@ohhwells/bridge 0.1.103 → 0.1.104
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 +57 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +57 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -588,14 +588,26 @@ function buttonSurfaceOf(el) {
|
|
|
588
588
|
}
|
|
589
589
|
function alignSubjectOf(el) {
|
|
590
590
|
const button = el.closest('[data-ohw-role="button"]');
|
|
591
|
-
|
|
591
|
+
if (button?.parentElement) return button.parentElement;
|
|
592
|
+
let subject = el;
|
|
593
|
+
while (subject.parentElement && !subject.parentElement.hasAttribute("data-ohw-section") && /^inline/.test(getComputedStyle(subject).display)) {
|
|
594
|
+
subject = subject.parentElement;
|
|
595
|
+
}
|
|
596
|
+
const row = subject.closest("li");
|
|
597
|
+
if (row && row !== subject && /^(inline-)?flex$/.test(getComputedStyle(row).display)) {
|
|
598
|
+
return row;
|
|
599
|
+
}
|
|
600
|
+
return subject;
|
|
592
601
|
}
|
|
593
602
|
function applyStylesToDom(store) {
|
|
594
603
|
ensureStyleSheet();
|
|
595
604
|
clearSectionAttrs(document);
|
|
596
605
|
clearNodeProps(document);
|
|
597
606
|
loadStyleFonts(
|
|
598
|
-
store ?
|
|
607
|
+
store ? [
|
|
608
|
+
...Object.values(store.nodes).flatMap((n) => n.fontFamily ? [n.fontFamily] : []),
|
|
609
|
+
...Object.values(store.sections).flatMap((s) => s.fontFamily ? [s.fontFamily] : [])
|
|
610
|
+
] : []
|
|
599
611
|
);
|
|
600
612
|
if (!store) return;
|
|
601
613
|
for (const [sectionId, override] of Object.entries(store.sections)) {
|
|
@@ -615,6 +627,23 @@ function applyStylesToDom(store) {
|
|
|
615
627
|
section.style.setProperty("background", override.sectionBackgroundColor, "important");
|
|
616
628
|
section.setAttribute("data-ohw-style-bgcolor", "");
|
|
617
629
|
}
|
|
630
|
+
if (override.textColor !== void 0 || override.fontFamily !== void 0) {
|
|
631
|
+
const textEls = marker.querySelectorAll(
|
|
632
|
+
'[data-ohw-editable="text"], [data-ohw-editable="plain"], [data-ohw-field-label]'
|
|
633
|
+
);
|
|
634
|
+
for (const el of Array.from(textEls)) {
|
|
635
|
+
if (override.textColor !== void 0) {
|
|
636
|
+
saveInline(el, "color");
|
|
637
|
+
el.style.setProperty("color", override.textColor, "important");
|
|
638
|
+
el.setAttribute(NODE_WROTE_ATTR, "");
|
|
639
|
+
}
|
|
640
|
+
if (override.fontFamily !== void 0) {
|
|
641
|
+
saveInline(el, "font-family");
|
|
642
|
+
el.style.setProperty("font-family", `'${override.fontFamily}'`, "important");
|
|
643
|
+
el.setAttribute(NODE_WROTE_ATTR, "");
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
618
647
|
}
|
|
619
648
|
}
|
|
620
649
|
for (const [key, override] of Object.entries(store.nodes)) {
|
|
@@ -661,6 +690,22 @@ function applyStylesToDom(store) {
|
|
|
661
690
|
}
|
|
662
691
|
}
|
|
663
692
|
}
|
|
693
|
+
for (const [sectionId, override] of Object.entries(store.sections)) {
|
|
694
|
+
if (override.headingColor === void 0) continue;
|
|
695
|
+
const escaped = CSS.escape(sectionId);
|
|
696
|
+
const byInstance = document.querySelectorAll(`[data-ohw-instance="${escaped}"]`);
|
|
697
|
+
const sections = byInstance.length ? byInstance : document.querySelectorAll(`[data-ohw-section="${escaped}"]`);
|
|
698
|
+
for (const marker of Array.from(sections)) {
|
|
699
|
+
const headings = marker.querySelectorAll(
|
|
700
|
+
":is(h1, h2, h3, h4, h5, h6)[data-ohw-editable], :is(h1, h2, h3, h4, h5, h6) > [data-ohw-editable]"
|
|
701
|
+
);
|
|
702
|
+
for (const el of Array.from(headings)) {
|
|
703
|
+
saveInline(el, "color");
|
|
704
|
+
el.style.setProperty("color", override.headingColor, "important");
|
|
705
|
+
el.setAttribute(NODE_WROTE_ATTR, "");
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
}
|
|
664
709
|
}
|
|
665
710
|
|
|
666
711
|
// src/ui/ai-tree/aiSectionsManager.tsx
|
|
@@ -18861,6 +18906,9 @@ function OhhwellsBridge() {
|
|
|
18861
18906
|
applySocialsDisplayFromContent(content);
|
|
18862
18907
|
applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
|
|
18863
18908
|
if (isEditModeRef.current) requestMissingSocialIconsRef.current();
|
|
18909
|
+
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
18910
|
+
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
18911
|
+
}
|
|
18864
18912
|
enforceLinkHrefs();
|
|
18865
18913
|
initSectionsFromContent(content, true);
|
|
18866
18914
|
sectionsLoadedRef.current = true;
|
|
@@ -19056,6 +19104,9 @@ function OhhwellsBridge() {
|
|
|
19056
19104
|
applySocialsDisplayFromContent(content);
|
|
19057
19105
|
applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
|
|
19058
19106
|
if (isEditModeRef.current) requestMissingSocialIconsRef.current();
|
|
19107
|
+
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
19108
|
+
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
19109
|
+
}
|
|
19059
19110
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
19060
19111
|
if (!form.querySelector("[data-ohw-form-success]")) {
|
|
19061
19112
|
reconcileFieldsFromContent(form, content);
|
|
@@ -21034,6 +21085,9 @@ function OhhwellsBridge() {
|
|
|
21034
21085
|
reconcileNavbarItemsFromContent(editContentRef.current);
|
|
21035
21086
|
reconcileFooterOrderFromContent(editContentRef.current);
|
|
21036
21087
|
syncNavigationDragCursorAttrs();
|
|
21088
|
+
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
21089
|
+
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
21090
|
+
}
|
|
21037
21091
|
enforceLinkHrefs();
|
|
21038
21092
|
const hydrateReapExclude = /* @__PURE__ */ new Set();
|
|
21039
21093
|
const hydratePendingUndo = pendingDeleteUndoRef.current;
|
|
@@ -22261,7 +22315,7 @@ function OhhwellsBridge() {
|
|
|
22261
22315
|
postToParent2({
|
|
22262
22316
|
type: "ow:ready",
|
|
22263
22317
|
version: "1",
|
|
22264
|
-
bridgeVersion: "0.1.
|
|
22318
|
+
bridgeVersion: "0.1.103",
|
|
22265
22319
|
path: pathname,
|
|
22266
22320
|
nodes: collectEditableNodes(editContentRef.current),
|
|
22267
22321
|
sections
|