@posthog/rrdom 0.0.34 → 0.0.36

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Contributors (https://github.com/rrweb-io/rrweb/graphs/contributors) and SmartX Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/rrdom.cjs CHANGED
@@ -68,7 +68,7 @@ function getDefaultExportFromCjs(x) {
68
68
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
69
69
  }
70
70
  function getAugmentedNamespace(n) {
71
- if (n.__esModule) return n;
71
+ if (Object.prototype.hasOwnProperty.call(n, "__esModule")) return n;
72
72
  var f2 = n.default;
73
73
  if (typeof f2 == "function") {
74
74
  var a2 = function a3() {
@@ -587,6 +587,9 @@ function requireNode() {
587
587
  return offset;
588
588
  }
589
589
  class Node {
590
+ get proxyOf() {
591
+ return this;
592
+ }
590
593
  constructor(defaults = {}) {
591
594
  this.raws = {};
592
595
  this[isClean] = false;
@@ -705,7 +708,7 @@ function requireNode() {
705
708
  let index = this.parent.index(this);
706
709
  return this.parent.nodes[index + 1];
707
710
  }
708
- positionBy(opts) {
711
+ positionBy(opts = {}) {
709
712
  let pos = this.source.start;
710
713
  if (opts.index) {
711
714
  pos = this.positionInside(opts.index);
@@ -734,27 +737,38 @@ function requireNode() {
734
737
  column += 1;
735
738
  }
736
739
  }
737
- return { column, line };
740
+ return { column, line, offset: end };
738
741
  }
739
742
  prev() {
740
743
  if (!this.parent) return void 0;
741
744
  let index = this.parent.index(this);
742
745
  return this.parent.nodes[index - 1];
743
746
  }
744
- rangeBy(opts) {
747
+ rangeBy(opts = {}) {
748
+ let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
745
749
  let start = {
746
750
  column: this.source.start.column,
747
- line: this.source.start.line
751
+ line: this.source.start.line,
752
+ offset: sourceOffset(inputString, this.source.start)
748
753
  };
749
754
  let end = this.source.end ? {
750
755
  column: this.source.end.column + 1,
751
- line: this.source.end.line
756
+ line: this.source.end.line,
757
+ offset: typeof this.source.end.offset === "number" ? (
758
+ // `source.end.offset` is exclusive, so we don't need to add 1
759
+ this.source.end.offset
760
+ ) : (
761
+ // Since line/column in this.source.end is inclusive,
762
+ // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
763
+ // So, we add 1 to convert it to exclusive.
764
+ sourceOffset(inputString, this.source.end) + 1
765
+ )
752
766
  } : {
753
767
  column: start.column + 1,
754
- line: start.line
768
+ line: start.line,
769
+ offset: start.offset + 1
755
770
  };
756
771
  if (opts.word) {
757
- let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
758
772
  let stringRepresentation = inputString.slice(
759
773
  sourceOffset(inputString, this.source.start),
760
774
  sourceOffset(inputString, this.source.end)
@@ -762,15 +776,14 @@ function requireNode() {
762
776
  let index = stringRepresentation.indexOf(opts.word);
763
777
  if (index !== -1) {
764
778
  start = this.positionInside(index);
765
- end = this.positionInside(
766
- index + opts.word.length
767
- );
779
+ end = this.positionInside(index + opts.word.length);
768
780
  }
769
781
  } else {
770
782
  if (opts.start) {
771
783
  start = {
772
784
  column: opts.start.column,
773
- line: opts.start.line
785
+ line: opts.start.line,
786
+ offset: sourceOffset(inputString, opts.start)
774
787
  };
775
788
  } else if (opts.index) {
776
789
  start = this.positionInside(opts.index);
@@ -778,7 +791,8 @@ function requireNode() {
778
791
  if (opts.end) {
779
792
  end = {
780
793
  column: opts.end.column,
781
- line: opts.end.line
794
+ line: opts.end.line,
795
+ offset: sourceOffset(inputString, opts.end)
782
796
  };
783
797
  } else if (typeof opts.endIndex === "number") {
784
798
  end = this.positionInside(opts.endIndex);
@@ -787,7 +801,11 @@ function requireNode() {
787
801
  }
788
802
  }
789
803
  if (end.line < start.line || end.line === start.line && end.column <= start.column) {
790
- end = { column: start.column + 1, line: start.line };
804
+ end = {
805
+ column: start.column + 1,
806
+ line: start.line,
807
+ offset: start.offset + 1
808
+ };
791
809
  }
792
810
  return { end, start };
793
811
  }
@@ -851,6 +869,7 @@ function requireNode() {
851
869
  } else if (typeof value === "object" && value.toJSON) {
852
870
  fixed[name] = value.toJSON(null, inputs);
853
871
  } else if (name === "source") {
872
+ if (value == null) continue;
854
873
  let inputId = inputs.get(value.input);
855
874
  if (inputId == null) {
856
875
  inputId = inputsNextIndex;
@@ -885,14 +904,11 @@ function requireNode() {
885
904
  });
886
905
  return result2;
887
906
  }
888
- warn(result2, text, opts) {
907
+ warn(result2, text, opts = {}) {
889
908
  let data = { node: this };
890
909
  for (let i in opts) data[i] = opts[i];
891
910
  return result2.warn(text, data);
892
911
  }
893
- get proxyOf() {
894
- return this;
895
- }
896
912
  }
897
913
  node = Node;
898
914
  Node.default = Node;
@@ -921,6 +937,9 @@ function requireDeclaration() {
921
937
  hasRequiredDeclaration = 1;
922
938
  let Node = requireNode();
923
939
  class Declaration extends Node {
940
+ get variable() {
941
+ return this.prop.startsWith("--") || this.prop[0] === "$";
942
+ }
924
943
  constructor(defaults) {
925
944
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
926
945
  defaults = { ...defaults, value: String(defaults.value) };
@@ -928,9 +947,6 @@ function requireDeclaration() {
928
947
  super(defaults);
929
948
  this.type = "decl";
930
949
  }
931
- get variable() {
932
- return this.prop.startsWith("--") || this.prop[0] === "$";
933
- }
934
950
  }
935
951
  declaration = Declaration;
936
952
  Declaration.default = Declaration;
@@ -962,6 +978,14 @@ function requireContainer() {
962
978
  }
963
979
  }
964
980
  class Container extends Node {
981
+ get first() {
982
+ if (!this.proxyOf.nodes) return void 0;
983
+ return this.proxyOf.nodes[0];
984
+ }
985
+ get last() {
986
+ if (!this.proxyOf.nodes) return void 0;
987
+ return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
988
+ }
965
989
  append(...children) {
966
990
  for (let child of children) {
967
991
  let nodes = this.normalize(child, this.last);
@@ -1274,14 +1298,6 @@ function requireContainer() {
1274
1298
  }
1275
1299
  });
1276
1300
  }
1277
- get first() {
1278
- if (!this.proxyOf.nodes) return void 0;
1279
- return this.proxyOf.nodes[0];
1280
- }
1281
- get last() {
1282
- if (!this.proxyOf.nodes) return void 0;
1283
- return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
1284
- }
1285
1301
  }
1286
1302
  Container.registerParse = (dependant) => {
1287
1303
  parse = dependant;
@@ -1531,10 +1547,25 @@ function requireInput() {
1531
1547
  let CssSyntaxError = requireCssSyntaxError();
1532
1548
  let PreviousMap = requirePreviousMap();
1533
1549
  let terminalHighlight = require$$2;
1534
- let fromOffsetCache = Symbol("fromOffsetCache");
1550
+ let lineToIndexCache = Symbol("lineToIndexCache");
1535
1551
  let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
1536
1552
  let pathAvailable = Boolean(resolve && isAbsolute);
1553
+ function getLineToIndex(input2) {
1554
+ if (input2[lineToIndexCache]) return input2[lineToIndexCache];
1555
+ let lines = input2.css.split("\n");
1556
+ let lineToIndex = new Array(lines.length);
1557
+ let prevIndex = 0;
1558
+ for (let i = 0, l2 = lines.length; i < l2; i++) {
1559
+ lineToIndex[i] = prevIndex;
1560
+ prevIndex += lines[i].length + 1;
1561
+ }
1562
+ input2[lineToIndexCache] = lineToIndex;
1563
+ return lineToIndex;
1564
+ }
1537
1565
  class Input {
1566
+ get from() {
1567
+ return this.file || this.id;
1568
+ }
1538
1569
  constructor(css, opts = {}) {
1539
1570
  if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
1540
1571
  throw new Error(`PostCSS received ${css} instead of CSS string`);
@@ -1569,30 +1600,37 @@ function requireInput() {
1569
1600
  if (this.map) this.map.file = this.from;
1570
1601
  }
1571
1602
  error(message, line, column, opts = {}) {
1572
- let endColumn, endLine, result2;
1603
+ let endColumn, endLine, endOffset, offset, result2;
1573
1604
  if (line && typeof line === "object") {
1574
1605
  let start = line;
1575
1606
  let end = column;
1576
1607
  if (typeof start.offset === "number") {
1577
- let pos = this.fromOffset(start.offset);
1608
+ offset = start.offset;
1609
+ let pos = this.fromOffset(offset);
1578
1610
  line = pos.line;
1579
1611
  column = pos.col;
1580
1612
  } else {
1581
1613
  line = start.line;
1582
1614
  column = start.column;
1615
+ offset = this.fromLineAndColumn(line, column);
1583
1616
  }
1584
1617
  if (typeof end.offset === "number") {
1585
- let pos = this.fromOffset(end.offset);
1618
+ endOffset = end.offset;
1619
+ let pos = this.fromOffset(endOffset);
1586
1620
  endLine = pos.line;
1587
1621
  endColumn = pos.col;
1588
1622
  } else {
1589
1623
  endLine = end.line;
1590
1624
  endColumn = end.column;
1625
+ endOffset = this.fromLineAndColumn(end.line, end.column);
1591
1626
  }
1592
1627
  } else if (!column) {
1593
- let pos = this.fromOffset(line);
1628
+ offset = line;
1629
+ let pos = this.fromOffset(offset);
1594
1630
  line = pos.line;
1595
1631
  column = pos.col;
1632
+ } else {
1633
+ offset = this.fromLineAndColumn(line, column);
1596
1634
  }
1597
1635
  let origin = this.origin(line, column, endLine, endColumn);
1598
1636
  if (origin) {
@@ -1614,7 +1652,7 @@ function requireInput() {
1614
1652
  opts.plugin
1615
1653
  );
1616
1654
  }
1617
- result2.input = { column, endColumn, endLine, line, source: this.css };
1655
+ result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
1618
1656
  if (this.file) {
1619
1657
  if (pathToFileURL) {
1620
1658
  result2.input.url = pathToFileURL(this.file).toString();
@@ -1623,21 +1661,14 @@ function requireInput() {
1623
1661
  }
1624
1662
  return result2;
1625
1663
  }
1664
+ fromLineAndColumn(line, column) {
1665
+ let lineToIndex = getLineToIndex(this);
1666
+ let index = lineToIndex[line - 1];
1667
+ return index + column - 1;
1668
+ }
1626
1669
  fromOffset(offset) {
1627
- let lastLine, lineToIndex;
1628
- if (!this[fromOffsetCache]) {
1629
- let lines = this.css.split("\n");
1630
- lineToIndex = new Array(lines.length);
1631
- let prevIndex = 0;
1632
- for (let i = 0, l2 = lines.length; i < l2; i++) {
1633
- lineToIndex[i] = prevIndex;
1634
- prevIndex += lines[i].length + 1;
1635
- }
1636
- this[fromOffsetCache] = lineToIndex;
1637
- } else {
1638
- lineToIndex = this[fromOffsetCache];
1639
- }
1640
- lastLine = lineToIndex[lineToIndex.length - 1];
1670
+ let lineToIndex = getLineToIndex(this);
1671
+ let lastLine = lineToIndex[lineToIndex.length - 1];
1641
1672
  let min = 0;
1642
1673
  if (offset >= lastLine) {
1643
1674
  min = lineToIndex.length - 1;
@@ -1718,9 +1749,6 @@ function requireInput() {
1718
1749
  }
1719
1750
  return json;
1720
1751
  }
1721
- get from() {
1722
- return this.file || this.id;
1723
- }
1724
1752
  }
1725
1753
  input = Input;
1726
1754
  Input.default = Input;
@@ -1846,11 +1874,6 @@ function requireRule() {
1846
1874
  let Container = requireContainer();
1847
1875
  let list = requireList();
1848
1876
  class Rule extends Container {
1849
- constructor(defaults) {
1850
- super(defaults);
1851
- this.type = "rule";
1852
- if (!this.nodes) this.nodes = [];
1853
- }
1854
1877
  get selectors() {
1855
1878
  return list.comma(this.selector);
1856
1879
  }
@@ -1859,6 +1882,11 @@ function requireRule() {
1859
1882
  let sep = match ? match[0] : "," + this.raw("between", "beforeOpen");
1860
1883
  this.selector = values.join(sep);
1861
1884
  }
1885
+ constructor(defaults) {
1886
+ super(defaults);
1887
+ this.type = "rule";
1888
+ if (!this.nodes) this.nodes = [];
1889
+ }
1862
1890
  }
1863
1891
  rule = Rule;
1864
1892
  Rule.default = Rule;
@@ -2758,6 +2786,8 @@ function requireParser() {
2758
2786
  if (prev && prev.type === "rule" && !prev.raws.ownSemicolon) {
2759
2787
  prev.raws.ownSemicolon = this.spaces;
2760
2788
  this.spaces = "";
2789
+ prev.source.end = this.getPosition(token[2]);
2790
+ prev.source.end.offset += prev.raws.ownSemicolon.length;
2761
2791
  }
2762
2792
  }
2763
2793
  }
@@ -2969,7 +2999,7 @@ function requireParser() {
2969
2999
  }
2970
3000
  unknownWord(tokens) {
2971
3001
  throw this.input.error(
2972
- "Unknown word",
3002
+ "Unknown word " + tokens[0][1],
2973
3003
  { offset: tokens[0][2] },
2974
3004
  { offset: tokens[0][2] + tokens[0][1].length }
2975
3005
  );
@@ -3062,12 +3092,15 @@ function requireResult() {
3062
3092
  hasRequiredResult = 1;
3063
3093
  let Warning = requireWarning();
3064
3094
  class Result {
3095
+ get content() {
3096
+ return this.css;
3097
+ }
3065
3098
  constructor(processor2, root2, opts) {
3066
3099
  this.processor = processor2;
3067
3100
  this.messages = [];
3068
3101
  this.root = root2;
3069
3102
  this.opts = opts;
3070
- this.css = void 0;
3103
+ this.css = "";
3071
3104
  this.map = void 0;
3072
3105
  }
3073
3106
  toString() {
@@ -3086,9 +3119,6 @@ function requireResult() {
3086
3119
  warnings() {
3087
3120
  return this.messages.filter((i) => i.type === "warning");
3088
3121
  }
3089
- get content() {
3090
- return this.css;
3091
- }
3092
3122
  }
3093
3123
  result = Result;
3094
3124
  Result.default = Result;
@@ -3207,6 +3237,30 @@ function requireLazyResult() {
3207
3237
  }
3208
3238
  let postcss2 = {};
3209
3239
  class LazyResult {
3240
+ get content() {
3241
+ return this.stringify().content;
3242
+ }
3243
+ get css() {
3244
+ return this.stringify().css;
3245
+ }
3246
+ get map() {
3247
+ return this.stringify().map;
3248
+ }
3249
+ get messages() {
3250
+ return this.sync().messages;
3251
+ }
3252
+ get opts() {
3253
+ return this.result.opts;
3254
+ }
3255
+ get processor() {
3256
+ return this.result.processor;
3257
+ }
3258
+ get root() {
3259
+ return this.sync().root;
3260
+ }
3261
+ get [Symbol.toStringTag]() {
3262
+ return "LazyResult";
3263
+ }
3210
3264
  constructor(processor2, css, opts) {
3211
3265
  this.stringified = false;
3212
3266
  this.processed = false;
@@ -3549,30 +3603,6 @@ function requireLazyResult() {
3549
3603
  warnings() {
3550
3604
  return this.sync().warnings();
3551
3605
  }
3552
- get content() {
3553
- return this.stringify().content;
3554
- }
3555
- get css() {
3556
- return this.stringify().css;
3557
- }
3558
- get map() {
3559
- return this.stringify().map;
3560
- }
3561
- get messages() {
3562
- return this.sync().messages;
3563
- }
3564
- get opts() {
3565
- return this.result.opts;
3566
- }
3567
- get processor() {
3568
- return this.result.processor;
3569
- }
3570
- get root() {
3571
- return this.sync().root;
3572
- }
3573
- get [Symbol.toStringTag]() {
3574
- return "LazyResult";
3575
- }
3576
3606
  }
3577
3607
  LazyResult.registerPostcss = (dependant) => {
3578
3608
  postcss2 = dependant;
@@ -3594,6 +3624,45 @@ function requireNoWorkResult() {
3594
3624
  let stringify = requireStringify();
3595
3625
  let warnOnce2 = requireWarnOnce();
3596
3626
  class NoWorkResult {
3627
+ get content() {
3628
+ return this.result.css;
3629
+ }
3630
+ get css() {
3631
+ return this.result.css;
3632
+ }
3633
+ get map() {
3634
+ return this.result.map;
3635
+ }
3636
+ get messages() {
3637
+ return [];
3638
+ }
3639
+ get opts() {
3640
+ return this.result.opts;
3641
+ }
3642
+ get processor() {
3643
+ return this.result.processor;
3644
+ }
3645
+ get root() {
3646
+ if (this._root) {
3647
+ return this._root;
3648
+ }
3649
+ let root2;
3650
+ let parser2 = parse;
3651
+ try {
3652
+ root2 = parser2(this._css, this._opts);
3653
+ } catch (error) {
3654
+ this.error = error;
3655
+ }
3656
+ if (this.error) {
3657
+ throw this.error;
3658
+ } else {
3659
+ this._root = root2;
3660
+ return root2;
3661
+ }
3662
+ }
3663
+ get [Symbol.toStringTag]() {
3664
+ return "NoWorkResult";
3665
+ }
3597
3666
  constructor(processor2, css, opts) {
3598
3667
  css = css.toString();
3599
3668
  this.stringified = false;
@@ -3655,45 +3724,6 @@ function requireNoWorkResult() {
3655
3724
  warnings() {
3656
3725
  return [];
3657
3726
  }
3658
- get content() {
3659
- return this.result.css;
3660
- }
3661
- get css() {
3662
- return this.result.css;
3663
- }
3664
- get map() {
3665
- return this.result.map;
3666
- }
3667
- get messages() {
3668
- return [];
3669
- }
3670
- get opts() {
3671
- return this.result.opts;
3672
- }
3673
- get processor() {
3674
- return this.result.processor;
3675
- }
3676
- get root() {
3677
- if (this._root) {
3678
- return this._root;
3679
- }
3680
- let root2;
3681
- let parser2 = parse;
3682
- try {
3683
- root2 = parser2(this._css, this._opts);
3684
- } catch (error) {
3685
- this.error = error;
3686
- }
3687
- if (this.error) {
3688
- throw this.error;
3689
- } else {
3690
- this._root = root2;
3691
- return root2;
3692
- }
3693
- }
3694
- get [Symbol.toStringTag]() {
3695
- return "NoWorkResult";
3696
- }
3697
3727
  }
3698
3728
  noWorkResult = NoWorkResult;
3699
3729
  NoWorkResult.default = NoWorkResult;
@@ -3710,7 +3740,7 @@ function requireProcessor() {
3710
3740
  let Root = requireRoot();
3711
3741
  class Processor {
3712
3742
  constructor(plugins = []) {
3713
- this.version = "8.5.1";
3743
+ this.version = "8.5.6";
3714
3744
  this.plugins = this.normalize(plugins);
3715
3745
  }
3716
3746
  normalize(plugins) {