clarity-js 0.7.57 → 0.7.59

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.js CHANGED
@@ -166,7 +166,7 @@ function stop$F() {
166
166
  startTime = 0;
167
167
  }
168
168
 
169
- var version$1 = "0.7.57";
169
+ var version$1 = "0.7.58";
170
170
 
171
171
  // tslint:disable: no-bitwise
172
172
  function hash (input, precision) {
@@ -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,6 +1962,9 @@ function stop$r() {
1957
1962
 
1958
1963
  var state$5 = [];
1959
1964
  var timeout$5 = null;
1965
+ var hasPrimaryTouch = false;
1966
+ var primaryTouchId = 0;
1967
+ var activeTouchPointIds = new Set();
1960
1968
  function start$s() {
1961
1969
  reset$f();
1962
1970
  }
@@ -1987,6 +1995,7 @@ function mouse(event, root, evt) {
1987
1995
  handler$2({ time: time(evt), event: event, data: { target: target(evt), x: x, y: y } });
1988
1996
  }
1989
1997
  }
1998
+ mouse.dn = 10 /* FunctionNames.PointerMouse */;
1990
1999
  function touch(event, root, evt) {
1991
2000
  var frame = iframe(root);
1992
2001
  var d = frame ? frame.contentDocument.documentElement : document.documentElement;
@@ -1999,17 +2008,38 @@ function touch(event, root, evt) {
1999
2008
  var y = "clientY" in entry ? Math.round(entry["clientY"] + d.scrollTop) : null;
2000
2009
  x = x && frame ? x + Math.round(frame.offsetLeft) : x;
2001
2010
  y = y && frame ? y + Math.round(frame.offsetTop) : y;
2002
- // identifier is 0-based, unique for each touch point and resets when all fingers are lifted
2003
- // that is not a part of the spec, but it is how it is implemented in browsers
2004
- // tested in Chromium-based browsers as well as Firefox
2011
+ // We cannot rely on identifier to determine primary touch as its value doesn't always start with 0.
2012
+ // Safari/Webkit uses the address of the UITouch object as the identifier value for each touch point.
2005
2013
  var id = "identifier" in entry ? entry["identifier"] : undefined;
2014
+ switch (event) {
2015
+ case 17 /* Event.TouchStart */:
2016
+ if (activeTouchPointIds.size === 0) {
2017
+ // Track presence of primary touch separately to handle scenarios when same id is repeated
2018
+ hasPrimaryTouch = true;
2019
+ primaryTouchId = id;
2020
+ }
2021
+ activeTouchPointIds.add(id);
2022
+ break;
2023
+ case 18 /* Event.TouchEnd */:
2024
+ case 20 /* Event.TouchCancel */:
2025
+ activeTouchPointIds.delete(id);
2026
+ break;
2027
+ }
2028
+ var isPrimary = hasPrimaryTouch && primaryTouchId === id;
2006
2029
  // Check for null values before processing this event
2007
2030
  if (x !== null && y !== null) {
2008
- handler$2({ time: t, event: event, data: { target: target(evt), x: x, y: y, id: id } });
2031
+ handler$2({ time: t, event: event, data: { target: target(evt), x: x, y: y, id: id, isPrimary: isPrimary } });
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
+ }
2009
2038
  }
2010
2039
  }
2011
2040
  }
2012
2041
  }
2042
+ touch.dn = 11 /* FunctionNames.PointerTouch */;
2013
2043
  function handler$2(current) {
2014
2044
  switch (current.event) {
2015
2045
  case 12 /* Event.MouseMove */:
@@ -2054,7 +2084,9 @@ function stop$q() {
2054
2084
 
2055
2085
  var data$b;
2056
2086
  var timeout$4 = null;
2087
+ var initialStateLogged = false;
2057
2088
  function start$r() {
2089
+ initialStateLogged = false;
2058
2090
  bind(window, "resize", recompute$5);
2059
2091
  recompute$5();
2060
2092
  }
@@ -2066,9 +2098,16 @@ function recompute$5() {
2066
2098
  width: de && "clientWidth" in de ? Math.min(de.clientWidth, window.innerWidth) : window.innerWidth,
2067
2099
  height: de && "clientHeight" in de ? Math.min(de.clientHeight, window.innerHeight) : window.innerHeight,
2068
2100
  };
2069
- clearTimeout(timeout$4);
2070
- timeout$4 = setTimeout(process$5, 500 /* Setting.LookAhead */, 11 /* Event.Resize */);
2101
+ if (initialStateLogged) {
2102
+ clearTimeout(timeout$4);
2103
+ timeout$4 = setTimeout(process$5, 500 /* Setting.LookAhead */, 11 /* Event.Resize */);
2104
+ }
2105
+ else {
2106
+ encode$3(11 /* Event.Resize */);
2107
+ initialStateLogged = true;
2108
+ }
2071
2109
  }
2110
+ recompute$5.dn = 12 /* FunctionNames.ResizeRecompute */;
2072
2111
  function process$5(event) {
2073
2112
  schedule$1(encode$3.bind(this, event));
2074
2113
  }
@@ -2133,6 +2172,7 @@ function recompute$4(event) {
2133
2172
  clearTimeout(timeout$3);
2134
2173
  timeout$3 = setTimeout(process$4, 500 /* Setting.LookAhead */, 10 /* Event.Scroll */);
2135
2174
  }
2175
+ recompute$4.dn = 13 /* FunctionNames.ScrollRecompute */;
2136
2176
  function getPositionNode(x, y) {
2137
2177
  var _a, _b;
2138
2178
  var node;
@@ -2174,6 +2214,7 @@ function compute$8() {
2174
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 */));
2175
2215
  }
2176
2216
  }
2217
+ compute$8.dn = 14 /* FunctionNames.ScrollCompute */;
2177
2218
  function stop$o() {
2178
2219
  clearTimeout(timeout$3);
2179
2220
  state$4 = [];
@@ -2221,6 +2262,7 @@ function recompute$3(root) {
2221
2262
  clearTimeout(timeout$2);
2222
2263
  timeout$2 = setTimeout(process$3, 500 /* Setting.LookAhead */, 21 /* Event.Selection */);
2223
2264
  }
2265
+ recompute$3.dn = 15 /* FunctionNames.SelectionRecompute */;
2224
2266
  function process$3(event) {
2225
2267
  schedule$1(encode$3.bind(this, event));
2226
2268
  }
@@ -2244,6 +2286,7 @@ function recompute$2(evt) {
2244
2286
  state$3.push({ time: time(evt), event: 39 /* Event.Submit */, data: { target: target(evt) } });
2245
2287
  schedule$1(encode$3.bind(this, 39 /* Event.Submit */));
2246
2288
  }
2289
+ recompute$2.dn = 16 /* FunctionNames.SubmitRecompute */;
2247
2290
  function reset$b() {
2248
2291
  state$3 = [];
2249
2292
  }
@@ -2260,6 +2303,7 @@ function recompute$1(evt) {
2260
2303
  encode$3(26 /* Event.Unload */, time(evt));
2261
2304
  stop();
2262
2305
  }
2306
+ recompute$1.dn = 17 /* FunctionNames.UnloadRecompute */;
2263
2307
  function reset$a() {
2264
2308
  data$9 = null;
2265
2309
  }
@@ -2277,6 +2321,7 @@ function recompute(evt) {
2277
2321
  data$8 = { visible: "visibilityState" in document ? document.visibilityState : "default" };
2278
2322
  encode$3(28 /* Event.Visibility */, time(evt));
2279
2323
  }
2324
+ recompute.dn = 18 /* FunctionNames.VisibilityRecompute */;
2280
2325
  function reset$9() {
2281
2326
  data$8 = null;
2282
2327
  }
@@ -2298,6 +2343,7 @@ function start$l() {
2298
2343
  start$o();
2299
2344
  start$n();
2300
2345
  }
2346
+ start$l.dn = 8 /* FunctionNames.InteractionStart */;
2301
2347
  function stop$j() {
2302
2348
  stop$e();
2303
2349
  stop$t();
@@ -2450,6 +2496,7 @@ function start$k() {
2450
2496
  }
2451
2497
  }
2452
2498
  }
2499
+ start$k.dn = 21 /* FunctionNames.MutationStart */;
2453
2500
  function observe$3(node) {
2454
2501
  // Create a new observer for every time a new DOM tree (e.g. root document or shadowdom root) is discovered on the page
2455
2502
  // In the case of shadow dom, any mutations that happen within the shadow dom are not bubbled up to the host document
@@ -2503,6 +2550,7 @@ function handle$1(m) {
2503
2550
  measure(compute$6)();
2504
2551
  });
2505
2552
  }
2553
+ handle$1.dn = 22 /* FunctionNames.MutationHandle */;
2506
2554
  function processMutation(timer, mutation, instance, timestamp) {
2507
2555
  return __awaiter(this, void 0, void 0, function () {
2508
2556
  var state, target, type;
@@ -2716,7 +2764,8 @@ function generate(target, type) {
2716
2764
  target: target,
2717
2765
  type: type
2718
2766
  }]);
2719
- }
2767
+ }
2768
+ generate.dn = 23 /* FunctionNames.MutationGenerate */;
2720
2769
 
2721
2770
  var digitsRegex = /[^0-9\.]/g;
2722
2771
  /* JSON+LD (Linked Data) Recursive Parser */
@@ -3523,6 +3572,7 @@ function compute$6() {
3523
3572
  encode$4(7 /* Event.Region */);
3524
3573
  }
3525
3574
  }
3575
+ compute$6.dn = 24 /* FunctionNames.RegionCompute */;
3526
3576
  function handler$1(entries) {
3527
3577
  for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
3528
3578
  var entry = entries_1[_i];
@@ -3650,6 +3700,9 @@ function encode$3 (type, ts) {
3650
3700
  tokens.push(entry.data.y);
3651
3701
  if (entry.data.id !== undefined) {
3652
3702
  tokens.push(entry.data.id);
3703
+ if (entry.data.isPrimary !== undefined) {
3704
+ tokens.push(entry.data.isPrimary.toString());
3705
+ }
3653
3706
  }
3654
3707
  queue(tokens);
3655
3708
  track$8(entry.event, entry.data.x, entry.data.y);
@@ -4168,7 +4221,8 @@ function handler(error) {
4168
4221
  encode$2(31 /* Event.ScriptError */);
4169
4222
  }
4170
4223
  return true;
4171
- }
4224
+ }
4225
+ handler.dn = 4 /* FunctionNames.ScriptHandler */;
4172
4226
 
4173
4227
  function encode$2 (type) {
4174
4228
  return __awaiter(this, void 0, void 0, function () {
@@ -5054,6 +5108,7 @@ function measure (method) {
5054
5108
  if (duration > config$2.longTask) {
5055
5109
  count$1(7 /* Metric.LongTaskCount */);
5056
5110
  max(6 /* Metric.ThreadBlockedTime */, duration);
5111
+ log$1(9 /* Code.FunctionExecutionTime */, 0 /* Severity.Info */, "".concat(method.dn || method.name, "-").concat(duration));
5057
5112
  }
5058
5113
  };
5059
5114
  }
@@ -5127,6 +5182,7 @@ function compute$1() {
5127
5182
  window.setTimeout(restart$1, 250 /* Setting.RestartDelay */);
5128
5183
  }
5129
5184
  }
5185
+ compute$1.dn = 1 /* FunctionNames.HistoryCompute */;
5130
5186
  function restart$1() {
5131
5187
  start();
5132
5188
  max(29 /* Metric.SinglePage */, 1 /* BooleanFlag.True */);
@@ -5206,13 +5262,15 @@ function suspend() {
5206
5262
  function restart() {
5207
5263
  start();
5208
5264
  event("clarity" /* Constant.Clarity */, "restart" /* Constant.Restart */);
5209
- }
5265
+ }
5266
+ restart.dn = 2 /* FunctionNames.Restart */;
5210
5267
 
5211
5268
  function start$5() {
5212
5269
  start$A();
5213
5270
  start$e();
5214
5271
  start$d();
5215
5272
  }
5273
+ start$5.dn = 3 /* FunctionNames.DiagnosticStart */;
5216
5274
  function stop$4() {
5217
5275
  stop$c();
5218
5276
  }
@@ -5272,6 +5330,7 @@ function start$3() {
5272
5330
  start$j();
5273
5331
  start$i();
5274
5332
  }
5333
+ start$3.dn = 20 /* FunctionNames.LayoutStart */;
5275
5334
  function stop$3() {
5276
5335
  stop$f();
5277
5336
  stop$x();
@@ -5492,9 +5551,11 @@ function observe() {
5492
5551
  log$1(3 /* Code.PerformanceObserver */, 1 /* Severity.Warning */);
5493
5552
  }
5494
5553
  }
5554
+ observe.dn = 26 /* FunctionNames.ObserverObserve */;
5495
5555
  function handle(entries) {
5496
5556
  process(entries.getEntries());
5497
5557
  }
5558
+ handle.dn = 27 /* FunctionNames.ObserverHandle */;
5498
5559
  function process(entries) {
5499
5560
  var visible = "visibilityState" in document ? document.visibilityState === "visible" : true;
5500
5561
  for (var i = 0; i < entries.length; i++) {
@@ -5556,6 +5617,7 @@ function start$1() {
5556
5617
  reset();
5557
5618
  start$2();
5558
5619
  }
5620
+ start$1.dn = 25 /* FunctionNames.PerformanceStart */;
5559
5621
  function stop$1() {
5560
5622
  stop$2();
5561
5623
  reset();