@gemx-dev/clarity-visualize 0.8.42 → 0.8.45
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/package.json +2 -2
- package/src/data.ts +8 -8
- package/src/enrich.ts +7 -7
- package/src/heatmap.ts +1 -1
- package/src/interaction.ts +18 -15
- package/src/layout.ts +25 -25
- package/src/visualizer.ts +65 -61
- package/types/index.d.ts +1 -1
- package/types/visualize.d.ts +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gemx-dev/clarity-visualize",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.45",
|
|
4
4
|
"description": "Clarity visualize",
|
|
5
5
|
"author": "Microsoft Corp.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"unpkg": "build/clarity.visualize.min.js",
|
|
10
10
|
"types": "types/index.d.ts",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@gemx-dev/clarity-decode": "^0.8.
|
|
12
|
+
"@gemx-dev/clarity-decode": "^0.8.45"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@rollup/plugin-commonjs": "^24.0.0",
|
package/src/data.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Data, Layout } from "clarity-js";
|
|
2
|
-
import type { Data as DecodedData, Layout as DecodedLayout } from "clarity-decode";
|
|
1
|
+
import { Data, Layout } from "@gemx-dev/clarity-js";
|
|
2
|
+
import type { Data as DecodedData, Layout as DecodedLayout } from "@gemx-dev/clarity-decode";
|
|
3
3
|
import { PlaybackState, RegionState } from "@clarity-types/visualize";
|
|
4
4
|
|
|
5
5
|
export class DataHelper {
|
|
@@ -34,17 +34,17 @@ export class DataHelper {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
public metric = (event: DecodedData.MetricEvent): void => {
|
|
37
|
-
if (this.state.options.metadata) {
|
|
37
|
+
if (this.state.options.metadata) {
|
|
38
38
|
let metricMarkup = [];
|
|
39
39
|
let regionMarkup = [];
|
|
40
40
|
// Copy over metrics for future reference
|
|
41
41
|
for (let m in event.data) {
|
|
42
|
-
const eventType = typeof event.data[m];
|
|
42
|
+
const eventType = typeof event.data[m];
|
|
43
43
|
if (eventType === "number" || (event.event === Data.Event.Dimension && m === Data.Dimension.InteractionNextPaint.toString())) {
|
|
44
44
|
if (!(m in this.metrics)) { this.metrics[m] = 0; }
|
|
45
45
|
let key = parseInt(m, 10);
|
|
46
46
|
let value = eventType === "object" ? Number(event.data[m]?.[0]) : event.data[m];
|
|
47
|
-
if (m in DataHelper.METRIC_MAP && (DataHelper.METRIC_MAP[m].unit === "html-price" ||DataHelper.METRIC_MAP[m].unit === "ld-price")) {
|
|
47
|
+
if (m in DataHelper.METRIC_MAP && (DataHelper.METRIC_MAP[m].unit === "html-price" ||DataHelper.METRIC_MAP[m].unit === "ld-price")) {
|
|
48
48
|
this.metrics[m] = value;
|
|
49
49
|
} else { this.metrics[m] += value; }
|
|
50
50
|
this.lean = key === Data.Metric.Playback && value === 0 ? true : this.lean;
|
|
@@ -74,7 +74,7 @@ export class DataHelper {
|
|
|
74
74
|
public region(event: DecodedLayout.RegionEvent): void {
|
|
75
75
|
let data = event.data;
|
|
76
76
|
for (let r of data) {
|
|
77
|
-
if (!(r.name in this.regions)) {
|
|
77
|
+
if (!(r.name in this.regions)) {
|
|
78
78
|
this.regions[r.name] = { interaction: r.interaction , visibility: r.visibility }
|
|
79
79
|
}
|
|
80
80
|
this.regionMap[r.id] = r.name;
|
|
@@ -83,8 +83,8 @@ export class DataHelper {
|
|
|
83
83
|
|
|
84
84
|
private key = (unit: string): string => {
|
|
85
85
|
switch (unit) {
|
|
86
|
-
case "html-price":
|
|
87
|
-
case "ld-price":
|
|
86
|
+
case "html-price":
|
|
87
|
+
case "ld-price":
|
|
88
88
|
case "cls":
|
|
89
89
|
return Data.Constant.Empty;
|
|
90
90
|
default: return unit;
|
package/src/enrich.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { helper, Layout } from "clarity-js";
|
|
2
|
-
import { Layout as DecodedLayout } from "clarity-decode";
|
|
1
|
+
import { helper, Layout } from "@gemx-dev/clarity-js";
|
|
2
|
+
import { Layout as DecodedLayout } from "@gemx-dev/clarity-decode";
|
|
3
3
|
import { NodeData } from "@clarity-types/visualize";
|
|
4
4
|
|
|
5
5
|
export class EnrichHelper {
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
children: { [key: number]: number[] };
|
|
8
8
|
nodes: { [key: number]: NodeData };
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
constructor() {
|
|
11
11
|
this.reset();
|
|
12
12
|
}
|
|
@@ -51,7 +51,7 @@ export class EnrichHelper {
|
|
|
51
51
|
let selectorAlpha = helper.selector.get(input, Layout.Selector.Alpha);
|
|
52
52
|
d.selectorAlpha = selectorAlpha.length > 0 ? selectorAlpha : null;
|
|
53
53
|
d.hashAlpha = selectorAlpha.length > 0 ? helper.hash(d.selectorAlpha) : null;
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
// Get beta selector
|
|
56
56
|
let selectorBeta = helper.selector.get(input, Layout.Selector.Beta);
|
|
57
57
|
d.selectorBeta = selectorBeta.length > 0 ? selectorBeta : null;
|
|
@@ -61,11 +61,11 @@ export class EnrichHelper {
|
|
|
61
61
|
node.alpha = selectorAlpha;
|
|
62
62
|
node.beta = selectorBeta;
|
|
63
63
|
this.nodes[d.id] = node;
|
|
64
|
-
if (d.parent) { this.children[d.parent] = children; }
|
|
64
|
+
if (d.parent) { this.children[d.parent] = children; }
|
|
65
65
|
});
|
|
66
66
|
return event;
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
|
|
69
69
|
private position = (id: number, tag: string, child: NodeData, children: number[], siblings: NodeData[]): number => {
|
|
70
70
|
child.position = 1;
|
|
71
71
|
let idx = children ? children.indexOf(id) : -1;
|
package/src/heatmap.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Activity, Constant, Heatmap, Setting, ScrollMapInfo, PlaybackState } from "@clarity-types/visualize";
|
|
2
|
-
import { Data } from "clarity-js";
|
|
2
|
+
import { Data } from "@gemx-dev/clarity-js";
|
|
3
3
|
import { LayoutHelper } from "./layout";
|
|
4
4
|
|
|
5
5
|
export class HeatmapHelper {
|
package/src/interaction.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Asset, Constant, PlaybackState, Point, Setting } from "@clarity-types/visualize";
|
|
2
|
-
import { Data, Layout } from "clarity-js";
|
|
3
|
-
import type { Interaction } from "clarity-decode"
|
|
2
|
+
import { Data, Layout } from "@gemx-dev/clarity-js";
|
|
3
|
+
import type { Interaction } from "@gemx-dev/clarity-decode"
|
|
4
4
|
import { LayoutHelper } from "./layout";
|
|
5
5
|
import pointerSvg from "./styles/pointer/pointerIcon.svg";
|
|
6
6
|
import clickStyle from "./styles/pointer/click.css";
|
|
7
|
-
import { BooleanFlag } from "clarity-decode/types/data";
|
|
8
|
-
import { ClickVizualizationData } from "clarity-decode/types/interaction";
|
|
7
|
+
import { BooleanFlag } from "@gemx-dev/clarity-decode/types/data";
|
|
8
|
+
import { ClickVizualizationData } from "@gemx-dev/clarity-decode/types/interaction";
|
|
9
9
|
|
|
10
10
|
export class InteractionHelper {
|
|
11
11
|
static TRAIL_START_COLOR = [242, 97, 12]; // rgb(242,97,12)
|
|
@@ -54,8 +54,8 @@ export class InteractionHelper {
|
|
|
54
54
|
|
|
55
55
|
// Position canvas relative to scroll events on the parent page
|
|
56
56
|
if (scrollTarget === de || scrollTarget === doc.body) {
|
|
57
|
-
if (!scrollable) {
|
|
58
|
-
this.state.window.scrollTo(data.x, data.y);
|
|
57
|
+
if (!scrollable) {
|
|
58
|
+
this.state.window.scrollTo(data.x, data.y);
|
|
59
59
|
}
|
|
60
60
|
let canvas = this.overlay();
|
|
61
61
|
if (canvas) {
|
|
@@ -115,6 +115,9 @@ export class InteractionHelper {
|
|
|
115
115
|
case "radio":
|
|
116
116
|
el.checked = data.value === "true";
|
|
117
117
|
break;
|
|
118
|
+
case "file":
|
|
119
|
+
// We cannot set value for files, only allowed to be an empty string when programatically set
|
|
120
|
+
break;
|
|
118
121
|
default:
|
|
119
122
|
el.value = data.value;
|
|
120
123
|
break;
|
|
@@ -192,11 +195,11 @@ export class InteractionHelper {
|
|
|
192
195
|
this.state.options.onclickMismatch({
|
|
193
196
|
time: event.time,
|
|
194
197
|
x: data.x,
|
|
195
|
-
y: data.y,
|
|
198
|
+
y: data.y,
|
|
196
199
|
nodeId: data.target as number});
|
|
197
200
|
}
|
|
198
201
|
}
|
|
199
|
-
|
|
202
|
+
|
|
200
203
|
p.className = Constant.PointerNone;
|
|
201
204
|
break;
|
|
202
205
|
case Data.Event.DoubleClick:
|
|
@@ -248,7 +251,7 @@ export class InteractionHelper {
|
|
|
248
251
|
this.fadeOutElement(click.click, click.doc);
|
|
249
252
|
this.visualizedClicks.splice(this.visualizedClicks.indexOf(click), 1);
|
|
250
253
|
});
|
|
251
|
-
}
|
|
254
|
+
}
|
|
252
255
|
}
|
|
253
256
|
|
|
254
257
|
private fadeOutElement = (element: HTMLElement, document: HTMLElement): void => {
|
|
@@ -313,7 +316,7 @@ export class InteractionHelper {
|
|
|
313
316
|
let de = doc.documentElement;
|
|
314
317
|
let click = doc.createElement("DIV");
|
|
315
318
|
click.className = Constant.ClickLayer;
|
|
316
|
-
|
|
319
|
+
|
|
317
320
|
click.setAttribute(Constant.Title, `${title} (${x}${Constant.Pixel}, ${y}${Constant.Pixel})`);
|
|
318
321
|
click.style.left = (x - Setting.ClickRadius / 2) + Constant.Pixel;
|
|
319
322
|
click.style.top = (y - Setting.ClickRadius / 2) + Constant.Pixel
|
|
@@ -331,18 +334,18 @@ export class InteractionHelper {
|
|
|
331
334
|
let center = doc.createElement("DIV");
|
|
332
335
|
center.className = `${Constant.ClickLayer}-center`;
|
|
333
336
|
click.appendChild(center);
|
|
334
|
-
} else {
|
|
337
|
+
} else {
|
|
335
338
|
// Second pulsating ring
|
|
336
339
|
let ringTwo = ringOne.cloneNode() as HTMLElement;
|
|
337
340
|
ringTwo.style.animation = "pulsate-two 1 1s";
|
|
338
341
|
click.appendChild(ringTwo);
|
|
339
342
|
}
|
|
340
343
|
de.appendChild(click);
|
|
341
|
-
|
|
344
|
+
|
|
342
345
|
// Play sound
|
|
343
346
|
if (typeof Audio !== Constant.Undefined) {
|
|
344
|
-
if (this.clickAudio === null) {
|
|
345
|
-
this.clickAudio = new Audio(Asset.Sound);
|
|
347
|
+
if (this.clickAudio === null) {
|
|
348
|
+
this.clickAudio = new Audio(Asset.Sound);
|
|
346
349
|
click.appendChild(this.clickAudio);
|
|
347
350
|
}
|
|
348
351
|
this.clickAudio.play();
|
|
@@ -501,7 +504,7 @@ export class InteractionHelper {
|
|
|
501
504
|
return clickStyle;
|
|
502
505
|
} else {
|
|
503
506
|
return `.${Constant.ClickLayer}, .${Constant.ClickRing}, .${Constant.TouchLayer}, .${Constant.TouchRing} { position: absolute; z-index: ${Setting.ZIndex}; border-radius: 50%; background: radial-gradient(rgba(0,90,158,0.8), transparent); width: ${Setting.ClickRadius}px; height: ${Setting.ClickRadius}px;}` +
|
|
504
|
-
|
|
507
|
+
`.${Constant.ClickRing} { background: transparent; border: 1px solid rgba(0,90,158,0.8); }`;
|
|
505
508
|
}
|
|
506
509
|
}
|
|
507
510
|
}
|
package/src/layout.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Data, Layout } from "clarity-js";
|
|
2
|
-
import type { Layout as DecodedLayout } from "clarity-decode";
|
|
1
|
+
import { Data, Layout } from "@gemx-dev/clarity-js";
|
|
2
|
+
import type { Layout as DecodedLayout } from "@gemx-dev/clarity-decode";
|
|
3
3
|
import { Asset, Constant, type LinkHandler, NodeType, type PlaybackState, Setting } from "@clarity-types/visualize";
|
|
4
|
-
import { StyleSheetOperation } from "clarity-js/types/layout";
|
|
5
|
-
import { AnimationOperation } from "clarity-js/types/layout";
|
|
6
|
-
import { Constant as LayoutConstants } from "clarity-js/types/layout";
|
|
4
|
+
import { StyleSheetOperation } from "@gemx-dev/clarity-js/types/layout";
|
|
5
|
+
import { AnimationOperation } from "@gemx-dev/clarity-js/types/layout";
|
|
6
|
+
import { Constant as LayoutConstants } from "@gemx-dev/clarity-js/types/layout";
|
|
7
7
|
import sharedStyle from "./styles/shared.css";
|
|
8
8
|
|
|
9
9
|
/* BEGIN blobUnavailableSvgs */
|
|
@@ -418,13 +418,13 @@ export class LayoutHelper {
|
|
|
418
418
|
}));
|
|
419
419
|
} else if ((node.attributes["rel"].includes("preload") || node.attributes["rel"].includes("preconnect"))
|
|
420
420
|
&& (node.attributes?.as === "style" || node.attributes?.as === "font")) {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
421
|
+
this.fonts.push(new Promise((resolve: () => void): void => {
|
|
422
|
+
const proxy = useproxy ?? this.state.options.useproxy;
|
|
423
|
+
linkElement.href = proxy ? proxy(linkElement.href, linkElement.id, node.attributes.as) : linkElement.href;
|
|
424
|
+
linkElement.onload = linkElement.onerror = this.style.bind(this, linkElement, resolve);
|
|
425
|
+
setTimeout(resolve, LayoutHelper.TIMEOUT);
|
|
426
|
+
}));
|
|
427
|
+
}
|
|
428
428
|
}
|
|
429
429
|
insert(node, parent, linkElement, pivot);
|
|
430
430
|
break;
|
|
@@ -612,7 +612,7 @@ export class LayoutHelper {
|
|
|
612
612
|
node.setAttribute(`data-clarity-${attribute}`, v);
|
|
613
613
|
} else if (tag === Constant.ImageTag && attribute.indexOf("src") === 0 && ((v === null || v.length === 0 || v?.startsWith('blob:')))) {
|
|
614
614
|
if (this.vNext) {
|
|
615
|
-
if (v.startsWith('blob:')) {
|
|
615
|
+
if (v.startsWith('blob:')) {
|
|
616
616
|
if (data.width >= Setting.LargeSvg && data.height >= Setting.LargeSvg) {
|
|
617
617
|
node.setAttribute(Constant.BlobUnavailable, `${Constant.Large}${Constant.Beta}`);
|
|
618
618
|
} else {
|
|
@@ -626,12 +626,12 @@ export class LayoutHelper {
|
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
628
|
} else {
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
629
|
+
node.setAttribute(attribute, Asset.Transparent);
|
|
630
|
+
let size = Constant.Large;
|
|
631
|
+
if (data.width) {
|
|
632
|
+
size = data.width <= Setting.Medium ? Constant.Medium : (data.width <= Setting.Small ? Constant.Small : size);
|
|
633
|
+
}
|
|
634
|
+
node.setAttribute(Constant.Hide, size);
|
|
635
635
|
}
|
|
636
636
|
} else {
|
|
637
637
|
node.setAttribute(attribute, v);
|
|
@@ -692,7 +692,7 @@ export class LayoutHelper {
|
|
|
692
692
|
private getIframeUnavailableCss = (): string => {
|
|
693
693
|
if (this.vNext) {
|
|
694
694
|
return `${Constant.IFrameTag}[${Constant.UnavailableSmall}] { ${iframeUnavailableSvgSmall} }` +
|
|
695
|
-
|
|
695
|
+
`${Constant.IFrameTag}[${Constant.Unavailable}] { ${iframeUnavailableSvg[this.locale]} }`;
|
|
696
696
|
} else {
|
|
697
697
|
return `${Constant.IFrameTag}[${Constant.Unavailable}] { background: url(${Asset.Unavailable}) no-repeat center center, url('${Asset.Cross}'); }`;
|
|
698
698
|
}
|
|
@@ -701,7 +701,7 @@ export class LayoutHelper {
|
|
|
701
701
|
private getBlobUnavailableCss = (): string => {
|
|
702
702
|
if (this.vNext) {
|
|
703
703
|
return `${Constant.ImageTag}[${Constant.BlobUnavailable}=${Constant.Small}${Constant.Beta}] { ${blobUnavailableSvgSmall} }` +
|
|
704
|
-
|
|
704
|
+
`${Constant.ImageTag}[${Constant.BlobUnavailable}=${Constant.Large}${Constant.Beta}] { ${blobUnavailableSvg[this.locale]} }`;
|
|
705
705
|
}
|
|
706
706
|
return '';
|
|
707
707
|
}
|
|
@@ -709,12 +709,12 @@ export class LayoutHelper {
|
|
|
709
709
|
private getImageHiddenCss = (): string => {
|
|
710
710
|
if (this.vNext) {
|
|
711
711
|
return `${Constant.ImageTag}[${Constant.Hide}=${Constant.Small}${Constant.Beta}] { ${imageMaskedSvgSmall} }` +
|
|
712
|
-
|
|
712
|
+
`${Constant.ImageTag}[${Constant.Hide}=${Constant.Large}${Constant.Beta}] { ${imageMaskedSvg[this.locale]} }`;
|
|
713
713
|
} else {
|
|
714
714
|
return `${Constant.ImageTag}[${Constant.Hide}] { background-color: #CCC; background-image: url(${Asset.Hide}); background-repeat:no-repeat; background-position: center; }` +
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
715
|
+
`${Constant.ImageTag}[${Constant.Hide}=${Constant.Small}] { background-size: 18px 18px; }` +
|
|
716
|
+
`${Constant.ImageTag}[${Constant.Hide}=${Constant.Medium}] { background-size: 24px 24px; }` +
|
|
717
|
+
`${Constant.ImageTag}[${Constant.Hide}=${Constant.Large}] { background-size: 36px 36px; }`;
|
|
718
718
|
}
|
|
719
719
|
}
|
|
720
720
|
|
package/src/visualizer.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Activity, Constant, ErrorLogger, LinkHandler, MergedPayload, Options, PlaybackState, ScrollMapInfo, Setting, ShortCircuitStrategy, Visualizer as VisualizerType } from "@clarity-types/visualize";
|
|
2
|
-
import { Data } from "clarity-js";
|
|
3
|
-
import type { Data as DecodedData, Interaction, Layout } from "clarity-decode";
|
|
2
|
+
import { Data } from "@gemx-dev/clarity-js";
|
|
3
|
+
import type { Data as DecodedData, Interaction, Layout } from "@gemx-dev/clarity-decode";
|
|
4
4
|
import { DataHelper } from "./data";
|
|
5
5
|
import { EnrichHelper } from "./enrich";
|
|
6
6
|
import { HeatmapHelper } from "./heatmap";
|
|
7
7
|
import { InteractionHelper } from "./interaction";
|
|
8
8
|
import { LayoutHelper } from "./layout";
|
|
9
|
-
import { Dimension } from "clarity-js/types/data";
|
|
9
|
+
import { Dimension } from "@gemx-dev/clarity-js/types/data";
|
|
10
10
|
|
|
11
11
|
export class Visualizer implements VisualizerType {
|
|
12
12
|
_state: PlaybackState = null;
|
|
@@ -164,75 +164,79 @@ export class Visualizer implements VisualizerType {
|
|
|
164
164
|
this.interaction = new InteractionHelper(this.state, this.layout, options.vNext);
|
|
165
165
|
|
|
166
166
|
// If discover event was passed, render it now
|
|
167
|
-
if (options.dom) {
|
|
167
|
+
if (options.dom) {
|
|
168
168
|
await this.layout.dom(options.dom, options.useproxy);
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
return this;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
public render =
|
|
174
|
+
public render = (events: DecodedData.DecodedEvent[]): void => {
|
|
175
175
|
if (this.state === null) { throw new Error(`Initialize visualization by calling "setup" prior to making this call.`); }
|
|
176
176
|
let time = 0;
|
|
177
|
-
for (
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
break;
|
|
184
|
-
case Data.Event.Dimension:
|
|
185
|
-
if(entry.data[Dimension.InteractionNextPaint]){
|
|
177
|
+
for (const entry of events) {
|
|
178
|
+
try {
|
|
179
|
+
time = entry.time;
|
|
180
|
+
this.interaction.clearOldClickVisualizations(time);
|
|
181
|
+
switch (entry.event) {
|
|
182
|
+
case Data.Event.Metric:
|
|
186
183
|
this.data.metric(entry as DecodedData.MetricEvent);
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
184
|
+
break;
|
|
185
|
+
case Data.Event.Dimension:
|
|
186
|
+
if(entry.data[Dimension.InteractionNextPaint]){
|
|
187
|
+
this.data.metric(entry as DecodedData.MetricEvent);
|
|
188
|
+
}
|
|
189
|
+
break;
|
|
190
|
+
case Data.Event.Region:
|
|
191
|
+
this.data.region(entry as Layout.RegionEvent);
|
|
192
|
+
break;
|
|
193
|
+
case Data.Event.Mutation:
|
|
194
|
+
case Data.Event.Snapshot:
|
|
195
|
+
this.layout.markup(entry as Layout.DomEvent);
|
|
196
|
+
break;
|
|
197
|
+
case Data.Event.MouseDown:
|
|
198
|
+
case Data.Event.MouseUp:
|
|
199
|
+
case Data.Event.MouseMove:
|
|
200
|
+
case Data.Event.MouseWheel:
|
|
201
|
+
case Data.Event.Click:
|
|
202
|
+
case Data.Event.DoubleClick:
|
|
203
|
+
case Data.Event.TouchStart:
|
|
204
|
+
case Data.Event.TouchCancel:
|
|
205
|
+
case Data.Event.TouchEnd:
|
|
206
|
+
case Data.Event.TouchMove:
|
|
207
|
+
this.interaction.pointer(entry as Interaction.PointerEvent);
|
|
208
|
+
break;
|
|
209
|
+
case Data.Event.Visibility:
|
|
210
|
+
this.interaction.visibility(entry as Interaction.VisibilityEvent);
|
|
211
|
+
break;
|
|
212
|
+
case Data.Event.Input:
|
|
213
|
+
this.interaction.input(entry as Interaction.InputEvent);
|
|
214
|
+
break;
|
|
215
|
+
case Data.Event.Selection:
|
|
216
|
+
this.interaction.selection(entry as Interaction.SelectionEvent);
|
|
217
|
+
break;
|
|
218
|
+
case Data.Event.Resize:
|
|
219
|
+
this.interaction.resize(entry as Interaction.ResizeEvent);
|
|
220
|
+
break;
|
|
221
|
+
case Data.Event.Scroll:
|
|
222
|
+
this.interaction.scroll(entry as Interaction.ScrollEvent);
|
|
223
|
+
break;
|
|
224
|
+
case Data.Event.StyleSheetAdoption:
|
|
225
|
+
case Data.Event.StyleSheetUpdate:
|
|
226
|
+
this.layout.styleChange(entry as Layout.StyleSheetEvent);
|
|
227
|
+
break;
|
|
228
|
+
case Data.Event.Animation:
|
|
229
|
+
this.layout.animateChange(entry as Layout.AnimationEvent);
|
|
230
|
+
break;
|
|
231
|
+
case Data.Event.CustomElement:
|
|
232
|
+
this.layout.customElement(entry as Layout.CustomElementEvent);
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
catch (e) {
|
|
237
|
+
this._state.options.logerror?.(e);
|
|
233
238
|
}
|
|
234
239
|
}
|
|
235
|
-
|
|
236
240
|
if (events.length > 0) {
|
|
237
241
|
// Update pointer trail at the end of every frame
|
|
238
242
|
this.interaction.trail(time);
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MergedPayload, ResizeHandler, Visualize, Visualizer, ShortCircuitStrategy } from "./visualize";
|
|
2
|
-
import { Data, Diagnostic, Interaction, Layout } from "clarity-decode"
|
|
2
|
+
import { Data, Diagnostic, Interaction, Layout } from "@gemx-dev/clarity-decode"
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @deprecated Use Visualizer instead.
|
package/types/visualize.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Data, Layout } from "clarity-decode";
|
|
1
|
+
import { Data, Layout } from "@gemx-dev/clarity-decode";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @deprecated Use Visualizer instead.
|
|
@@ -25,7 +25,7 @@ export class Visualizer {
|
|
|
25
25
|
clearmap: () => void;
|
|
26
26
|
scrollmap: (data?: ScrollMapInfo[], averageFold?: number, addMarkers?: boolean) => void;
|
|
27
27
|
merge: (decoded: Data.DecodedPayload[]) => MergedPayload;
|
|
28
|
-
render: (events: Data.DecodedEvent[]) =>
|
|
28
|
+
render: (events: Data.DecodedEvent[]) => void;
|
|
29
29
|
setup: (target: Window, options: Options) => Promise<Visualizer>;
|
|
30
30
|
time: () => number;
|
|
31
31
|
get: (hash: string) => HTMLElement;
|
|
@@ -154,7 +154,7 @@ export const enum Constant {
|
|
|
154
154
|
Region = "clarity-region",
|
|
155
155
|
AdoptedStyleSheet = "clarity-adopted-style",
|
|
156
156
|
CustomStyleTag = "clarity-custom-styles",
|
|
157
|
-
Id = "data-clarity-id",
|
|
157
|
+
Id = "data-clarity-id",
|
|
158
158
|
HashAlpha = "data-clarity-hashalpha",
|
|
159
159
|
HashBeta = "data-clarity-hashbeta",
|
|
160
160
|
Hide = "data-clarity-hide",
|
|
@@ -164,14 +164,14 @@ export const enum Constant {
|
|
|
164
164
|
Suspend = "data-clarity-suspend",
|
|
165
165
|
Hidden = "hidden",
|
|
166
166
|
Visible = "visible",
|
|
167
|
-
None = "none",
|
|
167
|
+
None = "none",
|
|
168
168
|
Small = "s",
|
|
169
169
|
Medium = "m",
|
|
170
170
|
Large = "l",
|
|
171
171
|
Beta = "b",
|
|
172
172
|
Dom = "dom",
|
|
173
173
|
Context = "2d",
|
|
174
|
-
Pixel = "px",
|
|
174
|
+
Pixel = "px",
|
|
175
175
|
Separator = "X",
|
|
176
176
|
Absolute = "absolute",
|
|
177
177
|
Black = "black",
|