@posthog/rrweb 0.0.28 → 0.0.29
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/rrweb.cjs +128 -105
- package/dist/rrweb.cjs.map +1 -1
- package/dist/rrweb.js +128 -105
- package/dist/rrweb.js.map +1 -1
- package/dist/rrweb.umd.cjs +128 -105
- package/dist/rrweb.umd.cjs.map +3 -3
- package/dist/rrweb.umd.min.cjs +9 -9
- package/dist/rrweb.umd.min.cjs.map +3 -3
- package/package.json +1 -1
package/dist/rrweb.cjs
CHANGED
|
@@ -207,6 +207,91 @@ function isShadowRoot(n2) {
|
|
|
207
207
|
function isNativeShadowDom(shadowRoot2) {
|
|
208
208
|
return Object.prototype.toString.call(shadowRoot2) === "[object ShadowRoot]";
|
|
209
209
|
}
|
|
210
|
+
function fixBrowserCompatibilityIssuesInCSS(cssText) {
|
|
211
|
+
if (cssText.includes(" background-clip: text;") && !cssText.includes(" -webkit-background-clip: text;")) {
|
|
212
|
+
cssText = cssText.replace(
|
|
213
|
+
/\sbackground-clip:\s*text;/g,
|
|
214
|
+
" -webkit-background-clip: text; background-clip: text;"
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
return cssText;
|
|
218
|
+
}
|
|
219
|
+
function escapeImportStatement(rule2) {
|
|
220
|
+
const { cssText } = rule2;
|
|
221
|
+
if (cssText.split('"').length < 3) return cssText;
|
|
222
|
+
const statement = ["@import", `url(${JSON.stringify(rule2.href)})`];
|
|
223
|
+
if (rule2.layerName === "") {
|
|
224
|
+
statement.push(`layer`);
|
|
225
|
+
} else if (rule2.layerName) {
|
|
226
|
+
statement.push(`layer(${rule2.layerName})`);
|
|
227
|
+
}
|
|
228
|
+
if (rule2.supportsText) {
|
|
229
|
+
statement.push(`supports(${rule2.supportsText})`);
|
|
230
|
+
}
|
|
231
|
+
if (rule2.media.length) {
|
|
232
|
+
statement.push(rule2.media.mediaText);
|
|
233
|
+
}
|
|
234
|
+
return statement.join(" ") + ";";
|
|
235
|
+
}
|
|
236
|
+
function stringifyStylesheet(s2) {
|
|
237
|
+
try {
|
|
238
|
+
const rules2 = s2.rules || s2.cssRules;
|
|
239
|
+
if (!rules2) {
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
let sheetHref = s2.href;
|
|
243
|
+
if (!sheetHref && s2.ownerNode) {
|
|
244
|
+
sheetHref = s2.ownerNode.baseURI;
|
|
245
|
+
}
|
|
246
|
+
const stringifiedRules = Array.from(
|
|
247
|
+
rules2,
|
|
248
|
+
(rule2) => stringifyRule(rule2, sheetHref)
|
|
249
|
+
).join("");
|
|
250
|
+
return fixBrowserCompatibilityIssuesInCSS(stringifiedRules);
|
|
251
|
+
} catch (error) {
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
function stringifyRule(rule2, sheetHref) {
|
|
256
|
+
var _a2;
|
|
257
|
+
if (isCSSImportRule(rule2)) {
|
|
258
|
+
let importStringified;
|
|
259
|
+
try {
|
|
260
|
+
importStringified = // for same-origin stylesheets,
|
|
261
|
+
// we can access the imported stylesheet rules directly
|
|
262
|
+
stringifyStylesheet(rule2.styleSheet) || // work around browser issues with the raw string `@import url(...)` statement
|
|
263
|
+
escapeImportStatement(rule2);
|
|
264
|
+
} catch (error) {
|
|
265
|
+
importStringified = rule2.cssText;
|
|
266
|
+
}
|
|
267
|
+
try {
|
|
268
|
+
if (importStringified && ((_a2 = rule2.styleSheet) == null ? void 0 : _a2.href)) {
|
|
269
|
+
return absolutifyURLs(importStringified, rule2.styleSheet.href);
|
|
270
|
+
}
|
|
271
|
+
} catch {
|
|
272
|
+
}
|
|
273
|
+
return importStringified;
|
|
274
|
+
} else {
|
|
275
|
+
let ruleStringified = rule2.cssText;
|
|
276
|
+
if (isCSSStyleRule(rule2) && rule2.selectorText.includes(":")) {
|
|
277
|
+
ruleStringified = fixSafariColons(ruleStringified);
|
|
278
|
+
}
|
|
279
|
+
if (sheetHref) {
|
|
280
|
+
return absolutifyURLs(ruleStringified, sheetHref);
|
|
281
|
+
}
|
|
282
|
+
return ruleStringified;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
function fixSafariColons(cssStringified) {
|
|
286
|
+
const regex = /(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;
|
|
287
|
+
return cssStringified.replace(regex, "$1\\$2");
|
|
288
|
+
}
|
|
289
|
+
function isCSSImportRule(rule2) {
|
|
290
|
+
return "styleSheet" in rule2;
|
|
291
|
+
}
|
|
292
|
+
function isCSSStyleRule(rule2) {
|
|
293
|
+
return "selectorText" in rule2;
|
|
294
|
+
}
|
|
210
295
|
class Mirror {
|
|
211
296
|
constructor() {
|
|
212
297
|
__publicField$1(this, "idNodeMap", /* @__PURE__ */ new Map());
|
|
@@ -341,91 +426,6 @@ function extractFileExtension(path, baseURL) {
|
|
|
341
426
|
const match = url.pathname.match(regex);
|
|
342
427
|
return (match == null ? void 0 : match[1]) ?? null;
|
|
343
428
|
}
|
|
344
|
-
function fixBrowserCompatibilityIssuesInCSS(cssText) {
|
|
345
|
-
if (cssText.includes(" background-clip: text;") && !cssText.includes(" -webkit-background-clip: text;")) {
|
|
346
|
-
cssText = cssText.replace(
|
|
347
|
-
/\sbackground-clip:\s*text;/g,
|
|
348
|
-
" -webkit-background-clip: text; background-clip: text;"
|
|
349
|
-
);
|
|
350
|
-
}
|
|
351
|
-
return cssText;
|
|
352
|
-
}
|
|
353
|
-
function escapeImportStatement(rule2) {
|
|
354
|
-
const { cssText } = rule2;
|
|
355
|
-
if (cssText.split('"').length < 3) return cssText;
|
|
356
|
-
const statement = ["@import", `url(${JSON.stringify(rule2.href)})`];
|
|
357
|
-
if (rule2.layerName === "") {
|
|
358
|
-
statement.push(`layer`);
|
|
359
|
-
} else if (rule2.layerName) {
|
|
360
|
-
statement.push(`layer(${rule2.layerName})`);
|
|
361
|
-
}
|
|
362
|
-
if (rule2.supportsText) {
|
|
363
|
-
statement.push(`supports(${rule2.supportsText})`);
|
|
364
|
-
}
|
|
365
|
-
if (rule2.media.length) {
|
|
366
|
-
statement.push(rule2.media.mediaText);
|
|
367
|
-
}
|
|
368
|
-
return statement.join(" ") + ";";
|
|
369
|
-
}
|
|
370
|
-
function stringifyStylesheet(s2) {
|
|
371
|
-
try {
|
|
372
|
-
const rules2 = s2.rules || s2.cssRules;
|
|
373
|
-
if (!rules2) {
|
|
374
|
-
return null;
|
|
375
|
-
}
|
|
376
|
-
let sheetHref = s2.href;
|
|
377
|
-
if (!sheetHref && s2.ownerNode) {
|
|
378
|
-
sheetHref = s2.ownerNode.baseURI;
|
|
379
|
-
}
|
|
380
|
-
const stringifiedRules = Array.from(
|
|
381
|
-
rules2,
|
|
382
|
-
(rule2) => stringifyRule(rule2, sheetHref)
|
|
383
|
-
).join("");
|
|
384
|
-
return fixBrowserCompatibilityIssuesInCSS(stringifiedRules);
|
|
385
|
-
} catch (error) {
|
|
386
|
-
return null;
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
function stringifyRule(rule2, sheetHref) {
|
|
390
|
-
var _a2;
|
|
391
|
-
if (isCSSImportRule(rule2)) {
|
|
392
|
-
let importStringified;
|
|
393
|
-
try {
|
|
394
|
-
importStringified = // for same-origin stylesheets,
|
|
395
|
-
// we can access the imported stylesheet rules directly
|
|
396
|
-
stringifyStylesheet(rule2.styleSheet) || // work around browser issues with the raw string `@import url(...)` statement
|
|
397
|
-
escapeImportStatement(rule2);
|
|
398
|
-
} catch (error) {
|
|
399
|
-
importStringified = rule2.cssText;
|
|
400
|
-
}
|
|
401
|
-
try {
|
|
402
|
-
if (importStringified && ((_a2 = rule2.styleSheet) == null ? void 0 : _a2.href)) {
|
|
403
|
-
return absolutifyURLs(importStringified, rule2.styleSheet.href);
|
|
404
|
-
}
|
|
405
|
-
} catch {
|
|
406
|
-
}
|
|
407
|
-
return importStringified;
|
|
408
|
-
} else {
|
|
409
|
-
let ruleStringified = rule2.cssText;
|
|
410
|
-
if (isCSSStyleRule(rule2) && rule2.selectorText.includes(":")) {
|
|
411
|
-
ruleStringified = fixSafariColons(ruleStringified);
|
|
412
|
-
}
|
|
413
|
-
if (sheetHref) {
|
|
414
|
-
return absolutifyURLs(ruleStringified, sheetHref);
|
|
415
|
-
}
|
|
416
|
-
return ruleStringified;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
function fixSafariColons(cssStringified) {
|
|
420
|
-
const regex = /(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;
|
|
421
|
-
return cssStringified.replace(regex, "$1\\$2");
|
|
422
|
-
}
|
|
423
|
-
function isCSSImportRule(rule2) {
|
|
424
|
-
return "styleSheet" in rule2;
|
|
425
|
-
}
|
|
426
|
-
function isCSSStyleRule(rule2) {
|
|
427
|
-
return "selectorText" in rule2;
|
|
428
|
-
}
|
|
429
429
|
function extractOrigin(url) {
|
|
430
430
|
let origin = "";
|
|
431
431
|
if (url.indexOf("//") > -1) {
|
|
@@ -5332,22 +5332,6 @@ postcss$1.Input;
|
|
|
5332
5332
|
postcss$1.Rule;
|
|
5333
5333
|
postcss$1.Root;
|
|
5334
5334
|
postcss$1.Node;
|
|
5335
|
-
function adaptCssForReplay(cssText, cache) {
|
|
5336
|
-
const cachedStyle = cache == null ? void 0 : cache.stylesWithHoverClass.get(cssText);
|
|
5337
|
-
if (cachedStyle) return cachedStyle;
|
|
5338
|
-
let result2 = cssText;
|
|
5339
|
-
try {
|
|
5340
|
-
const ast = postcss$1([
|
|
5341
|
-
mediaSelectorPlugin,
|
|
5342
|
-
pseudoClassPlugin
|
|
5343
|
-
]).process(cssText, { parser: safeParser });
|
|
5344
|
-
result2 = ast.css;
|
|
5345
|
-
} catch (error) {
|
|
5346
|
-
console.warn("Failed to adapt css for replay", error);
|
|
5347
|
-
}
|
|
5348
|
-
cache == null ? void 0 : cache.stylesWithHoverClass.set(cssText, result2);
|
|
5349
|
-
return result2;
|
|
5350
|
-
}
|
|
5351
5335
|
const tagMap = {
|
|
5352
5336
|
script: "noscript",
|
|
5353
5337
|
// camel case svg element tag names
|
|
@@ -5395,6 +5379,22 @@ function getTagName(n2) {
|
|
|
5395
5379
|
}
|
|
5396
5380
|
return tagName;
|
|
5397
5381
|
}
|
|
5382
|
+
function adaptCssForReplay(cssText, cache) {
|
|
5383
|
+
const cachedStyle = cache == null ? void 0 : cache.stylesWithHoverClass.get(cssText);
|
|
5384
|
+
if (cachedStyle) return cachedStyle;
|
|
5385
|
+
let result2 = cssText;
|
|
5386
|
+
try {
|
|
5387
|
+
const ast = postcss$1([
|
|
5388
|
+
mediaSelectorPlugin,
|
|
5389
|
+
pseudoClassPlugin
|
|
5390
|
+
]).process(cssText, { parser: safeParser });
|
|
5391
|
+
result2 = ast.css;
|
|
5392
|
+
} catch (error) {
|
|
5393
|
+
console.warn("Failed to adapt css for replay", error);
|
|
5394
|
+
}
|
|
5395
|
+
cache == null ? void 0 : cache.stylesWithHoverClass.set(cssText, result2);
|
|
5396
|
+
return result2;
|
|
5397
|
+
}
|
|
5398
5398
|
function createCache() {
|
|
5399
5399
|
const stylesWithHoverClass = /* @__PURE__ */ new Map();
|
|
5400
5400
|
return {
|
|
@@ -12168,6 +12168,11 @@ class MutationBuffer {
|
|
|
12168
12168
|
this.shadowDomManager.reset();
|
|
12169
12169
|
this.canvasManager.reset();
|
|
12170
12170
|
}
|
|
12171
|
+
destroy() {
|
|
12172
|
+
while (this.mapRemoves.length) {
|
|
12173
|
+
this.mirror.removeNodeFromMap(this.mapRemoves.shift());
|
|
12174
|
+
}
|
|
12175
|
+
}
|
|
12171
12176
|
}
|
|
12172
12177
|
function deepDelete(addsSet, n2) {
|
|
12173
12178
|
addsSet.delete(n2);
|
|
@@ -13214,6 +13219,7 @@ function initObservers(o2, hooks = {}) {
|
|
|
13214
13219
|
);
|
|
13215
13220
|
}
|
|
13216
13221
|
return callbackWrapper(() => {
|
|
13222
|
+
mutationBuffers.forEach((b) => b.destroy());
|
|
13217
13223
|
mutationBuffers.forEach((b) => b.reset());
|
|
13218
13224
|
mutationObserver == null ? void 0 : mutationObserver.disconnect();
|
|
13219
13225
|
mousemoveHandler();
|
|
@@ -13552,6 +13558,8 @@ class IframeManager {
|
|
|
13552
13558
|
contentWindow.removeEventListener("message", handler);
|
|
13553
13559
|
});
|
|
13554
13560
|
this.nestedIframeListeners.clear();
|
|
13561
|
+
this.crossOriginIframeMirror.reset();
|
|
13562
|
+
this.crossOriginIframeStyleMirror.reset();
|
|
13555
13563
|
}
|
|
13556
13564
|
}
|
|
13557
13565
|
class ShadowDomManager {
|
|
@@ -14030,6 +14038,8 @@ class CanvasManager {
|
|
|
14030
14038
|
__publicField(this, "resetObservers");
|
|
14031
14039
|
__publicField(this, "frozen", false);
|
|
14032
14040
|
__publicField(this, "locked", false);
|
|
14041
|
+
__publicField(this, "rafIdTimestamp", null);
|
|
14042
|
+
__publicField(this, "rafIdFlush", null);
|
|
14033
14043
|
__publicField(this, "processMutation", (target, mutation) => {
|
|
14034
14044
|
const newFrame = this.rafStamps.invokeId && this.rafStamps.latestId !== this.rafStamps.invokeId;
|
|
14035
14045
|
if (newFrame || !this.rafStamps.invokeId)
|
|
@@ -14064,6 +14074,14 @@ class CanvasManager {
|
|
|
14064
14074
|
reset() {
|
|
14065
14075
|
this.pendingCanvasMutations.clear();
|
|
14066
14076
|
this.resetObservers && this.resetObservers();
|
|
14077
|
+
if (this.rafIdTimestamp !== null) {
|
|
14078
|
+
cancelAnimationFrame(this.rafIdTimestamp);
|
|
14079
|
+
this.rafIdTimestamp = null;
|
|
14080
|
+
}
|
|
14081
|
+
if (this.rafIdFlush !== null) {
|
|
14082
|
+
cancelAnimationFrame(this.rafIdFlush);
|
|
14083
|
+
this.rafIdFlush = null;
|
|
14084
|
+
}
|
|
14067
14085
|
}
|
|
14068
14086
|
freeze() {
|
|
14069
14087
|
this.frozen = true;
|
|
@@ -14214,14 +14232,16 @@ class CanvasManager {
|
|
|
14214
14232
|
};
|
|
14215
14233
|
}
|
|
14216
14234
|
startPendingCanvasMutationFlusher() {
|
|
14217
|
-
|
|
14235
|
+
this.rafIdFlush = requestAnimationFrame(
|
|
14236
|
+
() => this.flushPendingCanvasMutations()
|
|
14237
|
+
);
|
|
14218
14238
|
}
|
|
14219
14239
|
startRAFTimestamping() {
|
|
14220
14240
|
const setLatestRAFTimestamp = (timestamp) => {
|
|
14221
14241
|
this.rafStamps.latestId = timestamp;
|
|
14222
|
-
requestAnimationFrame(setLatestRAFTimestamp);
|
|
14242
|
+
this.rafIdTimestamp = requestAnimationFrame(setLatestRAFTimestamp);
|
|
14223
14243
|
};
|
|
14224
|
-
requestAnimationFrame(setLatestRAFTimestamp);
|
|
14244
|
+
this.rafIdTimestamp = requestAnimationFrame(setLatestRAFTimestamp);
|
|
14225
14245
|
}
|
|
14226
14246
|
flushPendingCanvasMutations() {
|
|
14227
14247
|
this.pendingCanvasMutations.forEach(
|
|
@@ -14230,7 +14250,9 @@ class CanvasManager {
|
|
|
14230
14250
|
this.flushPendingCanvasMutationFor(canvas, id);
|
|
14231
14251
|
}
|
|
14232
14252
|
);
|
|
14233
|
-
|
|
14253
|
+
this.rafIdFlush = requestAnimationFrame(
|
|
14254
|
+
() => this.flushPendingCanvasMutations()
|
|
14255
|
+
);
|
|
14234
14256
|
}
|
|
14235
14257
|
flushPendingCanvasMutationFor(canvas, id) {
|
|
14236
14258
|
if (this.frozen || this.locked) {
|
|
@@ -14809,6 +14831,7 @@ function record(options = {}) {
|
|
|
14809
14831
|
processedNodeManager.destroy();
|
|
14810
14832
|
iframeManager.removeLoadListener();
|
|
14811
14833
|
iframeManager.destroy();
|
|
14834
|
+
mirror.reset();
|
|
14812
14835
|
recording = false;
|
|
14813
14836
|
unregisterErrorHandler();
|
|
14814
14837
|
};
|