@mlightcad/mtext-parser 1.1.6 → 1.1.8
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 +10 -1
- package/dist/parser.cjs.js +2 -2
- package/dist/parser.cjs.js.map +1 -1
- package/dist/parser.es.js +132 -112
- package/dist/parser.es.js.map +1 -1
- package/dist/parser.umd.js +2 -2
- package/dist/parser.umd.js.map +1 -1
- package/dist/types/parser.d.ts +45 -43
- package/package.json +1 -1
package/dist/parser.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
const
|
|
1
|
+
var m = /* @__PURE__ */ ((s) => (s[s.NONE = 0] = "NONE", s[s.WORD = 1] = "WORD", s[s.STACK = 2] = "STACK", s[s.SPACE = 3] = "SPACE", s[s.NBSP = 4] = "NBSP", s[s.TABULATOR = 5] = "TABULATOR", s[s.NEW_PARAGRAPH = 6] = "NEW_PARAGRAPH", s[s.NEW_COLUMN = 7] = "NEW_COLUMN", s[s.WRAP_AT_DIMLINE = 8] = "WRAP_AT_DIMLINE", s[s.PROPERTIES_CHANGED = 9] = "PROPERTIES_CHANGED", s))(m || {}), _ = /* @__PURE__ */ ((s) => (s[s.BOTTOM = 0] = "BOTTOM", s[s.MIDDLE = 1] = "MIDDLE", s[s.TOP = 2] = "TOP", s))(_ || {}), S = /* @__PURE__ */ ((s) => (s[s.DEFAULT = 0] = "DEFAULT", s[s.LEFT = 1] = "LEFT", s[s.RIGHT = 2] = "RIGHT", s[s.CENTER = 3] = "CENTER", s[s.JUSTIFIED = 4] = "JUSTIFIED", s[s.DISTRIBUTED = 5] = "DISTRIBUTED", s))(S || {}), E = /* @__PURE__ */ ((s) => (s[s.NONE = 0] = "NONE", s[s.UNDERLINE = 1] = "UNDERLINE", s[s.OVERLINE = 2] = "OVERLINE", s[s.STRIKE_THROUGH = 4] = "STRIKE_THROUGH", s))(E || {});
|
|
2
|
+
const F = {
|
|
3
3
|
c: "Ø",
|
|
4
4
|
d: "°",
|
|
5
5
|
p: "±"
|
|
6
|
-
},
|
|
6
|
+
}, R = {
|
|
7
7
|
l: 1,
|
|
8
8
|
r: 2,
|
|
9
9
|
c: 3,
|
|
@@ -11,11 +11,11 @@ const E = {
|
|
|
11
11
|
d: 5
|
|
12
12
|
/* DISTRIBUTED */
|
|
13
13
|
};
|
|
14
|
-
function
|
|
14
|
+
function O(s) {
|
|
15
15
|
const [t, e, r] = s;
|
|
16
16
|
return r << 16 | e << 8 | t;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function y(s) {
|
|
19
19
|
const t = s & 255, e = s >> 8 & 255, r = s >> 16 & 255;
|
|
20
20
|
return [t, e, r];
|
|
21
21
|
}
|
|
@@ -25,14 +25,14 @@ function N(s) {
|
|
|
25
25
|
function I(s) {
|
|
26
26
|
return s.replace(/\\P/g, "").replace(/\\~/g, "").includes("\\");
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function x(s, t = !1) {
|
|
29
29
|
const e = /* @__PURE__ */ new Set(), r = /\\[fF](.*?)[;|]/g;
|
|
30
30
|
return [...s.matchAll(r)].forEach((a) => {
|
|
31
|
-
let
|
|
32
|
-
t && (
|
|
31
|
+
let l = a[1].toLowerCase();
|
|
32
|
+
t && (l = l.replace(/\.(ttf|otf|woff|shx)$/, "")), e.add(l);
|
|
33
33
|
}), e;
|
|
34
34
|
}
|
|
35
|
-
class
|
|
35
|
+
class v {
|
|
36
36
|
/**
|
|
37
37
|
* Creates a new ContextStack with an initial context.
|
|
38
38
|
* @param initial The initial MTextContext to use as the base of the stack.
|
|
@@ -89,12 +89,12 @@ class D {
|
|
|
89
89
|
* Creates a new MTextParser instance
|
|
90
90
|
* @param content - The MText content to parse
|
|
91
91
|
* @param ctx - Optional initial MText context
|
|
92
|
-
* @param
|
|
92
|
+
* @param options - Parser options
|
|
93
93
|
*/
|
|
94
|
-
constructor(t, e, r =
|
|
94
|
+
constructor(t, e, r = {}) {
|
|
95
95
|
this.continueStroke = !1, this.inStackContext = !1, this.scanner = new g(t);
|
|
96
|
-
const a = e ?? new
|
|
97
|
-
this.ctxStack = new
|
|
96
|
+
const a = e ?? new k();
|
|
97
|
+
this.ctxStack = new v(a), this.yieldPropertyCommands = r.yieldPropertyCommands ?? !1, this.resetParagraphParameters = r.resetParagraphParameters ?? !1;
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
100
100
|
* Decode multi-byte character from hex code
|
|
@@ -109,8 +109,8 @@ class D {
|
|
|
109
109
|
]), a = new TextDecoder("gbk").decode(e);
|
|
110
110
|
if (a !== "▯")
|
|
111
111
|
return a;
|
|
112
|
-
const
|
|
113
|
-
return
|
|
112
|
+
const i = new TextDecoder("big5").decode(e);
|
|
113
|
+
return i !== "▯" ? i : "▯";
|
|
114
114
|
} catch {
|
|
115
115
|
return "▯";
|
|
116
116
|
}
|
|
@@ -134,31 +134,31 @@ class D {
|
|
|
134
134
|
parseStacking() {
|
|
135
135
|
const t = new g(this.extractExpression(!0));
|
|
136
136
|
let e = "", r = "", a = "";
|
|
137
|
-
const
|
|
138
|
-
let
|
|
139
|
-
return
|
|
140
|
-
},
|
|
141
|
-
let
|
|
137
|
+
const l = () => {
|
|
138
|
+
let c = t.peek(), n = !1;
|
|
139
|
+
return c.charCodeAt(0) < 32 && (c = " "), c === "\\" && (n = !0, t.consume(1), c = t.peek()), t.consume(1), [c, n];
|
|
140
|
+
}, i = () => {
|
|
141
|
+
let c = "";
|
|
142
142
|
for (; t.hasData; ) {
|
|
143
|
-
const [
|
|
144
|
-
if (!
|
|
145
|
-
return [
|
|
146
|
-
|
|
143
|
+
const [n, p] = l();
|
|
144
|
+
if (!p && (n === "/" || n === "#" || n === "^"))
|
|
145
|
+
return [c, n];
|
|
146
|
+
c += n;
|
|
147
147
|
}
|
|
148
|
-
return [
|
|
149
|
-
}, u = (
|
|
150
|
-
let
|
|
148
|
+
return [c, ""];
|
|
149
|
+
}, u = (c) => {
|
|
150
|
+
let n = "", p = c;
|
|
151
151
|
for (; t.hasData; ) {
|
|
152
|
-
const [
|
|
153
|
-
if (!(
|
|
154
|
-
if (
|
|
152
|
+
const [o, h] = l();
|
|
153
|
+
if (!(p && o === " ")) {
|
|
154
|
+
if (p = !1, !h && o === ";")
|
|
155
155
|
break;
|
|
156
|
-
|
|
156
|
+
n += o;
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
return
|
|
159
|
+
return n;
|
|
160
160
|
};
|
|
161
|
-
return [e, a] =
|
|
161
|
+
return [e, a] = i(), a && (r = u(a === "^")), e === "" && r.includes("I/") ? [2, [" ", " ", "/"]] : a === "^" ? [2, [e, r, "^"]] : [2, [e, r, a]];
|
|
162
162
|
}
|
|
163
163
|
/**
|
|
164
164
|
* Parse MText properties
|
|
@@ -237,7 +237,7 @@ class D {
|
|
|
237
237
|
const r = {};
|
|
238
238
|
if (t.underline !== e.underline && (r.underline = e.underline), t.overline !== e.overline && (r.overline = e.overline), t.strikeThrough !== e.strikeThrough && (r.strikeThrough = e.strikeThrough), t.color.aci !== e.color.aci && (r.aci = e.color.aci), t.color.rgbValue !== e.color.rgbValue && (r.rgb = e.color.rgb), t.align !== e.align && (r.align = e.align), JSON.stringify(t.fontFace) !== JSON.stringify(e.fontFace) && (r.fontFace = e.fontFace), (t.capHeight.value !== e.capHeight.value || t.capHeight.isRelative !== e.capHeight.isRelative) && (r.capHeight = e.capHeight), (t.widthFactor.value !== e.widthFactor.value || t.widthFactor.isRelative !== e.widthFactor.isRelative) && (r.widthFactor = e.widthFactor), (t.charTrackingFactor.value !== e.charTrackingFactor.value || t.charTrackingFactor.isRelative !== e.charTrackingFactor.isRelative) && (r.charTrackingFactor = e.charTrackingFactor), t.oblique !== e.oblique && (r.oblique = e.oblique), JSON.stringify(t.paragraph) !== JSON.stringify(e.paragraph)) {
|
|
239
239
|
const a = {};
|
|
240
|
-
t.paragraph.indent !== e.paragraph.indent && (a.indent = e.paragraph.indent), t.paragraph.align !== e.paragraph.align && (a.align = e.paragraph.align), t.paragraph.left !== e.paragraph.left && (a.left = e.paragraph.left), t.paragraph.right !== e.paragraph.right && (a.right = e.paragraph.right), JSON.stringify(t.paragraph.
|
|
240
|
+
t.paragraph.indent !== e.paragraph.indent && (a.indent = e.paragraph.indent), t.paragraph.align !== e.paragraph.align && (a.align = e.paragraph.align), t.paragraph.left !== e.paragraph.left && (a.left = e.paragraph.left), t.paragraph.right !== e.paragraph.right && (a.right = e.paragraph.right), JSON.stringify(t.paragraph.tabs) !== JSON.stringify(e.paragraph.tabs) && (a.tabs = e.paragraph.tabs), Object.keys(a).length > 0 && (r.paragraph = a);
|
|
241
241
|
}
|
|
242
242
|
return r;
|
|
243
243
|
}
|
|
@@ -392,11 +392,11 @@ class D {
|
|
|
392
392
|
extractExpression(t = !1) {
|
|
393
393
|
const e = this.scanner.find(";", t);
|
|
394
394
|
if (e < 0) {
|
|
395
|
-
const
|
|
396
|
-
return this.scanner.consume(
|
|
395
|
+
const i = this.scanner.tail;
|
|
396
|
+
return this.scanner.consume(i.length), i;
|
|
397
397
|
}
|
|
398
|
-
const a = this.scanner.peek(e - this.scanner.currentIndex - 1) === "\\",
|
|
399
|
-
return this.scanner.consume(
|
|
398
|
+
const a = this.scanner.peek(e - this.scanner.currentIndex - 1) === "\\", l = this.scanner.tail.slice(0, e - this.scanner.currentIndex + (a ? 1 : 0));
|
|
399
|
+
return this.scanner.consume(l.length + 1), l;
|
|
400
400
|
}
|
|
401
401
|
/**
|
|
402
402
|
* Parse font properties
|
|
@@ -406,13 +406,13 @@ class D {
|
|
|
406
406
|
const e = this.extractExpression().split("|");
|
|
407
407
|
if (e.length > 0 && e[0]) {
|
|
408
408
|
const r = e[0];
|
|
409
|
-
let a = "Regular",
|
|
410
|
-
for (const
|
|
411
|
-
|
|
409
|
+
let a = "Regular", l = 400;
|
|
410
|
+
for (const i of e.slice(1))
|
|
411
|
+
i.startsWith("b1") ? l = 700 : i === "i" || i.startsWith("i1") ? a = "Italic" : (i === "i0" || i.startsWith("i0")) && (a = "Regular");
|
|
412
412
|
t.fontFace = {
|
|
413
413
|
family: r,
|
|
414
414
|
style: a,
|
|
415
|
-
weight:
|
|
415
|
+
weight: l
|
|
416
416
|
};
|
|
417
417
|
}
|
|
418
418
|
}
|
|
@@ -423,46 +423,46 @@ class D {
|
|
|
423
423
|
*/
|
|
424
424
|
parseParagraphProperties(t) {
|
|
425
425
|
const e = new g(this.extractExpression());
|
|
426
|
-
let r = t.paragraph.indent, a = t.paragraph.left,
|
|
427
|
-
const
|
|
428
|
-
const
|
|
429
|
-
if (
|
|
430
|
-
const
|
|
431
|
-
for (e.consume(
|
|
426
|
+
let r = t.paragraph.indent, a = t.paragraph.left, l = t.paragraph.right, i = t.paragraph.align, u = [];
|
|
427
|
+
const c = () => {
|
|
428
|
+
const n = e.tail.match(/^[+-]?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?/);
|
|
429
|
+
if (n) {
|
|
430
|
+
const p = parseFloat(n[0]);
|
|
431
|
+
for (e.consume(n[0].length); e.peek() === ","; )
|
|
432
432
|
e.consume(1);
|
|
433
|
-
return
|
|
433
|
+
return p;
|
|
434
434
|
}
|
|
435
435
|
return 0;
|
|
436
436
|
};
|
|
437
437
|
for (; e.hasData; )
|
|
438
438
|
switch (e.get()) {
|
|
439
439
|
case "i":
|
|
440
|
-
r =
|
|
440
|
+
r = c();
|
|
441
441
|
break;
|
|
442
442
|
case "l":
|
|
443
|
-
a =
|
|
443
|
+
a = c();
|
|
444
444
|
break;
|
|
445
445
|
case "r":
|
|
446
|
-
|
|
446
|
+
l = c();
|
|
447
447
|
break;
|
|
448
448
|
case "x":
|
|
449
449
|
break;
|
|
450
450
|
case "q": {
|
|
451
|
-
const
|
|
452
|
-
for (
|
|
451
|
+
const p = e.get();
|
|
452
|
+
for (i = R[p] || 0; e.peek() === ","; )
|
|
453
453
|
e.consume(1);
|
|
454
454
|
break;
|
|
455
455
|
}
|
|
456
456
|
case "t":
|
|
457
457
|
for (u = []; e.hasData; ) {
|
|
458
|
-
const
|
|
459
|
-
if (
|
|
458
|
+
const p = e.peek();
|
|
459
|
+
if (p === "r" || p === "c") {
|
|
460
460
|
e.consume(1);
|
|
461
|
-
const
|
|
462
|
-
u.push(
|
|
461
|
+
const o = c();
|
|
462
|
+
u.push(p + o.toString());
|
|
463
463
|
} else {
|
|
464
|
-
const
|
|
465
|
-
isNaN(
|
|
464
|
+
const o = c();
|
|
465
|
+
isNaN(o) ? e.consume(1) : u.push(o);
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
468
|
break;
|
|
@@ -470,9 +470,9 @@ class D {
|
|
|
470
470
|
t.paragraph = {
|
|
471
471
|
indent: r,
|
|
472
472
|
left: a,
|
|
473
|
-
right:
|
|
474
|
-
align:
|
|
475
|
-
|
|
473
|
+
right: l,
|
|
474
|
+
align: i,
|
|
475
|
+
tabs: u
|
|
476
476
|
};
|
|
477
477
|
}
|
|
478
478
|
/**
|
|
@@ -487,12 +487,24 @@ class D {
|
|
|
487
487
|
*/
|
|
488
488
|
*parse() {
|
|
489
489
|
let r = null;
|
|
490
|
-
|
|
491
|
-
|
|
490
|
+
function a(i) {
|
|
491
|
+
const u = { ...i.paragraph };
|
|
492
|
+
i.paragraph = {
|
|
493
|
+
indent: 0,
|
|
494
|
+
left: 0,
|
|
495
|
+
right: 0,
|
|
496
|
+
align: 0,
|
|
497
|
+
tabs: []
|
|
498
|
+
};
|
|
499
|
+
const c = {};
|
|
500
|
+
return u.indent !== 0 && (c.indent = 0), u.left !== 0 && (c.left = 0), u.right !== 0 && (c.right = 0), u.align !== 0 && (c.align = 0), JSON.stringify(u.tabs) !== JSON.stringify([]) && (c.tabs = []), c;
|
|
501
|
+
}
|
|
502
|
+
const l = () => {
|
|
503
|
+
var u;
|
|
492
504
|
let i = "";
|
|
493
505
|
for (; this.scanner.hasData; ) {
|
|
494
|
-
let
|
|
495
|
-
const
|
|
506
|
+
let c = !1, n = this.scanner.peek();
|
|
507
|
+
const p = this.scanner.currentIndex;
|
|
496
508
|
if (n.charCodeAt(0) < 32) {
|
|
497
509
|
if (this.scanner.consume(1), n === " ")
|
|
498
510
|
return [5, null];
|
|
@@ -503,7 +515,7 @@ class D {
|
|
|
503
515
|
}
|
|
504
516
|
if (n === "\\")
|
|
505
517
|
if ("\\{}".includes(this.scanner.peek(1)))
|
|
506
|
-
|
|
518
|
+
c = !0, this.scanner.consume(1), n = this.scanner.peek();
|
|
507
519
|
else {
|
|
508
520
|
if (i)
|
|
509
521
|
return [1, i];
|
|
@@ -520,18 +532,18 @@ class D {
|
|
|
520
532
|
return [8, null];
|
|
521
533
|
case "S": {
|
|
522
534
|
this.inStackContext = !0;
|
|
523
|
-
const
|
|
524
|
-
return this.inStackContext = !1,
|
|
535
|
+
const h = this.parseStacking();
|
|
536
|
+
return this.inStackContext = !1, h;
|
|
525
537
|
}
|
|
526
538
|
case "m":
|
|
527
539
|
case "M":
|
|
528
540
|
if (this.scanner.peek() === "+") {
|
|
529
541
|
this.scanner.consume(1);
|
|
530
|
-
const
|
|
531
|
-
if (
|
|
542
|
+
const h = (u = this.scanner.tail.match(/^[0-9A-Fa-f]{4}/)) == null ? void 0 : u[0];
|
|
543
|
+
if (h) {
|
|
532
544
|
this.scanner.consume(4);
|
|
533
|
-
const
|
|
534
|
-
return i ? [1, i] : [1,
|
|
545
|
+
const b = this.decodeMultiByteChar(h);
|
|
546
|
+
return i ? [1, i] : [1, b];
|
|
535
547
|
}
|
|
536
548
|
this.scanner.consume(-1);
|
|
537
549
|
}
|
|
@@ -540,24 +552,24 @@ class D {
|
|
|
540
552
|
default:
|
|
541
553
|
if (o)
|
|
542
554
|
try {
|
|
543
|
-
const
|
|
544
|
-
if (this.yieldPropertyCommands &&
|
|
545
|
-
return [9,
|
|
555
|
+
const h = this.parseProperties(o);
|
|
556
|
+
if (this.yieldPropertyCommands && h)
|
|
557
|
+
return [9, h];
|
|
546
558
|
continue;
|
|
547
559
|
} catch {
|
|
548
|
-
const
|
|
549
|
-
|
|
560
|
+
const h = this.scanner.tail.slice(
|
|
561
|
+
p,
|
|
550
562
|
this.scanner.currentIndex
|
|
551
563
|
);
|
|
552
|
-
i +=
|
|
564
|
+
i += h;
|
|
553
565
|
}
|
|
554
566
|
}
|
|
555
567
|
continue;
|
|
556
568
|
}
|
|
557
569
|
if (n === "%" && this.scanner.peek(1) === "%") {
|
|
558
|
-
const o = this.scanner.peek(2).toLowerCase(),
|
|
559
|
-
if (
|
|
560
|
-
this.scanner.consume(3), i +=
|
|
570
|
+
const o = this.scanner.peek(2).toLowerCase(), h = F[o];
|
|
571
|
+
if (h) {
|
|
572
|
+
this.scanner.consume(3), i += h;
|
|
561
573
|
continue;
|
|
562
574
|
} else {
|
|
563
575
|
this.scanner.consume(3);
|
|
@@ -566,7 +578,7 @@ class D {
|
|
|
566
578
|
}
|
|
567
579
|
if (n === " ")
|
|
568
580
|
return i ? (this.scanner.consume(1), r = 3, [1, i]) : (this.scanner.consume(1), [3, null]);
|
|
569
|
-
if (!
|
|
581
|
+
if (!c) {
|
|
570
582
|
if (n === "{") {
|
|
571
583
|
if (i)
|
|
572
584
|
return [1, i];
|
|
@@ -578,11 +590,11 @@ class D {
|
|
|
578
590
|
if (this.scanner.consume(1), this.yieldPropertyCommands) {
|
|
579
591
|
const o = this.ctxStack.current;
|
|
580
592
|
this.popCtx();
|
|
581
|
-
const
|
|
582
|
-
if (Object.keys(
|
|
593
|
+
const h = this.getPropertyChanges(o, this.ctxStack.current);
|
|
594
|
+
if (Object.keys(h).length > 0)
|
|
583
595
|
return [
|
|
584
596
|
9,
|
|
585
|
-
{ command: void 0, changes:
|
|
597
|
+
{ command: void 0, changes: h, depth: this.ctxStack.depth }
|
|
586
598
|
];
|
|
587
599
|
} else
|
|
588
600
|
this.popCtx();
|
|
@@ -592,15 +604,15 @@ class D {
|
|
|
592
604
|
if (!this.inStackContext && n === "^") {
|
|
593
605
|
const o = this.scanner.peek(1);
|
|
594
606
|
if (o) {
|
|
595
|
-
const
|
|
596
|
-
if (this.scanner.consume(2),
|
|
607
|
+
const h = o.charCodeAt(0);
|
|
608
|
+
if (this.scanner.consume(2), h === 32)
|
|
597
609
|
i += "^";
|
|
598
610
|
else {
|
|
599
|
-
if (
|
|
611
|
+
if (h === 73)
|
|
600
612
|
return i ? [1, i] : [5, null];
|
|
601
|
-
if (
|
|
613
|
+
if (h === 74)
|
|
602
614
|
return i ? [1, i] : [6, null];
|
|
603
|
-
if (
|
|
615
|
+
if (h === 77)
|
|
604
616
|
continue;
|
|
605
617
|
i += "▯";
|
|
606
618
|
}
|
|
@@ -612,10 +624,18 @@ class D {
|
|
|
612
624
|
return i ? [1, i] : [0, null];
|
|
613
625
|
};
|
|
614
626
|
for (; ; ) {
|
|
615
|
-
const [i,
|
|
616
|
-
if (i)
|
|
617
|
-
yield new
|
|
618
|
-
|
|
627
|
+
const [i, u] = l.call(this);
|
|
628
|
+
if (i) {
|
|
629
|
+
if (yield new f(i, this.ctxStack.current.copy(), u), i === 6 && this.resetParagraphParameters) {
|
|
630
|
+
const c = this.ctxStack.current, n = a(c);
|
|
631
|
+
this.yieldPropertyCommands && Object.keys(n).length > 0 && (yield new f(9, c.copy(), {
|
|
632
|
+
command: void 0,
|
|
633
|
+
changes: { paragraph: n },
|
|
634
|
+
depth: this.ctxStack.depth
|
|
635
|
+
}));
|
|
636
|
+
}
|
|
637
|
+
r && (yield new f(r, this.ctxStack.current.copy(), null), r = null);
|
|
638
|
+
} else
|
|
619
639
|
break;
|
|
620
640
|
}
|
|
621
641
|
}
|
|
@@ -720,7 +740,7 @@ class g {
|
|
|
720
740
|
return t;
|
|
721
741
|
}
|
|
722
742
|
}
|
|
723
|
-
class
|
|
743
|
+
class d {
|
|
724
744
|
// Store as 0xRRGGBB or null
|
|
725
745
|
/**
|
|
726
746
|
* Create a new MTextColor instance.
|
|
@@ -796,7 +816,7 @@ class f {
|
|
|
796
816
|
* @returns A new MTextColor instance with the same color state.
|
|
797
817
|
*/
|
|
798
818
|
copy() {
|
|
799
|
-
const t = new
|
|
819
|
+
const t = new d();
|
|
800
820
|
return t._aci = this._aci, t._rgbValue = this._rgbValue, t;
|
|
801
821
|
}
|
|
802
822
|
/**
|
|
@@ -815,14 +835,14 @@ class f {
|
|
|
815
835
|
return this._aci === t._aci && this._rgbValue === t._rgbValue;
|
|
816
836
|
}
|
|
817
837
|
}
|
|
818
|
-
class
|
|
838
|
+
class k {
|
|
819
839
|
constructor() {
|
|
820
|
-
this._stroke = 0, this.continueStroke = !1, this.color = new
|
|
840
|
+
this._stroke = 0, this.continueStroke = !1, this.color = new d(), this.align = 0, this.fontFace = { family: "", style: "Regular", weight: 400 }, this._capHeight = { value: 1, isRelative: !1 }, this._widthFactor = { value: 1, isRelative: !1 }, this._charTrackingFactor = { value: 1, isRelative: !1 }, this.oblique = 0, this.paragraph = {
|
|
821
841
|
indent: 0,
|
|
822
842
|
left: 0,
|
|
823
843
|
right: 0,
|
|
824
844
|
align: 0,
|
|
825
|
-
|
|
845
|
+
tabs: []
|
|
826
846
|
};
|
|
827
847
|
}
|
|
828
848
|
/**
|
|
@@ -957,11 +977,11 @@ class d {
|
|
|
957
977
|
* @returns A new context with the same properties
|
|
958
978
|
*/
|
|
959
979
|
copy() {
|
|
960
|
-
const t = new
|
|
980
|
+
const t = new k();
|
|
961
981
|
return t._stroke = this._stroke, t.continueStroke = this.continueStroke, t.color = this.color.copy(), t.align = this.align, t.fontFace = { ...this.fontFace }, t._capHeight = { ...this._capHeight }, t._widthFactor = { ...this._widthFactor }, t._charTrackingFactor = { ...this._charTrackingFactor }, t.oblique = this.oblique, t.paragraph = { ...this.paragraph }, t;
|
|
962
982
|
}
|
|
963
983
|
}
|
|
964
|
-
class
|
|
984
|
+
class f {
|
|
965
985
|
/**
|
|
966
986
|
* Create a new MText token
|
|
967
987
|
* @param type - The token type
|
|
@@ -973,19 +993,19 @@ class k {
|
|
|
973
993
|
}
|
|
974
994
|
}
|
|
975
995
|
export {
|
|
976
|
-
|
|
977
|
-
|
|
996
|
+
d as MTextColor,
|
|
997
|
+
k as MTextContext,
|
|
978
998
|
_ as MTextLineAlignment,
|
|
979
|
-
|
|
999
|
+
S as MTextParagraphAlignment,
|
|
980
1000
|
D as MTextParser,
|
|
981
|
-
|
|
982
|
-
|
|
1001
|
+
E as MTextStroke,
|
|
1002
|
+
f as MTextToken,
|
|
983
1003
|
g as TextScanner,
|
|
984
|
-
|
|
1004
|
+
m as TokenType,
|
|
985
1005
|
N as escapeDxfLineEndings,
|
|
986
|
-
|
|
1006
|
+
x as getFonts,
|
|
987
1007
|
I as hasInlineFormattingCodes,
|
|
988
|
-
|
|
989
|
-
|
|
1008
|
+
y as int2rgb,
|
|
1009
|
+
O as rgb2int
|
|
990
1010
|
};
|
|
991
1011
|
//# sourceMappingURL=parser.es.js.map
|