@ohhwells/bridge 0.1.77 → 0.1.78

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
@@ -7360,6 +7360,10 @@ function topLevelSections() {
7360
7360
  function instanceIdOf(el) {
7361
7361
  return el.dataset.ohwInstance ?? el.dataset.ohwSection ?? "";
7362
7362
  }
7363
+ function findByInstanceId(instanceId) {
7364
+ const escapedId = CSS.escape(instanceId);
7365
+ return document.querySelector(`[data-ohw-instance="${escapedId}"]`) ?? document.querySelector(`[data-ohw-section="${escapedId}"]:not([data-ohw-instance])`);
7366
+ }
7363
7367
  function planSectionMove(instanceId, targetIndex, currentPath) {
7364
7368
  const sections = topLevelSections();
7365
7369
  const index = sections.findIndex((el) => instanceIdOf(el) === instanceId);
@@ -7395,7 +7399,7 @@ function syncRemovedFlags(entries) {
7395
7399
  }
7396
7400
  });
7397
7401
  for (const id of removedIds) {
7398
- const el = document.querySelector(`[data-ohw-instance="${CSS.escape(id)}"]`);
7402
+ const el = findByInstanceId(id);
7399
7403
  if (el) {
7400
7404
  el.style.display = "none";
7401
7405
  el.setAttribute(REMOVED_ATTR2, "");
@@ -7423,9 +7427,7 @@ function applyPersistedOrder(entries) {
7423
7427
  }
7424
7428
  }
7425
7429
  function setSectionRemoved(instanceId, currentPath, existingEntries, removed) {
7426
- const escapedId = CSS.escape(instanceId);
7427
- if (!document.querySelector(`[data-ohw-instance="${escapedId}"]`) && !document.querySelector(`[data-ohw-section="${escapedId}"]:not([data-ohw-instance])`))
7428
- return null;
7430
+ if (!findByInstanceId(instanceId)) return null;
7429
7431
  const byId = new Map(existingEntries.map((e) => [e.instanceId, e]));
7430
7432
  const allSections = Array.from(document.querySelectorAll("[data-ohw-section]")).filter(
7431
7433
  (el) => !el.parentElement?.closest("[data-ohw-section]") && !isChromeSection(el)
@@ -20121,7 +20123,7 @@ function OhhwellsBridge() {
20121
20123
  postToParent2({
20122
20124
  type: "ow:ready",
20123
20125
  version: "1",
20124
- bridgeVersion: "0.1.76",
20126
+ bridgeVersion: "0.1.77",
20125
20127
  path: pathname,
20126
20128
  nodes: collectEditableNodes(editContentRef.current),
20127
20129
  sections