@ohhwells/bridge 0.1.172-next.456 → 0.1.172-next.457

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
@@ -1261,21 +1261,21 @@ function chromeFrom(sample) {
1261
1261
  };
1262
1262
  }
1263
1263
  function filledPrimary(seed) {
1264
- const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1265
- const luminance = relativeLuminance(paint2);
1264
+ const paint3 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1265
+ const luminance = relativeLuminance(paint3);
1266
1266
  return {
1267
- background: toCss({ ...paint2, a: 1 }),
1267
+ background: toCss({ ...paint3, a: 1 }),
1268
1268
  color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
1269
1269
  borderColor: TRANSPARENT,
1270
1270
  borderWidth: "0px"
1271
1271
  };
1272
1272
  }
1273
1273
  function generatedSecondary(primary) {
1274
- const paint2 = accentColor(primary);
1274
+ const paint3 = accentColor(primary);
1275
1275
  return {
1276
1276
  background: TRANSPARENT,
1277
- color: paint2,
1278
- borderColor: paint2,
1277
+ color: paint3,
1278
+ borderColor: paint3,
1279
1279
  borderWidth: "1px"
1280
1280
  };
1281
1281
  }
@@ -1288,9 +1288,9 @@ function generatedGhost(primary) {
1288
1288
  };
1289
1289
  }
1290
1290
  function normalizeOutlineChrome(outline, primary) {
1291
- const paint2 = accentColor(primary);
1291
+ const paint3 = accentColor(primary);
1292
1292
  const text = parseColor(outline.color);
1293
- const paintRgb = parseColor(paint2);
1293
+ const paintRgb = parseColor(paint3);
1294
1294
  const primaryLabel = parseColor(primary.color);
1295
1295
  const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
1296
1296
  const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
@@ -1299,8 +1299,8 @@ function normalizeOutlineChrome(outline, primary) {
1299
1299
  const hasBorder = parseFloat(outline.borderWidth) > 0;
1300
1300
  return {
1301
1301
  ...outline,
1302
- color: paint2,
1303
- borderColor: hasBorder ? paint2 : outline.borderColor
1302
+ color: paint3,
1303
+ borderColor: hasBorder ? paint3 : outline.borderColor
1304
1304
  };
1305
1305
  }
1306
1306
  function generateButtonVariants(samples) {
@@ -7912,6 +7912,60 @@ function applySectionEmbeds(content) {
7912
7912
  }
7913
7913
  }
7914
7914
 
7915
+ // src/lib/section-extra.ts
7916
+ var SECTION_EXTRA_SUFFIX = "__ohw_extra";
7917
+ function placeUnderCards(section, box) {
7918
+ const cards = section.querySelector("[data-ohw-cards]");
7919
+ if (cards) {
7920
+ cards.after(box);
7921
+ return;
7922
+ }
7923
+ const viewAll = section.querySelector(".classes-viewall");
7924
+ if (viewAll && section.contains(viewAll)) {
7925
+ section.insertBefore(box, viewAll);
7926
+ return;
7927
+ }
7928
+ const copy = section.querySelector(".classes-copy");
7929
+ if (copy?.parentElement === section) {
7930
+ copy.after(box);
7931
+ return;
7932
+ }
7933
+ section.appendChild(box);
7934
+ }
7935
+ function paint2(section, key, text) {
7936
+ const existing = section.querySelector(`[data-ohw-section-extra="${CSS.escape(key)}"]`);
7937
+ if (existing) {
7938
+ const editable = existing.querySelector('[data-ohw-editable="text"]');
7939
+ if (editable && editable.innerHTML !== text) {
7940
+ editable.innerHTML = text;
7941
+ }
7942
+ placeUnderCards(section, existing);
7943
+ return;
7944
+ }
7945
+ const box = document.createElement("div");
7946
+ box.setAttribute("data-ohw-section-extra", key);
7947
+ box.style.cssText = "width:100%;max-width:720px;margin:48px auto 0;padding:0 48px;box-sizing:border-box;text-align:center;";
7948
+ const p = document.createElement("p");
7949
+ p.setAttribute("data-ohw-editable", "text");
7950
+ p.setAttribute("data-ohw-key", key);
7951
+ p.style.cssText = "font-family:var(--font-body, inherit);font-weight:400;font-size:clamp(15px,1.4vw,18px);line-height:1.55;margin:0;color:inherit;";
7952
+ p.innerHTML = text;
7953
+ box.appendChild(p);
7954
+ placeUnderCards(section, box);
7955
+ }
7956
+ function applySectionExtras(content) {
7957
+ for (const [key, val] of Object.entries(content)) {
7958
+ if (!key.endsWith(SECTION_EXTRA_SUFFIX)) continue;
7959
+ const sectionId = key.slice(0, -SECTION_EXTRA_SUFFIX.length);
7960
+ const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
7961
+ if (!section || typeof val !== "string" || !val.trim()) {
7962
+ section?.querySelector(`[data-ohw-section-extra="${CSS.escape(key)}"]`)?.remove();
7963
+ continue;
7964
+ }
7965
+ paint2(section, key, val);
7966
+ }
7967
+ }
7968
+
7915
7969
  // src/ui/ai-tree/aiSectionsManager.tsx
7916
7970
  var import_react_dom = require("react-dom");
7917
7971
  var import_client = require("react-dom/client");
@@ -18139,7 +18193,7 @@ function apiBase() {
18139
18193
  function bridgeVersion() {
18140
18194
  try {
18141
18195
  if (true) {
18142
- return "0.1.172-next.456";
18196
+ return "0.1.172-next.457";
18143
18197
  }
18144
18198
  } catch {
18145
18199
  }
@@ -18153,7 +18207,7 @@ function stampBridgeVersionOnDocument() {
18153
18207
  return;
18154
18208
  }
18155
18209
  try {
18156
- const v = true ? "0.1.172-next.456" : "";
18210
+ const v = true ? "0.1.172-next.457" : "";
18157
18211
  if (v) {
18158
18212
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
18159
18213
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -29145,7 +29199,7 @@ function OhhwellsBridge() {
29145
29199
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
29146
29200
  continue;
29147
29201
  }
29148
- if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
29202
+ if (key.endsWith(SECTION_EMBED_SUFFIX) || key.endsWith(SECTION_EXTRA_SUFFIX)) continue;
29149
29203
  if (applyVideoSettingNode(key, val)) continue;
29150
29204
  if (applyCarouselNode(key, val)) continue;
29151
29205
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -29186,6 +29240,7 @@ function OhhwellsBridge() {
29186
29240
  applyLinkByKey(key, val);
29187
29241
  }
29188
29242
  applySectionEmbeds(content);
29243
+ applySectionExtras(content);
29189
29244
  applyLogoFromContent(content);
29190
29245
  applyLogoSizes(content);
29191
29246
  reconcileNavbarItemsFromContent(content);
@@ -29390,7 +29445,7 @@ function OhhwellsBridge() {
29390
29445
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
29391
29446
  continue;
29392
29447
  }
29393
- if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
29448
+ if (key.endsWith(SECTION_EMBED_SUFFIX) || key.endsWith(SECTION_EXTRA_SUFFIX)) continue;
29394
29449
  if (applyVideoSettingNode(key, val)) continue;
29395
29450
  if (applyCarouselNode(key, val)) continue;
29396
29451
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -29416,6 +29471,7 @@ function OhhwellsBridge() {
29416
29471
  applyLinkByKey(key, val);
29417
29472
  }
29418
29473
  applySectionEmbeds(content);
29474
+ applySectionExtras(content);
29419
29475
  applyLogoFromContent(content);
29420
29476
  reconcileNavbarItemsFromContent(content);
29421
29477
  reconcileFooterOrderFromContent(content);
@@ -31676,7 +31732,7 @@ function OhhwellsBridge() {
31676
31732
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
31677
31733
  continue;
31678
31734
  }
31679
- if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
31735
+ if (key.endsWith(SECTION_EMBED_SUFFIX) || key.endsWith(SECTION_EXTRA_SUFFIX)) continue;
31680
31736
  if (applyVideoSettingNode(key, val)) continue;
31681
31737
  if (applyCarouselNode(key, val)) continue;
31682
31738
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -31703,6 +31759,7 @@ function OhhwellsBridge() {
31703
31759
  applyLinkByKey(key, val);
31704
31760
  }
31705
31761
  applySectionEmbeds(content);
31762
+ applySectionExtras(content);
31706
31763
  applyLogoFromContent(content);
31707
31764
  applyLogoSizes(content);
31708
31765
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
@@ -33476,7 +33533,7 @@ function OhhwellsBridge() {
33476
33533
  postToParent2({
33477
33534
  type: "ow:ready",
33478
33535
  version: "1",
33479
- bridgeVersion: "0.1.172-next.456",
33536
+ bridgeVersion: "0.1.172-next.457",
33480
33537
  path: pathname,
33481
33538
  nodes: collectEditableNodes(editContentRef.current),
33482
33539
  sections