@ohhwells/bridge 0.1.81 → 0.1.83

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
@@ -409,7 +409,9 @@ var NODE_WROTE_ATTR = "data-ohw-style-node";
409
409
  var NODE_PROPS = ["color", "font-family", "font-size", "background"];
410
410
  function saveInline(el, prop) {
411
411
  const attr = `data-ohw-style-prev-${prop}`;
412
- if (!el.hasAttribute(attr)) el.setAttribute(attr, el.style.getPropertyValue(prop));
412
+ if (el.hasAttribute(attr)) return;
413
+ const value = el.style.getPropertyValue(prop) || (prop === "background" ? el.style.getPropertyValue("background-color") : "");
414
+ el.setAttribute(attr, value);
413
415
  }
414
416
  function restoreInline(el, prop) {
415
417
  const attr = `data-ohw-style-prev-${prop}`;
@@ -460,7 +462,8 @@ function applyStylesToDom(store) {
460
462
  const sections = document.querySelectorAll(
461
463
  `[data-ohw-section="${CSS.escape(sectionId)}"]`
462
464
  );
463
- for (const section of Array.from(sections)) {
465
+ for (const marker of Array.from(sections)) {
466
+ const section = marker.querySelector(":scope > [data-ai-section]") ?? marker;
464
467
  for (const [prop, attr] of Object.entries(SECTION_ATTRS)) {
465
468
  const value = override[prop];
466
469
  if (value === void 0) continue;
@@ -2732,7 +2735,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
2732
2735
  const autoId = (0, import_react5.useId)();
2733
2736
  const insertAfter = insertAfterProp ?? autoId;
2734
2737
  const [schedule, setSchedule] = (0, import_react5.useState)(null);
2735
- const [loading, setLoading] = (0, import_react5.useState)(true);
2738
+ const [loading, setLoading] = (0, import_react5.useState)(initialScheduleId !== null);
2736
2739
  const [inEditor, setInEditor] = (0, import_react5.useState)(false);
2737
2740
  const [isHovered, setIsHovered] = (0, import_react5.useState)(false);
2738
2741
  const [modalState, setModalState] = (0, import_react5.useState)(null);
@@ -2906,8 +2909,10 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
2906
2909
  "*"
2907
2910
  );
2908
2911
  };
2909
- if (!inEditor && !loading && !schedule) return null;
2910
2912
  const sectionId = `scheduling-${insertAfter}`;
2913
+ if (!inEditor && !loading && !schedule) {
2914
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("section", { "data-ohw-section": sectionId, "data-ohw-scheduling-anchor": insertAfter, style: { display: "none" } });
2915
+ }
2911
2916
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2912
2917
  "section",
2913
2918
  {
@@ -15001,7 +15006,7 @@ function mountSchedulingEntries(entries, notifyOnConnect = false) {
15001
15006
  for (let i = pending.length - 1; i >= 0; i--) {
15002
15007
  const entry = pending[i];
15003
15008
  const shouldNotify = typeof notifyOnConnect === "function" ? notifyOnConnect(entry) : notifyOnConnect;
15004
- if (mountSchedulingWidget(entry.insertAfter, shouldNotify, entry.scheduleId)) {
15009
+ if (mountSchedulingWidget(entry.insertAfter, shouldNotify, entry.scheduleId ?? null)) {
15005
15010
  pending.splice(i, 1);
15006
15011
  }
15007
15012
  }
@@ -21089,7 +21094,7 @@ function OhhwellsBridge() {
21089
21094
  postToParent2({
21090
21095
  type: "ow:ready",
21091
21096
  version: "1",
21092
- bridgeVersion: "0.1.80",
21097
+ bridgeVersion: "0.1.82",
21093
21098
  path: pathname,
21094
21099
  nodes: collectEditableNodes(editContentRef.current),
21095
21100
  sections