@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.js
CHANGED
|
@@ -420,7 +420,9 @@ function styleSheetCss() {
|
|
|
420
420
|
}
|
|
421
421
|
rules.push(
|
|
422
422
|
`[data-ohw-style-corners="sharp"] :is(.card, [data-ohw-card], img, picture, figure, [data-ohw-editable="bg-image"]) { border-radius: 0 !important; }`,
|
|
423
|
-
`[data-ohw-style-corners="sharp"] :has(> img) { border-radius: 0 !important; }
|
|
423
|
+
`[data-ohw-style-corners="sharp"] :has(> img) { border-radius: 0 !important; }`,
|
|
424
|
+
`[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; }`,
|
|
425
|
+
`[data-ohw-style-corners="rounded"] :has(> img) { border-radius: max(0.75rem, var(--radius, 0px)) !important; }`
|
|
424
426
|
);
|
|
425
427
|
for (const align of ["left", "center", "right"]) {
|
|
426
428
|
rules.push(`[data-ohw-style-align="${align}"] { text-align: ${align} !important; }`);
|
|
@@ -2656,7 +2658,12 @@ function deriveTemplateButtonStyle() {
|
|
|
2656
2658
|
if (typeof document === "undefined") return null;
|
|
2657
2659
|
const candidates = Array.from(
|
|
2658
2660
|
document.querySelectorAll('[data-ohw-role="button"]')
|
|
2659
|
-
).filter(
|
|
2661
|
+
).filter(
|
|
2662
|
+
(el) => !el.closest(`[${CONTAINER_ATTR}]`) && // Whole-card links legitimately carry the button role (serene's clickable treatment
|
|
2663
|
+
// cards) but must never donate the "button look" — a real button holds at most its
|
|
2664
|
+
// one editable label, a card holds a headline, copy and prices.
|
|
2665
|
+
el.querySelectorAll("[data-ohw-editable]").length <= 1
|
|
2666
|
+
);
|
|
2660
2667
|
const isFilled = (el) => {
|
|
2661
2668
|
const bg = getComputedStyle(el).backgroundColor;
|
|
2662
2669
|
if (!bg || bg === "transparent") return false;
|
|
@@ -15207,7 +15214,9 @@ function collectEditableNodes(extraContent, root = document) {
|
|
|
15207
15214
|
return {
|
|
15208
15215
|
key: el.dataset.ohwKey ?? "",
|
|
15209
15216
|
type: el.dataset.ohwEditable ?? "text",
|
|
15210
|
-
|
|
15217
|
+
// innerText does not exist on SVG elements (a circular-badge <textPath> is a legitimate
|
|
15218
|
+
// plain editable) — textContent is the value there.
|
|
15219
|
+
text: el.dataset.ohwEditable === "plain" ? el.innerText ?? el.textContent ?? "" : el.innerHTML
|
|
15211
15220
|
};
|
|
15212
15221
|
});
|
|
15213
15222
|
const hrefEls = Array.from(root.querySelectorAll("[data-ohw-href-key]"));
|
|
@@ -19573,6 +19582,10 @@ function OhhwellsBridge() {
|
|
|
19573
19582
|
[data-ohw-editable-state], [data-ohw-editable-state] * { pointer-events: none !important; }
|
|
19574
19583
|
[data-ohw-editable-state][data-ohw-active-state] [data-ohw-editable] { pointer-events: auto !important; }
|
|
19575
19584
|
[data-ohw-editable-state][data-ohw-active-state][data-ohw-editable] { pointer-events: auto !important; }
|
|
19585
|
+
/* SVG hit-tests painted glyphs only, so an editable curved-text badge answered clicks
|
|
19586
|
+
on its letter strokes alone (and a spinning one barely at all). In edit mode the
|
|
19587
|
+
whole box takes the click; the handler resolves it to the editable inside. */
|
|
19588
|
+
svg:has([data-ohw-editable]) { pointer-events: bounding-box !important; }
|
|
19576
19589
|
`;
|
|
19577
19590
|
if (!existing) {
|
|
19578
19591
|
const base = document.createElement("style");
|
|
@@ -19743,7 +19756,19 @@ function OhhwellsBridge() {
|
|
|
19743
19756
|
openLogoSizePanelRef.current(logoEl);
|
|
19744
19757
|
return;
|
|
19745
19758
|
}
|
|
19746
|
-
|
|
19759
|
+
let editable = target.closest("[data-ohw-editable]");
|
|
19760
|
+
if (!editable && target instanceof SVGElement) {
|
|
19761
|
+
const inner = target.closest("svg")?.querySelectorAll("[data-ohw-editable]");
|
|
19762
|
+
if (inner && inner.length === 1) editable = inner[0];
|
|
19763
|
+
}
|
|
19764
|
+
if (editable && !(editable instanceof HTMLElement)) {
|
|
19765
|
+
e.preventDefault();
|
|
19766
|
+
e.stopPropagation();
|
|
19767
|
+
deselectRef.current();
|
|
19768
|
+
deactivateRef.current();
|
|
19769
|
+
aiSectionApiRef.current?.selectFromElement(editable);
|
|
19770
|
+
return;
|
|
19771
|
+
}
|
|
19747
19772
|
if (editable) {
|
|
19748
19773
|
if (editable.dataset.ohwEditable === "link") {
|
|
19749
19774
|
e.preventDefault();
|
|
@@ -20486,6 +20511,15 @@ function OhhwellsBridge() {
|
|
|
20486
20511
|
}
|
|
20487
20512
|
return;
|
|
20488
20513
|
}
|
|
20514
|
+
const cardHit = !isDragOver && Array.from(document.querySelectorAll(".card, [data-ohw-card]")).some((card) => {
|
|
20515
|
+
if (card.contains(imgEl)) return false;
|
|
20516
|
+
const r2 = card.getBoundingClientRect();
|
|
20517
|
+
return x2 >= r2.left && x2 <= r2.right && y2 >= r2.top && y2 <= r2.bottom;
|
|
20518
|
+
});
|
|
20519
|
+
if (cardHit) {
|
|
20520
|
+
dismissImageHover();
|
|
20521
|
+
return;
|
|
20522
|
+
}
|
|
20489
20523
|
const topEl = document.elementFromPoint(x2, y2);
|
|
20490
20524
|
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"]')) {
|
|
20491
20525
|
if (hoveredImageRef.current) {
|
|
@@ -22467,7 +22501,7 @@ function OhhwellsBridge() {
|
|
|
22467
22501
|
postToParent2({
|
|
22468
22502
|
type: "ow:ready",
|
|
22469
22503
|
version: "1",
|
|
22470
|
-
bridgeVersion: "0.1.
|
|
22504
|
+
bridgeVersion: "0.1.107",
|
|
22471
22505
|
path: pathname,
|
|
22472
22506
|
nodes: collectEditableNodes(editContentRef.current),
|
|
22473
22507
|
sections
|