@ohhwells/bridge 0.1.157 → 0.1.158
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 +41 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -1
- package/dist/index.d.ts +31 -1
- package/dist/index.js +39 -9
- package/dist/index.js.map +1 -1
- package/dist/pages.cjs +1 -1
- package/dist/pages.cjs.map +1 -1
- package/dist/pages.js +1 -1
- package/dist/pages.js.map +1 -1
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -64,6 +64,7 @@ __export(index_exports, {
|
|
|
64
64
|
OhwLoaderSurface: () => OhwLoaderSurface,
|
|
65
65
|
SITE_OG_IMAGE_KEY: () => SITE_OG_IMAGE_KEY,
|
|
66
66
|
SchedulingWidget: () => SchedulingWidget,
|
|
67
|
+
TEMPLATE_LOGO_ATTR: () => TEMPLATE_LOGO_ATTR,
|
|
67
68
|
Toggle: () => Toggle,
|
|
68
69
|
ToggleGroup: () => ToggleGroup,
|
|
69
70
|
ToggleGroupItem: () => ToggleGroupItem,
|
|
@@ -97,6 +98,7 @@ __export(index_exports, {
|
|
|
97
98
|
parseAiSectionsState: () => parseAiSectionsState,
|
|
98
99
|
parseTarget: () => parseTarget,
|
|
99
100
|
recordOverriddenPaths: () => recordOverriddenPaths,
|
|
101
|
+
releaseTemplateLogoIfReplaced: () => releaseTemplateLogoIfReplaced,
|
|
100
102
|
removeFooterBlock: () => removeFooterBlock,
|
|
101
103
|
resetOverriddenPathsCache: () => resetOverriddenPathsCache,
|
|
102
104
|
resolveFooterCopyright: () => resolveFooterCopyright,
|
|
@@ -518,11 +520,37 @@ function logoTextElement(root) {
|
|
|
518
520
|
);
|
|
519
521
|
return hasOwnText ? root : null;
|
|
520
522
|
}
|
|
523
|
+
var TEMPLATE_LOGO_ATTR = "data-ohw-template-logo";
|
|
524
|
+
function releaseTemplateLogoIfReplaced(img, url) {
|
|
525
|
+
if (!img.hasAttribute(TEMPLATE_LOGO_ATTR)) return;
|
|
526
|
+
let incoming = url;
|
|
527
|
+
try {
|
|
528
|
+
incoming = new URL(url, document.baseURI).href;
|
|
529
|
+
} catch {
|
|
530
|
+
}
|
|
531
|
+
if (incoming !== img.src) img.removeAttribute(TEMPLATE_LOGO_ATTR);
|
|
532
|
+
}
|
|
533
|
+
function logoImage(root, selector) {
|
|
534
|
+
if (root instanceof HTMLImageElement && root.matches(selector)) return root;
|
|
535
|
+
return root.querySelector(selector);
|
|
536
|
+
}
|
|
521
537
|
function logoRootImage(root) {
|
|
522
|
-
const img = root
|
|
538
|
+
const img = logoImage(root, `img:not([${TEMPLATE_LOGO_ATTR}])`);
|
|
523
539
|
const src = img?.getAttribute("src")?.trim() ?? "";
|
|
524
540
|
return img && src && img.style.display !== "none" ? img : null;
|
|
525
541
|
}
|
|
542
|
+
function templateLogoImage(root) {
|
|
543
|
+
const img = logoImage(root, `img[${TEMPLATE_LOGO_ATTR}]`);
|
|
544
|
+
return img && img.style.display !== "none" ? img : null;
|
|
545
|
+
}
|
|
546
|
+
function createWordmark(root) {
|
|
547
|
+
const el = document.createElement("span");
|
|
548
|
+
el.setAttribute("data-ohw-editable", "plain");
|
|
549
|
+
el.setAttribute("data-ohw-key", textKeyForRoot(root));
|
|
550
|
+
if (root instanceof HTMLImageElement) root.parentNode?.insertBefore(el, root.nextSibling);
|
|
551
|
+
else root.appendChild(el);
|
|
552
|
+
return el;
|
|
553
|
+
}
|
|
526
554
|
function applyLogoIdentity(text, isPlaceholder) {
|
|
527
555
|
const display = resolveLogoDisplayText(text);
|
|
528
556
|
const placeholder = isPlaceholder || !text.trim() || display === PLACEHOLDER_BUSINESS_NAME;
|
|
@@ -541,7 +569,9 @@ function applyLogoIdentity(text, isPlaceholder) {
|
|
|
541
569
|
if (placeholder) el.setAttribute("data-ohw-placeholder", "");
|
|
542
570
|
else el.removeAttribute("data-ohw-placeholder");
|
|
543
571
|
if (logoRootImage(el)) return;
|
|
544
|
-
const
|
|
572
|
+
const templateMark = placeholder ? null : templateLogoImage(el);
|
|
573
|
+
if (templateMark) templateMark.style.display = "none";
|
|
574
|
+
const textEl = logoTextElement(el) ?? (templateMark ? createWordmark(el) : null);
|
|
545
575
|
if (textEl && textEl.textContent !== display) textEl.textContent = display;
|
|
546
576
|
});
|
|
547
577
|
return display;
|
|
@@ -573,6 +603,7 @@ function applyLogoImage(url, alt, placement) {
|
|
|
573
603
|
}
|
|
574
604
|
img.removeAttribute("srcset");
|
|
575
605
|
img.removeAttribute("sizes");
|
|
606
|
+
img.removeAttribute(TEMPLATE_LOGO_ATTR);
|
|
576
607
|
img.src = url;
|
|
577
608
|
img.alt = displayAlt;
|
|
578
609
|
img.style.display = "block";
|
|
@@ -592,10 +623,7 @@ function applyLogoImage(url, alt, placement) {
|
|
|
592
623
|
img.style.display = "none";
|
|
593
624
|
}
|
|
594
625
|
if (!textEl) {
|
|
595
|
-
textEl =
|
|
596
|
-
textEl.setAttribute("data-ohw-editable", "plain");
|
|
597
|
-
textEl.setAttribute("data-ohw-key", textKey);
|
|
598
|
-
root.appendChild(textEl);
|
|
626
|
+
textEl = createWordmark(root);
|
|
599
627
|
}
|
|
600
628
|
textEl.style.display = "";
|
|
601
629
|
if (textEl.textContent !== displayAlt) textEl.textContent = displayAlt;
|
|
@@ -6849,6 +6877,7 @@ function applyBrandChrome(content) {
|
|
|
6849
6877
|
if (el.textContent !== name) el.textContent = name;
|
|
6850
6878
|
if (el.getAttribute("title") !== name) el.setAttribute("title", name);
|
|
6851
6879
|
});
|
|
6880
|
+
applyLogoIdentity(name, false);
|
|
6852
6881
|
}
|
|
6853
6882
|
const title = content[BRAND_TITLE_KEY];
|
|
6854
6883
|
if (typeof title === "string" && title.length > 0) {
|
|
@@ -17212,7 +17241,7 @@ function apiBase() {
|
|
|
17212
17241
|
function bridgeVersion() {
|
|
17213
17242
|
try {
|
|
17214
17243
|
if (true) {
|
|
17215
|
-
return "0.1.
|
|
17244
|
+
return "0.1.158";
|
|
17216
17245
|
}
|
|
17217
17246
|
} catch {
|
|
17218
17247
|
}
|
|
@@ -17226,7 +17255,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17226
17255
|
return;
|
|
17227
17256
|
}
|
|
17228
17257
|
try {
|
|
17229
|
-
const v = true ? "0.1.
|
|
17258
|
+
const v = true ? "0.1.158" : "";
|
|
17230
17259
|
if (v) {
|
|
17231
17260
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17232
17261
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -24031,6 +24060,7 @@ function applyEditableImageSrc(img, url) {
|
|
|
24031
24060
|
img.removeAttribute("srcset");
|
|
24032
24061
|
img.removeAttribute("sizes");
|
|
24033
24062
|
if (img.loading === "lazy") img.loading = "eager";
|
|
24063
|
+
releaseTemplateLogoIfReplaced(img, url);
|
|
24034
24064
|
img.src = url;
|
|
24035
24065
|
}
|
|
24036
24066
|
function fadeInBgImage(el, url, onReady) {
|
|
@@ -32044,7 +32074,7 @@ function OhhwellsBridge() {
|
|
|
32044
32074
|
postToParent2({
|
|
32045
32075
|
type: "ow:ready",
|
|
32046
32076
|
version: "1",
|
|
32047
|
-
bridgeVersion: "0.1.
|
|
32077
|
+
bridgeVersion: "0.1.158",
|
|
32048
32078
|
path: pathname,
|
|
32049
32079
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32050
32080
|
sections
|
|
@@ -33251,6 +33281,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
33251
33281
|
OhwLoaderSurface,
|
|
33252
33282
|
SITE_OG_IMAGE_KEY,
|
|
33253
33283
|
SchedulingWidget,
|
|
33284
|
+
TEMPLATE_LOGO_ATTR,
|
|
33254
33285
|
Toggle,
|
|
33255
33286
|
ToggleGroup,
|
|
33256
33287
|
ToggleGroupItem,
|
|
@@ -33284,6 +33315,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
33284
33315
|
parseAiSectionsState,
|
|
33285
33316
|
parseTarget,
|
|
33286
33317
|
recordOverriddenPaths,
|
|
33318
|
+
releaseTemplateLogoIfReplaced,
|
|
33287
33319
|
removeFooterBlock,
|
|
33288
33320
|
resetOverriddenPathsCache,
|
|
33289
33321
|
resolveFooterCopyright,
|