clarity-js 0.7.58 → 0.7.60
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 +87 -33
- package/build/clarity.min.js +1 -1
- package/build/clarity.module.js +87 -33
- package/build/clarity.performance.js +1 -1
- package/package.json +1 -1
- package/src/core/history.ts +2 -0
- package/src/core/index.ts +2 -0
- package/src/core/measure.ts +3 -1
- package/src/diagnostic/index.ts +2 -0
- package/src/diagnostic/script.ts +2 -0
- package/src/interaction/change.ts +2 -0
- package/src/interaction/click.ts +2 -0
- package/src/interaction/clipboard.ts +2 -0
- package/src/interaction/index.ts +2 -0
- package/src/interaction/input.ts +2 -0
- package/src/interaction/pointer.ts +14 -3
- package/src/interaction/resize.ts +2 -0
- package/src/interaction/scroll.ts +3 -0
- package/src/interaction/selection.ts +2 -0
- package/src/interaction/submit.ts +2 -0
- package/src/interaction/unload.ts +2 -0
- package/src/interaction/visibility.ts +2 -0
- package/src/layout/document.ts +2 -0
- package/src/layout/index.ts +2 -0
- package/src/layout/mutation.ts +22 -0
- package/src/layout/region.ts +2 -0
- package/src/layout/style.ts +32 -30
- package/src/performance/index.ts +2 -0
- package/src/performance/observer.ts +3 -0
- package/types/data.d.ts +4 -2
- package/types/layout.d.ts +3 -1
- package/types/performance.d.ts +32 -0
package/build/clarity.js
CHANGED
|
@@ -1721,6 +1721,7 @@ function compute$9() {
|
|
|
1721
1721
|
encode$4(8 /* Event.Document */);
|
|
1722
1722
|
}
|
|
1723
1723
|
}
|
|
1724
|
+
compute$9.dn = 19 /* FunctionNames.DocumentCompute */;
|
|
1724
1725
|
function stop$v() {
|
|
1725
1726
|
reset$k();
|
|
1726
1727
|
}
|
|
@@ -1741,6 +1742,7 @@ function recompute$8(evt) {
|
|
|
1741
1742
|
schedule$1(encode$3.bind(this, 42 /* Event.Change */));
|
|
1742
1743
|
}
|
|
1743
1744
|
}
|
|
1745
|
+
recompute$8.dn = 5 /* FunctionNames.ChangeRecompute */;
|
|
1744
1746
|
function reset$j() {
|
|
1745
1747
|
state$9 = [];
|
|
1746
1748
|
}
|
|
@@ -1821,6 +1823,7 @@ function handler$3(event, root, evt) {
|
|
|
1821
1823
|
schedule$1(encode$3.bind(this, event));
|
|
1822
1824
|
}
|
|
1823
1825
|
}
|
|
1826
|
+
handler$3.dn = 6 /* FunctionNames.ClickHandler */;
|
|
1824
1827
|
function link(node) {
|
|
1825
1828
|
while (node && node !== document) {
|
|
1826
1829
|
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
@@ -1907,6 +1910,7 @@ function recompute$7(action, evt) {
|
|
|
1907
1910
|
state$7.push({ time: time(evt), event: 38 /* Event.Clipboard */, data: { target: target(evt), action: action } });
|
|
1908
1911
|
schedule$1(encode$3.bind(this, 38 /* Event.Clipboard */));
|
|
1909
1912
|
}
|
|
1913
|
+
recompute$7.dn = 7 /* FunctionNames.ClipboardRecompute */;
|
|
1910
1914
|
function reset$h() {
|
|
1911
1915
|
state$7 = [];
|
|
1912
1916
|
}
|
|
@@ -1944,6 +1948,7 @@ function recompute$6(evt) {
|
|
|
1944
1948
|
timeout$6 = setTimeout(process$7, 1000 /* Setting.InputLookAhead */, 27 /* Event.Input */);
|
|
1945
1949
|
}
|
|
1946
1950
|
}
|
|
1951
|
+
recompute$6.dn = 9 /* FunctionNames.InputRecompute */;
|
|
1947
1952
|
function process$7(event) {
|
|
1948
1953
|
schedule$1(encode$3.bind(this, event));
|
|
1949
1954
|
}
|
|
@@ -1957,7 +1962,8 @@ function stop$r() {
|
|
|
1957
1962
|
|
|
1958
1963
|
var state$5 = [];
|
|
1959
1964
|
var timeout$5 = null;
|
|
1960
|
-
var
|
|
1965
|
+
var hasPrimaryTouch = false;
|
|
1966
|
+
var primaryTouchId = 0;
|
|
1961
1967
|
var activeTouchPointIds = new Set();
|
|
1962
1968
|
function start$s() {
|
|
1963
1969
|
reset$f();
|
|
@@ -1989,6 +1995,7 @@ function mouse(event, root, evt) {
|
|
|
1989
1995
|
handler$2({ time: time(evt), event: event, data: { target: target(evt), x: x, y: y } });
|
|
1990
1996
|
}
|
|
1991
1997
|
}
|
|
1998
|
+
mouse.dn = 10 /* FunctionNames.PointerMouse */;
|
|
1992
1999
|
function touch(event, root, evt) {
|
|
1993
2000
|
var frame = iframe(root);
|
|
1994
2001
|
var d = frame ? frame.contentDocument.documentElement : document.documentElement;
|
|
@@ -2007,7 +2014,9 @@ function touch(event, root, evt) {
|
|
|
2007
2014
|
switch (event) {
|
|
2008
2015
|
case 17 /* Event.TouchStart */:
|
|
2009
2016
|
if (activeTouchPointIds.size === 0) {
|
|
2010
|
-
|
|
2017
|
+
// Track presence of primary touch separately to handle scenarios when same id is repeated
|
|
2018
|
+
hasPrimaryTouch = true;
|
|
2019
|
+
primaryTouchId = id;
|
|
2011
2020
|
}
|
|
2012
2021
|
activeTouchPointIds.add(id);
|
|
2013
2022
|
break;
|
|
@@ -2016,14 +2025,21 @@ function touch(event, root, evt) {
|
|
|
2016
2025
|
activeTouchPointIds.delete(id);
|
|
2017
2026
|
break;
|
|
2018
2027
|
}
|
|
2019
|
-
var isPrimary =
|
|
2028
|
+
var isPrimary = hasPrimaryTouch && primaryTouchId === id;
|
|
2020
2029
|
// Check for null values before processing this event
|
|
2021
2030
|
if (x !== null && y !== null) {
|
|
2022
2031
|
handler$2({ time: t, event: event, data: { target: target(evt), x: x, y: y, id: id, isPrimary: isPrimary } });
|
|
2023
2032
|
}
|
|
2033
|
+
// Reset primary touch point id once touch event ends
|
|
2034
|
+
if (event === 20 /* Event.TouchCancel */ || event === 18 /* Event.TouchEnd */) {
|
|
2035
|
+
if (primaryTouchId === id) {
|
|
2036
|
+
hasPrimaryTouch = false;
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2024
2039
|
}
|
|
2025
2040
|
}
|
|
2026
2041
|
}
|
|
2042
|
+
touch.dn = 11 /* FunctionNames.PointerTouch */;
|
|
2027
2043
|
function handler$2(current) {
|
|
2028
2044
|
switch (current.event) {
|
|
2029
2045
|
case 12 /* Event.MouseMove */:
|
|
@@ -2091,6 +2107,7 @@ function recompute$5() {
|
|
|
2091
2107
|
initialStateLogged = true;
|
|
2092
2108
|
}
|
|
2093
2109
|
}
|
|
2110
|
+
recompute$5.dn = 12 /* FunctionNames.ResizeRecompute */;
|
|
2094
2111
|
function process$5(event) {
|
|
2095
2112
|
schedule$1(encode$3.bind(this, event));
|
|
2096
2113
|
}
|
|
@@ -2155,6 +2172,7 @@ function recompute$4(event) {
|
|
|
2155
2172
|
clearTimeout(timeout$3);
|
|
2156
2173
|
timeout$3 = setTimeout(process$4, 500 /* Setting.LookAhead */, 10 /* Event.Scroll */);
|
|
2157
2174
|
}
|
|
2175
|
+
recompute$4.dn = 13 /* FunctionNames.ScrollRecompute */;
|
|
2158
2176
|
function getPositionNode(x, y) {
|
|
2159
2177
|
var _a, _b;
|
|
2160
2178
|
var node;
|
|
@@ -2196,6 +2214,7 @@ function compute$8() {
|
|
|
2196
2214
|
log(32 /* Dimension.InitialScrollBottom */, (_b = bottom === null || bottom === void 0 ? void 0 : bottom.hash) === null || _b === void 0 ? void 0 : _b.join("." /* Constant.Dot */));
|
|
2197
2215
|
}
|
|
2198
2216
|
}
|
|
2217
|
+
compute$8.dn = 14 /* FunctionNames.ScrollCompute */;
|
|
2199
2218
|
function stop$o() {
|
|
2200
2219
|
clearTimeout(timeout$3);
|
|
2201
2220
|
state$4 = [];
|
|
@@ -2243,6 +2262,7 @@ function recompute$3(root) {
|
|
|
2243
2262
|
clearTimeout(timeout$2);
|
|
2244
2263
|
timeout$2 = setTimeout(process$3, 500 /* Setting.LookAhead */, 21 /* Event.Selection */);
|
|
2245
2264
|
}
|
|
2265
|
+
recompute$3.dn = 15 /* FunctionNames.SelectionRecompute */;
|
|
2246
2266
|
function process$3(event) {
|
|
2247
2267
|
schedule$1(encode$3.bind(this, event));
|
|
2248
2268
|
}
|
|
@@ -2266,6 +2286,7 @@ function recompute$2(evt) {
|
|
|
2266
2286
|
state$3.push({ time: time(evt), event: 39 /* Event.Submit */, data: { target: target(evt) } });
|
|
2267
2287
|
schedule$1(encode$3.bind(this, 39 /* Event.Submit */));
|
|
2268
2288
|
}
|
|
2289
|
+
recompute$2.dn = 16 /* FunctionNames.SubmitRecompute */;
|
|
2269
2290
|
function reset$b() {
|
|
2270
2291
|
state$3 = [];
|
|
2271
2292
|
}
|
|
@@ -2282,6 +2303,7 @@ function recompute$1(evt) {
|
|
|
2282
2303
|
encode$3(26 /* Event.Unload */, time(evt));
|
|
2283
2304
|
stop();
|
|
2284
2305
|
}
|
|
2306
|
+
recompute$1.dn = 17 /* FunctionNames.UnloadRecompute */;
|
|
2285
2307
|
function reset$a() {
|
|
2286
2308
|
data$9 = null;
|
|
2287
2309
|
}
|
|
@@ -2299,6 +2321,7 @@ function recompute(evt) {
|
|
|
2299
2321
|
data$8 = { visible: "visibilityState" in document ? document.visibilityState : "default" };
|
|
2300
2322
|
encode$3(28 /* Event.Visibility */, time(evt));
|
|
2301
2323
|
}
|
|
2324
|
+
recompute.dn = 18 /* FunctionNames.VisibilityRecompute */;
|
|
2302
2325
|
function reset$9() {
|
|
2303
2326
|
data$8 = null;
|
|
2304
2327
|
}
|
|
@@ -2320,6 +2343,7 @@ function start$l() {
|
|
|
2320
2343
|
start$o();
|
|
2321
2344
|
start$n();
|
|
2322
2345
|
}
|
|
2346
|
+
start$l.dn = 8 /* FunctionNames.InteractionStart */;
|
|
2323
2347
|
function stop$j() {
|
|
2324
2348
|
stop$e();
|
|
2325
2349
|
stop$t();
|
|
@@ -2472,6 +2496,7 @@ function start$k() {
|
|
|
2472
2496
|
}
|
|
2473
2497
|
}
|
|
2474
2498
|
}
|
|
2499
|
+
start$k.dn = 21 /* FunctionNames.MutationStart */;
|
|
2475
2500
|
function observe$3(node) {
|
|
2476
2501
|
// Create a new observer for every time a new DOM tree (e.g. root document or shadowdom root) is discovered on the page
|
|
2477
2502
|
// In the case of shadow dom, any mutations that happen within the shadow dom are not bubbled up to the host document
|
|
@@ -2525,6 +2550,7 @@ function handle$1(m) {
|
|
|
2525
2550
|
measure(compute$6)();
|
|
2526
2551
|
});
|
|
2527
2552
|
}
|
|
2553
|
+
handle$1.dn = 22 /* FunctionNames.MutationHandle */;
|
|
2528
2554
|
function processMutation(timer, mutation, instance, timestamp) {
|
|
2529
2555
|
return __awaiter(this, void 0, void 0, function () {
|
|
2530
2556
|
var state, target, type;
|
|
@@ -2605,12 +2631,27 @@ function process$2() {
|
|
|
2605
2631
|
_d.sent();
|
|
2606
2632
|
_d.label = 5;
|
|
2607
2633
|
case 5:
|
|
2634
|
+
cleanHistory();
|
|
2608
2635
|
stop$w(timer);
|
|
2609
2636
|
return [2 /*return*/];
|
|
2610
2637
|
}
|
|
2611
2638
|
});
|
|
2612
2639
|
});
|
|
2613
2640
|
}
|
|
2641
|
+
function cleanHistory() {
|
|
2642
|
+
var now = time();
|
|
2643
|
+
if (Object.keys(history$4).length > 10000 /* Setting.MaxMutationHistoryCount */) {
|
|
2644
|
+
history$4 = {};
|
|
2645
|
+
count$1(38 /* Metric.HistoryClear */);
|
|
2646
|
+
}
|
|
2647
|
+
for (var _i = 0, _a = Object.keys(history$4); _i < _a.length; _i++) {
|
|
2648
|
+
var key = _a[_i];
|
|
2649
|
+
var h = history$4[key];
|
|
2650
|
+
if (now > h[1] + 30000 /* Setting.MaxMutationHistoryTime */) {
|
|
2651
|
+
delete history$4[key];
|
|
2652
|
+
}
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2614
2655
|
function track$5(m, timer, instance, timestamp) {
|
|
2615
2656
|
var value = m.target ? get(m.target.parentNode) : null;
|
|
2616
2657
|
// Check if the parent is already discovered and that the parent is not the document root
|
|
@@ -2738,7 +2779,8 @@ function generate(target, type) {
|
|
|
2738
2779
|
target: target,
|
|
2739
2780
|
type: type
|
|
2740
2781
|
}]);
|
|
2741
|
-
}
|
|
2782
|
+
}
|
|
2783
|
+
generate.dn = 23 /* FunctionNames.MutationGenerate */;
|
|
2742
2784
|
|
|
2743
2785
|
var digitsRegex = /[^0-9\.]/g;
|
|
2744
2786
|
/* JSON+LD (Linked Data) Recursive Parser */
|
|
@@ -3068,35 +3110,37 @@ var styleSheetMap = {};
|
|
|
3068
3110
|
var styleTimeMap = {};
|
|
3069
3111
|
var documentNodes = [];
|
|
3070
3112
|
function start$j() {
|
|
3071
|
-
if (
|
|
3072
|
-
replace
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3113
|
+
if (window['CSSStyleSheet'] && CSSStyleSheet.prototype) {
|
|
3114
|
+
if (replace === null) {
|
|
3115
|
+
replace = CSSStyleSheet.prototype.replace;
|
|
3116
|
+
CSSStyleSheet.prototype.replace = function () {
|
|
3117
|
+
if (active()) {
|
|
3118
|
+
max(36 /* Metric.ConstructedStyles */, 1);
|
|
3119
|
+
// if we haven't seen this stylesheet on this page yet, wait until the checkDocumentStyles has found it
|
|
3120
|
+
// and attached the sheet to a document. This way the timestamp of the style sheet creation will align
|
|
3121
|
+
// to when it is used in the document rather than potentially being misaligned during the traverse process.
|
|
3122
|
+
if (this[styleSheetPageNum] === data$2.pageNum) {
|
|
3123
|
+
trackStyleChange(time(), this[styleSheetId], 1 /* StyleSheetOperation.Replace */, arguments[0]);
|
|
3124
|
+
}
|
|
3081
3125
|
}
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
}
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3126
|
+
return replace.apply(this, arguments);
|
|
3127
|
+
};
|
|
3128
|
+
}
|
|
3129
|
+
if (replaceSync === null) {
|
|
3130
|
+
replaceSync = CSSStyleSheet.prototype.replaceSync;
|
|
3131
|
+
CSSStyleSheet.prototype.replaceSync = function () {
|
|
3132
|
+
if (active()) {
|
|
3133
|
+
max(36 /* Metric.ConstructedStyles */, 1);
|
|
3134
|
+
// if we haven't seen this stylesheet on this page yet, wait until the checkDocumentStyles has found it
|
|
3135
|
+
// and attached the sheet to a document. This way the timestamp of the style sheet creation will align
|
|
3136
|
+
// to when it is used in the document rather than potentially being misaligned during the traverse process.
|
|
3137
|
+
if (this[styleSheetPageNum] === data$2.pageNum) {
|
|
3138
|
+
trackStyleChange(time(), this[styleSheetId], 2 /* StyleSheetOperation.ReplaceSync */, arguments[0]);
|
|
3139
|
+
}
|
|
3096
3140
|
}
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
}
|
|
3141
|
+
return replaceSync.apply(this, arguments);
|
|
3142
|
+
};
|
|
3143
|
+
}
|
|
3100
3144
|
}
|
|
3101
3145
|
}
|
|
3102
3146
|
function checkDocumentStyles(documentNode, timestamp) {
|
|
@@ -3545,6 +3589,7 @@ function compute$6() {
|
|
|
3545
3589
|
encode$4(7 /* Event.Region */);
|
|
3546
3590
|
}
|
|
3547
3591
|
}
|
|
3592
|
+
compute$6.dn = 24 /* FunctionNames.RegionCompute */;
|
|
3548
3593
|
function handler$1(entries) {
|
|
3549
3594
|
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
3550
3595
|
var entry = entries_1[_i];
|
|
@@ -4193,7 +4238,8 @@ function handler(error) {
|
|
|
4193
4238
|
encode$2(31 /* Event.ScriptError */);
|
|
4194
4239
|
}
|
|
4195
4240
|
return true;
|
|
4196
|
-
}
|
|
4241
|
+
}
|
|
4242
|
+
handler.dn = 4 /* FunctionNames.ScriptHandler */;
|
|
4197
4243
|
|
|
4198
4244
|
function encode$2 (type) {
|
|
4199
4245
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -5079,6 +5125,7 @@ function measure (method) {
|
|
|
5079
5125
|
if (duration > config$2.longTask) {
|
|
5080
5126
|
count$1(7 /* Metric.LongTaskCount */);
|
|
5081
5127
|
max(6 /* Metric.ThreadBlockedTime */, duration);
|
|
5128
|
+
log$1(9 /* Code.FunctionExecutionTime */, 0 /* Severity.Info */, "".concat(method.dn || method.name, "-").concat(duration));
|
|
5082
5129
|
}
|
|
5083
5130
|
};
|
|
5084
5131
|
}
|
|
@@ -5152,6 +5199,7 @@ function compute$1() {
|
|
|
5152
5199
|
window.setTimeout(restart$1, 250 /* Setting.RestartDelay */);
|
|
5153
5200
|
}
|
|
5154
5201
|
}
|
|
5202
|
+
compute$1.dn = 1 /* FunctionNames.HistoryCompute */;
|
|
5155
5203
|
function restart$1() {
|
|
5156
5204
|
start();
|
|
5157
5205
|
max(29 /* Metric.SinglePage */, 1 /* BooleanFlag.True */);
|
|
@@ -5231,13 +5279,15 @@ function suspend() {
|
|
|
5231
5279
|
function restart() {
|
|
5232
5280
|
start();
|
|
5233
5281
|
event("clarity" /* Constant.Clarity */, "restart" /* Constant.Restart */);
|
|
5234
|
-
}
|
|
5282
|
+
}
|
|
5283
|
+
restart.dn = 2 /* FunctionNames.Restart */;
|
|
5235
5284
|
|
|
5236
5285
|
function start$5() {
|
|
5237
5286
|
start$A();
|
|
5238
5287
|
start$e();
|
|
5239
5288
|
start$d();
|
|
5240
5289
|
}
|
|
5290
|
+
start$5.dn = 3 /* FunctionNames.DiagnosticStart */;
|
|
5241
5291
|
function stop$4() {
|
|
5242
5292
|
stop$c();
|
|
5243
5293
|
}
|
|
@@ -5297,6 +5347,7 @@ function start$3() {
|
|
|
5297
5347
|
start$j();
|
|
5298
5348
|
start$i();
|
|
5299
5349
|
}
|
|
5350
|
+
start$3.dn = 20 /* FunctionNames.LayoutStart */;
|
|
5300
5351
|
function stop$3() {
|
|
5301
5352
|
stop$f();
|
|
5302
5353
|
stop$x();
|
|
@@ -5517,9 +5568,11 @@ function observe() {
|
|
|
5517
5568
|
log$1(3 /* Code.PerformanceObserver */, 1 /* Severity.Warning */);
|
|
5518
5569
|
}
|
|
5519
5570
|
}
|
|
5571
|
+
observe.dn = 26 /* FunctionNames.ObserverObserve */;
|
|
5520
5572
|
function handle(entries) {
|
|
5521
5573
|
process(entries.getEntries());
|
|
5522
5574
|
}
|
|
5575
|
+
handle.dn = 27 /* FunctionNames.ObserverHandle */;
|
|
5523
5576
|
function process(entries) {
|
|
5524
5577
|
var visible = "visibilityState" in document ? document.visibilityState === "visible" : true;
|
|
5525
5578
|
for (var i = 0; i < entries.length; i++) {
|
|
@@ -5581,6 +5634,7 @@ function start$1() {
|
|
|
5581
5634
|
reset();
|
|
5582
5635
|
start$2();
|
|
5583
5636
|
}
|
|
5637
|
+
start$1.dn = 25 /* FunctionNames.PerformanceStart */;
|
|
5584
5638
|
function stop$1() {
|
|
5585
5639
|
stop$2();
|
|
5586
5640
|
reset();
|