@gemx-dev/clarity-visualize 0.8.64 → 0.8.66

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.
@@ -390,10 +390,6 @@ var EnrichHelper = /** @class */ (function () {
390
390
  var selectorBeta = helper.selector.get(input, 1 /* Layout.Selector.Beta */);
391
391
  d.selectorBeta = selectorBeta.length > 0 ? selectorBeta : null;
392
392
  d.hashBeta = selectorBeta.length > 0 ? helper.hash(d.selectorBeta) : null;
393
- var rawClass = (d.attributes || {})['class'] || '';
394
- if (rawClass.includes('gp_ls-is-cached')) {
395
- console.log("[Enrich] id=".concat(d.id, " tag=").concat(d.tag, " | class=\"").concat(rawClass, "\" | selectorBeta=\"").concat(selectorBeta, "\" | hashBeta=").concat(d.hashBeta));
396
- }
397
393
  /* Track state for future reference */
398
394
  node.alpha = selectorAlpha;
399
395
  node.beta = selectorBeta;
@@ -1002,7 +998,9 @@ var HeatmapHelper = /** @class */ (function () {
1002
998
  if (e.tagName === "CANVAS" /* Constant.Canvas */ || (e.id && e.id.indexOf("clarity-" /* Constant.ClarityPrefix */) === 0)) {
1003
999
  continue;
1004
1000
  }
1005
- visibility = e === el;
1001
+ // Consider visible if the top element is the element itself OR a descendant of it
1002
+ // (e.g. a BUTTON containing P/SPAN children — children will appear on top in elementsFromPoint)
1003
+ visibility = e === el || el.contains(e);
1006
1004
  shadowElement = e.shadowRoot && e.shadowRoot != doc ? e.shadowRoot : null;
1007
1005
  break;
1008
1006
  }
@@ -1769,9 +1767,6 @@ var LayoutHelper = /** @class */ (function () {
1769
1767
  // In case of selector collision, prefer the first inserted node
1770
1768
  _this.hashMapAlpha[data.hashAlpha] = _this.get(data.hashAlpha) || parent;
1771
1769
  _this.hashMapBeta[data.hashBeta] = _this.get(data.hashBeta) || parent;
1772
- if (data.hashBeta === '2e36mrf7c' || data.hashBeta === '19lq10ve5') {
1773
- console.log("[Layout] addToHashMap hashBeta=".concat(data.hashBeta, " | hashAlpha=").concat(data.hashAlpha, " | tag=").concat(parent === null || parent === void 0 ? void 0 : parent.tagName));
1774
- }
1775
1770
  };
1776
1771
  this.resize = function (el, width, height) {
1777
1772
  if (el && el.nodeType === 1 /* NodeType.ELEMENT_NODE */ && width && height) {
@@ -2403,7 +2398,7 @@ var Visualizer = /** @class */ (function () {
2403
2398
  this._excludeClassNames = [];
2404
2399
  this.configure = function (opts) {
2405
2400
  _this._excludeClassNames = opts.excludeClassNames || [];
2406
- helper.selector.configure(_this._excludeClassNames);
2401
+ helper.selector.config(_this._excludeClassNames);
2407
2402
  };
2408
2403
  this.dom = function (event) { return __awaiter(_this, void 0, void 0, function () {
2409
2404
  return __generator(this, function (_a) {
@@ -2441,33 +2436,25 @@ var Visualizer = /** @class */ (function () {
2441
2436
  return false;
2442
2437
  }
2443
2438
  };
2444
- this.html = function (decoded, target, portalCanvasId, hash, useproxy, logerror, shortCircuitStrategy, signal) {
2439
+ this.html = function (decoded, target, portalCanvasId, hash, useproxy, logerror, shortCircuitStrategy) {
2445
2440
  if (hash === void 0) { hash = null; }
2446
2441
  if (shortCircuitStrategy === void 0) { shortCircuitStrategy = 0 /* ShortCircuitStrategy.None */; }
2447
2442
  return __awaiter(_this, void 0, void 0, function () {
2448
- var merged, CHUNK_BUDGET_MS, chunkStart, entry, _a, domEvent, e_1;
2443
+ var merged, entry, _a, domEvent, e_1;
2449
2444
  return __generator(this, function (_b) {
2450
2445
  switch (_b.label) {
2451
2446
  case 0:
2452
- if (!(decoded && decoded.length > 0 && target)) return [3 /*break*/, 13];
2447
+ if (!(decoded && decoded.length > 0 && target)) return [3 /*break*/, 11];
2453
2448
  _b.label = 1;
2454
2449
  case 1:
2455
- _b.trys.push([1, 12, , 13]);
2450
+ _b.trys.push([1, 10, , 11]);
2456
2451
  merged = this.merge(decoded);
2457
- if (signal === null || signal === void 0 ? void 0 : signal.aborted)
2458
- return [2 /*return*/, this];
2459
2452
  return [4 /*yield*/, this.setup(target, { version: decoded[0].envelope.version, dom: merged.dom, useproxy: useproxy, portalCanvasId: portalCanvasId })];
2460
2453
  case 2:
2461
2454
  _b.sent();
2462
- if (signal === null || signal === void 0 ? void 0 : signal.aborted)
2463
- return [2 /*return*/, this];
2464
- CHUNK_BUDGET_MS = 8;
2465
- chunkStart = performance.now();
2466
2455
  _b.label = 3;
2467
2456
  case 3:
2468
- if (!(merged.events.length > 0)) return [3 /*break*/, 11];
2469
- if (signal === null || signal === void 0 ? void 0 : signal.aborted)
2470
- return [2 /*return*/, this];
2457
+ if (!(merged.events.length > 0)) return [3 /*break*/, 9];
2471
2458
  entry = merged.events.shift();
2472
2459
  _a = entry.event;
2473
2460
  switch (_a) {
@@ -2493,22 +2480,15 @@ var Visualizer = /** @class */ (function () {
2493
2480
  case 7:
2494
2481
  _b.sent();
2495
2482
  return [3 /*break*/, 8];
2496
- case 8:
2497
- if (!(performance.now() - chunkStart >= CHUNK_BUDGET_MS)) return [3 /*break*/, 10];
2498
- return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 0); })];
2499
- case 9:
2500
- _b.sent();
2501
- chunkStart = performance.now();
2502
- _b.label = 10;
2503
- case 10: return [3 /*break*/, 3];
2504
- case 11: return [3 /*break*/, 13];
2505
- case 12:
2483
+ case 8: return [3 /*break*/, 3];
2484
+ case 9: return [3 /*break*/, 11];
2485
+ case 10:
2506
2486
  e_1 = _b.sent();
2507
2487
  if (logerror) {
2508
2488
  logerror(e_1);
2509
2489
  }
2510
- return [3 /*break*/, 13];
2511
- case 13: return [2 /*return*/, this];
2490
+ return [3 /*break*/, 11];
2491
+ case 11: return [2 /*return*/, this];
2512
2492
  }
2513
2493
  });
2514
2494
  });
@@ -2540,7 +2520,7 @@ var Visualizer = /** @class */ (function () {
2540
2520
  decoded = decoded.sort(_this.sortPayloads);
2541
2521
  // Re-initialize enrich class if someone ends up calling merge function directly
2542
2522
  _this.enrich = _this.enrich || new EnrichHelper();
2543
- helper.selector.configure(_this._excludeClassNames);
2523
+ helper.selector.config(_this._excludeClassNames);
2544
2524
  _this.enrich.reset();
2545
2525
  // Walk through payloads and generate merged payload from an array of decoded payloads
2546
2526
  for (var _i = 0, decoded_1 = decoded; _i < decoded_1.length; _i++) {
@@ -2581,7 +2561,7 @@ var Visualizer = /** @class */ (function () {
2581
2561
  this.reset();
2582
2562
  if (options.excludeClassNames) {
2583
2563
  this._excludeClassNames = options.excludeClassNames;
2584
- helper.selector.configure(options.excludeClassNames);
2564
+ helper.selector.config(options.excludeClassNames);
2585
2565
  }
2586
2566
  // Infer options
2587
2567
  options.pointer = "pointer" in options ? options.pointer : true;