clarity-js 0.7.56 → 0.7.58
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.extended.js +1 -1
- package/build/clarity.insight.js +1 -1
- package/build/clarity.js +124 -56
- package/build/clarity.min.js +1 -1
- package/build/clarity.module.js +124 -56
- package/build/clarity.performance.js +1 -1
- package/package.json +1 -1
- package/src/core/config.ts +1 -0
- package/src/core/version.ts +1 -1
- package/src/data/metadata.ts +10 -3
- package/src/interaction/encode.ts +7 -1
- package/src/interaction/pointer.ts +19 -4
- package/src/interaction/resize.ts +9 -2
- package/src/layout/animation.ts +8 -1
- package/src/layout/mutation.ts +61 -30
- package/types/core.d.ts +1 -0
- package/types/interaction.d.ts +1 -0
- package/types/layout.d.ts +8 -2
package/build/clarity.js
CHANGED
|
@@ -138,6 +138,7 @@ var config$2 = {
|
|
|
138
138
|
throttleDom: true,
|
|
139
139
|
conversions: false,
|
|
140
140
|
longTask: 30,
|
|
141
|
+
includeSubdomains: true,
|
|
141
142
|
};
|
|
142
143
|
|
|
143
144
|
function api(method) {
|
|
@@ -165,7 +166,7 @@ function stop$F() {
|
|
|
165
166
|
startTime = 0;
|
|
166
167
|
}
|
|
167
168
|
|
|
168
|
-
var version$1 = "0.7.
|
|
169
|
+
var version$1 = "0.7.58";
|
|
169
170
|
|
|
170
171
|
// tslint:disable: no-bitwise
|
|
171
172
|
function hash (input, precision) {
|
|
@@ -1956,6 +1957,8 @@ function stop$r() {
|
|
|
1956
1957
|
|
|
1957
1958
|
var state$5 = [];
|
|
1958
1959
|
var timeout$5 = null;
|
|
1960
|
+
var activeTouchPointId = 0;
|
|
1961
|
+
var activeTouchPointIds = new Set();
|
|
1959
1962
|
function start$s() {
|
|
1960
1963
|
reset$f();
|
|
1961
1964
|
}
|
|
@@ -1998,13 +2001,25 @@ function touch(event, root, evt) {
|
|
|
1998
2001
|
var y = "clientY" in entry ? Math.round(entry["clientY"] + d.scrollTop) : null;
|
|
1999
2002
|
x = x && frame ? x + Math.round(frame.offsetLeft) : x;
|
|
2000
2003
|
y = y && frame ? y + Math.round(frame.offsetTop) : y;
|
|
2001
|
-
//
|
|
2002
|
-
//
|
|
2003
|
-
// tested in Chromium-based browsers as well as Firefox
|
|
2004
|
+
// We cannot rely on identifier to determine primary touch as its value doesn't always start with 0.
|
|
2005
|
+
// Safari/Webkit uses the address of the UITouch object as the identifier value for each touch point.
|
|
2004
2006
|
var id = "identifier" in entry ? entry["identifier"] : undefined;
|
|
2007
|
+
switch (event) {
|
|
2008
|
+
case 17 /* Event.TouchStart */:
|
|
2009
|
+
if (activeTouchPointIds.size === 0) {
|
|
2010
|
+
activeTouchPointId = id;
|
|
2011
|
+
}
|
|
2012
|
+
activeTouchPointIds.add(id);
|
|
2013
|
+
break;
|
|
2014
|
+
case 18 /* Event.TouchEnd */:
|
|
2015
|
+
case 20 /* Event.TouchCancel */:
|
|
2016
|
+
activeTouchPointIds.delete(id);
|
|
2017
|
+
break;
|
|
2018
|
+
}
|
|
2019
|
+
var isPrimary = activeTouchPointId === id;
|
|
2005
2020
|
// Check for null values before processing this event
|
|
2006
2021
|
if (x !== null && y !== null) {
|
|
2007
|
-
handler$2({ time: t, event: event, data: { target: target(evt), x: x, y: y, id: id } });
|
|
2022
|
+
handler$2({ time: t, event: event, data: { target: target(evt), x: x, y: y, id: id, isPrimary: isPrimary } });
|
|
2008
2023
|
}
|
|
2009
2024
|
}
|
|
2010
2025
|
}
|
|
@@ -2053,7 +2068,9 @@ function stop$q() {
|
|
|
2053
2068
|
|
|
2054
2069
|
var data$b;
|
|
2055
2070
|
var timeout$4 = null;
|
|
2071
|
+
var initialStateLogged = false;
|
|
2056
2072
|
function start$r() {
|
|
2073
|
+
initialStateLogged = false;
|
|
2057
2074
|
bind(window, "resize", recompute$5);
|
|
2058
2075
|
recompute$5();
|
|
2059
2076
|
}
|
|
@@ -2065,8 +2082,14 @@ function recompute$5() {
|
|
|
2065
2082
|
width: de && "clientWidth" in de ? Math.min(de.clientWidth, window.innerWidth) : window.innerWidth,
|
|
2066
2083
|
height: de && "clientHeight" in de ? Math.min(de.clientHeight, window.innerHeight) : window.innerHeight,
|
|
2067
2084
|
};
|
|
2068
|
-
|
|
2069
|
-
|
|
2085
|
+
if (initialStateLogged) {
|
|
2086
|
+
clearTimeout(timeout$4);
|
|
2087
|
+
timeout$4 = setTimeout(process$5, 500 /* Setting.LookAhead */, 11 /* Event.Resize */);
|
|
2088
|
+
}
|
|
2089
|
+
else {
|
|
2090
|
+
encode$3(11 /* Event.Resize */);
|
|
2091
|
+
initialStateLogged = true;
|
|
2092
|
+
}
|
|
2070
2093
|
}
|
|
2071
2094
|
function process$5(event) {
|
|
2072
2095
|
schedule$1(encode$3.bind(this, event));
|
|
@@ -2372,6 +2395,7 @@ function traverse (root, timer, source, timestamp) {
|
|
|
2372
2395
|
|
|
2373
2396
|
var observers = [];
|
|
2374
2397
|
var mutations = [];
|
|
2398
|
+
var throttledMutations = {};
|
|
2375
2399
|
var insertRule = null;
|
|
2376
2400
|
var deleteRule = null;
|
|
2377
2401
|
var attachShadow = null;
|
|
@@ -2379,6 +2403,7 @@ var mediaInsertRule = null;
|
|
|
2379
2403
|
var mediaDeleteRule = null;
|
|
2380
2404
|
var queue$2 = [];
|
|
2381
2405
|
var timeout$1 = null;
|
|
2406
|
+
var throttleDelay = null;
|
|
2382
2407
|
var activePeriod = null;
|
|
2383
2408
|
var history$4 = {};
|
|
2384
2409
|
function start$k() {
|
|
@@ -2482,6 +2507,7 @@ function stop$i() {
|
|
|
2482
2507
|
observers = [];
|
|
2483
2508
|
history$4 = {};
|
|
2484
2509
|
mutations = [];
|
|
2510
|
+
throttledMutations = [];
|
|
2485
2511
|
queue$2 = [];
|
|
2486
2512
|
activePeriod = 0;
|
|
2487
2513
|
timeout$1 = null;
|
|
@@ -2499,36 +2525,24 @@ function handle$1(m) {
|
|
|
2499
2525
|
measure(compute$6)();
|
|
2500
2526
|
});
|
|
2501
2527
|
}
|
|
2502
|
-
function
|
|
2528
|
+
function processMutation(timer, mutation, instance, timestamp) {
|
|
2503
2529
|
return __awaiter(this, void 0, void 0, function () {
|
|
2504
|
-
var
|
|
2505
|
-
return __generator(this, function (
|
|
2506
|
-
switch (
|
|
2530
|
+
var state, target, type;
|
|
2531
|
+
return __generator(this, function (_a) {
|
|
2532
|
+
switch (_a.label) {
|
|
2507
2533
|
case 0:
|
|
2508
|
-
timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
|
|
2509
|
-
start$y(timer);
|
|
2510
|
-
_b.label = 1;
|
|
2511
|
-
case 1:
|
|
2512
|
-
if (!(mutations.length > 0)) return [3 /*break*/, 8];
|
|
2513
|
-
record = mutations.shift();
|
|
2514
|
-
instance = time();
|
|
2515
|
-
_i = 0, _a = record.mutations;
|
|
2516
|
-
_b.label = 2;
|
|
2517
|
-
case 2:
|
|
2518
|
-
if (!(_i < _a.length)) return [3 /*break*/, 6];
|
|
2519
|
-
mutation = _a[_i];
|
|
2520
2534
|
state = state$a(timer);
|
|
2521
|
-
if (!(state === 0 /* Task.Wait */)) return [3 /*break*/,
|
|
2535
|
+
if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 2];
|
|
2522
2536
|
return [4 /*yield*/, suspend$1(timer)];
|
|
2523
|
-
case
|
|
2524
|
-
state =
|
|
2525
|
-
|
|
2526
|
-
case
|
|
2537
|
+
case 1:
|
|
2538
|
+
state = _a.sent();
|
|
2539
|
+
_a.label = 2;
|
|
2540
|
+
case 2:
|
|
2527
2541
|
if (state === 2 /* Task.Stop */) {
|
|
2528
|
-
return [
|
|
2542
|
+
return [2 /*return*/];
|
|
2529
2543
|
}
|
|
2530
2544
|
target = mutation.target;
|
|
2531
|
-
type = config$2.throttleDom ? track$5(mutation, timer, instance,
|
|
2545
|
+
type = config$2.throttleDom ? track$5(mutation, timer, instance, timestamp) : mutation.type;
|
|
2532
2546
|
if (type && target && target.ownerDocument) {
|
|
2533
2547
|
parse$1(target.ownerDocument);
|
|
2534
2548
|
}
|
|
@@ -2537,31 +2551,60 @@ function process$2() {
|
|
|
2537
2551
|
}
|
|
2538
2552
|
switch (type) {
|
|
2539
2553
|
case "attributes" /* Constant.Attributes */:
|
|
2540
|
-
processNode(target, 3 /* Source.Attributes */,
|
|
2554
|
+
processNode(target, 3 /* Source.Attributes */, timestamp);
|
|
2541
2555
|
break;
|
|
2542
2556
|
case "characterData" /* Constant.CharacterData */:
|
|
2543
|
-
processNode(target, 4 /* Source.CharacterData */,
|
|
2557
|
+
processNode(target, 4 /* Source.CharacterData */, timestamp);
|
|
2544
2558
|
break;
|
|
2545
2559
|
case "childList" /* Constant.ChildList */:
|
|
2546
|
-
processNodeList(mutation.addedNodes, 1 /* Source.ChildListAdd */, timer,
|
|
2547
|
-
processNodeList(mutation.removedNodes, 2 /* Source.ChildListRemove */, timer,
|
|
2548
|
-
break;
|
|
2549
|
-
case "suspend" /* Constant.Suspend */:
|
|
2550
|
-
value = get(target);
|
|
2551
|
-
if (value) {
|
|
2552
|
-
value.metadata.suspend = true;
|
|
2553
|
-
}
|
|
2560
|
+
processNodeList(mutation.addedNodes, 1 /* Source.ChildListAdd */, timer, timestamp);
|
|
2561
|
+
processNodeList(mutation.removedNodes, 2 /* Source.ChildListRemove */, timer, timestamp);
|
|
2554
2562
|
break;
|
|
2555
2563
|
}
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2564
|
+
return [2 /*return*/];
|
|
2565
|
+
}
|
|
2566
|
+
});
|
|
2567
|
+
});
|
|
2568
|
+
}
|
|
2569
|
+
function process$2() {
|
|
2570
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2571
|
+
var timer, record, instance, _i, _a, mutation, processedMutations, _b, _c, key, throttledMutationToProcess;
|
|
2572
|
+
return __generator(this, function (_d) {
|
|
2573
|
+
switch (_d.label) {
|
|
2574
|
+
case 0:
|
|
2575
|
+
timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
|
|
2576
|
+
start$y(timer);
|
|
2577
|
+
_d.label = 1;
|
|
2578
|
+
case 1:
|
|
2579
|
+
if (!(mutations.length > 0)) return [3 /*break*/, 3];
|
|
2580
|
+
record = mutations.shift();
|
|
2581
|
+
instance = time();
|
|
2582
|
+
for (_i = 0, _a = record.mutations; _i < _a.length; _i++) {
|
|
2583
|
+
mutation = _a[_i];
|
|
2584
|
+
processMutation(timer, mutation, instance, record.time);
|
|
2585
|
+
}
|
|
2586
|
+
return [4 /*yield*/, encode$4(6 /* Event.Mutation */, timer, record.time)];
|
|
2587
|
+
case 2:
|
|
2588
|
+
_d.sent();
|
|
2563
2589
|
return [3 /*break*/, 1];
|
|
2564
|
-
case
|
|
2590
|
+
case 3:
|
|
2591
|
+
processedMutations = false;
|
|
2592
|
+
for (_b = 0, _c = Object.keys(throttledMutations); _b < _c.length; _b++) {
|
|
2593
|
+
key = _c[_b];
|
|
2594
|
+
throttledMutationToProcess = throttledMutations[key];
|
|
2595
|
+
delete throttledMutations[key];
|
|
2596
|
+
processMutation(timer, throttledMutationToProcess.mutation, time(), throttledMutationToProcess.timestamp);
|
|
2597
|
+
processedMutations = true;
|
|
2598
|
+
}
|
|
2599
|
+
if (Object.keys(throttledMutations).length > 0) {
|
|
2600
|
+
processThrottledMutations();
|
|
2601
|
+
}
|
|
2602
|
+
if (!(Object.keys(throttledMutations).length === 0 && processedMutations)) return [3 /*break*/, 5];
|
|
2603
|
+
return [4 /*yield*/, encode$4(6 /* Event.Mutation */, timer, time())];
|
|
2604
|
+
case 4:
|
|
2605
|
+
_d.sent();
|
|
2606
|
+
_d.label = 5;
|
|
2607
|
+
case 5:
|
|
2565
2608
|
stop$w(timer);
|
|
2566
2609
|
return [2 /*return*/];
|
|
2567
2610
|
}
|
|
@@ -2592,14 +2635,16 @@ function track$5(m, timer, instance, timestamp) {
|
|
|
2592
2635
|
h[0] = inactive ? (h[1] === instance ? h[0] : h[0] + 1) : 1;
|
|
2593
2636
|
h[1] = instance;
|
|
2594
2637
|
// Return updated mutation type based on if we have already hit the threshold or not
|
|
2595
|
-
if (h[0]
|
|
2638
|
+
if (h[0] >= 10 /* Setting.MutationSuspendThreshold */) {
|
|
2596
2639
|
// Store a reference to removedNodes so we can process them later
|
|
2597
2640
|
// when we resume mutations again on user interactions
|
|
2598
2641
|
h[2] = m.removedNodes;
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2642
|
+
if (instance > timestamp + 3000 /* Setting.MutationActivePeriod */) {
|
|
2643
|
+
return m.type;
|
|
2644
|
+
}
|
|
2645
|
+
// we only store the most recent mutation for a given key if it is being throttled
|
|
2646
|
+
throttledMutations[key] = { mutation: m, timestamp: timestamp };
|
|
2647
|
+
return "throttle" /* Constant.Throttle */;
|
|
2603
2648
|
}
|
|
2604
2649
|
}
|
|
2605
2650
|
return m.type;
|
|
@@ -2646,6 +2691,12 @@ function processNodeList(list, source, timer, timestamp) {
|
|
|
2646
2691
|
});
|
|
2647
2692
|
});
|
|
2648
2693
|
}
|
|
2694
|
+
function processThrottledMutations() {
|
|
2695
|
+
if (throttleDelay) {
|
|
2696
|
+
clearTimeout(throttleDelay);
|
|
2697
|
+
}
|
|
2698
|
+
throttleDelay = setTimeout(function () { schedule$1(process$2, 1 /* Priority.High */); }, 33 /* Setting.LookAhead */);
|
|
2699
|
+
}
|
|
2649
2700
|
function schedule(node) {
|
|
2650
2701
|
// Only schedule manual trigger for this node if it's not already in the queue
|
|
2651
2702
|
if (queue$2.indexOf(node) < 0) {
|
|
@@ -3138,6 +3189,7 @@ var state$2 = [];
|
|
|
3138
3189
|
var elementAnimate = null;
|
|
3139
3190
|
var animationPlay = null;
|
|
3140
3191
|
var animationPause = null;
|
|
3192
|
+
var animationCommitStyles = null;
|
|
3141
3193
|
var animationCancel = null;
|
|
3142
3194
|
var animationFinish = null;
|
|
3143
3195
|
var animationId = 'clarityAnimationId';
|
|
@@ -3145,12 +3197,15 @@ var operationCount = 'clarityOperationCount';
|
|
|
3145
3197
|
var maxOperations = 20;
|
|
3146
3198
|
function start$i() {
|
|
3147
3199
|
if (window["Animation"] &&
|
|
3200
|
+
window["Animation"].prototype &&
|
|
3148
3201
|
window["KeyframeEffect"] &&
|
|
3202
|
+
window["KeyframeEffect"].prototype &&
|
|
3149
3203
|
window["KeyframeEffect"].prototype.getKeyframes &&
|
|
3150
3204
|
window["KeyframeEffect"].prototype.getTiming) {
|
|
3151
3205
|
reset$7();
|
|
3152
3206
|
overrideAnimationHelper(animationPlay, "play");
|
|
3153
3207
|
overrideAnimationHelper(animationPause, "pause");
|
|
3208
|
+
overrideAnimationHelper(animationCommitStyles, "commitStyles");
|
|
3154
3209
|
overrideAnimationHelper(animationCancel, "cancel");
|
|
3155
3210
|
overrideAnimationHelper(animationFinish, "finish");
|
|
3156
3211
|
if (elementAnimate === null) {
|
|
@@ -3234,6 +3289,9 @@ function trackAnimationOperation(animation, name) {
|
|
|
3234
3289
|
case "finish":
|
|
3235
3290
|
operation = 4 /* AnimationOperation.Finish */;
|
|
3236
3291
|
break;
|
|
3292
|
+
case "commitStyles":
|
|
3293
|
+
operation = 5 /* AnimationOperation.CommitStyles */;
|
|
3294
|
+
break;
|
|
3237
3295
|
}
|
|
3238
3296
|
if (operation) {
|
|
3239
3297
|
track$4(time(), animation[animationId], operation);
|
|
@@ -3614,6 +3672,9 @@ function encode$3 (type, ts) {
|
|
|
3614
3672
|
tokens.push(entry.data.y);
|
|
3615
3673
|
if (entry.data.id !== undefined) {
|
|
3616
3674
|
tokens.push(entry.data.id);
|
|
3675
|
+
if (entry.data.isPrimary !== undefined) {
|
|
3676
|
+
tokens.push(entry.data.isPrimary.toString());
|
|
3677
|
+
}
|
|
3617
3678
|
}
|
|
3618
3679
|
queue(tokens);
|
|
3619
3680
|
track$8(entry.event, entry.data.x, entry.data.y);
|
|
@@ -4787,7 +4848,7 @@ function shortid() {
|
|
|
4787
4848
|
}
|
|
4788
4849
|
function session() {
|
|
4789
4850
|
var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Constant.Empty */ };
|
|
4790
|
-
var value = getCookie("_clsk" /* Constant.SessionKey
|
|
4851
|
+
var value = getCookie("_clsk" /* Constant.SessionKey */, !config$2.includeSubdomains);
|
|
4791
4852
|
if (value) {
|
|
4792
4853
|
var parts = value.split("|" /* Constant.Pipe */);
|
|
4793
4854
|
// Making it backward & forward compatible by using greater than comparison (v0.6.21)
|
|
@@ -4807,7 +4868,7 @@ function num(string, base) {
|
|
|
4807
4868
|
}
|
|
4808
4869
|
function user() {
|
|
4809
4870
|
var output = { id: shortid(), version: 0, expiry: null, consent: 0 /* BooleanFlag.False */, dob: 0 };
|
|
4810
|
-
var cookie = getCookie("_clck" /* Constant.CookieKey
|
|
4871
|
+
var cookie = getCookie("_clck" /* Constant.CookieKey */, !config$2.includeSubdomains);
|
|
4811
4872
|
if (cookie && cookie.length > 0) {
|
|
4812
4873
|
// Splitting and looking up first part for forward compatibility, in case we wish to store additional information in a cookie
|
|
4813
4874
|
var parts = cookie.split("|" /* Constant.Pipe */);
|
|
@@ -4849,8 +4910,9 @@ function user() {
|
|
|
4849
4910
|
}
|
|
4850
4911
|
return output;
|
|
4851
4912
|
}
|
|
4852
|
-
function getCookie(key) {
|
|
4913
|
+
function getCookie(key, limit) {
|
|
4853
4914
|
var _a;
|
|
4915
|
+
if (limit === void 0) { limit = false; }
|
|
4854
4916
|
if (supported(document, "cookie" /* Constant.Cookie */)) {
|
|
4855
4917
|
var cookies = document.cookie.split(";" /* Constant.Semicolon */);
|
|
4856
4918
|
if (cookies) {
|
|
@@ -4867,6 +4929,12 @@ function getCookie(key) {
|
|
|
4867
4929
|
while (isEncoded) {
|
|
4868
4930
|
_a = decodeCookieValue(decodedValue), isEncoded = _a[0], decodedValue = _a[1];
|
|
4869
4931
|
}
|
|
4932
|
+
// If we are limiting cookies, check if the cookie value is limited
|
|
4933
|
+
if (limit) {
|
|
4934
|
+
return decodedValue.endsWith("".concat("~" /* Constant.Tilde */, "1"))
|
|
4935
|
+
? decodedValue.substring(0, decodedValue.length - 2)
|
|
4936
|
+
: null;
|
|
4937
|
+
}
|
|
4870
4938
|
return decodedValue;
|
|
4871
4939
|
}
|
|
4872
4940
|
}
|