@gemx-dev/clarity-visualize 0.8.62 → 0.8.64
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/build/clarity.visualize.js +228 -115
- package/build/clarity.visualize.min.js +1 -1
- package/build/clarity.visualize.module.js +228 -115
- package/package.json +2 -2
- package/src/heatmap.ts +65 -6
- package/src/visualizer.ts +14 -2
- package/types/visualize.d.ts +2 -0
package/src/visualizer.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Activity, Constant, ErrorLogger, LinkHandler, MergedPayload, Options, PlaybackState, ScrollMapInfo, Setting, ShortCircuitStrategy, Visualizer as VisualizerType } from "@clarity-types/visualize";
|
|
2
|
-
import { Data } from "@gemx-dev/clarity-js";
|
|
3
1
|
import type { Data as DecodedData, Interaction, Layout } from "@gemx-dev/clarity-decode";
|
|
2
|
+
|
|
3
|
+
import { Activity, Constant, ErrorLogger, LinkHandler, MergedPayload, Options, PlaybackState, ScrollMapInfo, Setting, ShortCircuitStrategy, Visualizer as VisualizerType } from "@clarity-types/visualize";
|
|
4
|
+
import { Data, helper } from "@gemx-dev/clarity-js";
|
|
4
5
|
import { DataHelper } from "./data";
|
|
5
6
|
import { EnrichHelper } from "./enrich";
|
|
6
7
|
import { HeatmapHelper } from "./heatmap";
|
|
@@ -12,6 +13,7 @@ export class Visualizer implements VisualizerType {
|
|
|
12
13
|
_state: PlaybackState = null;
|
|
13
14
|
renderTime = 0;
|
|
14
15
|
hashFoundTime = -1;
|
|
16
|
+
_excludeClassNames: string[] = [];
|
|
15
17
|
|
|
16
18
|
enrich: EnrichHelper;
|
|
17
19
|
layout: LayoutHelper;
|
|
@@ -23,6 +25,11 @@ export class Visualizer implements VisualizerType {
|
|
|
23
25
|
return this._state;
|
|
24
26
|
}
|
|
25
27
|
|
|
28
|
+
public configure = (opts: { excludeClassNames?: string[] }): void => {
|
|
29
|
+
this._excludeClassNames = opts.excludeClassNames || [];
|
|
30
|
+
helper.selector.configure(this._excludeClassNames);
|
|
31
|
+
}
|
|
32
|
+
|
|
26
33
|
public dom = async (event: Layout.DomEvent): Promise<void> => {
|
|
27
34
|
await this.layout.dom(event);
|
|
28
35
|
}
|
|
@@ -116,6 +123,7 @@ export class Visualizer implements VisualizerType {
|
|
|
116
123
|
decoded = decoded.sort(this.sortPayloads);
|
|
117
124
|
// Re-initialize enrich class if someone ends up calling merge function directly
|
|
118
125
|
this.enrich = this.enrich || new EnrichHelper();
|
|
126
|
+
helper.selector.configure(this._excludeClassNames);
|
|
119
127
|
this.enrich.reset();
|
|
120
128
|
// Walk through payloads and generate merged payload from an array of decoded payloads
|
|
121
129
|
for (let payload of decoded) {
|
|
@@ -148,6 +156,10 @@ export class Visualizer implements VisualizerType {
|
|
|
148
156
|
|
|
149
157
|
public setup = async (target: Window, options: Options): Promise<Visualizer> => {
|
|
150
158
|
this.reset();
|
|
159
|
+
if (options.excludeClassNames) {
|
|
160
|
+
this._excludeClassNames = options.excludeClassNames;
|
|
161
|
+
helper.selector.configure(options.excludeClassNames);
|
|
162
|
+
}
|
|
151
163
|
// Infer options
|
|
152
164
|
options.pointer = "pointer" in options ? options.pointer : true;
|
|
153
165
|
options.canvas = "canvas" in options ? options.canvas : true;
|
package/types/visualize.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export class Visualizer {
|
|
|
27
27
|
merge: (decoded: Data.DecodedPayload[]) => MergedPayload;
|
|
28
28
|
render: (events: Data.DecodedEvent[]) => void;
|
|
29
29
|
setup: (target: Window, options: Options) => Promise<Visualizer>;
|
|
30
|
+
configure: (opts: { excludeClassNames?: string[] }) => void;
|
|
30
31
|
time: () => number;
|
|
31
32
|
get: (hash: string) => HTMLElement;
|
|
32
33
|
}
|
|
@@ -70,6 +71,7 @@ export interface Options {
|
|
|
70
71
|
mobile?: boolean;
|
|
71
72
|
vNext?: boolean;
|
|
72
73
|
locale?: string;
|
|
74
|
+
excludeClassNames?: string[];
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
export interface NodeData {
|