@ohhwells/bridge 0.1.179-next.479 → 0.1.179-next.480

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
@@ -20395,6 +20395,7 @@ function insertField(form, type) {
20395
20395
  wrapper.setAttribute(FIELD_ATTR, key);
20396
20396
  wrapper.setAttribute(FIELD_TYPE_ATTR, type);
20397
20397
  wrapper.removeAttribute(DROPDOWN_OPEN_ATTR);
20398
+ wrapper.removeAttribute("data-half");
20398
20399
  applyFieldType(wrapper, type);
20399
20400
  const defaults = FIELD_DEFAULTS[type];
20400
20401
  const input = fieldControlOf(wrapper);
@@ -20418,6 +20419,7 @@ function duplicateField(form, wrapper) {
20418
20419
  const key = uniqueKey(form, `${fieldKeyOf(wrapper)}-copy`);
20419
20420
  copy.setAttribute(FIELD_ATTR, key);
20420
20421
  copy.removeAttribute(DROPDOWN_OPEN_ATTR);
20422
+ copy.removeAttribute("data-half");
20421
20423
  clearDropdownOptionSelection(copy);
20422
20424
  const input = fieldControlOf(copy);
20423
20425
  if (input) {
@@ -20699,7 +20701,7 @@ function apiBase() {
20699
20701
  function bridgeVersion() {
20700
20702
  try {
20701
20703
  if (true) {
20702
- return "0.1.179-next.479";
20704
+ return "0.1.179-next.480";
20703
20705
  }
20704
20706
  } catch {
20705
20707
  }
@@ -20713,7 +20715,7 @@ function stampBridgeVersionOnDocument() {
20713
20715
  return;
20714
20716
  }
20715
20717
  try {
20716
- const v = true ? "0.1.179-next.479" : "";
20718
+ const v = true ? "0.1.179-next.480" : "";
20717
20719
  if (v) {
20718
20720
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
20719
20721
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -31734,11 +31736,38 @@ function OhhwellsBridge() {
31734
31736
  }, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
31735
31737
  (0, import_react27.useEffect)(() => {
31736
31738
  if (!isEditMode) return;
31737
- const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
31738
- markFormFields(form);
31739
+ let applying = false;
31740
+ const syncForms = () => {
31741
+ if (applying) return;
31742
+ applying = true;
31743
+ try {
31744
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
31745
+ const key = formKeyOf(form);
31746
+ if (key && editContentRef.current[fieldsKey(key)]) {
31747
+ reconcileFieldsFromContent(form, editContentRef.current);
31748
+ } else {
31749
+ markFormFields(form);
31750
+ }
31751
+ });
31752
+ } finally {
31753
+ queueMicrotask(() => {
31754
+ applying = false;
31755
+ });
31756
+ }
31757
+ };
31758
+ syncForms();
31759
+ const observer = new MutationObserver((mutations) => {
31760
+ const structural = mutations.some(
31761
+ (m) => m.type === "childList" && (m.addedNodes.length > 0 || m.removedNodes.length > 0)
31762
+ );
31763
+ if (!structural) {
31764
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
31765
+ markFormFields(form);
31766
+ });
31767
+ return;
31768
+ }
31769
+ syncForms();
31739
31770
  });
31740
- mark();
31741
- const observer = new MutationObserver(() => mark());
31742
31771
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
31743
31772
  observer.observe(form, { childList: true, subtree: true, characterData: true });
31744
31773
  });
@@ -36004,7 +36033,7 @@ function OhhwellsBridge() {
36004
36033
  postToParent2({
36005
36034
  type: "ow:ready",
36006
36035
  version: "1",
36007
- bridgeVersion: "0.1.179-next.479",
36036
+ bridgeVersion: "0.1.179-next.480",
36008
36037
  path: pathname,
36009
36038
  nodes: collectEditableNodes(editContentRef.current),
36010
36039
  sections