@instructure/ui-truncate-text 11.6.0 → 11.6.1-snapshot-129

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.
Files changed (100) hide show
  1. package/CHANGELOG.md +29 -277
  2. package/es/TruncateText/{index.js → v1/index.js} +1 -1
  3. package/es/TruncateText/v2/index.js +264 -0
  4. package/es/TruncateText/v2/props.js +26 -0
  5. package/es/TruncateText/v2/styles.js +58 -0
  6. package/es/TruncateText/v2/utils/cleanData.js +158 -0
  7. package/es/TruncateText/v2/utils/cleanString.js +53 -0
  8. package/es/TruncateText/v2/utils/measureText.js +74 -0
  9. package/es/TruncateText/v2/utils/truncate.js +341 -0
  10. package/es/{index.js → exports/a.js} +1 -1
  11. package/{src/index.ts → es/exports/b.js} +1 -2
  12. package/lib/TruncateText/{index.js → v1/index.js} +1 -1
  13. package/lib/TruncateText/v2/index.js +271 -0
  14. package/lib/TruncateText/v2/props.js +31 -0
  15. package/lib/TruncateText/v2/styles.js +64 -0
  16. package/lib/TruncateText/v2/utils/cleanData.js +164 -0
  17. package/lib/TruncateText/v2/utils/cleanString.js +59 -0
  18. package/lib/TruncateText/v2/utils/measureText.js +79 -0
  19. package/lib/TruncateText/v2/utils/truncate.js +350 -0
  20. package/lib/{index.js → exports/a.js} +2 -2
  21. package/lib/exports/b.js +12 -0
  22. package/package.json +42 -20
  23. package/src/TruncateText/{index.tsx → v1/index.tsx} +1 -1
  24. package/src/TruncateText/v2/README.md +230 -0
  25. package/src/TruncateText/v2/index.tsx +314 -0
  26. package/src/TruncateText/v2/props.ts +113 -0
  27. package/src/TruncateText/v2/styles.ts +60 -0
  28. package/src/TruncateText/v2/utils/cleanData.ts +178 -0
  29. package/src/TruncateText/v2/utils/cleanString.ts +61 -0
  30. package/src/TruncateText/v2/utils/measureText.ts +86 -0
  31. package/src/TruncateText/v2/utils/truncate.ts +451 -0
  32. package/src/exports/a.ts +25 -0
  33. package/src/exports/b.ts +25 -0
  34. package/tsconfig.build.tsbuildinfo +1 -1
  35. package/types/TruncateText/v1/index.d.ts.map +1 -0
  36. package/types/TruncateText/v1/props.d.ts.map +1 -0
  37. package/types/TruncateText/v1/styles.d.ts.map +1 -0
  38. package/types/TruncateText/v1/theme.d.ts.map +1 -0
  39. package/types/TruncateText/v1/utils/cleanData.d.ts.map +1 -0
  40. package/types/TruncateText/v1/utils/cleanString.d.ts.map +1 -0
  41. package/types/TruncateText/v1/utils/measureText.d.ts.map +1 -0
  42. package/types/TruncateText/v1/utils/truncate.d.ts.map +1 -0
  43. package/types/TruncateText/v2/index.d.ts +47 -0
  44. package/types/TruncateText/v2/index.d.ts.map +1 -0
  45. package/types/TruncateText/v2/props.d.ts +61 -0
  46. package/types/TruncateText/v2/props.d.ts.map +1 -0
  47. package/types/TruncateText/v2/styles.d.ts +15 -0
  48. package/types/TruncateText/v2/styles.d.ts.map +1 -0
  49. package/types/TruncateText/v2/utils/cleanData.d.ts +19 -0
  50. package/types/TruncateText/v2/utils/cleanData.d.ts.map +1 -0
  51. package/types/TruncateText/v2/utils/cleanString.d.ts +16 -0
  52. package/types/TruncateText/v2/utils/cleanString.d.ts.map +1 -0
  53. package/types/TruncateText/v2/utils/measureText.d.ts +13 -0
  54. package/types/TruncateText/v2/utils/measureText.d.ts.map +1 -0
  55. package/types/TruncateText/v2/utils/truncate.d.ts +35 -0
  56. package/types/TruncateText/v2/utils/truncate.d.ts.map +1 -0
  57. package/types/exports/a.d.ts +3 -0
  58. package/types/exports/a.d.ts.map +1 -0
  59. package/types/exports/b.d.ts +3 -0
  60. package/types/exports/b.d.ts.map +1 -0
  61. package/types/TruncateText/index.d.ts.map +0 -1
  62. package/types/TruncateText/props.d.ts.map +0 -1
  63. package/types/TruncateText/styles.d.ts.map +0 -1
  64. package/types/TruncateText/theme.d.ts.map +0 -1
  65. package/types/TruncateText/utils/cleanData.d.ts.map +0 -1
  66. package/types/TruncateText/utils/cleanString.d.ts.map +0 -1
  67. package/types/TruncateText/utils/measureText.d.ts.map +0 -1
  68. package/types/TruncateText/utils/truncate.d.ts.map +0 -1
  69. package/types/index.d.ts +0 -3
  70. package/types/index.d.ts.map +0 -1
  71. /package/es/TruncateText/{props.js → v1/props.js} +0 -0
  72. /package/es/TruncateText/{styles.js → v1/styles.js} +0 -0
  73. /package/es/TruncateText/{theme.js → v1/theme.js} +0 -0
  74. /package/es/TruncateText/{utils → v1/utils}/cleanData.js +0 -0
  75. /package/es/TruncateText/{utils → v1/utils}/cleanString.js +0 -0
  76. /package/es/TruncateText/{utils → v1/utils}/measureText.js +0 -0
  77. /package/es/TruncateText/{utils → v1/utils}/truncate.js +0 -0
  78. /package/lib/TruncateText/{props.js → v1/props.js} +0 -0
  79. /package/lib/TruncateText/{styles.js → v1/styles.js} +0 -0
  80. /package/lib/TruncateText/{theme.js → v1/theme.js} +0 -0
  81. /package/lib/TruncateText/{utils → v1/utils}/cleanData.js +0 -0
  82. /package/lib/TruncateText/{utils → v1/utils}/cleanString.js +0 -0
  83. /package/lib/TruncateText/{utils → v1/utils}/measureText.js +0 -0
  84. /package/lib/TruncateText/{utils → v1/utils}/truncate.js +0 -0
  85. /package/src/TruncateText/{README.md → v1/README.md} +0 -0
  86. /package/src/TruncateText/{props.ts → v1/props.ts} +0 -0
  87. /package/src/TruncateText/{styles.ts → v1/styles.ts} +0 -0
  88. /package/src/TruncateText/{theme.ts → v1/theme.ts} +0 -0
  89. /package/src/TruncateText/{utils → v1/utils}/cleanData.ts +0 -0
  90. /package/src/TruncateText/{utils → v1/utils}/cleanString.ts +0 -0
  91. /package/src/TruncateText/{utils → v1/utils}/measureText.ts +0 -0
  92. /package/src/TruncateText/{utils → v1/utils}/truncate.ts +0 -0
  93. /package/types/TruncateText/{index.d.ts → v1/index.d.ts} +0 -0
  94. /package/types/TruncateText/{props.d.ts → v1/props.d.ts} +0 -0
  95. /package/types/TruncateText/{styles.d.ts → v1/styles.d.ts} +0 -0
  96. /package/types/TruncateText/{theme.d.ts → v1/theme.d.ts} +0 -0
  97. /package/types/TruncateText/{utils → v1/utils}/cleanData.d.ts +0 -0
  98. /package/types/TruncateText/{utils → v1/utils}/cleanString.d.ts +0 -0
  99. /package/types/TruncateText/{utils → v1/utils}/measureText.d.ts +0 -0
  100. /package/types/TruncateText/{utils → v1/utils}/truncate.d.ts +0 -0
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ /**
32
+ * ---
33
+ * private: true
34
+ * ---
35
+ * Generates the style object from the theme and provided additional information
36
+ * @param {Object} componentTheme The theme variable object.
37
+ * @param {Object} props the props of the component, the style is applied to
38
+ * @param {Object} state the state of the component, the style is applied to
39
+ * @return {Object} The final style object, which will be used in the component
40
+ */
41
+ const generateStyle = componentTheme => {
42
+ return {
43
+ truncateText: {
44
+ label: 'truncateText',
45
+ display: 'block',
46
+ overflow: 'hidden',
47
+ wordWrap: 'break-word',
48
+ whiteSpace: 'normal',
49
+ fontFamily: componentTheme.fontFamily
50
+ },
51
+ auto: {
52
+ label: 'truncateText__auto',
53
+ height: '100%'
54
+ },
55
+ spacer: {
56
+ label: 'truncateText__spacer',
57
+ visibility: 'hidden',
58
+ maxHeight: '0',
59
+ display: 'block'
60
+ },
61
+ lineHeight: componentTheme.lineHeight
62
+ };
63
+ };
64
+ var _default = exports.default = generateStyle;
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _cloneArray = require("@instructure/ui-utils/lib/cloneArray.js");
8
+ /*
9
+ * The MIT License (MIT)
10
+ *
11
+ * Copyright (c) 2015 - present Instructure, Inc.
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ * copies of the Software, and to permit persons to whom the Software is
18
+ * furnished to do so, subject to the following conditions:
19
+ *
20
+ * The above copyright notice and this permission notice shall be included in all
21
+ * copies or substantial portions of the Software.
22
+ *
23
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ * SOFTWARE.
30
+ */
31
+
32
+ /**
33
+ * ---
34
+ * parent: TruncateText
35
+ * private: true
36
+ * ---
37
+ * Removes given characters, such as whitespace and punctuation, from stringData
38
+ * arrays used by Truncator and TruncateText.
39
+ *
40
+ * @param {Array} stringData A stringData array.
41
+ * @param {Object} options The options object.
42
+ * @param {string} options.truncate Is the data being truncated by character or word.
43
+ * @param {string[]} options.ignore An array of characters to remove around the ellipsis.
44
+ * @param {string} options.ellipsis The string being used as an ellipsis.
45
+ * @param {boolean} repeat=false Do a thorough clean.
46
+ */
47
+ function cleanData(stringData, options, repeat = false) {
48
+ const truncate = options.truncate,
49
+ ignore = options.ignore,
50
+ ellipsis = options.ellipsis;
51
+ let newData = (0, _cloneArray.cloneArray)(stringData);
52
+ let ellipsisNode = -1;
53
+ let ellipsisIndex = -1;
54
+ const findEllipsis = () => {
55
+ for (let i = 0; i < newData.length; i++) {
56
+ const nodeData = newData[i];
57
+ if (nodeData.indexOf(ellipsis) !== -1) {
58
+ ellipsisNode = i;
59
+ ellipsisIndex = nodeData.indexOf(ellipsis);
60
+ }
61
+ }
62
+ };
63
+ if (truncate === 'character') {
64
+ findEllipsis();
65
+ let node = newData[ellipsisNode];
66
+ if (node) {
67
+ const before = node[ellipsisIndex - 1];
68
+ if (before && ignore.indexOf(before) !== -1) {
69
+ // remove character immediately BEFORE the ellipsis in the same node
70
+ newData[ellipsisNode].splice(ellipsisIndex - 1, 1);
71
+ }
72
+ if (!before) {
73
+ // character before the ellipsis is part of a different node
74
+ // find the next node with data and remove last datum
75
+ let prevNode = null;
76
+ let prevNodeIndex = ellipsisNode - 1;
77
+ while (prevNodeIndex >= 0) {
78
+ prevNode = newData[prevNodeIndex];
79
+ if (prevNode.length > 0) {
80
+ break;
81
+ } else {
82
+ prevNodeIndex--;
83
+ }
84
+ }
85
+ if (prevNode) {
86
+ const lastChar = String(prevNode.slice(-1));
87
+ if (ignore.indexOf(lastChar) !== -1) {
88
+ newData[prevNodeIndex].length -= 1;
89
+ }
90
+ }
91
+ }
92
+ }
93
+ findEllipsis();
94
+ node = newData[ellipsisNode];
95
+ if (node) {
96
+ const after = node[ellipsisIndex + 1];
97
+ if (after && ignore.indexOf(after) !== -1) {
98
+ // remove character immediately AFTER the ellipsis in the same node
99
+ newData[ellipsisNode].splice(ellipsisIndex + 1, 1);
100
+ }
101
+ if (!after) {
102
+ // character after the ellipsis is part of a different node
103
+ // find the next node with data and remove first datum
104
+ let nextNode = null;
105
+ let nextNodeIndex = ellipsisNode + 1;
106
+ while (nextNodeIndex < newData.length) {
107
+ nextNode = newData[nextNodeIndex];
108
+ if (nextNode.length > 0) {
109
+ break;
110
+ } else {
111
+ nextNodeIndex++;
112
+ }
113
+ }
114
+ if (nextNode) {
115
+ const firstChar = String(nextNode[0]);
116
+ if (ignore.indexOf(firstChar) !== -1) {
117
+ newData[nextNodeIndex].shift();
118
+ }
119
+ }
120
+ }
121
+ }
122
+ } else {
123
+ findEllipsis();
124
+ const node = newData[ellipsisNode];
125
+ if (node) {
126
+ const before = node[ellipsisIndex - 1];
127
+ if (before && ignore.indexOf(before.slice(-1)) !== -1) {
128
+ if (before.length === 1) {
129
+ // remove entire word datum
130
+ newData[ellipsisNode].splice(ellipsisIndex - 1, 1);
131
+ } else {
132
+ // remove word immediately BEFORE the ellipsis in the same node
133
+ newData[ellipsisNode][ellipsisIndex - 1] = before.slice(0, -1);
134
+ }
135
+ }
136
+ if (!before) {
137
+ // word before the ellipsis is part of a different node
138
+ // find the next node with data and remove last datum
139
+ let prevNode = null;
140
+ let prevNodeIndex = ellipsisNode - 1;
141
+ while (prevNodeIndex >= 0) {
142
+ prevNode = newData[prevNodeIndex];
143
+ if (prevNode.length > 0) {
144
+ break;
145
+ } else {
146
+ prevNodeIndex--;
147
+ }
148
+ }
149
+ if (prevNode) {
150
+ const lastChar = String(prevNode.slice(-1)).slice(-1);
151
+ if (ignore.indexOf(lastChar) !== -1) {
152
+ const lastItem = prevNode.length - 1;
153
+ newData[prevNodeIndex][lastItem] = prevNode[lastItem].slice(0, -1);
154
+ }
155
+ }
156
+ }
157
+ }
158
+ }
159
+ if (repeat) {
160
+ newData = cleanData(newData, options, false);
161
+ }
162
+ return newData;
163
+ }
164
+ var _default = exports.default = cleanData;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ /**
32
+ * ---
33
+ * parent: TruncateText
34
+ * private: true
35
+ * ---
36
+ * Removes given characters, such as whitespace and punctuation, from either end of a string.
37
+ *
38
+ * @param {string} string The string to clean.
39
+ * @param {string[]} ignore Array of characters to remove.
40
+ * @param {boolean} start Whether or not to clean start of string.
41
+ * @param {boolean} end Whether or not to clean end of string.
42
+ * @param {boolean} repeat=false Do a thorough clean.
43
+ */
44
+ function cleanString(string, ignore, start = true, end = true, repeat = false) {
45
+ let text = string;
46
+ const firstChar = text.charAt(0);
47
+ const lastChar = text.slice(-1);
48
+ if (start && ignore.indexOf(firstChar) !== -1) {
49
+ text = text.slice(1);
50
+ }
51
+ if (end && ignore.indexOf(lastChar) !== -1) {
52
+ text = text.slice(0, -1);
53
+ }
54
+ if (repeat) {
55
+ text = cleanString(text, ignore, start, end, false);
56
+ }
57
+ return text;
58
+ }
59
+ var _default = exports.default = cleanString;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _getCSSStyleDeclaration = require("@instructure/ui-dom-utils/lib/getCSSStyleDeclaration.js");
8
+ /*
9
+ * The MIT License (MIT)
10
+ *
11
+ * Copyright (c) 2015 - present Instructure, Inc.
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ * copies of the Software, and to permit persons to whom the Software is
18
+ * furnished to do so, subject to the following conditions:
19
+ *
20
+ * The above copyright notice and this permission notice shall be included in all
21
+ * copies or substantial portions of the Software.
22
+ *
23
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ * SOFTWARE.
30
+ */
31
+
32
+ /**
33
+ * ---
34
+ * parent: TruncateText
35
+ * private: true
36
+ * ---
37
+ * Finds the max potential width of set of DOM nodes.
38
+ *
39
+ * @param {DOMNode[]} nodes Array of DOM nodes.
40
+ * @param {DOMNode} parentNode The node to inherit default styles from.
41
+ */
42
+ function measureText(nodes, parentNode) {
43
+ let width = 0;
44
+ for (let i = 0; i < nodes.length; i++) {
45
+ const node = nodes[i];
46
+ width += measure(node.textContent, node.nodeType === 1 ? node : parentNode);
47
+ }
48
+ return width;
49
+ }
50
+ function measure(string, domNode) {
51
+ const style = (0, _getCSSStyleDeclaration.getCSSStyleDeclaration)(domNode);
52
+ // we use a canvas in a doc fragment to prevent having to render the string full width in the DOM
53
+ const canvas = document.createElement('canvas');
54
+ document.createDocumentFragment().appendChild(canvas);
55
+ const context = canvas.getContext('2d');
56
+ if (!context || !string) {
57
+ return 0;
58
+ }
59
+ let text = string;
60
+ let letterOffset = 0;
61
+ let width = 0;
62
+ // grab individual font styles
63
+ // some browsers don't report a value for style['font']
64
+ context.font = [style === null || style === void 0 ? void 0 : style.fontWeight, style === null || style === void 0 ? void 0 : style.fontStyle, style === null || style === void 0 ? void 0 : style.fontSize, style === null || style === void 0 ? void 0 : style.fontFamily].join(' ');
65
+ if ((style === null || style === void 0 ? void 0 : style.textTransform) === 'uppercase') {
66
+ text = string.toUpperCase();
67
+ } else if ((style === null || style === void 0 ? void 0 : style.textTransform) === 'lowercase') {
68
+ text = string.toLowerCase();
69
+ } else if ((style === null || style === void 0 ? void 0 : style.textTransform) === 'capitalize') {
70
+ text = string.replace(/\b\w/g, str => str.toUpperCase());
71
+ }
72
+ if ((style === null || style === void 0 ? void 0 : style.letterSpacing) !== 'normal') {
73
+ letterOffset = text.length * parseInt(style === null || style === void 0 ? void 0 : style.letterSpacing);
74
+ }
75
+ width = context.measureText(text).width + letterOffset;
76
+ // returns the max potential width of the text, assuming the text was on a single line
77
+ return width;
78
+ }
79
+ var _default = exports.default = measureText;