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/chatbot.d.cts +2 -1
- package/dist/chatbot.d.ts +2 -1
- package/dist/index.cjs +1 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -10
- package/dist/index.js.map +1 -1
- package/dist/native.cjs +240 -33
- package/dist/native.cjs.map +1 -1
- package/dist/native.d.cts +10 -1
- package/dist/native.d.ts +10 -1
- package/dist/native.js +241 -34
- package/dist/native.js.map +1 -1
- package/dist/react.cjs +2 -11
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +3 -2
- package/dist/react.d.ts +3 -2
- package/dist/react.js +2 -11
- package/dist/react.js.map +1 -1
- package/dist/realtime.cjs +18 -3
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +3 -2
- package/dist/realtime.d.ts +3 -2
- package/dist/realtime.js +18 -3
- package/dist/realtime.js.map +1 -1
- package/dist/realtimeNative.cjs +2124 -0
- package/dist/realtimeNative.cjs.map +1 -0
- package/dist/realtimeNative.d.cts +255 -0
- package/dist/realtimeNative.d.ts +255 -0
- package/dist/realtimeNative.js +2097 -0
- package/dist/realtimeNative.js.map +1 -0
- package/dist/tldraw.cjs +1 -10
- package/dist/tldraw.cjs.map +1 -1
- package/dist/tldraw.js +1 -10
- package/dist/tldraw.js.map +1 -1
- package/dist/types-B82WiQQh.d.ts +69 -0
- package/dist/types-BQUbxMgz.d.cts +69 -0
- package/dist/{types-UZYYwK-v.d.ts → types-DeDm865m.d.ts} +2 -67
- package/dist/{types-BS-YG8Hx.d.cts → types-NBYvslB-.d.cts} +2 -67
- package/package.json +7 -1
package/dist/react.cjs
CHANGED
|
@@ -72,16 +72,13 @@ function buildLinkCardSvg(width, _height, link) {
|
|
|
72
72
|
const title = link.title?.trim() || hostname || "Link";
|
|
73
73
|
const protocol = getLinkProtocol(link.href);
|
|
74
74
|
const subtitle = hostname || link.href;
|
|
75
|
-
const favicon = link.favicon?.trim() || buildGoogleFaviconUrl(hostname);
|
|
76
75
|
const idSuffix = getStableLinkIdSuffix(`${hostname}:${link.href}`);
|
|
77
|
-
const clipId = `canvu-link-favicon-${idSuffix}`;
|
|
78
76
|
const gradientId = `canvu-link-favicon-gradient-${idSuffix}`;
|
|
79
77
|
const buttonX = contentWidth - padding - buttonSize;
|
|
80
78
|
const buttonY = (contentHeight - buttonSize) / 2;
|
|
81
79
|
const isSecure = protocol === "https:";
|
|
82
80
|
const subtitleX = isSecure ? textX + 13 : textX;
|
|
83
81
|
const subtitleWidth = isSecure ? textWidth - 13 : textWidth;
|
|
84
|
-
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})" />` : "";
|
|
85
82
|
return `
|
|
86
83
|
<style>
|
|
87
84
|
.canvu-link-card-root .canvu-link-card { transition: transform .18s ease, filter .18s ease, stroke .18s ease; }
|
|
@@ -96,13 +93,9 @@ function buildLinkCardSvg(width, _height, link) {
|
|
|
96
93
|
<stop stop-color="${LINK_CARD_ACCENT}" />
|
|
97
94
|
<stop offset="1" stop-color="${LINK_CARD_ACCENT_DEEP}" />
|
|
98
95
|
</linearGradient>
|
|
99
|
-
<clipPath id="${clipId}">
|
|
100
|
-
<rect x="${formatNumber(padding)}" y="${formatNumber(padding)}" width="${formatNumber(badgeSize)}" height="${formatNumber(badgeSize)}" rx="11" />
|
|
101
|
-
</clipPath>
|
|
102
96
|
</defs>
|
|
103
97
|
<rect x="${formatNumber(padding)}" y="${formatNumber(padding)}" width="${formatNumber(badgeSize)}" height="${formatNumber(badgeSize)}" rx="11" fill="url(#${gradientId})" />
|
|
104
98
|
<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>
|
|
105
|
-
${faviconImage}
|
|
106
99
|
${buildLinkTextBand({ x: textX, y: 16, width: textWidth, height: 19, text: title, fontSize: 14.5, color: LINK_CARD_TITLE_COLOR, fontWeight: 700 })}
|
|
107
100
|
${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>` : ""}
|
|
108
101
|
${buildLinkTextBand({ x: subtitleX, y: 36, width: subtitleWidth, height: 17, text: subtitle, fontSize: 12.5, color: LINK_CARD_TEXT_COLOR })}
|
|
@@ -154,14 +147,14 @@ function rebuildLinkItemSvg(item) {
|
|
|
154
147
|
childrenSvg: buildLinkCardSvg(width, height, link)
|
|
155
148
|
};
|
|
156
149
|
}
|
|
157
|
-
var LINK_PLUGIN_KEY, DEFAULT_LINK_CARD_WIDTH, DEFAULT_LINK_CARD_HEIGHT, LINK_CARD_MIN_SCALE, LINK_CARD_MAX_SCALE, LINK_CARD_ASPECT, LINK_CARD_BORDER, LINK_CARD_BORDER_STRONG, LINK_CARD_ACCENT, LINK_CARD_ACCENT_DEEP, LINK_CARD_TITLE_COLOR, LINK_CARD_TEXT_COLOR, clamp, formatNumber,
|
|
150
|
+
var LINK_PLUGIN_KEY, DEFAULT_LINK_CARD_WIDTH, DEFAULT_LINK_CARD_HEIGHT, LINK_CARD_MIN_SCALE, LINK_CARD_MAX_SCALE, LINK_CARD_ASPECT, LINK_CARD_BORDER, LINK_CARD_BORDER_STRONG, LINK_CARD_ACCENT, LINK_CARD_ACCENT_DEEP, LINK_CARD_TITLE_COLOR, LINK_CARD_TEXT_COLOR, clamp, formatNumber, escapeHtmlText, getLinkHostname, buildLinkTextBand, getLinkProtocol, getLinkInitial, getStableLinkIdSuffix, isCanvuLinkData;
|
|
158
151
|
var init_link_item = __esm({
|
|
159
152
|
"src/scene/link-item.ts"() {
|
|
160
153
|
LINK_PLUGIN_KEY = "canvuLink";
|
|
161
154
|
DEFAULT_LINK_CARD_WIDTH = 320;
|
|
162
155
|
DEFAULT_LINK_CARD_HEIGHT = 70;
|
|
163
156
|
LINK_CARD_MIN_SCALE = 0.6;
|
|
164
|
-
LINK_CARD_MAX_SCALE =
|
|
157
|
+
LINK_CARD_MAX_SCALE = 6;
|
|
165
158
|
LINK_CARD_ASPECT = DEFAULT_LINK_CARD_WIDTH / DEFAULT_LINK_CARD_HEIGHT;
|
|
166
159
|
LINK_CARD_BORDER = "oklch(0.918 0.008 255)";
|
|
167
160
|
LINK_CARD_BORDER_STRONG = "oklch(0.86 0.012 255)";
|
|
@@ -174,7 +167,6 @@ var init_link_item = __esm({
|
|
|
174
167
|
const rounded = Math.round(value * 100) / 100;
|
|
175
168
|
return Object.is(rounded, -0) ? "0" : String(rounded);
|
|
176
169
|
};
|
|
177
|
-
escapeXmlAttribute = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
178
170
|
escapeHtmlText = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
179
171
|
getLinkHostname = (href) => {
|
|
180
172
|
try {
|
|
@@ -199,7 +191,6 @@ var init_link_item = __esm({
|
|
|
199
191
|
const first = hostname.trim().charAt(0).toUpperCase();
|
|
200
192
|
return first || "L";
|
|
201
193
|
};
|
|
202
|
-
buildGoogleFaviconUrl = (hostname) => hostname ? `https://www.google.com/s2/favicons?domain=${encodeURIComponent(hostname)}&sz=64` : null;
|
|
203
194
|
getStableLinkIdSuffix = (value) => {
|
|
204
195
|
let hash = 0;
|
|
205
196
|
for (const char of value) {
|