@ai-matrx/records-ui 0.116.76 → 0.116.77
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/CHANGELOG.md +4 -8342
- package/dist/{chunk-D2FZEAYO.js → chunk-P7GVWT6U.js} +341 -325
- package/dist/chunk-P7GVWT6U.js.map +1 -0
- package/dist/index.cjs +50 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/pickers.cjs +43 -27
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +1 -1
- package/package.json +6 -6
- package/dist/chunk-D2FZEAYO.js.map +0 -1
package/dist/index.js
CHANGED
package/dist/pickers.cjs
CHANGED
|
@@ -8173,12 +8173,36 @@ var import_design_system22 = require("@ai-matrx/design-system");
|
|
|
8173
8173
|
init_host();
|
|
8174
8174
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
8175
8175
|
var answers = /* @__PURE__ */ new Map();
|
|
8176
|
+
function hostOf(url) {
|
|
8177
|
+
try {
|
|
8178
|
+
return new URL(url).hostname.replace(/^www\./, "");
|
|
8179
|
+
} catch {
|
|
8180
|
+
return url;
|
|
8181
|
+
}
|
|
8182
|
+
}
|
|
8183
|
+
function linkPreviewRecord(url, shown2) {
|
|
8184
|
+
const site = shown2.siteName?.trim() || hostOf(url);
|
|
8185
|
+
const title = shown2.title?.trim() || site;
|
|
8186
|
+
return {
|
|
8187
|
+
kind: "Link",
|
|
8188
|
+
id: url,
|
|
8189
|
+
showId: false,
|
|
8190
|
+
title,
|
|
8191
|
+
...shown2.siteName || shown2.title ? { subtitle: site } : {},
|
|
8192
|
+
avatar: { initials: site.slice(0, 1).toUpperCase(), ...shown2.faviconUrl ? { src: shown2.faviconUrl } : {} },
|
|
8193
|
+
...shown2.imageUrl ? { media: { alt: title, src: shown2.imageUrl, aspect: "16:9" } } : {},
|
|
8194
|
+
...shown2.description ? { body: [{ section: "Description", text: shown2.description, clamp: 3 }] } : {},
|
|
8195
|
+
href: url,
|
|
8196
|
+
copyData: { url, title: shown2.title, description: shown2.description, site: shown2.siteName }
|
|
8197
|
+
};
|
|
8198
|
+
}
|
|
8176
8199
|
function LinkPreviewCard({ url, children }) {
|
|
8177
8200
|
const port = useRecordsUi().linkPreview;
|
|
8178
8201
|
const [preview, setPreview] = (0, import_react34.useState)(void 0);
|
|
8179
8202
|
const [open, setOpen] = (0, import_react34.useState)(false);
|
|
8180
|
-
const
|
|
8181
|
-
(0, import_react34.
|
|
8203
|
+
const shown2 = preview && (preview.title || preview.description || preview.imageUrl) ? preview : null;
|
|
8204
|
+
const record = (0, import_react34.useMemo)(() => shown2 ? linkPreviewRecord(url, shown2) : null, [url, shown2]);
|
|
8205
|
+
(0, import_react34.useEffect)(() => setPreview(void 0), [url]);
|
|
8182
8206
|
if (!port) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children });
|
|
8183
8207
|
const ask = () => {
|
|
8184
8208
|
if (preview !== void 0) return;
|
|
@@ -8189,31 +8213,23 @@ function LinkPreviewCard({ url, children }) {
|
|
|
8189
8213
|
}
|
|
8190
8214
|
void pending.then((found) => setPreview(found));
|
|
8191
8215
|
};
|
|
8192
|
-
const
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
|
|
8197
|
-
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
8210
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_design_system22.SiteIcon, { site: url, iconUrl: shown2.faviconUrl, className: "h-3.5 w-3.5" }),
|
|
8211
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "truncate text-muted-foreground", children: shown2.siteName ?? "" })
|
|
8212
|
-
] }),
|
|
8213
|
-
shown2.title ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "line-clamp-2 font-medium", children: shown2.title }) : null,
|
|
8214
|
-
shown2.description ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "line-clamp-3 text-muted-foreground", children: shown2.description }) : null
|
|
8215
|
-
] }) : null
|
|
8216
|
-
] });
|
|
8216
|
+
const chip = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "inline-flex min-w-0 max-w-full", onMouseEnter: ask, onFocus: ask, children });
|
|
8217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
8218
|
+
import_design_system22.PeekHoverCard,
|
|
8219
|
+
{
|
|
8220
|
+
trigger: chip,
|
|
8221
|
+
label: record?.title ?? "Link",
|
|
8222
|
+
side: "bottom",
|
|
8223
|
+
align: "start",
|
|
8224
|
+
presentation: "float",
|
|
8225
|
+
open: open && record !== null,
|
|
8226
|
+
onOpenChange: (next) => {
|
|
8227
|
+
if (next) ask();
|
|
8228
|
+
setOpen(next);
|
|
8229
|
+
},
|
|
8230
|
+
children: record ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_design_system22.Peek, { record, size: "sm" }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, {})
|
|
8231
|
+
}
|
|
8232
|
+
);
|
|
8217
8233
|
}
|
|
8218
8234
|
|
|
8219
8235
|
// src/formattedValue.tsx
|