move browser-only rrdom features to the new rrdom package (#913)
This commit is contained in:
@@ -5,6 +5,5 @@ module.exports = {
|
||||
testMatch: ['**/**.test.ts'],
|
||||
moduleNameMapper: {
|
||||
'\\.css$': 'identity-obj-proxy',
|
||||
'rrdom/es/(.*)': 'rrdom/lib/$1',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
buildFromDom,
|
||||
diff,
|
||||
getDefaultSN,
|
||||
} from 'rrdom/es/virtual-dom';
|
||||
} from 'rrdom';
|
||||
import type {
|
||||
RRNode,
|
||||
RRElement,
|
||||
@@ -26,7 +26,7 @@ import type {
|
||||
ReplayerHandler,
|
||||
Mirror as RRDOMMirror,
|
||||
VirtualStyleRules,
|
||||
} from 'rrdom/es/virtual-dom';
|
||||
} from 'rrdom';
|
||||
import * as mittProxy from 'mitt';
|
||||
import { polyfill as smoothscrollPolyfill } from './smoothscroll';
|
||||
import { Timer } from './timer';
|
||||
@@ -731,7 +731,7 @@ export class Replayer {
|
||||
);
|
||||
}
|
||||
if (this.usingVirtualDom) {
|
||||
const styleEl = this.virtualDom.createElement('style') ;
|
||||
const styleEl = this.virtualDom.createElement('style');
|
||||
this.virtualDom.mirror.add(
|
||||
styleEl,
|
||||
getDefaultSN(styleEl, this.virtualDom.unserializedId),
|
||||
@@ -752,10 +752,7 @@ export class Replayer {
|
||||
head as HTMLHeadElement,
|
||||
);
|
||||
for (let idx = 0; idx < injectStylesRules.length; idx++) {
|
||||
(styleEl.sheet! ).insertRule(
|
||||
injectStylesRules[idx],
|
||||
idx,
|
||||
);
|
||||
styleEl.sheet!.insertRule(injectStylesRules[idx], idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1210,7 +1207,7 @@ export class Replayer {
|
||||
if (!target) {
|
||||
return this.debugNodeNotFound(d, d.id);
|
||||
}
|
||||
const styleSheet = ((target ) as HTMLStyleElement).sheet!;
|
||||
const styleSheet = (target as HTMLStyleElement).sheet!;
|
||||
d.adds?.forEach(({ rule, index: nestedIndex }) => {
|
||||
try {
|
||||
if (Array.isArray(nestedIndex)) {
|
||||
@@ -1692,7 +1689,7 @@ export class Replayer {
|
||||
}
|
||||
}
|
||||
} else if (attributeName === 'style') {
|
||||
const styleValues = value ;
|
||||
const styleValues = value;
|
||||
const targetEl = target as HTMLElement | RRElement;
|
||||
for (const s in styleValues) {
|
||||
if (styleValues[s] === false) {
|
||||
@@ -1772,7 +1769,7 @@ export class Replayer {
|
||||
const previousInMap = previousId && map[previousId];
|
||||
const nextInMap = nextId && map[nextId];
|
||||
if (previousInMap) {
|
||||
const { node, mutation } = previousInMap ;
|
||||
const { node, mutation } = previousInMap;
|
||||
parent.insertBefore(node as Node & RRNode, target as Node & RRNode);
|
||||
delete map[mutation.node.id];
|
||||
delete this.legacy_missingNodeRetryMap[mutation.node.id];
|
||||
@@ -1781,7 +1778,7 @@ export class Replayer {
|
||||
}
|
||||
}
|
||||
if (nextInMap) {
|
||||
const { node, mutation } = nextInMap ;
|
||||
const { node, mutation } = nextInMap;
|
||||
parent.insertBefore(
|
||||
node as Node & RRNode,
|
||||
target.nextSibling as Node & RRNode,
|
||||
|
||||
@@ -11,7 +11,7 @@ import type { PackFn, UnpackFn } from './packer/base';
|
||||
import type { IframeManager } from './record/iframe-manager';
|
||||
import type { ShadowDomManager } from './record/shadow-dom-manager';
|
||||
import type { Replayer } from './replay';
|
||||
import type { RRNode } from 'rrdom/es/virtual-dom';
|
||||
import type { RRNode } from 'rrdom';
|
||||
import type { CanvasManager } from './record/observers/canvas/canvas-manager';
|
||||
|
||||
export enum EventType {
|
||||
|
||||
@@ -11,7 +11,7 @@ import type {
|
||||
} from './types';
|
||||
import type { IMirror, Mirror } from 'rrweb-snapshot';
|
||||
import { isShadowRoot, IGNORED_NODE, classMatchesRegex } from 'rrweb-snapshot';
|
||||
import type { RRNode, RRIFrameElement } from 'rrdom/es/virtual-dom';
|
||||
import type { RRNode, RRIFrameElement } from 'rrdom';
|
||||
|
||||
export function on(
|
||||
type: string,
|
||||
|
||||
2
packages/rrweb/typings/replay/index.d.ts
vendored
2
packages/rrweb/typings/replay/index.d.ts
vendored
@@ -1,5 +1,5 @@
|
||||
import { Mirror } from 'rrweb-snapshot';
|
||||
import { RRDocument } from 'rrdom/es/virtual-dom';
|
||||
import { RRDocument } from 'rrdom';
|
||||
import { Timer } from './timer';
|
||||
import { createPlayerService, createSpeedService } from './machine';
|
||||
import { eventWithTime, playerConfig, playerMetaData, Handler } from '../types';
|
||||
|
||||
2
packages/rrweb/typings/types.d.ts
vendored
2
packages/rrweb/typings/types.d.ts
vendored
@@ -3,7 +3,7 @@ import type { PackFn, UnpackFn } from './packer/base';
|
||||
import type { IframeManager } from './record/iframe-manager';
|
||||
import type { ShadowDomManager } from './record/shadow-dom-manager';
|
||||
import type { Replayer } from './replay';
|
||||
import type { RRNode } from 'rrdom/es/virtual-dom';
|
||||
import type { RRNode } from 'rrdom';
|
||||
import type { CanvasManager } from './record/observers/canvas/canvas-manager';
|
||||
export declare enum EventType {
|
||||
DomContentLoaded = 0,
|
||||
|
||||
2
packages/rrweb/typings/utils.d.ts
vendored
2
packages/rrweb/typings/utils.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
import type { throttleOptions, listenerHandler, hookResetter, blockClass, addedNodeMutation, DocumentDimension, IWindow, DeprecatedMirror, textMutation } from './types';
|
||||
import type { IMirror, Mirror } from 'rrweb-snapshot';
|
||||
import type { RRNode, RRIFrameElement } from 'rrdom/es/virtual-dom';
|
||||
import type { RRNode, RRIFrameElement } from 'rrdom';
|
||||
export declare function on(type: string, fn: EventListenerOrEventListenerObject, target?: Document | IWindow): listenerHandler;
|
||||
export declare let _mirror: DeprecatedMirror;
|
||||
export declare function throttle<T>(func: (arg: T) => void, wait: number, options?: throttleOptions): (arg: T) => void;
|
||||
|
||||
Reference in New Issue
Block a user