@ai-matrx/records-ui 0.116.79 → 0.116.80

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
@@ -204,7 +204,7 @@ import {
204
204
  withoutLeadingBlank,
205
205
  workedOutErrorFor,
206
206
  workedOutHoldsNumbers
207
- } from "./chunk-5ICDUZS7.js";
207
+ } from "./chunk-5DELD6DC.js";
208
208
  import {
209
209
  CHART_PLOT_PX,
210
210
  EMBEDDED_ROW_PX,
package/dist/pickers.cjs CHANGED
@@ -8243,7 +8243,7 @@ function hostOf(url) {
8243
8243
  return url;
8244
8244
  }
8245
8245
  }
8246
- function linkPreviewRecord(url, shown2) {
8246
+ function linkPreviewRecord(url, shown2, icon = shown2.faviconUrl) {
8247
8247
  const site = shown2.siteName?.trim() || hostOf(url);
8248
8248
  const title = shown2.title?.trim() || site;
8249
8249
  return {
@@ -8252,7 +8252,7 @@ function linkPreviewRecord(url, shown2) {
8252
8252
  showId: false,
8253
8253
  title,
8254
8254
  ...shown2.siteName || shown2.title ? { subtitle: site } : {},
8255
- avatar: { initials: site.slice(0, 1).toUpperCase(), ...shown2.faviconUrl ? { src: shown2.faviconUrl } : {} },
8255
+ avatar: { initials: site.slice(0, 1).toUpperCase(), ...icon ? { src: icon } : {} },
8256
8256
  ...shown2.imageUrl ? { media: { alt: title, src: shown2.imageUrl, aspect: "16:9" } } : {},
8257
8257
  ...shown2.description ? { body: [{ section: "Description", text: shown2.description, clamp: 3 }] } : {},
8258
8258
  href: url,
@@ -8264,7 +8264,20 @@ function LinkPreviewCard({ url, children }) {
8264
8264
  const [preview, setPreview] = (0, import_react34.useState)(void 0);
8265
8265
  const [open, setOpen] = (0, import_react34.useState)(false);
8266
8266
  const shown2 = preview && (preview.title || preview.description || preview.imageUrl) ? preview : null;
8267
- const record = (0, import_react34.useMemo)(() => shown2 ? linkPreviewRecord(url, shown2) : null, [url, shown2]);
8267
+ const [icon, setIcon] = (0, import_react34.useState)(null);
8268
+ const iconKey = `${url}|${shown2?.faviconUrl ?? ""}`;
8269
+ (0, import_react34.useEffect)(() => {
8270
+ if (!shown2) return;
8271
+ let live = true;
8272
+ void (0, import_design_system22.resolveSiteIcon)(url, shown2.faviconUrl).then((src) => live && setIcon({ key: iconKey, src }));
8273
+ return () => {
8274
+ live = false;
8275
+ };
8276
+ }, [shown2, url, iconKey]);
8277
+ const record = (0, import_react34.useMemo)(
8278
+ () => shown2 ? linkPreviewRecord(url, shown2, icon?.key === iconKey ? icon.src : shown2.faviconUrl) : null,
8279
+ [url, shown2, icon, iconKey]
8280
+ );
8268
8281
  (0, import_react34.useEffect)(() => setPreview(void 0), [url]);
8269
8282
  if (!port) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children });
8270
8283
  const ask = () => {