@syncfusion/ej2-docx-renderer 0.0.0-stage → 35.2.15

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 (129) hide show
  1. package/README.md +2 -2
  2. package/base.d.ts +4 -0
  3. package/base.js +4 -0
  4. package/dist/ej2-docx-renderer.umd.min.js +2 -0
  5. package/dist/ej2-docx-renderer.umd.min.js.map +1 -0
  6. package/dist/es6/ej2-docx-renderer.es2015.js +52432 -0
  7. package/dist/es6/ej2-docx-renderer.es2015.js.map +1 -0
  8. package/dist/es6/ej2-docx-renderer.es5.js +54425 -0
  9. package/dist/es6/ej2-docx-renderer.es5.js.map +1 -0
  10. package/dist/global/ej2-docx-renderer.min.js +2 -0
  11. package/dist/global/ej2-docx-renderer.min.js.map +1 -0
  12. package/dist/global/index.d.ts +5 -0
  13. package/format.d.ts +4 -0
  14. package/format.js +4 -0
  15. package/helper.d.ts +4 -0
  16. package/helper.js +4 -0
  17. package/index.d.ts +4 -0
  18. package/index.js +4 -0
  19. package/license +10 -0
  20. package/list.d.ts +4 -0
  21. package/list.js +4 -0
  22. package/package.json +26 -4
  23. package/parser.d.ts +4 -0
  24. package/parser.js +4 -0
  25. package/src/base/constants.d.ts +2 -0
  26. package/src/base/constants.js +2 -0
  27. package/src/base/dictionary.d.ts +52 -0
  28. package/src/base/dictionary.js +137 -0
  29. package/src/base/index.d.ts +9 -0
  30. package/src/base/index.js +9 -0
  31. package/src/base/keywords.d.ts +422 -0
  32. package/src/base/keywords.js +422 -0
  33. package/src/base/types.d.ts +2590 -0
  34. package/src/base/types.js +1056 -0
  35. package/src/base/unique-format.d.ts +87 -0
  36. package/src/base/unique-format.js +858 -0
  37. package/src/base/unique-formats.d.ts +32 -0
  38. package/src/base/unique-formats.js +87 -0
  39. package/src/document-canvas.d.ts +61 -0
  40. package/src/document-canvas.js +221 -0
  41. package/src/docx-renderer.d.ts +941 -0
  42. package/src/docx-renderer.js +2251 -0
  43. package/src/format/border.d.ts +53 -0
  44. package/src/format/border.js +600 -0
  45. package/src/format/borders.d.ts +44 -0
  46. package/src/format/borders.js +314 -0
  47. package/src/format/cell-format.d.ts +42 -0
  48. package/src/format/cell-format.js +309 -0
  49. package/src/format/character-format.d.ts +152 -0
  50. package/src/format/character-format.js +1224 -0
  51. package/src/format/index.d.ts +14 -0
  52. package/src/format/index.js +14 -0
  53. package/src/format/list-format.d.ts +32 -0
  54. package/src/format/list-format.js +238 -0
  55. package/src/format/paragraph-format.d.ts +103 -0
  56. package/src/format/paragraph-format.js +854 -0
  57. package/src/format/row-format.d.ts +119 -0
  58. package/src/format/row-format.js +545 -0
  59. package/src/format/section-format.d.ts +89 -0
  60. package/src/format/section-format.js +689 -0
  61. package/src/format/shading.d.ts +24 -0
  62. package/src/format/shading.js +137 -0
  63. package/src/format/style.d.ts +106 -0
  64. package/src/format/style.js +286 -0
  65. package/src/format/table-format.d.ts +51 -0
  66. package/src/format/table-format.js +395 -0
  67. package/src/global.js +1 -0
  68. package/src/helper/document-editor-helper.d.ts +515 -0
  69. package/src/helper/document-editor-helper.js +1302 -0
  70. package/src/helper/document-editor-settings.d.ts +293 -0
  71. package/src/helper/document-editor-settings.js +94 -0
  72. package/src/helper/index.d.ts +5 -0
  73. package/src/helper/index.js +5 -0
  74. package/src/helper/layout-helper-methods.d.ts +539 -0
  75. package/src/helper/layout-helper-methods.js +1065 -0
  76. package/src/helper/renderer-hooks.d.ts +74 -0
  77. package/src/helper/renderer-hooks.js +14 -0
  78. package/src/helper/revision-helper-methods.d.ts +199 -0
  79. package/src/helper/revision-helper-methods.js +362 -0
  80. package/src/index.d.ts +18 -0
  81. package/src/index.js +18 -0
  82. package/src/layout-helper.d.ts +190 -0
  83. package/src/layout-helper.js +1368 -0
  84. package/src/layout.d.ts +779 -0
  85. package/src/layout.js +17232 -0
  86. package/src/list/abstract-list.d.ts +25 -0
  87. package/src/list/abstract-list.js +67 -0
  88. package/src/list/index.d.ts +7 -0
  89. package/src/list/index.js +7 -0
  90. package/src/list/level-override.d.ts +22 -0
  91. package/src/list/level-override.js +43 -0
  92. package/src/list/list-level.d.ts +57 -0
  93. package/src/list/list-level.js +249 -0
  94. package/src/list/list.d.ts +30 -0
  95. package/src/list/list.js +100 -0
  96. package/src/page.d.ts +4155 -0
  97. package/src/page.js +11342 -0
  98. package/src/parser/index.d.ts +1 -0
  99. package/src/parser/index.js +1 -0
  100. package/src/parser/sfdt-reader.d.ts +254 -0
  101. package/src/parser/sfdt-reader.js +4569 -0
  102. package/src/render.d.ts +226 -0
  103. package/src/render.js +4222 -0
  104. package/src/text-helper.d.ts +144 -0
  105. package/src/text-helper.js +1079 -0
  106. package/src/text-helpers/index.d.ts +2 -0
  107. package/src/text-helpers/index.js +2 -0
  108. package/src/text-helpers/optimized.d.ts +45 -0
  109. package/src/text-helpers/optimized.js +121 -0
  110. package/src/text-helpers/regular.d.ts +37 -0
  111. package/src/text-helpers/regular.js +93 -0
  112. package/src/themes/font-scheme.d.ts +28 -0
  113. package/src/themes/font-scheme.js +107 -0
  114. package/src/themes/index.d.ts +6 -0
  115. package/src/themes/index.js +6 -0
  116. package/src/themes/major-minor-font-scheme.d.ts +14 -0
  117. package/src/themes/major-minor-font-scheme.js +45 -0
  118. package/src/themes/themes.d.ts +11 -0
  119. package/src/themes/themes.js +31 -0
  120. package/src/utility/index.d.ts +1 -0
  121. package/src/utility/index.js +1 -0
  122. package/src/utility/path-util.d.ts +133 -0
  123. package/src/utility/path-util.js +639 -0
  124. package/text-helpers.d.ts +4 -0
  125. package/text-helpers.js +4 -0
  126. package/themes.d.ts +4 -0
  127. package/themes.js +4 -0
  128. package/utility.d.ts +4 -0
  129. package/utility.js +4 -0
@@ -0,0 +1,639 @@
1
+ /**
2
+ * These utility methods help to process the data and to convert it to desired dimensions
3
+ */
4
+ /**
5
+ * processPathData method \
6
+ *
7
+ * @returns {Object[]} processPathData method .\
8
+ * @param { string } data - provide the data value.
9
+ * @private
10
+ */
11
+ export function processPathData(data) {
12
+ var collection = [];
13
+ var j;
14
+ var arrayCollection = parsePathData(data);
15
+ if (arrayCollection.length > 0) {
16
+ for (var i = 0; i < arrayCollection.length; i++) {
17
+ var ob = arrayCollection[parseInt(i.toString(), 10)];
18
+ var char = '';
19
+ char = ob[0];
20
+ switch (char.toLowerCase()) {
21
+ case 'm':
22
+ for (j = 1; j < ob.length; j++) {
23
+ collection.push({ command: char, x: ob[parseInt(j.toString(), 10)], y: ob[j + 1] });
24
+ j = j + 1;
25
+ if (char === 'm') {
26
+ char = 'l';
27
+ }
28
+ else if (char === 'M') {
29
+ char = 'L';
30
+ }
31
+ }
32
+ break;
33
+ case 'l':
34
+ case 't':
35
+ for (j = 1; j < ob.length; j++) {
36
+ collection.push({ command: char, x: ob[parseInt(j.toString(), 10)], y: ob[j + 1] });
37
+ j = j + 1;
38
+ }
39
+ break;
40
+ case 'h':
41
+ for (j = 1; j < ob.length; j++) {
42
+ collection.push({ command: char, x: ob[parseInt(j.toString(), 10)] });
43
+ }
44
+ break;
45
+ case 'v':
46
+ for (j = 1; j < ob.length; j++) {
47
+ collection.push({ command: char, y: ob[parseInt(j.toString(), 10)] });
48
+ }
49
+ break;
50
+ case 'z':
51
+ collection.push({ command: char });
52
+ break;
53
+ case 'c':
54
+ for (j = 1; j < ob.length; j++) {
55
+ collection.push({
56
+ command: char, x1: ob[parseInt(j.toString(), 10)], y1: ob[j + 1],
57
+ x2: ob[j + 2], y2: ob[j + 3], x: ob[j + 4], y: ob[j + 5]
58
+ });
59
+ j = j + 5;
60
+ }
61
+ break;
62
+ case 's':
63
+ for (j = 1; j < ob.length; j++) {
64
+ collection.push({ command: char, x2: ob[parseInt(j.toString(), 10)], y2: ob[j + 1], x: ob[j + 2], y: ob[j + 3] });
65
+ j = j + 3;
66
+ }
67
+ break;
68
+ case 'q':
69
+ for (j = 1; j < ob.length; j++) {
70
+ collection.push({ command: char, x1: ob[parseInt(j.toString(), 10)], y1: ob[j + 1], x: ob[j + 2], y: ob[j + 3] });
71
+ j = j + 3;
72
+ }
73
+ break;
74
+ case 'a':
75
+ for (j = 1; j < ob.length; j++) {
76
+ collection.push({
77
+ command: char, r1: ob[parseInt(j.toString(), 10)], r2: ob[j + 1], angle: ob[j + 2], largeArc: ob[j + 3],
78
+ sweep: ob[j + 4], x: ob[j + 5], y: ob[j + 6]
79
+ });
80
+ j = j + 6;
81
+ }
82
+ break;
83
+ }
84
+ }
85
+ }
86
+ return collection;
87
+ }
88
+ /**
89
+ * getPathString method \
90
+ *
91
+ * @returns {string} getPathString method .\
92
+ * @param { Object[]} arrayCollection - provide the val value.
93
+ * @private
94
+ */
95
+ export function getPathString(arrayCollection) {
96
+ var getNewString = '';
97
+ var i;
98
+ for (i = 0; i < arrayCollection.length; i++) {
99
+ if (i === 0) {
100
+ getNewString += getString(arrayCollection[parseInt(i.toString(), 10)]);
101
+ }
102
+ else {
103
+ getNewString += ' ' + getString(arrayCollection[parseInt(i.toString(), 10)]);
104
+ }
105
+ }
106
+ return getNewString;
107
+ }
108
+ /* eslint-disable */
109
+ /**
110
+ * getString method \
111
+ *
112
+ * @returns {string} getString method .\
113
+ * @param { PathSegment} arrayCollection - provide the val value.
114
+ * @private
115
+ */
116
+ export function getString(obj) {
117
+ var string = '';
118
+ switch (obj.command) {
119
+ case 'Z':
120
+ case 'z':
121
+ string = obj.command;
122
+ break;
123
+ case 'M':
124
+ case 'm':
125
+ case 'L':
126
+ case 'l':
127
+ string = obj.command + ' ' + obj.x + ' ' + obj.y;
128
+ break;
129
+ case 'C':
130
+ case 'c':
131
+ string = obj.command + ' ' + obj.x1 + ' ' + obj.y1 + ' ' + obj.x2 + ' ' + obj.y2 + ' ' + obj.x + ' ' + obj.y;
132
+ break;
133
+ case 'Q':
134
+ case 'q':
135
+ string = obj.command + ' ' + obj.x1 + ' ' + obj.y1 + ' ' + obj.x + ' ' + obj.y;
136
+ break;
137
+ case 'A':
138
+ case 'a':
139
+ var cmd = obj.command;
140
+ var ang = obj.angle;
141
+ var l = (obj.largeArc ? '1' : '0');
142
+ var s = (obj.sweep ? '1' : '0');
143
+ string = cmd + ' ' + obj.r1 + ' ' + obj.r2 + ' ' + ang + ' ' + l + ' ' + s + ' ' + obj.x + ' ' + obj.y;
144
+ break;
145
+ case 'H':
146
+ case 'h':
147
+ string = obj.command + ' ' + obj.x;
148
+ break;
149
+ case 'V':
150
+ case 'v':
151
+ string = obj.command + ' ' + obj.y;
152
+ break;
153
+ case 'S':
154
+ case 's':
155
+ string = obj.command + ' ' + obj.x2 + ' ' + obj.y2 + ' ' + obj.x + ' ' + obj.y;
156
+ break;
157
+ case 'T':
158
+ case 't':
159
+ string = obj.command + ' ' + obj.x + ' ' + obj.y;
160
+ }
161
+ return string;
162
+ }
163
+ /**
164
+ * parsePathData method \
165
+ *
166
+ * @returns {Object[]} parsePathData method .\
167
+ * @param { string } data - provide the data value.
168
+ * @private
169
+ */
170
+ export function parsePathData(data) {
171
+ var tokenizer = /([a-z]+)|([+-]?(?:\d+\.?\d*|\.\d+))/gi;
172
+ var current = [];
173
+ var commands = [];
174
+ var match = {};
175
+ tokenizer.lastIndex = 0;
176
+ var isExponential = false;
177
+ match = tokenizer.exec(data);
178
+ while (match) {
179
+ if (match[1] === 'e') {
180
+ //let s1: string = '';
181
+ isExponential = true;
182
+ }
183
+ else if (match[1]) {
184
+ if (match[1].toLowerCase() === 'zm') {
185
+ if (current.length) {
186
+ commands.push(current);
187
+ }
188
+ commands.push(['Z']);
189
+ current = [match[1].substring(1, 2)];
190
+ }
191
+ else {
192
+ if (current.length) {
193
+ commands.push(current);
194
+ }
195
+ current = [match[1]];
196
+ }
197
+ isExponential = false;
198
+ }
199
+ else {
200
+ if (!current.length) {
201
+ current = [];
202
+ }
203
+ if (!isExponential) {
204
+ current.push(Number(match[2]));
205
+ }
206
+ isExponential = false;
207
+ }
208
+ match = tokenizer.exec(data);
209
+ }
210
+ if (current.length) {
211
+ commands.push(current);
212
+ }
213
+ return commands;
214
+ }
215
+ /**
216
+ * splitArrayCollection method \
217
+ *
218
+ * @returns {Object[]} splitArrayCollection method .\
219
+ * @param { Object[]} arrayCollection - provide the val value.
220
+ * @private
221
+ */
222
+ export function splitArrayCollection(arrayCollection) {
223
+ var x0;
224
+ var y0;
225
+ var x1;
226
+ var y1;
227
+ var x2;
228
+ var y2;
229
+ var x;
230
+ var y;
231
+ var length;
232
+ var i;
233
+ for (x = 0, y = 0, i = 0, length = arrayCollection.length; i < length; ++i) {
234
+ var path = arrayCollection[parseInt(i.toString(), 10)];
235
+ var seg = path;
236
+ var char = seg.command;
237
+ if (/[MLHVCSQTA]/.test(char)) {
238
+ if ('x' in seg) {
239
+ seg.x = x = seg.x;
240
+ }
241
+ if ('y' in seg) {
242
+ seg.y = y = seg.y;
243
+ }
244
+ }
245
+ else {
246
+ if ('x1' in seg) {
247
+ seg.x1 = x1 = x + seg.x1;
248
+ }
249
+ if ('x2' in seg) {
250
+ seg.x2 = x2 = x + seg.x2;
251
+ }
252
+ if ('y1' in seg) {
253
+ seg.y1 = y1 = y + seg.y1;
254
+ }
255
+ if ('y2' in seg) {
256
+ seg.y2 = y2 = y + seg.y2;
257
+ }
258
+ if ('x' in seg) {
259
+ seg.x = x += seg.x;
260
+ }
261
+ if ('y' in seg) {
262
+ seg.y = y += seg.y;
263
+ }
264
+ var newSeg = void 0;
265
+ switch (char) {
266
+ case 'm':
267
+ case 'M':
268
+ newSeg = { command: 'M', x: x, y: y };
269
+ break;
270
+ case 'l':
271
+ case 'L':
272
+ newSeg = { command: 'L', x: x, y: y };
273
+ break;
274
+ case 'h':
275
+ case 'H':
276
+ newSeg = { command: 'H', x: x };
277
+ break;
278
+ case 'v':
279
+ case 'V':
280
+ newSeg = { command: 'V', y: y };
281
+ break;
282
+ case 'c':
283
+ case 'C':
284
+ newSeg = { command: 'C', x: x, y: y, x1: x1, y1: y1, x2: x2, y2: y2 };
285
+ break;
286
+ case 's':
287
+ case 'S':
288
+ newSeg = { command: 'S', x: x, y: y, x2: x2, y2: y2 };
289
+ break;
290
+ case 'q':
291
+ case 'Q':
292
+ newSeg = { command: 'Q', x: x, y: y, x1: x1, y1: y1 };
293
+ break;
294
+ case 't':
295
+ case 'T':
296
+ newSeg = { command: 'T', x: x, y: y };
297
+ break;
298
+ case 'a':
299
+ case 'A':
300
+ newSeg = { command: 'A', x: x, y: y };
301
+ newSeg.r1 = seg.r1;
302
+ newSeg.r2 = seg.r2;
303
+ newSeg.angle = seg.angle;
304
+ newSeg.largeArc = seg.largeArc;
305
+ newSeg.sweep = seg.sweep;
306
+ break;
307
+ case 'z':
308
+ case 'Z':
309
+ newSeg = { command: 'Z' };
310
+ x = x0;
311
+ y = y0;
312
+ newSeg = arrayCollection[parseInt(i.toString(), 10)];
313
+ break;
314
+ }
315
+ if (newSeg) {
316
+ arrayCollection[parseInt(i.toString(), 10)] = newSeg;
317
+ }
318
+ }
319
+ if (char === 'M' || char === 'm') {
320
+ x0 = x;
321
+ y0 = y;
322
+ }
323
+ }
324
+ return arrayCollection;
325
+ }
326
+ /**
327
+ * transformPath method \
328
+ *
329
+ * @returns {string} transformPath method .\
330
+ * @param { Object[]} arr - provide the collection value.
331
+ * @param { number} sX - provide the collection value.
332
+ * @param { number} sY - provide the collection value.
333
+ * @param { boolean} s - provide the collection value.
334
+ * @param {number} bX - provide the collection value.
335
+ * @param { number} bY - provide the collection value.
336
+ * @param { number} iX - provide the collection value.
337
+ * @param { number} iY - provide the collection value.
338
+ * @private
339
+ */
340
+ export function transformPath(arr, sX, sY, s, bX, bY, iX, iY) {
341
+ var x0;
342
+ var y0;
343
+ var x1;
344
+ var y1;
345
+ var x2;
346
+ var y2;
347
+ var x;
348
+ var y;
349
+ var length;
350
+ var i;
351
+ var newSeg;
352
+ for (x = 0, y = 0, i = 0, length = arr.length; i < length; ++i) {
353
+ var obj = arr[i];
354
+ var seg = obj;
355
+ var char = seg.command;
356
+ if ('x' in seg) {
357
+ x = seg.x;
358
+ }
359
+ if ('y' in seg) {
360
+ y = seg.y;
361
+ }
362
+ if ('y1' in seg) {
363
+ y1 = seg.y1;
364
+ }
365
+ if ('y2' in seg) {
366
+ y2 = seg.y2;
367
+ }
368
+ if ('x1' in seg) {
369
+ x1 = seg.x1;
370
+ }
371
+ if ('x2' in seg) {
372
+ x2 = seg.x2;
373
+ }
374
+ if (s) {
375
+ if (x !== undefined) {
376
+ x = scalePathData(x, sX, bX, iX);
377
+ }
378
+ if (y !== undefined) {
379
+ y = scalePathData(y, sY, bY, iY);
380
+ }
381
+ if (x1 !== undefined) {
382
+ x1 = scalePathData(x1, sX, bX, iX);
383
+ }
384
+ if (y1 !== undefined) {
385
+ y1 = scalePathData(y1, sY, bY, iY);
386
+ }
387
+ if (x2 !== undefined) {
388
+ x2 = scalePathData(x2, sX, bX, iX);
389
+ }
390
+ if (y2 !== undefined) {
391
+ y2 = scalePathData(y2, sY, bY, iY);
392
+ }
393
+ }
394
+ else {
395
+ if (x !== undefined) {
396
+ x = Number((x + sX).toFixed(2));
397
+ }
398
+ if (y !== undefined) {
399
+ y = Number((y + sY).toFixed(2));
400
+ }
401
+ if (x1 !== undefined) {
402
+ x1 = Number((x1 + sX).toFixed(2));
403
+ }
404
+ if (y1 !== undefined) {
405
+ y1 = Number((y1 + sY).toFixed(2));
406
+ }
407
+ if (x2 !== undefined) {
408
+ x2 = Number((x2 + sX).toFixed(2));
409
+ }
410
+ if (y2 !== undefined) {
411
+ y2 = Number((y2 + sY).toFixed(2));
412
+ }
413
+ }
414
+ var scaledPath = { x: x, y: y, x1: x1, y1: y1, x2: x2, y2: y2, r1: seg.r1, r2: seg.r2 };
415
+ newSeg = updatedSegment(seg, char, scaledPath, s, sX, sY);
416
+ if (newSeg) {
417
+ arr[i] = newSeg;
418
+ }
419
+ // Record the start of a subpath
420
+ if (char === 'M' || char === 'm') {
421
+ x0 = x;
422
+ y0 = y;
423
+ }
424
+ }
425
+ var pathData = getPathString(arr);
426
+ return pathData;
427
+ }
428
+ /**
429
+ * updatedSegment method \
430
+ *
431
+ * @returns {string} updatedSegment method .\
432
+ * @param { PathSegment} segment - provide the collection value.
433
+ * @param { PathSegment} char - provide the collection value.
434
+ * @param { number} obj - provide the collection value.
435
+ * @param { boolean} isScale - provide the collection value.
436
+ * @param {number} sX - provide the collection value.
437
+ * @param { number} sY - provide the collection value.
438
+ * @private
439
+ */
440
+ export function updatedSegment(segment, char, obj, isScale, sX, sY) {
441
+ switch (char) {
442
+ case 'M':
443
+ segment.x = obj.x;
444
+ segment.y = obj.y;
445
+ break;
446
+ case 'L':
447
+ segment.x = obj.x;
448
+ segment.y = obj.y;
449
+ break;
450
+ case 'H':
451
+ segment.x = obj.x;
452
+ break;
453
+ case 'V':
454
+ segment.y = obj.y;
455
+ break;
456
+ case 'C':
457
+ segment.x = obj.x;
458
+ segment.y = obj.y;
459
+ segment.x1 = obj.x1;
460
+ segment.y1 = obj.y1;
461
+ segment.x2 = obj.x2;
462
+ segment.y2 = obj.y2;
463
+ break;
464
+ case 'S':
465
+ segment.x = obj.x;
466
+ segment.y = obj.y;
467
+ segment.x2 = obj.x2;
468
+ segment.y2 = obj.y2;
469
+ break;
470
+ case 'Q':
471
+ segment.x = obj.x;
472
+ segment.y = obj.y;
473
+ segment.x1 = obj.x1;
474
+ segment.y1 = obj.y1;
475
+ break;
476
+ case 'T':
477
+ segment.x = obj.x;
478
+ segment.y = obj.y;
479
+ break;
480
+ case 'A':
481
+ var r1 = obj.r1;
482
+ var r2 = obj.r2;
483
+ if (isScale) {
484
+ obj.r1 = r1 = (r1 * sX);
485
+ obj.r2 = r2 = (r2 * sY);
486
+ }
487
+ segment.x = obj.x;
488
+ segment.y = obj.y;
489
+ segment.r1 = obj.r1;
490
+ segment.r2 = obj.r2;
491
+ break;
492
+ case 'z':
493
+ case 'Z':
494
+ segment = { command: 'Z' };
495
+ break;
496
+ }
497
+ return segment;
498
+ }
499
+ /* eslint-enable */
500
+ /**
501
+ * scalePathData method \
502
+ *
503
+ * @returns {string} scalePathData method .\
504
+ * @param { number} val - provide the val value.
505
+ * @param { number} scaleFactor - provide the scaleFactor value.
506
+ * @param { number} oldOffset - provide the oldOffset value.
507
+ * @param { number} newOffset - provide the newOffset value.
508
+ * @private
509
+ */
510
+ export function scalePathData(val, scaleFactor, oldOffset, newOffset) {
511
+ if (val !== oldOffset) {
512
+ if (newOffset !== oldOffset) {
513
+ val = (((val * scaleFactor) - (Number(oldOffset) * scaleFactor - Number(oldOffset)))
514
+ + (newOffset - Number(oldOffset)));
515
+ }
516
+ else {
517
+ val = ((Number(val) * scaleFactor) - (Number(oldOffset) * scaleFactor - Number(oldOffset)));
518
+ }
519
+ }
520
+ else {
521
+ if (newOffset !== oldOffset) {
522
+ val = newOffset;
523
+ }
524
+ }
525
+ return Number(val.toFixed(2));
526
+ }
527
+ /* eslint-disable */
528
+ /**
529
+ * pathSegmentCollection method \
530
+ *
531
+ * @returns {string} pathSegmentCollection method .\
532
+ * @param { Object[]} collection - provide the collection value.
533
+ * @private
534
+ */
535
+ export function pathSegmentCollection(collection) {
536
+ var x0;
537
+ var y0;
538
+ var x1;
539
+ var y1;
540
+ var x2;
541
+ var y2;
542
+ var x;
543
+ var y;
544
+ var length;
545
+ var i;
546
+ var initx;
547
+ var inity;
548
+ var segments = [];
549
+ for (x = 0, y = 0, i = 0, length = collection.length; i < length; ++i) {
550
+ var obj = collection[i];
551
+ var seg = obj;
552
+ var char = '';
553
+ char = seg.command;
554
+ if ('y1' in seg) {
555
+ y1 = seg.y1;
556
+ }
557
+ if ('y2' in seg) {
558
+ y2 = seg.y2;
559
+ }
560
+ if ('x1' in seg) {
561
+ x1 = seg.x1;
562
+ }
563
+ if ('x2' in seg) {
564
+ x2 = seg.x2;
565
+ }
566
+ if ('x' in seg) {
567
+ x = seg.x;
568
+ }
569
+ if ('y' in seg) {
570
+ y = seg.y;
571
+ }
572
+ var prev = segments[segments.length - 1];
573
+ switch (char) {
574
+ case 'M':
575
+ segments.push({ command: 'M', x: x, y: y });
576
+ break;
577
+ case 'L':
578
+ segments.push({ command: 'L', x0: x0, y0: y0, x: x, y: y });
579
+ break;
580
+ case 'H':
581
+ segments.push({ command: 'L', x0: x0, y0: y0, x: x, y: y0 });
582
+ break;
583
+ case 'V':
584
+ segments.push({ command: 'L', x0: x0, y0: y0, x: x0, y: y });
585
+ break;
586
+ case 'C':
587
+ segments.push({ command: 'C', x0: x0, y0: y0, x1: x1, y1: y1, x2: x2, y2: y2, x: x, y: y });
588
+ break;
589
+ case 'S':
590
+ if (prev) {
591
+ var ctrl = void 0;
592
+ if (prev.command === 'C' || prev.command === 'S') {
593
+ ctrl = { x: prev.x2, y: prev.y2 };
594
+ }
595
+ else {
596
+ ctrl = { x: x0, y: y0 };
597
+ }
598
+ var cpt2 = { x: 2 * x0 - ctrl.x, y: 2 * y0 - ctrl.y };
599
+ segments.push({ command: 'C', x0: x0, y0: y0, x1: cpt2.x, y1: cpt2.y, x2: x2, y2: y2, x: x, y: y });
600
+ }
601
+ break;
602
+ case 'Q':
603
+ //ctx.quadraticCurveTo(x1, y1, x, y);
604
+ segments.push({ command: 'Q', x0: x0, y0: y0, x1: x1, y1: y1, x: x, y: y });
605
+ break;
606
+ case 'T':
607
+ if (prev) {
608
+ var ctrl = void 0;
609
+ if (prev.command === 'Q') {
610
+ ctrl = { x: prev.x1, y: prev.y1 };
611
+ }
612
+ else {
613
+ ctrl = { x: x0, y: y0 };
614
+ }
615
+ var cpt2 = { x: 2 * x0 - ctrl.x, y: 2 * y0 - ctrl.y };
616
+ segments.push({ command: 'Q', x0: x0, y0: y0, x1: cpt2.x, y1: cpt2.y, x: x, y: y });
617
+ }
618
+ break;
619
+ case 'A':
620
+ var newSeg = seg;
621
+ newSeg.command = 'A';
622
+ segments.push(newSeg);
623
+ break;
624
+ case 'Z':
625
+ case 'z':
626
+ segments.push({ command: 'Z' });
627
+ x = x0;
628
+ y = y0;
629
+ break;
630
+ }
631
+ if (char === 'M' || char === 'm') {
632
+ initx = x;
633
+ inity = y;
634
+ }
635
+ x0 = x;
636
+ y0 = y;
637
+ }
638
+ return segments;
639
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * text-helpers
3
+ */
4
+ export * from './src/text-helpers/index';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * text-helpers
3
+ */
4
+ export * from './src/text-helpers/index';
package/themes.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * themes
3
+ */
4
+ export * from './src/themes/index';
package/themes.js ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * themes
3
+ */
4
+ export * from './src/themes/index';
package/utility.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * utility
3
+ */
4
+ export * from './src/utility/index';
package/utility.js ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * utility
3
+ */
4
+ export * from './src/utility/index';