@broberg/lens-daemon 0.1.65 → 0.1.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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/critic-dom.ts +29 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@broberg/lens-daemon",
3
- "version": "0.1.65",
3
+ "version": "0.1.66",
4
4
  "description": "The Lens module of the cardmem daemon (flows, critic, coverage, capture sessions, the /lens/* routes and the cardmem-lens MCP) as a package. The daemon mounts createLensRouter(deps) + createLensMcpRouter(deps). Bun runtime.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -16,8 +16,8 @@
16
16
  "turndown": "^7.2.4",
17
17
  "zod": "^3.23.8",
18
18
  "@broberg/lens-engine": "0.14.1",
19
- "@broberg/lens-svg": "0.1.1",
20
- "@broberg/lens-measure": "0.1.2"
19
+ "@broberg/lens-measure": "0.1.2",
20
+ "@broberg/lens-svg": "0.1.1"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@happy-dom/global-registrator": "^20.10.6",
package/src/critic-dom.ts CHANGED
@@ -608,21 +608,35 @@ function inPageCritic(cfg: { maxElements: number }): DomFinding[] {
608
608
  let centreCovered = false;
609
609
  let edgeCovered = 0;
610
610
  let occluder: Element | null = null;
611
- for (const [sx, sy, isCentre] of samples) {
612
- if (sx < 0 || sy < 0 || sx > W || sy > H) continue;
613
- if (sx < clipL || sx > clipR || sy < clipT || sy > clipB) continue;
614
- const top = document.elementFromPoint(sx, sy);
615
- if (!top || top === el || el.contains(top) || top.contains(el)) continue;
616
- if (isIntentionalOverlay(top)) continue;
617
- // F126.27 — elementFromPoint DOES return an opacity:0 / visibility:hidden
618
- // layer, but a layer nobody can see covers nothing. trailmem's hero stacks
619
- // two crossfading title spans on purpose; the transparent one was named as
620
- // covering the visible one (run 758697dd, 7 high). Same test the covered
621
- // side already uses (nothingToLose), now on the occluder side too.
622
- if (getComputedStyle(top).visibility === 'hidden' || isTransparentThroughChain(top)) continue;
623
- occluder = top;
624
- if (isCentre) centreCovered = true;
625
- else edgeCovered++;
611
+ // F008.30 — elementFromPoint skips pointer-events:none, so for such an element it
612
+ // answers with whatever is painted BEHIND it: a tooltip correctly on top read as
613
+ // «covered» (cardmem #45629). Made hit-testable for this synchronous loop only,
614
+ // then the exact inline value is put back.
615
+ const peEl = cs.pointerEvents === 'none' ? (el as HTMLElement) : null;
616
+ const peWas = peEl ? [peEl.style.getPropertyValue('pointer-events'), peEl.style.getPropertyPriority('pointer-events')] as const : null;
617
+ if (peEl) peEl.style.setProperty('pointer-events', 'auto', 'important');
618
+ try {
619
+ for (const [sx, sy, isCentre] of samples) {
620
+ if (sx < 0 || sy < 0 || sx > W || sy > H) continue;
621
+ if (sx < clipL || sx > clipR || sy < clipT || sy > clipB) continue;
622
+ const top = document.elementFromPoint(sx, sy);
623
+ if (!top || top === el || el.contains(top) || top.contains(el)) continue;
624
+ if (isIntentionalOverlay(top)) continue;
625
+ // F126.27 — elementFromPoint DOES return an opacity:0 / visibility:hidden
626
+ // layer, but a layer nobody can see covers nothing. trailmem's hero stacks
627
+ // two crossfading title spans on purpose; the transparent one was named as
628
+ // covering the visible one (run 758697dd, 7 high). Same test the covered
629
+ // side already uses (nothingToLose), now on the occluder side too.
630
+ if (getComputedStyle(top).visibility === 'hidden' || isTransparentThroughChain(top)) continue;
631
+ occluder = top;
632
+ if (isCentre) centreCovered = true;
633
+ else edgeCovered++;
634
+ }
635
+ } finally {
636
+ if (peEl && peWas) {
637
+ if (peWas[0]) peEl.style.setProperty('pointer-events', peWas[0], peWas[1]);
638
+ else peEl.style.removeProperty('pointer-events');
639
+ }
626
640
  }
627
641
  if (occluder && (centreCovered || edgeCovered >= 1) && !nothingToLose(el, cs, c.interactive)) {
628
642
  const coversMeaning = centreCovered || c.text; // text whose edge is covered loses content