@ohhwells/bridge 0.1.105 → 0.1.106

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
@@ -19501,10 +19501,21 @@ function OhhwellsBridge() {
19501
19501
  gap: 6px;
19502
19502
  }
19503
19503
  /* Not the form: it is a layout container (flex/grid with gaps), and forcing block
19504
- crushed its fields together (OHH-490). */
19505
- [data-ohw-editable]:not([data-ohw-editable="form"]) {
19504
+ crushed its fields together (OHH-490). Not media (image/bg-image/video/icon/map)
19505
+ either: those can be their own flex containers centering fallback content (a
19506
+ placeholder label, a mascot emoji) \u2014 forcing block broke that centering while the
19507
+ image was unset (OHH-758-ish). */
19508
+ [data-ohw-editable]:not([data-ohw-editable="form"]):not([data-ohw-editable="image"]):not([data-ohw-editable="bg-image"]):not([data-ohw-editable="video"]):not([data-ohw-editable="icon"]):not([data-ohw-editable="map"]) {
19506
19509
  display: block;
19507
19510
  }
19511
+ /* The block-force above is an author rule, so it beats the browser's own
19512
+ details-not-open child-display-none UA rule \u2014 origin always wins over specificity.
19513
+ Left alone, a closed FAQ's answer became a real, hoverable box that overflowed past
19514
+ the collapsed <details> into the gap before the next item. Restore the native
19515
+ collapse for editable content once it isn't the summary. */
19516
+ details:not([open]) > [data-ohw-editable]:not(summary) {
19517
+ display: none !important;
19518
+ }
19508
19519
  /* Body text (no item-action toolbar) \u2014 first click enters text edit \u2192 I-beam.
19509
19520
  Exclude select-first nav/footer labels so grab/default on [data-ohw-href-key] can win. */
19510
19521
  [data-ohw-editable]:not([contenteditable]):not([data-ohw-editable="image"]):not([data-ohw-editable="bg-image"]):not([data-ohw-editable="video"]):not([data-ohw-editable="link"]):not(:is([data-ohw-href-key] *)) {
@@ -19528,6 +19539,14 @@ function OhhwellsBridge() {
19528
19539
  [data-ohw-editable="video"], [data-ohw-editable="video"] *,
19529
19540
  [data-ohw-editable="bg-image"], [data-ohw-editable="bg-image"] * { cursor: pointer !important; }
19530
19541
  [data-ohw-editable="link"], [data-ohw-editable="link"] * { cursor: pointer !important; }
19542
+ /* A text/plain editable nested inside a media editable (e.g. a placeholder's fallback
19543
+ label inside its bg-image box) is its own click target, not the media picker \u2014 the
19544
+ blanket media cursor rule above would otherwise show pointer where a click actually
19545
+ opens text edit. */
19546
+ [data-ohw-editable="bg-image"] [data-ohw-editable="text"],
19547
+ [data-ohw-editable="bg-image"] [data-ohw-editable="text"] *,
19548
+ [data-ohw-editable="image"] [data-ohw-editable="text"],
19549
+ [data-ohw-editable="image"] [data-ohw-editable="text"] * { cursor: text !important; }
19531
19550
  /* A form field is a design surface in the editor: its input takes the pointer so the
19532
19551
  field can be picked and hovered from anywhere inside it (OHH-642). */
19533
19552
  [data-ohw-editable="form"] [data-ohw-form-field] input,
@@ -20114,6 +20133,8 @@ function OhhwellsBridge() {
20114
20133
  setFormHoverRect(null);
20115
20134
  }
20116
20135
  if (!editable) return;
20136
+ const editableRect = editable.getBoundingClientRect();
20137
+ if (editableRect.width <= 0 || editableRect.height <= 0) return;
20117
20138
  const selected = selectedElRef.current;
20118
20139
  if (selected && (selected === editable || selected.contains(editable))) return;
20119
20140
  if (!isMediaEditable(editable) && !editable.hasAttribute("contenteditable")) {
@@ -22217,6 +22238,18 @@ function OhhwellsBridge() {
22217
22238
  hoveredNavContainerRef.current = null;
22218
22239
  setHoveredNavContainerRect(null);
22219
22240
  };
22241
+ const handleDetailsToggle = (e) => {
22242
+ if (e.target?.tagName !== "DETAILS") return;
22243
+ document.querySelectorAll("[data-ohw-hovered]").forEach((hovered) => {
22244
+ hovered.removeAttribute("data-ohw-hovered");
22245
+ });
22246
+ setHoveredTextRect(null);
22247
+ hoveredItemElRef.current = null;
22248
+ setHoveredItemRect(null);
22249
+ hoveredNavContainerRef.current = null;
22250
+ setHoveredNavContainerRect(null);
22251
+ };
22252
+ document.addEventListener("toggle", handleDetailsToggle, true);
22220
22253
  window.addEventListener("resize", handleViewportResize, { passive: true });
22221
22254
  document.addEventListener("click", handleClick, true);
22222
22255
  document.addEventListener("dblclick", handleDblClick, true);
@@ -22234,6 +22267,7 @@ function OhhwellsBridge() {
22234
22267
  document.addEventListener("selectionchange", handleSelectionChange);
22235
22268
  window.addEventListener("scroll", handleScroll, true);
22236
22269
  return () => {
22270
+ document.removeEventListener("toggle", handleDetailsToggle, true);
22237
22271
  document.removeEventListener("click", handleClick, true);
22238
22272
  document.removeEventListener("dblclick", handleDblClick, true);
22239
22273
  document.removeEventListener("paste", handlePaste, true);
@@ -22487,7 +22521,7 @@ function OhhwellsBridge() {
22487
22521
  postToParent2({
22488
22522
  type: "ow:ready",
22489
22523
  version: "1",
22490
- bridgeVersion: "0.1.104",
22524
+ bridgeVersion: "0.1.105",
22491
22525
  path: pathname,
22492
22526
  nodes: collectEditableNodes(editContentRef.current),
22493
22527
  sections