@ohhwells/bridge 0.1.54-next.156 → 0.1.54-next.157

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
@@ -9927,16 +9927,20 @@ function reconcileSocialsFromContent(content, root = document) {
9927
9927
  applySocialsOrder(stored, root);
9928
9928
  }
9929
9929
  var DROP_BAR_THICKNESS = 3;
9930
+ var DROP_BAR_GAP = 8;
9930
9931
  function buildSocialDropSlots(row) {
9931
9932
  const items = listSocialItems(row);
9932
9933
  if (!items.length) return [];
9933
- return items.concat(items[items.length - 1]).map((item, index) => {
9934
- const rect = item.getBoundingClientRect();
9935
- const left = (index === items.length ? rect.right : rect.left) - DROP_BAR_THICKNESS / 2;
9934
+ const rects = items.map((item) => item.getBoundingClientRect());
9935
+ return items.concat(items[items.length - 1]).map((_, index) => {
9936
+ const previous = rects[index - 1];
9937
+ const next = rects[index];
9938
+ const centre = previous && next ? (previous.right + next.left) / 2 : next ? next.left - DROP_BAR_GAP : previous.right + DROP_BAR_GAP;
9939
+ const rect = next ?? previous;
9936
9940
  return {
9937
9941
  insertIndex: index,
9938
9942
  columnIndex: -1,
9939
- left,
9943
+ left: centre - DROP_BAR_THICKNESS / 2,
9940
9944
  top: rect.top,
9941
9945
  width: DROP_BAR_THICKNESS,
9942
9946
  height: rect.height,
@@ -15462,7 +15466,6 @@ function OhhwellsBridge() {
15462
15466
  reconcileFooterOrderFromContent(content);
15463
15467
  reconcileSocialsFromContent(content);
15464
15468
  applySocialsDisplayFromContent(content);
15465
- applySocialsDisplayFromContent(content);
15466
15469
  } finally {
15467
15470
  observer?.observe(document.body, { childList: true, subtree: true });
15468
15471
  }
@@ -15542,7 +15545,6 @@ function OhhwellsBridge() {
15542
15545
  reconcileFooterOrderFromContent(content);
15543
15546
  reconcileSocialsFromContent(content);
15544
15547
  applySocialsDisplayFromContent(content);
15545
- applySocialsDisplayFromContent(content);
15546
15548
  document.querySelectorAll("footer [data-ohw-href-key]").forEach((el) => {
15547
15549
  if (isFooterHrefKey(el.getAttribute("data-ohw-href-key"))) {
15548
15550
  disableNativeHrefDrag(el);
@@ -16084,7 +16086,7 @@ function OhhwellsBridge() {
16084
16086
  const selected = selectedElRef.current;
16085
16087
  if (selected && (selected === editable || selected.contains(editable))) return;
16086
16088
  if (!isMediaEditable(editable) && !editable.hasAttribute("contenteditable")) {
16087
- if (isIconEditable(editable)) {
16089
+ if (isIconEditable(editable) && !getSocialItem(editable)) {
16088
16090
  hoveredItemElRef.current = editable;
16089
16091
  setHoveredItemRect(editable.getBoundingClientRect());
16090
16092
  return;
@@ -16154,7 +16156,7 @@ function OhhwellsBridge() {
16154
16156
  const related = e.relatedTarget instanceof Element ? e.relatedTarget : null;
16155
16157
  if (related?.closest("[data-ohw-drag-handle-container], [data-ohw-item-interaction]")) return;
16156
16158
  if (!isMediaEditable(editable)) {
16157
- if (isIconEditable(editable) && hoveredItemElRef.current === editable) {
16159
+ if (isIconEditable(editable) && !getSocialItem(editable) && hoveredItemElRef.current === editable) {
16158
16160
  if (!related?.closest("[data-ohw-item-interaction]")) {
16159
16161
  hoveredItemElRef.current = null;
16160
16162
  setHoveredItemRect(null);
@@ -17827,9 +17829,9 @@ function OhhwellsBridge() {
17827
17829
  return;
17828
17830
  }
17829
17831
  if (target.closest("[data-ohw-item-drag-surface]")) return;
17830
- const anchor = getNavigationItemAnchor(target);
17832
+ const anchor = getNavigationItemAnchor(target) ?? (document.elementsFromPoint(e.clientX, e.clientY).map((el) => el instanceof HTMLElement ? getNavigationItemAnchor(el) : null).find((found) => found !== null) ?? null);
17831
17833
  const hrefKey = anchor?.getAttribute("data-ohw-href-key") ?? null;
17832
- if (anchor && isFooterHrefKey(hrefKey)) {
17834
+ if (anchor && (isFooterHrefKey(hrefKey) || getSocialItem(anchor))) {
17833
17835
  footerPointerDragRef.current = {
17834
17836
  el: anchor,
17835
17837
  kind: "link",
@@ -17889,7 +17891,7 @@ function OhhwellsBridge() {
17889
17891
  const column = findFooterColumnForLink(pending.el);
17890
17892
  const columns2 = listFooterColumns();
17891
17893
  beginFooterDragRef.current({
17892
- kind: "link",
17894
+ kind: getSocialItem(pending.el) ? "social" : "link",
17893
17895
  hrefKey: key,
17894
17896
  columnEl: column,
17895
17897
  sourceColumnIndex: column ? columns2.indexOf(column) : 0,