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.
@@ -1,9 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as CanvasPlugin } from './types-BS-YG8Hx.cjs';
2
+ import { C as CanvasPlugin } from './types-NBYvslB-.cjs';
3
3
  import 'react';
4
4
  import './types-BCCvY6ie.cjs';
5
5
  import './shape-builders-CKEMjivV.cjs';
6
6
  import './link-item-Dncuz2d_.cjs';
7
+ import './types-BQUbxMgz.cjs';
7
8
 
8
9
  type ChatbotPluginPanelProps = {
9
10
  /**
package/dist/chatbot.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as CanvasPlugin } from './types-UZYYwK-v.js';
2
+ import { C as CanvasPlugin } from './types-DeDm865m.js';
3
3
  import 'react';
4
4
  import './types-BCCvY6ie.js';
5
5
  import './shape-builders-Cyh8zvDG.js';
6
6
  import './link-item-voRU0Up9.js';
7
+ import './types-B82WiQQh.js';
7
8
 
8
9
  type ChatbotPluginPanelProps = {
9
10
  /**
package/dist/index.cjs CHANGED
@@ -995,7 +995,7 @@ var LINK_PLUGIN_KEY = "canvuLink";
995
995
  var DEFAULT_LINK_CARD_WIDTH = 320;
996
996
  var DEFAULT_LINK_CARD_HEIGHT = 70;
997
997
  var LINK_CARD_MIN_SCALE = 0.6;
998
- var LINK_CARD_MAX_SCALE = 2.5;
998
+ var LINK_CARD_MAX_SCALE = 6;
999
999
  var LINK_CARD_BORDER = "oklch(0.918 0.008 255)";
1000
1000
  var LINK_CARD_BORDER_STRONG = "oklch(0.86 0.012 255)";
1001
1001
  var LINK_CARD_ACCENT = "oklch(0.55 0.19 264)";
@@ -1007,7 +1007,6 @@ var formatNumber = (value) => {
1007
1007
  const rounded = Math.round(value * 100) / 100;
1008
1008
  return Object.is(rounded, -0) ? "0" : String(rounded);
1009
1009
  };
1010
- var escapeXmlAttribute = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
1011
1010
  var escapeHtmlText = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
1012
1011
  var getLinkHostname = (href) => {
1013
1012
  try {
@@ -1032,7 +1031,6 @@ var getLinkInitial = (hostname) => {
1032
1031
  const first = hostname.trim().charAt(0).toUpperCase();
1033
1032
  return first || "L";
1034
1033
  };
1035
- var buildGoogleFaviconUrl = (hostname) => hostname ? `https://www.google.com/s2/favicons?domain=${encodeURIComponent(hostname)}&sz=64` : null;
1036
1034
  var getStableLinkIdSuffix = (value) => {
1037
1035
  let hash = 0;
1038
1036
  for (const char of value) {
@@ -1055,16 +1053,13 @@ function buildLinkCardSvg(width, _height, link) {
1055
1053
  const title = link.title?.trim() || hostname || "Link";
1056
1054
  const protocol = getLinkProtocol(link.href);
1057
1055
  const subtitle = hostname || link.href;
1058
- const favicon = link.favicon?.trim() || buildGoogleFaviconUrl(hostname);
1059
1056
  const idSuffix = getStableLinkIdSuffix(`${hostname}:${link.href}`);
1060
- const clipId = `canvu-link-favicon-${idSuffix}`;
1061
1057
  const gradientId = `canvu-link-favicon-gradient-${idSuffix}`;
1062
1058
  const buttonX = contentWidth - padding - buttonSize;
1063
1059
  const buttonY = (contentHeight - buttonSize) / 2;
1064
1060
  const isSecure = protocol === "https:";
1065
1061
  const subtitleX = isSecure ? textX + 13 : textX;
1066
1062
  const subtitleWidth = isSecure ? textWidth - 13 : textWidth;
1067
- 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})" />` : "";
1068
1063
  return `
1069
1064
  <style>
1070
1065
  .canvu-link-card-root .canvu-link-card { transition: transform .18s ease, filter .18s ease, stroke .18s ease; }
@@ -1079,13 +1074,9 @@ function buildLinkCardSvg(width, _height, link) {
1079
1074
  <stop stop-color="${LINK_CARD_ACCENT}" />
1080
1075
  <stop offset="1" stop-color="${LINK_CARD_ACCENT_DEEP}" />
1081
1076
  </linearGradient>
1082
- <clipPath id="${clipId}">
1083
- <rect x="${formatNumber(padding)}" y="${formatNumber(padding)}" width="${formatNumber(badgeSize)}" height="${formatNumber(badgeSize)}" rx="11" />
1084
- </clipPath>
1085
1077
  </defs>
1086
1078
  <rect x="${formatNumber(padding)}" y="${formatNumber(padding)}" width="${formatNumber(badgeSize)}" height="${formatNumber(badgeSize)}" rx="11" fill="url(#${gradientId})" />
1087
1079
  <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>
1088
- ${faviconImage}
1089
1080
  ${buildLinkTextBand({ x: textX, y: 16, width: textWidth, height: 19, text: title, fontSize: 14.5, color: LINK_CARD_TITLE_COLOR, fontWeight: 700 })}
1090
1081
  ${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>` : ""}
1091
1082
  ${buildLinkTextBand({ x: subtitleX, y: 36, width: subtitleWidth, height: 17, text: subtitle, fontSize: 12.5, color: LINK_CARD_TEXT_COLOR })}