* Move ids to weakmap * Fix typo * Move from INode to storing serialized data in mirror * Update packages/rrweb-snapshot/src/rebuild.ts Co-authored-by: Yun Feng <yun.feng@anu.edu.au> * Remove unnessisary `as Node` typecastings Fixes: https://github.com/rrweb-io/rrweb/pull/868#discussion_r842240758 * Remove unnessisary `as unknown as ...` * Remove unnessisary `as unknown as ...` * Reset mirror when recording starts Solves: https://github.com/rrweb-io/rrweb/pull/868#discussion_r842249599 * API has changed for snapshot, change test to reflect that * Allow for es5 compatibility * Remove unnessisary as unknown as ... and change test to reflect the API change * Refactor mirror to remove `nodeIdMap` Fixes: https://github.com/rrweb-io/rrweb/pull/868#discussion_r842732696 Co-authored-by: Yun Feng <yun.feng@anu.edu.au>
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
export declare enum StyleRuleType {
|
|
Insert = 0,
|
|
Remove = 1,
|
|
Snapshot = 2,
|
|
SetProperty = 3,
|
|
RemoveProperty = 4
|
|
}
|
|
declare type InsertRule = {
|
|
cssText: string;
|
|
type: StyleRuleType.Insert;
|
|
index?: number | number[];
|
|
};
|
|
declare type RemoveRule = {
|
|
type: StyleRuleType.Remove;
|
|
index: number | number[];
|
|
};
|
|
declare type SnapshotRule = {
|
|
type: StyleRuleType.Snapshot;
|
|
cssTexts: string[];
|
|
};
|
|
declare type SetPropertyRule = {
|
|
type: StyleRuleType.SetProperty;
|
|
index: number[];
|
|
property: string;
|
|
value: string | null;
|
|
priority: string | undefined;
|
|
};
|
|
declare type RemovePropertyRule = {
|
|
type: StyleRuleType.RemoveProperty;
|
|
index: number[];
|
|
property: string;
|
|
};
|
|
export declare type VirtualStyleRules = Array<InsertRule | RemoveRule | SnapshotRule | SetPropertyRule | RemovePropertyRule>;
|
|
export declare type VirtualStyleRulesMap = Map<Node, VirtualStyleRules>;
|
|
export declare function getNestedRule(rules: CSSRuleList, position: number[]): CSSGroupingRule;
|
|
export declare function getPositionsAndIndex(nestedIndex: number[]): {
|
|
positions: number[];
|
|
index: number | undefined;
|
|
};
|
|
export declare function applyVirtualStyleRulesToNode(storedRules: VirtualStyleRules, styleNode: HTMLStyleElement): void;
|
|
export declare function storeCSSRules(parentElement: HTMLStyleElement, virtualStyleRulesMap: VirtualStyleRulesMap): void;
|
|
export {};
|