@ohhwells/bridge 0.1.153 → 0.1.155

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.js CHANGED
@@ -7161,6 +7161,21 @@ function applyCustomCodeToHead(content) {
7161
7161
  if (beforeNodes.length > 0) document.head.append(...beforeNodes);
7162
7162
  }
7163
7163
 
7164
+ // src/lib/selectNavContainer.ts
7165
+ function isOnScreen(el) {
7166
+ const rect = el.getBoundingClientRect();
7167
+ if (rect.width <= 0 || rect.height <= 0) return false;
7168
+ if (el.offsetParent !== null) return true;
7169
+ return getComputedStyle(el).position === "fixed";
7170
+ }
7171
+ function findSelectableNavContainer(doc = document) {
7172
+ const visible = Array.from(doc.querySelectorAll("[data-ohw-nav-container]")).filter(isOnScreen);
7173
+ if (visible.length === 0) return null;
7174
+ return visible.reduce(
7175
+ (best, el) => el.getBoundingClientRect().top < best.getBoundingClientRect().top ? el : best
7176
+ );
7177
+ }
7178
+
7164
7179
  // src/ui/ai-tree/aiSectionsManager.tsx
7165
7180
  import { flushSync } from "react-dom";
7166
7181
  import { createRoot } from "react-dom/client";
@@ -16919,7 +16934,7 @@ function apiBase() {
16919
16934
  function bridgeVersion() {
16920
16935
  try {
16921
16936
  if (true) {
16922
- return "0.1.153";
16937
+ return "0.1.155";
16923
16938
  }
16924
16939
  } catch {
16925
16940
  }
@@ -16933,7 +16948,7 @@ function stampBridgeVersionOnDocument() {
16933
16948
  return;
16934
16949
  }
16935
16950
  try {
16936
- const v = true ? "0.1.153" : "";
16951
+ const v = true ? "0.1.155" : "";
16937
16952
  if (v) {
16938
16953
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
16939
16954
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -16942,10 +16957,19 @@ function stampBridgeVersionOnDocument() {
16942
16957
  }
16943
16958
  }
16944
16959
  var RECOVERABLE_PAGE_ERROR = /Minified React error #(?:418|419|421|422|423|425)\b|Hydration failed because the initial UI does not match|Text content does not match server-rendered HTML|There was an error while hydrating|did not match\. Server:/i;
16960
+ function isVercelPreviewHost() {
16961
+ if (typeof location === "undefined") {
16962
+ return false;
16963
+ }
16964
+ return location.hostname.toLowerCase().endsWith(".vercel.ohhwells.site");
16965
+ }
16945
16966
  function reportOutageBeacon(args) {
16946
16967
  if (typeof window === "undefined" || !args.subdomain) {
16947
16968
  return;
16948
16969
  }
16970
+ if (isVercelPreviewHost()) {
16971
+ return;
16972
+ }
16949
16973
  if (args.reason === "page_error" && args.detail && RECOVERABLE_PAGE_ERROR.test(args.detail)) {
16950
16974
  return;
16951
16975
  }
@@ -30745,6 +30769,12 @@ function OhhwellsBridge() {
30745
30769
  clearIconSelectionRef.current();
30746
30770
  };
30747
30771
  window.addEventListener("message", handleDeactivate);
30772
+ const handleSelectNav = (e) => {
30773
+ if (e.data?.type !== "ow:select-nav") return;
30774
+ const navContainer = findSelectableNavContainer();
30775
+ if (navContainer) selectFrameRef.current(navContainer);
30776
+ };
30777
+ window.addEventListener("message", handleSelectNav);
30748
30778
  const handleToastAction = (e) => {
30749
30779
  if (e.data?.type !== "ow:toast-action") return;
30750
30780
  const actionId = typeof e.data.actionId === "string" ? e.data.actionId : null;
@@ -31561,6 +31591,7 @@ function OhhwellsBridge() {
31561
31591
  window.removeEventListener("message", handleDeleteSection);
31562
31592
  window.removeEventListener("message", handleDuplicateSection);
31563
31593
  window.removeEventListener("message", handleDeactivate);
31594
+ window.removeEventListener("message", handleSelectNav);
31564
31595
  document.documentElement.removeAttribute("data-ohw-panel-dragging");
31565
31596
  window.removeEventListener("message", handleToastAction);
31566
31597
  window.removeEventListener("message", handleFormCount);
@@ -31858,7 +31889,7 @@ function OhhwellsBridge() {
31858
31889
  postToParent2({
31859
31890
  type: "ow:ready",
31860
31891
  version: "1",
31861
- bridgeVersion: "0.1.153",
31892
+ bridgeVersion: "0.1.155",
31862
31893
  path: pathname,
31863
31894
  nodes: collectEditableNodes(editContentRef.current),
31864
31895
  sections