@ohhwells/bridge 0.1.168 → 0.1.169

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/dist/index.cjs CHANGED
@@ -17608,7 +17608,7 @@ function apiBase() {
17608
17608
  function bridgeVersion() {
17609
17609
  try {
17610
17610
  if (true) {
17611
- return "0.1.168";
17611
+ return "0.1.169";
17612
17612
  }
17613
17613
  } catch {
17614
17614
  }
@@ -17622,7 +17622,7 @@ function stampBridgeVersionOnDocument() {
17622
17622
  return;
17623
17623
  }
17624
17624
  try {
17625
- const v = true ? "0.1.168" : "";
17625
+ const v = true ? "0.1.169" : "";
17626
17626
  if (v) {
17627
17627
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17628
17628
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -18604,6 +18604,12 @@ function highlightChangedElements(keys, item, sectionId) {
18604
18604
  clearTimer = setTimeout(clearChangeHighlight, HIGHLIGHT_MS);
18605
18605
  return targets.length;
18606
18606
  }
18607
+ function highlightedRect() {
18608
+ const first = document.querySelector(`[${MARK_ATTR}]`);
18609
+ if (!first) return null;
18610
+ const rect = first.getBoundingClientRect();
18611
+ return { top: rect.top + window.scrollY, bottom: rect.bottom + window.scrollY };
18612
+ }
18607
18613
  function installAiChangeHighlight() {
18608
18614
  const onMessage = (e) => {
18609
18615
  const data = e.data;
@@ -18613,7 +18619,8 @@ function installAiChangeHighlight() {
18613
18619
  const item = raw && typeof raw.sectionId === "string" && typeof raw.group === "string" && typeof raw.index === "number" ? { sectionId: raw.sectionId, group: raw.group, index: raw.index } : void 0;
18614
18620
  const sectionId = typeof data.sectionId === "string" ? data.sectionId : void 0;
18615
18621
  const found = highlightChangedElements(keys, item, sectionId);
18616
- window.parent?.postMessage({ type: "ow:ai-highlight-done", found }, "*");
18622
+ const rect = data.reveal === true && found > 0 ? highlightedRect() : null;
18623
+ window.parent?.postMessage({ type: "ow:ai-highlight-done", found, ...rect ? { rect } : {} }, "*");
18617
18624
  };
18618
18625
  window.addEventListener("message", onMessage);
18619
18626
  return () => window.removeEventListener("message", onMessage);
@@ -32805,7 +32812,7 @@ function OhhwellsBridge() {
32805
32812
  postToParent2({
32806
32813
  type: "ow:ready",
32807
32814
  version: "1",
32808
- bridgeVersion: "0.1.168",
32815
+ bridgeVersion: "0.1.169",
32809
32816
  path: pathname,
32810
32817
  nodes: collectEditableNodes(editContentRef.current),
32811
32818
  sections