UNPKG

@sutton-signwriting/sgnw-components

Version:

a javascript package of web components for use with the SignWriting script.

4 lines 11.7 kB
/*! * The Sutton SignWriting Web Components */ var t,n={exports:{}},s=(t||(t=1,function(t){let n={null:"S00000",symbol:"S[123][0-9a-f]{2}[0-5][0-9a-f]",coord:"[0-9]{3}x[0-9]{3}",sort:"A",box:"[BLMR]"};n.nullorsymbol=`(?:${n.null}|${n.symbol})`,n.prefix=`(?:${n.sort}${n.nullorsymbol}+)`,n.spatial=`${n.symbol}${n.coord}`,n.signbox=`${n.box}${n.coord}(?:${n.spatial})*`,n.sign=`${n.prefix}?${n.signbox}`,n.sortable=`${n.prefix}${n.signbox}`;let s={null:"񀀀",symbol:"(?:(?:\ud8c0[\udc01-\udfff])|(?:[\ud8c1-\ud8fc][\udc00-\udfff])|(?:\ud8fd[\udc00-\udc80]))",coord:"(?:\ud836[\udc0c-\uddff]){2}",sort:"𝠀",box:"\ud836[\udc01-\udc04]"};s.nullorsymbol=`(?:${s.null}|${s.symbol})`,s.prefix=`(?:${s.sort}(?:${s.nullorsymbol})+)`,s.spatial=`${s.symbol}${s.coord}`,s.signbox=`${s.box}${s.coord}(?:${s.spatial})*`,s.sign=`${s.prefix}?${s.signbox}`,s.sortable=`${s.prefix}${s.signbox}`;const r=["101011","101021","101031","101041","101051","101061","101071","101081","101091","101101","101111","101121","101131","101141","102011","102021","102031","102041","102051","102061","102071","102081","102091","102101","102111","102121","102131","102141","102151","102161","103011","103021","103031","103041","103051","103061","103071","103081","103091","103101","103111","103121","103131","103141","103151","103161","103171","103181","103191","103201","103211","103221","103231","103241","103251","103261","103271","103281","103291","103301","103311","103321","103331","103341","103351","103361","103371","103381","104011","104021","104031","104041","104051","104061","104071","104081","105011","105021","105031","105041","105051","105061","105071","105081","105091","105101","105111","105121","105131","105141","105151","105161","105171","105181","105191","105201","105211","105221","105231","105241","105251","105261","105271","105281","105291","105301","105311","105321","105331","105341","105351","105361","105371","105381","105391","105401","105411","105421","105431","105441","105451","105461","105471","105481","105491","105501","105511","105521","105531","105541","105551","105561","105571","105581","106011","106021","106031","106041","106051","106061","106071","106081","106091","106101","106111","106121","106131","106141","106151","106161","106171","106181","106191","106201","106211","106221","106231","106241","106251","106261","106271","106281","106291","106301","107011","107021","107031","107041","107051","107061","107071","107081","107091","107101","107111","107121","107131","107141","107151","107161","107171","107181","107191","107201","107211","107221","108011","108021","108031","108041","108051","108061","108071","108081","108091","108101","108111","108121","108131","108141","108151","108161","108171","108181","108191","109011","109021","109031","109041","109051","109061","109071","109081","109091","109101","109111","109121","109131","109141","109151","109161","109171","109181","109191","109201","109211","109221","109231","109241","109251","109261","109271","109281","109291","109301","109311","109321","109331","109341","109351","109361","109371","109381","109391","109401","110011","110021","110031","110041","110051","110061","110071","110081","110091","110101","110111","110121","110131","110141","110151","110161","201011","201021","201031","201041","201051","201061","201071","201081","201091","201101","201111","201121","201131","201141","201151","201161","201171","202011","202012","202021","202022","202031","202041","202042","202051","202052","202061","202071","202081","202082","202091","202092","202101","202102","202111","202121","202131","203011","203012","203013","203014","203015","203021","203022","203031","203032","203041","203051","203052","203061","203062","203071","203072","203073","203081","203082","203083","203084","203091","203092","203093","203101","203102","203103","203111","203112","203113","203121","203122","203123","203131","203141","203151","203161","203171","203181","203191","203201","203202","203203","204011","204012","204013","204014","204021","204022","204023","204024","204031","204032","204033","204034","204041","204042","204043","204044","205011","205012","205013","205014","205015","205021","205022","205031","205032","205041","205051","205052","205061","205062","205071","205081","205082","205083","205091","205101","205102","205103","205111","205112","205113","205121","205122","205123","205131","205141","205151","205161","205171","205181","205191","206011","206012","206013","206014","206021","206022","206023","206024","206031","206032","206041","206042","206043","206051","206052","206053","206054","206061","206062","206063","206064","206065","206066","206071","206072","206073","206081","206091","206101","206111","207011","207021","207031","207041","207051","207061","207071","207091","207101","207111","207121","207131","207141","207151","207161","207162","207163","208011","208012","208021","208022","208023","208024","208031","208032","208033","208034","208041","208042","208051","208061","208071","208081","208082","208091","208092","208093","208094","208101","208102","208103","208104","208111","208112","208121","208131","208141","209011","209012","209013","209014","209015","209021","209031","209041","209042","209043","209051","209061","209071","209081","210011","210012","210021","210022","210031","210032","210033","210041","210042","210043","210051","210052","210061","210062","210071","210072","210073","210074","210081","210082","301011","301021","301031","301032","301041","301042","301043","301044","401011","401021","401031","401041","401051","401061","401071","401081","401091","401101","401102","402011","402012","402013","402021","402022","402023","402024","402031","402032","402033","402041","402042","402043","402044","402045","402051","402052","402053","402054","402055","402061","402062","402063","402071","402072","402073","402081","402082","402083","402091","402101","402111","403011","403012","403013","403021","403022","403023","403031","403041","403042","403043","403044","403051","403052","403061","403062","403071","403072","404011","404012","404013","404021","404022","404023","404031","404032","404033","404041","404042","404043","404051","404052","404053","404061","404062","404063","404071","404072","404073","404081","404082","404083","404091","404092","404093","404101","404111","404112","405011","405012","405013","405014","405015","405021","405031","405041","405051","405052","405061","405062","405071","405072","405081","405091","405101","405111","405121","405131","501011","501021","501031","501041","501051","501061","501071","501081","501091","502011","502021","502022","502023","502024","502031","502032","502033","502041","601011","601012","601021","601031","601041","601051","601061","601071","701011","701012","701021","701022","701031"],e=t=>({A:"𝠀",B:"𝠁",L:"𝠂",M:"𝠃",R:"𝠄"}[t]),l=t=>parseInt(t.codePointAt(0))-120844+250,q=t=>String.fromCodePoint(120844+parseInt(t)-250),o=t=>[l(t.slice(0,2)),l(t.slice(2,4))],a=t=>t.map((t=>q(t))).join(""),d=t=>t.split("x").map((t=>parseInt(t))),g=t=>parseInt(t.codePointAt(0)),p=t=>String.fromCodePoint(t),u=t=>{if("񀀀"===t)return"S00000";const n=g(t)-262145,s=parseInt(n/96),r=parseInt((n-96*s)/16),e=parseInt(n-96*s-16*r);return"S"+(s+256).toString(16)+r.toString(16)+e.toString(16)},$=t=>p("S00000"===t?262144:262145+96*(parseInt(t.slice(1,4),16)-256)+16*parseInt(t.slice(4,5),16)+parseInt(t.slice(5,6),16)),v=t=>{if(!/^\d{6}(?:\d{3})?$/.test(t))return"";let n=`0${t.charAt(0)}-${t.charAt(1)}${t.charAt(2)}-0${t.charAt(3)}${t.charAt(4)}-0${t.charAt(5)}`;return t.length>6&&(n+=`-0${t.charAt(6)}-${t.charAt(7)}${t.charAt(8)}`),n};t.code2swu=p,t.coord2fsw=t=>t.join("x"),t.coord2swu=a,t.fsw2coord=d,t.fsw2swu=t=>{if(!t)return"";const s=t.match(new RegExp(n.prefix,"g"));s&&s.forEach((function(n){t=t.replace(n,"𝠀"+n.slice(1).match(/.{6}/g).map((t=>$(t))).join(""))}));const r=t.match(new RegExp(n.box+n.coord,"g"));r&&r.forEach((function(n){t=t.replace(n,e(n.slice(0,1))+a(d(n.slice(1,8))))}));const l=t.match(new RegExp(n.spatial,"g"));return l&&l.forEach((function(n){t=t.replace(n,$(n.slice(0,6))+a(d(n.slice(6,13))))})),t},t.id2key=t=>{if(0===t)return"S00000";const n=t-1,s=parseInt(n/96),r=parseInt((n-96*s)/16),e=parseInt(n-96*s-16*r);return"S"+(s+256).toString(16)+r.toString(16)+e.toString(16)},t.id2swu=t=>p(t+262144),t.key2id=t=>"S00000"===t?0:1+96*(parseInt(t.slice(1,4),16)-256)+16*parseInt(t.slice(4,5),16)+parseInt(t.slice(5,6),16),t.key2swu=$,t.key2symid=t=>{const n=t.match(/^S([1-3][0-9a-f]{2})(?:([0-5])([0-9a-f]))?$/);if(!n)return"";const s=parseInt(n[1],16)-256;return s>=r.length?"":n[3]?v(r[s])+"-0"+(1+parseInt(n[2]))+"-"+(parseInt(n[3],16)+1).toString().padStart(2,"0"):v(r[s])},t.mark2swu=e,t.num2swu=q,t.swu2code=g,t.swu2coord=o,t.swu2fsw=t=>{if(!t)return"";let n=t.replace(/𝠀/g,"A").replace(/𝠁/g,"B").replace(/𝠂/g,"L").replace(/𝠃/g,"M").replace(/𝠄/g,"R");const r=n.match(new RegExp(s.nullorsymbol,"g"));r&&r.forEach((function(t){n=n.replace(t,u(t))}));const e=n.match(new RegExp(s.coord,"g"));return e&&e.forEach((function(t){n=n.replace(t,o(t).join("x"))})),n},t.swu2id=t=>g(t)-262144,t.swu2key=u,t.swu2mark=t=>({"𝠀":"A","𝠁":"B","𝠂":"L","𝠃":"M","𝠄":"R"}[t]),t.swu2num=l,t.symid2key=t=>{const n=t.match(/^0(\d)-(\d{2})-0(\d{2})-0(\d)(?:-0(\d)-(\d{2}))?$/);if(!n)return"";const s=r.indexOf(n[1]+n[2]+n[3]+n[4]);return-1===s?"":n[5]?"S"+(256+s).toString(16)+(parseInt(n[5],10)-1)+(parseInt(n[6],10)-1).toString(16):"S"+(256+s).toString(16)},t.symidArr=r,t.symidMax=v,t.symidMin=t=>{const n=t.match(/^0(\d)-(\d{2})-0(\d{2})-0(\d)(?:-0(\d)-(\d{2}))?$/);return n?n[5]?n[1]+n[2]+n[3]+n[4]+n[5]+n[6]:n[1]+n[2]+n[3]+n[4]:""},Object.defineProperty(t,"__esModule",{value:!0})}(n.exports)),n.exports);const r="<svg viewBox='0 0 1792 1792' xmlns='http://www.w3.org/2000/svg'><path d='M1472 992v480q0 26-19 45t-45 19h-384v-384h-256v384h-384q-26 0-45-19t-19-45v-480q0-1 .5-3t.5-3l575-474 575 474q1 2 1 6zm223-69l-62 74q-8 9-21 11h-3q-13 0-21-7l-692-577-692 577q-12 8-24 7-13-2-21-11l-62-74q-8-10-7-23.5t11-21.5l719-599q32-26 76-26t76 26l244 204v-195q0-14 9-23t23-9h192q14 0 23 9t9 23v408l219 182q10 8 11 21.5t-7 23.5z'></path></svg>",e="<svg viewBox='0 0 1792 1792' xmlns='http://www.w3.org/2000/svg'><path d='M1683 1331l-166 165q-19 19-45 19t-45-19l-531-531-531 531q-19 19-45 19t-45-19l-166-165q-19-19-19-45.5t19-45.5l742-741q19-19 45-19t45 19l742 741q19 19 19 45.5t-19 45.5z'/></svg>",l="<svg viewBox='0 0 1792 1792' xmlns='http://www.w3.org/2000/svg'><path d='M1675 971q0 51-37 90l-75 75q-38 38-91 38-54 0-90-38l-294-293v704q0 52-37.5 84.5t-90.5 32.5h-128q-53 0-90.5-32.5t-37.5-84.5v-704l-294 293q-36 38-90 38t-90-38l-75-75q-38-38-38-90 0-53 38-91l651-651q35-37 90-37 54 0 91 37l651 651q37 39 37 91z'/></svg>",q="<svg viewBox='0 0 1792 1792' xmlns='http://www.w3.org/2000/svg'><path d='M1675 832q0 53-37 90l-651 652q-39 37-91 37-53 0-90-37l-651-652q-38-36-38-90 0-53 38-91l74-75q39-37 91-37 53 0 90 37l294 294v-704q0-52 38-90t90-38h128q52 0 90 38t38 90v704l294-294q37-37 90-37 52 0 91 37l75 75q37 39 37 91z'/></svg>",o="<svg viewBox='0 0 1792 1792' xmlns='http://www.w3.org/2000/svg'><path d='M1664 896v128q0 53-32.5 90.5t-84.5 37.5h-704l293 294q38 36 38 90t-38 90l-75 76q-37 37-90 37-52 0-91-37l-651-652q-37-37-37-90 0-52 37-91l651-650q38-38 91-38 52 0 90 38l75 74q38 38 38 91t-38 91l-293 293h704q52 0 84.5 37.5t32.5 90.5z'/></svg>",a="<svg viewBox='0 0 1792 1792' xmlns='http://www.w3.org/2000/svg'><path d='M1600 960q0 54-37 91l-651 651q-39 37-91 37-51 0-90-37l-75-75q-38-38-38-91t38-91l293-293h-704q-52 0-84.5-37.5t-32.5-90.5v-128q0-53 32.5-90.5t84.5-37.5h704l-293-294q-38-36-38-90t38-90l75-75q38-38 90-38 53 0 91 38l651 651q37 35 37 90z'/></svg>";export{o as A,e as C,r as H,a,l as b,s as c,q as d}