@ohhwells/bridge 0.1.169-next.449 → 0.1.169-next.450

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
@@ -323,6 +323,7 @@ function softUnhide(el) {
323
323
  // src/lib/section-instances.ts
324
324
  var SECTION_ORDER_KEY = "__ohw_section_order";
325
325
  var REMOVED_ATTR = "data-ohw-section-removed";
326
+ var CLONE_ATTR = "data-ohw-section-clone";
326
327
  function isRemovedSection(el) {
327
328
  return el.hasAttribute(REMOVED_ATTR);
328
329
  }
@@ -451,6 +452,7 @@ function duplicateSectionInstance(instanceId, newId, currentPath, existingEntrie
451
452
  if (!original) return null;
452
453
  const clone = original.cloneNode(true);
453
454
  clone.setAttribute("data-ohw-instance", newId);
455
+ clone.setAttribute(CLONE_ATTR, "");
454
456
  const keyRekeys = rekeySectionSubtree(clone, newId);
455
457
  original.insertAdjacentElement("afterend", clone);
456
458
  const byId = new Map(existingEntries.map((e) => [e.instanceId, e]));
@@ -530,6 +532,10 @@ function initSectionInstancesFromContent(content, currentPath) {
530
532
  if (type) el.setAttribute("data-ohw-instance", type);
531
533
  });
532
534
  const entries = getPageSectionOrderEntries(content[SECTION_ORDER_KEY], currentPath);
535
+ const listed = new Set(entries.map((entry) => entry.instanceId));
536
+ document.querySelectorAll(`[${CLONE_ATTR}]`).forEach((clone) => {
537
+ if (!listed.has(instanceIdOf(clone))) clone.remove();
538
+ });
533
539
  for (const entry of entries) {
534
540
  if (entry.instanceId === entry.type) continue;
535
541
  if (document.querySelector(`[data-ohw-instance="${CSS.escape(entry.instanceId)}"]`)) continue;
@@ -539,6 +545,7 @@ function initSectionInstancesFromContent(content, currentPath) {
539
545
  if (!original) continue;
540
546
  const clone = original.cloneNode(true);
541
547
  clone.setAttribute("data-ohw-instance", entry.instanceId);
548
+ clone.setAttribute(CLONE_ATTR, "");
542
549
  rekeySectionSubtree(clone, entry.instanceId);
543
550
  original.insertAdjacentElement("afterend", clone);
544
551
  }
@@ -4938,6 +4945,9 @@ function reconcileNavbarItemsFromContent(content) {
4938
4945
  }
4939
4946
  }
4940
4947
  pruneNavbarItemsNotInOrder(allowed);
4948
+ for (const node of orderForest) {
4949
+ if (node.children.length === 0) collapseEmptyNavDropdownForParent(node.id);
4950
+ }
4941
4951
  applyNavForest(orderForest);
4942
4952
  for (const parentKey of openParentKeys) {
4943
4953
  const trigger = document.querySelector(
@@ -17870,7 +17880,7 @@ function apiBase() {
17870
17880
  function bridgeVersion() {
17871
17881
  try {
17872
17882
  if (true) {
17873
- return "0.1.169-next.449";
17883
+ return "0.1.169-next.450";
17874
17884
  }
17875
17885
  } catch {
17876
17886
  }
@@ -17884,7 +17894,7 @@ function stampBridgeVersionOnDocument() {
17884
17894
  return;
17885
17895
  }
17886
17896
  try {
17887
- const v = true ? "0.1.169-next.449" : "";
17897
+ const v = true ? "0.1.169-next.450" : "";
17888
17898
  if (v) {
17889
17899
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17890
17900
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -33131,7 +33141,7 @@ function OhhwellsBridge() {
33131
33141
  postToParent2({
33132
33142
  type: "ow:ready",
33133
33143
  version: "1",
33134
- bridgeVersion: "0.1.169-next.449",
33144
+ bridgeVersion: "0.1.169-next.450",
33135
33145
  path: pathname,
33136
33146
  nodes: collectEditableNodes(editContentRef.current),
33137
33147
  sections