@d3plus/text 3.0.2 → 3.0.4
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 +13 -13
- package/es/src/textSplit.js +9 -70
- package/es/src/textWrap.js +2 -3
- package/es/src/titleCase.js +15 -28
- package/package.json +4 -4
- package/umd/d3plus-text.full.js +1857 -1350
- package/umd/d3plus-text.full.js.map +1 -1
- package/umd/d3plus-text.full.min.js +154 -31
- package/umd/d3plus-text.js +25 -1350
- package/umd/d3plus-text.js.map +1 -1
- package/umd/d3plus-text.min.js +25 -28
|
@@ -1,43 +1,148 @@
|
|
|
1
1
|
/*
|
|
2
|
-
@d3plus/text v3.0.
|
|
2
|
+
@d3plus/text v3.0.4
|
|
3
3
|
A smart SVG text box with line wrapping and automatic font size scaling.
|
|
4
4
|
Copyright (c) 2025 D3plus - https://d3plus.org
|
|
5
5
|
@license MIT
|
|
6
6
|
*/
|
|
7
|
-
(
|
|
7
|
+
(t=>{"function"==typeof define&&define.amd?define(t):t()})(function(){if("undefined"!=typeof window){try{if("undefined"==typeof SVGElement||Boolean(SVGElement.prototype.innerHTML))return}catch(t){return}function r(t){switch(t.nodeType){case 1:var e=t,n="";return n+="<"+e.tagName,e.hasAttributes()&&[].forEach.call(e.attributes,function(t){n+=" "+t.name+'="'+t.value+'"'}),n+=">",e.hasChildNodes()&&[].forEach.call(e.childNodes,function(t){n+=r(t)}),n+="</"+e.tagName+">";case 3:return t.textContent.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");case 8:return"\x3c!--"+t.nodeValue+"--\x3e"}}Object.defineProperty(SVGElement.prototype,"innerHTML",{get:function(){var e="";return[].forEach.call(this.childNodes,function(t){e+=r(t)}),e},set:function(t){for(;this.firstChild;)this.removeChild(this.firstChild);try{var e=new DOMParser,n=(e.async=!1,"<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>"+t+"</svg>"),r=e.parseFromString(n,"text/xml").documentElement;[].forEach.call(r.childNodes,function(t){this.appendChild(this.ownerDocument.importNode(t,!0))}.bind(this))}catch(t){throw new Error("Error parsing markup string")}}}),Object.defineProperty(SVGElement.prototype,"innerSVG",{get:function(){return this.innerHTML},set:function(t){this.innerHTML=t}})}}),((t,e)=>{"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define("@d3plus/text",["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).d3plus={})})(this,function(t){
|
|
8
|
+
/**
|
|
9
|
+
@const fontFamily
|
|
10
|
+
@desc The default fallback font list used for all text labels as an Array of Strings.
|
|
11
|
+
@returns {Array<string>}
|
|
12
|
+
*/var i,l,n,s,e,a;
|
|
13
|
+
/**
|
|
14
|
+
@const fontFamilyStringify
|
|
15
|
+
@desc Converts an Array of font-family names into a CSS font-family string.
|
|
16
|
+
@param {String|Array<string>} *family*
|
|
17
|
+
@returns {String}
|
|
18
|
+
*/
|
|
8
19
|
/**
|
|
9
20
|
@function stringify
|
|
10
21
|
@desc Coerces value into a String.
|
|
11
22
|
@param {String} value
|
|
12
|
-
*/function
|
|
23
|
+
*/function A(t){return void 0===t?t="undefined":"string"==typeof t||t instanceof String||(t=JSON.stringify(t)),t}
|
|
13
24
|
// great unicode list: http://asecuritysite.com/coding/asc2
|
|
14
|
-
let
|
|
25
|
+
let o=[[/[\300-\305]/g,"A"],[/[\340-\345]/g,"a"],[/[\306]/g,"AE"],[/[\346]/g,"ae"],[/[\337]/g,"B"],[/[\307]/g,"C"],[/[\347]/g,"c"],[/[\320\336\376]/g,"D"],[/[\360]/g,"d"],[/[\310-\313]/g,"E"],[/[\350-\353]/g,"e"],[/[\314-\317]/g,"I"],[/[\354-\357]/g,"i"],[/[\321]/g,"N"],[/[\361]/g,"n"],[/[\u014c\322-\326\330]/g,"O"],[/[\u014d\362-\366\370]/g,"o"],[/[\u016a\331-\334]/g,"U"],[/[\u016b\371-\374]/g,"u"],[/[\327]/g,"x"],[/[\335]/g,"Y"],[/[\375\377]/g,"y"]];
|
|
15
26
|
/**
|
|
16
27
|
@function strip
|
|
17
28
|
@desc Removes all non ASCII characters from a string.
|
|
18
29
|
@param {String} value
|
|
19
30
|
@param {String} [spacer = "-"]
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var A=["u0903","u093B","u093E","u093F","u0940","u0949","u094A","u094B","u094C","u094E","u094F","u0982","u0983","u09BE","u09BF","u09C0","u09C7","u09C8","u09CB","u09CC","u09D7","u0A03","u0A3E","u0A3F","u0A40","u0A83","u0ABE","u0ABF","u0AC0","u0AC9","u0ACB","u0ACC","u0B02","u0B03","u0B3E","u0B40","u0B47","u0B48","u0B4B","u0B4C","u0B57","u0BBE","u0BBF","u0BC1","u0BC2","u0BC6","u0BC7","u0BC8","u0BCA","u0BCB","u0BCC","u0BD7","u0C01","u0C02","u0C03","u0C41","u0C42","u0C43","u0C44","u0C82","u0C83","u0CBE","u0CC0","u0CC1","u0CC2","u0CC3","u0CC4","u0CC7","u0CC8","u0CCA","u0CCB","u0CD5","u0CD6","u0D02","u0D03","u0D3E","u0D3F","u0D40","u0D46","u0D47","u0D48","u0D4A","u0D4B","u0D4C","u0D57","u0D82","u0D83","u0DCF","u0DD0","u0DD1","u0DD8","u0DD9","u0DDA","u0DDB","u0DDC","u0DDD","u0DDE","u0DDF","u0DF2","u0DF3","u0F3E","u0F3F","u0F7F","u102B","u102C","u1031","u1038","u103B","u103C","u1056","u1057","u1062","u1063","u1064","u1067","u1068","u1069","u106A","u106B","u106C","u106D","u1083","u1084","u1087","u1088","u1089","u108A","u108B","u108C","u108F","u109A","u109B","u109C","u17B6","u17BE","u17BF","u17C0","u17C1","u17C2","u17C3","u17C4","u17C5","u17C7","u17C8","u1923","u1924","u1925","u1926","u1929","u192A","u192B","u1930","u1931","u1933","u1934","u1935","u1936","u1937","u1938","u1A19","u1A1A","u1A55","u1A57","u1A61","u1A63","u1A64","u1A6D","u1A6E","u1A6F","u1A70","u1A71","u1A72","u1B04","u1B35","u1B3B","u1B3D","u1B3E","u1B3F","u1B40","u1B41","u1B43","u1B44","u1B82","u1BA1","u1BA6","u1BA7","u1BAA","u1BE7","u1BEA","u1BEB","u1BEC","u1BEE","u1BF2","u1BF3","u1C24","u1C25","u1C26","u1C27","u1C28","u1C29","u1C2A","u1C2B","u1C34","u1C35","u1CE1","u1CF2","u1CF3","u302E","u302F","uA823","uA824","uA827","uA880","uA881","uA8B4","uA8B5","uA8B6","uA8B7","uA8B8","uA8B9","uA8BA","uA8BB","uA8BC","uA8BD","uA8BE","uA8BF","uA8C0","uA8C1","uA8C2","uA8C3","uA952","uA953","uA983","uA9B4","uA9B5","uA9BA","uA9BB","uA9BD","uA9BE","uA9BF","uA9C0","uAA2F","uAA30","uAA33","uAA34","uAA4D","uAA7B","uAA7D","uAAEB","uAAEE","uAAEF","uAAF5","uABE3","uABE4","uABE6","uABE7","uABE9","uABEA","uABEC"].concat(["u0300","u0301","u0302","u0303","u0304","u0305","u0306","u0307","u0308","u0309","u030A","u030B","u030C","u030D","u030E","u030F","u0310","u0311","u0312","u0313","u0314","u0315","u0316","u0317","u0318","u0319","u031A","u031B","u031C","u031D","u031E","u031F","u0320","u0321","u0322","u0323","u0324","u0325","u0326","u0327","u0328","u0329","u032A","u032B","u032C","u032D","u032E","u032F","u0330","u0331","u0332","u0333","u0334","u0335","u0336","u0337","u0338","u0339","u033A","u033B","u033C","u033D","u033E","u033F","u0340","u0341","u0342","u0343","u0344","u0345","u0346","u0347","u0348","u0349","u034A","u034B","u034C","u034D","u034E","u034F","u0350","u0351","u0352","u0353","u0354","u0355","u0356","u0357","u0358","u0359","u035A","u035B","u035C","u035D","u035E","u035F","u0360","u0361","u0362","u0363","u0364","u0365","u0366","u0367","u0368","u0369","u036A","u036B","u036C","u036D","u036E","u036F","u0483","u0484","u0485","u0486","u0487","u0591","u0592","u0593","u0594","u0595","u0596","u0597","u0598","u0599","u059A","u059B","u059C","u059D","u059E","u059F","u05A0","u05A1","u05A2","u05A3","u05A4","u05A5","u05A6","u05A7","u05A8","u05A9","u05AA","u05AB","u05AC","u05AD","u05AE","u05AF","u05B0","u05B1","u05B2","u05B3","u05B4","u05B5","u05B6","u05B7","u05B8","u05B9","u05BA","u05BB","u05BC","u05BD","u05BF","u05C1","u05C2","u05C4","u05C5","u05C7","u0610","u0611","u0612","u0613","u0614","u0615","u0616","u0617","u0618","u0619","u061A","u064B","u064C","u064D","u064E","u064F","u0650","u0651","u0652","u0653","u0654","u0655","u0656","u0657","u0658","u0659","u065A","u065B","u065C","u065D","u065E","u065F","u0670","u06D6","u06D7","u06D8","u06D9","u06DA","u06DB","u06DC","u06DF","u06E0","u06E1","u06E2","u06E3","u06E4","u06E7","u06E8","u06EA","u06EB","u06EC","u06ED","u0711","u0730","u0731","u0732","u0733","u0734","u0735","u0736","u0737","u0738","u0739","u073A","u073B","u073C","u073D","u073E","u073F","u0740","u0741","u0742","u0743","u0744","u0745","u0746","u0747","u0748","u0749","u074A","u07A6","u07A7","u07A8","u07A9","u07AA","u07AB","u07AC","u07AD","u07AE","u07AF","u07B0","u07EB","u07EC","u07ED","u07EE","u07EF","u07F0","u07F1","u07F2","u07F3","u0816","u0817","u0818","u0819","u081B","u081C","u081D","u081E","u081F","u0820","u0821","u0822","u0823","u0825","u0826","u0827","u0829","u082A","u082B","u082C","u082D","u0859","u085A","u085B","u08E3","u08E4","u08E5","u08E6","u08E7","u08E8","u08E9","u08EA","u08EB","u08EC","u08ED","u08EE","u08EF","u08F0","u08F1","u08F2","u08F3","u08F4","u08F5","u08F6","u08F7","u08F8","u08F9","u08FA","u08FB","u08FC","u08FD","u08FE","u08FF","u0900","u0901","u0902","u093A","u093C","u0941","u0942","u0943","u0944","u0945","u0946","u0947","u0948","u094D","u0951","u0952","u0953","u0954","u0955","u0956","u0957","u0962","u0963","u0981","u09BC","u09C1","u09C2","u09C3","u09C4","u09CD","u09E2","u09E3","u0A01","u0A02","u0A3C","u0A41","u0A42","u0A47","u0A48","u0A4B","u0A4C","u0A4D","u0A51","u0A70","u0A71","u0A75","u0A81","u0A82","u0ABC","u0AC1","u0AC2","u0AC3","u0AC4","u0AC5","u0AC7","u0AC8","u0ACD","u0AE2","u0AE3","u0B01","u0B3C","u0B3F","u0B41","u0B42","u0B43","u0B44","u0B4D","u0B56","u0B62","u0B63","u0B82","u0BC0","u0BCD","u0C00","u0C3E","u0C3F","u0C40","u0C46","u0C47","u0C48","u0C4A","u0C4B","u0C4C","u0C4D","u0C55","u0C56","u0C62","u0C63","u0C81","u0CBC","u0CBF","u0CC6","u0CCC","u0CCD","u0CE2","u0CE3","u0D01","u0D41","u0D42","u0D43","u0D44","u0D4D","u0D62","u0D63","u0DCA","u0DD2","u0DD3","u0DD4","u0DD6","u0E31","u0E34","u0E35","u0E36","u0E37","u0E38","u0E39","u0E3A","u0E47","u0E48","u0E49","u0E4A","u0E4B","u0E4C","u0E4D","u0E4E","u0EB1","u0EB4","u0EB5","u0EB6","u0EB7","u0EB8","u0EB9","u0EBB","u0EBC","u0EC8","u0EC9","u0ECA","u0ECB","u0ECC","u0ECD","u0F18","u0F19","u0F35","u0F37","u0F39","u0F71","u0F72","u0F73","u0F74","u0F75","u0F76","u0F77","u0F78","u0F79","u0F7A","u0F7B","u0F7C","u0F7D","u0F7E","u0F80","u0F81","u0F82","u0F83","u0F84","u0F86","u0F87","u0F8D","u0F8E","u0F8F","u0F90","u0F91","u0F92","u0F93","u0F94","u0F95","u0F96","u0F97","u0F99","u0F9A","u0F9B","u0F9C","u0F9D","u0F9E","u0F9F","u0FA0","u0FA1","u0FA2","u0FA3","u0FA4","u0FA5","u0FA6","u0FA7","u0FA8","u0FA9","u0FAA","u0FAB","u0FAC","u0FAD","u0FAE","u0FAF","u0FB0","u0FB1","u0FB2","u0FB3","u0FB4","u0FB5","u0FB6","u0FB7","u0FB8","u0FB9","u0FBA","u0FBB","u0FBC","u0FC6","u102D","u102E","u102F","u1030","u1032","u1033","u1034","u1035","u1036","u1037","u1039","u103A","u103D","u103E","u1058","u1059","u105E","u105F","u1060","u1071","u1072","u1073","u1074","u1082","u1085","u1086","u108D","u109D","u135D","u135E","u135F","u1712","u1713","u1714","u1732","u1733","u1734","u1752","u1753","u1772","u1773","u17B4","u17B5","u17B7","u17B8","u17B9","u17BA","u17BB","u17BC","u17BD","u17C6","u17C9","u17CA","u17CB","u17CC","u17CD","u17CE","u17CF","u17D0","u17D1","u17D2","u17D3","u17DD","u180B","u180C","u180D","u18A9","u1920","u1921","u1922","u1927","u1928","u1932","u1939","u193A","u193B","u1A17","u1A18","u1A1B","u1A56","u1A58","u1A59","u1A5A","u1A5B","u1A5C","u1A5D","u1A5E","u1A60","u1A62","u1A65","u1A66","u1A67","u1A68","u1A69","u1A6A","u1A6B","u1A6C","u1A73","u1A74","u1A75","u1A76","u1A77","u1A78","u1A79","u1A7A","u1A7B","u1A7C","u1A7F","u1AB0","u1AB1","u1AB2","u1AB3","u1AB4","u1AB5","u1AB6","u1AB7","u1AB8","u1AB9","u1ABA","u1ABB","u1ABC","u1ABD","u1B00","u1B01","u1B02","u1B03","u1B34","u1B36","u1B37","u1B38","u1B39","u1B3A","u1B3C","u1B42","u1B6B","u1B6C","u1B6D","u1B6E","u1B6F","u1B70","u1B71","u1B72","u1B73","u1B80","u1B81","u1BA2","u1BA3","u1BA4","u1BA5","u1BA8","u1BA9","u1BAB","u1BAC","u1BAD","u1BE6","u1BE8","u1BE9","u1BED","u1BEF","u1BF0","u1BF1","u1C2C","u1C2D","u1C2E","u1C2F","u1C30","u1C31","u1C32","u1C33","u1C36","u1C37","u1CD0","u1CD1","u1CD2","u1CD4","u1CD5","u1CD6","u1CD7","u1CD8","u1CD9","u1CDA","u1CDB","u1CDC","u1CDD","u1CDE","u1CDF","u1CE0","u1CE2","u1CE3","u1CE4","u1CE5","u1CE6","u1CE7","u1CE8","u1CED","u1CF4","u1CF8","u1CF9","u1DC0","u1DC1","u1DC2","u1DC3","u1DC4","u1DC5","u1DC6","u1DC7","u1DC8","u1DC9","u1DCA","u1DCB","u1DCC","u1DCD","u1DCE","u1DCF","u1DD0","u1DD1","u1DD2","u1DD3","u1DD4","u1DD5","u1DD6","u1DD7","u1DD8","u1DD9","u1DDA","u1DDB","u1DDC","u1DDD","u1DDE","u1DDF","u1DE0","u1DE1","u1DE2","u1DE3","u1DE4","u1DE5","u1DE6","u1DE7","u1DE8","u1DE9","u1DEA","u1DEB","u1DEC","u1DED","u1DEE","u1DEF","u1DF0","u1DF1","u1DF2","u1DF3","u1DF4","u1DF5","u1DFC","u1DFD","u1DFE","u1DFF","u20D0","u20D1","u20D2","u20D3","u20D4","u20D5","u20D6","u20D7","u20D8","u20D9","u20DA","u20DB","u20DC","u20E1","u20E5","u20E6","u20E7","u20E8","u20E9","u20EA","u20EB","u20EC","u20ED","u20EE","u20EF","u20F0","u2CEF","u2CF0","u2CF1","u2D7F","u2DE0","u2DE1","u2DE2","u2DE3","u2DE4","u2DE5","u2DE6","u2DE7","u2DE8","u2DE9","u2DEA","u2DEB","u2DEC","u2DED","u2DEE","u2DEF","u2DF0","u2DF1","u2DF2","u2DF3","u2DF4","u2DF5","u2DF6","u2DF7","u2DF8","u2DF9","u2DFA","u2DFB","u2DFC","u2DFD","u2DFE","u2DFF","u302A","u302B","u302C","u302D","u3099","u309A","uA66F","uA674","uA675","uA676","uA677","uA678","uA679","uA67A","uA67B","uA67C","uA67D","uA69E","uA69F","uA6F0","uA6F1","uA802","uA806","uA80B","uA825","uA826","uA8C4","uA8E0","uA8E1","uA8E2","uA8E3","uA8E4","uA8E5","uA8E6","uA8E7","uA8E8","uA8E9","uA8EA","uA8EB","uA8EC","uA8ED","uA8EE","uA8EF","uA8F0","uA8F1","uA926","uA927","uA928","uA929","uA92A","uA92B","uA92C","uA92D","uA947","uA948","uA949","uA94A","uA94B","uA94C","uA94D","uA94E","uA94F","uA950","uA951","uA980","uA981","uA982","uA9B3","uA9B6","uA9B7","uA9B8","uA9B9","uA9BC","uA9E5","uAA29","uAA2A","uAA2B","uAA2C","uAA2D","uAA2E","uAA31","uAA32","uAA35","uAA36","uAA43","uAA4C","uAA7C","uAAB0","uAAB2","uAAB3","uAAB4","uAAB7","uAAB8","uAABE","uAABF","uAAC1","uAAEC","uAAED","uAAF6","uABE5","uABE8","uABED","uFB1E","uFE00","uFE01","uFE02","uFE03","uFE04","uFE05","uFE06","uFE07","uFE08","uFE09","uFE0A","uFE0B","uFE0C","uFE0D","uFE0E","uFE0F","uFE20","uFE21","uFE22","uFE23","uFE24","uFE25","uFE26","uFE27","uFE28","uFE29","uFE2A","uFE2B","uFE2C","uFE2D","uFE2E","uFE2F"]);function t(u){return Array.from(function*(u){for(var A of u)yield*A}(u))}var C=["-",";",":","&","|","u0E2F","u0EAF","u0EC6","u0ECC","u104A","u104B","u104C","u104D","u104E","u104F","u2013","u2014","u2027","u3000","u3001","u3002","uFF0C","uFF5E"];let F=["'",">",")","}","]",".","!","?","/","u00BB","u300B","u3009"].concat(C);var e="က-ဪဿ-၉ၐ-ၕ㐀-龿-ゟ゠-ヿ-+--}⦅-゚㐀-䶿ກ-ຮະ-ໄ່-໋ໍ-ໝ";let D=new RegExp(`(\\${C.join("|\\")})*[^\\s|\\${C.join("|\\")}]*(\\${C.join("|\\")})*`,"g"),E=new RegExp(`[${e}]`),n=new RegExp(`(\\${["'","<","(","{","[","u00AB","u300A","u3008"].join("|\\")})*[${e}](\\${F.join("|\\")}|\\${A.join("|\\")})*|[a-z0-9]+`,"gi");
|
|
31
|
+
*/function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function u(){if(!l){l=1;
|
|
32
|
+
/* build fixed length tree */for(var y=0,w=-3,A=new r,m=new r,o=new Uint8Array(30),u=new Uint16Array(30),f=new Uint8Array(30),c=new Uint16Array(30),P=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),L=new r,x=new Uint8Array(320),a=new Uint16Array(16),
|
|
33
|
+
/* -------------------- *
|
|
34
|
+
* -- initialization -- *
|
|
35
|
+
* -------------------- */ /* build fixed huffman trees */t=A,e=m,n=0;n<7;++n)t.table[n]=0;for(t.table[7]=24,t.table[8]=152,t.table[9]=112,n=0;n<24;++n)t.trans[n]=256+n;for(n=0;n<144;++n)t.trans[24+n]=n;for(n=0;n<8;++n)t.trans[168+n]=280+n;for(n=0;n<112;++n)t.trans[176+n]=144+n;
|
|
36
|
+
/* build fixed distance tree */for(n=0;n<5;++n)e.table[n]=0;for(e.table[5]=32,n=0;n<32;++n)e.trans[n]=n;
|
|
37
|
+
/* build extra bits and base tables */s(o,u,4,3),s(f,c,2,1),
|
|
38
|
+
/* fix a special case */o[28]=0,u[28]=258,i=
|
|
39
|
+
/* inflate stream from source to dest */function(t,e){var n,r,s,i=new C(t,e);do{
|
|
40
|
+
/* decompress block */switch(s=void 0,
|
|
41
|
+
/* check if tag is empty */(r=i).bitcount--||(
|
|
42
|
+
/* load next tag */r.tag=r.source[r.sourceIndex++],r.bitcount=7)
|
|
43
|
+
/* shift bit out of tag */,s=1&r.tag,r.tag>>>=1,
|
|
44
|
+
/* read final block flag */r=s,X(i,2,0)){case 0:
|
|
45
|
+
/* decompress uncompressed block */n=(
|
|
46
|
+
/* inflate an uncompressed block of data */t=>{
|
|
47
|
+
/* unread from bitbuffer */for(var e,n;8<t.bitcount;)t.sourceIndex--,t.bitcount-=8;
|
|
48
|
+
/* get length */
|
|
49
|
+
/* check length */if((e=256*t.source[t.sourceIndex+1]+t.source[t.sourceIndex])!==(65535&~(256*t.source[t.sourceIndex+3]+t.source[t.sourceIndex+2])))return w;
|
|
50
|
+
/* copy block */for(t.sourceIndex+=4,n=e;n;--n)t.dest[t.destLen++]=t.source[t.sourceIndex++];
|
|
51
|
+
/* make sure we start next block on a byte boundary */return t.bitcount=0,y})(i);break;case 1:
|
|
52
|
+
/* decompress block with fixed huffman trees */n=U(i,A,m);break;case 2:v=b=g=p=a=d=h=l=c=f=u=o=void 0;for(
|
|
53
|
+
/* decompress block with dynamic huffman trees */var a,o=i,u=i.ltree,f=i.dtree,
|
|
54
|
+
/* get 5 bits HLIT (257-286) */c=X(o,5,257),
|
|
55
|
+
/* get 5 bits HDIST (1-32) */l=X(o,5,1),
|
|
56
|
+
/* get 4 bits HCLEN (4-19) */h=X(o,4,4),d=0;d<19;++d)x[d]=0;
|
|
57
|
+
/* read code lengths for code length alphabet */for(d=0;d<h;++d){
|
|
58
|
+
/* get 3 bits code length (0-7) */var g=X(o,3,0);x[P[d]]=g}
|
|
59
|
+
/* build code length tree */
|
|
60
|
+
/* decode code lengths for the dynamic trees */for(z(L,x,0,19),a=0;a<c+l;){var b=H(o,L);switch(b){case 16:for(
|
|
61
|
+
/* copy previous code length 3-6 times (read 2 bits) */var v=x[a-1],p=X(o,2,3);p;--p)x[a++]=v;break;case 17:
|
|
62
|
+
/* repeat code length 0 for 3-10 times (read 3 bits) */for(p=X(o,3,3);p;--p)x[a++]=0;break;case 18:
|
|
63
|
+
/* repeat code length 0 for 11-138 times (read 7 bits) */for(p=X(o,7,11);p;--p)x[a++]=0;break;default:
|
|
64
|
+
/* values 0-15 represent the actual code lengths */x[a++]=b}}
|
|
65
|
+
/* build dynamic trees */z(u,x,0,c),z(f,x,c,l),n=U(i,i.ltree,i.dtree);break;default:n=w}if(n!==y)throw new Error("Data error")}while(!r);return i.destLen<i.dest.length?"function"==typeof i.dest.slice?i.dest.slice(0,i.destLen):i.dest.subarray(0,i.destLen):i.dest}}return i;function r(){this.table=new Uint16Array(16),/* table of code length counts */
|
|
66
|
+
this.trans=new Uint16Array(288)}function C(t,e){this.source=t,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new r,/* dynamic length/symbol tree */
|
|
67
|
+
this.dtree=new r}
|
|
68
|
+
/* --------------------------------------------------- *
|
|
69
|
+
* -- uninitialized global data (static structures) -- *
|
|
70
|
+
* --------------------------------------------------- */
|
|
71
|
+
/* ----------------------- *
|
|
72
|
+
* -- utility functions -- *
|
|
73
|
+
* ----------------------- */ /* build extra bits and base tables */function s(t,e,n,r){
|
|
74
|
+
/* build bits table */for(var s,i=0;i<n;++i)t[i]=0;for(i=0;i<30-n;++i)t[i+n]=i/n|0;
|
|
75
|
+
/* build base table */for(s=r,i=0;i<30;++i)e[i]=s,s+=1<<t[i]}
|
|
76
|
+
/* build the fixed huffman trees */function z(t,e,n,r){
|
|
77
|
+
/* clear code length count table */for(var s,i=0;i<16;++i)t.table[i]=0;
|
|
78
|
+
/* scan symbol lengths, and sum code length counts */for(i=0;i<r;++i)t.table[e[n+i]]++;
|
|
79
|
+
/* compute offset table for distribution sort */for(i=s=t.table[0]=0;i<16;++i)a[i]=s,s+=t.table[i];
|
|
80
|
+
/* create code->symbol translation table (symbols sorted by code) */for(i=0;i<r;++i)e[n+i]&&(t.trans[a[e[n+i]]++]=i)}
|
|
81
|
+
/* ---------------------- *
|
|
82
|
+
* -- decode functions -- *
|
|
83
|
+
* ---------------------- */ /* get one bit from source stream */
|
|
84
|
+
/* read a num bit value from a stream and add base */function X(t,e,n){if(!e)return n;for(;t.bitcount<24;)t.tag|=t.source[t.sourceIndex++]<<t.bitcount,t.bitcount+=8;var r=t.tag&65535>>>16-e;return t.tag>>>=e,t.bitcount-=e,r+n}
|
|
85
|
+
/* given a data stream and a tree, decode a symbol */function H(t,e){for(;t.bitcount<24;)t.tag|=t.source[t.sourceIndex++]<<t.bitcount,t.bitcount+=8;
|
|
86
|
+
/* get more bits while code value is above sum */for(var n=0,r=0,s=0,i=t.tag;r=2*r+(1&i),i>>>=1,n+=e.table[++s],0<=(r-=e.table[s]););return t.tag=i,t.bitcount-=s,e.trans[n+r]}
|
|
87
|
+
/* given a data stream, decode dynamic trees from it */
|
|
88
|
+
/* ----------------------------- *
|
|
89
|
+
* -- block inflate functions -- *
|
|
90
|
+
* ----------------------------- */ /* given a stream and two trees, inflate a block of data */function U(t,e,n){for(;;){var r=H(t,e);
|
|
91
|
+
/* check for end of block */if(256===r)return y;if(r<256)t.dest[t.destLen++]=r;else
|
|
92
|
+
/* copy match */for(var s,
|
|
93
|
+
/* possibly get more bits from length code */i=X(t,o[r-=257],u[r]),r=H(t,n),a=
|
|
94
|
+
/* possibly get more bits from distance code */s=t.destLen-X(t,f[r],c[r]);a<s+i;++a)t.dest[t.destLen++]=t.dest[a]}}}function f(){if(!s){s=1;let e=18===new Uint8Array(new Uint32Array([305419896]).buffer)[0],r=(t,e,n)=>{var r=t[e];t[e]=t[n],t[n]=r};n={swap32LE:t=>{e&&(e=>{var n=e.length;for(let t=0;t<n;t+=4)r(e,t,t+3),r(e,t+1,t+2)})(t)}}}return n}var c,h,d,g,b,v,p,y,w,m=r((()=>{if(!a){a=1;let r=u(),s=f().swap32LE;e=class{get(t){let e;return t<0||1114111<t?this.errorValue:t<55296||56319<t&&t<=65535?(
|
|
95
|
+
// Ordinary BMP code point, excluding leading surrogates.
|
|
96
|
+
// BMP uses a single level lookup. BMP index starts at offset 0 in the index.
|
|
97
|
+
// data is stored in the index array itself.
|
|
98
|
+
e=(this.data[t>>5]<<2)+(31&t),this.data[e]):t<=65535?(
|
|
99
|
+
// Lead Surrogate Code Point. A Separate index section is stored for
|
|
100
|
+
// lead surrogate code units and code points.
|
|
101
|
+
// The main index has the code unit data.
|
|
102
|
+
// For this function, we need the code point data.
|
|
103
|
+
e=(this.data[2048+(t-55296>>5)]<<2)+(31&t),this.data[e]):t<this.highStart?(
|
|
104
|
+
// Supplemental code point, use two-level lookup.
|
|
105
|
+
e=this.data[2080+(t>>11)],e=((e=this.data[e+(t>>5&63)])<<2)+(31&t),this.data[e]):this.data[this.data.length-4]}constructor(e){var n="function"==typeof e.readUInt32BE&&"function"==typeof e.slice;if(n||e instanceof Uint8Array){
|
|
106
|
+
// read binary format
|
|
107
|
+
let t;e=n?(this.highStart=e.readUInt32LE(0),this.errorValue=e.readUInt32LE(4),t=e.readUInt32LE(8),e.slice(12)):(n=new DataView(e.buffer),this.highStart=n.getUint32(0,!0),this.errorValue=n.getUint32(4,!0),t=n.getUint32(8,!0),e.subarray(12)),
|
|
108
|
+
// double inflate the actual trie data
|
|
109
|
+
e=r(e,new Uint8Array(t)),e=r(e,new Uint8Array(t)),
|
|
110
|
+
// swap bytes from little-endian
|
|
111
|
+
s(e),this.data=new Uint32Array(e.buffer)}else
|
|
112
|
+
// pre-parsed data
|
|
113
|
+
({data:this.data,highStart:this.highStart,errorValue:this.errorValue}=e)}}}return e})()),P={};function L(t){t=t.charCodeAt(0);return t===h||t===p?62:t===d||t===y?63:t<g?-1:t<g+10?t-g+26+26:t<v+26?t-v:t<b+26?t-b+26:void 0}S||(S=1,w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",S=P,c="undefined"!=typeof Uint8Array?Uint8Array:Array,h="+".charCodeAt(0),d="/".charCodeAt(0),g="0".charCodeAt(0),b="a".charCodeAt(0),v="A".charCodeAt(0),p="-".charCodeAt(0),y="_".charCodeAt(0),S.toByteArray=function(t){var e,n;if(0<t.length%4)throw new Error("Invalid string. Length must be a multiple of 4");
|
|
114
|
+
// the number of equal signs (place holders)
|
|
115
|
+
// if there are two placeholders, than the two characters before it
|
|
116
|
+
// represent one byte
|
|
117
|
+
// if there is only one, then the three characters before it represent 2 bytes
|
|
118
|
+
// this is just a cheap hack to not do indexOf twice
|
|
119
|
+
var r="="===t.charAt((r=t.length)-2)?2:"="===t.charAt(r-1)?1:0,
|
|
120
|
+
// base64 is 4/3 + up to two characters of the original data
|
|
121
|
+
s=new c(3*t.length/4-r),
|
|
122
|
+
// if there are placeholders, only get up to the last complete 4 chars
|
|
123
|
+
i=0<r?t.length-4:t.length,a=0;function o(t){s[a++]=t}for(e=0;e<i;e+=4,0)o((16711680&(n=L(t.charAt(e))<<18|L(t.charAt(e+1))<<12|L(t.charAt(e+2))<<6|L(t.charAt(e+3))))>>16),o((65280&n)>>8),o(255&n);return 2==r?o(255&(n=L(t.charAt(e))<<2|L(t.charAt(e+1))>>4)):1==r&&(o((n=L(t.charAt(e))<<10|L(t.charAt(e+1))<<4|L(t.charAt(e+2))>>2)>>8&255),o(255&n)),s},S.fromByteArray=function(t){var e,n,r,s,i=t.length%3,a="";function o(t){return w.charAt(t)}
|
|
124
|
+
// go through the array every three bytes, we'll deal with trailing stuff later
|
|
125
|
+
for(e=0,r=t.length-i;e<r;e+=3)n=(t[e]<<16)+(t[e+1]<<8)+t[e+2],a+=o((s=n)>>18&63)+o(s>>12&63)+o(s>>6&63)+o(63&s);
|
|
126
|
+
// pad the end with zeros, but make sure to not forget the extra bytes
|
|
127
|
+
switch(i){case 1:a=(a+=o((n=t[t.length-1])>>2))+o(n<<4&63)+"==";break;case 2:a=(a=(a+=o((n=(t[t.length-2]<<8)+t[t.length-1])>>10))+o(n>>4&63))+o(n<<2&63)+"="}return a});var x={};function C(t){switch(t){case 33:return 12;case 39:case 40:case 42:return 12;case 35:return 5;default:return t}}function z(t){switch(t){case 37:case 38:return 34;case 41:return 22;default:return t}}// Prohibited break
|
|
128
|
+
let X=[
|
|
129
|
+
//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
|
|
130
|
+
[4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,4,4,4,4,4,4,4,4,4,4,4],[0,4,4,1,1,4,4,4,4,1,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0,0,0,1,0],[0,4,4,1,1,4,4,4,4,1,1,1,1,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0,0,0,1,0],[4,4,4,1,1,1,4,4,4,1,1,1,1,1,1,1,1,1,1,1,4,2,4,1,1,1,1,1,1,1,1,1,1],[1,4,4,1,1,1,4,4,4,1,1,1,1,1,1,1,1,1,1,1,4,2,4,1,1,1,1,1,1,1,1,1,1],[0,4,4,1,1,1,4,4,4,0,0,0,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I9Pu8ypfDXqm3A2z8s1FWGn4ntL9NfQu2oSlftX9uetvTtv7J8Ql4zxfXGZ3zk8PeQ9w59x2uMfqI8/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/"));class U{constructor(t,e=!1){this.position=t,this.required=e}}
|
|
26
131
|
/**
|
|
27
132
|
@function textSplit
|
|
28
133
|
@desc Splits a given sentence into an array of words.
|
|
29
134
|
@param {String} sentence
|
|
30
|
-
*/function
|
|
135
|
+
*/function V(t){var e=new x(t);let n,r,s=[];for(;n=e.nextBreak();){var i=t.slice(r,n.position);s.push(i),r=n.position}return s}
|
|
31
136
|
/**
|
|
32
137
|
* Strips HTML and "un-escapes" escape characters.
|
|
33
138
|
* @param {String} input
|
|
34
|
-
*/function
|
|
139
|
+
*/function W(t){var e;return""!==t.replace(/\s+/g,"")&&(e=(new DOMParser).parseFromString(t.replace(/<[^>]+>/g,""),"text/html")).documentElement?e.documentElement.textContent:t}
|
|
35
140
|
/**
|
|
36
141
|
@function textWidth
|
|
37
142
|
@desc Given a text string, returns the predicted pixel width of the string when placed into DOM.
|
|
38
143
|
@param {String|Array} text Can be either a single string or an array of strings to analyze.
|
|
39
144
|
@param {Object} [style] An object of CSS font styles to apply. Accepts any of the valid [CSS font property](http://www.w3schools.com/cssref/pr_font_font.asp) values.
|
|
40
|
-
*/function
|
|
145
|
+
*/function N(t,e){e=Object.assign({"font-size":10,"font-family":"sans-serif","font-style":"normal","font-weight":400,"font-variant":"normal"},e);var n=document.createElement("canvas").getContext("2d"),r=[];return r.push(e["font-style"]),r.push(e["font-variant"]),r.push(e["font-weight"]),r.push("string"==typeof e["font-size"]?e["font-size"]:"".concat(e["font-size"],"px")),r.push(e["font-family"]),n.font=r.join(" "),e=t,(null!=(r=Array)&&"undefined"!=typeof Symbol&&r[Symbol.hasInstance]?r[Symbol.hasInstance](e):e instanceof r)?t.map(function(t){return n.measureText(W(t)).width}):n.measureText(W(t)).width}
|
|
41
146
|
/**
|
|
42
147
|
@function trim
|
|
43
148
|
@desc Cross-browser implementation of [trim](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim).
|
|
@@ -47,68 +152,86 @@ var A=["u0903","u093B","u093E","u093F","u0940","u0949","u094A","u094B","u094C","
|
|
|
47
152
|
@function trimRight
|
|
48
153
|
@desc Cross-browser implementation of [trimRight](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/TrimRight).
|
|
49
154
|
@param {String} str
|
|
50
|
-
*/function
|
|
155
|
+
*/function O(t){return t.toString().replace(/\s+$/,"")}
|
|
51
156
|
/**
|
|
52
157
|
@function textWrap
|
|
53
158
|
@desc Based on the defined styles and dimensions, breaks a string into an array of strings for each line of text.
|
|
54
|
-
*/
|
|
159
|
+
*/x=class{nextCodePoint(){var t=this.string.charCodeAt(this.pos++),e=this.string.charCodeAt(this.pos);
|
|
160
|
+
// If a surrogate pair
|
|
161
|
+
return 55296<=t&&t<=56319&&56320<=e&&e<=57343?(this.pos++,1024*(t-55296)+(e-56320)+65536):t}nextCharClass(){return C(H.get(this.nextCodePoint()))}getSimpleBreak(){
|
|
162
|
+
// handle classes not handled by the pair table
|
|
163
|
+
switch(this.nextClass){case 41:return!1;case 34:case 37:case 38:return!(this.curClass=34);case 36:return!(this.curClass=36)}return null}getPairTableBreak(t){
|
|
164
|
+
// if not handled already, use the pair table
|
|
165
|
+
let e=!1;switch(X[this.curClass][this.nextClass]){case 0:e=!0;break;case 1:e=41===t;break;case 2:if(e=41===t)break;return e=!1;case 3:if(41!==t)return e}return this.LB8a&&(e=!1),
|
|
166
|
+
// Rule LB21a
|
|
167
|
+
!this.LB21a||16!==this.curClass&&17!==this.curClass?this.LB21a=13===this.curClass:(e=!1,this.LB21a=!1),
|
|
168
|
+
// Rule LB30a
|
|
169
|
+
28===this.curClass?(this.LB30a++,2==this.LB30a&&28===this.nextClass&&(e=!0,this.LB30a=0)):this.LB30a=0,this.curClass=this.nextClass,e}nextBreak(){
|
|
170
|
+
// get the first char if we're at the beginning of the string
|
|
171
|
+
var t;for(null==this.curClass&&(t=this.nextCharClass(),this.curClass=z(t),this.nextClass=t,this.LB8a=31===t,this.LB30a=0);this.pos<this.string.length;){this.lastPos=this.pos;var e=this.nextClass;
|
|
172
|
+
// explicit newline
|
|
173
|
+
if(this.nextClass=this.nextCharClass(),34===this.curClass||36===this.curClass&&37!==this.nextClass)return this.curClass=z(C(this.nextClass)),new U(this.lastPos,!0);let t=this.getSimpleBreak();if(null===t&&(t=this.getPairTableBreak(e)),
|
|
174
|
+
// Rule LB8a
|
|
175
|
+
this.LB8a=31===this.nextClass,t)return new U(this.lastPos)}return this.lastPos<this.string.length?(this.lastPos=this.string.length,new U(this.string.length)):null}constructor(t){this.string=t,this.pos=0,this.lastPos=0,this.curClass=null,this.nextClass=null,this.LB8a=!1,this.LB21a=!1,this.LB30a=0}};let B=["a","an","and","as","at","but","by","for","from","if","in","into","near","nor","of","on","onto","or","per","that","the","to","with","via","vs","vs."];var S=["CEO","CFO","CNC","COO","CPU","GDP","HVAC","ID","IT","R&D","TV","UI"];let T=S.reduce((t,e)=>(t.push(e+"s"),t),S.map(t=>t.toLowerCase()));
|
|
176
|
+
/**
|
|
177
|
+
@function titleCase
|
|
178
|
+
@desc Capitalizes the first letter of each word in a phrase/sentence, accounting for words in English that should be kept lowercase such as "and" or "of", as well as acronym that should be kept uppercase such as "CEO" or "TVs".
|
|
179
|
+
@param {String} str The string to apply the title case logic.
|
|
180
|
+
*/t.fontFamily=["Inter","Helvetica Neue","HelveticaNeue","Helvetica","Arial","sans-serif"],t.fontFamilyStringify=t=>("string"==typeof t?[t]:t).map(t=>t.match(/^[a-z-_]{1,}$/)?t:`'${t}'`).join(", "),t.stringify=A,t.strip=function(t,r="-"){return(""+t).replace(/[^A-Za-z0-9\-_\u0621-\u064A]/g,e=>{if(" "===e)return r;let n=!1;for(let t=0;t<o.length;t++)if(new RegExp(o[t][0]).test(e)){n=o[t][1];break}return n||""})},t.textSplit=V,t.textWrap=function(){let l="sans-serif",h=10,d=400,g=200,b,v=null,p=!1,y=V,w=200;
|
|
55
181
|
/**
|
|
56
182
|
The inner return object and wraps the text and returns the line data array.
|
|
57
183
|
@private
|
|
58
|
-
*/function
|
|
184
|
+
*/function e(t){t=A(t),void 0===b&&(b=Math.ceil(1.4*h));var e=y(t),n={"font-family":l,"font-size":h,"font-weight":d,"line-height":b};let r=1,s="",i=!1,a=0;var o=[],u=N(e,n);for(let t=0;t<e.length;t++){var f=e[t],c=u[e.indexOf(f)];
|
|
185
|
+
// newline if breaking character or not enough width
|
|
186
|
+
if("\n"===s.slice(-1)||a+c>w){if(!t&&!p){i=!0;break}if(o.length>=r&&(o[r-1]=O(o[r-1])),r++,b*r>g||c>w&&!p||v&&r>v){i=!0;break}a=0,o.push(f)}else t?o[r-1]+=f:o[0]=f;s+=f,a+=c}return{lines:o,sentence:t,truncated:i,widths:N(o,n),words:e}}
|
|
59
187
|
/**
|
|
60
188
|
@memberof textWrap
|
|
61
189
|
@desc If *value* is specified, sets the font family accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current font family.
|
|
62
190
|
@param {Function|String} [*value* = "sans-serif"]
|
|
63
|
-
*/return
|
|
191
|
+
*/return e.fontFamily=function(t){return arguments.length?(l=t,e):l},
|
|
64
192
|
/**
|
|
65
193
|
@memberof textWrap
|
|
66
194
|
@desc If *value* is specified, sets the font size accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current font size.
|
|
67
195
|
@param {Function|Number} [*value* = 10]
|
|
68
|
-
*/
|
|
196
|
+
*/e.fontSize=function(t){return arguments.length?(h=t,e):h},
|
|
69
197
|
/**
|
|
70
198
|
@memberof textWrap
|
|
71
199
|
@desc If *value* is specified, sets the font weight accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current font weight.
|
|
72
200
|
@param {Function|Number|String} [*value* = 400]
|
|
73
|
-
*/
|
|
201
|
+
*/e.fontWeight=function(t){return arguments.length?(d=t,e):d},
|
|
74
202
|
/**
|
|
75
203
|
@memberof textWrap
|
|
76
204
|
@desc If *value* is specified, sets height limit to the specified value and returns this generator. If *value* is not specified, returns the current value.
|
|
77
205
|
@param {Number} [*value* = 200]
|
|
78
|
-
*/
|
|
206
|
+
*/e.height=function(t){return arguments.length?(g=t,e):g},
|
|
79
207
|
/**
|
|
80
208
|
@memberof textWrap
|
|
81
209
|
@desc If *value* is specified, sets the line height accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current line height accessor, which is 1.1 times the [font size](#textWrap.fontSize) by default.
|
|
82
210
|
@param {Function|Number} [*value*]
|
|
83
|
-
*/
|
|
211
|
+
*/e.lineHeight=function(t){return arguments.length?(b=t,e):b},
|
|
84
212
|
/**
|
|
85
213
|
@memberof textWrap
|
|
86
214
|
@desc If *value* is specified, sets the maximum number of lines allowed when wrapping.
|
|
87
215
|
@param {Function|Number} [*value*]
|
|
88
|
-
*/
|
|
216
|
+
*/e.maxLines=function(t){return arguments.length?(v=t,e):v},
|
|
89
217
|
/**
|
|
90
218
|
@memberof textWrap
|
|
91
219
|
@desc If *value* is specified, sets the overflow to the specified boolean and returns this generator. If *value* is not specified, returns the current overflow value.
|
|
92
220
|
@param {Boolean} [*value* = false]
|
|
93
|
-
*/
|
|
221
|
+
*/e.overflow=function(t){return arguments.length?(p=t,e):p},
|
|
94
222
|
/**
|
|
95
223
|
@memberof textWrap
|
|
96
224
|
@desc If *value* is specified, sets the word split function to the specified function and returns this generator. If *value* is not specified, returns the current word split function.
|
|
97
225
|
@param {Function} [*value*] A function that, when passed a string, is expected to return that string split into an array of words to textWrap. The default split function splits strings on the following characters: `-`, `/`, `;`, `:`, `&`
|
|
98
|
-
*/
|
|
226
|
+
*/e.split=function(t){return arguments.length?(y=t,e):y},
|
|
99
227
|
/**
|
|
100
228
|
@memberof textWrap
|
|
101
229
|
@desc If *value* is specified, sets width limit to the specified value and returns this generator. If *value* is not specified, returns the current value.
|
|
102
230
|
@param {Number} [*value* = 200]
|
|
103
|
-
*/
|
|
104
|
-
/**
|
|
105
|
-
@function titleCase
|
|
106
|
-
@desc Capitalizes the first letter of each word in a phrase/sentence.
|
|
107
|
-
@param {String} str The string to apply the title case logic.
|
|
108
|
-
*/function(C){if(void 0===C)return"";let e=o.map(u=>u.toLowerCase()),D=a.slice(),E=(D=D.concat(D.map(u=>u+"s"))).map(u=>u.toLowerCase()),n=r(C);return n.map((u,A)=>{var t,C,B;return u?(t=u.toLowerCase(),C=F.includes(t.charAt(t.length-1))?t.slice(0,-1):t,0<=(B=E.indexOf(C))?D[B]:e.includes(C)&&0!==A&&A!==n.length-1?t:u.charAt(0).toUpperCase()+u.substr(1).toLowerCase()):""}).reduce((u,A,t)=>(t&&" "===C.charAt(u.length)&&(u+=" "),u+=A),"")},u.trim=function(u){return u.toString().replace(/^\s+|\s+$/g,"")}
|
|
231
|
+
*/e.width=function(t){return arguments.length?(w=t,e):w},e},t.titleCase=function(t){return void 0===t?"":V(t).reduce((t,e,n)=>{let r=e;var s=e.toLowerCase().slice(0,-1),n=T.includes(s)||B.includes(s)&&0!==n&&e.toLowerCase()!==s;return t+(r=n?r:e.charAt(0).toUpperCase()+e.slice(1))},"")},t.trim=function(t){return t.toString().replace(/^\s+|\s+$/g,"")}
|
|
109
232
|
/**
|
|
110
233
|
@function trimLeft
|
|
111
234
|
@desc Cross-browser implementation of [trimLeft](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/TrimLeft).
|
|
112
235
|
@param {String} str
|
|
113
|
-
*/,
|
|
236
|
+
*/,t.trimLeft=function(t){return t.toString().replace(/^\s+/,"")},t.trimRight=O});
|
|
114
237
|
//# sourceMappingURL=d3plus-text.full.js.map
|