@ohhwells/bridge 0.1.92-next.267 → 0.1.92-next.269
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 +26 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2642,6 +2642,10 @@ var REPLACED_ATTR = "data-ohw-ai-replaced-by";
|
|
|
2642
2642
|
var REMOVED_ATTR2 = "data-ohw-ai-removed";
|
|
2643
2643
|
var TEMPLATE_HIDDEN_ATTR = "data-ohw-ai-template-hidden";
|
|
2644
2644
|
var CHROME_SECTION_IDS = /* @__PURE__ */ new Set(["navbar", "footer"]);
|
|
2645
|
+
function isChromeSection2(el) {
|
|
2646
|
+
if (CHROME_SECTION_IDS.has(el.getAttribute("data-ohw-section") ?? "")) return true;
|
|
2647
|
+
return el.tagName === "HEADER" || el.tagName === "FOOTER";
|
|
2648
|
+
}
|
|
2645
2649
|
function readRootVar(name) {
|
|
2646
2650
|
if (typeof document === "undefined") return "";
|
|
2647
2651
|
return getComputedStyle(document.documentElement).getPropertyValue(name).trim();
|
|
@@ -2693,7 +2697,10 @@ function deriveTemplateButtonStyle() {
|
|
|
2693
2697
|
].map((v) => v || "0px");
|
|
2694
2698
|
const radius = corners.every((v) => v === corners[0]) ? corners[0] : corners.join(" ");
|
|
2695
2699
|
const px = (v) => parseFloat(v) || 0;
|
|
2696
|
-
const
|
|
2700
|
+
const lineHeight = px(cs.lineHeight) || px(cs.fontSize) * 1.2;
|
|
2701
|
+
const contentH = btn.getBoundingClientRect().height - px(cs.borderTopWidth) - px(cs.borderBottomWidth);
|
|
2702
|
+
const impliedY = Math.round(Math.max(0, (contentH - lineHeight) / 2));
|
|
2703
|
+
const padY = Math.max(px(cs.paddingTop), px(cs.paddingBottom), impliedY);
|
|
2697
2704
|
const padX = Math.max(px(cs.paddingLeft), px(cs.paddingRight));
|
|
2698
2705
|
return {
|
|
2699
2706
|
radius: radius || "10px",
|
|
@@ -2719,6 +2726,19 @@ function findPlacementAnchor(id, exclude) {
|
|
|
2719
2726
|
for (const el of document.querySelectorAll(`[data-ohw-section="${CSS.escape(id)}"]`)) {
|
|
2720
2727
|
if (el === exclude) continue;
|
|
2721
2728
|
if (el.parentElement?.closest("[data-ohw-section]")) continue;
|
|
2729
|
+
if (isChromeSection2(el)) return null;
|
|
2730
|
+
return el;
|
|
2731
|
+
}
|
|
2732
|
+
return null;
|
|
2733
|
+
}
|
|
2734
|
+
function findFooterSection() {
|
|
2735
|
+
const byId = findTemplateSection("footer");
|
|
2736
|
+
if (byId) return byId;
|
|
2737
|
+
for (const el of Array.from(
|
|
2738
|
+
document.querySelectorAll("footer[data-ohw-section]")
|
|
2739
|
+
).reverse()) {
|
|
2740
|
+
if (el.hasAttribute(CONTAINER_ATTR)) continue;
|
|
2741
|
+
if (el.parentElement?.closest("[data-ohw-section]")) continue;
|
|
2722
2742
|
return el;
|
|
2723
2743
|
}
|
|
2724
2744
|
return null;
|
|
@@ -2745,7 +2765,7 @@ function placeContainer(container, entry) {
|
|
|
2745
2765
|
return;
|
|
2746
2766
|
}
|
|
2747
2767
|
}
|
|
2748
|
-
const footer =
|
|
2768
|
+
const footer = findFooterSection();
|
|
2749
2769
|
if (footer) {
|
|
2750
2770
|
footer.insertAdjacentElement("beforebegin", container);
|
|
2751
2771
|
} else {
|
|
@@ -2780,7 +2800,7 @@ function syncTemplateHidden(state, pageHasSections) {
|
|
|
2780
2800
|
if (!hide) return;
|
|
2781
2801
|
for (const el of Array.from(document.querySelectorAll("[data-ohw-section]"))) {
|
|
2782
2802
|
if (el.hasAttribute(CONTAINER_ATTR)) continue;
|
|
2783
|
-
if (
|
|
2803
|
+
if (isChromeSection2(el)) continue;
|
|
2784
2804
|
if (el.parentElement?.closest("[data-ohw-section]")) continue;
|
|
2785
2805
|
if (el.hasAttribute(REPLACED_ATTR) || el.hasAttribute(REMOVED_ATTR2)) continue;
|
|
2786
2806
|
el.style.display = "none";
|
|
@@ -20836,6 +20856,9 @@ function OhhwellsBridge() {
|
|
|
20836
20856
|
if (reapNodes.length > 0) postToParentRef.current({ type: "ow:change", nodes: reapNodes });
|
|
20837
20857
|
const hydratedHeight = document.body.scrollHeight;
|
|
20838
20858
|
if (hydratedHeight > 50) postToParentRef.current({ type: "ow:height", height: hydratedHeight });
|
|
20859
|
+
if (parseAiSectionsState(aiSectionsRef.current).sections.length > 0) {
|
|
20860
|
+
postAiSectionsChanged();
|
|
20861
|
+
}
|
|
20839
20862
|
postToParentRef.current({ type: "ow:hydrate-done" });
|
|
20840
20863
|
};
|
|
20841
20864
|
const handleUpdateLogoIdentity = (e) => {
|