canvu-react 0.4.32 → 0.4.34

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.js CHANGED
@@ -988,7 +988,7 @@ var LINK_PLUGIN_KEY = "canvuLink";
988
988
  var DEFAULT_LINK_CARD_WIDTH = 320;
989
989
  var DEFAULT_LINK_CARD_HEIGHT = 70;
990
990
  var LINK_CARD_MIN_SCALE = 0.6;
991
- var LINK_CARD_MAX_SCALE = 2.5;
991
+ var LINK_CARD_MAX_SCALE = 6;
992
992
  var LINK_CARD_BORDER = "oklch(0.918 0.008 255)";
993
993
  var LINK_CARD_BORDER_STRONG = "oklch(0.86 0.012 255)";
994
994
  var LINK_CARD_ACCENT = "oklch(0.55 0.19 264)";
@@ -1000,7 +1000,6 @@ var formatNumber = (value) => {
1000
1000
  const rounded = Math.round(value * 100) / 100;
1001
1001
  return Object.is(rounded, -0) ? "0" : String(rounded);
1002
1002
  };
1003
- var escapeXmlAttribute = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
1004
1003
  var escapeHtmlText = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
1005
1004
  var getLinkHostname = (href) => {
1006
1005
  try {
@@ -1025,7 +1024,6 @@ var getLinkInitial = (hostname) => {
1025
1024
  const first = hostname.trim().charAt(0).toUpperCase();
1026
1025
  return first || "L";
1027
1026
  };
1028
- var buildGoogleFaviconUrl = (hostname) => hostname ? `https://www.google.com/s2/favicons?domain=${encodeURIComponent(hostname)}&sz=64` : null;
1029
1027
  var getStableLinkIdSuffix = (value) => {
1030
1028
  let hash = 0;
1031
1029
  for (const char of value) {
@@ -1048,16 +1046,13 @@ function buildLinkCardSvg(width, _height, link) {
1048
1046
  const title = link.title?.trim() || hostname || "Link";
1049
1047
  const protocol = getLinkProtocol(link.href);
1050
1048
  const subtitle = hostname || link.href;
1051
- const favicon = link.favicon?.trim() || buildGoogleFaviconUrl(hostname);
1052
1049
  const idSuffix = getStableLinkIdSuffix(`${hostname}:${link.href}`);
1053
- const clipId = `canvu-link-favicon-${idSuffix}`;
1054
1050
  const gradientId = `canvu-link-favicon-gradient-${idSuffix}`;
1055
1051
  const buttonX = contentWidth - padding - buttonSize;
1056
1052
  const buttonY = (contentHeight - buttonSize) / 2;
1057
1053
  const isSecure = protocol === "https:";
1058
1054
  const subtitleX = isSecure ? textX + 13 : textX;
1059
1055
  const subtitleWidth = isSecure ? textWidth - 13 : textWidth;
1060
- const faviconImage = favicon ? `<image class="canvu-link-favicon-img" href="${escapeXmlAttribute(favicon)}" x="${formatNumber(padding)}" y="${formatNumber(padding)}" width="${formatNumber(badgeSize)}" height="${formatNumber(badgeSize)}" preserveAspectRatio="xMidYMid slice" clip-path="url(#${clipId})" />` : "";
1061
1056
  return `
1062
1057
  <style>
1063
1058
  .canvu-link-card-root .canvu-link-card { transition: transform .18s ease, filter .18s ease, stroke .18s ease; }
@@ -1072,13 +1067,9 @@ function buildLinkCardSvg(width, _height, link) {
1072
1067
  <stop stop-color="${LINK_CARD_ACCENT}" />
1073
1068
  <stop offset="1" stop-color="${LINK_CARD_ACCENT_DEEP}" />
1074
1069
  </linearGradient>
1075
- <clipPath id="${clipId}">
1076
- <rect x="${formatNumber(padding)}" y="${formatNumber(padding)}" width="${formatNumber(badgeSize)}" height="${formatNumber(badgeSize)}" rx="11" />
1077
- </clipPath>
1078
1070
  </defs>
1079
1071
  <rect x="${formatNumber(padding)}" y="${formatNumber(padding)}" width="${formatNumber(badgeSize)}" height="${formatNumber(badgeSize)}" rx="11" fill="url(#${gradientId})" />
1080
1072
  <text x="${formatNumber(padding + badgeSize / 2)}" y="${formatNumber(padding + badgeSize / 2 + 5)}" text-anchor="middle" font-family="system-ui,sans-serif" font-size="17" font-weight="700" fill="#ffffff">${escapeHtmlText(getLinkInitial(hostname))}</text>
1081
- ${faviconImage}
1082
1073
  ${buildLinkTextBand({ x: textX, y: 16, width: textWidth, height: 19, text: title, fontSize: 14.5, color: LINK_CARD_TITLE_COLOR, fontWeight: 700 })}
1083
1074
  ${isSecure ? `<g transform="translate(${formatNumber(textX)},40)" stroke="${LINK_CARD_TEXT_COLOR}" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" fill="none"><rect x="1.5" y="4.5" width="7" height="6" rx="1" /><path d="M3 4.5 V3 a2 2 0 0 1 4 0 v1.5" /></g>` : ""}
1084
1075
  ${buildLinkTextBand({ x: subtitleX, y: 36, width: subtitleWidth, height: 17, text: subtitle, fontSize: 12.5, color: LINK_CARD_TEXT_COLOR })}