@appsurify-testmap/rrdom 2.1.1-alpha.6 → 2.1.2-alpha.1
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/rrdom.umd.cjs +354 -177
- package/dist/rrdom.umd.cjs.map +1 -1
- package/dist/rrdom.umd.min.cjs +2 -1
- package/dist/rrdom.umd.min.cjs.map +1 -1
- package/package.json +3 -3
package/dist/rrdom.umd.cjs
CHANGED
|
@@ -57,7 +57,8 @@ let Mirror$1 = class Mirror {
|
|
|
57
57
|
}
|
|
58
58
|
getId(n) {
|
|
59
59
|
var _a;
|
|
60
|
-
if (!n)
|
|
60
|
+
if (!n)
|
|
61
|
+
return -1;
|
|
61
62
|
const id = (_a = this.getMeta(n)) == null ? void 0 : _a.id;
|
|
62
63
|
return id != null ? id : -1;
|
|
63
64
|
}
|
|
@@ -96,7 +97,8 @@ let Mirror$1 = class Mirror {
|
|
|
96
97
|
const oldNode = this.getNode(id);
|
|
97
98
|
if (oldNode) {
|
|
98
99
|
const meta = this.nodeMetaMap.get(oldNode);
|
|
99
|
-
if (meta)
|
|
100
|
+
if (meta)
|
|
101
|
+
this.nodeMetaMap.set(n, meta);
|
|
100
102
|
}
|
|
101
103
|
this.idNodeMap.set(id, n);
|
|
102
104
|
}
|
|
@@ -191,7 +193,8 @@ function getDefaultExportFromCjs(x2) {
|
|
|
191
193
|
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
192
194
|
}
|
|
193
195
|
function getAugmentedNamespace(n) {
|
|
194
|
-
if (n.__esModule)
|
|
196
|
+
if (n.__esModule)
|
|
197
|
+
return n;
|
|
195
198
|
var f = n.default;
|
|
196
199
|
if (typeof f == "function") {
|
|
197
200
|
var a = function a2() {
|
|
@@ -201,7 +204,8 @@ function getAugmentedNamespace(n) {
|
|
|
201
204
|
return f.apply(this, arguments);
|
|
202
205
|
};
|
|
203
206
|
a.prototype = f.prototype;
|
|
204
|
-
} else
|
|
207
|
+
} else
|
|
208
|
+
a = {};
|
|
205
209
|
Object.defineProperty(a, "__esModule", { value: true });
|
|
206
210
|
Object.keys(n).forEach(function(k) {
|
|
207
211
|
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
@@ -269,11 +273,14 @@ let CssSyntaxError$3 = class CssSyntaxError extends Error {
|
|
|
269
273
|
this.message += ": " + this.reason;
|
|
270
274
|
}
|
|
271
275
|
showSourceCode(color) {
|
|
272
|
-
if (!this.source)
|
|
276
|
+
if (!this.source)
|
|
277
|
+
return "";
|
|
273
278
|
let css = this.source;
|
|
274
|
-
if (color == null)
|
|
279
|
+
if (color == null)
|
|
280
|
+
color = pico.isColorSupported;
|
|
275
281
|
if (terminalHighlight$1) {
|
|
276
|
-
if (color)
|
|
282
|
+
if (color)
|
|
283
|
+
css = terminalHighlight$1(css);
|
|
277
284
|
}
|
|
278
285
|
let lines = css.split(/\r?\n/);
|
|
279
286
|
let start = Math.max(this.line - 3, 0);
|
|
@@ -366,7 +373,8 @@ let Stringifier$2 = class Stringifier {
|
|
|
366
373
|
if (value.includes("\n")) {
|
|
367
374
|
let indent = this.raw(node2, null, "indent");
|
|
368
375
|
if (indent.length) {
|
|
369
|
-
for (let step = 0; step < depth; step++)
|
|
376
|
+
for (let step = 0; step < depth; step++)
|
|
377
|
+
value += indent;
|
|
370
378
|
}
|
|
371
379
|
}
|
|
372
380
|
return value;
|
|
@@ -381,20 +389,23 @@ let Stringifier$2 = class Stringifier {
|
|
|
381
389
|
} else {
|
|
382
390
|
after = this.raw(node2, "after", "emptyBody");
|
|
383
391
|
}
|
|
384
|
-
if (after)
|
|
392
|
+
if (after)
|
|
393
|
+
this.builder(after);
|
|
385
394
|
this.builder("}", node2, "end");
|
|
386
395
|
}
|
|
387
396
|
body(node2) {
|
|
388
397
|
let last = node2.nodes.length - 1;
|
|
389
398
|
while (last > 0) {
|
|
390
|
-
if (node2.nodes[last].type !== "comment")
|
|
399
|
+
if (node2.nodes[last].type !== "comment")
|
|
400
|
+
break;
|
|
391
401
|
last -= 1;
|
|
392
402
|
}
|
|
393
403
|
let semicolon = this.raw(node2, "semicolon");
|
|
394
404
|
for (let i = 0; i < node2.nodes.length; i++) {
|
|
395
405
|
let child = node2.nodes[i];
|
|
396
406
|
let before = this.raw(child, "before");
|
|
397
|
-
if (before)
|
|
407
|
+
if (before)
|
|
408
|
+
this.builder(before);
|
|
398
409
|
this.stringify(child, last !== i || semicolon);
|
|
399
410
|
}
|
|
400
411
|
}
|
|
@@ -409,7 +420,8 @@ let Stringifier$2 = class Stringifier {
|
|
|
409
420
|
if (node2.important) {
|
|
410
421
|
string += node2.raws.important || " !important";
|
|
411
422
|
}
|
|
412
|
-
if (semicolon)
|
|
423
|
+
if (semicolon)
|
|
424
|
+
string += ";";
|
|
413
425
|
this.builder(string, node2);
|
|
414
426
|
}
|
|
415
427
|
document(node2) {
|
|
@@ -417,10 +429,12 @@ let Stringifier$2 = class Stringifier {
|
|
|
417
429
|
}
|
|
418
430
|
raw(node2, own, detect) {
|
|
419
431
|
let value;
|
|
420
|
-
if (!detect)
|
|
432
|
+
if (!detect)
|
|
433
|
+
detect = own;
|
|
421
434
|
if (own) {
|
|
422
435
|
value = node2.raws[own];
|
|
423
|
-
if (typeof value !== "undefined")
|
|
436
|
+
if (typeof value !== "undefined")
|
|
437
|
+
return value;
|
|
424
438
|
}
|
|
425
439
|
let parent = node2.parent;
|
|
426
440
|
if (detect === "before") {
|
|
@@ -431,9 +445,11 @@ let Stringifier$2 = class Stringifier {
|
|
|
431
445
|
return "";
|
|
432
446
|
}
|
|
433
447
|
}
|
|
434
|
-
if (!parent)
|
|
448
|
+
if (!parent)
|
|
449
|
+
return DEFAULT_RAW[detect];
|
|
435
450
|
let root2 = node2.root();
|
|
436
|
-
if (!root2.rawCache)
|
|
451
|
+
if (!root2.rawCache)
|
|
452
|
+
root2.rawCache = {};
|
|
437
453
|
if (typeof root2.rawCache[detect] !== "undefined") {
|
|
438
454
|
return root2.rawCache[detect];
|
|
439
455
|
}
|
|
@@ -446,11 +462,13 @@ let Stringifier$2 = class Stringifier {
|
|
|
446
462
|
} else {
|
|
447
463
|
root2.walk((i) => {
|
|
448
464
|
value = i.raws[own];
|
|
449
|
-
if (typeof value !== "undefined")
|
|
465
|
+
if (typeof value !== "undefined")
|
|
466
|
+
return false;
|
|
450
467
|
});
|
|
451
468
|
}
|
|
452
469
|
}
|
|
453
|
-
if (typeof value === "undefined")
|
|
470
|
+
if (typeof value === "undefined")
|
|
471
|
+
value = DEFAULT_RAW[detect];
|
|
454
472
|
root2.rawCache[detect] = value;
|
|
455
473
|
return value;
|
|
456
474
|
}
|
|
@@ -467,7 +485,8 @@ let Stringifier$2 = class Stringifier {
|
|
|
467
485
|
}
|
|
468
486
|
}
|
|
469
487
|
});
|
|
470
|
-
if (value)
|
|
488
|
+
if (value)
|
|
489
|
+
value = value.replace(/\S/g, "");
|
|
471
490
|
return value;
|
|
472
491
|
}
|
|
473
492
|
rawBeforeComment(root2, node2) {
|
|
@@ -511,7 +530,8 @@ let Stringifier$2 = class Stringifier {
|
|
|
511
530
|
root2.walk((i) => {
|
|
512
531
|
if (i.type !== "decl") {
|
|
513
532
|
value = i.raws.between;
|
|
514
|
-
if (typeof value !== "undefined")
|
|
533
|
+
if (typeof value !== "undefined")
|
|
534
|
+
return false;
|
|
515
535
|
}
|
|
516
536
|
});
|
|
517
537
|
return value;
|
|
@@ -529,7 +549,8 @@ let Stringifier$2 = class Stringifier {
|
|
|
529
549
|
}
|
|
530
550
|
}
|
|
531
551
|
});
|
|
532
|
-
if (value)
|
|
552
|
+
if (value)
|
|
553
|
+
value = value.replace(/\S/g, "");
|
|
533
554
|
return value;
|
|
534
555
|
}
|
|
535
556
|
rawColon(root2) {
|
|
@@ -547,13 +568,15 @@ let Stringifier$2 = class Stringifier {
|
|
|
547
568
|
root2.walk((i) => {
|
|
548
569
|
if (i.nodes && i.nodes.length === 0) {
|
|
549
570
|
value = i.raws.after;
|
|
550
|
-
if (typeof value !== "undefined")
|
|
571
|
+
if (typeof value !== "undefined")
|
|
572
|
+
return false;
|
|
551
573
|
}
|
|
552
574
|
});
|
|
553
575
|
return value;
|
|
554
576
|
}
|
|
555
577
|
rawIndent(root2) {
|
|
556
|
-
if (root2.raws.indent)
|
|
578
|
+
if (root2.raws.indent)
|
|
579
|
+
return root2.raws.indent;
|
|
557
580
|
let value;
|
|
558
581
|
root2.walk((i) => {
|
|
559
582
|
let p = i.parent;
|
|
@@ -573,7 +596,8 @@ let Stringifier$2 = class Stringifier {
|
|
|
573
596
|
root2.walk((i) => {
|
|
574
597
|
if (i.nodes && i.nodes.length && i.last.type === "decl") {
|
|
575
598
|
value = i.raws.semicolon;
|
|
576
|
-
if (typeof value !== "undefined")
|
|
599
|
+
if (typeof value !== "undefined")
|
|
600
|
+
return false;
|
|
577
601
|
}
|
|
578
602
|
});
|
|
579
603
|
return value;
|
|
@@ -588,7 +612,8 @@ let Stringifier$2 = class Stringifier {
|
|
|
588
612
|
}
|
|
589
613
|
root(node2) {
|
|
590
614
|
this.body(node2);
|
|
591
|
-
if (node2.raws.after)
|
|
615
|
+
if (node2.raws.after)
|
|
616
|
+
this.builder(node2.raws.after);
|
|
592
617
|
}
|
|
593
618
|
rule(node2) {
|
|
594
619
|
this.block(node2, this.rawValue(node2, "selector"));
|
|
@@ -624,17 +649,20 @@ function cloneNode(obj, parent) {
|
|
|
624
649
|
if (!Object.prototype.hasOwnProperty.call(obj, i)) {
|
|
625
650
|
continue;
|
|
626
651
|
}
|
|
627
|
-
if (i === "proxyCache")
|
|
652
|
+
if (i === "proxyCache")
|
|
653
|
+
continue;
|
|
628
654
|
let value = obj[i];
|
|
629
655
|
let type = typeof value;
|
|
630
656
|
if (i === "parent" && type === "object") {
|
|
631
|
-
if (parent)
|
|
657
|
+
if (parent)
|
|
658
|
+
cloned[i] = parent;
|
|
632
659
|
} else if (i === "source") {
|
|
633
660
|
cloned[i] = value;
|
|
634
661
|
} else if (Array.isArray(value)) {
|
|
635
662
|
cloned[i] = value.map((j) => cloneNode(j, cloned));
|
|
636
663
|
} else {
|
|
637
|
-
if (type === "object" && value !== null)
|
|
664
|
+
if (type === "object" && value !== null)
|
|
665
|
+
value = cloneNode(value);
|
|
638
666
|
cloned[i] = value;
|
|
639
667
|
}
|
|
640
668
|
}
|
|
@@ -688,7 +716,8 @@ let Node$5 = class Node2 {
|
|
|
688
716
|
cleanRaws(keepBetween) {
|
|
689
717
|
delete this.raws.before;
|
|
690
718
|
delete this.raws.after;
|
|
691
|
-
if (!keepBetween)
|
|
719
|
+
if (!keepBetween)
|
|
720
|
+
delete this.raws.between;
|
|
692
721
|
}
|
|
693
722
|
clone(overrides = {}) {
|
|
694
723
|
let cloned = cloneNode(this);
|
|
@@ -731,7 +760,8 @@ let Node$5 = class Node2 {
|
|
|
731
760
|
}
|
|
732
761
|
},
|
|
733
762
|
set(node2, prop, value) {
|
|
734
|
-
if (node2[prop] === value)
|
|
763
|
+
if (node2[prop] === value)
|
|
764
|
+
return true;
|
|
735
765
|
node2[prop] = value;
|
|
736
766
|
if (prop === "prop" || prop === "value" || prop === "name" || prop === "params" || prop === "important" || /* c8 ignore next */
|
|
737
767
|
prop === "text") {
|
|
@@ -751,7 +781,8 @@ let Node$5 = class Node2 {
|
|
|
751
781
|
}
|
|
752
782
|
}
|
|
753
783
|
next() {
|
|
754
|
-
if (!this.parent)
|
|
784
|
+
if (!this.parent)
|
|
785
|
+
return void 0;
|
|
755
786
|
let index2 = this.parent.index(this);
|
|
756
787
|
return this.parent.nodes[index2 + 1];
|
|
757
788
|
}
|
|
@@ -762,7 +793,8 @@ let Node$5 = class Node2 {
|
|
|
762
793
|
} else if (opts.word) {
|
|
763
794
|
stringRepresentation = this.toString();
|
|
764
795
|
let index2 = stringRepresentation.indexOf(opts.word);
|
|
765
|
-
if (index2 !== -1)
|
|
796
|
+
if (index2 !== -1)
|
|
797
|
+
pos = this.positionInside(index2, stringRepresentation);
|
|
766
798
|
}
|
|
767
799
|
return pos;
|
|
768
800
|
}
|
|
@@ -781,7 +813,8 @@ let Node$5 = class Node2 {
|
|
|
781
813
|
return { column, line };
|
|
782
814
|
}
|
|
783
815
|
prev() {
|
|
784
|
-
if (!this.parent)
|
|
816
|
+
if (!this.parent)
|
|
817
|
+
return void 0;
|
|
785
818
|
let index2 = this.parent.index(this);
|
|
786
819
|
return this.parent.nodes[index2 - 1];
|
|
787
820
|
}
|
|
@@ -876,7 +909,8 @@ let Node$5 = class Node2 {
|
|
|
876
909
|
if (!Object.prototype.hasOwnProperty.call(this, name)) {
|
|
877
910
|
continue;
|
|
878
911
|
}
|
|
879
|
-
if (name === "parent" || name === "proxyCache")
|
|
912
|
+
if (name === "parent" || name === "proxyCache")
|
|
913
|
+
continue;
|
|
880
914
|
let value = this[name];
|
|
881
915
|
if (Array.isArray(value)) {
|
|
882
916
|
fixed[name] = value.map((i) => {
|
|
@@ -916,7 +950,8 @@ let Node$5 = class Node2 {
|
|
|
916
950
|
return this.proxyCache;
|
|
917
951
|
}
|
|
918
952
|
toString(stringifier2 = stringify$3) {
|
|
919
|
-
if (stringifier2.stringify)
|
|
953
|
+
if (stringifier2.stringify)
|
|
954
|
+
stringifier2 = stringifier2.stringify;
|
|
920
955
|
let result2 = "";
|
|
921
956
|
stringifier2(this, (i) => {
|
|
922
957
|
result2 += i;
|
|
@@ -925,7 +960,8 @@ let Node$5 = class Node2 {
|
|
|
925
960
|
}
|
|
926
961
|
warn(result2, text, opts) {
|
|
927
962
|
let data = { node: this };
|
|
928
|
-
for (let i in opts)
|
|
963
|
+
for (let i in opts)
|
|
964
|
+
data[i] = opts[i];
|
|
929
965
|
return result2.warn(text, data);
|
|
930
966
|
}
|
|
931
967
|
get proxyOf() {
|
|
@@ -981,7 +1017,8 @@ function fromBase64(str) {
|
|
|
981
1017
|
}
|
|
982
1018
|
let PreviousMap$2 = class PreviousMap {
|
|
983
1019
|
constructor(css, opts) {
|
|
984
|
-
if (opts.map === false)
|
|
1020
|
+
if (opts.map === false)
|
|
1021
|
+
return;
|
|
985
1022
|
this.loadAnnotation(css);
|
|
986
1023
|
this.inline = this.startWith(this.annotation, "data:");
|
|
987
1024
|
let prev = opts.map ? opts.map.prev : void 0;
|
|
@@ -989,8 +1026,10 @@ let PreviousMap$2 = class PreviousMap {
|
|
|
989
1026
|
if (!this.mapFile && opts.from) {
|
|
990
1027
|
this.mapFile = opts.from;
|
|
991
1028
|
}
|
|
992
|
-
if (this.mapFile)
|
|
993
|
-
|
|
1029
|
+
if (this.mapFile)
|
|
1030
|
+
this.root = dirname$1(this.mapFile);
|
|
1031
|
+
if (text)
|
|
1032
|
+
this.text = text;
|
|
994
1033
|
}
|
|
995
1034
|
consumer() {
|
|
996
1035
|
if (!this.consumerCache) {
|
|
@@ -1016,12 +1055,14 @@ let PreviousMap$2 = class PreviousMap {
|
|
|
1016
1055
|
return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, "").trim();
|
|
1017
1056
|
}
|
|
1018
1057
|
isMap(map) {
|
|
1019
|
-
if (typeof map !== "object")
|
|
1058
|
+
if (typeof map !== "object")
|
|
1059
|
+
return false;
|
|
1020
1060
|
return typeof map.mappings === "string" || typeof map._mappings === "string" || Array.isArray(map.sections);
|
|
1021
1061
|
}
|
|
1022
1062
|
loadAnnotation(css) {
|
|
1023
1063
|
let comments = css.match(/\/\*\s*# sourceMappingURL=/gm);
|
|
1024
|
-
if (!comments)
|
|
1064
|
+
if (!comments)
|
|
1065
|
+
return;
|
|
1025
1066
|
let start = css.lastIndexOf(comments.pop());
|
|
1026
1067
|
let end = css.indexOf("*/", start);
|
|
1027
1068
|
if (start > -1 && end > -1) {
|
|
@@ -1036,7 +1077,8 @@ let PreviousMap$2 = class PreviousMap {
|
|
|
1036
1077
|
}
|
|
1037
1078
|
}
|
|
1038
1079
|
loadMap(file, prev) {
|
|
1039
|
-
if (prev === false)
|
|
1080
|
+
if (prev === false)
|
|
1081
|
+
return false;
|
|
1040
1082
|
if (prev) {
|
|
1041
1083
|
if (typeof prev === "string") {
|
|
1042
1084
|
return prev;
|
|
@@ -1066,12 +1108,14 @@ let PreviousMap$2 = class PreviousMap {
|
|
|
1066
1108
|
return this.decodeInline(this.annotation);
|
|
1067
1109
|
} else if (this.annotation) {
|
|
1068
1110
|
let map = this.annotation;
|
|
1069
|
-
if (file)
|
|
1111
|
+
if (file)
|
|
1112
|
+
map = join(dirname$1(file), map);
|
|
1070
1113
|
return this.loadFile(map);
|
|
1071
1114
|
}
|
|
1072
1115
|
}
|
|
1073
1116
|
startWith(string, start) {
|
|
1074
|
-
if (!string)
|
|
1117
|
+
if (!string)
|
|
1118
|
+
return false;
|
|
1075
1119
|
return string.substr(0, start.length) === start;
|
|
1076
1120
|
}
|
|
1077
1121
|
withContent() {
|
|
@@ -1114,13 +1158,15 @@ let Input$4 = class Input {
|
|
|
1114
1158
|
if (map.text) {
|
|
1115
1159
|
this.map = map;
|
|
1116
1160
|
let file = map.consumer().file;
|
|
1117
|
-
if (!this.file && file)
|
|
1161
|
+
if (!this.file && file)
|
|
1162
|
+
this.file = this.mapResolve(file);
|
|
1118
1163
|
}
|
|
1119
1164
|
}
|
|
1120
1165
|
if (!this.file) {
|
|
1121
1166
|
this.id = "<input css " + nanoid(6) + ">";
|
|
1122
1167
|
}
|
|
1123
|
-
if (this.map)
|
|
1168
|
+
if (this.map)
|
|
1169
|
+
this.map.file = this.from;
|
|
1124
1170
|
}
|
|
1125
1171
|
error(message, line, column, opts = {}) {
|
|
1126
1172
|
let result2, endLine, endColumn;
|
|
@@ -1222,10 +1268,12 @@ let Input$4 = class Input {
|
|
|
1222
1268
|
return resolve$1(this.map.consumer().sourceRoot || this.map.root || ".", file);
|
|
1223
1269
|
}
|
|
1224
1270
|
origin(line, column, endLine, endColumn) {
|
|
1225
|
-
if (!this.map)
|
|
1271
|
+
if (!this.map)
|
|
1272
|
+
return false;
|
|
1226
1273
|
let consumer = this.map.consumer();
|
|
1227
1274
|
let from = consumer.originalPositionFor({ column, line });
|
|
1228
|
-
if (!from.source)
|
|
1275
|
+
if (!from.source)
|
|
1276
|
+
return false;
|
|
1229
1277
|
let to;
|
|
1230
1278
|
if (typeof endLine === "number") {
|
|
1231
1279
|
to = consumer.originalPositionFor({ column: endColumn, line: endLine });
|
|
@@ -1254,7 +1302,8 @@ let Input$4 = class Input {
|
|
|
1254
1302
|
}
|
|
1255
1303
|
}
|
|
1256
1304
|
let source = consumer.sourceContentFor(from.source);
|
|
1257
|
-
if (source)
|
|
1305
|
+
if (source)
|
|
1306
|
+
result2.source = source;
|
|
1258
1307
|
return result2;
|
|
1259
1308
|
}
|
|
1260
1309
|
toJSON() {
|
|
@@ -1312,7 +1361,8 @@ let MapGenerator$2 = class MapGenerator {
|
|
|
1312
1361
|
content = this.outputFile() + ".map";
|
|
1313
1362
|
}
|
|
1314
1363
|
let eol = "\n";
|
|
1315
|
-
if (this.css.includes("\r\n"))
|
|
1364
|
+
if (this.css.includes("\r\n"))
|
|
1365
|
+
eol = "\r\n";
|
|
1316
1366
|
this.css += eol + "/*# sourceMappingURL=" + content + " */";
|
|
1317
1367
|
}
|
|
1318
1368
|
applyPrevMaps() {
|
|
@@ -1332,12 +1382,14 @@ let MapGenerator$2 = class MapGenerator {
|
|
|
1332
1382
|
}
|
|
1333
1383
|
}
|
|
1334
1384
|
clearAnnotation() {
|
|
1335
|
-
if (this.mapOpts.annotation === false)
|
|
1385
|
+
if (this.mapOpts.annotation === false)
|
|
1386
|
+
return;
|
|
1336
1387
|
if (this.root) {
|
|
1337
1388
|
let node2;
|
|
1338
1389
|
for (let i = this.root.nodes.length - 1; i >= 0; i--) {
|
|
1339
1390
|
node2 = this.root.nodes[i];
|
|
1340
|
-
if (node2.type !== "comment")
|
|
1391
|
+
if (node2.type !== "comment")
|
|
1392
|
+
continue;
|
|
1341
1393
|
if (node2.text.indexOf("# sourceMappingURL=") === 0) {
|
|
1342
1394
|
this.root.removeChild(i);
|
|
1343
1395
|
}
|
|
@@ -1378,9 +1430,12 @@ let MapGenerator$2 = class MapGenerator {
|
|
|
1378
1430
|
source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>"
|
|
1379
1431
|
});
|
|
1380
1432
|
}
|
|
1381
|
-
if (this.isSourcesContent())
|
|
1382
|
-
|
|
1383
|
-
if (this.
|
|
1433
|
+
if (this.isSourcesContent())
|
|
1434
|
+
this.setSourcesContent();
|
|
1435
|
+
if (this.root && this.previous().length > 0)
|
|
1436
|
+
this.applyPrevMaps();
|
|
1437
|
+
if (this.isAnnotation())
|
|
1438
|
+
this.addAnnotation();
|
|
1384
1439
|
if (this.isInline()) {
|
|
1385
1440
|
return [this.css];
|
|
1386
1441
|
} else {
|
|
@@ -1500,11 +1555,15 @@ let MapGenerator$2 = class MapGenerator {
|
|
|
1500
1555
|
}
|
|
1501
1556
|
}
|
|
1502
1557
|
path(file) {
|
|
1503
|
-
if (this.mapOpts.absolute)
|
|
1504
|
-
|
|
1505
|
-
if (
|
|
1558
|
+
if (this.mapOpts.absolute)
|
|
1559
|
+
return file;
|
|
1560
|
+
if (file.charCodeAt(0) === 60)
|
|
1561
|
+
return file;
|
|
1562
|
+
if (/^\w+:\/\//.test(file))
|
|
1563
|
+
return file;
|
|
1506
1564
|
let cached = this.memoizedPaths.get(file);
|
|
1507
|
-
if (cached)
|
|
1565
|
+
if (cached)
|
|
1566
|
+
return cached;
|
|
1508
1567
|
let from = this.opts.to ? dirname(this.opts.to) : ".";
|
|
1509
1568
|
if (typeof this.mapOpts.annotation === "string") {
|
|
1510
1569
|
from = dirname(resolve(from, this.mapOpts.annotation));
|
|
@@ -1527,7 +1586,8 @@ let MapGenerator$2 = class MapGenerator {
|
|
|
1527
1586
|
});
|
|
1528
1587
|
} else {
|
|
1529
1588
|
let input2 = new Input$3(this.originalCSS, this.opts);
|
|
1530
|
-
if (input2.map)
|
|
1589
|
+
if (input2.map)
|
|
1590
|
+
this.previousMaps.push(input2.map);
|
|
1531
1591
|
}
|
|
1532
1592
|
}
|
|
1533
1593
|
return this.previousMaps;
|
|
@@ -1568,7 +1628,8 @@ let MapGenerator$2 = class MapGenerator {
|
|
|
1568
1628
|
}
|
|
1569
1629
|
toFileUrl(path) {
|
|
1570
1630
|
let cached = this.memoizedFileURLs.get(path);
|
|
1571
|
-
if (cached)
|
|
1631
|
+
if (cached)
|
|
1632
|
+
return cached;
|
|
1572
1633
|
if (pathToFileURL) {
|
|
1573
1634
|
let fileURL = pathToFileURL(path).toString();
|
|
1574
1635
|
this.memoizedFileURLs.set(path, fileURL);
|
|
@@ -1581,7 +1642,8 @@ let MapGenerator$2 = class MapGenerator {
|
|
|
1581
1642
|
}
|
|
1582
1643
|
toUrl(path) {
|
|
1583
1644
|
let cached = this.memoizedURLs.get(path);
|
|
1584
|
-
if (cached)
|
|
1645
|
+
if (cached)
|
|
1646
|
+
return cached;
|
|
1585
1647
|
if (sep === "\\") {
|
|
1586
1648
|
path = path.replace(/\\/g, "/");
|
|
1587
1649
|
}
|
|
@@ -1610,7 +1672,8 @@ let AtRule$4;
|
|
|
1610
1672
|
let Root$6;
|
|
1611
1673
|
function cleanSource(nodes) {
|
|
1612
1674
|
return nodes.map((i) => {
|
|
1613
|
-
if (i.nodes)
|
|
1675
|
+
if (i.nodes)
|
|
1676
|
+
i.nodes = cleanSource(i.nodes);
|
|
1614
1677
|
delete i.source;
|
|
1615
1678
|
return i;
|
|
1616
1679
|
});
|
|
@@ -1627,7 +1690,8 @@ let Container$7 = class Container extends Node$2 {
|
|
|
1627
1690
|
append(...children) {
|
|
1628
1691
|
for (let child of children) {
|
|
1629
1692
|
let nodes = this.normalize(child, this.last);
|
|
1630
|
-
for (let node2 of nodes)
|
|
1693
|
+
for (let node2 of nodes)
|
|
1694
|
+
this.proxyOf.nodes.push(node2);
|
|
1631
1695
|
}
|
|
1632
1696
|
this.markDirty();
|
|
1633
1697
|
return this;
|
|
@@ -1635,17 +1699,20 @@ let Container$7 = class Container extends Node$2 {
|
|
|
1635
1699
|
cleanRaws(keepBetween) {
|
|
1636
1700
|
super.cleanRaws(keepBetween);
|
|
1637
1701
|
if (this.nodes) {
|
|
1638
|
-
for (let node2 of this.nodes)
|
|
1702
|
+
for (let node2 of this.nodes)
|
|
1703
|
+
node2.cleanRaws(keepBetween);
|
|
1639
1704
|
}
|
|
1640
1705
|
}
|
|
1641
1706
|
each(callback) {
|
|
1642
|
-
if (!this.proxyOf.nodes)
|
|
1707
|
+
if (!this.proxyOf.nodes)
|
|
1708
|
+
return void 0;
|
|
1643
1709
|
let iterator = this.getIterator();
|
|
1644
1710
|
let index2, result2;
|
|
1645
1711
|
while (this.indexes[iterator] < this.proxyOf.nodes.length) {
|
|
1646
1712
|
index2 = this.indexes[iterator];
|
|
1647
1713
|
result2 = callback(this.proxyOf.nodes[index2], index2);
|
|
1648
|
-
if (result2 === false)
|
|
1714
|
+
if (result2 === false)
|
|
1715
|
+
break;
|
|
1649
1716
|
this.indexes[iterator] += 1;
|
|
1650
1717
|
}
|
|
1651
1718
|
delete this.indexes[iterator];
|
|
@@ -1655,8 +1722,10 @@ let Container$7 = class Container extends Node$2 {
|
|
|
1655
1722
|
return this.nodes.every(condition);
|
|
1656
1723
|
}
|
|
1657
1724
|
getIterator() {
|
|
1658
|
-
if (!this.lastEach)
|
|
1659
|
-
|
|
1725
|
+
if (!this.lastEach)
|
|
1726
|
+
this.lastEach = 0;
|
|
1727
|
+
if (!this.indexes)
|
|
1728
|
+
this.indexes = {};
|
|
1660
1729
|
this.lastEach += 1;
|
|
1661
1730
|
let iterator = this.lastEach;
|
|
1662
1731
|
this.indexes[iterator] = 0;
|
|
@@ -1698,7 +1767,8 @@ let Container$7 = class Container extends Node$2 {
|
|
|
1698
1767
|
}
|
|
1699
1768
|
},
|
|
1700
1769
|
set(node2, prop, value) {
|
|
1701
|
-
if (node2[prop] === value)
|
|
1770
|
+
if (node2[prop] === value)
|
|
1771
|
+
return true;
|
|
1702
1772
|
node2[prop] = value;
|
|
1703
1773
|
if (prop === "name" || prop === "params" || prop === "selector") {
|
|
1704
1774
|
node2.markDirty();
|
|
@@ -1708,15 +1778,18 @@ let Container$7 = class Container extends Node$2 {
|
|
|
1708
1778
|
};
|
|
1709
1779
|
}
|
|
1710
1780
|
index(child) {
|
|
1711
|
-
if (typeof child === "number")
|
|
1712
|
-
|
|
1781
|
+
if (typeof child === "number")
|
|
1782
|
+
return child;
|
|
1783
|
+
if (child.proxyOf)
|
|
1784
|
+
child = child.proxyOf;
|
|
1713
1785
|
return this.proxyOf.nodes.indexOf(child);
|
|
1714
1786
|
}
|
|
1715
1787
|
insertAfter(exist, add) {
|
|
1716
1788
|
let existIndex = this.index(exist);
|
|
1717
1789
|
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse();
|
|
1718
1790
|
existIndex = this.index(exist);
|
|
1719
|
-
for (let node2 of nodes)
|
|
1791
|
+
for (let node2 of nodes)
|
|
1792
|
+
this.proxyOf.nodes.splice(existIndex + 1, 0, node2);
|
|
1720
1793
|
let index2;
|
|
1721
1794
|
for (let id in this.indexes) {
|
|
1722
1795
|
index2 = this.indexes[id];
|
|
@@ -1732,7 +1805,8 @@ let Container$7 = class Container extends Node$2 {
|
|
|
1732
1805
|
let type = existIndex === 0 ? "prepend" : false;
|
|
1733
1806
|
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex], type).reverse();
|
|
1734
1807
|
existIndex = this.index(exist);
|
|
1735
|
-
for (let node2 of nodes)
|
|
1808
|
+
for (let node2 of nodes)
|
|
1809
|
+
this.proxyOf.nodes.splice(existIndex, 0, node2);
|
|
1736
1810
|
let index2;
|
|
1737
1811
|
for (let id in this.indexes) {
|
|
1738
1812
|
index2 = this.indexes[id];
|
|
@@ -1751,12 +1825,14 @@ let Container$7 = class Container extends Node$2 {
|
|
|
1751
1825
|
} else if (Array.isArray(nodes)) {
|
|
1752
1826
|
nodes = nodes.slice(0);
|
|
1753
1827
|
for (let i of nodes) {
|
|
1754
|
-
if (i.parent)
|
|
1828
|
+
if (i.parent)
|
|
1829
|
+
i.parent.removeChild(i, "ignore");
|
|
1755
1830
|
}
|
|
1756
1831
|
} else if (nodes.type === "root" && this.type !== "document") {
|
|
1757
1832
|
nodes = nodes.nodes.slice(0);
|
|
1758
1833
|
for (let i of nodes) {
|
|
1759
|
-
if (i.parent)
|
|
1834
|
+
if (i.parent)
|
|
1835
|
+
i.parent.removeChild(i, "ignore");
|
|
1760
1836
|
}
|
|
1761
1837
|
} else if (nodes.type) {
|
|
1762
1838
|
nodes = [nodes];
|
|
@@ -1777,10 +1853,13 @@ let Container$7 = class Container extends Node$2 {
|
|
|
1777
1853
|
throw new Error("Unknown node type in node creation");
|
|
1778
1854
|
}
|
|
1779
1855
|
let processed = nodes.map((i) => {
|
|
1780
|
-
if (!i[my$1])
|
|
1856
|
+
if (!i[my$1])
|
|
1857
|
+
Container.rebuild(i);
|
|
1781
1858
|
i = i.proxyOf;
|
|
1782
|
-
if (i.parent)
|
|
1783
|
-
|
|
1859
|
+
if (i.parent)
|
|
1860
|
+
i.parent.removeChild(i);
|
|
1861
|
+
if (i[isClean$1])
|
|
1862
|
+
markDirtyUp(i);
|
|
1784
1863
|
if (typeof i.raws.before === "undefined") {
|
|
1785
1864
|
if (sample && typeof sample.raws.before !== "undefined") {
|
|
1786
1865
|
i.raws.before = sample.raws.before.replace(/\S/g, "");
|
|
@@ -1795,7 +1874,8 @@ let Container$7 = class Container extends Node$2 {
|
|
|
1795
1874
|
children = children.reverse();
|
|
1796
1875
|
for (let child of children) {
|
|
1797
1876
|
let nodes = this.normalize(child, this.first, "prepend").reverse();
|
|
1798
|
-
for (let node2 of nodes)
|
|
1877
|
+
for (let node2 of nodes)
|
|
1878
|
+
this.proxyOf.nodes.unshift(node2);
|
|
1799
1879
|
for (let id in this.indexes) {
|
|
1800
1880
|
this.indexes[id] = this.indexes[id] + nodes.length;
|
|
1801
1881
|
}
|
|
@@ -1809,7 +1889,8 @@ let Container$7 = class Container extends Node$2 {
|
|
|
1809
1889
|
return this;
|
|
1810
1890
|
}
|
|
1811
1891
|
removeAll() {
|
|
1812
|
-
for (let node2 of this.proxyOf.nodes)
|
|
1892
|
+
for (let node2 of this.proxyOf.nodes)
|
|
1893
|
+
node2.parent = void 0;
|
|
1813
1894
|
this.proxyOf.nodes = [];
|
|
1814
1895
|
this.markDirty();
|
|
1815
1896
|
return this;
|
|
@@ -1834,8 +1915,10 @@ let Container$7 = class Container extends Node$2 {
|
|
|
1834
1915
|
opts = {};
|
|
1835
1916
|
}
|
|
1836
1917
|
this.walkDecls((decl) => {
|
|
1837
|
-
if (opts.props && !opts.props.includes(decl.prop))
|
|
1838
|
-
|
|
1918
|
+
if (opts.props && !opts.props.includes(decl.prop))
|
|
1919
|
+
return;
|
|
1920
|
+
if (opts.fast && !decl.value.includes(opts.fast))
|
|
1921
|
+
return;
|
|
1839
1922
|
decl.value = decl.value.replace(pattern, callback);
|
|
1840
1923
|
});
|
|
1841
1924
|
this.markDirty();
|
|
@@ -1932,11 +2015,13 @@ let Container$7 = class Container extends Node$2 {
|
|
|
1932
2015
|
});
|
|
1933
2016
|
}
|
|
1934
2017
|
get first() {
|
|
1935
|
-
if (!this.proxyOf.nodes)
|
|
2018
|
+
if (!this.proxyOf.nodes)
|
|
2019
|
+
return void 0;
|
|
1936
2020
|
return this.proxyOf.nodes[0];
|
|
1937
2021
|
}
|
|
1938
2022
|
get last() {
|
|
1939
|
-
if (!this.proxyOf.nodes)
|
|
2023
|
+
if (!this.proxyOf.nodes)
|
|
2024
|
+
return void 0;
|
|
1940
2025
|
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
|
|
1941
2026
|
}
|
|
1942
2027
|
};
|
|
@@ -1998,7 +2083,8 @@ var document$1 = Document$3;
|
|
|
1998
2083
|
Document$3.default = Document$3;
|
|
1999
2084
|
let printed = {};
|
|
2000
2085
|
var warnOnce$2 = function warnOnce(message) {
|
|
2001
|
-
if (printed[message])
|
|
2086
|
+
if (printed[message])
|
|
2087
|
+
return;
|
|
2002
2088
|
printed[message] = true;
|
|
2003
2089
|
if (typeof console !== "undefined" && console.warn) {
|
|
2004
2090
|
console.warn(message);
|
|
@@ -2015,7 +2101,8 @@ let Warning$2 = class Warning {
|
|
|
2015
2101
|
this.endLine = range.end.line;
|
|
2016
2102
|
this.endColumn = range.end.column;
|
|
2017
2103
|
}
|
|
2018
|
-
for (let opt in opts)
|
|
2104
|
+
for (let opt in opts)
|
|
2105
|
+
this[opt] = opts[opt];
|
|
2019
2106
|
}
|
|
2020
2107
|
toString() {
|
|
2021
2108
|
if (this.node) {
|
|
@@ -2107,8 +2194,10 @@ var tokenize = function tokenizer(input2, options = {}) {
|
|
|
2107
2194
|
return returned.length === 0 && pos >= length;
|
|
2108
2195
|
}
|
|
2109
2196
|
function nextToken(opts) {
|
|
2110
|
-
if (returned.length)
|
|
2111
|
-
|
|
2197
|
+
if (returned.length)
|
|
2198
|
+
return returned.pop();
|
|
2199
|
+
if (pos >= length)
|
|
2200
|
+
return;
|
|
2112
2201
|
let ignoreUnclosed = opts ? opts.ignoreUnclosed : false;
|
|
2113
2202
|
code = css.charCodeAt(pos);
|
|
2114
2203
|
switch (code) {
|
|
@@ -2280,11 +2369,13 @@ let AtRule$3 = class AtRule extends Container$5 {
|
|
|
2280
2369
|
this.type = "atrule";
|
|
2281
2370
|
}
|
|
2282
2371
|
append(...children) {
|
|
2283
|
-
if (!this.proxyOf.nodes)
|
|
2372
|
+
if (!this.proxyOf.nodes)
|
|
2373
|
+
this.nodes = [];
|
|
2284
2374
|
return super.append(...children);
|
|
2285
2375
|
}
|
|
2286
2376
|
prepend(...children) {
|
|
2287
|
-
if (!this.proxyOf.nodes)
|
|
2377
|
+
if (!this.proxyOf.nodes)
|
|
2378
|
+
this.nodes = [];
|
|
2288
2379
|
return super.prepend(...children);
|
|
2289
2380
|
}
|
|
2290
2381
|
};
|
|
@@ -2298,7 +2389,8 @@ let Root$5 = class Root extends Container$4 {
|
|
|
2298
2389
|
constructor(defaults) {
|
|
2299
2390
|
super(defaults);
|
|
2300
2391
|
this.type = "root";
|
|
2301
|
-
if (!this.nodes)
|
|
2392
|
+
if (!this.nodes)
|
|
2393
|
+
this.nodes = [];
|
|
2302
2394
|
}
|
|
2303
2395
|
normalize(child, sample, type) {
|
|
2304
2396
|
let nodes = super.normalize(child);
|
|
@@ -2369,19 +2461,23 @@ let list$2 = {
|
|
|
2369
2461
|
} else if (letter === "(") {
|
|
2370
2462
|
func += 1;
|
|
2371
2463
|
} else if (letter === ")") {
|
|
2372
|
-
if (func > 0)
|
|
2464
|
+
if (func > 0)
|
|
2465
|
+
func -= 1;
|
|
2373
2466
|
} else if (func === 0) {
|
|
2374
|
-
if (separators.includes(letter))
|
|
2467
|
+
if (separators.includes(letter))
|
|
2468
|
+
split = true;
|
|
2375
2469
|
}
|
|
2376
2470
|
if (split) {
|
|
2377
|
-
if (current !== "")
|
|
2471
|
+
if (current !== "")
|
|
2472
|
+
array.push(current.trim());
|
|
2378
2473
|
current = "";
|
|
2379
2474
|
split = false;
|
|
2380
2475
|
} else {
|
|
2381
2476
|
current += letter;
|
|
2382
2477
|
}
|
|
2383
2478
|
}
|
|
2384
|
-
if (last || current !== "")
|
|
2479
|
+
if (last || current !== "")
|
|
2480
|
+
array.push(current.trim());
|
|
2385
2481
|
return array;
|
|
2386
2482
|
}
|
|
2387
2483
|
};
|
|
@@ -2393,7 +2489,8 @@ let Rule$3 = class Rule extends Container$3 {
|
|
|
2393
2489
|
constructor(defaults) {
|
|
2394
2490
|
super(defaults);
|
|
2395
2491
|
this.type = "rule";
|
|
2396
|
-
if (!this.nodes)
|
|
2492
|
+
if (!this.nodes)
|
|
2493
|
+
this.nodes = [];
|
|
2397
2494
|
}
|
|
2398
2495
|
get selectors() {
|
|
2399
2496
|
return list$1.comma(this.selector);
|
|
@@ -2421,7 +2518,8 @@ function findLastWithPosition(tokens) {
|
|
|
2421
2518
|
for (let i = tokens.length - 1; i >= 0; i--) {
|
|
2422
2519
|
let token = tokens[i];
|
|
2423
2520
|
let pos = token[3] || token[2];
|
|
2424
|
-
if (pos)
|
|
2521
|
+
if (pos)
|
|
2522
|
+
return pos;
|
|
2425
2523
|
}
|
|
2426
2524
|
}
|
|
2427
2525
|
let Parser$1 = class Parser {
|
|
@@ -2514,14 +2612,16 @@ let Parser$1 = class Parser {
|
|
|
2514
2612
|
}
|
|
2515
2613
|
checkMissedSemicolon(tokens) {
|
|
2516
2614
|
let colon = this.colon(tokens);
|
|
2517
|
-
if (colon === false)
|
|
2615
|
+
if (colon === false)
|
|
2616
|
+
return;
|
|
2518
2617
|
let founded = 0;
|
|
2519
2618
|
let token;
|
|
2520
2619
|
for (let j = colon - 1; j >= 0; j--) {
|
|
2521
2620
|
token = tokens[j];
|
|
2522
2621
|
if (token[0] !== "space") {
|
|
2523
2622
|
founded += 1;
|
|
2524
|
-
if (founded === 2)
|
|
2623
|
+
if (founded === 2)
|
|
2624
|
+
break;
|
|
2525
2625
|
}
|
|
2526
2626
|
}
|
|
2527
2627
|
throw this.input.error(
|
|
@@ -2587,7 +2687,8 @@ let Parser$1 = class Parser {
|
|
|
2587
2687
|
);
|
|
2588
2688
|
node2.source.end.offset++;
|
|
2589
2689
|
while (tokens[0][0] !== "word") {
|
|
2590
|
-
if (tokens.length === 1)
|
|
2690
|
+
if (tokens.length === 1)
|
|
2691
|
+
this.unknownWord(tokens);
|
|
2591
2692
|
node2.raws.before += tokens.shift()[1];
|
|
2592
2693
|
}
|
|
2593
2694
|
node2.source.start = this.getPosition(tokens[0][2]);
|
|
@@ -2621,7 +2722,8 @@ let Parser$1 = class Parser {
|
|
|
2621
2722
|
let next;
|
|
2622
2723
|
while (tokens.length) {
|
|
2623
2724
|
next = tokens[0][0];
|
|
2624
|
-
if (next !== "space" && next !== "comment")
|
|
2725
|
+
if (next !== "space" && next !== "comment")
|
|
2726
|
+
break;
|
|
2625
2727
|
firstSpaces.push(tokens.shift());
|
|
2626
2728
|
}
|
|
2627
2729
|
this.precheckMissedSemicolon(tokens);
|
|
@@ -2631,7 +2733,8 @@ let Parser$1 = class Parser {
|
|
|
2631
2733
|
node2.important = true;
|
|
2632
2734
|
let string = this.stringFrom(tokens, i);
|
|
2633
2735
|
string = this.spacesFromEnd(tokens) + string;
|
|
2634
|
-
if (string !== " !important")
|
|
2736
|
+
if (string !== " !important")
|
|
2737
|
+
node2.raws.important = string;
|
|
2635
2738
|
break;
|
|
2636
2739
|
} else if (token[1].toLowerCase() === "important") {
|
|
2637
2740
|
let cache = tokens.slice(0);
|
|
@@ -2693,7 +2796,8 @@ let Parser$1 = class Parser {
|
|
|
2693
2796
|
}
|
|
2694
2797
|
}
|
|
2695
2798
|
endFile() {
|
|
2696
|
-
if (this.current.parent)
|
|
2799
|
+
if (this.current.parent)
|
|
2800
|
+
this.unclosedBlock();
|
|
2697
2801
|
if (this.current.nodes && this.current.nodes.length) {
|
|
2698
2802
|
this.current.raws.semicolon = this.semicolon;
|
|
2699
2803
|
}
|
|
@@ -2727,7 +2831,8 @@ let Parser$1 = class Parser {
|
|
|
2727
2831
|
};
|
|
2728
2832
|
node2.raws.before = this.spaces;
|
|
2729
2833
|
this.spaces = "";
|
|
2730
|
-
if (node2.type !== "comment")
|
|
2834
|
+
if (node2.type !== "comment")
|
|
2835
|
+
this.semicolon = false;
|
|
2731
2836
|
}
|
|
2732
2837
|
other(start) {
|
|
2733
2838
|
let end = false;
|
|
@@ -2742,10 +2847,12 @@ let Parser$1 = class Parser {
|
|
|
2742
2847
|
type = token[0];
|
|
2743
2848
|
tokens.push(token);
|
|
2744
2849
|
if (type === "(" || type === "[") {
|
|
2745
|
-
if (!bracket)
|
|
2850
|
+
if (!bracket)
|
|
2851
|
+
bracket = token;
|
|
2746
2852
|
brackets.push(type === "(" ? ")" : "]");
|
|
2747
2853
|
} else if (customProperty && colon && type === "{") {
|
|
2748
|
-
if (!bracket)
|
|
2854
|
+
if (!bracket)
|
|
2855
|
+
bracket = token;
|
|
2749
2856
|
brackets.push("}");
|
|
2750
2857
|
} else if (brackets.length === 0) {
|
|
2751
2858
|
if (type === ";") {
|
|
@@ -2767,17 +2874,21 @@ let Parser$1 = class Parser {
|
|
|
2767
2874
|
}
|
|
2768
2875
|
} else if (type === brackets[brackets.length - 1]) {
|
|
2769
2876
|
brackets.pop();
|
|
2770
|
-
if (brackets.length === 0)
|
|
2877
|
+
if (brackets.length === 0)
|
|
2878
|
+
bracket = null;
|
|
2771
2879
|
}
|
|
2772
2880
|
token = this.tokenizer.nextToken();
|
|
2773
2881
|
}
|
|
2774
|
-
if (this.tokenizer.endOfFile())
|
|
2775
|
-
|
|
2882
|
+
if (this.tokenizer.endOfFile())
|
|
2883
|
+
end = true;
|
|
2884
|
+
if (brackets.length > 0)
|
|
2885
|
+
this.unclosedBracket(bracket);
|
|
2776
2886
|
if (end && colon) {
|
|
2777
2887
|
if (!customProperty) {
|
|
2778
2888
|
while (tokens.length) {
|
|
2779
2889
|
token = tokens[tokens.length - 1][0];
|
|
2780
|
-
if (token !== "space" && token !== "comment")
|
|
2890
|
+
if (token !== "space" && token !== "comment")
|
|
2891
|
+
break;
|
|
2781
2892
|
this.tokenizer.back(tokens.pop());
|
|
2782
2893
|
}
|
|
2783
2894
|
}
|
|
@@ -2864,7 +2975,8 @@ let Parser$1 = class Parser {
|
|
|
2864
2975
|
let spaces = "";
|
|
2865
2976
|
while (tokens.length) {
|
|
2866
2977
|
lastTokenType = tokens[tokens.length - 1][0];
|
|
2867
|
-
if (lastTokenType !== "space" && lastTokenType !== "comment")
|
|
2978
|
+
if (lastTokenType !== "space" && lastTokenType !== "comment")
|
|
2979
|
+
break;
|
|
2868
2980
|
spaces = tokens.pop()[1] + spaces;
|
|
2869
2981
|
}
|
|
2870
2982
|
return spaces;
|
|
@@ -2875,7 +2987,8 @@ let Parser$1 = class Parser {
|
|
|
2875
2987
|
let spaces = "";
|
|
2876
2988
|
while (tokens.length) {
|
|
2877
2989
|
next = tokens[0][0];
|
|
2878
|
-
if (next !== "space" && next !== "comment")
|
|
2990
|
+
if (next !== "space" && next !== "comment")
|
|
2991
|
+
break;
|
|
2879
2992
|
spaces += tokens.shift()[1];
|
|
2880
2993
|
}
|
|
2881
2994
|
return spaces;
|
|
@@ -2885,7 +2998,8 @@ let Parser$1 = class Parser {
|
|
|
2885
2998
|
let spaces = "";
|
|
2886
2999
|
while (tokens.length) {
|
|
2887
3000
|
lastTokenType = tokens[tokens.length - 1][0];
|
|
2888
|
-
if (lastTokenType !== "space")
|
|
3001
|
+
if (lastTokenType !== "space")
|
|
3002
|
+
break;
|
|
2889
3003
|
spaces = tokens.pop()[1] + spaces;
|
|
2890
3004
|
}
|
|
2891
3005
|
return spaces;
|
|
@@ -3047,7 +3161,8 @@ function toStack(node2) {
|
|
|
3047
3161
|
}
|
|
3048
3162
|
function cleanMarks(node2) {
|
|
3049
3163
|
node2[isClean] = false;
|
|
3050
|
-
if (node2.nodes)
|
|
3164
|
+
if (node2.nodes)
|
|
3165
|
+
node2.nodes.forEach((i) => cleanMarks(i));
|
|
3051
3166
|
return node2;
|
|
3052
3167
|
}
|
|
3053
3168
|
let postcss$2 = {};
|
|
@@ -3061,15 +3176,20 @@ let LazyResult$2 = class LazyResult {
|
|
|
3061
3176
|
} else if (css instanceof LazyResult || css instanceof Result$2) {
|
|
3062
3177
|
root2 = cleanMarks(css.root);
|
|
3063
3178
|
if (css.map) {
|
|
3064
|
-
if (typeof opts.map === "undefined")
|
|
3065
|
-
|
|
3179
|
+
if (typeof opts.map === "undefined")
|
|
3180
|
+
opts.map = {};
|
|
3181
|
+
if (!opts.map.inline)
|
|
3182
|
+
opts.map.inline = false;
|
|
3066
3183
|
opts.map.prev = css.map;
|
|
3067
3184
|
}
|
|
3068
3185
|
} else {
|
|
3069
3186
|
let parser2 = parse$2;
|
|
3070
|
-
if (opts.syntax)
|
|
3071
|
-
|
|
3072
|
-
if (
|
|
3187
|
+
if (opts.syntax)
|
|
3188
|
+
parser2 = opts.syntax.parse;
|
|
3189
|
+
if (opts.parser)
|
|
3190
|
+
parser2 = opts.parser;
|
|
3191
|
+
if (parser2.parse)
|
|
3192
|
+
parser2 = parser2.parse;
|
|
3073
3193
|
try {
|
|
3074
3194
|
root2 = parser2(css, opts);
|
|
3075
3195
|
} catch (error) {
|
|
@@ -3091,8 +3211,10 @@ let LazyResult$2 = class LazyResult {
|
|
|
3091
3211
|
});
|
|
3092
3212
|
}
|
|
3093
3213
|
async() {
|
|
3094
|
-
if (this.error)
|
|
3095
|
-
|
|
3214
|
+
if (this.error)
|
|
3215
|
+
return Promise.reject(this.error);
|
|
3216
|
+
if (this.processed)
|
|
3217
|
+
return Promise.resolve(this.result);
|
|
3096
3218
|
if (!this.processing) {
|
|
3097
3219
|
this.processing = this.runAsync();
|
|
3098
3220
|
}
|
|
@@ -3110,7 +3232,8 @@ let LazyResult$2 = class LazyResult {
|
|
|
3110
3232
|
handleError(error, node2) {
|
|
3111
3233
|
let plugin2 = this.result.lastPlugin;
|
|
3112
3234
|
try {
|
|
3113
|
-
if (node2)
|
|
3235
|
+
if (node2)
|
|
3236
|
+
node2.addToError(error);
|
|
3114
3237
|
this.error = error;
|
|
3115
3238
|
if (error.name === "CssSyntaxError" && !error.plugin) {
|
|
3116
3239
|
error.plugin = plugin2.postcssPlugin;
|
|
@@ -3130,14 +3253,16 @@ let LazyResult$2 = class LazyResult {
|
|
|
3130
3253
|
}
|
|
3131
3254
|
}
|
|
3132
3255
|
} catch (err) {
|
|
3133
|
-
if (console && console.error)
|
|
3256
|
+
if (console && console.error)
|
|
3257
|
+
console.error(err);
|
|
3134
3258
|
}
|
|
3135
3259
|
return error;
|
|
3136
3260
|
}
|
|
3137
3261
|
prepareVisitors() {
|
|
3138
3262
|
this.listeners = {};
|
|
3139
3263
|
let add = (plugin2, type, cb) => {
|
|
3140
|
-
if (!this.listeners[type])
|
|
3264
|
+
if (!this.listeners[type])
|
|
3265
|
+
this.listeners[type] = [];
|
|
3141
3266
|
this.listeners[type].push([plugin2, cb]);
|
|
3142
3267
|
};
|
|
3143
3268
|
for (let plugin2 of this.plugins) {
|
|
@@ -3244,15 +3369,20 @@ let LazyResult$2 = class LazyResult {
|
|
|
3244
3369
|
}
|
|
3245
3370
|
}
|
|
3246
3371
|
stringify() {
|
|
3247
|
-
if (this.error)
|
|
3248
|
-
|
|
3372
|
+
if (this.error)
|
|
3373
|
+
throw this.error;
|
|
3374
|
+
if (this.stringified)
|
|
3375
|
+
return this.result;
|
|
3249
3376
|
this.stringified = true;
|
|
3250
3377
|
this.sync();
|
|
3251
3378
|
let opts = this.result.opts;
|
|
3252
3379
|
let str = stringify$2;
|
|
3253
|
-
if (opts.syntax)
|
|
3254
|
-
|
|
3255
|
-
if (
|
|
3380
|
+
if (opts.syntax)
|
|
3381
|
+
str = opts.syntax.stringify;
|
|
3382
|
+
if (opts.stringifier)
|
|
3383
|
+
str = opts.stringifier;
|
|
3384
|
+
if (str.stringify)
|
|
3385
|
+
str = str.stringify;
|
|
3256
3386
|
let map = new MapGenerator$1(str, this.result.root, this.result.opts);
|
|
3257
3387
|
let data = map.generate();
|
|
3258
3388
|
this.result.css = data[0];
|
|
@@ -3260,8 +3390,10 @@ let LazyResult$2 = class LazyResult {
|
|
|
3260
3390
|
return this.result;
|
|
3261
3391
|
}
|
|
3262
3392
|
sync() {
|
|
3263
|
-
if (this.error)
|
|
3264
|
-
|
|
3393
|
+
if (this.error)
|
|
3394
|
+
throw this.error;
|
|
3395
|
+
if (this.processed)
|
|
3396
|
+
return this.result;
|
|
3265
3397
|
this.processed = true;
|
|
3266
3398
|
if (this.processing) {
|
|
3267
3399
|
throw this.getAsyncError();
|
|
@@ -3380,13 +3512,15 @@ let LazyResult$2 = class LazyResult {
|
|
|
3380
3512
|
if (event === CHILDREN) {
|
|
3381
3513
|
if (node2.nodes) {
|
|
3382
3514
|
node2.each((child) => {
|
|
3383
|
-
if (!child[isClean])
|
|
3515
|
+
if (!child[isClean])
|
|
3516
|
+
this.walkSync(child);
|
|
3384
3517
|
});
|
|
3385
3518
|
}
|
|
3386
3519
|
} else {
|
|
3387
3520
|
let visitors = this.listeners[event];
|
|
3388
3521
|
if (visitors) {
|
|
3389
|
-
if (this.visitSync(visitors, node2.toProxy()))
|
|
3522
|
+
if (this.visitSync(visitors, node2.toProxy()))
|
|
3523
|
+
return;
|
|
3390
3524
|
}
|
|
3391
3525
|
}
|
|
3392
3526
|
}
|
|
@@ -3464,7 +3598,8 @@ let NoWorkResult$1 = class NoWorkResult {
|
|
|
3464
3598
|
}
|
|
3465
3599
|
}
|
|
3466
3600
|
async() {
|
|
3467
|
-
if (this.error)
|
|
3601
|
+
if (this.error)
|
|
3602
|
+
return Promise.reject(this.error);
|
|
3468
3603
|
return Promise.resolve(this.result);
|
|
3469
3604
|
}
|
|
3470
3605
|
catch(onRejected) {
|
|
@@ -3474,7 +3609,8 @@ let NoWorkResult$1 = class NoWorkResult {
|
|
|
3474
3609
|
return this.async().then(onFinally, onFinally);
|
|
3475
3610
|
}
|
|
3476
3611
|
sync() {
|
|
3477
|
-
if (this.error)
|
|
3612
|
+
if (this.error)
|
|
3613
|
+
throw this.error;
|
|
3478
3614
|
return this.result;
|
|
3479
3615
|
}
|
|
3480
3616
|
then(onFulfilled, onRejected) {
|
|
@@ -3594,7 +3730,8 @@ let Input$1 = input;
|
|
|
3594
3730
|
let Root$1 = root;
|
|
3595
3731
|
let Rule$1 = rule;
|
|
3596
3732
|
function fromJSON$1(json, inputs) {
|
|
3597
|
-
if (Array.isArray(json))
|
|
3733
|
+
if (Array.isArray(json))
|
|
3734
|
+
return json.map((n) => fromJSON$1(n));
|
|
3598
3735
|
let _a = json, { inputs: ownInputs } = _a, defaults = __objRest(_a, ["inputs"]);
|
|
3599
3736
|
if (ownInputs) {
|
|
3600
3737
|
inputs = [];
|
|
@@ -3680,7 +3817,8 @@ postcss.plugin = function plugin(name, initializer) {
|
|
|
3680
3817
|
let cache;
|
|
3681
3818
|
Object.defineProperty(creator, "postcss", {
|
|
3682
3819
|
get() {
|
|
3683
|
-
if (!cache)
|
|
3820
|
+
if (!cache)
|
|
3821
|
+
cache = creator();
|
|
3684
3822
|
return cache;
|
|
3685
3823
|
}
|
|
3686
3824
|
});
|
|
@@ -3766,7 +3904,8 @@ function toCSSText(style) {
|
|
|
3766
3904
|
const properties = [];
|
|
3767
3905
|
for (const name in style) {
|
|
3768
3906
|
const value = style[name];
|
|
3769
|
-
if (typeof value !== "string")
|
|
3907
|
+
if (typeof value !== "string")
|
|
3908
|
+
continue;
|
|
3770
3909
|
const normalizedName = hyphenate(name);
|
|
3771
3910
|
properties.push(`${normalizedName}: ${value};`);
|
|
3772
3911
|
}
|
|
@@ -3775,7 +3914,8 @@ function toCSSText(style) {
|
|
|
3775
3914
|
const camelizeRE = /-([a-z])/g;
|
|
3776
3915
|
const CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9-]+$/;
|
|
3777
3916
|
const camelize = (str) => {
|
|
3778
|
-
if (CUSTOM_PROPERTY_REGEX.test(str))
|
|
3917
|
+
if (CUSTOM_PROPERTY_REGEX.test(str))
|
|
3918
|
+
return str;
|
|
3779
3919
|
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
3780
3920
|
};
|
|
3781
3921
|
const hyphenateRE = /\B([A-Z])/g;
|
|
@@ -3808,11 +3948,15 @@ class BaseRRNode {
|
|
|
3808
3948
|
return childNodes;
|
|
3809
3949
|
}
|
|
3810
3950
|
contains(node2) {
|
|
3811
|
-
if (!(node2 instanceof BaseRRNode))
|
|
3812
|
-
|
|
3813
|
-
else if (node2
|
|
3951
|
+
if (!(node2 instanceof BaseRRNode))
|
|
3952
|
+
return false;
|
|
3953
|
+
else if (node2.ownerDocument !== this.ownerDocument)
|
|
3954
|
+
return false;
|
|
3955
|
+
else if (node2 === this)
|
|
3956
|
+
return true;
|
|
3814
3957
|
while (node2.parentNode) {
|
|
3815
|
-
if (node2.parentNode === this)
|
|
3958
|
+
if (node2.parentNode === this)
|
|
3959
|
+
return true;
|
|
3816
3960
|
node2 = node2.parentNode;
|
|
3817
3961
|
}
|
|
3818
3962
|
return false;
|
|
@@ -4020,15 +4164,20 @@ class BaseRRElement extends BaseRRNode {
|
|
|
4020
4164
|
const style = this.attributes.style ? parseCSSText(this.attributes.style) : {};
|
|
4021
4165
|
const hyphenateRE2 = /\B([A-Z])/g;
|
|
4022
4166
|
style.setProperty = (name, value, priority) => {
|
|
4023
|
-
if (hyphenateRE2.test(name))
|
|
4167
|
+
if (hyphenateRE2.test(name))
|
|
4168
|
+
return;
|
|
4024
4169
|
const normalizedName = camelize(name);
|
|
4025
|
-
if (!value)
|
|
4026
|
-
|
|
4027
|
-
|
|
4170
|
+
if (!value)
|
|
4171
|
+
delete style[normalizedName];
|
|
4172
|
+
else
|
|
4173
|
+
style[normalizedName] = value;
|
|
4174
|
+
if (priority === "important")
|
|
4175
|
+
style[normalizedName] += " !important";
|
|
4028
4176
|
this.attributes.style = toCSSText(style);
|
|
4029
4177
|
};
|
|
4030
4178
|
style.removeProperty = (name) => {
|
|
4031
|
-
if (hyphenateRE2.test(name))
|
|
4179
|
+
if (hyphenateRE2.test(name))
|
|
4180
|
+
return "";
|
|
4032
4181
|
const normalizedName = camelize(name);
|
|
4033
4182
|
const value = style[normalizedName] || "";
|
|
4034
4183
|
delete style[normalizedName];
|
|
@@ -4038,7 +4187,8 @@ class BaseRRElement extends BaseRRNode {
|
|
|
4038
4187
|
return style;
|
|
4039
4188
|
}
|
|
4040
4189
|
getAttribute(name) {
|
|
4041
|
-
if (this.attributes[name] === void 0)
|
|
4190
|
+
if (this.attributes[name] === void 0)
|
|
4191
|
+
return null;
|
|
4042
4192
|
return this.attributes[name];
|
|
4043
4193
|
}
|
|
4044
4194
|
setAttribute(name, attribute) {
|
|
@@ -4189,7 +4339,8 @@ class ClassList {
|
|
|
4189
4339
|
__publicField(this, "add", (...classNames) => {
|
|
4190
4340
|
for (const item of classNames) {
|
|
4191
4341
|
const className = String(item);
|
|
4192
|
-
if (this.classes.indexOf(className) >= 0)
|
|
4342
|
+
if (this.classes.indexOf(className) >= 0)
|
|
4343
|
+
continue;
|
|
4193
4344
|
this.classes.push(className);
|
|
4194
4345
|
}
|
|
4195
4346
|
this.onChange && this.onChange(this.classes.join(" "));
|
|
@@ -4208,7 +4359,8 @@ class ClassList {
|
|
|
4208
4359
|
}
|
|
4209
4360
|
}
|
|
4210
4361
|
function appendChild(parent, newChild) {
|
|
4211
|
-
if (newChild.parentNode)
|
|
4362
|
+
if (newChild.parentNode)
|
|
4363
|
+
newChild.parentNode.removeChild(newChild);
|
|
4212
4364
|
if (parent.lastChild) {
|
|
4213
4365
|
parent.lastChild.nextSibling = newChild;
|
|
4214
4366
|
newChild.previousSibling = parent.lastChild;
|
|
@@ -4224,18 +4376,23 @@ function appendChild(parent, newChild) {
|
|
|
4224
4376
|
return newChild;
|
|
4225
4377
|
}
|
|
4226
4378
|
function insertBefore(parent, newChild, refChild) {
|
|
4227
|
-
if (!refChild)
|
|
4379
|
+
if (!refChild)
|
|
4380
|
+
return appendChild(parent, newChild);
|
|
4228
4381
|
if (refChild.parentNode !== parent)
|
|
4229
4382
|
throw new Error(
|
|
4230
4383
|
"Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode."
|
|
4231
4384
|
);
|
|
4232
|
-
if (newChild === refChild)
|
|
4233
|
-
|
|
4385
|
+
if (newChild === refChild)
|
|
4386
|
+
return newChild;
|
|
4387
|
+
if (newChild.parentNode)
|
|
4388
|
+
newChild.parentNode.removeChild(newChild);
|
|
4234
4389
|
newChild.previousSibling = refChild.previousSibling;
|
|
4235
4390
|
refChild.previousSibling = newChild;
|
|
4236
4391
|
newChild.nextSibling = refChild;
|
|
4237
|
-
if (newChild.previousSibling)
|
|
4238
|
-
|
|
4392
|
+
if (newChild.previousSibling)
|
|
4393
|
+
newChild.previousSibling.nextSibling = newChild;
|
|
4394
|
+
else
|
|
4395
|
+
parent.firstChild = newChild;
|
|
4239
4396
|
newChild.parentElement = parent;
|
|
4240
4397
|
newChild.parentNode = parent;
|
|
4241
4398
|
newChild.ownerDocument = parent.ownerDocument;
|
|
@@ -4248,10 +4405,12 @@ function removeChild(parent, child) {
|
|
|
4248
4405
|
);
|
|
4249
4406
|
if (child.previousSibling)
|
|
4250
4407
|
child.previousSibling.nextSibling = child.nextSibling;
|
|
4251
|
-
else
|
|
4408
|
+
else
|
|
4409
|
+
parent.firstChild = child.nextSibling;
|
|
4252
4410
|
if (child.nextSibling)
|
|
4253
4411
|
child.nextSibling.previousSibling = child.previousSibling;
|
|
4254
|
-
else
|
|
4412
|
+
else
|
|
4413
|
+
parent.lastChild = child.previousSibling;
|
|
4255
4414
|
child.previousSibling = null;
|
|
4256
4415
|
child.nextSibling = null;
|
|
4257
4416
|
child.parentElement = null;
|
|
@@ -4364,7 +4523,8 @@ function diffBeforeUpdatingChildren(oldTree, newTree, replayer, rrnodeMirror) {
|
|
|
4364
4523
|
switch (newRRElement.tagName) {
|
|
4365
4524
|
case "IFRAME": {
|
|
4366
4525
|
const oldContentDocument = oldTree.contentDocument;
|
|
4367
|
-
if (!oldContentDocument)
|
|
4526
|
+
if (!oldContentDocument)
|
|
4527
|
+
break;
|
|
4368
4528
|
diff(
|
|
4369
4529
|
oldContentDocument,
|
|
4370
4530
|
newTree.contentDocument,
|
|
@@ -4375,7 +4535,8 @@ function diffBeforeUpdatingChildren(oldTree, newTree, replayer, rrnodeMirror) {
|
|
|
4375
4535
|
}
|
|
4376
4536
|
}
|
|
4377
4537
|
if (newRRElement.shadowRoot) {
|
|
4378
|
-
if (!oldElement.shadowRoot)
|
|
4538
|
+
if (!oldElement.shadowRoot)
|
|
4539
|
+
oldElement.attachShadow({ mode: "open" });
|
|
4379
4540
|
diffChildren(
|
|
4380
4541
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
4381
4542
|
oldElement.shadowRoot,
|
|
@@ -4459,11 +4620,14 @@ function diffAfterUpdatingChildren(oldTree, newTree, replayer) {
|
|
|
4459
4620
|
const shouldBeModal = rrDialog.isModal;
|
|
4460
4621
|
const modalChanged = wasModal !== shouldBeModal;
|
|
4461
4622
|
const openChanged = wasOpen !== shouldBeOpen;
|
|
4462
|
-
if (modalChanged || wasOpen && openChanged)
|
|
4623
|
+
if (modalChanged || wasOpen && openChanged)
|
|
4624
|
+
dialog.close();
|
|
4463
4625
|
if (shouldBeOpen && (openChanged || modalChanged)) {
|
|
4464
4626
|
try {
|
|
4465
|
-
if (shouldBeModal)
|
|
4466
|
-
|
|
4627
|
+
if (shouldBeModal)
|
|
4628
|
+
dialog.showModal();
|
|
4629
|
+
else
|
|
4630
|
+
dialog.show();
|
|
4467
4631
|
} catch (e) {
|
|
4468
4632
|
console.warn(e);
|
|
4469
4633
|
}
|
|
@@ -4503,7 +4667,8 @@ function diffProps(oldTree, newTree, rrnodeMirror) {
|
|
|
4503
4667
|
ctx.drawImage(image, 0, 0, image.width, image.height);
|
|
4504
4668
|
}
|
|
4505
4669
|
};
|
|
4506
|
-
} else if (newTree.tagName === "IFRAME" && name === "srcdoc")
|
|
4670
|
+
} else if (newTree.tagName === "IFRAME" && name === "srcdoc")
|
|
4671
|
+
continue;
|
|
4507
4672
|
else {
|
|
4508
4673
|
try {
|
|
4509
4674
|
oldTree.setAttribute(name, newValue);
|
|
@@ -4513,14 +4678,16 @@ function diffProps(oldTree, newTree, rrnodeMirror) {
|
|
|
4513
4678
|
}
|
|
4514
4679
|
}
|
|
4515
4680
|
for (const { name } of Array.from(oldAttributes))
|
|
4516
|
-
if (!(name in newAttributes))
|
|
4681
|
+
if (!(name in newAttributes))
|
|
4682
|
+
oldTree.removeAttribute(name);
|
|
4517
4683
|
newTree.scrollLeft && (oldTree.scrollLeft = newTree.scrollLeft);
|
|
4518
4684
|
newTree.scrollTop && (oldTree.scrollTop = newTree.scrollTop);
|
|
4519
4685
|
}
|
|
4520
4686
|
function diffChildren(oldTree, newTree, replayer, rrnodeMirror) {
|
|
4521
4687
|
const oldChildren = Array.from(oldTree.childNodes);
|
|
4522
4688
|
const newChildren = newTree.childNodes;
|
|
4523
|
-
if (oldChildren.length === 0 && newChildren.length === 0)
|
|
4689
|
+
if (oldChildren.length === 0 && newChildren.length === 0)
|
|
4690
|
+
return;
|
|
4524
4691
|
let oldStartIndex = 0, oldEndIndex = oldChildren.length - 1, newStartIndex = 0, newEndIndex = newChildren.length - 1;
|
|
4525
4692
|
let oldStartNode = oldChildren[oldStartIndex], oldEndNode = oldChildren[oldEndIndex], newStartNode = newChildren[newStartIndex], newEndNode = newChildren[newEndIndex];
|
|
4526
4693
|
let oldIdToIndex = void 0, indexInOld = void 0;
|
|
@@ -4631,7 +4798,8 @@ function diffChildren(oldTree, newTree, replayer, rrnodeMirror) {
|
|
|
4631
4798
|
} else if (newStartIndex > newEndIndex) {
|
|
4632
4799
|
for (; oldStartIndex <= oldEndIndex; oldStartIndex++) {
|
|
4633
4800
|
const node2 = oldChildren[oldStartIndex];
|
|
4634
|
-
if (!node2 || node2.parentNode !== oldTree)
|
|
4801
|
+
if (!node2 || node2.parentNode !== oldTree)
|
|
4802
|
+
continue;
|
|
4635
4803
|
try {
|
|
4636
4804
|
oldTree.removeChild(node2);
|
|
4637
4805
|
replayer.mirror.removeNodeFromMap(node2);
|
|
@@ -4652,8 +4820,10 @@ function createOrGetNode(rrNode, domMirror, rrnodeMirror) {
|
|
|
4652
4820
|
const nodeId = rrnodeMirror.getId(rrNode);
|
|
4653
4821
|
const sn = rrnodeMirror.getMeta(rrNode);
|
|
4654
4822
|
let node2 = null;
|
|
4655
|
-
if (nodeId > -1)
|
|
4656
|
-
|
|
4823
|
+
if (nodeId > -1)
|
|
4824
|
+
node2 = domMirror.getNode(nodeId);
|
|
4825
|
+
if (node2 !== null && sameNodeType(node2, rrNode))
|
|
4826
|
+
return node2;
|
|
4657
4827
|
switch (rrNode.RRNodeType) {
|
|
4658
4828
|
case NodeType$1.Document:
|
|
4659
4829
|
node2 = new Document();
|
|
@@ -4670,7 +4840,8 @@ function createOrGetNode(rrNode, domMirror, rrnodeMirror) {
|
|
|
4670
4840
|
tagName = SVGTagMap[tagName] || tagName;
|
|
4671
4841
|
if (sn && "isSVG" in sn && (sn == null ? void 0 : sn.isSVG)) {
|
|
4672
4842
|
node2 = document.createElementNS(NAMESPACES["svg"], tagName);
|
|
4673
|
-
} else
|
|
4843
|
+
} else
|
|
4844
|
+
node2 = document.createElement(rrNode.tagName);
|
|
4674
4845
|
break;
|
|
4675
4846
|
}
|
|
4676
4847
|
case NodeType$1.Text:
|
|
@@ -4683,7 +4854,8 @@ function createOrGetNode(rrNode, domMirror, rrnodeMirror) {
|
|
|
4683
4854
|
node2 = document.createCDATASection(rrNode.data);
|
|
4684
4855
|
break;
|
|
4685
4856
|
}
|
|
4686
|
-
if (sn)
|
|
4857
|
+
if (sn)
|
|
4858
|
+
domMirror.add(node2, __spreadValues({}, sn));
|
|
4687
4859
|
try {
|
|
4688
4860
|
createdNodeSet == null ? void 0 : createdNodeSet.add(node2);
|
|
4689
4861
|
} catch (e) {
|
|
@@ -4691,13 +4863,15 @@ function createOrGetNode(rrNode, domMirror, rrnodeMirror) {
|
|
|
4691
4863
|
return node2;
|
|
4692
4864
|
}
|
|
4693
4865
|
function sameNodeType(node1, node2) {
|
|
4694
|
-
if (node1.nodeType !== node2.nodeType)
|
|
4866
|
+
if (node1.nodeType !== node2.nodeType)
|
|
4867
|
+
return false;
|
|
4695
4868
|
return node1.nodeType !== node1.ELEMENT_NODE || node1.tagName.toUpperCase() === node2.tagName;
|
|
4696
4869
|
}
|
|
4697
4870
|
function nodeMatching(node1, node2, domMirror, rrdomMirror) {
|
|
4698
4871
|
const node1Id = domMirror.getId(node1);
|
|
4699
4872
|
const node2Id = rrdomMirror.getId(node2);
|
|
4700
|
-
if (node1Id === -1 || node1Id !== node2Id)
|
|
4873
|
+
if (node1Id === -1 || node1Id !== node2Id)
|
|
4874
|
+
return false;
|
|
4701
4875
|
return sameNodeType(node1, node2);
|
|
4702
4876
|
}
|
|
4703
4877
|
class RRDocument extends BaseRRDocument {
|
|
@@ -4888,7 +5062,8 @@ function buildFromNode(node2, rrdom, domMirror, parentRRNode) {
|
|
|
4888
5062
|
function buildFromDom(dom, domMirror = createMirror$1(), rrdom = new RRDocument()) {
|
|
4889
5063
|
function walk2(node2, parentRRNode) {
|
|
4890
5064
|
const rrNode = buildFromNode(node2, rrdom, domMirror, parentRRNode);
|
|
4891
|
-
if (rrNode === null)
|
|
5065
|
+
if (rrNode === null)
|
|
5066
|
+
return;
|
|
4892
5067
|
if (
|
|
4893
5068
|
// if the parentRRNode isn't a RRIFrameElement
|
|
4894
5069
|
(parentRRNode == null ? void 0 : parentRRNode.nodeName) !== "IFRAME" && // if node isn't a shadow root
|
|
@@ -4920,7 +5095,8 @@ class Mirror2 {
|
|
|
4920
5095
|
}
|
|
4921
5096
|
getId(n) {
|
|
4922
5097
|
var _a;
|
|
4923
|
-
if (!n)
|
|
5098
|
+
if (!n)
|
|
5099
|
+
return -1;
|
|
4924
5100
|
const id = (_a = this.getMeta(n)) == null ? void 0 : _a.id;
|
|
4925
5101
|
return id != null ? id : -1;
|
|
4926
5102
|
}
|
|
@@ -4957,7 +5133,8 @@ class Mirror2 {
|
|
|
4957
5133
|
const oldNode = this.getNode(id);
|
|
4958
5134
|
if (oldNode) {
|
|
4959
5135
|
const meta = this.nodeMetaMap.get(oldNode);
|
|
4960
|
-
if (meta)
|
|
5136
|
+
if (meta)
|
|
5137
|
+
this.nodeMetaMap.set(n, meta);
|
|
4961
5138
|
}
|
|
4962
5139
|
this.idNodeMap.set(id, n);
|
|
4963
5140
|
}
|