@ohhwells/bridge 0.1.107 → 0.1.108
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 +39 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +39 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -493,7 +493,9 @@ function styleSheetCss() {
|
|
|
493
493
|
}
|
|
494
494
|
rules.push(
|
|
495
495
|
`[data-ohw-style-corners="sharp"] :is(.card, [data-ohw-card], img, picture, figure, [data-ohw-editable="bg-image"]) { border-radius: 0 !important; }`,
|
|
496
|
-
`[data-ohw-style-corners="sharp"] :has(> img) { border-radius: 0 !important; }
|
|
496
|
+
`[data-ohw-style-corners="sharp"] :has(> img) { border-radius: 0 !important; }`,
|
|
497
|
+
`[data-ohw-style-corners="rounded"] :is(.card, [data-ohw-card], img, picture, figure, [data-ohw-editable="bg-image"]) { border-radius: max(0.75rem, var(--radius, 0px)) !important; }`,
|
|
498
|
+
`[data-ohw-style-corners="rounded"] :has(> img) { border-radius: max(0.75rem, var(--radius, 0px)) !important; }`
|
|
497
499
|
);
|
|
498
500
|
for (const align of ["left", "center", "right"]) {
|
|
499
501
|
rules.push(`[data-ohw-style-align="${align}"] { text-align: ${align} !important; }`);
|
|
@@ -2729,7 +2731,12 @@ function deriveTemplateButtonStyle() {
|
|
|
2729
2731
|
if (typeof document === "undefined") return null;
|
|
2730
2732
|
const candidates = Array.from(
|
|
2731
2733
|
document.querySelectorAll('[data-ohw-role="button"]')
|
|
2732
|
-
).filter(
|
|
2734
|
+
).filter(
|
|
2735
|
+
(el) => !el.closest(`[${CONTAINER_ATTR}]`) && // Whole-card links legitimately carry the button role (serene's clickable treatment
|
|
2736
|
+
// cards) but must never donate the "button look" — a real button holds at most its
|
|
2737
|
+
// one editable label, a card holds a headline, copy and prices.
|
|
2738
|
+
el.querySelectorAll("[data-ohw-editable]").length <= 1
|
|
2739
|
+
);
|
|
2733
2740
|
const isFilled = (el) => {
|
|
2734
2741
|
const bg = getComputedStyle(el).backgroundColor;
|
|
2735
2742
|
if (!bg || bg === "transparent") return false;
|
|
@@ -15274,7 +15281,9 @@ function collectEditableNodes(extraContent, root = document) {
|
|
|
15274
15281
|
return {
|
|
15275
15282
|
key: el.dataset.ohwKey ?? "",
|
|
15276
15283
|
type: el.dataset.ohwEditable ?? "text",
|
|
15277
|
-
|
|
15284
|
+
// innerText does not exist on SVG elements (a circular-badge <textPath> is a legitimate
|
|
15285
|
+
// plain editable) — textContent is the value there.
|
|
15286
|
+
text: el.dataset.ohwEditable === "plain" ? el.innerText ?? el.textContent ?? "" : el.innerHTML
|
|
15278
15287
|
};
|
|
15279
15288
|
});
|
|
15280
15289
|
const hrefEls = Array.from(root.querySelectorAll("[data-ohw-href-key]"));
|
|
@@ -19640,6 +19649,10 @@ function OhhwellsBridge() {
|
|
|
19640
19649
|
[data-ohw-editable-state], [data-ohw-editable-state] * { pointer-events: none !important; }
|
|
19641
19650
|
[data-ohw-editable-state][data-ohw-active-state] [data-ohw-editable] { pointer-events: auto !important; }
|
|
19642
19651
|
[data-ohw-editable-state][data-ohw-active-state][data-ohw-editable] { pointer-events: auto !important; }
|
|
19652
|
+
/* SVG hit-tests painted glyphs only, so an editable curved-text badge answered clicks
|
|
19653
|
+
on its letter strokes alone (and a spinning one barely at all). In edit mode the
|
|
19654
|
+
whole box takes the click; the handler resolves it to the editable inside. */
|
|
19655
|
+
svg:has([data-ohw-editable]) { pointer-events: bounding-box !important; }
|
|
19643
19656
|
`;
|
|
19644
19657
|
if (!existing) {
|
|
19645
19658
|
const base = document.createElement("style");
|
|
@@ -19810,7 +19823,19 @@ function OhhwellsBridge() {
|
|
|
19810
19823
|
openLogoSizePanelRef.current(logoEl);
|
|
19811
19824
|
return;
|
|
19812
19825
|
}
|
|
19813
|
-
|
|
19826
|
+
let editable = target.closest("[data-ohw-editable]");
|
|
19827
|
+
if (!editable && target instanceof SVGElement) {
|
|
19828
|
+
const inner = target.closest("svg")?.querySelectorAll("[data-ohw-editable]");
|
|
19829
|
+
if (inner && inner.length === 1) editable = inner[0];
|
|
19830
|
+
}
|
|
19831
|
+
if (editable && !(editable instanceof HTMLElement)) {
|
|
19832
|
+
e.preventDefault();
|
|
19833
|
+
e.stopPropagation();
|
|
19834
|
+
deselectRef.current();
|
|
19835
|
+
deactivateRef.current();
|
|
19836
|
+
aiSectionApiRef.current?.selectFromElement(editable);
|
|
19837
|
+
return;
|
|
19838
|
+
}
|
|
19814
19839
|
if (editable) {
|
|
19815
19840
|
if (editable.dataset.ohwEditable === "link") {
|
|
19816
19841
|
e.preventDefault();
|
|
@@ -20553,6 +20578,15 @@ function OhhwellsBridge() {
|
|
|
20553
20578
|
}
|
|
20554
20579
|
return;
|
|
20555
20580
|
}
|
|
20581
|
+
const cardHit = !isDragOver && Array.from(document.querySelectorAll(".card, [data-ohw-card]")).some((card) => {
|
|
20582
|
+
if (card.contains(imgEl)) return false;
|
|
20583
|
+
const r2 = card.getBoundingClientRect();
|
|
20584
|
+
return x2 >= r2.left && x2 <= r2.right && y2 >= r2.top && y2 <= r2.bottom;
|
|
20585
|
+
});
|
|
20586
|
+
if (cardHit) {
|
|
20587
|
+
dismissImageHover();
|
|
20588
|
+
return;
|
|
20589
|
+
}
|
|
20556
20590
|
const topEl = document.elementFromPoint(x2, y2);
|
|
20557
20591
|
if (topEl?.closest('[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-drag-handle-container], [data-slot="drag-handle"], [data-ohw-more-menu], [data-slot="dropdown-menu-content"], [data-slot="dropdown-menu-item"]')) {
|
|
20558
20592
|
if (hoveredImageRef.current) {
|
|
@@ -22534,7 +22568,7 @@ function OhhwellsBridge() {
|
|
|
22534
22568
|
postToParent2({
|
|
22535
22569
|
type: "ow:ready",
|
|
22536
22570
|
version: "1",
|
|
22537
|
-
bridgeVersion: "0.1.
|
|
22571
|
+
bridgeVersion: "0.1.107",
|
|
22538
22572
|
path: pathname,
|
|
22539
22573
|
nodes: collectEditableNodes(editContentRef.current),
|
|
22540
22574
|
sections
|