@ohhwells/bridge 0.1.93 → 0.1.94

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
@@ -2188,6 +2188,22 @@ function applyAiSectionsToDom(state, options) {
2188
2188
  syncRemovedSections(state);
2189
2189
  syncTemplateHidden(state, pageSections.length > 0);
2190
2190
  }
2191
+ function unmountAllAiSections() {
2192
+ for (const [, section] of mounted) {
2193
+ section.root.unmount();
2194
+ section.container.remove();
2195
+ }
2196
+ mounted.clear();
2197
+ if (typeof document === "undefined") return;
2198
+ for (const el of document.querySelectorAll(`[${REPLACED_ATTR}]`)) {
2199
+ el.style.removeProperty("display");
2200
+ el.removeAttribute(REPLACED_ATTR);
2201
+ }
2202
+ for (const el of document.querySelectorAll(`[${REMOVED_ATTR}]`)) {
2203
+ el.style.removeProperty("display");
2204
+ el.removeAttribute(REMOVED_ATTR);
2205
+ }
2206
+ }
2191
2207
 
2192
2208
  // src/useLinkHrefGuardian.ts
2193
2209
  import { useLayoutEffect } from "react";
@@ -18360,6 +18376,22 @@ function OhhwellsBridge() {
18360
18376
  useEffect13(() => {
18361
18377
  postToParent2({ type: "ow:navigation", path: pathname });
18362
18378
  }, [pathname, postToParent2]);
18379
+ useEffect13(() => {
18380
+ if (!subdomain || isEditMode) return;
18381
+ const content = contentCache.get(subdomain);
18382
+ if (!content) return;
18383
+ unmountAllAiSections();
18384
+ initSectionsFromContent(
18385
+ content,
18386
+ /*removeExisting*/
18387
+ true,
18388
+ pathname
18389
+ );
18390
+ if (typeof content[AI_SECTIONS_KEY] === "string") {
18391
+ setAiSectionOrder(content[SECTION_ORDER_KEY], pathname);
18392
+ applyAiSectionsToDom(parseAiSectionsState(content[AI_SECTIONS_KEY]));
18393
+ }
18394
+ }, [pathname, subdomain, isEditMode]);
18363
18395
  useEffect13(() => {
18364
18396
  if (!isEditMode) return;
18365
18397
  if (linkPopoverSessionRef.current?.intent === "add-nav") return;
@@ -21441,7 +21473,7 @@ function OhhwellsBridge() {
21441
21473
  postToParent2({
21442
21474
  type: "ow:ready",
21443
21475
  version: "1",
21444
- bridgeVersion: "0.1.92",
21476
+ bridgeVersion: "0.1.93",
21445
21477
  path: pathname,
21446
21478
  nodes: collectEditableNodes(editContentRef.current),
21447
21479
  sections