@ohhwells/bridge 0.1.92-next.272 → 0.1.92-next.274
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 +24 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +24 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1400,7 +1400,12 @@ function ButtonEl({
|
|
|
1400
1400
|
textDecoration: "none",
|
|
1401
1401
|
cursor: "pointer",
|
|
1402
1402
|
...buttonShellStyle(ctx, fullWidth),
|
|
1403
|
-
...secondary ? { border: `1px solid ${ctx.brand.palette.dark}`, color: ctx.brand.palette.dark } :
|
|
1403
|
+
...secondary ? { border: `1px solid ${ctx.brand.palette.dark}`, color: ctx.brand.palette.dark } : (
|
|
1404
|
+
// Off-band, prefer the template button's measured fill/label pair — a template may
|
|
1405
|
+
// fill its CTAs with any token (hvac: accent bg, primary text). On an accent band
|
|
1406
|
+
// the flipped palette keeps contrast, so the brand-driven colours stay.
|
|
1407
|
+
!ctx.buttonLabel && ctx.buttonStyle?.background ? { background: ctx.buttonStyle.background, color: ctx.buttonStyle.color } : { background: ctx.brand.palette.primary, color: ctx.buttonLabel ?? primaryButtonLabel(ctx.brand) }
|
|
1408
|
+
)
|
|
1404
1409
|
},
|
|
1405
1410
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { ...path ? textAttrs(ctx, `${path}.label`) : {}, children: str(slots.label) })
|
|
1406
1411
|
}
|
|
@@ -2472,10 +2477,12 @@ function renderNode(node, ctx, path) {
|
|
|
2472
2477
|
cursor: "pointer",
|
|
2473
2478
|
// Shape/padding/typography follow the host template's own buttons.
|
|
2474
2479
|
...buttonShellStyle(ctx),
|
|
2475
|
-
// Brand-styled:
|
|
2476
|
-
// reads
|
|
2477
|
-
background: ctx.
|
|
2478
|
-
|
|
2480
|
+
// Brand-styled: the template button's measured fill/label pair off-band, else
|
|
2481
|
+
// primary fill with a brand-derived label so it reads on custom palettes.
|
|
2482
|
+
...!ctx.buttonLabel && ctx.buttonStyle?.background ? { background: ctx.buttonStyle.background, color: ctx.buttonStyle.color } : {
|
|
2483
|
+
background: ctx.brand.palette.primary,
|
|
2484
|
+
color: ctx.buttonLabel ?? primaryButtonLabel(ctx.brand)
|
|
2485
|
+
}
|
|
2479
2486
|
},
|
|
2480
2487
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { ...textAttrs(ctx, `${path}.c${i}.label`), children: str(cs.label) })
|
|
2481
2488
|
},
|
|
@@ -2684,11 +2691,19 @@ function deriveTemplateBrand() {
|
|
|
2684
2691
|
}
|
|
2685
2692
|
function deriveTemplateButtonStyle() {
|
|
2686
2693
|
if (typeof document === "undefined") return null;
|
|
2687
|
-
const
|
|
2688
|
-
|
|
2689
|
-
);
|
|
2694
|
+
const candidates = Array.from(
|
|
2695
|
+
document.querySelectorAll('[data-ohw-role="button"]')
|
|
2696
|
+
).filter((el) => !el.closest(`[${CONTAINER_ATTR}]`));
|
|
2697
|
+
const isFilled = (el) => {
|
|
2698
|
+
const bg = getComputedStyle(el).backgroundColor;
|
|
2699
|
+
if (!bg || bg === "transparent") return false;
|
|
2700
|
+
const alpha = bg.match(/rgba?\([^)]*,\s*([\d.]+)\)$/);
|
|
2701
|
+
return !alpha || parseFloat(alpha[1]) > 0;
|
|
2702
|
+
};
|
|
2703
|
+
const btn = candidates.find(isFilled) ?? candidates[0];
|
|
2690
2704
|
if (!btn) return null;
|
|
2691
2705
|
const cs = getComputedStyle(btn);
|
|
2706
|
+
const filled = isFilled(btn);
|
|
2692
2707
|
const corners = [
|
|
2693
2708
|
cs.borderTopLeftRadius,
|
|
2694
2709
|
cs.borderTopRightRadius,
|
|
@@ -2705,6 +2720,7 @@ function deriveTemplateButtonStyle() {
|
|
|
2705
2720
|
return {
|
|
2706
2721
|
radius: radius || "10px",
|
|
2707
2722
|
padding: `${padY}px ${padX}px`,
|
|
2723
|
+
...filled ? { background: cs.backgroundColor, color: cs.color } : {},
|
|
2708
2724
|
fontFamily: cs.fontFamily || "",
|
|
2709
2725
|
fontSize: cs.fontSize || "",
|
|
2710
2726
|
fontWeight: cs.fontWeight || "",
|