@highlight-run/rrweb 2.0.1 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/dist/plugins/console-record.js +12 -655
  2. package/dist/plugins/console-record.min.js +12 -15
  3. package/dist/plugins/console-record.min.js.map +1 -1
  4. package/dist/plugins/console-replay.js +4 -293
  5. package/dist/plugins/console-replay.min.js +4 -15
  6. package/dist/plugins/console-replay.min.js.map +1 -1
  7. package/dist/plugins/sequential-id-record.js +1 -33
  8. package/dist/plugins/sequential-id-record.min.js +1 -1
  9. package/dist/plugins/sequential-id-record.min.js.map +1 -1
  10. package/dist/plugins/sequential-id-replay.js +1 -37
  11. package/dist/plugins/sequential-id-replay.min.js +1 -1
  12. package/dist/plugins/sequential-id-replay.min.js.map +1 -1
  13. package/dist/record/rrweb-record-pack.js +3 -747
  14. package/dist/record/rrweb-record-pack.min.js +3 -15
  15. package/dist/record/rrweb-record-pack.min.js.map +1 -1
  16. package/dist/record/rrweb-record.js +4 -3318
  17. package/dist/record/rrweb-record.min.js +4 -15
  18. package/dist/record/rrweb-record.min.js.map +1 -1
  19. package/dist/replay/rrweb-replay-unpack.css +1 -0
  20. package/dist/replay/rrweb-replay-unpack.js +5 -4614
  21. package/dist/replay/rrweb-replay-unpack.min.js +5 -17
  22. package/dist/replay/rrweb-replay-unpack.min.js.map +1 -1
  23. package/dist/replay/rrweb-replay.css +1 -0
  24. package/dist/replay/rrweb-replay.js +5 -4204
  25. package/dist/replay/rrweb-replay.min.js +5 -17
  26. package/dist/replay/rrweb-replay.min.js.map +1 -1
  27. package/dist/rrweb-all.css +1 -0
  28. package/dist/rrweb-all.js +16 -8696
  29. package/dist/rrweb-all.min.js +16 -17
  30. package/dist/rrweb-all.min.js.map +1 -1
  31. package/dist/rrweb.css +1 -0
  32. package/dist/rrweb.js +6 -7282
  33. package/dist/rrweb.min.js +6 -17
  34. package/dist/rrweb.min.js.map +1 -1
  35. package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js +12 -0
  36. package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js +7 -0
  37. package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +31 -0
  38. package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js +11 -0
  39. package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js +18 -0
  40. package/es/rrweb/_virtual/image-bitmap-data-url-worker.js +6 -0
  41. package/es/rrweb/all.css +1 -0
  42. package/es/rrweb/ext/mitt/dist/mitt.es.js +1 -1
  43. package/es/rrweb/ext/tslib/tslib.es6.js +38 -0
  44. package/es/rrweb/packages/rrdom/es/virtual-dom.js +1099 -0
  45. package/es/rrweb/packages/rrweb/src/index.js +6 -4
  46. package/es/rrweb/packages/rrweb/src/packer/base.js +1 -1
  47. package/es/rrweb/packages/rrweb/src/packer/pack.js +4 -5
  48. package/es/rrweb/packages/rrweb/src/packer/unpack.js +24 -24
  49. package/es/rrweb/packages/rrweb/src/plugins/console/record/error-stack-parser.js +175 -176
  50. package/es/rrweb/packages/rrweb/src/plugins/console/record/index.js +109 -128
  51. package/es/rrweb/packages/rrweb/src/plugins/console/record/stringify.js +125 -138
  52. package/es/rrweb/packages/rrweb/src/plugins/console/replay/index.js +88 -105
  53. package/es/rrweb/packages/rrweb/src/plugins/sequential-id/record/index.js +19 -20
  54. package/es/rrweb/packages/rrweb/src/plugins/sequential-id/replay/index.js +25 -25
  55. package/es/rrweb/packages/rrweb/src/record/iframe-manager.js +29 -30
  56. package/es/rrweb/packages/rrweb/src/record/index.js +348 -373
  57. package/es/rrweb/packages/rrweb/src/record/mutation.js +487 -528
  58. package/es/rrweb/packages/rrweb/src/record/observer.js +584 -659
  59. package/es/rrweb/packages/rrweb/src/record/observers/canvas/2d.js +44 -73
  60. package/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js +166 -87
  61. package/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas.js +21 -26
  62. package/es/rrweb/packages/rrweb/src/record/observers/canvas/serialize-args.js +119 -112
  63. package/es/rrweb/packages/rrweb/src/record/observers/canvas/webgl.js +53 -72
  64. package/es/rrweb/packages/rrweb/src/record/shadow-dom-manager.js +38 -40
  65. package/es/rrweb/packages/rrweb/src/record/stylesheet-manager.js +31 -0
  66. package/es/rrweb/packages/rrweb/src/replay/canvas/2d.js +27 -23
  67. package/es/rrweb/packages/rrweb/src/replay/canvas/deserialize-args.js +67 -0
  68. package/es/rrweb/packages/rrweb/src/replay/canvas/index.js +37 -29
  69. package/es/rrweb/packages/rrweb/src/replay/canvas/webgl.js +58 -120
  70. package/es/rrweb/packages/rrweb/src/replay/index.js +1545 -1854
  71. package/es/rrweb/packages/rrweb/src/replay/machine.js +275 -315
  72. package/es/rrweb/packages/rrweb/src/replay/smoothscroll.js +216 -218
  73. package/es/rrweb/packages/rrweb/src/replay/styles/inject-style.js +7 -7
  74. package/es/rrweb/packages/rrweb/src/replay/timer.js +87 -91
  75. package/es/rrweb/packages/rrweb/src/types.js +72 -72
  76. package/es/rrweb/packages/rrweb/src/utils.js +312 -506
  77. package/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js +190 -72
  78. package/lib/plugins/console-record.js +469 -627
  79. package/lib/plugins/console-replay.js +198 -268
  80. package/lib/plugins/sequential-id-record.js +19 -20
  81. package/lib/plugins/sequential-id-replay.js +25 -25
  82. package/lib/record/rrweb-record-pack.js +184 -139
  83. package/lib/record/rrweb-record.js +2467 -2425
  84. package/lib/replay/rrweb-replay-unpack.css +1 -0
  85. package/lib/replay/rrweb-replay-unpack.js +3798 -3344
  86. package/lib/replay/rrweb-replay.css +1 -0
  87. package/lib/replay/rrweb-replay.js +3743 -3289
  88. package/lib/rrweb-all.css +1 -0
  89. package/lib/rrweb-all.js +6721 -6249
  90. package/lib/rrweb.css +1 -0
  91. package/lib/rrweb.js +6151 -5632
  92. package/package.json +14 -13
  93. package/typings/packer/base.d.ts +1 -1
  94. package/typings/plugins/console/record/index.d.ts +1 -1
  95. package/typings/plugins/console/record/stringify.d.ts +1 -1
  96. package/typings/plugins/sequential-id/record/index.d.ts +1 -1
  97. package/typings/plugins/sequential-id/replay/index.d.ts +1 -1
  98. package/typings/record/iframe-manager.d.ts +3 -3
  99. package/typings/record/index.d.ts +1 -1
  100. package/typings/record/mutation.d.ts +2 -1
  101. package/typings/record/observers/canvas/2d.d.ts +2 -1
  102. package/typings/record/observers/canvas/canvas-manager.d.ts +5 -2
  103. package/typings/record/observers/canvas/canvas.d.ts +1 -1
  104. package/typings/record/observers/canvas/serialize-args.d.ts +5 -5
  105. package/typings/record/observers/canvas/webgl.d.ts +2 -1
  106. package/typings/record/shadow-dom-manager.d.ts +2 -1
  107. package/typings/record/stylesheet-manager.d.ts +12 -0
  108. package/typings/record/workers/image-bitmap-data-url-worker.d.ts +5 -0
  109. package/typings/replay/canvas/2d.d.ts +3 -3
  110. package/typings/replay/canvas/deserialize-args.d.ts +7 -0
  111. package/typings/replay/canvas/index.d.ts +4 -3
  112. package/typings/replay/canvas/webgl.d.ts +3 -5
  113. package/typings/replay/index.d.ts +7 -10
  114. package/typings/types.d.ts +45 -17
  115. package/typings/utils.d.ts +17 -44
  116. package/es/rrweb/packages/rrweb/ext/tslib/tslib.es6.js +0 -78
  117. package/es/rrweb/packages/rrweb/src/replay/virtual-styles.js +0 -121
  118. package/typings/replay/virtual-styles.d.ts +0 -43
@@ -1,221 +1,219 @@
1
- function polyfill(w, d) {
2
- if (w === void 0) { w = window; }
3
- if (d === void 0) { d = document; }
4
- if ('scrollBehavior' in d.documentElement.style &&
5
- w.__forceSmoothScrollPolyfill__ !== true) {
6
- return;
7
- }
8
- var Element = w.HTMLElement || w.Element;
9
- var SCROLL_TIME = 468;
10
- var original = {
11
- scroll: w.scroll || w.scrollTo,
12
- scrollBy: w.scrollBy,
13
- elementScroll: Element.prototype.scroll || scrollElement,
14
- scrollIntoView: Element.prototype.scrollIntoView,
15
- };
16
- var now = w.performance && w.performance.now
17
- ? w.performance.now.bind(w.performance)
18
- : Date.now;
19
- function isMicrosoftBrowser(userAgent) {
20
- var userAgentPatterns = ['MSIE ', 'Trident/', 'Edge/'];
21
- return new RegExp(userAgentPatterns.join('|')).test(userAgent);
22
- }
23
- var ROUNDING_TOLERANCE = isMicrosoftBrowser(w.navigator.userAgent) ? 1 : 0;
24
- function scrollElement(x, y) {
25
- this.scrollLeft = x;
26
- this.scrollTop = y;
27
- }
28
- function ease(k) {
29
- return 0.5 * (1 - Math.cos(Math.PI * k));
30
- }
31
- function shouldBailOut(firstArg) {
32
- if (firstArg === null ||
33
- typeof firstArg !== 'object' ||
34
- firstArg.behavior === undefined ||
35
- firstArg.behavior === 'auto' ||
36
- firstArg.behavior === 'instant') {
37
- return true;
38
- }
39
- if (typeof firstArg === 'object' && firstArg.behavior === 'smooth') {
40
- return false;
41
- }
42
- throw new TypeError('behavior member of ScrollOptions ' +
43
- firstArg.behavior +
44
- ' is not a valid value for enumeration ScrollBehavior.');
45
- }
46
- function hasScrollableSpace(el, axis) {
47
- if (axis === 'Y') {
48
- return el.clientHeight + ROUNDING_TOLERANCE < el.scrollHeight;
49
- }
50
- if (axis === 'X') {
51
- return el.clientWidth + ROUNDING_TOLERANCE < el.scrollWidth;
52
- }
53
- }
54
- function canOverflow(el, axis) {
55
- var overflowValue = w.getComputedStyle(el, null)['overflow' + axis];
56
- return overflowValue === 'auto' || overflowValue === 'scroll';
57
- }
58
- function isScrollable(el) {
59
- var isScrollableY = hasScrollableSpace(el, 'Y') && canOverflow(el, 'Y');
60
- var isScrollableX = hasScrollableSpace(el, 'X') && canOverflow(el, 'X');
61
- return isScrollableY || isScrollableX;
62
- }
63
- function findScrollableParent(el) {
64
- while (el !== d.body && isScrollable(el) === false) {
65
- el = el.parentNode || el.host;
66
- }
67
- return el;
68
- }
69
- function step(context) {
70
- var time = now();
71
- var value;
72
- var currentX;
73
- var currentY;
74
- var elapsed = (time - context.startTime) / SCROLL_TIME;
75
- elapsed = elapsed > 1 ? 1 : elapsed;
76
- value = ease(elapsed);
77
- currentX = context.startX + (context.x - context.startX) * value;
78
- currentY = context.startY + (context.y - context.startY) * value;
79
- context.method.call(context.scrollable, currentX, currentY);
80
- if (currentX !== context.x || currentY !== context.y) {
81
- w.requestAnimationFrame(step.bind(w, context));
82
- }
83
- }
84
- function smoothScroll(el, x, y) {
85
- var scrollable;
86
- var startX;
87
- var startY;
88
- var method;
89
- var startTime = now();
90
- if (el === d.body) {
91
- scrollable = w;
92
- startX = w.scrollX || w.pageXOffset;
93
- startY = w.scrollY || w.pageYOffset;
94
- method = original.scroll;
95
- }
96
- else {
97
- scrollable = el;
98
- startX = el.scrollLeft;
99
- startY = el.scrollTop;
100
- method = scrollElement;
101
- }
102
- step({
103
- scrollable: scrollable,
104
- method: method,
105
- startTime: startTime,
106
- startX: startX,
107
- startY: startY,
108
- x: x,
109
- y: y,
110
- });
111
- }
112
- w.scroll = w.scrollTo = function () {
113
- if (arguments[0] === undefined) {
114
- return;
115
- }
116
- if (shouldBailOut(arguments[0]) === true) {
117
- original.scroll.call(w, arguments[0].left !== undefined
118
- ? arguments[0].left
119
- : typeof arguments[0] !== 'object'
120
- ? arguments[0]
121
- : w.scrollX || w.pageXOffset, arguments[0].top !== undefined
122
- ? arguments[0].top
123
- : arguments[1] !== undefined
124
- ? arguments[1]
125
- : w.scrollY || w.pageYOffset);
126
- return;
127
- }
128
- smoothScroll.call(w, d.body, arguments[0].left !== undefined
129
- ? ~~arguments[0].left
130
- : w.scrollX || w.pageXOffset, arguments[0].top !== undefined
131
- ? ~~arguments[0].top
132
- : w.scrollY || w.pageYOffset);
133
- };
134
- w.scrollBy = function () {
135
- if (arguments[0] === undefined) {
136
- return;
137
- }
138
- if (shouldBailOut(arguments[0])) {
139
- original.scrollBy.call(w, arguments[0].left !== undefined
140
- ? arguments[0].left
141
- : typeof arguments[0] !== 'object'
142
- ? arguments[0]
143
- : 0, arguments[0].top !== undefined
144
- ? arguments[0].top
145
- : arguments[1] !== undefined
146
- ? arguments[1]
147
- : 0);
148
- return;
149
- }
150
- smoothScroll.call(w, d.body, ~~arguments[0].left + (w.scrollX || w.pageXOffset), ~~arguments[0].top + (w.scrollY || w.pageYOffset));
151
- };
152
- Element.prototype.scroll = Element.prototype.scrollTo = function () {
153
- if (arguments[0] === undefined) {
154
- return;
155
- }
156
- if (shouldBailOut(arguments[0]) === true) {
157
- if (typeof arguments[0] === 'number' && arguments[1] === undefined) {
158
- throw new SyntaxError('Value could not be converted');
159
- }
160
- original.elementScroll.call(this, arguments[0].left !== undefined
161
- ? ~~arguments[0].left
162
- : typeof arguments[0] !== 'object'
163
- ? ~~arguments[0]
164
- : this.scrollLeft, arguments[0].top !== undefined
165
- ? ~~arguments[0].top
166
- : arguments[1] !== undefined
167
- ? ~~arguments[1]
168
- : this.scrollTop);
169
- return;
170
- }
171
- var left = arguments[0].left;
172
- var top = arguments[0].top;
173
- smoothScroll.call(this, this, typeof left === 'undefined' ? this.scrollLeft : ~~left, typeof top === 'undefined' ? this.scrollTop : ~~top);
174
- };
175
- Element.prototype.scrollBy = function () {
176
- if (arguments[0] === undefined) {
177
- return;
178
- }
179
- if (shouldBailOut(arguments[0]) === true) {
180
- original.elementScroll.call(this, arguments[0].left !== undefined
181
- ? ~~arguments[0].left + this.scrollLeft
182
- : ~~arguments[0] + this.scrollLeft, arguments[0].top !== undefined
183
- ? ~~arguments[0].top + this.scrollTop
184
- : ~~arguments[1] + this.scrollTop);
185
- return;
186
- }
187
- this.scroll({
188
- left: ~~arguments[0].left + this.scrollLeft,
189
- top: ~~arguments[0].top + this.scrollTop,
190
- behavior: arguments[0].behavior,
191
- });
192
- };
193
- Element.prototype.scrollIntoView = function () {
194
- if (shouldBailOut(arguments[0]) === true) {
195
- original.scrollIntoView.call(this, arguments[0] === undefined ? true : arguments[0]);
196
- return;
197
- }
198
- var scrollableParent = findScrollableParent(this);
199
- var parentRects = scrollableParent.getBoundingClientRect();
200
- var clientRects = this.getBoundingClientRect();
201
- if (scrollableParent !== d.body) {
202
- smoothScroll.call(this, scrollableParent, scrollableParent.scrollLeft + clientRects.left - parentRects.left, scrollableParent.scrollTop + clientRects.top - parentRects.top);
203
- if (w.getComputedStyle(scrollableParent).position !== 'fixed') {
204
- w.scrollBy({
205
- left: parentRects.left,
206
- top: parentRects.top,
207
- behavior: 'smooth',
208
- });
209
- }
210
- }
211
- else {
212
- w.scrollBy({
213
- left: clientRects.left,
214
- top: clientRects.top,
215
- behavior: 'smooth',
216
- });
217
- }
218
- };
1
+ function polyfill(w = window, d = document) {
2
+ if ('scrollBehavior' in d.documentElement.style &&
3
+ w.__forceSmoothScrollPolyfill__ !== true) {
4
+ return;
5
+ }
6
+ const Element = w.HTMLElement || w.Element;
7
+ const SCROLL_TIME = 468;
8
+ const original = {
9
+ scroll: w.scroll || w.scrollTo,
10
+ scrollBy: w.scrollBy,
11
+ elementScroll: Element.prototype.scroll || scrollElement,
12
+ scrollIntoView: Element.prototype.scrollIntoView,
13
+ };
14
+ const now = w.performance && w.performance.now
15
+ ? w.performance.now.bind(w.performance)
16
+ : Date.now;
17
+ function isMicrosoftBrowser(userAgent) {
18
+ const userAgentPatterns = ['MSIE ', 'Trident/', 'Edge/'];
19
+ return new RegExp(userAgentPatterns.join('|')).test(userAgent);
20
+ }
21
+ const ROUNDING_TOLERANCE = isMicrosoftBrowser(w.navigator.userAgent) ? 1 : 0;
22
+ function scrollElement(x, y) {
23
+ this.scrollLeft = x;
24
+ this.scrollTop = y;
25
+ }
26
+ function ease(k) {
27
+ return 0.5 * (1 - Math.cos(Math.PI * k));
28
+ }
29
+ function shouldBailOut(firstArg) {
30
+ if (firstArg === null ||
31
+ typeof firstArg !== 'object' ||
32
+ firstArg.behavior === undefined ||
33
+ firstArg.behavior === 'auto' ||
34
+ firstArg.behavior === 'instant') {
35
+ return true;
36
+ }
37
+ if (typeof firstArg === 'object' && firstArg.behavior === 'smooth') {
38
+ return false;
39
+ }
40
+ throw new TypeError('behavior member of ScrollOptions ' +
41
+ firstArg.behavior +
42
+ ' is not a valid value for enumeration ScrollBehavior.');
43
+ }
44
+ function hasScrollableSpace(el, axis) {
45
+ if (axis === 'Y') {
46
+ return el.clientHeight + ROUNDING_TOLERANCE < el.scrollHeight;
47
+ }
48
+ if (axis === 'X') {
49
+ return el.clientWidth + ROUNDING_TOLERANCE < el.scrollWidth;
50
+ }
51
+ }
52
+ function canOverflow(el, axis) {
53
+ const overflowValue = w.getComputedStyle(el, null)['overflow' + axis];
54
+ return overflowValue === 'auto' || overflowValue === 'scroll';
55
+ }
56
+ function isScrollable(el) {
57
+ const isScrollableY = hasScrollableSpace(el, 'Y') && canOverflow(el, 'Y');
58
+ const isScrollableX = hasScrollableSpace(el, 'X') && canOverflow(el, 'X');
59
+ return isScrollableY || isScrollableX;
60
+ }
61
+ function findScrollableParent(el) {
62
+ while (el !== d.body && isScrollable(el) === false) {
63
+ el = el.parentNode || el.host;
64
+ }
65
+ return el;
66
+ }
67
+ function step(context) {
68
+ const time = now();
69
+ let value;
70
+ let currentX;
71
+ let currentY;
72
+ let elapsed = (time - context.startTime) / SCROLL_TIME;
73
+ elapsed = elapsed > 1 ? 1 : elapsed;
74
+ value = ease(elapsed);
75
+ currentX = context.startX + (context.x - context.startX) * value;
76
+ currentY = context.startY + (context.y - context.startY) * value;
77
+ context.method.call(context.scrollable, currentX, currentY);
78
+ if (currentX !== context.x || currentY !== context.y) {
79
+ w.requestAnimationFrame(step.bind(w, context));
80
+ }
81
+ }
82
+ function smoothScroll(el, x, y) {
83
+ let scrollable;
84
+ let startX;
85
+ let startY;
86
+ let method;
87
+ const startTime = now();
88
+ if (el === d.body) {
89
+ scrollable = w;
90
+ startX = w.scrollX || w.pageXOffset;
91
+ startY = w.scrollY || w.pageYOffset;
92
+ method = original.scroll;
93
+ }
94
+ else {
95
+ scrollable = el;
96
+ startX = el.scrollLeft;
97
+ startY = el.scrollTop;
98
+ method = scrollElement;
99
+ }
100
+ step({
101
+ scrollable: scrollable,
102
+ method: method,
103
+ startTime: startTime,
104
+ startX: startX,
105
+ startY: startY,
106
+ x: x,
107
+ y: y,
108
+ });
109
+ }
110
+ w.scroll = w.scrollTo = function () {
111
+ if (arguments[0] === undefined) {
112
+ return;
113
+ }
114
+ if (shouldBailOut(arguments[0]) === true) {
115
+ original.scroll.call(w, arguments[0].left !== undefined
116
+ ? arguments[0].left
117
+ : typeof arguments[0] !== 'object'
118
+ ? arguments[0]
119
+ : w.scrollX || w.pageXOffset, arguments[0].top !== undefined
120
+ ? arguments[0].top
121
+ : arguments[1] !== undefined
122
+ ? arguments[1]
123
+ : w.scrollY || w.pageYOffset);
124
+ return;
125
+ }
126
+ smoothScroll.call(w, d.body, arguments[0].left !== undefined
127
+ ? ~~arguments[0].left
128
+ : w.scrollX || w.pageXOffset, arguments[0].top !== undefined
129
+ ? ~~arguments[0].top
130
+ : w.scrollY || w.pageYOffset);
131
+ };
132
+ w.scrollBy = function () {
133
+ if (arguments[0] === undefined) {
134
+ return;
135
+ }
136
+ if (shouldBailOut(arguments[0])) {
137
+ original.scrollBy.call(w, arguments[0].left !== undefined
138
+ ? arguments[0].left
139
+ : typeof arguments[0] !== 'object'
140
+ ? arguments[0]
141
+ : 0, arguments[0].top !== undefined
142
+ ? arguments[0].top
143
+ : arguments[1] !== undefined
144
+ ? arguments[1]
145
+ : 0);
146
+ return;
147
+ }
148
+ smoothScroll.call(w, d.body, ~~arguments[0].left + (w.scrollX || w.pageXOffset), ~~arguments[0].top + (w.scrollY || w.pageYOffset));
149
+ };
150
+ Element.prototype.scroll = Element.prototype.scrollTo = function () {
151
+ if (arguments[0] === undefined) {
152
+ return;
153
+ }
154
+ if (shouldBailOut(arguments[0]) === true) {
155
+ if (typeof arguments[0] === 'number' && arguments[1] === undefined) {
156
+ throw new SyntaxError('Value could not be converted');
157
+ }
158
+ original.elementScroll.call(this, arguments[0].left !== undefined
159
+ ? ~~arguments[0].left
160
+ : typeof arguments[0] !== 'object'
161
+ ? ~~arguments[0]
162
+ : this.scrollLeft, arguments[0].top !== undefined
163
+ ? ~~arguments[0].top
164
+ : arguments[1] !== undefined
165
+ ? ~~arguments[1]
166
+ : this.scrollTop);
167
+ return;
168
+ }
169
+ const left = arguments[0].left;
170
+ const top = arguments[0].top;
171
+ smoothScroll.call(this, this, typeof left === 'undefined' ? this.scrollLeft : ~~left, typeof top === 'undefined' ? this.scrollTop : ~~top);
172
+ };
173
+ Element.prototype.scrollBy = function () {
174
+ if (arguments[0] === undefined) {
175
+ return;
176
+ }
177
+ if (shouldBailOut(arguments[0]) === true) {
178
+ original.elementScroll.call(this, arguments[0].left !== undefined
179
+ ? ~~arguments[0].left + this.scrollLeft
180
+ : ~~arguments[0] + this.scrollLeft, arguments[0].top !== undefined
181
+ ? ~~arguments[0].top + this.scrollTop
182
+ : ~~arguments[1] + this.scrollTop);
183
+ return;
184
+ }
185
+ this.scroll({
186
+ left: ~~arguments[0].left + this.scrollLeft,
187
+ top: ~~arguments[0].top + this.scrollTop,
188
+ behavior: arguments[0].behavior,
189
+ });
190
+ };
191
+ Element.prototype.scrollIntoView = function () {
192
+ if (shouldBailOut(arguments[0]) === true) {
193
+ original.scrollIntoView.call(this, arguments[0] === undefined ? true : arguments[0]);
194
+ return;
195
+ }
196
+ const scrollableParent = findScrollableParent(this);
197
+ const parentRects = scrollableParent.getBoundingClientRect();
198
+ const clientRects = this.getBoundingClientRect();
199
+ if (scrollableParent !== d.body) {
200
+ smoothScroll.call(this, scrollableParent, scrollableParent.scrollLeft + clientRects.left - parentRects.left, scrollableParent.scrollTop + clientRects.top - parentRects.top);
201
+ if (w.getComputedStyle(scrollableParent).position !== 'fixed') {
202
+ w.scrollBy({
203
+ left: parentRects.left,
204
+ top: parentRects.top,
205
+ behavior: 'smooth',
206
+ });
207
+ }
208
+ }
209
+ else {
210
+ w.scrollBy({
211
+ left: clientRects.left,
212
+ top: clientRects.top,
213
+ behavior: 'smooth',
214
+ });
215
+ }
216
+ };
219
217
  }
220
218
 
221
219
  export { polyfill };
@@ -1,8 +1,8 @@
1
- var rules = function (blockClass) { return [
2
- ".".concat(blockClass, " { background: currentColor }"),
3
- 'noscript { display: none !important; }',
4
- ".".concat(blockClass, " { background: currentColor; border-radius: 5px; }"),
5
- ".".concat(blockClass, ":hover::after {content: 'Redacted'; color: white; background: black; text-align: center; width: 100%; display: block;}"),
6
- ]; };
1
+ const rules = (blockClass) => [
2
+ `.${blockClass} { background: currentColor }`,
3
+ 'noscript { display: none !important; }',
4
+ `.${blockClass} { background: currentColor; border-radius: 5px; }`,
5
+ `.${blockClass}:hover::after {content: 'Redacted'; color: white; background: black; text-align: center; width: 100%; display: block;}`,
6
+ ];
7
7
 
8
- export default rules;
8
+ export { rules as default };