@ohhwells/bridge 0.1.153 → 0.1.154

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
@@ -7271,6 +7271,21 @@ function applyCustomCodeToHead(content) {
7271
7271
  if (beforeNodes.length > 0) document.head.append(...beforeNodes);
7272
7272
  }
7273
7273
 
7274
+ // src/lib/selectNavContainer.ts
7275
+ function isOnScreen(el) {
7276
+ const rect = el.getBoundingClientRect();
7277
+ if (rect.width <= 0 || rect.height <= 0) return false;
7278
+ if (el.offsetParent !== null) return true;
7279
+ return getComputedStyle(el).position === "fixed";
7280
+ }
7281
+ function findSelectableNavContainer(doc = document) {
7282
+ const visible = Array.from(doc.querySelectorAll("[data-ohw-nav-container]")).filter(isOnScreen);
7283
+ if (visible.length === 0) return null;
7284
+ return visible.reduce(
7285
+ (best, el) => el.getBoundingClientRect().top < best.getBoundingClientRect().top ? el : best
7286
+ );
7287
+ }
7288
+
7274
7289
  // src/ui/ai-tree/aiSectionsManager.tsx
7275
7290
  var import_react_dom = require("react-dom");
7276
7291
  var import_client = require("react-dom/client");
@@ -17029,7 +17044,7 @@ function apiBase() {
17029
17044
  function bridgeVersion() {
17030
17045
  try {
17031
17046
  if (true) {
17032
- return "0.1.153";
17047
+ return "0.1.154";
17033
17048
  }
17034
17049
  } catch {
17035
17050
  }
@@ -17043,7 +17058,7 @@ function stampBridgeVersionOnDocument() {
17043
17058
  return;
17044
17059
  }
17045
17060
  try {
17046
- const v = true ? "0.1.153" : "";
17061
+ const v = true ? "0.1.154" : "";
17047
17062
  if (v) {
17048
17063
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17049
17064
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -30849,6 +30864,12 @@ function OhhwellsBridge() {
30849
30864
  clearIconSelectionRef.current();
30850
30865
  };
30851
30866
  window.addEventListener("message", handleDeactivate);
30867
+ const handleSelectNav = (e) => {
30868
+ if (e.data?.type !== "ow:select-nav") return;
30869
+ const navContainer = findSelectableNavContainer();
30870
+ if (navContainer) selectFrameRef.current(navContainer);
30871
+ };
30872
+ window.addEventListener("message", handleSelectNav);
30852
30873
  const handleToastAction = (e) => {
30853
30874
  if (e.data?.type !== "ow:toast-action") return;
30854
30875
  const actionId = typeof e.data.actionId === "string" ? e.data.actionId : null;
@@ -31665,6 +31686,7 @@ function OhhwellsBridge() {
31665
31686
  window.removeEventListener("message", handleDeleteSection);
31666
31687
  window.removeEventListener("message", handleDuplicateSection);
31667
31688
  window.removeEventListener("message", handleDeactivate);
31689
+ window.removeEventListener("message", handleSelectNav);
31668
31690
  document.documentElement.removeAttribute("data-ohw-panel-dragging");
31669
31691
  window.removeEventListener("message", handleToastAction);
31670
31692
  window.removeEventListener("message", handleFormCount);
@@ -31962,7 +31984,7 @@ function OhhwellsBridge() {
31962
31984
  postToParent2({
31963
31985
  type: "ow:ready",
31964
31986
  version: "1",
31965
- bridgeVersion: "0.1.153",
31987
+ bridgeVersion: "0.1.154",
31966
31988
  path: pathname,
31967
31989
  nodes: collectEditableNodes(editContentRef.current),
31968
31990
  sections