@ohhwells/bridge 0.1.99 → 0.1.100
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 +27 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2620,6 +2620,10 @@ var REPLACED_ATTR = "data-ohw-ai-replaced-by";
|
|
|
2620
2620
|
var REMOVED_ATTR2 = "data-ohw-ai-removed";
|
|
2621
2621
|
var TEMPLATE_HIDDEN_ATTR = "data-ohw-ai-template-hidden";
|
|
2622
2622
|
var CHROME_SECTION_IDS = /* @__PURE__ */ new Set(["navbar", "footer"]);
|
|
2623
|
+
function isChromeSection2(el) {
|
|
2624
|
+
if (CHROME_SECTION_IDS.has(el.getAttribute("data-ohw-section") ?? "")) return true;
|
|
2625
|
+
return el.tagName === "HEADER" || el.tagName === "FOOTER";
|
|
2626
|
+
}
|
|
2623
2627
|
function readRootVar(name) {
|
|
2624
2628
|
if (typeof document === "undefined") return "";
|
|
2625
2629
|
return getComputedStyle(document.documentElement).getPropertyValue(name).trim();
|
|
@@ -2671,7 +2675,10 @@ function deriveTemplateButtonStyle() {
|
|
|
2671
2675
|
].map((v) => v || "0px");
|
|
2672
2676
|
const radius = corners.every((v) => v === corners[0]) ? corners[0] : corners.join(" ");
|
|
2673
2677
|
const px = (v) => parseFloat(v) || 0;
|
|
2674
|
-
const
|
|
2678
|
+
const lineHeight = px(cs.lineHeight) || px(cs.fontSize) * 1.2;
|
|
2679
|
+
const contentH = btn.getBoundingClientRect().height - px(cs.borderTopWidth) - px(cs.borderBottomWidth);
|
|
2680
|
+
const impliedY = Math.round(Math.max(0, (contentH - lineHeight) / 2));
|
|
2681
|
+
const padY = Math.max(px(cs.paddingTop), px(cs.paddingBottom), impliedY);
|
|
2675
2682
|
const padX = Math.max(px(cs.paddingLeft), px(cs.paddingRight));
|
|
2676
2683
|
return {
|
|
2677
2684
|
radius: radius || "10px",
|
|
@@ -2697,6 +2704,19 @@ function findPlacementAnchor(id, exclude) {
|
|
|
2697
2704
|
for (const el of document.querySelectorAll(`[data-ohw-section="${CSS.escape(id)}"]`)) {
|
|
2698
2705
|
if (el === exclude) continue;
|
|
2699
2706
|
if (el.parentElement?.closest("[data-ohw-section]")) continue;
|
|
2707
|
+
if (isChromeSection2(el)) return null;
|
|
2708
|
+
return el;
|
|
2709
|
+
}
|
|
2710
|
+
return null;
|
|
2711
|
+
}
|
|
2712
|
+
function findFooterSection() {
|
|
2713
|
+
const byId = findTemplateSection("footer");
|
|
2714
|
+
if (byId) return byId;
|
|
2715
|
+
for (const el of Array.from(
|
|
2716
|
+
document.querySelectorAll("footer[data-ohw-section]")
|
|
2717
|
+
).reverse()) {
|
|
2718
|
+
if (el.hasAttribute(CONTAINER_ATTR)) continue;
|
|
2719
|
+
if (el.parentElement?.closest("[data-ohw-section]")) continue;
|
|
2700
2720
|
return el;
|
|
2701
2721
|
}
|
|
2702
2722
|
return null;
|
|
@@ -2723,7 +2743,7 @@ function placeContainer(container, entry) {
|
|
|
2723
2743
|
return;
|
|
2724
2744
|
}
|
|
2725
2745
|
}
|
|
2726
|
-
const footer =
|
|
2746
|
+
const footer = findFooterSection();
|
|
2727
2747
|
if (footer) {
|
|
2728
2748
|
footer.insertAdjacentElement("beforebegin", container);
|
|
2729
2749
|
} else {
|
|
@@ -2758,7 +2778,7 @@ function syncTemplateHidden(state, pageHasSections) {
|
|
|
2758
2778
|
if (!hide) return;
|
|
2759
2779
|
for (const el of Array.from(document.querySelectorAll("[data-ohw-section]"))) {
|
|
2760
2780
|
if (el.hasAttribute(CONTAINER_ATTR)) continue;
|
|
2761
|
-
if (
|
|
2781
|
+
if (isChromeSection2(el)) continue;
|
|
2762
2782
|
if (el.parentElement?.closest("[data-ohw-section]")) continue;
|
|
2763
2783
|
if (el.hasAttribute(REPLACED_ATTR) || el.hasAttribute(REMOVED_ATTR2)) continue;
|
|
2764
2784
|
el.style.display = "none";
|
|
@@ -20854,6 +20874,9 @@ function OhhwellsBridge() {
|
|
|
20854
20874
|
if (reapNodes.length > 0) postToParentRef.current({ type: "ow:change", nodes: reapNodes });
|
|
20855
20875
|
const hydratedHeight = document.body.scrollHeight;
|
|
20856
20876
|
if (hydratedHeight > 50) postToParentRef.current({ type: "ow:height", height: hydratedHeight });
|
|
20877
|
+
if (parseAiSectionsState(aiSectionsRef.current).sections.length > 0) {
|
|
20878
|
+
postAiSectionsChanged();
|
|
20879
|
+
}
|
|
20857
20880
|
postToParentRef.current({ type: "ow:hydrate-done" });
|
|
20858
20881
|
};
|
|
20859
20882
|
const handleUpdateLogoIdentity = (e) => {
|
|
@@ -22062,7 +22085,7 @@ function OhhwellsBridge() {
|
|
|
22062
22085
|
postToParent2({
|
|
22063
22086
|
type: "ow:ready",
|
|
22064
22087
|
version: "1",
|
|
22065
|
-
bridgeVersion: "0.1.
|
|
22088
|
+
bridgeVersion: "0.1.99",
|
|
22066
22089
|
path: pathname,
|
|
22067
22090
|
nodes: collectEditableNodes(editContentRef.current),
|
|
22068
22091
|
sections
|