@mlightcad/mtext-parser 1.2.0 → 1.3.2
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/dist/parser.cjs.js +2 -2
- package/dist/parser.cjs.js.map +1 -1
- package/dist/parser.es.js +155 -121
- 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 +26 -1
- package/package.json +3 -2
package/dist/parser.es.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
const
|
|
1
|
+
var _ = /* @__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))(_ || {}), F = /* @__PURE__ */ ((s) => (s[s.BOTTOM = 0] = "BOTTOM", s[s.MIDDLE = 1] = "MIDDLE", s[s.TOP = 2] = "TOP", s))(F || {}), 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 R = {
|
|
3
3
|
c: "Ø",
|
|
4
4
|
d: "°",
|
|
5
|
-
p: "±"
|
|
6
|
-
|
|
5
|
+
p: "±",
|
|
6
|
+
"%": "%"
|
|
7
|
+
}, v = {
|
|
7
8
|
l: 1,
|
|
8
9
|
r: 2,
|
|
9
10
|
c: 3,
|
|
@@ -11,28 +12,28 @@ const v = {
|
|
|
11
12
|
d: 5
|
|
12
13
|
/* DISTRIBUTED */
|
|
13
14
|
};
|
|
14
|
-
function
|
|
15
|
+
function I(s) {
|
|
15
16
|
const [t, e, r] = s;
|
|
16
17
|
return r << 16 | e << 8 | t;
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
+
function O(s) {
|
|
19
20
|
const t = s & 255, e = s >> 8 & 255, r = s >> 16 & 255;
|
|
20
21
|
return [t, e, r];
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
+
function N(s) {
|
|
23
24
|
return s.replace(/\r\n|\r|\n/g, "\\P");
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
+
function w(s) {
|
|
26
27
|
return s.replace(/\\P/g, "").replace(/\\~/g, "").includes("\\");
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
+
function D(s, t = !1) {
|
|
29
30
|
const e = /* @__PURE__ */ new Set(), r = /\\[fF](.*?)[;|]/g;
|
|
30
31
|
return [...s.matchAll(r)].forEach((a) => {
|
|
31
|
-
let
|
|
32
|
-
t && (
|
|
32
|
+
let h = a[1].toLowerCase();
|
|
33
|
+
t && (h = h.replace(/\.(ttf|otf|woff|shx)$/, "")), e.add(h);
|
|
33
34
|
}), e;
|
|
34
35
|
}
|
|
35
|
-
class
|
|
36
|
+
class y {
|
|
36
37
|
/**
|
|
37
38
|
* Creates a new ContextStack with an initial context.
|
|
38
39
|
* @param initial The initial MTextContext to use as the base of the stack.
|
|
@@ -84,7 +85,7 @@ class O {
|
|
|
84
85
|
this.stack[this.stack.length - 1] = t;
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
|
-
class
|
|
88
|
+
class x {
|
|
88
89
|
/**
|
|
89
90
|
* Creates a new MTextParser instance
|
|
90
91
|
* @param content - The MText content to parse
|
|
@@ -94,27 +95,56 @@ class D {
|
|
|
94
95
|
constructor(t, e, r = {}) {
|
|
95
96
|
this.continueStroke = !1, this.inStackContext = !1, this.scanner = new d(t);
|
|
96
97
|
const a = e ?? new m();
|
|
97
|
-
this.ctxStack = new
|
|
98
|
+
this.ctxStack = new y(a), this.yieldPropertyCommands = r.yieldPropertyCommands ?? !1, this.resetParagraphParameters = r.resetParagraphParameters ?? !1, this.mifDecoder = r.mifDecoder ?? this.decodeMultiByteChar.bind(this), this.mifCodeLength = r.mifCodeLength ?? "auto";
|
|
98
99
|
}
|
|
99
100
|
/**
|
|
100
101
|
* Decode multi-byte character from hex code
|
|
101
|
-
* @param hex - Hex code string (e.g. "C4E3")
|
|
102
|
+
* @param hex - Hex code string (e.g. "C4E3" or "1A2B3")
|
|
102
103
|
* @returns Decoded character or empty square if invalid
|
|
103
104
|
*/
|
|
104
105
|
decodeMultiByteChar(t) {
|
|
105
106
|
try {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
107
|
+
if (t.length === 5) {
|
|
108
|
+
const e = t[0];
|
|
109
|
+
let r = "gbk";
|
|
110
|
+
e === "1" ? r = "shift-jis" : e === "2" && (r = "big5");
|
|
111
|
+
const a = new Uint8Array([
|
|
112
|
+
parseInt(t.substr(1, 2), 16),
|
|
113
|
+
parseInt(t.substr(3, 2), 16)
|
|
114
|
+
]);
|
|
115
|
+
return new TextDecoder(r).decode(a);
|
|
116
|
+
} else if (t.length === 4) {
|
|
117
|
+
const e = new Uint8Array([
|
|
118
|
+
parseInt(t.substr(0, 2), 16),
|
|
119
|
+
parseInt(t.substr(2, 2), 16)
|
|
120
|
+
]), a = new TextDecoder("gbk").decode(e);
|
|
121
|
+
if (a !== "▯")
|
|
122
|
+
return a;
|
|
123
|
+
const i = new TextDecoder("big5").decode(e);
|
|
124
|
+
if (i !== "▯")
|
|
125
|
+
return i;
|
|
126
|
+
}
|
|
127
|
+
return "▯";
|
|
114
128
|
} catch {
|
|
115
129
|
return "▯";
|
|
116
130
|
}
|
|
117
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Extract MIF hex code from scanner
|
|
134
|
+
* @param length - The length of the hex code to extract (4 or 5), or 'auto' to detect
|
|
135
|
+
* @returns The extracted hex code, or null if not found
|
|
136
|
+
*/
|
|
137
|
+
extractMifCode(t) {
|
|
138
|
+
var e, r, a;
|
|
139
|
+
if (t === "auto") {
|
|
140
|
+
const h = (e = this.scanner.tail.match(/^[0-9A-Fa-f]{5}/)) == null ? void 0 : e[0];
|
|
141
|
+
if (h)
|
|
142
|
+
return h;
|
|
143
|
+
const i = (r = this.scanner.tail.match(/^[0-9A-Fa-f]{4}/)) == null ? void 0 : r[0];
|
|
144
|
+
return i || null;
|
|
145
|
+
} else
|
|
146
|
+
return ((a = this.scanner.tail.match(new RegExp(`^[0-9A-Fa-f]{${t}}`))) == null ? void 0 : a[0]) || null;
|
|
147
|
+
}
|
|
118
148
|
/**
|
|
119
149
|
* Push current context onto the stack
|
|
120
150
|
*/
|
|
@@ -134,29 +164,29 @@ class D {
|
|
|
134
164
|
parseStacking() {
|
|
135
165
|
const t = new d(this.extractExpression(!0));
|
|
136
166
|
let e = "", r = "", a = "";
|
|
137
|
-
const
|
|
138
|
-
let
|
|
139
|
-
return
|
|
167
|
+
const h = () => {
|
|
168
|
+
let n = t.peek(), l = !1;
|
|
169
|
+
return n.charCodeAt(0) < 32 && (n = " "), n === "\\" && (l = !0, t.consume(1), n = t.peek()), t.consume(1), [n, l];
|
|
140
170
|
}, i = () => {
|
|
141
|
-
let
|
|
171
|
+
let n = "";
|
|
142
172
|
for (; t.hasData; ) {
|
|
143
|
-
const [
|
|
144
|
-
if (!
|
|
145
|
-
return [
|
|
146
|
-
|
|
173
|
+
const [l, o] = h();
|
|
174
|
+
if (!o && (l === "/" || l === "#" || l === "^"))
|
|
175
|
+
return [n, l];
|
|
176
|
+
n += l;
|
|
147
177
|
}
|
|
148
|
-
return [
|
|
149
|
-
}, u = (
|
|
150
|
-
let
|
|
178
|
+
return [n, ""];
|
|
179
|
+
}, u = (n) => {
|
|
180
|
+
let l = "", o = n;
|
|
151
181
|
for (; t.hasData; ) {
|
|
152
|
-
const [
|
|
153
|
-
if (!(
|
|
154
|
-
if (
|
|
182
|
+
const [c, p] = h();
|
|
183
|
+
if (!(o && c === " ")) {
|
|
184
|
+
if (o = !1, !p && c === ";")
|
|
155
185
|
break;
|
|
156
|
-
|
|
186
|
+
l += c;
|
|
157
187
|
}
|
|
158
188
|
}
|
|
159
|
-
return
|
|
189
|
+
return l;
|
|
160
190
|
};
|
|
161
191
|
return [e, a] = i(), a && (r = u(a === "^")), e === "" && r.includes("I/") ? [2, [" ", " ", "/"]] : a === "^" ? [2, [e, r, "^"]] : [2, [e, r, a]];
|
|
162
192
|
}
|
|
@@ -395,8 +425,8 @@ class D {
|
|
|
395
425
|
const i = this.scanner.tail;
|
|
396
426
|
return this.scanner.consume(i.length), i;
|
|
397
427
|
}
|
|
398
|
-
const a = this.scanner.peek(e - this.scanner.currentIndex - 1) === "\\",
|
|
399
|
-
return this.scanner.consume(
|
|
428
|
+
const a = this.scanner.peek(e - this.scanner.currentIndex - 1) === "\\", h = this.scanner.tail.slice(0, e - this.scanner.currentIndex + (a ? 1 : 0));
|
|
429
|
+
return this.scanner.consume(h.length + 1), h;
|
|
400
430
|
}
|
|
401
431
|
/**
|
|
402
432
|
* Parse font properties
|
|
@@ -406,13 +436,13 @@ class D {
|
|
|
406
436
|
const e = this.extractExpression().split("|");
|
|
407
437
|
if (e.length > 0 && e[0]) {
|
|
408
438
|
const r = e[0];
|
|
409
|
-
let a = "Regular",
|
|
439
|
+
let a = "Regular", h = 400;
|
|
410
440
|
for (const i of e.slice(1))
|
|
411
|
-
i.startsWith("b1") ?
|
|
441
|
+
i.startsWith("b1") ? h = 700 : i === "i" || i.startsWith("i1") ? a = "Italic" : (i === "i0" || i.startsWith("i0")) && (a = "Regular");
|
|
412
442
|
t.fontFace = {
|
|
413
443
|
family: r,
|
|
414
444
|
style: a,
|
|
415
|
-
weight:
|
|
445
|
+
weight: h
|
|
416
446
|
};
|
|
417
447
|
}
|
|
418
448
|
}
|
|
@@ -423,46 +453,46 @@ class D {
|
|
|
423
453
|
*/
|
|
424
454
|
parseParagraphProperties(t) {
|
|
425
455
|
const e = new d(this.extractExpression());
|
|
426
|
-
let r = t.paragraph.indent, a = t.paragraph.left,
|
|
427
|
-
const
|
|
428
|
-
const
|
|
429
|
-
if (
|
|
430
|
-
const
|
|
431
|
-
for (e.consume(
|
|
456
|
+
let r = t.paragraph.indent, a = t.paragraph.left, h = t.paragraph.right, i = t.paragraph.align, u = [];
|
|
457
|
+
const n = () => {
|
|
458
|
+
const l = e.tail.match(/^[+-]?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?/);
|
|
459
|
+
if (l) {
|
|
460
|
+
const o = parseFloat(l[0]);
|
|
461
|
+
for (e.consume(l[0].length); e.peek() === ","; )
|
|
432
462
|
e.consume(1);
|
|
433
|
-
return
|
|
463
|
+
return o;
|
|
434
464
|
}
|
|
435
465
|
return 0;
|
|
436
466
|
};
|
|
437
467
|
for (; e.hasData; )
|
|
438
468
|
switch (e.get()) {
|
|
439
469
|
case "i":
|
|
440
|
-
r =
|
|
470
|
+
r = n();
|
|
441
471
|
break;
|
|
442
472
|
case "l":
|
|
443
|
-
a =
|
|
473
|
+
a = n();
|
|
444
474
|
break;
|
|
445
475
|
case "r":
|
|
446
|
-
|
|
476
|
+
h = n();
|
|
447
477
|
break;
|
|
448
478
|
case "x":
|
|
449
479
|
break;
|
|
450
480
|
case "q": {
|
|
451
|
-
const
|
|
452
|
-
for (i =
|
|
481
|
+
const o = e.get();
|
|
482
|
+
for (i = v[o] || 0; e.peek() === ","; )
|
|
453
483
|
e.consume(1);
|
|
454
484
|
break;
|
|
455
485
|
}
|
|
456
486
|
case "t":
|
|
457
487
|
for (u = []; e.hasData; ) {
|
|
458
|
-
const
|
|
459
|
-
if (
|
|
488
|
+
const o = e.peek();
|
|
489
|
+
if (o === "r" || o === "c") {
|
|
460
490
|
e.consume(1);
|
|
461
|
-
const
|
|
462
|
-
u.push(
|
|
491
|
+
const c = n();
|
|
492
|
+
u.push(o + c.toString());
|
|
463
493
|
} else {
|
|
464
|
-
const
|
|
465
|
-
isNaN(
|
|
494
|
+
const c = n();
|
|
495
|
+
isNaN(c) ? e.consume(1) : u.push(c);
|
|
466
496
|
}
|
|
467
497
|
}
|
|
468
498
|
break;
|
|
@@ -470,7 +500,7 @@ class D {
|
|
|
470
500
|
t.paragraph = {
|
|
471
501
|
indent: r,
|
|
472
502
|
left: a,
|
|
473
|
-
right:
|
|
503
|
+
right: h,
|
|
474
504
|
align: i,
|
|
475
505
|
tabs: u
|
|
476
506
|
};
|
|
@@ -496,15 +526,14 @@ class D {
|
|
|
496
526
|
align: 0,
|
|
497
527
|
tabs: []
|
|
498
528
|
};
|
|
499
|
-
const
|
|
500
|
-
return u.indent !== 0 && (
|
|
529
|
+
const n = {};
|
|
530
|
+
return u.indent !== 0 && (n.indent = 0), u.left !== 0 && (n.left = 0), u.right !== 0 && (n.right = 0), u.align !== 0 && (n.align = 0), JSON.stringify(u.tabs) !== JSON.stringify([]) && (n.tabs = []), n;
|
|
501
531
|
}
|
|
502
|
-
const
|
|
503
|
-
var u;
|
|
532
|
+
const h = () => {
|
|
504
533
|
let i = "";
|
|
505
534
|
for (; this.scanner.hasData; ) {
|
|
506
|
-
let
|
|
507
|
-
const
|
|
535
|
+
let u = !1, n = this.scanner.peek();
|
|
536
|
+
const l = this.scanner.currentIndex;
|
|
508
537
|
if (n.charCodeAt(0) < 32) {
|
|
509
538
|
if (this.scanner.consume(1), n === " ")
|
|
510
539
|
return [5, null];
|
|
@@ -515,13 +544,13 @@ class D {
|
|
|
515
544
|
}
|
|
516
545
|
if (n === "\\")
|
|
517
546
|
if ("\\{}".includes(this.scanner.peek(1)))
|
|
518
|
-
|
|
547
|
+
u = !0, this.scanner.consume(1), n = this.scanner.peek();
|
|
519
548
|
else {
|
|
520
549
|
if (i)
|
|
521
550
|
return [1, i];
|
|
522
551
|
this.scanner.consume(1);
|
|
523
|
-
const
|
|
524
|
-
switch (
|
|
552
|
+
const o = this.scanner.get();
|
|
553
|
+
switch (o) {
|
|
525
554
|
case "~":
|
|
526
555
|
return [4, null];
|
|
527
556
|
case "P":
|
|
@@ -532,18 +561,18 @@ class D {
|
|
|
532
561
|
return [8, null];
|
|
533
562
|
case "S": {
|
|
534
563
|
this.inStackContext = !0;
|
|
535
|
-
const
|
|
536
|
-
return this.inStackContext = !1,
|
|
564
|
+
const c = this.parseStacking();
|
|
565
|
+
return this.inStackContext = !1, c;
|
|
537
566
|
}
|
|
538
567
|
case "m":
|
|
539
568
|
case "M":
|
|
540
569
|
if (this.scanner.peek() === "+") {
|
|
541
570
|
this.scanner.consume(1);
|
|
542
|
-
const
|
|
543
|
-
if (
|
|
544
|
-
this.scanner.consume(
|
|
545
|
-
const
|
|
546
|
-
return i ? [1, i] : [1,
|
|
571
|
+
const c = this.extractMifCode(this.mifCodeLength);
|
|
572
|
+
if (c) {
|
|
573
|
+
this.scanner.consume(c.length);
|
|
574
|
+
const p = this.mifDecoder(c);
|
|
575
|
+
return i ? [1, i] : [1, p];
|
|
547
576
|
}
|
|
548
577
|
this.scanner.consume(-1);
|
|
549
578
|
}
|
|
@@ -552,14 +581,14 @@ class D {
|
|
|
552
581
|
case "U":
|
|
553
582
|
if (this.scanner.peek() === "+") {
|
|
554
583
|
this.scanner.consume(1);
|
|
555
|
-
const
|
|
556
|
-
if (
|
|
557
|
-
const
|
|
558
|
-
this.scanner.consume(
|
|
559
|
-
const
|
|
584
|
+
const c = this.scanner.tail.match(/^[0-9A-Fa-f]{4,8}/);
|
|
585
|
+
if (c) {
|
|
586
|
+
const p = c[0];
|
|
587
|
+
this.scanner.consume(p.length);
|
|
588
|
+
const g = parseInt(p, 16);
|
|
560
589
|
let f = "";
|
|
561
590
|
try {
|
|
562
|
-
f = String.fromCodePoint(
|
|
591
|
+
f = String.fromCodePoint(g);
|
|
563
592
|
} catch {
|
|
564
593
|
f = "▯";
|
|
565
594
|
}
|
|
@@ -570,35 +599,40 @@ class D {
|
|
|
570
599
|
i += "\\U";
|
|
571
600
|
continue;
|
|
572
601
|
default:
|
|
573
|
-
if (
|
|
602
|
+
if (o)
|
|
574
603
|
try {
|
|
575
|
-
const
|
|
576
|
-
if (this.yieldPropertyCommands &&
|
|
577
|
-
return [9,
|
|
604
|
+
const c = this.parseProperties(o);
|
|
605
|
+
if (this.yieldPropertyCommands && c)
|
|
606
|
+
return [9, c];
|
|
578
607
|
continue;
|
|
579
608
|
} catch {
|
|
580
|
-
const
|
|
581
|
-
|
|
609
|
+
const c = this.scanner.tail.slice(
|
|
610
|
+
l,
|
|
582
611
|
this.scanner.currentIndex
|
|
583
612
|
);
|
|
584
|
-
i +=
|
|
613
|
+
i += c;
|
|
585
614
|
}
|
|
586
615
|
}
|
|
587
616
|
continue;
|
|
588
617
|
}
|
|
589
618
|
if (n === "%" && this.scanner.peek(1) === "%") {
|
|
590
|
-
const
|
|
591
|
-
if (
|
|
592
|
-
this.scanner.consume(3), i +=
|
|
619
|
+
const o = this.scanner.peek(2).toLowerCase(), c = R[o];
|
|
620
|
+
if (c) {
|
|
621
|
+
this.scanner.consume(3), i += c;
|
|
593
622
|
continue;
|
|
594
623
|
} else {
|
|
595
|
-
this.scanner.
|
|
624
|
+
const p = [o, this.scanner.peek(3), this.scanner.peek(4)];
|
|
625
|
+
if (p.every((g) => g >= "0" && g <= "9")) {
|
|
626
|
+
const g = Number.parseInt(p.join(""), 10);
|
|
627
|
+
this.scanner.consume(5), i += String.fromCharCode(g);
|
|
628
|
+
} else
|
|
629
|
+
this.scanner.consume(3);
|
|
596
630
|
continue;
|
|
597
631
|
}
|
|
598
632
|
}
|
|
599
633
|
if (n === " ")
|
|
600
634
|
return i ? (this.scanner.consume(1), r = 3, [1, i]) : (this.scanner.consume(1), [3, null]);
|
|
601
|
-
if (!
|
|
635
|
+
if (!u) {
|
|
602
636
|
if (n === "{") {
|
|
603
637
|
if (i)
|
|
604
638
|
return [1, i];
|
|
@@ -608,13 +642,13 @@ class D {
|
|
|
608
642
|
if (i)
|
|
609
643
|
return [1, i];
|
|
610
644
|
if (this.scanner.consume(1), this.yieldPropertyCommands) {
|
|
611
|
-
const
|
|
645
|
+
const o = this.ctxStack.current;
|
|
612
646
|
this.popCtx();
|
|
613
|
-
const
|
|
614
|
-
if (Object.keys(
|
|
647
|
+
const c = this.getPropertyChanges(o, this.ctxStack.current);
|
|
648
|
+
if (Object.keys(c).length > 0)
|
|
615
649
|
return [
|
|
616
650
|
9,
|
|
617
|
-
{ command: void 0, changes:
|
|
651
|
+
{ command: void 0, changes: c, depth: this.ctxStack.depth }
|
|
618
652
|
];
|
|
619
653
|
} else
|
|
620
654
|
this.popCtx();
|
|
@@ -622,17 +656,17 @@ class D {
|
|
|
622
656
|
}
|
|
623
657
|
}
|
|
624
658
|
if (!this.inStackContext && n === "^") {
|
|
625
|
-
const
|
|
626
|
-
if (
|
|
627
|
-
const
|
|
628
|
-
if (this.scanner.consume(2),
|
|
659
|
+
const o = this.scanner.peek(1);
|
|
660
|
+
if (o) {
|
|
661
|
+
const c = o.charCodeAt(0);
|
|
662
|
+
if (this.scanner.consume(2), c === 32)
|
|
629
663
|
i += "^";
|
|
630
664
|
else {
|
|
631
|
-
if (
|
|
665
|
+
if (c === 73)
|
|
632
666
|
return i ? [1, i] : [5, null];
|
|
633
|
-
if (
|
|
667
|
+
if (c === 74)
|
|
634
668
|
return i ? [1, i] : [6, null];
|
|
635
|
-
if (
|
|
669
|
+
if (c === 77)
|
|
636
670
|
continue;
|
|
637
671
|
i += "▯";
|
|
638
672
|
}
|
|
@@ -644,13 +678,13 @@ class D {
|
|
|
644
678
|
return i ? [1, i] : [0, null];
|
|
645
679
|
};
|
|
646
680
|
for (; ; ) {
|
|
647
|
-
const [i, u] =
|
|
681
|
+
const [i, u] = h.call(this);
|
|
648
682
|
if (i) {
|
|
649
683
|
if (yield new k(i, this.ctxStack.current.copy(), u), i === 6 && this.resetParagraphParameters) {
|
|
650
|
-
const
|
|
651
|
-
this.yieldPropertyCommands && Object.keys(
|
|
684
|
+
const n = this.ctxStack.current, l = a(n);
|
|
685
|
+
this.yieldPropertyCommands && Object.keys(l).length > 0 && (yield new k(9, n.copy(), {
|
|
652
686
|
command: void 0,
|
|
653
|
-
changes: { paragraph:
|
|
687
|
+
changes: { paragraph: l },
|
|
654
688
|
depth: this.ctxStack.depth
|
|
655
689
|
}));
|
|
656
690
|
}
|
|
@@ -1046,16 +1080,16 @@ export {
|
|
|
1046
1080
|
b as MTextColor,
|
|
1047
1081
|
m as MTextContext,
|
|
1048
1082
|
F as MTextLineAlignment,
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1083
|
+
S as MTextParagraphAlignment,
|
|
1084
|
+
x as MTextParser,
|
|
1085
|
+
E as MTextStroke,
|
|
1052
1086
|
k as MTextToken,
|
|
1053
1087
|
d as TextScanner,
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1088
|
+
_ as TokenType,
|
|
1089
|
+
N as escapeDxfLineEndings,
|
|
1090
|
+
D as getFonts,
|
|
1091
|
+
w as hasInlineFormattingCodes,
|
|
1092
|
+
O as int2rgb,
|
|
1093
|
+
I as rgb2int
|
|
1060
1094
|
};
|
|
1061
1095
|
//# sourceMappingURL=parser.es.js.map
|