@ohhwells/bridge 0.1.38-next.59 → 0.1.38-next.60

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
@@ -5804,12 +5804,15 @@ function SectionPickerOverlay({
5804
5804
  );
5805
5805
  sectionIdsRef.current = sectionIds;
5806
5806
  const rects = useSectionRects(sectionIdsKey, isOnTargetPage);
5807
- const applyHoverAt = (0, import_react5.useCallback)((x, y, liveRects) => {
5808
- const ids = sectionIdsRef.current;
5809
- const map = liveRects ?? readSectionRects(ids);
5810
- const next = hitTestSectionId(x, y, ids, map);
5811
- setHoveredId((prev) => prev === next ? prev : next);
5812
- }, []);
5807
+ const applyHoverAt = (0, import_react5.useCallback)(
5808
+ (x, y, liveRects) => {
5809
+ const ids = sectionIdsRef.current;
5810
+ const map = liveRects ?? readSectionRects(ids);
5811
+ const next = hitTestSectionId(x, y, ids, map);
5812
+ setHoveredId((prev) => prev === next ? prev : next);
5813
+ },
5814
+ []
5815
+ );
5813
5816
  (0, import_react5.useEffect)(() => {
5814
5817
  const applyClip = (iframeOffsetTop, visibleCanvasTop, canvasH) => {
5815
5818
  const top = Math.max(0, visibleCanvasTop - iframeOffsetTop);
@@ -5960,8 +5963,9 @@ function SectionPickerOverlay({
5960
5963
  const rect = rects.get(section.id);
5961
5964
  if (!rect || rect.width <= 0 || rect.height <= 0) return null;
5962
5965
  const isSelected = selectedId === section.id;
5963
- const isLit = isSelected || hoveredId === section.id;
5964
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
5966
+ const isHovered = hoveredId === section.id;
5967
+ const isLit = isSelected || isHovered;
5968
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
5965
5969
  "button",
5966
5970
  {
5967
5971
  type: "button",
@@ -5975,15 +5979,30 @@ function SectionPickerOverlay({
5975
5979
  },
5976
5980
  "aria-label": `Select section ${section.label}`,
5977
5981
  onClick: () => handleSelect(section),
5978
- children: isSelected ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
5979
- "span",
5980
- {
5981
- className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
5982
- style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
5983
- "aria-hidden": true,
5984
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.Check, { className: "size-5" })
5985
- }
5986
- ) : null
5982
+ children: [
5983
+ isLit ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
5984
+ "span",
5985
+ {
5986
+ className: "pointer-events-none absolute",
5987
+ style: {
5988
+ inset: 4,
5989
+ borderRadius: "var(--radius, 6px)",
5990
+ border: "1.5px dashed var(--primary, #0885FE)",
5991
+ boxSizing: "border-box"
5992
+ },
5993
+ "aria-hidden": true
5994
+ }
5995
+ ) : null,
5996
+ isSelected ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
5997
+ "span",
5998
+ {
5999
+ className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
6000
+ style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
6001
+ "aria-hidden": true,
6002
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.Check, { className: "size-5" })
6003
+ }
6004
+ ) : null
6005
+ ]
5987
6006
  },
5988
6007
  section.id
5989
6008
  );
@@ -6192,7 +6211,7 @@ function LinkPopover({
6192
6211
  (0, import_react7.useEffect)(() => {
6193
6212
  if (!open) return;
6194
6213
  if (sectionPickerActive) {
6195
- postToParent({ type: "ow:link-modal-lock", locked: false });
6214
+ postToParent({ type: "ui:unlock" });
6196
6215
  postToParent({ type: "ow:section-picker", active: true });
6197
6216
  document.documentElement.style.overflow = "";
6198
6217
  document.body.style.overflow = "";
@@ -6201,7 +6220,7 @@ function LinkPopover({
6201
6220
  };
6202
6221
  }
6203
6222
  postToParent({ type: "ow:section-picker", active: false });
6204
- postToParent({ type: "ow:link-modal-lock", locked: true });
6223
+ postToParent({ type: "ui:lock" });
6205
6224
  const html = document.documentElement;
6206
6225
  const body = document.body;
6207
6226
  const prevHtmlOverflow = html.style.overflow;
@@ -6239,7 +6258,7 @@ function LinkPopover({
6239
6258
  document.addEventListener("wheel", preventBackgroundScroll, scrollOpts);
6240
6259
  document.addEventListener("touchmove", preventBackgroundScroll, scrollOpts);
6241
6260
  return () => {
6242
- postToParent({ type: "ow:link-modal-lock", locked: false });
6261
+ postToParent({ type: "ui:unlock" });
6243
6262
  html.style.overflow = prevHtmlOverflow;
6244
6263
  body.style.overflow = prevBodyOverflow;
6245
6264
  html.style.overscrollBehavior = prevHtmlOverscroll;
@@ -9145,6 +9164,13 @@ function OhhwellsBridge() {
9145
9164
  deactivateRef.current();
9146
9165
  };
9147
9166
  window.addEventListener("message", handleDeactivate);
9167
+ const handleUiEscape = (e) => {
9168
+ if (e.data?.type !== "ui:escape") return;
9169
+ if (linkPopoverOpenRef.current) {
9170
+ setLinkPopoverRef.current(null);
9171
+ }
9172
+ };
9173
+ window.addEventListener("message", handleUiEscape);
9148
9174
  const handleKeyDown = (e) => {
9149
9175
  if (e.key === "Escape" && document.querySelector("[data-ohw-section-picker]")) return;
9150
9176
  if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "a" && activeElRef.current) {
@@ -9577,6 +9603,7 @@ function OhhwellsBridge() {
9577
9603
  window.removeEventListener("message", handleClickAt);
9578
9604
  window.removeEventListener("message", handleHydrate);
9579
9605
  window.removeEventListener("message", handleDeactivate);
9606
+ window.removeEventListener("message", handleUiEscape);
9580
9607
  autoSaveTimers.current.forEach(clearTimeout);
9581
9608
  autoSaveTimers.current.clear();
9582
9609
  if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);