fck-honey 0.3.2 → 0.3.4

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.
@@ -62,6 +62,30 @@ function looksLikeTargetDiv(el, zNearMax, uuidGate, debug) {
62
62
  console.log("+++ reject: uuid", el.id);
63
63
  return false;
64
64
  }
65
+ // Fast path: if inline z-index is missing or below threshold, skip expensive getComputedStyle
66
+ var inlineZ = parseInt(el.style.zIndex, 10);
67
+ if (!isFinite(inlineZ) || inlineZ < zNearMax) {
68
+ var cs_1 = getComputedStyle(el);
69
+ var z_1 = parseZIndex(cs_1, el);
70
+ if (z_1 === null || z_1 < zNearMax) {
71
+ if (debug)
72
+ console.log("+++ reject: z-index", z_1, cs_1.zIndex, el.style.zIndex, el);
73
+ return false;
74
+ }
75
+ if (cs_1.display === "none") {
76
+ if (debug)
77
+ console.log("+++ reject: display none", el);
78
+ return false;
79
+ }
80
+ if (el.shadowRoot) {
81
+ if (debug)
82
+ console.log("+++ reject: shadowRoot", el);
83
+ return false;
84
+ }
85
+ if (debug)
86
+ console.log("+++ match", el);
87
+ return true;
88
+ }
65
89
  var cs = getComputedStyle(el);
66
90
  var z = parseZIndex(cs, el);
67
91
  if (z === null || z < zNearMax) {
@@ -1,2 +1,2 @@
1
1
  // Auto-generated from package.json. Do not edit by hand.
2
- export var VERSION = "0.3.2";
2
+ export var VERSION = "0.3.4";
package/dist/esm/core.js CHANGED
@@ -62,6 +62,30 @@ function looksLikeTargetDiv(el, zNearMax, uuidGate, debug) {
62
62
  console.log("+++ reject: uuid", el.id);
63
63
  return false;
64
64
  }
65
+ // Fast path: if inline z-index is missing or below threshold, skip expensive getComputedStyle
66
+ var inlineZ = parseInt(el.style.zIndex, 10);
67
+ if (!isFinite(inlineZ) || inlineZ < zNearMax) {
68
+ var cs_1 = getComputedStyle(el);
69
+ var z_1 = parseZIndex(cs_1, el);
70
+ if (z_1 === null || z_1 < zNearMax) {
71
+ if (debug)
72
+ console.log("+++ reject: z-index", z_1, cs_1.zIndex, el.style.zIndex, el);
73
+ return false;
74
+ }
75
+ if (cs_1.display === "none") {
76
+ if (debug)
77
+ console.log("+++ reject: display none", el);
78
+ return false;
79
+ }
80
+ if (el.shadowRoot) {
81
+ if (debug)
82
+ console.log("+++ reject: shadowRoot", el);
83
+ return false;
84
+ }
85
+ if (debug)
86
+ console.log("+++ match", el);
87
+ return true;
88
+ }
65
89
  var cs = getComputedStyle(el);
66
90
  var z = parseZIndex(cs, el);
67
91
  if (z === null || z < zNearMax) {
@@ -1,2 +1,2 @@
1
1
  // Auto-generated from package.json. Do not edit by hand.
2
- export var VERSION = "0.3.2";
2
+ export var VERSION = "0.3.4";
@@ -1,6 +1,6 @@
1
1
  (function() {
2
2
  // dist/bundle-tmp/version.js
3
- var VERSION = "0.3.2";
3
+ var VERSION = "0.3.4";
4
4
 
5
5
  // dist/bundle-tmp/core.js
6
6
  var __assign = function() {
@@ -65,6 +65,29 @@
65
65
  console.log("+++ reject: uuid", el.id);
66
66
  return false;
67
67
  }
68
+ var inlineZ = parseInt(el.style.zIndex, 10);
69
+ if (!isFinite(inlineZ) || inlineZ < zNearMax) {
70
+ var cs_1 = getComputedStyle(el);
71
+ var z_1 = parseZIndex(cs_1, el);
72
+ if (z_1 === null || z_1 < zNearMax) {
73
+ if (debug)
74
+ console.log("+++ reject: z-index", z_1, cs_1.zIndex, el.style.zIndex, el);
75
+ return false;
76
+ }
77
+ if (cs_1.display === "none") {
78
+ if (debug)
79
+ console.log("+++ reject: display none", el);
80
+ return false;
81
+ }
82
+ if (el.shadowRoot) {
83
+ if (debug)
84
+ console.log("+++ reject: shadowRoot", el);
85
+ return false;
86
+ }
87
+ if (debug)
88
+ console.log("+++ match", el);
89
+ return true;
90
+ }
68
91
  var cs = getComputedStyle(el);
69
92
  var z = parseZIndex(cs, el);
70
93
  if (z === null || z < zNearMax) {
@@ -1,4 +1,4 @@
1
- export declare const version = "0.3.2";
1
+ export declare const version = "0.3.4";
2
2
  export type WarnCallback = (message: string) => () => void;
3
3
  export type MatchCallback = (warn: WarnCallback, el?: HTMLDivElement) => void;
4
4
  export interface ObserverOptions {
@@ -1 +1 @@
1
- export declare const VERSION = "0.3.2";
1
+ export declare const VERSION = "0.3.4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fck-honey",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Detects Honey browser extension overlays for merchants.",
5
5
  "license": "MIT",
6
6
  "main": "dist/honey-detect.js",
@@ -19,7 +19,7 @@
19
19
  "scripts": {
20
20
  "prebuild": "node scripts/write-version.cjs",
21
21
  "build": "tsc -p tsconfig.esm.json && tsc -p tsconfig.bundle.json && esbuild dist/bundle-tmp/global.js --bundle --format=iife --platform=browser --target=es5 --outfile=dist/honey-detect.js",
22
- "prepublishOnly": "npm run build",
22
+ "prepublishOnly": "npm run build && node scripts/check-version.cjs",
23
23
  "clean": "rm -rf dist"
24
24
  },
25
25
  "devDependencies": {