@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.js
CHANGED
|
@@ -515,14 +515,26 @@ function buttonSurfaceOf(el) {
|
|
|
515
515
|
}
|
|
516
516
|
function alignSubjectOf(el) {
|
|
517
517
|
const button = el.closest('[data-ohw-role="button"]');
|
|
518
|
-
|
|
518
|
+
if (button?.parentElement) return button.parentElement;
|
|
519
|
+
let subject = el;
|
|
520
|
+
while (subject.parentElement && !subject.parentElement.hasAttribute("data-ohw-section") && /^inline/.test(getComputedStyle(subject).display)) {
|
|
521
|
+
subject = subject.parentElement;
|
|
522
|
+
}
|
|
523
|
+
const row = subject.closest("li");
|
|
524
|
+
if (row && row !== subject && /^(inline-)?flex$/.test(getComputedStyle(row).display)) {
|
|
525
|
+
return row;
|
|
526
|
+
}
|
|
527
|
+
return subject;
|
|
519
528
|
}
|
|
520
529
|
function applyStylesToDom(store) {
|
|
521
530
|
ensureStyleSheet();
|
|
522
531
|
clearSectionAttrs(document);
|
|
523
532
|
clearNodeProps(document);
|
|
524
533
|
loadStyleFonts(
|
|
525
|
-
store ?
|
|
534
|
+
store ? [
|
|
535
|
+
...Object.values(store.nodes).flatMap((n) => n.fontFamily ? [n.fontFamily] : []),
|
|
536
|
+
...Object.values(store.sections).flatMap((s) => s.fontFamily ? [s.fontFamily] : [])
|
|
537
|
+
] : []
|
|
526
538
|
);
|
|
527
539
|
if (!store) return;
|
|
528
540
|
for (const [sectionId, override] of Object.entries(store.sections)) {
|
|
@@ -542,6 +554,23 @@ function applyStylesToDom(store) {
|
|
|
542
554
|
section.style.setProperty("background", override.sectionBackgroundColor, "important");
|
|
543
555
|
section.setAttribute("data-ohw-style-bgcolor", "");
|
|
544
556
|
}
|
|
557
|
+
if (override.textColor !== void 0 || override.fontFamily !== void 0) {
|
|
558
|
+
const textEls = marker.querySelectorAll(
|
|
559
|
+
'[data-ohw-editable="text"], [data-ohw-editable="plain"], [data-ohw-field-label]'
|
|
560
|
+
);
|
|
561
|
+
for (const el of Array.from(textEls)) {
|
|
562
|
+
if (override.textColor !== void 0) {
|
|
563
|
+
saveInline(el, "color");
|
|
564
|
+
el.style.setProperty("color", override.textColor, "important");
|
|
565
|
+
el.setAttribute(NODE_WROTE_ATTR, "");
|
|
566
|
+
}
|
|
567
|
+
if (override.fontFamily !== void 0) {
|
|
568
|
+
saveInline(el, "font-family");
|
|
569
|
+
el.style.setProperty("font-family", `'${override.fontFamily}'`, "important");
|
|
570
|
+
el.setAttribute(NODE_WROTE_ATTR, "");
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}
|
|
545
574
|
}
|
|
546
575
|
}
|
|
547
576
|
for (const [key, override] of Object.entries(store.nodes)) {
|
|
@@ -588,6 +617,22 @@ function applyStylesToDom(store) {
|
|
|
588
617
|
}
|
|
589
618
|
}
|
|
590
619
|
}
|
|
620
|
+
for (const [sectionId, override] of Object.entries(store.sections)) {
|
|
621
|
+
if (override.headingColor === void 0) continue;
|
|
622
|
+
const escaped = CSS.escape(sectionId);
|
|
623
|
+
const byInstance = document.querySelectorAll(`[data-ohw-instance="${escaped}"]`);
|
|
624
|
+
const sections = byInstance.length ? byInstance : document.querySelectorAll(`[data-ohw-section="${escaped}"]`);
|
|
625
|
+
for (const marker of Array.from(sections)) {
|
|
626
|
+
const headings = marker.querySelectorAll(
|
|
627
|
+
":is(h1, h2, h3, h4, h5, h6)[data-ohw-editable], :is(h1, h2, h3, h4, h5, h6) > [data-ohw-editable]"
|
|
628
|
+
);
|
|
629
|
+
for (const el of Array.from(headings)) {
|
|
630
|
+
saveInline(el, "color");
|
|
631
|
+
el.style.setProperty("color", override.headingColor, "important");
|
|
632
|
+
el.setAttribute(NODE_WROTE_ATTR, "");
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
591
636
|
}
|
|
592
637
|
|
|
593
638
|
// src/ui/ai-tree/aiSectionsManager.tsx
|
|
@@ -18794,6 +18839,9 @@ function OhhwellsBridge() {
|
|
|
18794
18839
|
applySocialsDisplayFromContent(content);
|
|
18795
18840
|
applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
|
|
18796
18841
|
if (isEditModeRef.current) requestMissingSocialIconsRef.current();
|
|
18842
|
+
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
18843
|
+
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
18844
|
+
}
|
|
18797
18845
|
enforceLinkHrefs();
|
|
18798
18846
|
initSectionsFromContent(content, true);
|
|
18799
18847
|
sectionsLoadedRef.current = true;
|
|
@@ -18989,6 +19037,9 @@ function OhhwellsBridge() {
|
|
|
18989
19037
|
applySocialsDisplayFromContent(content);
|
|
18990
19038
|
applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
|
|
18991
19039
|
if (isEditModeRef.current) requestMissingSocialIconsRef.current();
|
|
19040
|
+
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
19041
|
+
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
19042
|
+
}
|
|
18992
19043
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
18993
19044
|
if (!form.querySelector("[data-ohw-form-success]")) {
|
|
18994
19045
|
reconcileFieldsFromContent(form, content);
|
|
@@ -20967,6 +21018,9 @@ function OhhwellsBridge() {
|
|
|
20967
21018
|
reconcileNavbarItemsFromContent(editContentRef.current);
|
|
20968
21019
|
reconcileFooterOrderFromContent(editContentRef.current);
|
|
20969
21020
|
syncNavigationDragCursorAttrs();
|
|
21021
|
+
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
21022
|
+
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
21023
|
+
}
|
|
20970
21024
|
enforceLinkHrefs();
|
|
20971
21025
|
const hydrateReapExclude = /* @__PURE__ */ new Set();
|
|
20972
21026
|
const hydratePendingUndo = pendingDeleteUndoRef.current;
|
|
@@ -22194,7 +22248,7 @@ function OhhwellsBridge() {
|
|
|
22194
22248
|
postToParent2({
|
|
22195
22249
|
type: "ow:ready",
|
|
22196
22250
|
version: "1",
|
|
22197
|
-
bridgeVersion: "0.1.
|
|
22251
|
+
bridgeVersion: "0.1.103",
|
|
22198
22252
|
path: pathname,
|
|
22199
22253
|
nodes: collectEditableNodes(editContentRef.current),
|
|
22200
22254
|
sections
|