@ohhwells/bridge 0.1.139-next.375 → 0.1.139-next.379

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 CHANGED
@@ -1350,15 +1350,25 @@ function readAssignments(content) {
1350
1350
  function cssLength(style, prop) {
1351
1351
  return style.getPropertyValue(prop) || "0px";
1352
1352
  }
1353
+ function withTransitionsSettled(el, read) {
1354
+ const prior = el.style.getPropertyValue("transition");
1355
+ const priority = el.style.getPropertyPriority("transition");
1356
+ el.style.setProperty("transition", "none", "important");
1357
+ try {
1358
+ return read(getComputedStyle(el));
1359
+ } finally {
1360
+ if (prior) el.style.setProperty("transition", prior, priority);
1361
+ else el.style.removeProperty("transition");
1362
+ }
1363
+ }
1353
1364
  function readVariantSample(el) {
1354
- const style = getComputedStyle(el);
1355
- return {
1365
+ return withTransitionsSettled(el, (style) => ({
1356
1366
  background: style.backgroundColor,
1357
1367
  color: style.color,
1358
1368
  borderColor: style.borderTopColor,
1359
1369
  borderWidth: style.borderTopWidth,
1360
1370
  className: el.className || ""
1361
- };
1371
+ }));
1362
1372
  }
1363
1373
  function readSizeSample(el) {
1364
1374
  const style = getComputedStyle(el);
@@ -10311,38 +10321,39 @@ function deriveTemplateButtonStyle() {
10311
10321
  el.querySelectorAll("[data-ohw-editable]").length <= 1
10312
10322
  );
10313
10323
  const isFilled = (el) => {
10314
- const bg = getComputedStyle(el).backgroundColor;
10324
+ const bg = withTransitionsSettled(el, (s) => s.backgroundColor);
10315
10325
  if (!bg || bg === "transparent") return false;
10316
10326
  const alpha = bg.match(/rgba?\([^)]*,\s*([\d.]+)\)$/);
10317
10327
  return !alpha || parseFloat(alpha[1]) > 0;
10318
10328
  };
10319
10329
  const btn = candidates.find(isFilled) ?? candidates[0];
10320
10330
  if (!btn) return null;
10321
- const cs = getComputedStyle(btn);
10322
- const filled = isFilled(btn);
10323
- const corners = [
10324
- cs.borderTopLeftRadius,
10325
- cs.borderTopRightRadius,
10326
- cs.borderBottomRightRadius,
10327
- cs.borderBottomLeftRadius
10328
- ].map((v) => v || "0px");
10329
- const radius = corners.every((v) => v === corners[0]) ? corners[0] : corners.join(" ");
10330
- const px2 = (v) => parseFloat(v) || 0;
10331
- const lineHeight = px2(cs.lineHeight) || px2(cs.fontSize) * 1.2;
10332
- const contentH = btn.getBoundingClientRect().height - px2(cs.borderTopWidth) - px2(cs.borderBottomWidth);
10333
- const impliedY = Math.round(Math.max(0, (contentH - lineHeight) / 2));
10334
- const padY = Math.max(px2(cs.paddingTop), px2(cs.paddingBottom), impliedY);
10335
- const padX = Math.max(px2(cs.paddingLeft), px2(cs.paddingRight));
10336
- return {
10337
- radius: radius || "10px",
10338
- padding: `${padY}px ${padX}px`,
10339
- ...filled ? { background: cs.backgroundColor, color: cs.color } : {},
10340
- fontFamily: cs.fontFamily || "",
10341
- fontSize: cs.fontSize || "",
10342
- fontWeight: cs.fontWeight || "",
10343
- letterSpacing: cs.letterSpacing || "",
10344
- textTransform: cs.textTransform || ""
10345
- };
10331
+ return withTransitionsSettled(btn, (cs) => {
10332
+ const filled = isFilled(btn);
10333
+ const corners = [
10334
+ cs.borderTopLeftRadius,
10335
+ cs.borderTopRightRadius,
10336
+ cs.borderBottomRightRadius,
10337
+ cs.borderBottomLeftRadius
10338
+ ].map((v) => v || "0px");
10339
+ const radius = corners.every((v) => v === corners[0]) ? corners[0] : corners.join(" ");
10340
+ const px2 = (v) => parseFloat(v) || 0;
10341
+ const lineHeight = px2(cs.lineHeight) || px2(cs.fontSize) * 1.2;
10342
+ const contentH = btn.getBoundingClientRect().height - px2(cs.borderTopWidth) - px2(cs.borderBottomWidth);
10343
+ const impliedY = Math.round(Math.max(0, (contentH - lineHeight) / 2));
10344
+ const padY = Math.max(px2(cs.paddingTop), px2(cs.paddingBottom), impliedY);
10345
+ const padX = Math.max(px2(cs.paddingLeft), px2(cs.paddingRight));
10346
+ return {
10347
+ radius: radius || "10px",
10348
+ padding: `${padY}px ${padX}px`,
10349
+ ...filled ? { background: cs.backgroundColor, color: cs.color } : {},
10350
+ fontFamily: cs.fontFamily || "",
10351
+ fontSize: cs.fontSize || "",
10352
+ fontWeight: cs.fontWeight || "",
10353
+ letterSpacing: cs.letterSpacing || "",
10354
+ textTransform: cs.textTransform || ""
10355
+ };
10356
+ });
10346
10357
  }
10347
10358
  var mounted = /* @__PURE__ */ new Map();
10348
10359
  function findTemplateSection(id) {
@@ -19085,7 +19096,12 @@ function AiPricingCardOverlay({
19085
19096
  index: active.index,
19086
19097
  pending,
19087
19098
  error,
19088
- onAddTier: () => runMutation(active.sectionId, addPricingTier),
19099
+ onAddTier: () => {
19100
+ const newIndex = pricingCardCount(activeEntry.tree);
19101
+ void runMutation(active.sectionId, addPricingTier).then((applied) => {
19102
+ if (applied) setActive({ sectionId: active.sectionId, index: newIndex });
19103
+ });
19104
+ },
19089
19105
  onRemoveTier: () => {
19090
19106
  void runMutation(active.sectionId, (tree) => removePricingTier(tree, active.index)).then(
19091
19107
  (applied) => {