@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.d.cts CHANGED
@@ -273,7 +273,7 @@ declare function SchedulingWidget({ notifyOnConnect, initialScheduleId, insertAf
273
273
  notifyOnConnect?: boolean;
274
274
  initialScheduleId?: string | null;
275
275
  insertAfter?: string;
276
- }): react_jsx_runtime.JSX.Element | null;
276
+ }): react_jsx_runtime.JSX.Element;
277
277
 
278
278
  declare const DragHandle: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
279
279
 
package/dist/index.d.ts CHANGED
@@ -273,7 +273,7 @@ declare function SchedulingWidget({ notifyOnConnect, initialScheduleId, insertAf
273
273
  notifyOnConnect?: boolean;
274
274
  initialScheduleId?: string | null;
275
275
  insertAfter?: string;
276
- }): react_jsx_runtime.JSX.Element | null;
276
+ }): react_jsx_runtime.JSX.Element;
277
277
 
278
278
  declare const DragHandle: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
279
279
 
package/dist/index.js CHANGED
@@ -336,7 +336,9 @@ var NODE_WROTE_ATTR = "data-ohw-style-node";
336
336
  var NODE_PROPS = ["color", "font-family", "font-size", "background"];
337
337
  function saveInline(el, prop) {
338
338
  const attr = `data-ohw-style-prev-${prop}`;
339
- if (!el.hasAttribute(attr)) el.setAttribute(attr, el.style.getPropertyValue(prop));
339
+ if (el.hasAttribute(attr)) return;
340
+ const value = el.style.getPropertyValue(prop) || (prop === "background" ? el.style.getPropertyValue("background-color") : "");
341
+ el.setAttribute(attr, value);
340
342
  }
341
343
  function restoreInline(el, prop) {
342
344
  const attr = `data-ohw-style-prev-${prop}`;
@@ -387,7 +389,8 @@ function applyStylesToDom(store) {
387
389
  const sections = document.querySelectorAll(
388
390
  `[data-ohw-section="${CSS.escape(sectionId)}"]`
389
391
  );
390
- for (const section of Array.from(sections)) {
392
+ for (const marker of Array.from(sections)) {
393
+ const section = marker.querySelector(":scope > [data-ai-section]") ?? marker;
391
394
  for (const [prop, attr] of Object.entries(SECTION_ATTRS)) {
392
395
  const value = override[prop];
393
396
  if (value === void 0) continue;
@@ -2659,7 +2662,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
2659
2662
  const autoId = useId();
2660
2663
  const insertAfter = insertAfterProp ?? autoId;
2661
2664
  const [schedule, setSchedule] = useState2(null);
2662
- const [loading, setLoading] = useState2(true);
2665
+ const [loading, setLoading] = useState2(initialScheduleId !== null);
2663
2666
  const [inEditor, setInEditor] = useState2(false);
2664
2667
  const [isHovered, setIsHovered] = useState2(false);
2665
2668
  const [modalState, setModalState] = useState2(null);
@@ -2833,8 +2836,10 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
2833
2836
  "*"
2834
2837
  );
2835
2838
  };
2836
- if (!inEditor && !loading && !schedule) return null;
2837
2839
  const sectionId = `scheduling-${insertAfter}`;
2840
+ if (!inEditor && !loading && !schedule) {
2841
+ return /* @__PURE__ */ jsx4("section", { "data-ohw-section": sectionId, "data-ohw-scheduling-anchor": insertAfter, style: { display: "none" } });
2842
+ }
2838
2843
  return /* @__PURE__ */ jsxs3(
2839
2844
  "section",
2840
2845
  {
@@ -14934,7 +14939,7 @@ function mountSchedulingEntries(entries, notifyOnConnect = false) {
14934
14939
  for (let i = pending.length - 1; i >= 0; i--) {
14935
14940
  const entry = pending[i];
14936
14941
  const shouldNotify = typeof notifyOnConnect === "function" ? notifyOnConnect(entry) : notifyOnConnect;
14937
- if (mountSchedulingWidget(entry.insertAfter, shouldNotify, entry.scheduleId)) {
14942
+ if (mountSchedulingWidget(entry.insertAfter, shouldNotify, entry.scheduleId ?? null)) {
14938
14943
  pending.splice(i, 1);
14939
14944
  }
14940
14945
  }
@@ -21022,7 +21027,7 @@ function OhhwellsBridge() {
21022
21027
  postToParent2({
21023
21028
  type: "ow:ready",
21024
21029
  version: "1",
21025
- bridgeVersion: "0.1.80",
21030
+ bridgeVersion: "0.1.82",
21026
21031
  path: pathname,
21027
21032
  nodes: collectEditableNodes(editContentRef.current),
21028
21033
  sections