@ohhwells/bridge 0.1.69-next.207 → 0.1.70-next.209

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
@@ -1927,6 +1927,17 @@ function applyAiSectionsToDom(state, options) {
1927
1927
  });
1928
1928
  mounted.set(entry.id, { root, container, serialized });
1929
1929
  }
1930
+ if (state.hideTemplate === true) {
1931
+ let prev = null;
1932
+ for (const entry of pageSections) {
1933
+ const el = mounted.get(entry.id)?.container;
1934
+ if (!el) continue;
1935
+ if (prev && !(prev.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_FOLLOWING)) {
1936
+ prev.insertAdjacentElement("afterend", el);
1937
+ }
1938
+ prev = el;
1939
+ }
1940
+ }
1930
1941
  syncReplacedOriginals(state);
1931
1942
  syncRemovedSections(state);
1932
1943
  syncTemplateHidden(state, pageSections.length > 0);
@@ -8253,10 +8264,11 @@ function applyPersistedOrder(entries) {
8253
8264
  if (bOrder === void 0) return -1;
8254
8265
  return aOrder - bOrder;
8255
8266
  });
8256
- const parent = sections[0].parentElement;
8257
- if (!parent) return;
8258
- const anchor = sections[sections.length - 1].nextSibling;
8259
- ordered.forEach((el) => parent.insertBefore(el, anchor));
8267
+ let prev = null;
8268
+ for (const el of ordered) {
8269
+ if (prev) prev.after(el);
8270
+ prev = el;
8271
+ }
8260
8272
  }
8261
8273
  function getPageSectionOrderEntries(raw, currentPath) {
8262
8274
  if (!raw) return [];
@@ -17474,11 +17486,15 @@ function OhhwellsBridge() {
17474
17486
  if (typeof content[BRAND_KIT_KEY] === "string") {
17475
17487
  applyBrandToDom(parseBrandKit(content[BRAND_KIT_KEY]));
17476
17488
  }
17489
+ if (typeof content[AI_SECTIONS_KEY] === "string") {
17490
+ applyAiSectionsToDom(parseAiSectionsState(content[AI_SECTIONS_KEY]));
17491
+ }
17477
17492
  if (typeof content[STYLE_STORE_KEY] === "string") {
17478
17493
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
17479
17494
  }
17480
17495
  for (const [key, val] of Object.entries(content)) {
17481
17496
  if (key === "__ohw_sections") continue;
17497
+ if (key === AI_SECTIONS_KEY) continue;
17482
17498
  if (key === LOGO_PLACEHOLDER_KEY) continue;
17483
17499
  if (LOGO_IMAGE_KEYS.includes(key)) continue;
17484
17500
  if (key === BRAND_KIT_KEY) continue;
@@ -20354,7 +20370,7 @@ function OhhwellsBridge() {
20354
20370
  postToParent2({
20355
20371
  type: "ow:ready",
20356
20372
  version: "1",
20357
- bridgeVersion: "0.1.69",
20373
+ bridgeVersion: "0.1.70",
20358
20374
  path: pathname,
20359
20375
  nodes: collectEditableNodes(editContentRef.current),
20360
20376
  sections