palt-typesetting 0.1.11 → 0.2.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/README.md +54 -8
- package/bundle/typesetter.min.js +6 -0
- package/bundle/typesetter.min.js.map +7 -0
- package/dist/apply-style.js +1 -1
- package/dist/apply-style.js.map +1 -1
- package/dist/bundle.d.ts +2 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js.map +1 -0
- package/dist/insert-separators.d.ts +2 -2
- package/dist/insert-separators.d.ts.map +1 -1
- package/dist/insert-separators.js +8 -6
- package/dist/insert-separators.js.map +1 -1
- package/dist/utils-regex.d.ts.map +1 -1
- package/dist/utils-regex.js +1 -1
- package/dist/utils-regex.js.map +1 -1
- package/dist/utils-tags.d.ts +3 -3
- package/dist/utils-tags.d.ts.map +1 -1
- package/dist/utils-tags.js +16 -12
- package/dist/utils-tags.js.map +1 -1
- package/package.json +10 -7
package/README.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
## Typesetting Library for Proportional Spacing
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
Palt Typesetting は、美しいテキスト表示を実現するための JavaScript ライブラリです。和欧混植、およびツメ組み (`font-feature-settings: 'palt'`) の版面設計において、最大限の力を発揮します。
|
|
6
8
|
|
|
7
9
|
四分アキの自動挿入、カーニングルールの適用、英語のような単語区切りでの改行など、洗練された組版機能を提供します。
|
|
8
10
|
|
|
@@ -29,23 +31,67 @@ const typesetter = new Typesetter()
|
|
|
29
31
|
typesetter.renderToSelector('.my-class')
|
|
30
32
|
```
|
|
31
33
|
|
|
32
|
-
###
|
|
34
|
+
### Use Typesetter from CDN
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<script src="https://unpkg.com/palt-typesetting@0.2.1/bundle/typesetter.min.js"></script>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```html
|
|
41
|
+
<script>
|
|
42
|
+
// Typesetter のインスタンスを作成
|
|
43
|
+
const typesetter = new Typesetter()
|
|
44
|
+
|
|
45
|
+
// セレクターにマッチする要素に対して組版を適用
|
|
46
|
+
typesetter.renderToSelector('.my-class')
|
|
47
|
+
</script>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Apply CSS (Example)
|
|
33
51
|
|
|
34
52
|
```css
|
|
35
|
-
/*
|
|
53
|
+
/*
|
|
54
|
+
* 共通のスタイリング
|
|
55
|
+
*/
|
|
36
56
|
.typeset {
|
|
57
|
+
/* プロポーショナルメトリクス(ツメ組み)の設定 */
|
|
37
58
|
font-feature-settings: 'palt';
|
|
38
|
-
|
|
59
|
+
|
|
60
|
+
/* 行間 */
|
|
39
61
|
line-height: 1.8;
|
|
62
|
+
|
|
63
|
+
/* 文字間 */
|
|
64
|
+
letter-spacing: 0.1em;
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
* Safari のフォントレンダリング対策。
|
|
68
|
+
* 英数(.typeset-latin)で -webkit-text-stroke を使う場合は必須。
|
|
69
|
+
* text-stroke-weight > 0, text-stroke-color: transparent
|
|
70
|
+
*/
|
|
71
|
+
-webkit-text-stroke: 0.01em transparent;
|
|
40
72
|
}
|
|
41
73
|
|
|
42
|
-
/*
|
|
74
|
+
/*
|
|
75
|
+
* 英数のみのスタイリング
|
|
76
|
+
*/
|
|
43
77
|
.typeset-latin {
|
|
78
|
+
/* フォントの拡大・縮小 */
|
|
79
|
+
font-size: 105%;
|
|
80
|
+
|
|
81
|
+
/* ベースラインの調整 */
|
|
82
|
+
vertical-align: 0.02em;
|
|
83
|
+
|
|
84
|
+
/*
|
|
85
|
+
* 行間の調整。親要素 .typeset の行間と視覚的に合わせます。
|
|
86
|
+
* [.typeset の line-height] ÷ [フォントの拡大率] - [ベースラインの調整値の絶対値] × 2
|
|
87
|
+
*/
|
|
88
|
+
line-height: calc(1.8 / 1.05 - 0.02 * 2);
|
|
89
|
+
|
|
90
|
+
/* 文字間の調整 */
|
|
44
91
|
letter-spacing: 0.05em;
|
|
45
92
|
|
|
46
|
-
/*
|
|
47
|
-
|
|
48
|
-
line-height: calc(1.8 / 1.05);
|
|
93
|
+
/* 文字の細らせ・太らせ */
|
|
94
|
+
-webkit-text-stroke: 0.01em #000;
|
|
49
95
|
}
|
|
50
96
|
```
|
|
51
97
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";var Typesetter=(()=>{var x=(s,a)=>()=>(a||s((a={exports:{}}).exports,a),a.exports);var Q=x(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});var at=window;G.default=at});var ge=x(L=>{"use strict";var it=L&&L.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(L,"__esModule",{value:!0});L.getTextNodes=L.parseFromString=void 0;var V=it(Q()),J=class{constructor(a,n){this.replaceNode=(i,o)=>{let c=V.default.document.createRange();c.selectNode(i);let d=c.createContextualFragment(o);i.parentNode&&(i.parentNode.insertBefore(d,i),i.parentNode.removeChild(i))},this.transformFunctions=a,this.options=n}processHtmlWithFunctions(a){return a===""?a:this.transformFunctions.reduce((n,i)=>this.processHtml(n,i),a)}processHtml(a,n){if(a==="")return a;let i=pe(a),o=be(i.body);return o.forEach((c,d)=>{let h=o[d+1]||null,p=this.getTransformedHtml(c,h,n);this.replaceNode(c,p)}),i.body.innerHTML}getTransformedHtml(a,n,i){return i(a.nodeValue||"",n&&n.nodeValue||"",this.options)}},pe=s=>new V.default.DOMParser().parseFromString(s,"text/html");L.parseFromString=pe;var be=s=>{let a=V.default.document.createTreeWalker(s,V.default.NodeFilter.SHOW_TEXT),n=a.nextNode(),i=[];for(;n;)n.nodeValue&&n.nodeValue.trim()!==""&&i.push(n),n=a.nextNode();return i};L.getTextNodes=be;L.default=J});var me=x((gr,Le)=>{var te=0,Se=-3;function k(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function ot(s,a){this.source=s,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=a,this.destLen=0,this.ltree=new k,this.dtree=new k}var $e=new k,Ae=new k,re=new Uint8Array(30),se=new Uint16Array(30),we=new Uint8Array(30),Te=new Uint16Array(30),ct=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),xe=new k,T=new Uint8Array(320);function _e(s,a,n,i){var o,c;for(o=0;o<n;++o)s[o]=0;for(o=0;o<30-n;++o)s[o+n]=o/n|0;for(c=i,o=0;o<30;++o)a[o]=c,c+=1<<s[o]}function ft(s,a){var n;for(n=0;n<7;++n)s.table[n]=0;for(s.table[7]=24,s.table[8]=152,s.table[9]=112,n=0;n<24;++n)s.trans[n]=256+n;for(n=0;n<144;++n)s.trans[24+n]=n;for(n=0;n<8;++n)s.trans[168+n]=280+n;for(n=0;n<112;++n)s.trans[176+n]=144+n;for(n=0;n<5;++n)a.table[n]=0;for(a.table[5]=32,n=0;n<32;++n)a.trans[n]=n}var ve=new Uint16Array(16);function Y(s,a,n,i){var o,c;for(o=0;o<16;++o)s.table[o]=0;for(o=0;o<i;++o)s.table[a[n+o]]++;for(s.table[0]=0,c=0,o=0;o<16;++o)ve[o]=c,c+=s.table[o];for(o=0;o<i;++o)a[n+o]&&(s.trans[ve[a[n+o]]++]=o)}function lt(s){s.bitcount--||(s.tag=s.source[s.sourceIndex++],s.bitcount=7);var a=s.tag&1;return s.tag>>>=1,a}function _(s,a,n){if(!a)return n;for(;s.bitcount<24;)s.tag|=s.source[s.sourceIndex++]<<s.bitcount,s.bitcount+=8;var i=s.tag&65535>>>16-a;return s.tag>>>=a,s.bitcount-=a,i+n}function ee(s,a){for(;s.bitcount<24;)s.tag|=s.source[s.sourceIndex++]<<s.bitcount,s.bitcount+=8;var n=0,i=0,o=0,c=s.tag;do i=2*i+(c&1),c>>>=1,++o,n+=a.table[o],i-=a.table[o];while(i>=0);return s.tag=c,s.bitcount-=o,a.trans[n+i]}function ut(s,a,n){var i,o,c,d,h,p;for(i=_(s,5,257),o=_(s,5,1),c=_(s,4,4),d=0;d<19;++d)T[d]=0;for(d=0;d<c;++d){var g=_(s,3,0);T[ct[d]]=g}for(Y(xe,T,0,19),h=0;h<i+o;){var H=ee(s,xe);switch(H){case 16:var I=T[h-1];for(p=_(s,2,3);p;--p)T[h++]=I;break;case 17:for(p=_(s,3,3);p;--p)T[h++]=0;break;case 18:for(p=_(s,7,11);p;--p)T[h++]=0;break;default:T[h++]=H;break}}Y(a,T,0,i),Y(n,T,i,o)}function ye(s,a,n){for(;;){var i=ee(s,a);if(i===256)return te;if(i<256)s.dest[s.destLen++]=i;else{var o,c,d,h;for(i-=257,o=_(s,re[i],se[i]),c=ee(s,n),d=s.destLen-_(s,we[c],Te[c]),h=d;h<d+o;++h)s.dest[s.destLen++]=s.dest[h]}}}function dt(s){for(var a,n,i;s.bitcount>8;)s.sourceIndex--,s.bitcount-=8;if(a=s.source[s.sourceIndex+1],a=256*a+s.source[s.sourceIndex],n=s.source[s.sourceIndex+3],n=256*n+s.source[s.sourceIndex+2],a!==(~n&65535))return Se;for(s.sourceIndex+=4,i=a;i;--i)s.dest[s.destLen++]=s.source[s.sourceIndex++];return s.bitcount=0,te}function ht(s,a){var n=new ot(s,a),i,o,c;do{switch(i=lt(n),o=_(n,2,0),o){case 0:c=dt(n);break;case 1:c=ye(n,$e,Ae);break;case 2:ut(n,n.ltree,n.dtree),c=ye(n,n.ltree,n.dtree);break;default:c=Se}if(c!==te)throw new Error("Data error")}while(!i);return n.destLen<n.dest.length?typeof n.dest.slice=="function"?n.dest.slice(0,n.destLen):n.dest.subarray(0,n.destLen):n.dest}ft($e,Ae);_e(re,se,4,3);_e(we,Te,2,1);re[28]=0;se[28]=258;Le.exports=ht});var He=x((xr,Pe)=>{var pt=new Uint8Array(new Uint32Array([305419896]).buffer)[0]===18,Ne=(s,a,n)=>{let i=s[a];s[a]=s[n],s[n]=i},bt=s=>{let a=s.length;for(let n=0;n<a;n+=4)Ne(s,n,n+3),Ne(s,n+1,n+2)},gt=s=>{pt&&bt(s)};Pe.exports={swap32LE:gt}});var Xe=x((vr,Fe)=>{var Be=me(),{swap32LE:xt}=He(),ie=11,P=5,vt=ie-P,yt=65536>>ie,St=1<<vt,$t=St-1,E=2,At=1<<P,ne=At-1,Ce=65536>>P,wt=1024>>P,Tt=Ce+wt,_t=Tt,Lt=32,mt=_t+Lt,Nt=1<<E,ae=class{constructor(a){let n=typeof a.readUInt32BE=="function"&&typeof a.slice=="function";if(n||a instanceof Uint8Array){let i;if(n)this.highStart=a.readUInt32LE(0),this.errorValue=a.readUInt32LE(4),i=a.readUInt32LE(8),a=a.slice(12);else{let o=new DataView(a.buffer);this.highStart=o.getUint32(0,!0),this.errorValue=o.getUint32(4,!0),i=o.getUint32(8,!0),a=a.subarray(12)}a=Be(a,new Uint8Array(i)),a=Be(a,new Uint8Array(i)),xt(a),this.data=new Uint32Array(a.buffer)}else({data:this.data,highStart:this.highStart,errorValue:this.errorValue}=a)}get(a){let n;return a<0||a>1114111?this.errorValue:a<55296||a>56319&&a<=65535?(n=(this.data[a>>P]<<E)+(a&ne),this.data[n]):a<=65535?(n=(this.data[Ce+(a-55296>>P)]<<E)+(a&ne),this.data[n]):a<this.highStart?(n=this.data[mt-yt+(a>>ie)],n=this.data[n+(a>>P&$t)],n=(n<<E)+(a&ne),this.data[n]):this.data[this.data.length-Nt]}};Fe.exports=ae});var Oe=x(R=>{var Pt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(s){"use strict";var a=typeof Uint8Array!="undefined"?Uint8Array:Array,n=43,i=47,o=48,c=97,d=65,h=45,p=95;function g(u){var l=u.charCodeAt(0);if(l===n||l===h)return 62;if(l===i||l===p)return 63;if(l<o)return-1;if(l<o+10)return l-o+26+26;if(l<d+26)return l-d;if(l<c+26)return l-c+26}function H(u){var l,W,A,b,m,S;if(u.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var j=u.length;m=u.charAt(j-2)==="="?2:u.charAt(j-1)==="="?1:0,S=new a(u.length*3/4-m),A=m>0?u.length-4:u.length;var N=0;function B(nt){S[N++]=nt}for(l=0,W=0;l<A;l+=4,W+=3)b=g(u.charAt(l))<<18|g(u.charAt(l+1))<<12|g(u.charAt(l+2))<<6|g(u.charAt(l+3)),B((b&16711680)>>16),B((b&65280)>>8),B(b&255);return m===2?(b=g(u.charAt(l))<<2|g(u.charAt(l+1))>>4,B(b&255)):m===1&&(b=g(u.charAt(l))<<10|g(u.charAt(l+1))<<4|g(u.charAt(l+2))>>2,B(b>>8&255),B(b&255)),S}function I(u){var l,W=u.length%3,A="",b,m;function S(N){return Pt.charAt(N)}function j(N){return S(N>>18&63)+S(N>>12&63)+S(N>>6&63)+S(N&63)}for(l=0,m=u.length-W;l<m;l+=3)b=(u[l]<<16)+(u[l+1]<<8)+u[l+2],A+=j(b);switch(W){case 1:b=u[u.length-1],A+=S(b>>2),A+=S(b<<4&63),A+="==";break;case 2:b=(u[u.length-2]<<8)+u[u.length-1],A+=S(b>>10),A+=S(b>>4&63),A+=S(b<<2&63),A+="=";break}return A}s.toByteArray=H,s.fromByteArray=I})(typeof R=="undefined"?R.base64js={}:R)});var Re=x((Sr,Ee)=>{var Ht=Xe(),Bt=Oe();function ze(s){return s&&s.__esModule?s.default:s}var Ct=5,Ie=12,Ft=13,Xt=16,Ot=17,It=22,We=28,ke=31,Wt=33,q=34,kt=35,oe=36,ce=37,je=38,Dt=39,Ut=40,D=41,zt=42,e=0,t=1,f=2,Ve=3,r=4,jt=[[r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,Ve,r,r,r,r,r,r,r,r,r,r,r],[e,r,r,t,t,r,r,r,r,t,t,e,e,e,e,t,t,t,e,e,r,f,r,e,e,e,e,e,e,e,e,t,e],[e,r,r,t,t,r,r,r,r,t,t,t,t,t,e,t,t,t,e,e,r,f,r,e,e,e,e,e,e,e,e,t,e],[r,r,r,t,t,t,r,r,r,t,t,t,t,t,t,t,t,t,t,t,r,f,r,t,t,t,t,t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Ep+rHvPMXbr+sHVb/lnL+pTP57jPw9Cvk3PW178JD9qChfzuvTf7Htl38L1QUf/VKu9SFjwWbTWPvFEvu7Uq76y7+31g6QlYPc669pbsm9Xur2LWI9Pu8ypfDXqm3A2z8s1FWGn4ntL9NfQu2oSlftX9uetvTtv7J8Ql4zxfXGZ3zk8PeQ9w59x2uMfqI8/q5eKh/l9cb2rwsu9rSNl06ZP2Pmxtz+rNMx93yno0n2/82rVH7rQ+y9P15H6FyRun9ViH81ATmffI7nJ5r8uXXW6enbP6b/B8/l5OifVHYLnb9S39s2zcc+Ph+rh8+eQgVPS72elzGWY/tUtbbabBpDiI7yN1q6/4th2y+ErAc5+9BVvu/7KamJbWNZeuqI/R4tRf+YyD1HmOZM1bMV3/14Sn10c0Xu+Sj1nOXb5jL73ncdy02uvlXZNde65dOHYl7Vs4KYuS6FzWLn2zJlpZqPXPVPOa5yzKOyn1VhT9lmMfdbfH7D11Wf2PXN5h9y+dD287+qxgSnaYmnIrRtIb8pJe6/Uv9OVer6Whn0zfGO/BEloZI9ojmfAlUflClDd178bTmVHVTpZXOkAlk/lb42UujmI89HH5V+cl7XtowY6vTxLVWok6UrGzoGTHN+bB+6ri05687VNpvfuvRfaP2uMlNQth1D5JjGelm/8yn+9p3p/7qk9gnfeddXZmq/Sm333PJT659Kv1zjNbZ9uv2Oi//67CV8/N1nj1DmviyXDNVeJkaeaX8UsyesYg8cu2+NvdaPfb+lLDu5tvt/"),Et=new(ze(Ht))(Vt),De=function(s){switch(s){case Wt:return Ie;case Dt:case Ut:case zt:return Ie;case kt:return Ct;default:return s}},Ue=function(s){switch(s){case ce:case je:return q;case D:return It;default:return s}},U=class{constructor(a,n=!1){this.position=a,this.required=n}},fe=class{nextCodePoint(){let a=this.string.charCodeAt(this.pos++),n=this.string.charCodeAt(this.pos);return 55296<=a&&a<=56319&&56320<=n&&n<=57343?(this.pos++,(a-55296)*1024+(n-56320)+65536):a}nextCharClass(){return De(Et.get(this.nextCodePoint()))}getSimpleBreak(){switch(this.nextClass){case D:return!1;case q:case ce:case je:return this.curClass=q,!1;case oe:return this.curClass=oe,!1}return null}getPairTableBreak(a){let n=!1;switch(jt[this.curClass][this.nextClass]){case e:n=!0;break;case t:n=a===D;break;case f:if(n=a===D,!n)return n=!1,n;break;case Ve:if(a!==D)return n;break;case r:break}return this.LB8a&&(n=!1),this.LB21a&&(this.curClass===Xt||this.curClass===Ot)?(n=!1,this.LB21a=!1):this.LB21a=this.curClass===Ft,this.curClass===We?(this.LB30a++,this.LB30a==2&&this.nextClass===We&&(n=!0,this.LB30a=0)):this.LB30a=0,this.curClass=this.nextClass,n}nextBreak(){if(this.curClass==null){let a=this.nextCharClass();this.curClass=Ue(a),this.nextClass=a,this.LB8a=a===ke,this.LB30a=0}for(;this.pos<this.string.length;){this.lastPos=this.pos;let a=this.nextClass;if(this.nextClass=this.nextCharClass(),this.curClass===q||this.curClass===oe&&this.nextClass!==ce)return this.curClass=Ue(De(this.nextClass)),new U(this.lastPos,!0);let n=this.getSimpleBreak();if(n===null&&(n=this.getPairTableBreak(a)),this.LB8a=this.nextClass===ke,n)return new U(this.lastPos)}return this.lastPos<this.string.length?(this.lastPos=this.string.length,new U(this.string.length)):null}constructor(a){this.string=a,this.pos=0,this.lastPos=0,this.curClass=null,this.nextClass=null,this.LB8a=!1,this.LB21a=!1,this.LB30a=0}};Ee.exports=fe});var qe=x(v=>{"use strict";Object.defineProperty(v,"__esModule",{value:!0});v.noBreakRulesRegex=v.middleDotsRegex=v.closingsRegex=v.openingsRegex=v.japaneseRegex=v.latinRegex=void 0;v.latinRegex=/[\p{scx=Latin}0-9!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~]+/u;v.japaneseRegex=/[\p{scx=Hiragana}\p{scx=Katakana}|ヲ-゚\p{scx=Han}]+/u;v.openingsRegex=/(|[|{|〔|〈|《|「|『|【|〘|〖|“|‘/;v.closingsRegex=/)|]|}|〕|〉|》|」|』|】|〙|〗|”|’|、|,|。|./;v.middleDotsRegex=/・|:|;/;v.noBreakRulesRegex=new RegExp("[\u2014\u2025\u2026\uFF3F\u2500-\u257F]+")});var le=x(w=>{"use strict";var Rt=w&&w.__createBinding||(Object.create?function(s,a,n,i){i===void 0&&(i=n);var o=Object.getOwnPropertyDescriptor(a,n);(!o||("get"in o?!a.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return a[n]}}),Object.defineProperty(s,i,o)}:function(s,a,n,i){i===void 0&&(i=n),s[i]=a[n]}),qt=w&&w.__setModuleDefault||(Object.create?function(s,a){Object.defineProperty(s,"default",{enumerable:!0,value:a})}:function(s,a){s.default=a}),Mt=w&&w.__importStar||function(s){if(s&&s.__esModule)return s;var a={};if(s!=null)for(var n in s)n!=="default"&&Object.prototype.hasOwnProperty.call(s,n)&&Rt(a,s,n);return qt(a,s),a};Object.defineProperty(w,"__esModule",{value:!0});w.LanguageClass=w.CharClass=void 0;var F=Mt(qe()),Kt={shouldNotBreak:s=>F.noBreakRulesRegex.test(s),shouldAddThinSpace:(s,a)=>{let n={openings:{regex:F.openingsRegex,hasSpaceBefore:!0,hasSpaceAfter:!1},closings:{regex:F.closingsRegex,hasSpaceBefore:!1,hasSpaceAfter:!0},middleDots:{regex:F.middleDotsRegex,hasSpaceBefore:!0,hasSpaceAfter:!0}};for(let{regex:i,hasSpaceBefore:o,hasSpaceAfter:c}of Object.values(n))if(o&&i.test(a)&&!i.test(s)||c&&i.test(s)&&!i.test(a))return!0;return!1}};w.CharClass=Kt;var C={isLatin:s=>F.latinRegex.test(s),isJapanese:s=>F.japaneseRegex.test(s),isDifferentLanguageClass:(s,a)=>C.isJapanese(s)&&C.isLatin(a)||C.isLatin(s)&&C.isJapanese(a),shouldAddThinSpace:(s,a)=>C.isDifferentLanguageClass(s,a)};w.LanguageClass=C});var ue=x(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.applyNoBreakStyle=y.applyLatinStyle=y.applyWrapperStyle=y.createKerningSpan=y.createThinSpaceSpan=y.wbr=void 0;var X={styles:{preventSelect:"user-select:none;"},attributes:{hiddenFromReader:'aria-hidden="true"',noIndex:'data-nosnippet=""'}},Zt="<wbr>";y.wbr=Zt;var Gt=(s,a)=>{let n="\u2009",i=a+"-thin-space",o=`font-size: ${s}; ${X.styles.preventSelect}`;return`<span class="${i}" style="${o}" ${X.attributes.hiddenFromReader} ${X.attributes.noIndex}>${n}</span>`};y.createThinSpaceSpan=Gt;var Qt=(s,a)=>{let n=s/1e3/2+"em",i=a+"-kerning",o=`margin: ${n}; ${X.styles.preventSelect}`;return`<span class="${i}" style="${o}" ${X.attributes.hiddenFromReader} ${X.attributes.noIndex}></span>`};y.createKerningSpan=Qt;var Jt=(s,a,n)=>`<span class="${a}" style="${n?"word-break: keep-all; overflow-wrap: anywhere;":""}">${s}</span>`;y.applyWrapperStyle=Jt;var Yt=(s,a)=>`<span class="${a+"-latin"}">${s}</span>`;y.applyLatinStyle=Yt;var er=(s,a)=>`<span class="${a+"-no-breaks"}" style="letter-spacing: 0">${s}</span>`;y.applyNoBreakStyle=er});var Je=x($=>{"use strict";var tr=$&&$.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty($,"__esModule",{value:!0});$.shouldAddThinSpace=$.shouldAddWbr=$.addSeparatorsToSegment=$.createSegments=void 0;var rr=tr(Re()),Me=le(),Ke=ue(),sr=(s,a,n)=>{let i=de(s),o=de(a);return i.reduce((d,h,p,g)=>{let H=h,I=g[p+1]||o[0];return d+Ze(H,I,n)},"")},de=s=>{let a=new Intl.Segmenter("ja-JP",{granularity:"word"});return Array.from(a.segment(s),({segment:n})=>n)};$.createSegments=de;var Ze=(s,a="",n)=>{if(!a)return s;let i=n.useWordBreak&&Ge(s,a),o=n.insertThinSpaces&&Qe(s,a);return s+(o?(0,Ke.createThinSpaceSpan)(n.thinSpaceWidth,n.classNamePrefix):"")+(i?Ke.wbr:"")};$.addSeparatorsToSegment=Ze;var Ge=(s,a)=>{let n=s.slice(-1)+a.slice(0,1),o=new rr.default(n).nextBreak();return o&&o.position===1};$.shouldAddWbr=Ge;var Qe=(s,a)=>Me.LanguageClass.shouldAddThinSpace(s,a)||Me.CharClass.shouldAddThinSpace(s,a);$.shouldAddThinSpace=Qe;$.default=sr});var et=x(O=>{"use strict";Object.defineProperty(O,"__esModule",{value:!0});O.applyStyleToSegment=O.applyStyleToText=void 0;var Ye=le(),M=ue(),nr=(s,a,n)=>s===" "?s:(0,M.applyWrapperStyle)(s,n.classNamePrefix,n.useWordBreak);O.applyStyleToText=nr;var ar=(s,a,n)=>{if(s===" ")return s;let i=ir(s,a,n);return n.wrapLatin&&Ye.LanguageClass.isLatin(s)?(0,M.applyLatinStyle)(i,n.classNamePrefix):n.noSpaceBetweenNoBreaks&&Ye.CharClass.shouldNotBreak(s)?(0,M.applyNoBreakStyle)(i,n.classNamePrefix):i};O.applyStyleToSegment=ar;var ir=(s,a,n)=>{let i=[...s];return i.map((c,d)=>{let h=i[d+1]||a[0]||"",p=n.kerningRules.find(g=>g.between[0]===c&&g.between[1]===h);if(p){let g=typeof p.value=="number"?p.value:parseInt(p.value,10);return c+(0,M.createKerningSpan)(g,n.classNamePrefix)}return c}).join("")}});var rt=x(z=>{"use strict";var he=z&&z.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(z,"__esModule",{value:!0});var or=he(ge()),cr=he(Je()),tt=et(),fr=he(Q()),K=class s extends or.default{constructor(a={}){let n=[tt.applyStyleToText,cr.default,tt.applyStyleToSegment],i=s.validateOptions(a);super(n,i),this.isIntlSegmenterSupported=typeof Intl.Segmenter!="undefined",this.isIntlSegmenterSupported||console.warn(`
|
|
2
|
+
Intl.Segmenter is not supported in this environment.
|
|
3
|
+
The original HTML string will be returned.
|
|
4
|
+
For more information, see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter
|
|
5
|
+
`)}static validateOptions(a){return a.kerningRules&&(a.kerningRules=a.kerningRules.filter(s.isValidKerningRule)),Object.assign(Object.assign({},s.defaultOptions),a)}static isValidKerningRule(a){return a.between[0].length!==1||a.between[1].length!==1?(console.warn(`Kerning rule between '${a.between[0]}' and '${a.between[1]}' must be single characters.`),!1):!0}render(a){return!this.isIntlSegmenterSupported||!a?a:this.processHtmlWithFunctions(a)}renderToElements(a){!this.isIntlSegmenterSupported||!a||(Array.isArray(a)||(a=[a]),a.forEach(n=>{let i=this.render(n.innerHTML);n.innerHTML=i}))}renderToSelector(a){if(!this.isIntlSegmenterSupported||!a)return;let n=fr.default.document.querySelectorAll(a);this.renderToElements(Array.from(n))}};K.defaultOptions={classNamePrefix:"typeset",useWordBreak:!0,wrapLatin:!0,noSpaceBetweenNoBreaks:!0,insertThinSpaces:!0,thinSpaceWidth:"50%",kerningRules:[]};z.default=K});var dr=x((Z,st)=>{var lr=Z&&Z.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Z,"__esModule",{value:!0});var ur=lr(rt());st.exports=ur.default});return dr();})();
|
|
6
|
+
//# sourceMappingURL=typesetter.min.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/win-browser.ts", "../src/html-processor.ts", "../node_modules/tiny-inflate/index.js", "../node_modules/unicode-trie/swap.js", "../node_modules/unicode-trie/index.js", "../node_modules/base64-js/lib/b64.js", "../node_modules/linebreak/dist/src/linebreaker.js", "../node_modules/linebreak/dist/node_modules/@parcel/node-resolver-core/lib/_empty.js", "../node_modules/linebreak/dist/src/classes.js", "../node_modules/linebreak/dist/src/pairs.js", "../src/utils-regex.ts", "../src/utils-text-classes.ts", "../src/utils-tags.ts", "../src/insert-separators.ts", "../src/apply-style.ts", "../src/index.ts", "../src/bundle.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * \u30D6\u30E9\u30A6\u30B6\u74B0\u5883\u3067\u4F7F\u7528\u3055\u308C\u308B\u3001\u30B0\u30ED\u30FC\u30D0\u30EB\u306Awindow\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3092\u63D0\u4F9B\u3057\u307E\u3059\u3002\n *\n * @return \u30D6\u30E9\u30A6\u30B6\u306E\u30B0\u30ED\u30FC\u30D0\u30EBWindow\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3002\n */\nconst win = window\n\nexport default win\n", "import win from './win'\nimport type { TransformFunction, TypesettingOptions } from './types'\n\n/**\n * HTML\u30B3\u30F3\u30C6\u30F3\u30C4\u306E\u5909\u63DB\u3068\u51E6\u7406\u3092\u884C\u3046\u30AF\u30E9\u30B9\u3067\u3059\u3002\n * \u3053\u306E\u30AF\u30E9\u30B9\u306F\u3001HTML\u6587\u5B57\u5217\u3092\u89E3\u6790\u3057\u3001\u30AB\u30B9\u30BF\u30DE\u30A4\u30BA\u3055\u308C\u305F\u5909\u63DB\u95A2\u6570\u3092\u9069\u7528\u3057\u3066\u3001\n * \u5909\u63DB\u3055\u308C\u305F\u30B3\u30F3\u30C6\u30F3\u30C4\u3092\u751F\u6210\u3057\u307E\u3059\u3002\n */\nclass HTMLProcessor {\n private transformFunctions: TransformFunction[]\n private options: TypesettingOptions\n\n constructor(transformFunctions: TransformFunction[], options: TypesettingOptions) {\n this.transformFunctions = transformFunctions\n this.options = options\n }\n\n /**\n * \u4E0E\u3048\u3089\u308C\u305FHTML\u6587\u5B57\u5217\u306B\u5BFE\u3057\u3066\u3001\u6307\u5B9A\u3055\u308C\u305F\u5909\u63DB\u95A2\u6570\u306E\u914D\u5217\u3092\u9806\u756A\u306B\u9069\u7528\u3057\u3001\n * \u5909\u63DB\u3055\u308C\u305FHTML\u3092\u751F\u6210\u3057\u307E\u3059\u3002\n *\n * @param srcHtml - \u5909\u63DB\u3092\u9069\u7528\u3059\u308B\u5143\u306EHTML\u6587\u5B57\u5217\u3002\n * @param functions - \u9806\u756A\u306B\u9069\u7528\u3059\u308B\u5909\u63DB\u95A2\u6570\u306E\u914D\u5217\u3002\n * @return \u5909\u63DB\u5F8C\u306EHTML\u6587\u5B57\u5217\u3002\n */\n processHtmlWithFunctions(srcHtml: string): string {\n if (srcHtml === '') {\n return srcHtml\n }\n\n return this.transformFunctions.reduce(\n (currentHtml, transformFunction) => this.processHtml(currentHtml, transformFunction),\n srcHtml\n )\n }\n\n /**\n * HTML\u6587\u5B57\u5217\u3092\u89E3\u6790\u3057\u3001\u7279\u5B9A\u306E\u5909\u63DB\u95A2\u6570\u3092\u4F7F\u7528\u3057\u3066\u305D\u306E\u5185\u5BB9\u3092\u5909\u63DB\u3057\u3001\n * \u5909\u63DB\u3055\u308C\u305FHTML\u3092\u6587\u5B57\u5217\u3068\u3057\u3066\u8FD4\u3057\u307E\u3059\u3002\n *\n * @param html - \u89E3\u6790\u304A\u3088\u3073\u5909\u63DB\u3059\u308BHTML\u6587\u5B57\u5217\u3002\n * @param transformFunction - \u5404\u30C6\u30AD\u30B9\u30C8\u30CE\u30FC\u30C9\u306B\u9069\u7528\u3055\u308C\u308B\u5909\u63DB\u95A2\u6570\u3002\n * @return \u5909\u63DB\u5F8C\u306EHTML\u5185\u5BB9\u3092\u542B\u3080\u6587\u5B57\u5217\u3002\u30C6\u30AD\u30B9\u30C8\u304C\u7A7A\u306E\u5834\u5408\u306F\u3001\u305D\u306E\u307E\u307E\u8FD4\u3055\u308C\u307E\u3059\u3002\n */\n private processHtml(html: string, transformFunction: TransformFunction): string {\n if (html === '') {\n return html\n }\n\n const doc = parseFromString(html)\n const textNodes = getTextNodes(doc.body)\n\n textNodes.forEach((currentNode, index) => {\n const nextNode = textNodes[index + 1] || null\n const transformedHtml = this.getTransformedHtml(currentNode, nextNode, transformFunction)\n this.replaceNode(currentNode, transformedHtml)\n })\n\n return doc.body.innerHTML\n }\n\n /**\n * \u4E0E\u3048\u3089\u308C\u305F\u30CE\u30FC\u30C9\u3068\u3001\u305D\u306E\u6B21\u306E\u30CE\u30FC\u30C9\u306B\u57FA\u3065\u3044\u3066\u5909\u63DB\u3055\u308C\u305FHTML\u3092\u751F\u6210\u3057\u307E\u3059\u3002\n *\n * @param currentNode - \u73FE\u5728\u306E\u30CE\u30FC\u30C9\u3002\n * @param nextNode - \u6B21\u306E\u30CE\u30FC\u30C9\u3001\u307E\u305F\u306F\u5B58\u5728\u3057\u306A\u3044\u5834\u5408\u306F null\u3002\n * @param transformFunction - \u30CE\u30FC\u30C9\u306E\u5024\u3092\u5909\u63DB\u3059\u308B\u305F\u3081\u306E\u95A2\u6570\u3002\n * @return \u5909\u63DB\u3055\u308C\u305FHTML\u30B3\u30F3\u30C6\u30F3\u30C4\u3092\u542B\u3080\u6587\u5B57\u5217\u3002\n */\n private getTransformedHtml(currentNode: Node, nextNode: Node | null, transformFunction: TransformFunction): string {\n const transformedHtml = transformFunction(\n currentNode.nodeValue || '',\n nextNode ? nextNode.nodeValue || '' : '',\n this.options\n )\n return transformedHtml\n }\n\n /**\n * \u6307\u5B9A\u3055\u308C\u305F\u30CE\u30FC\u30C9\u3092\u3001\u65B0\u3057\u3044HTML\u30B3\u30F3\u30C6\u30F3\u30C4\u3067\u7F6E\u304D\u63DB\u3048\u307E\u3059\u3002\n *\n * @param node - \u7F6E\u304D\u63DB\u3048\u308B\u30CE\u30FC\u30C9\u3002\n * @param transformedHtml - \u30CE\u30FC\u30C9\u306B\u633F\u5165\u3055\u308C\u308B\u5909\u63DB\u5F8C\u306EHTML\u30B3\u30F3\u30C6\u30F3\u30C4\u3002\n */\n private replaceNode = (node: Node, transformedHtml: string): void => {\n const range = win.document.createRange()\n range.selectNode(node)\n const fragment = range.createContextualFragment(transformedHtml)\n\n if (node.parentNode) {\n node.parentNode.insertBefore(fragment, node)\n node.parentNode.removeChild(node)\n }\n }\n}\n\n/**\n * \u6587\u5B57\u5217\u304B\u3089HTML\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u89E3\u6790\u3057\u307E\u3059\u3002\n *\n * @param html - \u89E3\u6790\u3059\u308BHTML\u6587\u5B57\u5217\u3002\n * @return \u89E3\u6790\u3055\u308C\u305FHTML\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3002\n */\nconst parseFromString = (html: string) => {\n return new win.DOMParser().parseFromString(html, 'text/html')\n}\n\n/**\n * \u6307\u5B9A\u3055\u308C\u305FHTMLElement\u5185\u306E\u3059\u3079\u3066\u306E\u30C6\u30AD\u30B9\u30C8\u30CE\u30FC\u30C9\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002\n *\n * @param element - \u30C6\u30AD\u30B9\u30C8\u30CE\u30FC\u30C9\u3092\u53D6\u5F97\u3059\u308B\u8981\u7D20\u3002\n * @return \u53D6\u5F97\u3057\u305F\u30C6\u30AD\u30B9\u30C8\u30CE\u30FC\u30C9\u306E\u914D\u5217\u3002\n */\nconst getTextNodes = (element: HTMLElement): Node[] => {\n const walk = win.document.createTreeWalker(element, win.NodeFilter.SHOW_TEXT)\n let textNode = walk.nextNode() as Node | null\n const textNodes: Node[] = []\n\n while (textNode) {\n if (textNode.nodeValue && textNode.nodeValue.trim() !== '') {\n textNodes.push(textNode)\n }\n textNode = walk.nextNode()\n }\n\n return textNodes\n}\n\nexport default HTMLProcessor\nexport { parseFromString, getTextNodes }\n", "var TINF_OK = 0;\nvar TINF_DATA_ERROR = -3;\n\nfunction Tree() {\n this.table = new Uint16Array(16); /* table of code length counts */\n this.trans = new Uint16Array(288); /* code -> symbol translation table */\n}\n\nfunction Data(source, dest) {\n this.source = source;\n this.sourceIndex = 0;\n this.tag = 0;\n this.bitcount = 0;\n \n this.dest = dest;\n this.destLen = 0;\n \n this.ltree = new Tree(); /* dynamic length/symbol tree */\n this.dtree = new Tree(); /* dynamic distance tree */\n}\n\n/* --------------------------------------------------- *\n * -- uninitialized global data (static structures) -- *\n * --------------------------------------------------- */\n\nvar sltree = new Tree();\nvar sdtree = new Tree();\n\n/* extra bits and base tables for length codes */\nvar length_bits = new Uint8Array(30);\nvar length_base = new Uint16Array(30);\n\n/* extra bits and base tables for distance codes */\nvar dist_bits = new Uint8Array(30);\nvar dist_base = new Uint16Array(30);\n\n/* special ordering of code length codes */\nvar clcidx = new Uint8Array([\n 16, 17, 18, 0, 8, 7, 9, 6,\n 10, 5, 11, 4, 12, 3, 13, 2,\n 14, 1, 15\n]);\n\n/* used by tinf_decode_trees, avoids allocations every call */\nvar code_tree = new Tree();\nvar lengths = new Uint8Array(288 + 32);\n\n/* ----------------------- *\n * -- utility functions -- *\n * ----------------------- */\n\n/* build extra bits and base tables */\nfunction tinf_build_bits_base(bits, base, delta, first) {\n var i, sum;\n\n /* build bits table */\n for (i = 0; i < delta; ++i) bits[i] = 0;\n for (i = 0; i < 30 - delta; ++i) bits[i + delta] = i / delta | 0;\n\n /* build base table */\n for (sum = first, i = 0; i < 30; ++i) {\n base[i] = sum;\n sum += 1 << bits[i];\n }\n}\n\n/* build the fixed huffman trees */\nfunction tinf_build_fixed_trees(lt, dt) {\n var i;\n\n /* build fixed length tree */\n for (i = 0; i < 7; ++i) lt.table[i] = 0;\n\n lt.table[7] = 24;\n lt.table[8] = 152;\n lt.table[9] = 112;\n\n for (i = 0; i < 24; ++i) lt.trans[i] = 256 + i;\n for (i = 0; i < 144; ++i) lt.trans[24 + i] = i;\n for (i = 0; i < 8; ++i) lt.trans[24 + 144 + i] = 280 + i;\n for (i = 0; i < 112; ++i) lt.trans[24 + 144 + 8 + i] = 144 + i;\n\n /* build fixed distance tree */\n for (i = 0; i < 5; ++i) dt.table[i] = 0;\n\n dt.table[5] = 32;\n\n for (i = 0; i < 32; ++i) dt.trans[i] = i;\n}\n\n/* given an array of code lengths, build a tree */\nvar offs = new Uint16Array(16);\n\nfunction tinf_build_tree(t, lengths, off, num) {\n var i, sum;\n\n /* clear code length count table */\n for (i = 0; i < 16; ++i) t.table[i] = 0;\n\n /* scan symbol lengths, and sum code length counts */\n for (i = 0; i < num; ++i) t.table[lengths[off + i]]++;\n\n t.table[0] = 0;\n\n /* compute offset table for distribution sort */\n for (sum = 0, i = 0; i < 16; ++i) {\n offs[i] = sum;\n sum += t.table[i];\n }\n\n /* create code->symbol translation table (symbols sorted by code) */\n for (i = 0; i < num; ++i) {\n if (lengths[off + i]) t.trans[offs[lengths[off + i]]++] = i;\n }\n}\n\n/* ---------------------- *\n * -- decode functions -- *\n * ---------------------- */\n\n/* get one bit from source stream */\nfunction tinf_getbit(d) {\n /* check if tag is empty */\n if (!d.bitcount--) {\n /* load next tag */\n d.tag = d.source[d.sourceIndex++];\n d.bitcount = 7;\n }\n\n /* shift bit out of tag */\n var bit = d.tag & 1;\n d.tag >>>= 1;\n\n return bit;\n}\n\n/* read a num bit value from a stream and add base */\nfunction tinf_read_bits(d, num, base) {\n if (!num)\n return base;\n\n while (d.bitcount < 24) {\n d.tag |= d.source[d.sourceIndex++] << d.bitcount;\n d.bitcount += 8;\n }\n\n var val = d.tag & (0xffff >>> (16 - num));\n d.tag >>>= num;\n d.bitcount -= num;\n return val + base;\n}\n\n/* given a data stream and a tree, decode a symbol */\nfunction tinf_decode_symbol(d, t) {\n while (d.bitcount < 24) {\n d.tag |= d.source[d.sourceIndex++] << d.bitcount;\n d.bitcount += 8;\n }\n \n var sum = 0, cur = 0, len = 0;\n var tag = d.tag;\n\n /* get more bits while code value is above sum */\n do {\n cur = 2 * cur + (tag & 1);\n tag >>>= 1;\n ++len;\n\n sum += t.table[len];\n cur -= t.table[len];\n } while (cur >= 0);\n \n d.tag = tag;\n d.bitcount -= len;\n\n return t.trans[sum + cur];\n}\n\n/* given a data stream, decode dynamic trees from it */\nfunction tinf_decode_trees(d, lt, dt) {\n var hlit, hdist, hclen;\n var i, num, length;\n\n /* get 5 bits HLIT (257-286) */\n hlit = tinf_read_bits(d, 5, 257);\n\n /* get 5 bits HDIST (1-32) */\n hdist = tinf_read_bits(d, 5, 1);\n\n /* get 4 bits HCLEN (4-19) */\n hclen = tinf_read_bits(d, 4, 4);\n\n for (i = 0; i < 19; ++i) lengths[i] = 0;\n\n /* read code lengths for code length alphabet */\n for (i = 0; i < hclen; ++i) {\n /* get 3 bits code length (0-7) */\n var clen = tinf_read_bits(d, 3, 0);\n lengths[clcidx[i]] = clen;\n }\n\n /* build code length tree */\n tinf_build_tree(code_tree, lengths, 0, 19);\n\n /* decode code lengths for the dynamic trees */\n for (num = 0; num < hlit + hdist;) {\n var sym = tinf_decode_symbol(d, code_tree);\n\n switch (sym) {\n case 16:\n /* copy previous code length 3-6 times (read 2 bits) */\n var prev = lengths[num - 1];\n for (length = tinf_read_bits(d, 2, 3); length; --length) {\n lengths[num++] = prev;\n }\n break;\n case 17:\n /* repeat code length 0 for 3-10 times (read 3 bits) */\n for (length = tinf_read_bits(d, 3, 3); length; --length) {\n lengths[num++] = 0;\n }\n break;\n case 18:\n /* repeat code length 0 for 11-138 times (read 7 bits) */\n for (length = tinf_read_bits(d, 7, 11); length; --length) {\n lengths[num++] = 0;\n }\n break;\n default:\n /* values 0-15 represent the actual code lengths */\n lengths[num++] = sym;\n break;\n }\n }\n\n /* build dynamic trees */\n tinf_build_tree(lt, lengths, 0, hlit);\n tinf_build_tree(dt, lengths, hlit, hdist);\n}\n\n/* ----------------------------- *\n * -- block inflate functions -- *\n * ----------------------------- */\n\n/* given a stream and two trees, inflate a block of data */\nfunction tinf_inflate_block_data(d, lt, dt) {\n while (1) {\n var sym = tinf_decode_symbol(d, lt);\n\n /* check for end of block */\n if (sym === 256) {\n return TINF_OK;\n }\n\n if (sym < 256) {\n d.dest[d.destLen++] = sym;\n } else {\n var length, dist, offs;\n var i;\n\n sym -= 257;\n\n /* possibly get more bits from length code */\n length = tinf_read_bits(d, length_bits[sym], length_base[sym]);\n\n dist = tinf_decode_symbol(d, dt);\n\n /* possibly get more bits from distance code */\n offs = d.destLen - tinf_read_bits(d, dist_bits[dist], dist_base[dist]);\n\n /* copy match */\n for (i = offs; i < offs + length; ++i) {\n d.dest[d.destLen++] = d.dest[i];\n }\n }\n }\n}\n\n/* inflate an uncompressed block of data */\nfunction tinf_inflate_uncompressed_block(d) {\n var length, invlength;\n var i;\n \n /* unread from bitbuffer */\n while (d.bitcount > 8) {\n d.sourceIndex--;\n d.bitcount -= 8;\n }\n\n /* get length */\n length = d.source[d.sourceIndex + 1];\n length = 256 * length + d.source[d.sourceIndex];\n\n /* get one's complement of length */\n invlength = d.source[d.sourceIndex + 3];\n invlength = 256 * invlength + d.source[d.sourceIndex + 2];\n\n /* check length */\n if (length !== (~invlength & 0x0000ffff))\n return TINF_DATA_ERROR;\n\n d.sourceIndex += 4;\n\n /* copy block */\n for (i = length; i; --i)\n d.dest[d.destLen++] = d.source[d.sourceIndex++];\n\n /* make sure we start next block on a byte boundary */\n d.bitcount = 0;\n\n return TINF_OK;\n}\n\n/* inflate stream from source to dest */\nfunction tinf_uncompress(source, dest) {\n var d = new Data(source, dest);\n var bfinal, btype, res;\n\n do {\n /* read final block flag */\n bfinal = tinf_getbit(d);\n\n /* read block type (2 bits) */\n btype = tinf_read_bits(d, 2, 0);\n\n /* decompress block */\n switch (btype) {\n case 0:\n /* decompress uncompressed block */\n res = tinf_inflate_uncompressed_block(d);\n break;\n case 1:\n /* decompress block with fixed huffman trees */\n res = tinf_inflate_block_data(d, sltree, sdtree);\n break;\n case 2:\n /* decompress block with dynamic huffman trees */\n tinf_decode_trees(d, d.ltree, d.dtree);\n res = tinf_inflate_block_data(d, d.ltree, d.dtree);\n break;\n default:\n res = TINF_DATA_ERROR;\n }\n\n if (res !== TINF_OK)\n throw new Error('Data error');\n\n } while (!bfinal);\n\n if (d.destLen < d.dest.length) {\n if (typeof d.dest.slice === 'function')\n return d.dest.slice(0, d.destLen);\n else\n return d.dest.subarray(0, d.destLen);\n }\n \n return d.dest;\n}\n\n/* -------------------- *\n * -- initialization -- *\n * -------------------- */\n\n/* build fixed huffman trees */\ntinf_build_fixed_trees(sltree, sdtree);\n\n/* build extra bits and base tables */\ntinf_build_bits_base(length_bits, length_base, 4, 3);\ntinf_build_bits_base(dist_bits, dist_base, 2, 1);\n\n/* fix a special case */\nlength_bits[28] = 0;\nlength_base[28] = 258;\n\nmodule.exports = tinf_uncompress;\n", "const isBigEndian = (new Uint8Array(new Uint32Array([0x12345678]).buffer)[0] === 0x12);\n\nconst swap = (b, n, m) => {\n let i = b[n];\n b[n] = b[m];\n b[m] = i;\n};\n\nconst swap32 = array => {\n const len = array.length;\n for (let i = 0; i < len; i += 4) {\n swap(array, i, i + 3);\n swap(array, i + 1, i + 2);\n }\n};\n\nconst swap32LE = array => {\n if (isBigEndian) {\n swap32(array);\n }\n};\n\nmodule.exports = {\n swap32LE: swap32LE\n};\n", "const inflate = require('tiny-inflate');\nconst { swap32LE } = require('./swap');\n\n// Shift size for getting the index-1 table offset.\nconst SHIFT_1 = 6 + 5;\n\n// Shift size for getting the index-2 table offset.\nconst SHIFT_2 = 5;\n\n// Difference between the two shift sizes,\n// for getting an index-1 offset from an index-2 offset. 6=11-5\nconst SHIFT_1_2 = SHIFT_1 - SHIFT_2;\n\n// Number of index-1 entries for the BMP. 32=0x20\n// This part of the index-1 table is omitted from the serialized form.\nconst OMITTED_BMP_INDEX_1_LENGTH = 0x10000 >> SHIFT_1;\n\n// Number of entries in an index-2 block. 64=0x40\nconst INDEX_2_BLOCK_LENGTH = 1 << SHIFT_1_2;\n\n// Mask for getting the lower bits for the in-index-2-block offset. */\nconst INDEX_2_MASK = INDEX_2_BLOCK_LENGTH - 1;\n\n// Shift size for shifting left the index array values.\n// Increases possible data size with 16-bit index values at the cost\n// of compactability.\n// This requires data blocks to be aligned by DATA_GRANULARITY.\nconst INDEX_SHIFT = 2;\n\n// Number of entries in a data block. 32=0x20\nconst DATA_BLOCK_LENGTH = 1 << SHIFT_2;\n\n// Mask for getting the lower bits for the in-data-block offset.\nconst DATA_MASK = DATA_BLOCK_LENGTH - 1;\n\n// The part of the index-2 table for U+D800..U+DBFF stores values for\n// lead surrogate code _units_ not code _points_.\n// Values for lead surrogate code _points_ are indexed with this portion of the table.\n// Length=32=0x20=0x400>>SHIFT_2. (There are 1024=0x400 lead surrogates.)\nconst LSCP_INDEX_2_OFFSET = 0x10000 >> SHIFT_2;\nconst LSCP_INDEX_2_LENGTH = 0x400 >> SHIFT_2;\n\n// Count the lengths of both BMP pieces. 2080=0x820\nconst INDEX_2_BMP_LENGTH = LSCP_INDEX_2_OFFSET + LSCP_INDEX_2_LENGTH;\n\n// The 2-byte UTF-8 version of the index-2 table follows at offset 2080=0x820.\n// Length 32=0x20 for lead bytes C0..DF, regardless of SHIFT_2.\nconst UTF8_2B_INDEX_2_OFFSET = INDEX_2_BMP_LENGTH;\nconst UTF8_2B_INDEX_2_LENGTH = 0x800 >> 6; // U+0800 is the first code point after 2-byte UTF-8\n\n// The index-1 table, only used for supplementary code points, at offset 2112=0x840.\n// Variable length, for code points up to highStart, where the last single-value range starts.\n// Maximum length 512=0x200=0x100000>>SHIFT_1.\n// (For 0x100000 supplementary code points U+10000..U+10ffff.)\n//\n// The part of the index-2 table for supplementary code points starts\n// after this index-1 table.\n//\n// Both the index-1 table and the following part of the index-2 table\n// are omitted completely if there is only BMP data.\nconst INDEX_1_OFFSET = UTF8_2B_INDEX_2_OFFSET + UTF8_2B_INDEX_2_LENGTH;\n\n// The alignment size of a data block. Also the granularity for compaction.\nconst DATA_GRANULARITY = 1 << INDEX_SHIFT;\n\nclass UnicodeTrie {\n constructor(data) {\n const isBuffer = (typeof data.readUInt32BE === 'function') && (typeof data.slice === 'function');\n\n if (isBuffer || data instanceof Uint8Array) {\n // read binary format\n let uncompressedLength;\n if (isBuffer) {\n this.highStart = data.readUInt32LE(0);\n this.errorValue = data.readUInt32LE(4);\n uncompressedLength = data.readUInt32LE(8);\n data = data.slice(12);\n } else {\n const view = new DataView(data.buffer);\n this.highStart = view.getUint32(0, true);\n this.errorValue = view.getUint32(4, true);\n uncompressedLength = view.getUint32(8, true);\n data = data.subarray(12);\n }\n\n // double inflate the actual trie data\n data = inflate(data, new Uint8Array(uncompressedLength));\n data = inflate(data, new Uint8Array(uncompressedLength));\n\n // swap bytes from little-endian\n swap32LE(data);\n\n this.data = new Uint32Array(data.buffer);\n\n } else {\n // pre-parsed data\n ({ data: this.data, highStart: this.highStart, errorValue: this.errorValue } = data);\n }\n }\n\n get(codePoint) {\n let index;\n if ((codePoint < 0) || (codePoint > 0x10ffff)) {\n return this.errorValue;\n }\n\n if ((codePoint < 0xd800) || ((codePoint > 0xdbff) && (codePoint <= 0xffff))) {\n // Ordinary BMP code point, excluding leading surrogates.\n // BMP uses a single level lookup. BMP index starts at offset 0 in the index.\n // data is stored in the index array itself.\n index = (this.data[codePoint >> SHIFT_2] << INDEX_SHIFT) + (codePoint & DATA_MASK);\n return this.data[index];\n }\n\n if (codePoint <= 0xffff) {\n // Lead Surrogate Code Point. A Separate index section is stored for\n // lead surrogate code units and code points.\n // The main index has the code unit data.\n // For this function, we need the code point data.\n index = (this.data[LSCP_INDEX_2_OFFSET + ((codePoint - 0xd800) >> SHIFT_2)] << INDEX_SHIFT) + (codePoint & DATA_MASK);\n return this.data[index];\n }\n\n if (codePoint < this.highStart) {\n // Supplemental code point, use two-level lookup.\n index = this.data[(INDEX_1_OFFSET - OMITTED_BMP_INDEX_1_LENGTH) + (codePoint >> SHIFT_1)];\n index = this.data[index + ((codePoint >> SHIFT_2) & INDEX_2_MASK)];\n index = (index << INDEX_SHIFT) + (codePoint & DATA_MASK);\n return this.data[index];\n }\n\n return this.data[this.data.length - DATA_GRANULARITY];\n }\n}\n\nmodule.exports = UnicodeTrie;", "var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n;(function (exports) {\n\t'use strict';\n\n var Arr = (typeof Uint8Array !== 'undefined')\n ? Uint8Array\n : Array\n\n\tvar PLUS = '+'.charCodeAt(0)\n\tvar SLASH = '/'.charCodeAt(0)\n\tvar NUMBER = '0'.charCodeAt(0)\n\tvar LOWER = 'a'.charCodeAt(0)\n\tvar UPPER = 'A'.charCodeAt(0)\n\tvar PLUS_URL_SAFE = '-'.charCodeAt(0)\n\tvar SLASH_URL_SAFE = '_'.charCodeAt(0)\n\n\tfunction decode (elt) {\n\t\tvar code = elt.charCodeAt(0)\n\t\tif (code === PLUS ||\n\t\t code === PLUS_URL_SAFE)\n\t\t\treturn 62 // '+'\n\t\tif (code === SLASH ||\n\t\t code === SLASH_URL_SAFE)\n\t\t\treturn 63 // '/'\n\t\tif (code < NUMBER)\n\t\t\treturn -1 //no match\n\t\tif (code < NUMBER + 10)\n\t\t\treturn code - NUMBER + 26 + 26\n\t\tif (code < UPPER + 26)\n\t\t\treturn code - UPPER\n\t\tif (code < LOWER + 26)\n\t\t\treturn code - LOWER + 26\n\t}\n\n\tfunction b64ToByteArray (b64) {\n\t\tvar i, j, l, tmp, placeHolders, arr\n\n\t\tif (b64.length % 4 > 0) {\n\t\t\tthrow new Error('Invalid string. Length must be a multiple of 4')\n\t\t}\n\n\t\t// the number of equal signs (place holders)\n\t\t// if there are two placeholders, than the two characters before it\n\t\t// represent one byte\n\t\t// if there is only one, then the three characters before it represent 2 bytes\n\t\t// this is just a cheap hack to not do indexOf twice\n\t\tvar len = b64.length\n\t\tplaceHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0\n\n\t\t// base64 is 4/3 + up to two characters of the original data\n\t\tarr = new Arr(b64.length * 3 / 4 - placeHolders)\n\n\t\t// if there are placeholders, only get up to the last complete 4 chars\n\t\tl = placeHolders > 0 ? b64.length - 4 : b64.length\n\n\t\tvar L = 0\n\n\t\tfunction push (v) {\n\t\t\tarr[L++] = v\n\t\t}\n\n\t\tfor (i = 0, j = 0; i < l; i += 4, j += 3) {\n\t\t\ttmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))\n\t\t\tpush((tmp & 0xFF0000) >> 16)\n\t\t\tpush((tmp & 0xFF00) >> 8)\n\t\t\tpush(tmp & 0xFF)\n\t\t}\n\n\t\tif (placeHolders === 2) {\n\t\t\ttmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)\n\t\t\tpush(tmp & 0xFF)\n\t\t} else if (placeHolders === 1) {\n\t\t\ttmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)\n\t\t\tpush((tmp >> 8) & 0xFF)\n\t\t\tpush(tmp & 0xFF)\n\t\t}\n\n\t\treturn arr\n\t}\n\n\tfunction uint8ToBase64 (uint8) {\n\t\tvar i,\n\t\t\textraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes\n\t\t\toutput = \"\",\n\t\t\ttemp, length\n\n\t\tfunction encode (num) {\n\t\t\treturn lookup.charAt(num)\n\t\t}\n\n\t\tfunction tripletToBase64 (num) {\n\t\t\treturn encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)\n\t\t}\n\n\t\t// go through the array every three bytes, we'll deal with trailing stuff later\n\t\tfor (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {\n\t\t\ttemp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\n\t\t\toutput += tripletToBase64(temp)\n\t\t}\n\n\t\t// pad the end with zeros, but make sure to not forget the extra bytes\n\t\tswitch (extraBytes) {\n\t\t\tcase 1:\n\t\t\t\ttemp = uint8[uint8.length - 1]\n\t\t\t\toutput += encode(temp >> 2)\n\t\t\t\toutput += encode((temp << 4) & 0x3F)\n\t\t\t\toutput += '=='\n\t\t\t\tbreak\n\t\t\tcase 2:\n\t\t\t\ttemp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])\n\t\t\t\toutput += encode(temp >> 10)\n\t\t\t\toutput += encode((temp >> 4) & 0x3F)\n\t\t\t\toutput += encode((temp << 2) & 0x3F)\n\t\t\t\toutput += '='\n\t\t\t\tbreak\n\t\t}\n\n\t\treturn output\n\t}\n\n\texports.toByteArray = b64ToByteArray\n\texports.fromByteArray = uint8ToBase64\n}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))\n", "import UnicodeTrie from 'unicode-trie';\nimport fs from 'fs';\nimport base64 from 'base64-js';\nimport { BK, CR, LF, NL, SG, WJ, SP, ZWJ, BA, HY, NS, AI, AL, CJ, HL, RI, SA, XX } from './classes';\nimport { DI_BRK, IN_BRK, CI_BRK, CP_BRK, PR_BRK, pairTable } from './pairs';\n\nconst data = base64.toByteArray(fs.readFileSync(__dirname + '/classes.trie', 'base64'));\nconst classTrie = new UnicodeTrie(data);\n\nconst mapClass = function (c) {\n switch (c) {\n case AI:\n return AL;\n\n case SA:\n case SG:\n case XX:\n return AL;\n\n case CJ:\n return NS;\n\n default:\n return c;\n }\n};\n\nconst mapFirst = function (c) {\n switch (c) {\n case LF:\n case NL:\n return BK;\n\n case SP:\n return WJ;\n\n default:\n return c;\n }\n};\n\nclass Break {\n constructor(position, required = false) {\n this.position = position;\n this.required = required;\n }\n}\n\nclass LineBreaker {\n constructor(string) {\n this.string = string;\n this.pos = 0;\n this.lastPos = 0;\n this.curClass = null;\n this.nextClass = null;\n this.LB8a = false;\n this.LB21a = false;\n this.LB30a = 0;\n }\n\n nextCodePoint() {\n const code = this.string.charCodeAt(this.pos++);\n const next = this.string.charCodeAt(this.pos);\n\n // If a surrogate pair\n if ((0xd800 <= code && code <= 0xdbff) && (0xdc00 <= next && next <= 0xdfff)) {\n this.pos++;\n return ((code - 0xd800) * 0x400) + (next - 0xdc00) + 0x10000;\n }\n\n return code;\n }\n\n nextCharClass() {\n return mapClass(classTrie.get(this.nextCodePoint()));\n }\n\n getSimpleBreak() {\n // handle classes not handled by the pair table\n switch (this.nextClass) {\n case SP:\n return false;\n\n case BK:\n case LF:\n case NL:\n this.curClass = BK;\n return false;\n\n case CR:\n this.curClass = CR;\n return false;\n }\n\n return null;\n }\n\n getPairTableBreak(lastClass) {\n // if not handled already, use the pair table\n let shouldBreak = false;\n switch (pairTable[this.curClass][this.nextClass]) {\n case DI_BRK: // Direct break\n shouldBreak = true;\n break;\n\n case IN_BRK: // possible indirect break\n shouldBreak = lastClass === SP;\n break;\n\n case CI_BRK:\n shouldBreak = lastClass === SP;\n if (!shouldBreak) {\n shouldBreak = false;\n return shouldBreak;\n }\n break;\n\n case CP_BRK: // prohibited for combining marks\n if (lastClass !== SP) {\n return shouldBreak;\n }\n break;\n\n case PR_BRK:\n break;\n }\n\n if (this.LB8a) {\n shouldBreak = false;\n }\n\n // Rule LB21a\n if (this.LB21a && (this.curClass === HY || this.curClass === BA)) {\n shouldBreak = false;\n this.LB21a = false;\n } else {\n this.LB21a = (this.curClass === HL);\n }\n\n // Rule LB30a\n if (this.curClass === RI) {\n this.LB30a++;\n if (this.LB30a == 2 && (this.nextClass === RI)) {\n shouldBreak = true;\n this.LB30a = 0;\n }\n } else {\n this.LB30a = 0;\n }\n\n this.curClass = this.nextClass;\n\n return shouldBreak;\n }\n\n nextBreak() {\n // get the first char if we're at the beginning of the string\n if (this.curClass == null) {\n let firstClass = this.nextCharClass();\n this.curClass = mapFirst(firstClass);\n this.nextClass = firstClass;\n this.LB8a = (firstClass === ZWJ);\n this.LB30a = 0;\n }\n\n while (this.pos < this.string.length) {\n this.lastPos = this.pos;\n const lastClass = this.nextClass;\n this.nextClass = this.nextCharClass();\n\n // explicit newline\n if ((this.curClass === BK) || ((this.curClass === CR) && (this.nextClass !== LF))) {\n this.curClass = mapFirst(mapClass(this.nextClass));\n return new Break(this.lastPos, true);\n }\n\n let shouldBreak = this.getSimpleBreak();\n\n if (shouldBreak === null) {\n shouldBreak = this.getPairTableBreak(lastClass);\n }\n\n // Rule LB8a\n this.LB8a = (this.nextClass === ZWJ);\n\n if (shouldBreak) {\n return new Break(this.lastPos);\n }\n }\n\n if (this.lastPos < this.string.length) {\n this.lastPos = this.string.length;\n return new Break(this.string.length);\n }\n\n return null;\n }\n}\n\nmodule.exports = LineBreaker;\n", "\"use strict\";", "// The following break classes are handled by the pair table\nexport const OP = 0; // Opening punctuation\nexport const CL = 1; // Closing punctuation\nexport const CP = 2; // Closing parenthesis\nexport const QU = 3; // Ambiguous quotation\nexport const GL = 4; // Glue\nexport const NS = 5; // Non-starters\nexport const EX = 6; // Exclamation/Interrogation\nexport const SY = 7; // Symbols allowing break after\nexport const IS = 8; // Infix separator\nexport const PR = 9; // Prefix\nexport const PO = 10; // Postfix\nexport const NU = 11; // Numeric\nexport const AL = 12; // Alphabetic\nexport const HL = 13; // Hebrew Letter\nexport const ID = 14; // Ideographic\nexport const IN = 15; // Inseparable characters\nexport const HY = 16; // Hyphen\nexport const BA = 17; // Break after\nexport const BB = 18; // Break before\nexport const B2 = 19; // Break on either side (but not pair)\nexport const ZW = 20; // Zero-width space\nexport const CM = 21; // Combining marks\nexport const WJ = 22; // Word joiner\nexport const H2 = 23; // Hangul LV\nexport const H3 = 24; // Hangul LVT\nexport const JL = 25; // Hangul L Jamo\nexport const JV = 26; // Hangul V Jamo\nexport const JT = 27; // Hangul T Jamo\nexport const RI = 28; // Regional Indicator\nexport const EB = 29; // Emoji Base\nexport const EM = 30; // Emoji Modifier\nexport const ZWJ = 31; // Zero Width Joiner\nexport const CB = 32; // Contingent break\n\n// The following break classes are not handled by the pair table\nexport const AI = 33; // Ambiguous (Alphabetic or Ideograph)\nexport const BK = 34; // Break (mandatory)\nexport const CJ = 35; // Conditional Japanese Starter\nexport const CR = 36; // Carriage return\nexport const LF = 37; // Line feed\nexport const NL = 38; // Next line\nexport const SA = 39; // South-East Asian\nexport const SG = 40; // Surrogates\nexport const SP = 41; // Space\nexport const XX = 42; // Unknown\n", "export const DI_BRK = 0; // Direct break opportunity\nexport const IN_BRK = 1; // Indirect break opportunity\nexport const CI_BRK = 2; // Indirect break opportunity for combining marks\nexport const CP_BRK = 3; // Prohibited break for combining marks\nexport const PR_BRK = 4; // Prohibited break\n\n// Based on example pair table from https://www.unicode.org/reports/tr14/tr14-37.html#Table2\n// - ZWJ special processing for LB8a of Revision 41\n// - CB manually added as per Rule LB20\n// - CL, CP, NS, SY, IS, PR, PO, HY, BA, B2 and RI manually adjusted as per LB22 of Revision 45\nexport const pairTable = [\n //OP , CL , CP , QU , GL , NS , EX , SY , IS , PR , PO , NU , AL , HL , ID , IN , HY , BA , BB , B2 , ZW , CM , WJ , H2 , H3 , JL , JV , JT , RI , EB , EM , ZWJ , CB\n [PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, CP_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK], // OP\n [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // CL\n [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // CP\n [PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, CI_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK], // QU\n [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, CI_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK], // GL\n [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // NS\n [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // EX\n [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // SY\n [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // IS\n [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK], // PR\n [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // PO\n [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // NU\n [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // AL\n [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // HL\n [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // ID\n [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // IN\n [DI_BRK, PR_BRK, PR_BRK, IN_BRK, DI_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // HY\n [DI_BRK, PR_BRK, PR_BRK, IN_BRK, DI_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // BA\n [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, CI_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK], // BB\n [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, PR_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // B2\n [DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK], // ZW\n [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // CM\n [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, CI_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK], // WJ\n [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // H2\n [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // H3\n [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // JL\n [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // JV\n [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // JT\n [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // RI\n [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, DI_BRK], // EB\n [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // EM\n [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // ZWJ\n [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, DI_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK] // CB\n];", "/**\n * \u30E9\u30C6\u30F3\u6587\u5B57\u3001\u6570\u5B57\u3001\u57FA\u672C\u7684\u306A\u8A18\u53F7\u985E\n */\nexport const latinRegex = /[\\p{scx=Latin}0-9!\"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^_`{|}~]+/u\n\n/**\n * \u65E5\u672C\u8A9E\n */\nexport const japaneseRegex = /[\\p{scx=Hiragana}\\p{scx=Katakana}|\uFF66-\uFF9F\\p{scx=Han}]+/u\n\n/**\n * \u521D\u3081\u62EC\u5F27\u985E\n */\nexport const openingsRegex = /\uFF08|\uFF3B|\uFF5B|\u3014|\u3008|\u300A|\u300C|\u300E|\u3010|\u3018|\u3016|\u201C|\u2018/\n\n/**\n * \u7D42\u308F\u308A\u62EC\u5F27\u985E\u3001\u53E5\u70B9\u985E\u3001\u8AAD\u70B9\u985E\n */\nexport const closingsRegex = /\uFF09|\uFF3D|\uFF5D|\u3015|\u3009|\u300B|\u300D|\u300F|\u3011|\u3019|\u3017|\u201D|\u2019|\u3001|\uFF0C|\u3002|\uFF0E/\n\n/**\n * \u4E2D\u70B9\u985E\n */\nexport const middleDotsRegex = /\u30FB|\uFF1A|\uFF1B/\n\n/**\n * \u5206\u96E2\u7981\u5247\u6587\u5B57\n */\nexport const noBreakRulesRegex = new RegExp(\n `[${'\u2014\u2025\u2026\uFF3F'}${String.fromCharCode(0x2500)}-${String.fromCharCode(0x257f)}]+`\n)\n", "import * as utils from './utils-regex'\n\n/**\n * \u6587\u5B57\u30AF\u30E9\u30B9\u95A2\u9023\u306E\u51E6\u7406\u3092\u63D0\u4F9B\u3059\u308B\u30AF\u30E9\u30B9\u3067\u3059\u3002\n * \u6587\u7AE0\u5185\u306E\u7279\u5B9A\u306E\u6587\u5B57\u3084\u6587\u5B57\u30AF\u30E9\u30B9\u306B\u57FA\u3065\u3044\u3066\u3001\n * \u5206\u96E2\u7981\u5247\u51E6\u7406\u3084\u56DB\u5206\u30A2\u30AD\u306E\u8FFD\u52A0\u306E\u5224\u5B9A\u3092\u884C\u3044\u307E\u3059\u3002\n */\nconst CharClass = {\n /**\n * \u30BB\u30B0\u30E1\u30F3\u30C8\u304C\u5206\u96E2\u7981\u5247\u6587\u5B57\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u308B\u304B\u3069\u3046\u304B\u3092\u5224\u5B9A\u3057\u307E\u3059\u3002\n * @param segment - \u5224\u5B9A\u3059\u308B\u30C6\u30AD\u30B9\u30C8\u30BB\u30B0\u30E1\u30F3\u30C8\n * @return \u5206\u96E2\u7981\u5247\u6587\u5B57\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u308B\u5834\u5408\u306Ftrue\u3001\u305D\u3046\u3067\u306A\u3044\u5834\u5408\u306Ffalse\n */\n shouldNotBreak: (segment: string): boolean => {\n return utils.noBreakRulesRegex.test(segment)\n },\n\n /**\n * 2\u3064\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\u9593\u306B\u56DB\u5206\u30A2\u30AD\u3092\u8FFD\u52A0\u3059\u3079\u304D\u304B\u3092\u5224\u65AD\u3057\u307E\u3059\u3002\n * @param current - \u73FE\u5728\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\n * @param next - \u6B21\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\n * @return \u56DB\u5206\u30A2\u30AD\u3092\u8FFD\u52A0\u3059\u3079\u304D\u304B\u3069\u3046\u304B\n */\n shouldAddThinSpace: (current: string, next: string): boolean => {\n const settings = {\n openings: {\n regex: utils.openingsRegex,\n hasSpaceBefore: true,\n hasSpaceAfter: false,\n },\n closings: {\n regex: utils.closingsRegex,\n hasSpaceBefore: false,\n hasSpaceAfter: true,\n },\n middleDots: {\n regex: utils.middleDotsRegex,\n hasSpaceBefore: true,\n hasSpaceAfter: true,\n },\n }\n\n for (const { regex, hasSpaceBefore, hasSpaceAfter } of Object.values(settings)) {\n // \u540C\u3058\u6587\u5B57\u30AF\u30E9\u30B9\u306E\u8A18\u53F7\u304C\u9023\u7D9A\u3059\u308B\u5834\u5408\u306F\u30A2\u30AD\u3092\u5165\u308C\u306A\u3044\n if (hasSpaceBefore && regex.test(next) && !regex.test(current)) {\n return true\n }\n\n if (hasSpaceAfter && regex.test(current) && !regex.test(next)) {\n return true\n }\n }\n\n return false\n },\n}\n\n/**\n * \u8A00\u8A9E\u30AF\u30E9\u30B9\u306B\u95A2\u9023\u3059\u308B\u51E6\u7406\u3092\u63D0\u4F9B\u3059\u308B\u30AF\u30E9\u30B9\u3067\u3059\u3002\n * \u6587\u7AE0\u5185\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\u304C\u3069\u306E\u8A00\u8A9E\u30AF\u30E9\u30B9\u306B\u5C5E\u3059\u308B\u304B\u3092\u5224\u5B9A\u3057\u3001\n * \u305D\u308C\u306B\u5FDC\u3058\u305F\u30C6\u30AD\u30B9\u30C8\u51E6\u7406\u3092\u884C\u3046\u305F\u3081\u306E\u30E1\u30BD\u30C3\u30C9\u3092\u63D0\u4F9B\u3057\u307E\u3059\u3002\n */\nconst LanguageClass = {\n /**\n * \u30BB\u30B0\u30E1\u30F3\u30C8\u304C\u30E9\u30C6\u30F3\u6587\u5B57\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u308B\u304B\u3069\u3046\u304B\u3092\u5224\u5B9A\u3057\u307E\u3059\u3002\n * @param segment - \u5224\u5B9A\u3059\u308B\u30C6\u30AD\u30B9\u30C8\u30BB\u30B0\u30E1\u30F3\u30C8\n * @return \u30E9\u30C6\u30F3\u6587\u5B57\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u308B\u5834\u5408\u306Ftrue\u3001\u305D\u3046\u3067\u306A\u3044\u5834\u5408\u306Ffalse\n */\n isLatin: (segment: string): boolean => {\n return utils.latinRegex.test(segment)\n },\n\n /**\n * \u30BB\u30B0\u30E1\u30F3\u30C8\u304C\u65E5\u672C\u8A9E\u6587\u5B57\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u308B\u304B\u3069\u3046\u304B\u3092\u5224\u5B9A\u3057\u307E\u3059\u3002\n * @param segment - \u5224\u5B9A\u3059\u308B\u30C6\u30AD\u30B9\u30C8\u30BB\u30B0\u30E1\u30F3\u30C8\n * @return \u65E5\u672C\u8A9E\u6587\u5B57\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u308B\u5834\u5408\u306Ftrue\u3001\u305D\u3046\u3067\u306A\u3044\u5834\u5408\u306Ffalse\n */\n isJapanese: (segment: string): boolean => {\n return utils.japaneseRegex.test(segment)\n },\n\n /**\n * 2\u3064\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\u304C\u7570\u306A\u308B\u8A00\u8A9E\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u308B\u304B\u3069\u3046\u304B\u3092\u5224\u5B9A\u3057\u307E\u3059\u3002\n * @param current - \u73FE\u5728\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\n * @param next - \u6B21\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\n * @return 2\u3064\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\u304C\u7570\u306A\u308B\u8A00\u8A9E\u304C\u3069\u3046\u304B\n */\n isDifferentLanguageClass: (current: string, next: string): boolean => {\n return (\n (LanguageClass.isJapanese(current) && LanguageClass.isLatin(next)) ||\n (LanguageClass.isLatin(current) && LanguageClass.isJapanese(next))\n )\n },\n\n /**\n * 2\u3064\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\u9593\u306B\u56DB\u5206\u30A2\u30AD\u3092\u8FFD\u52A0\u3059\u3079\u304D\u304B\u3092\u5224\u65AD\u3057\u307E\u3059\u3002\n * @param current - \u73FE\u5728\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\n * @param next - \u6B21\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\n * @return \u56DB\u5206\u30A2\u30AD\u3092\u8FFD\u52A0\u3059\u3079\u304D\u304B\u3069\u3046\u304B\n */\n shouldAddThinSpace: (current: string, next: string): boolean => {\n return LanguageClass.isDifferentLanguageClass(current, next)\n },\n}\n\nexport { CharClass, LanguageClass }\n", "/**\n * \u30E6\u30FC\u30B6\u30FC\u30A4\u30F3\u30BF\u30FC\u30D5\u30A7\u30FC\u30B9\u306E\u30A2\u30AF\u30BB\u30B7\u30D3\u30EA\u30C6\u30A3\u3068\u691C\u7D22\u30A8\u30F3\u30B8\u30F3\u306E\u6700\u9069\u5316\u306B\u95A2\u9023\u3059\u308B\u8A2D\u5B9A\u3092\u5B9A\u7FA9\u3057\u307E\u3059\u3002\n * - preventSelect: \u30E6\u30FC\u30B6\u30FC\u304C\u30C6\u30AD\u30B9\u30C8\u3092\u9078\u629E\u3057\u3066\u30B3\u30D4\u30FC\u3059\u308B\u3053\u3068\u3092\u9632\u6B62\u3057\u307E\u3059\u3002\n * - hiddenFromReader: \u30B9\u30AF\u30EA\u30FC\u30F3\u30EA\u30FC\u30C0\u30FC\u306A\u3069\u306E\u30A2\u30AF\u30BB\u30B7\u30D3\u30EA\u30C6\u30A3\u30C4\u30FC\u30EB\u304B\u3089\u3053\u306E\u8981\u7D20\u3092\u96A0\u3057\u307E\u3059\u3002\n * - noIndex: \u691C\u7D22\u30A8\u30F3\u30B8\u30F3\u304C\u3053\u306E\u8981\u7D20\u306E\u5185\u5BB9\u3092\u691C\u7D22\u7D50\u679C\u306E\u30B9\u30CB\u30DA\u30C3\u30C8\u3068\u3057\u3066\u8868\u793A\u3057\u306A\u3044\u3088\u3046\u306B\u3057\u307E\u3059\u3002\n */\nconst uiIgnoreSettings = {\n styles: {\n preventSelect: 'user-select:none;',\n },\n attributes: {\n hiddenFromReader: 'aria-hidden=\"true\"',\n noIndex: 'data-nosnippet=\"\"',\n },\n}\n\n/**\n * `<wbr>`\u30BF\u30B0\u306FHTML\u6587\u66F8\u5185\u3067\u5358\u8A9E\u306E\u533A\u5207\u308A\u3092\u793A\u3057\u3001\u5FC5\u8981\u306B\u5FDC\u3058\u3066\u6539\u884C\u306E\u633F\u5165\u3092\u8A31\u53EF\u3059\u308B\u30BF\u30B0\u3067\u3059\u3002\n */\nconst wbr = '<wbr>'\n\n/**\n * THIN SPACE\u3092\u6307\u5B9A\u3057\u305F\u5E45\u3067\u751F\u6210\u3059\u308B\u95A2\u6570\u3067\u3059\u3002\n * @param thisSpaceWidth - THIN SPACE\u306E\u5E45\u3002\n * @param classNamePrefix - \u9069\u7528\u3059\u308BCSS\u30AF\u30E9\u30B9\u540D\u306E\u30D7\u30EC\u30D5\u30A3\u30C3\u30AF\u30B9\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306F 'typeset'\u3002\n * @return \u30B9\u30BF\u30A4\u30EB\u9069\u7528\u3055\u308C\u305FTHIN SPACE\u3092\u542B\u3080span\u30BF\u30B0\u3002\n */\nconst createThinSpaceSpan = (thisSpaceWidth: string, classNamePrefix: string): string => {\n const THIN_SPACE = String.fromCharCode(0x2009) // U+2009 THIN SPACE\n const className = classNamePrefix + '-thin-space'\n const style = `font-size: ${thisSpaceWidth}; ${uiIgnoreSettings.styles.preventSelect}`\n return `<span class=\"${className}\" style=\"${style}\" ${uiIgnoreSettings.attributes.hiddenFromReader} ${uiIgnoreSettings.attributes.noIndex}>${THIN_SPACE}</span>`\n}\n\n/**\n * \u6307\u5B9A\u3057\u305F\u6570\u5024\u3067\u30AB\u30FC\u30CB\u30F3\u30B0\uFF08\u6587\u5B57\u9593\u9694\u8ABF\u6574\uFF09\u30BF\u30B0\u3092\u751F\u6210\u3059\u308B\u95A2\u6570\u3067\u3059\u3002\n *\n * @param kerningValue - \u30AB\u30FC\u30CB\u30F3\u30B0\u5024\uFF08\u5343\u5206\u7387\uFF09\u3002\u4F8B: 1000 \u306F 1em \u306E\u30AB\u30FC\u30CB\u30F3\u30B0\u3092\u610F\u5473\u3057\u307E\u3059\u3002\n * @param classNamePrefix - \u9069\u7528\u3059\u308BCSS\u30AF\u30E9\u30B9\u540D\u306E\u30D7\u30EC\u30D5\u30A3\u30C3\u30AF\u30B9\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306F 'typeset'\u3002\n * @return \u30AB\u30FC\u30CB\u30F3\u30B0\u9069\u7528\u5F8C\u306EHTML\u30B3\u30F3\u30C6\u30F3\u30C4\u3002\n */\nconst createKerningSpan = (kerningValue: number, classNamePrefix: string): string => {\n const emValue = kerningValue / 1000 / 2 + 'em'\n const className = classNamePrefix + '-kerning'\n const style = `margin: ${emValue}; ${uiIgnoreSettings.styles.preventSelect}`\n return `<span class=\"${className}\" style=\"${style}\" ${uiIgnoreSettings.attributes.hiddenFromReader} ${uiIgnoreSettings.attributes.noIndex}></span>`\n}\n\n/**\n * \u4E0E\u3048\u3089\u308C\u305F\u30C6\u30AD\u30B9\u30C8\u306Bword-break\u3068overflow-wrap\u30B9\u30BF\u30A4\u30EB\u3092\u9069\u7528\u3057\u307E\u3059\u3002\n * @param text - \u30B9\u30BF\u30A4\u30EB\u3092\u9069\u7528\u3059\u308B\u30C6\u30AD\u30B9\u30C8\u3002\n * @param classNamePrefix - \u9069\u7528\u3059\u308BCSS\u30AF\u30E9\u30B9\u540D\u306E\u30D7\u30EC\u30D5\u30A3\u30C3\u30AF\u30B9\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306F 'typeset'\u3002\n * @param useWordBreak - \u5358\u8A9E\u3084\u52A9\u8A5E\u306A\u3069\u3001\u5358\u8A9E\u533A\u5207\u308A\u3067\u306E\u6539\u884C\u3092\u884C\u3046\u304B\u3069\u3046\u304B\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306F true\u3002\n * @return \u30B9\u30BF\u30A4\u30EB\u9069\u7528\u3055\u308C\u305F\u30C6\u30AD\u30B9\u30C8\u3092\u542B\u3080span\u30BF\u30B0\u3002\n */\nconst applyWrapperStyle = (text: string, classNamePrefix: string, useWordBreak: boolean): string => {\n // <wbr> \u4EE5\u5916\u306E\u7B87\u6240\u3067\u6539\u884C\u3057\u306A\u3044\u305F\u3081\u306E\u30B9\u30BF\u30A4\u30EA\u30F3\u30B0\n const style = useWordBreak ? 'word-break: keep-all; overflow-wrap: anywhere;' : ''\n return `<span class=\"${classNamePrefix}\" style=\"${style}\">${text}</span>`\n}\n\n/**\n * \u4E0E\u3048\u3089\u308C\u305F\u30BB\u30B0\u30E1\u30F3\u30C8\u306B\u30AF\u30E9\u30B9\u540D\u3092\u9069\u7528\u3057\u307E\u3059\u3002\n * @param segment - \u30AF\u30E9\u30B9\u3092\u9069\u7528\u3059\u308B\u30BB\u30B0\u30E1\u30F3\u30C8\u3002\n * @param classNamePrefix - \u9069\u7528\u3059\u308BCSS\u30AF\u30E9\u30B9\u540D\u306E\u30D7\u30EC\u30D5\u30A3\u30C3\u30AF\u30B9\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306F 'typeset'\u3002\n * @return \u30AF\u30E9\u30B9\u9069\u7528\u3055\u308C\u305F\u30BB\u30B0\u30E1\u30F3\u30C8\u3092\u542B\u3080span\u30BF\u30B0\u3002\n */\nconst applyLatinStyle = (segment: string, classNamePrefix: string): string => {\n const className = classNamePrefix + '-latin'\n return `<span class=\"${className}\">${segment}</span>`\n}\n\n/**\n * \u4E0E\u3048\u3089\u308C\u305F\u30BB\u30B0\u30E1\u30F3\u30C8\u306Bno-break\u30B9\u30BF\u30A4\u30EB\u3092\u9069\u7528\u3057\u307E\u3059\u3002\n * @param segment - \u30B9\u30BF\u30A4\u30EB\u3092\u9069\u7528\u3059\u308B\u30BB\u30B0\u30E1\u30F3\u30C8\u3002\n * @param classNamePrefix - \u9069\u7528\u3059\u308BCSS\u30AF\u30E9\u30B9\u540D\u306E\u30D7\u30EC\u30D5\u30A3\u30C3\u30AF\u30B9\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306F 'typeset'\u3002\n * @return \u30B9\u30BF\u30A4\u30EB\u9069\u7528\u3055\u308C\u305F\u30BB\u30B0\u30E1\u30F3\u30C8\u3092\u542B\u3080span\u30BF\u30B0\u3002\n */\nconst applyNoBreakStyle = (segment: string, classNamePrefix: string): string => {\n const className = classNamePrefix + '-no-breaks'\n return `<span class=\"${className}\" style=\"letter-spacing: 0\">${segment}</span>`\n}\n\nexport { wbr, createThinSpaceSpan, createKerningSpan, applyWrapperStyle, applyLatinStyle, applyNoBreakStyle }\n", "import LineBreaker from 'linebreak'\nimport { CharClass, LanguageClass } from './utils-text-classes'\nimport { wbr, createThinSpaceSpan } from './utils-tags'\nimport { TypesettingOptions } from './types'\n\n/**\n * HTML\u30C6\u30AD\u30B9\u30C8\u30CE\u30FC\u30C9\u306B\u30BB\u30D1\u30EC\u30FC\u30BF\u30FC\uFF08\u56DB\u5206\u30A2\u30AD\u3001<wbr>\uFF09\u3092\u633F\u5165\u3057\u307E\u3059\u3002\n * @param currentText - \u73FE\u5728\u306E\u30C6\u30AD\u30B9\u30C8\u30CE\u30FC\u30C9\n * @param nextText - \u6B21\u306E\u30C6\u30AD\u30B9\u30C8\u30CE\u30FC\u30C9\n * @return \u30BB\u30D1\u30EC\u30FC\u30BF\u30FC\u3092\u633F\u5165\u3057\u305FHTML\u6587\u5B57\u5217\n */\nconst insertSeparatorsToText = (currentText: string, nextText: string, options: TypesettingOptions): string => {\n const currentSegments = createSegments(currentText)\n const nextSegments = createSegments(nextText)\n\n const formattedText = currentSegments.reduce((accumulatedText, segment, index, array) => {\n const current = segment\n const next = array[index + 1] || nextSegments[0]\n return accumulatedText + addSeparatorsToSegment(current, next, options)\n }, '')\n\n return formattedText\n}\n\n/**\n * \u6587\u7AE0\u304B\u3089\u6587\u7BC0\u533A\u5207\u308A\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\u306E\u914D\u5217\u3092\u751F\u6210\u3057\u307E\u3059\u3002\n * @param src - \u30BD\u30FC\u30B9\u30C6\u30AD\u30B9\u30C8\n * @return \u6587\u7AE0\u304B\u3089\u751F\u6210\u3055\u308C\u305F\u30BB\u30B0\u30E1\u30F3\u30C8\u306E\u914D\u5217\n */\nconst createSegments = (src: string): string[] => {\n const segmenter = new Intl.Segmenter('ja-JP', { granularity: 'word' })\n return Array.from(segmenter.segment(src), ({ segment }) => segment)\n}\n\n/**\n * 2\u3064\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\u9593\u306B\u30BB\u30D1\u30EC\u30FC\u30BF\u30FC\uFF08\u56DB\u5206\u30A2\u30AD\u3001<wbr>\uFF09\u3092\u8FFD\u52A0\u3057\u307E\u3059\u3002\n * @param current - \u73FE\u5728\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\n * @param next - \u6B21\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\n * @return \u30BB\u30D1\u30EC\u30FC\u30BF\u30FC\u3092\u8FFD\u52A0\u3057\u305F\u30BB\u30B0\u30E1\u30F3\u30C8\n */\nconst addSeparatorsToSegment = (current: string, next = '', options: TypesettingOptions): string => {\n if (!next) return current\n\n const addWbr = options.useWordBreak && shouldAddWbr(current, next)\n const addSpace = options.insertThinSpaces && shouldAddThinSpace(current, next)\n return (\n current +\n (addSpace ? createThinSpaceSpan(options.thinSpaceWidth, options.classNamePrefix) : '') +\n (addWbr ? wbr : '')\n )\n}\n\n/**\n * 2\u3064\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\u9593\u306B<wbr>\u3092\u8FFD\u52A0\u3059\u3079\u304D\u304B\u3092\u5224\u65AD\u3057\u307E\u3059\u3002\n * @param current - \u73FE\u5728\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\n * @param next - \u6B21\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\n * @return <wbr>\u3092\u8FFD\u52A0\u3059\u3079\u304D\u304B\u3069\u3046\u304B\n */\nconst shouldAddWbr = (current: string, next: string): boolean | null => {\n const combinedText = current.slice(-1) + next.slice(0, 1)\n const lb = new LineBreaker(combinedText)\n const breakOpportunity = lb.nextBreak()\n return breakOpportunity && breakOpportunity.position === 1\n}\n\n/**\n * 2\u3064\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\u9593\u306B\u56DB\u5206\u30A2\u30AD\u3092\u8FFD\u52A0\u3059\u3079\u304D\u304B\u3092\u5224\u65AD\u3057\u307E\u3059\u3002\n * @param current - \u73FE\u5728\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\n * @param next - \u6B21\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\n * @return \u56DB\u5206\u30A2\u30AD\u3092\u8FFD\u52A0\u3059\u3079\u304D\u304B\u3069\u3046\u304B\n */\nconst shouldAddThinSpace = (current: string, next: string): boolean => {\n return LanguageClass.shouldAddThinSpace(current, next) || CharClass.shouldAddThinSpace(current, next)\n}\n\nexport default insertSeparatorsToText\nexport { createSegments, addSeparatorsToSegment, shouldAddWbr, shouldAddThinSpace }\n", "import { CharClass, LanguageClass } from './utils-text-classes'\nimport { applyWrapperStyle, applyLatinStyle, applyNoBreakStyle, createKerningSpan } from './utils-tags'\nimport { TypesettingOptions } from './types'\n\n/**\n * \u4E0E\u3048\u3089\u308C\u305F\u30C6\u30AD\u30B9\u30C8\u306B\u5BFE\u3057\u3066\u3001word-break\u3068overflow-wrap\u30B9\u30BF\u30A4\u30EB\u3092\u6301\u3064span\u30BF\u30B0\u3067\u30E9\u30C3\u30D7\u3057\u307E\u3059\u3002\n *\n * @param text - \u30B9\u30BF\u30A4\u30EA\u30F3\u30B0\u3055\u308C\u308B\u30C6\u30AD\u30B9\u30C8\u3002\n * @return \u30B9\u30BF\u30A4\u30EA\u30F3\u30B0\u3055\u308C\u305F\u30C6\u30AD\u30B9\u30C8\u3002\u30C6\u30AD\u30B9\u30C8\u304C\u7A7A\u306E\u5834\u5408\u306F\u3001\u305D\u306E\u307E\u307E\u8FD4\u3055\u308C\u307E\u3059\u3002\n */\nconst applyStyleToText = (currentNodeValue: string, nextNodeValue: string, options: TypesettingOptions): string => {\n // \u3053\u3053\u3067\u306F nextNodeValue \u3092\u4F7F\u7528\u3057\u3066\u3044\u307E\u305B\u3093\u304C\u3001\u95A2\u6570\u306E\u30B7\u30B0\u30CD\u30C1\u30E3\u306FTransformFunction\u306B\u5408\u308F\u305B\u3066\u3044\u307E\u3059\u3002\n if (currentNodeValue === ' ') {\n return currentNodeValue\n }\n\n return applyWrapperStyle(currentNodeValue, options.classNamePrefix, options.useWordBreak)\n}\n\n/**\n * \u4E0E\u3048\u3089\u308C\u305F\u30C6\u30AD\u30B9\u30C8\u30BB\u30B0\u30E1\u30F3\u30C8\u306B\u30B9\u30BF\u30A4\u30EA\u30F3\u30B0\u3092\u9069\u7528\u3057\u307E\u3059\u3002\u3053\u308C\u306B\u306F\u3001\u30BB\u30B0\u30E1\u30F3\u30C8\u306E\u5185\u5BB9\u306B\u57FA\u3065\u3044\u3066\u3001\n * \u7279\u5B9A\u306E\u30AF\u30E9\u30B9\u307E\u305F\u306F\u30B9\u30BF\u30A4\u30EB\u3067HTML\u306Espan\u30BF\u30B0\u3067\u30BB\u30B0\u30E1\u30F3\u30C8\u3092\u30E9\u30C3\u30D7\u3059\u308B\u3053\u3068\u304C\u542B\u307E\u308C\u308B\u5834\u5408\u304C\u3042\u308A\u307E\u3059\u3002\n *\n * @param segment - \u30B9\u30BF\u30A4\u30EA\u30F3\u30B0\u3055\u308C\u308B\u30C6\u30AD\u30B9\u30C8\u30BB\u30B0\u30E1\u30F3\u30C8\u3002\n * @return \u30B9\u30BF\u30A4\u30EA\u30F3\u30B0\u3055\u308C\u305F\u30C6\u30AD\u30B9\u30C8\u30BB\u30B0\u30E1\u30F3\u30C8\u3002\u30BB\u30B0\u30E1\u30F3\u30C8\u304C\u30B9\u30DA\u30FC\u30B9\u3067\u3042\u308B\u304B\u3001\u7279\u5225\u306A\u30B9\u30BF\u30A4\u30EA\u30F3\u30B0\u304C\u4E0D\u8981\u3067\u3042\u308C\u3070\u3001\n * \u305D\u306E\u307E\u307E\u8FD4\u3055\u308C\u307E\u3059\u3002\u305D\u308C\u4EE5\u5916\u306E\u5834\u5408\u306F\u3001\u9069\u5207\u306A\u30B9\u30BF\u30A4\u30EA\u30F3\u30B0\u3067span\u30BF\u30B0\u3067\u30E9\u30C3\u30D7\u3055\u308C\u307E\u3059\u3002\n */\nconst applyStyleToSegment = (currentSegment: string, nextSegment: string, options: TypesettingOptions): string => {\n // \u30BB\u30B0\u30E1\u30F3\u30C8\u304C\u30B9\u30DA\u30FC\u30B9\u3067\u3042\u308C\u3070\u305D\u306E\u307E\u307E\u8FD4\u3059\n if (currentSegment === ' ') {\n return currentSegment\n }\n\n const kernedSegment = applyKerningToSegment(currentSegment, nextSegment, options)\n\n // \u30E9\u30C6\u30F3\u6587\u5B57\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\u306B\u306F 'latin' \u30AF\u30E9\u30B9\u3092\u9069\u7528\n if (options.wrapLatin && LanguageClass.isLatin(currentSegment)) {\n return applyLatinStyle(kernedSegment, options.classNamePrefix)\n }\n\n // \u6539\u884C\u3092\u3057\u306A\u3044\u30BB\u30B0\u30E1\u30F3\u30C8\u306B\u306F\u30BC\u30ED\u306E\u6587\u5B57\u9593\u9694\u30B9\u30BF\u30A4\u30EB\u3092\u9069\u7528\n if (options.noSpaceBetweenNoBreaks && CharClass.shouldNotBreak(currentSegment)) {\n return applyNoBreakStyle(kernedSegment, options.classNamePrefix)\n }\n\n return kernedSegment\n}\n\n/**\n * \u30AB\u30FC\u30CB\u30F3\u30B0\u30EB\u30FC\u30EB\u306B\u57FA\u3065\u304D\u3001\u30C6\u30AD\u30B9\u30C8\u30BB\u30B0\u30E1\u30F3\u30C8\u306B\u30AB\u30FC\u30CB\u30F3\u30B0\u3092\u9069\u7528\u3057\u307E\u3059\u3002\n *\n * @param currentSegment - \u30AB\u30FC\u30CB\u30F3\u30B0\u3092\u9069\u7528\u3059\u308B\u73FE\u5728\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\u3002\n * @param nextSegment - \u6B21\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\uFF08\u30AB\u30FC\u30CB\u30F3\u30B0\u9069\u7528\u306E\u5224\u65AD\u306B\u4F7F\u7528\uFF09\u3002\n * @param kerningRules - \u9069\u7528\u3059\u308B\u30AB\u30FC\u30CB\u30F3\u30B0\u30EB\u30FC\u30EB\u306E\u914D\u5217\u3002\n * @return \u30AB\u30FC\u30CB\u30F3\u30B0\u9069\u7528\u5F8C\u306E\u30C6\u30AD\u30B9\u30C8\u30BB\u30B0\u30E1\u30F3\u30C8\u3002\n */\nconst applyKerningToSegment = (currentSegment: string, nextSegment: string, options: TypesettingOptions): string => {\n const chars = [...currentSegment]\n\n const kernedChars = chars.map((currentChar, i) => {\n const nextChar = chars[i + 1] || nextSegment[0] || ''\n const kerningRule = options.kerningRules.find(\n rule => rule.between[0] === currentChar && rule.between[1] === nextChar\n )\n\n if (kerningRule) {\n const kerningValue = typeof kerningRule.value === 'number' ? kerningRule.value : parseInt(kerningRule.value, 10)\n return currentChar + createKerningSpan(kerningValue, options.classNamePrefix)\n }\n\n return currentChar\n })\n\n return kernedChars.join('')\n}\n\nexport { applyStyleToText, applyStyleToSegment }\n", "import HTMLProcessor from './html-processor'\nimport insertSeparatorsToText from './insert-separators'\nimport { applyStyleToText, applyStyleToSegment } from './apply-style'\nimport win from './win'\nimport type { TypesettingOptions, KerningRule } from './types'\n\n/**\n * HTML\u30C6\u30AD\u30B9\u30C8\u3092\u51E6\u7406\u3057\u3001\u30AB\u30B9\u30BF\u30E0\u30B9\u30BF\u30A4\u30EB\u3068\u533A\u5207\u308A\u6587\u5B57\u3092\u9069\u7528\u3059\u308B\u305F\u3081\u306E\u30AF\u30E9\u30B9\u3002\n * HTMLProcessor \u30AF\u30E9\u30B9\u3092\u62E1\u5F35\u3057\u3001\u7279\u5B9A\u306E\u5909\u63DB\u95A2\u6570\u3092\u9069\u7528\u3057\u307E\u3059\u3002\n */\nclass Typesetter extends HTMLProcessor {\n /**\n * Typesetter \u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u8A2D\u5B9A\u3067\u3059\u3002\n */\n static defaultOptions: TypesettingOptions = {\n classNamePrefix: 'typeset',\n useWordBreak: true,\n wrapLatin: true,\n noSpaceBetweenNoBreaks: true,\n insertThinSpaces: true,\n thinSpaceWidth: '50%',\n kerningRules: [],\n }\n\n /**\n * Intl.Segmenter API \u304C\u73FE\u5728\u306E\u5B9F\u884C\u74B0\u5883\u3067\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u308B\u304B\u3069\u3046\u304B\u3092\u793A\u3057\u307E\u3059\u3002\n */\n private isIntlSegmenterSupported: boolean\n\n constructor(options: Partial<TypesettingOptions> = {}) {\n const transformFunctions = [applyStyleToText, insertSeparatorsToText, applyStyleToSegment]\n const validatedOptions = Typesetter.validateOptions(options)\n\n super(transformFunctions, validatedOptions)\n\n /**\n * \u73FE\u5728\u306E\u5B9F\u884C\u74B0\u5883\u3067 Intl.Segmenter \u304C\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u308B\u304B\u3069\u3046\u304B\u3092\u78BA\u8A8D\u3057\u307E\u3059\u3002\n * Intl.Segmenter \u306F\u3001\u30C6\u30AD\u30B9\u30C8\u3092\u8A00\u8A9E\u56FA\u6709\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\u306B\u5206\u5272\u3059\u308B\u6A5F\u80FD\u3092\u63D0\u4F9B\u3057\u307E\u3059\u3002\n * \u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u306A\u3044\u5834\u5408\u306F\u8B66\u544A\u3092\u30B3\u30F3\u30BD\u30FC\u30EB\u306B\u8868\u793A\u3057\u307E\u3059\u3002\n */\n this.isIntlSegmenterSupported = typeof Intl.Segmenter !== 'undefined'\n if (!this.isIntlSegmenterSupported) {\n console.warn(`\n Intl.Segmenter is not supported in this environment. \n The original HTML string will be returned. \n For more information, see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter\n `)\n }\n }\n\n /**\n * \u4E0E\u3048\u3089\u308C\u305F\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u691C\u8A3C\u3057\u3001\u4FEE\u6B63\u3055\u308C\u305F\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u8FD4\u3057\u307E\u3059\u3002\n *\n * @param options - \u691C\u8A3C\u3059\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u3002\n * @return \u4FEE\u6B63\u3055\u308C\u305F\u30AA\u30D7\u30B7\u30E7\u30F3\u3002\n */\n private static validateOptions(options: Partial<TypesettingOptions>): TypesettingOptions {\n if (options.kerningRules) {\n options.kerningRules = options.kerningRules.filter(Typesetter.isValidKerningRule)\n }\n\n // \u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u3068\u30DE\u30FC\u30B8\n return {\n ...Typesetter.defaultOptions,\n ...options,\n }\n }\n\n /**\n * \u30AB\u30FC\u30CB\u30F3\u30B0\u30EB\u30FC\u30EB\u304C\u9069\u5207\u304B\u3069\u3046\u304B\u3092\u691C\u8A3C\u3057\u307E\u3059\u3002\n *\n * @param kerningRule - \u691C\u8A3C\u3059\u308B\u30AB\u30FC\u30CB\u30F3\u30B0\u30EB\u30FC\u30EB\u3002\n * @return \u30EB\u30FC\u30EB\u304C\u6709\u52B9\u306A\u5834\u5408\u306Ftrue\u3001\u305D\u3046\u3067\u306A\u3044\u5834\u5408\u306Ffalse\u3002\n */\n private static isValidKerningRule(kerningRule: KerningRule): boolean {\n if (kerningRule.between[0].length !== 1 || kerningRule.between[1].length !== 1) {\n console.warn(\n `Kerning rule between '${kerningRule.between[0]}' and '${kerningRule.between[1]}' must be single characters.`\n )\n return false\n }\n\n return true\n }\n\n /**\n * \u4E0E\u3048\u3089\u308C\u305FHTML\u6587\u5B57\u5217\u3092\u51E6\u7406\u3057\u3001\u6307\u5B9A\u3055\u308C\u305F\u30B9\u30BF\u30A4\u30EB\u3068\u533A\u5207\u308A\u6587\u5B57\u3092\u9069\u7528\u3057\u305F\u7D50\u679C\u3092\u8FD4\u3057\u307E\u3059\u3002\n *\n * @param srcHtml - \u51E6\u7406\u3059\u308BHTML\u6587\u5B57\u5217\u3002\n * @return \u51E6\u7406\u5F8C\u306EHTML\u6587\u5B57\u5217\u3002\n */\n render(srcHtml: string): string {\n if (!this.isIntlSegmenterSupported || !srcHtml) {\n return srcHtml\n }\n\n return this.processHtmlWithFunctions(srcHtml)\n }\n\n /**\n * \u4E0E\u3048\u3089\u308C\u305FElement\u307E\u305F\u306FElement\u306E\u914D\u5217\u306B\u5BFE\u3057\u3066\u3001\u30B9\u30BF\u30A4\u30EB\u3068\u533A\u5207\u308A\u6587\u5B57\u3092\u9069\u7528\u3057\u307E\u3059\u3002\n * \u5404\u8981\u7D20\u306EinnerHTML\u3092\u53D6\u5F97\u3057\u3001\u5909\u63DB\u51E6\u7406\u3092\u9069\u7528\u3057\u305F\u5F8C\u3001\u5909\u63DB\u3055\u308C\u305FHTML\u3067\u5143\u306E\u5185\u5BB9\u3092\u7F6E\u304D\u63DB\u3048\u307E\u3059\u3002\n *\n * @param elements - \u30B9\u30BF\u30A4\u30EB\u3092\u9069\u7528\u3059\u308BElement\u307E\u305F\u306FHTMLElement\u306E\u914D\u5217\u3002\n */\n renderToElements(elements: Element | Element[] | null): void {\n if (!this.isIntlSegmenterSupported || !elements) {\n return\n }\n\n if (!Array.isArray(elements)) {\n elements = [elements]\n }\n\n elements.forEach(element => {\n const processedHtml = this.render(element.innerHTML)\n element.innerHTML = processedHtml\n })\n }\n\n /**\n * \u6307\u5B9A\u3055\u308C\u305FCSS\u30BB\u30EC\u30AF\u30BF\u306B\u4E00\u81F4\u3059\u308B\u3059\u3079\u3066\u306E\u8981\u7D20\u306B\u30B9\u30BF\u30A4\u30EB\u3092\u9069\u7528\u3057\u307E\u3059\u3002\n * document.querySelectorAll\u3092\u4F7F\u7528\u3057\u3066\u8981\u7D20\u3092\u53D6\u5F97\u3057\u3001\u305D\u308C\u305E\u308C\u306B\u5BFE\u3057\u3066\u30B9\u30BF\u30A4\u30EB\u9069\u7528\u51E6\u7406\u3092\u884C\u3044\u307E\u3059\u3002\n *\n * @param selector - \u30B9\u30BF\u30A4\u30EB\u3092\u9069\u7528\u3059\u308B\u8981\u7D20\u3092\u9078\u629E\u3059\u308BCSS\u30BB\u30EC\u30AF\u30BF\u3002\n */\n renderToSelector(selector: string | null): void {\n if (!this.isIntlSegmenterSupported || !selector) {\n return\n }\n\n const elements = win.document.querySelectorAll(selector)\n this.renderToElements(Array.from(elements))\n }\n}\n\nexport default Typesetter\n", "import Typesetter from '.'\n\nmodule.exports = Typesetter\n"],
|
|
5
|
+
"mappings": "0KAKA,IAAMA,GAAM,OAEZC,EAAA,QAAeD,uMCPf,IAAAE,EAAAC,GAAA,GAAA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,IAIlC,MAAM,QAAQA,CAAQ,IACzBA,EAAW,CAACA,CAAQ,GAGtBA,EAAS,QAAQC,GAAU,CACzB,IAAMC,EAAgB,KAAK,OAAOD,EAAQ,SAAS,EACnDA,EAAQ,UAAYC,CACtB,CAAC,EACH,CAQA,iBAAiBC,EAAuB,CACtC,GAAI,CAAC,KAAK,0BAA4B,CAACA,EACrC,OAGF,IAAMH,EAAWR,GAAA,QAAI,SAAS,iBAAiBW,CAAQ,EACvD,KAAK,iBAAiB,MAAM,KAAKH,CAAQ,CAAC,CAC5C,GAvHOP,EAAA,eAAqC,CAC1C,gBAAiB,UACjB,aAAc,GACd,UAAW,GACX,uBAAwB,GACxB,iBAAkB,GAClB,eAAgB,MAChB,aAAc,CAAA,GAmHlBW,EAAA,QAAeX,sJCxIf,IAAAY,GAAAC,GAAA,IAAA,EAEAC,GAAO,QAAUF,GAAA",
|
|
6
|
+
"names": ["win", "exports", "win_1", "__importDefault", "HTMLProcessor", "transformFunctions", "options", "node", "transformedHtml", "range", "fragment", "srcHtml", "currentHtml", "transformFunction", "html", "doc", "parseFromString", "textNodes", "getTextNodes", "currentNode", "index", "nextNode", "exports", "element", "walk", "textNode", "require_tiny_inflate", "__commonJSMin", "exports", "module", "TINF_OK", "TINF_DATA_ERROR", "Tree", "Data", "source", "dest", "sltree", "sdtree", "length_bits", "length_base", "dist_bits", "dist_base", "clcidx", "code_tree", "lengths", "tinf_build_bits_base", "bits", "base", "delta", "first", "i", "sum", "tinf_build_fixed_trees", "lt", "dt", "offs", "tinf_build_tree", "t", "off", "num", "tinf_getbit", "d", "bit", "tinf_read_bits", "val", "tinf_decode_symbol", "cur", "len", "tag", "tinf_decode_trees", "hlit", "hdist", "hclen", "length", "clen", "sym", "prev", "tinf_inflate_block_data", "dist", "tinf_inflate_uncompressed_block", "invlength", "tinf_uncompress", "bfinal", "btype", "res", "require_swap", "__commonJSMin", "exports", "module", "isBigEndian", "swap", "b", "n", "m", "swap32", "array", "len", "i", "swap32LE", "require_unicode_trie", "__commonJSMin", "exports", "module", "inflate", "swap32LE", "SHIFT_1", "SHIFT_2", "SHIFT_1_2", "OMITTED_BMP_INDEX_1_LENGTH", "INDEX_2_BLOCK_LENGTH", "INDEX_2_MASK", "INDEX_SHIFT", "DATA_BLOCK_LENGTH", "DATA_MASK", "LSCP_INDEX_2_OFFSET", "LSCP_INDEX_2_LENGTH", "INDEX_2_BMP_LENGTH", "UTF8_2B_INDEX_2_OFFSET", "UTF8_2B_INDEX_2_LENGTH", "INDEX_1_OFFSET", "DATA_GRANULARITY", "UnicodeTrie", "data", "isBuffer", "uncompressedLength", "view", "codePoint", "index", "require_b64", "__commonJSMin", "exports", "lookup", "Arr", "PLUS", "SLASH", "NUMBER", "LOWER", "UPPER", "PLUS_URL_SAFE", "SLASH_URL_SAFE", "decode", "elt", "code", "b64ToByteArray", "b64", "i", "j", "l", "tmp", "placeHolders", "arr", "len", "L", "push", "v", "uint8ToBase64", "uint8", "extraBytes", "output", "temp", "length", "encode", "num", "tripletToBase64", "$60ff486a304db230$export$fb4028874a74450", "$60ff486a304db230$export$1bb1140fe1358b00", "$60ff486a304db230$export$f3e416a182673355", "$60ff486a304db230$export$24aa617c849a894a", "$60ff486a304db230$export$a73c4d14459b698d", "$60ff486a304db230$export$9e5d732f3676a9ba", "$60ff486a304db230$export$1dff41d5c0caca01", "$60ff486a304db230$export$30a74a373318dec6", "$60ff486a304db230$export$d710c5f50fc7496a", "$60ff486a304db230$export$66498d28055820a9", "$60ff486a304db230$export$eb6c6d0b7c8826f2", "$60ff486a304db230$export$de92be486109a1df", "$60ff486a304db230$export$606cfc2a8896c91f", "$60ff486a304db230$export$e51d3c675bb0140d", "$60ff486a304db230$export$da51c6332ad11d7b", "$60ff486a304db230$export$bea437c40441867d", "$60ff486a304db230$export$c4c7eecbfed13dc9", "$60ff486a304db230$export$98e1f8a379849661", "$1b6fba3281342923$export$98f50d781a474745", "$1b6fba3281342923$export$12ee1f8f5315ca7e", "$1b6fba3281342923$export$e4965ce242860454", "$1b6fba3281342923$export$8f14048969dcd45e", "$1b6fba3281342923$export$133eb141bf58aff4", "$1b6fba3281342923$export$5bdb8ccbf5c57afc", "$f898ea50f3b38ab8$var$data", "$parcel$interopDefault", "$kQ2hT$base64js", "$f898ea50f3b38ab8$var$classTrie", "$kQ2hT$unicodetrie", "$f898ea50f3b38ab8$var$mapClass", "c", "$f898ea50f3b38ab8$var$mapFirst", "$f898ea50f3b38ab8$var$Break", "position", "required", "$f898ea50f3b38ab8$var$LineBreaker", "code", "next", "lastClass", "shouldBreak", "firstClass", "string", "module", "exports", "utils", "__importStar", "CharClass", "segment", "current", "next", "settings", "regex", "hasSpaceBefore", "hasSpaceAfter", "exports", "LanguageClass", "uiIgnoreSettings", "wbr", "exports", "createThinSpaceSpan", "thisSpaceWidth", "classNamePrefix", "THIN_SPACE", "className", "style", "createKerningSpan", "kerningValue", "emValue", "applyWrapperStyle", "text", "useWordBreak", "applyLatinStyle", "segment", "applyNoBreakStyle", "linebreak_1", "__importDefault", "utils_text_classes_1", "utils_tags_1", "insertSeparatorsToText", "currentText", "nextText", "options", "currentSegments", "createSegments", "nextSegments", "accumulatedText", "segment", "index", "array", "current", "next", "addSeparatorsToSegment", "src", "segmenter", "exports", "addWbr", "shouldAddWbr", "addSpace", "shouldAddThinSpace", "combinedText", "breakOpportunity", "utils_text_classes_1", "utils_tags_1", "applyStyleToText", "currentNodeValue", "nextNodeValue", "options", "exports", "applyStyleToSegment", "currentSegment", "nextSegment", "kernedSegment", "applyKerningToSegment", "chars", "currentChar", "i", "nextChar", "kerningRule", "rule", "kerningValue", "html_processor_1", "__importDefault", "insert_separators_1", "apply_style_1", "win_1", "Typesetter", "_Typesetter", "options", "transformFunctions", "validatedOptions", "kerningRule", "srcHtml", "elements", "element", "processedHtml", "selector", "exports", "_1", "__importDefault", "module"]
|
|
7
|
+
}
|
package/dist/apply-style.js
CHANGED
|
@@ -31,7 +31,7 @@ const applyKerningToSegment = (currentSegment, nextSegment, options) => {
|
|
|
31
31
|
const kerningRule = options.kerningRules.find(rule => rule.between[0] === currentChar && rule.between[1] === nextChar);
|
|
32
32
|
if (kerningRule) {
|
|
33
33
|
const kerningValue = typeof kerningRule.value === 'number' ? kerningRule.value : parseInt(kerningRule.value, 10);
|
|
34
|
-
return (0, utils_tags_1.
|
|
34
|
+
return currentChar + (0, utils_tags_1.createKerningSpan)(kerningValue, options.classNamePrefix);
|
|
35
35
|
}
|
|
36
36
|
return currentChar;
|
|
37
37
|
});
|
package/dist/apply-style.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-style.js","sourceRoot":"","sources":["../src/apply-style.ts"],"names":[],"mappings":";;;AAAA,6DAA+D;AAC/D,
|
|
1
|
+
{"version":3,"file":"apply-style.js","sourceRoot":"","sources":["../src/apply-style.ts"],"names":[],"mappings":";;;AAAA,6DAA+D;AAC/D,6CAAuG;AASvG,MAAM,gBAAgB,GAAG,CAAC,gBAAwB,EAAE,aAAqB,EAAE,OAA2B,EAAU,EAAE;IAEhH,IAAI,gBAAgB,KAAK,GAAG,EAAE,CAAC;QAC7B,OAAO,gBAAgB,CAAA;IACzB,CAAC;IAED,OAAO,IAAA,8BAAiB,EAAC,gBAAgB,EAAE,OAAO,CAAC,eAAe,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;AAC3F,CAAC,CAAA;AA2DQ,4CAAgB;AAjDzB,MAAM,mBAAmB,GAAG,CAAC,cAAsB,EAAE,WAAmB,EAAE,OAA2B,EAAU,EAAE;IAE/G,IAAI,cAAc,KAAK,GAAG,EAAE,CAAC;QAC3B,OAAO,cAAc,CAAA;IACvB,CAAC;IAED,MAAM,aAAa,GAAG,qBAAqB,CAAC,cAAc,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA;IAGjF,IAAI,OAAO,CAAC,SAAS,IAAI,kCAAa,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;QAC/D,OAAO,IAAA,4BAAe,EAAC,aAAa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"}
|
package/dist/bundle.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":";;;;;AAAA,yCAA0B;AAE1B,MAAM,CAAC,OAAO,GAAG,UAAU,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TypesettingOptions } from './types';
|
|
2
2
|
declare const insertSeparatorsToText: (currentText: string, nextText: string, options: TypesettingOptions) => string;
|
|
3
|
-
declare const
|
|
3
|
+
declare const createSegments: (src: string) => string[];
|
|
4
4
|
declare const addSeparatorsToSegment: (current: string, next: string | undefined, options: TypesettingOptions) => string;
|
|
5
5
|
declare const shouldAddWbr: (current: string, next: string) => boolean | null;
|
|
6
6
|
declare const shouldAddThinSpace: (current: string, next: string) => boolean;
|
|
7
7
|
export default insertSeparatorsToText;
|
|
8
|
-
export {
|
|
8
|
+
export { createSegments, addSeparatorsToSegment, shouldAddWbr, shouldAddThinSpace };
|
|
9
9
|
//# sourceMappingURL=insert-separators.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insert-separators.d.ts","sourceRoot":"","sources":["../src/insert-separators.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAQ5C,QAAA,MAAM,sBAAsB,gBAAiB,MAAM,YAAY,MAAM,WAAW,kBAAkB,KAAG,MAWpG,CAAA;AAOD,QAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"insert-separators.d.ts","sourceRoot":"","sources":["../src/insert-separators.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAQ5C,QAAA,MAAM,sBAAsB,gBAAiB,MAAM,YAAY,MAAM,WAAW,kBAAkB,KAAG,MAWpG,CAAA;AAOD,QAAA,MAAM,cAAc,QAAS,MAAM,KAAG,MAAM,EAG3C,CAAA;AAQD,QAAA,MAAM,sBAAsB,YAAa,MAAM,qCAAsB,kBAAkB,KAAG,MAUzF,CAAA;AAQD,QAAA,MAAM,YAAY,YAAa,MAAM,QAAQ,MAAM,KAAG,OAAO,GAAG,IAK/D,CAAA;AAQD,QAAA,MAAM,kBAAkB,YAAa,MAAM,QAAQ,MAAM,KAAG,OAE3D,CAAA;AAED,eAAe,sBAAsB,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,YAAY,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -3,13 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.shouldAddThinSpace = exports.shouldAddWbr = exports.addSeparatorsToSegment = exports.
|
|
6
|
+
exports.shouldAddThinSpace = exports.shouldAddWbr = exports.addSeparatorsToSegment = exports.createSegments = void 0;
|
|
7
7
|
const linebreak_1 = __importDefault(require("linebreak"));
|
|
8
8
|
const utils_text_classes_1 = require("./utils-text-classes");
|
|
9
9
|
const utils_tags_1 = require("./utils-tags");
|
|
10
10
|
const insertSeparatorsToText = (currentText, nextText, options) => {
|
|
11
|
-
const currentSegments =
|
|
12
|
-
const nextSegments =
|
|
11
|
+
const currentSegments = createSegments(currentText);
|
|
12
|
+
const nextSegments = createSegments(nextText);
|
|
13
13
|
const formattedText = currentSegments.reduce((accumulatedText, segment, index, array) => {
|
|
14
14
|
const current = segment;
|
|
15
15
|
const next = array[index + 1] || nextSegments[0];
|
|
@@ -17,17 +17,19 @@ const insertSeparatorsToText = (currentText, nextText, options) => {
|
|
|
17
17
|
}, '');
|
|
18
18
|
return formattedText;
|
|
19
19
|
};
|
|
20
|
-
const
|
|
20
|
+
const createSegments = (src) => {
|
|
21
21
|
const segmenter = new Intl.Segmenter('ja-JP', { granularity: 'word' });
|
|
22
22
|
return Array.from(segmenter.segment(src), ({ segment }) => segment);
|
|
23
23
|
};
|
|
24
|
-
exports.
|
|
24
|
+
exports.createSegments = createSegments;
|
|
25
25
|
const addSeparatorsToSegment = (current, next = '', options) => {
|
|
26
26
|
if (!next)
|
|
27
27
|
return current;
|
|
28
28
|
const addWbr = options.useWordBreak && shouldAddWbr(current, next);
|
|
29
29
|
const addSpace = options.insertThinSpaces && shouldAddThinSpace(current, next);
|
|
30
|
-
return current +
|
|
30
|
+
return (current +
|
|
31
|
+
(addSpace ? (0, utils_tags_1.createThinSpaceSpan)(options.thinSpaceWidth, options.classNamePrefix) : '') +
|
|
32
|
+
(addWbr ? utils_tags_1.wbr : ''));
|
|
31
33
|
};
|
|
32
34
|
exports.addSeparatorsToSegment = addSeparatorsToSegment;
|
|
33
35
|
const shouldAddWbr = (current, next) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insert-separators.js","sourceRoot":"","sources":["../src/insert-separators.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAmC;AACnC,6DAA+D;AAC/D,
|
|
1
|
+
{"version":3,"file":"insert-separators.js","sourceRoot":"","sources":["../src/insert-separators.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAmC;AACnC,6DAA+D;AAC/D,6CAAuD;AASvD,MAAM,sBAAsB,GAAG,CAAC,WAAmB,EAAE,QAAgB,EAAE,OAA2B,EAAU,EAAE;IAC5G,MAAM,eAAe,GAAG,cAAc,CAAC,WAAW,CAAC,CAAA;IACnD,MAAM,YAAY,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAA;IAE7C,MAAM,aAAa,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,eAAe,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QACtF,MAAM,OAAO,GAAG,OAAO,CAAA;QACvB,MAAM,IAAI,GAAG,KAAK,CAA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AY,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IACzD,MAAM,EAAE,GAAG,IAAI,mBAAW,CAAC,YAAY,CAAC,CAAA;IACxC,MAAM,gBAAgB,GAAG,EAAE,CAAC,SAAS,EAAE,CAAA;IACvC,OAAO,gBAAgB,IAAI,gBAAgB,CAAC,QAAQ,KAAK,CAAC,CAAA;AAC5D,CAAC,CAAA;AAagD,oCAAY;AAL7D,MAAM,kBAAkB,GAAG,CAAC,OAAe,EAAE,IAAY,EAAW,EAAE;IACpE,OAAO,kCAAa,CAAC,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,8BAAS,CAAC,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACvG,CAAC,CAAA;AAG8D,gDAAkB;AADjF,kBAAe,sBAAsB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-regex.d.ts","sourceRoot":"","sources":["../src/utils-regex.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"utils-regex.d.ts","sourceRoot":"","sources":["../src/utils-regex.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,QAA4D,CAAA;AAKnF,eAAO,MAAM,aAAa,QAAwD,CAAA;AAKlF,eAAO,MAAM,aAAa,QAA8B,CAAA;AAKxD,eAAO,MAAM,aAAa,QAAsC,CAAA;AAKhE,eAAO,MAAM,eAAe,QAAU,CAAA;AAKtC,eAAO,MAAM,iBAAiB,QAE7B,CAAA"}
|
package/dist/utils-regex.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.noBreakRulesRegex = exports.middleDotsRegex = exports.closingsRegex = exports.openingsRegex = exports.japaneseRegex = exports.latinRegex = void 0;
|
|
4
|
-
exports.latinRegex = /[
|
|
4
|
+
exports.latinRegex = /[\p{scx=Latin}0-9!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~]+/u;
|
|
5
5
|
exports.japaneseRegex = /[\p{scx=Hiragana}\p{scx=Katakana}|ヲ-゚\p{scx=Han}]+/u;
|
|
6
6
|
exports.openingsRegex = /(|[|{|〔|〈|《|「|『|【|〘|〖|“|‘/;
|
|
7
7
|
exports.closingsRegex = /)|]|}|〕|〉|》|」|』|】|〙|〗|”|’|、|,|。|./;
|
package/dist/utils-regex.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-regex.js","sourceRoot":"","sources":["../src/utils-regex.ts"],"names":[],"mappings":";;;AAGa,QAAA,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"utils-regex.js","sourceRoot":"","sources":["../src/utils-regex.ts"],"names":[],"mappings":";;;AAGa,QAAA,UAAU,GAAG,yDAAyD,CAAA;AAKtE,QAAA,aAAa,GAAG,qDAAqD,CAAA;AAKrE,QAAA,aAAa,GAAG,2BAA2B,CAAA;AAK3C,QAAA,aAAa,GAAG,mCAAmC,CAAA;AAKnD,QAAA,eAAe,GAAG,OAAO,CAAA;AAKzB,QAAA,iBAAiB,GAAG,IAAI,MAAM,CACzC,IAAI,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAC5E,CAAA"}
|
package/dist/utils-tags.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
declare const wbr = "<wbr>";
|
|
2
|
-
declare const
|
|
3
|
-
declare const
|
|
2
|
+
declare const createThinSpaceSpan: (thisSpaceWidth: string, classNamePrefix: string) => string;
|
|
3
|
+
declare const createKerningSpan: (kerningValue: number, classNamePrefix: string) => string;
|
|
4
4
|
declare const applyWrapperStyle: (text: string, classNamePrefix: string, useWordBreak: boolean) => string;
|
|
5
5
|
declare const applyLatinStyle: (segment: string, classNamePrefix: string) => string;
|
|
6
6
|
declare const applyNoBreakStyle: (segment: string, classNamePrefix: string) => string;
|
|
7
|
-
export { wbr,
|
|
7
|
+
export { wbr, createThinSpaceSpan, createKerningSpan, applyWrapperStyle, applyLatinStyle, applyNoBreakStyle };
|
|
8
8
|
//# sourceMappingURL=utils-tags.d.ts.map
|
package/dist/utils-tags.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-tags.d.ts","sourceRoot":"","sources":["../src/utils-tags.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils-tags.d.ts","sourceRoot":"","sources":["../src/utils-tags.ts"],"names":[],"mappings":"AAmBA,QAAA,MAAM,GAAG,UAAU,CAAA;AAQnB,QAAA,MAAM,mBAAmB,mBAAoB,MAAM,mBAAmB,MAAM,KAAG,MAK9E,CAAA;AASD,QAAA,MAAM,iBAAiB,iBAAkB,MAAM,mBAAmB,MAAM,KAAG,MAK1E,CAAA;AASD,QAAA,MAAM,iBAAiB,SAAU,MAAM,mBAAmB,MAAM,gBAAgB,OAAO,KAAG,MAIzF,CAAA;AAQD,QAAA,MAAM,eAAe,YAAa,MAAM,mBAAmB,MAAM,KAAG,MAGnE,CAAA;AAQD,QAAA,MAAM,iBAAiB,YAAa,MAAM,mBAAmB,MAAM,KAAG,MAGrE,CAAA;AAED,OAAO,EAAE,GAAG,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,eAAe,EAAE,iBAAiB,EAAE,CAAA"}
|
package/dist/utils-tags.js
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.applyNoBreakStyle = exports.applyLatinStyle = exports.applyWrapperStyle = exports.
|
|
3
|
+
exports.applyNoBreakStyle = exports.applyLatinStyle = exports.applyWrapperStyle = exports.createKerningSpan = exports.createThinSpaceSpan = exports.wbr = void 0;
|
|
4
4
|
const uiIgnoreSettings = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
styles: {
|
|
6
|
+
preventSelect: 'user-select:none;',
|
|
7
|
+
},
|
|
8
|
+
attributes: {
|
|
9
|
+
hiddenFromReader: 'aria-hidden="true"',
|
|
10
|
+
noIndex: 'data-nosnippet=""',
|
|
11
|
+
},
|
|
8
12
|
};
|
|
9
13
|
const wbr = '<wbr>';
|
|
10
14
|
exports.wbr = wbr;
|
|
11
|
-
const
|
|
15
|
+
const createThinSpaceSpan = (thisSpaceWidth, classNamePrefix) => {
|
|
12
16
|
const THIN_SPACE = String.fromCharCode(0x2009);
|
|
13
17
|
const className = classNamePrefix + '-thin-space';
|
|
14
|
-
const style = `font-size: ${thisSpaceWidth}; ${uiIgnoreSettings.
|
|
15
|
-
return `<span class="${className}" style="${style}" ${uiIgnoreSettings.hiddenFromReader} ${uiIgnoreSettings.noIndex}>${THIN_SPACE}</span>`;
|
|
18
|
+
const style = `font-size: ${thisSpaceWidth}; ${uiIgnoreSettings.styles.preventSelect}`;
|
|
19
|
+
return `<span class="${className}" style="${style}" ${uiIgnoreSettings.attributes.hiddenFromReader} ${uiIgnoreSettings.attributes.noIndex}>${THIN_SPACE}</span>`;
|
|
16
20
|
};
|
|
17
|
-
exports.
|
|
18
|
-
const
|
|
21
|
+
exports.createThinSpaceSpan = createThinSpaceSpan;
|
|
22
|
+
const createKerningSpan = (kerningValue, classNamePrefix) => {
|
|
19
23
|
const emValue = kerningValue / 1000 / 2 + 'em';
|
|
20
24
|
const className = classNamePrefix + '-kerning';
|
|
21
|
-
const style = `margin: ${emValue}; ${uiIgnoreSettings.
|
|
22
|
-
return
|
|
25
|
+
const style = `margin: ${emValue}; ${uiIgnoreSettings.styles.preventSelect}`;
|
|
26
|
+
return `<span class="${className}" style="${style}" ${uiIgnoreSettings.attributes.hiddenFromReader} ${uiIgnoreSettings.attributes.noIndex}></span>`;
|
|
23
27
|
};
|
|
24
|
-
exports.
|
|
28
|
+
exports.createKerningSpan = createKerningSpan;
|
|
25
29
|
const applyWrapperStyle = (text, classNamePrefix, useWordBreak) => {
|
|
26
30
|
const style = useWordBreak ? 'word-break: keep-all; overflow-wrap: anywhere;' : '';
|
|
27
31
|
return `<span class="${classNamePrefix}" style="${style}">${text}</span>`;
|
package/dist/utils-tags.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-tags.js","sourceRoot":"","sources":["../src/utils-tags.ts"],"names":[],"mappings":";;;AAMA,MAAM,gBAAgB,GAAG;IACvB,
|
|
1
|
+
{"version":3,"file":"utils-tags.js","sourceRoot":"","sources":["../src/utils-tags.ts"],"names":[],"mappings":";;;AAMA,MAAM,gBAAgB,GAAG;IACvB,MAAM,EAAE;QACN,aAAa,EAAE,mBAAmB;KACnC;IACD,UAAU,EAAE;QACV,gBAAgB,EAAE,oBAAoB;QACtC,OAAO,EAAE,mBAAmB;KAC7B;CACF,CAAA;AAKD,MAAM,GAAG,GAAG,OAAO,CAAA;AAgEV,kBAAG;AAxDZ,MAAM,mBAAmB,GAAG,CAAC,cAAsB,EAAE,eAAuB,EAAU,EAAE;IACtF,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;IAC9C,MAAM,SAAS,GAAG,eAAe,GAAG,aAAa,CAAA;IACjD,MAAM,KAAK,GAAG,cAAc,cAAc,KAAK,gBAAgB,CAAC,MAAM,CAAC,aAAa,EAAE,CAAA;IACtF,OAAO,gBAAgB,SAAS,YAAY,KAAK,KAAK,gBAAgB,CAAC,UAAU,CAAC,gBAAgB,IAAI,gBAAgB,CAAC,UAAU,CAAC,OAAO,IAAI,UAAU,SAAS,CAAA;AAClK,CAAC,CAAA;AAmDa,kDAAmB;AA1CjC,MAAM,iBAAiB,GAAG,CAAC,YAAoB,EAAE,eAAuB,EAAU,EAAE;IAClF,MAAM,OAAO,GAAG,YAAY,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,CAAA;IAC9C,MAAM,SAAS,GAAG,eAAe,GAAG,UAAU,CAAA;IAC9C,MAAM,KAAK,GAAG,WAAW,OAAO,KAAK,gBAAgB,CAAC,MAAM,CAAC,aAAa,EAAE,CAAA;IAC5E,OAAO,gBAAgB,SAAS,YAAY,KAAK,KAAK,gBAAgB,CAAC,UAAU,CAAC,gBAAgB,IAAI,gBAAgB,CAAC,UAAU,CAAC,OAAO,UAAU,CAAA;AACrJ,CAAC,CAAA;AAqCkC,8CAAiB;AA5BpD,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAE,eAAuB,EAAE,YAAqB,EAAU,EAAE;IAEjG,MAAM,KAAK,GAAG,YAAY,CAAC,CAAC,CAAC,gDAAgD,CAAC,CAAC,CAAC,EAAE,CAAA;IAClF,OAAO,gBAAgB,eAAe,YAAY,KAAK,KAAK,IAAI,SAAS,CAAA;AAC3E,CAAC,CAAA;AAwBqD,8CAAiB;AAhBvE,MAAM,eAAe,GAAG,CAAC,OAAe,EAAE,eAAuB,EAAU,EAAE;IAC3E,MAAM,SAAS,GAAG,eAAe,GAAG,QAAQ,CAAA;IAC5C,OAAO,gBAAgB,SAAS,KAAK,OAAO,SAAS,CAAA;AACvD,CAAC,CAAA;AAawE,0CAAe;AALxF,MAAM,iBAAiB,GAAG,CAAC,OAAe,EAAE,eAAuB,EAAU,EAAE;IAC7E,MAAM,SAAS,GAAG,eAAe,GAAG,YAAY,CAAA;IAChD,OAAO,gBAAgB,SAAS,+BAA+B,OAAO,SAAS,CAAA;AACjF,CAAC,CAAA;AAEyF,8CAAiB"}
|
package/package.json
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "palt-typesetting",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "A typesetting library.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
|
-
"type": "module",
|
|
7
6
|
"files": [
|
|
8
|
-
"dist/**/*"
|
|
7
|
+
"dist/**/*",
|
|
8
|
+
"bundle/**/*"
|
|
9
9
|
],
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "https://github.com/yamatoiizuka/palt-typesetting.git"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
|
-
"clean": "rm -rf ./dist",
|
|
16
|
-
"copy": "mkdir -p ./dist/types && cp -R ./src/types/* ./dist/types",
|
|
17
|
-
"prebuild": "npm run clean && npm run copy",
|
|
18
|
-
"build": "tsc",
|
|
15
|
+
"clean:dist": "rm -rf ./dist",
|
|
16
|
+
"copy:types": "mkdir -p ./dist/types && cp -R ./src/types/* ./dist/types",
|
|
17
|
+
"prebuild": "npm run clean:dist && npm run copy:types",
|
|
18
|
+
"build": "tsc && npm run bundle",
|
|
19
|
+
"postbuild": "rm -rf ./dist/bundle.js",
|
|
20
|
+
"bundle": "esbuild ./dist/bundle.js --bundle --outfile=./bundle/typesetter.min.js --minify --sourcemap --platform=browser --target=es2016 --global-name=Typesetter",
|
|
19
21
|
"test": "jest",
|
|
20
22
|
"lint": "eslint ./src/** --no-error-on-unmatched-pattern",
|
|
21
23
|
"lint:fix": "eslint ./src/** --fix"
|
|
@@ -39,6 +41,7 @@
|
|
|
39
41
|
"@typescript-eslint/eslint-plugin": "^6.18.0",
|
|
40
42
|
"@typescript-eslint/parser": "^6.18.0",
|
|
41
43
|
"babel-jest": "^29.7.0",
|
|
44
|
+
"esbuild": "^0.19.11",
|
|
42
45
|
"eslint": "^8",
|
|
43
46
|
"jest": "^29.7.0",
|
|
44
47
|
"ts-jest": "^29.1.1",
|