@ai-matrx/records-ui 0.116.45 → 0.116.47
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 +29 -1
- package/dist/{SaveToTable-SL5DUNI4.js → SaveToTable-HG3HQMAQ.js} +5 -5
- package/dist/{chunk-KQR2RA4V.js → chunk-ABIUJCNS.js} +3 -3
- package/dist/chunk-ABIUJCNS.js.map +1 -0
- package/dist/{chunk-F4SAKQKQ.js → chunk-K3B5IRXY.js} +79 -76
- package/dist/chunk-K3B5IRXY.js.map +1 -0
- package/dist/{chunk-OV6QBL5R.js → chunk-LBZZDHV6.js} +8 -8
- package/dist/chunk-LBZZDHV6.js.map +1 -0
- package/dist/{chunk-NKZBAIU4.js → chunk-MDXDJVDB.js} +8 -6
- package/dist/chunk-MDXDJVDB.js.map +1 -0
- package/dist/{chunk-XKI6S5KF.js → chunk-VJDJQDDI.js} +7 -7
- package/dist/{chunk-XKI6S5KF.js.map → chunk-VJDJQDDI.js.map} +1 -1
- package/dist/helpers.cjs +14 -12
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.js +14 -12
- package/dist/helpers.js.map +1 -1
- package/dist/index.cjs +137 -116
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +46 -30
- package/dist/index.js.map +1 -1
- package/dist/object-actions.cjs +8 -8
- package/dist/object-actions.cjs.map +1 -1
- package/dist/object-actions.d.cts +1 -1
- package/dist/object-actions.d.ts +1 -1
- package/dist/object-actions.js +2 -2
- package/dist/{objectActions-Be9sBGvW.d.cts → objectActions-DK-qa5zC.d.cts} +1 -1
- package/dist/{objectActions-Be9sBGvW.d.ts → objectActions-DK-qa5zC.d.ts} +1 -1
- package/dist/pickers.cjs +90 -86
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +3 -3
- package/package.json +5 -5
- package/dist/chunk-F4SAKQKQ.js.map +0 -1
- package/dist/chunk-KQR2RA4V.js.map +0 -1
- package/dist/chunk-NKZBAIU4.js.map +0 -1
- package/dist/chunk-OV6QBL5R.js.map +0 -1
- /package/dist/{SaveToTable-SL5DUNI4.js.map → SaveToTable-HG3HQMAQ.js.map} +0 -0
package/dist/pickers.cjs
CHANGED
|
@@ -173,21 +173,22 @@ function exampleOf(error) {
|
|
|
173
173
|
}
|
|
174
174
|
function refusalForAPerson(error) {
|
|
175
175
|
const code = error.code ?? "internal";
|
|
176
|
+
const timedOut = code === "timed_out" || error.sqlstate === "57014" || /canceling statement due to statement timeout/i.test(String(error.message ?? ""));
|
|
176
177
|
const ours = error.ours === true;
|
|
177
178
|
const hint = plainSentence(String(error.hint ?? ""));
|
|
178
179
|
const message = ours ? plainSentence(String(error.message ?? "")) : peopleSentence(String(error.message ?? ""));
|
|
179
|
-
const title = TITLE[code] ?? "That was refused";
|
|
180
|
+
const title = timedOut ? TITLE["timed_out"] : TITLE[code] ?? "That was refused";
|
|
180
181
|
const hintIsForEngineers = isDeveloperHint(String(error.hint ?? ""));
|
|
181
182
|
const example = exampleOf(error);
|
|
182
|
-
const remedy = (example ? `Enter it like ${example}.` : null) ?? (hintIsForEngineers ? null : hint.kept) ?? REMEDY[code] ?? REMEDY["internal"];
|
|
183
|
+
const remedy = (example ? `Enter it like ${example}.` : null) ?? (hintIsForEngineers ? null : hint.kept) ?? (timedOut ? REMEDY["timed_out"] : REMEDY[code]) ?? REMEDY["internal"];
|
|
183
184
|
const messageIsForEngineers = isEngineerText(String(error.message ?? ""));
|
|
184
|
-
const said2 = (messageIsForEngineers ? "" : message.kept ?? "").trim();
|
|
185
|
+
const said2 = timedOut ? TIMED_OUT_SAID : (messageIsForEngineers ? "" : message.kept ?? "").trim();
|
|
185
186
|
const forEngineers = [
|
|
186
187
|
error.sqlstate ? `SQLSTATE ${error.sqlstate}.` : null,
|
|
187
188
|
// The client's own note about a class it did not recognize, or a call that
|
|
188
189
|
// never reached the store. It is rendered out of sight, never as a sentence.
|
|
189
190
|
error.diagnostic ? error.diagnostic : null,
|
|
190
|
-
messageIsForEngineers ? `Message: ${error.message}` : null,
|
|
191
|
+
messageIsForEngineers || timedOut ? `Message: ${error.message}` : null,
|
|
191
192
|
error.hint && (hintIsForEngineers || hint.kept !== error.hint) ? `Hint: ${error.hint}` : null,
|
|
192
193
|
message.dropped.length > 0 || hint.dropped.length > 0 ? `Dropped from the person's view: ${[...message.dropped, ...hint.dropped].join(" | ")}` : null
|
|
193
194
|
].filter(Boolean).join(" ");
|
|
@@ -211,7 +212,7 @@ function refusalLineForAPerson(error) {
|
|
|
211
212
|
function refusalIsMissingInput(error) {
|
|
212
213
|
return error.sqlstate === "22023" || error.code === "invalid_argument";
|
|
213
214
|
}
|
|
214
|
-
var MACHINE_IDENTITY, TITLE, REMEDY, ENGINEER_TEXT;
|
|
215
|
+
var MACHINE_IDENTITY, TITLE, REMEDY, ENGINEER_TEXT, TIMED_OUT_SAID;
|
|
215
216
|
var init_plainWords = __esm({
|
|
216
217
|
"src/plainWords.ts"() {
|
|
217
218
|
"use strict";
|
|
@@ -294,6 +295,7 @@ var init_plainWords = __esm({
|
|
|
294
295
|
// the app, arriving on the screen of somebody who cannot act on it.
|
|
295
296
|
/\bbind\s+[`'"A-Za-z]/i
|
|
296
297
|
];
|
|
298
|
+
TIMED_OUT_SAID = "That took too long. Nothing was lost; try again.";
|
|
297
299
|
}
|
|
298
300
|
});
|
|
299
301
|
|
|
@@ -311,7 +313,7 @@ function sentenceFor(what, level) {
|
|
|
311
313
|
share: "pass this on to somebody else",
|
|
312
314
|
structure: "change the columns of this table"
|
|
313
315
|
};
|
|
314
|
-
return `You
|
|
316
|
+
return `You have ${have} here, and it takes ${need} to ${doing[what]}. Ask somebody with Full access on it to move you up.`;
|
|
315
317
|
}
|
|
316
318
|
function whatYouMayDo(level, known = true) {
|
|
317
319
|
const may = (what) => known && (0, import_field_kinds2.atLeast)(level, NEEDS[what]);
|
|
@@ -349,11 +351,11 @@ var init_rights = __esm({
|
|
|
349
351
|
"use strict";
|
|
350
352
|
import_field_kinds2 = require("@ai-matrx/records/field-kinds");
|
|
351
353
|
LEVEL_WORD = {
|
|
352
|
-
viewer: "
|
|
353
|
-
commenter: "
|
|
354
|
-
edit_content: "
|
|
355
|
-
editor: "
|
|
356
|
-
admin: "
|
|
354
|
+
viewer: "View access",
|
|
355
|
+
commenter: "Comment access",
|
|
356
|
+
edit_content: "Edit access",
|
|
357
|
+
editor: "Edit access",
|
|
358
|
+
admin: "Full access"
|
|
357
359
|
};
|
|
358
360
|
NEEDS = {
|
|
359
361
|
read: "viewer",
|
|
@@ -375,7 +377,7 @@ var init_rights = __esm({
|
|
|
375
377
|
structure: "admin"
|
|
376
378
|
};
|
|
377
379
|
NOT_YET = "Checking what you may do here. Nothing is offered until then.";
|
|
378
|
-
NOTHING_AT_ALL = "You have not been given this. Ask somebody
|
|
380
|
+
NOTHING_AT_ALL = "You have not been given this. Ask somebody with Full access on it to share it with you.";
|
|
379
381
|
NOT_ANSWERED_YET = whatYouMayDo(null, false);
|
|
380
382
|
KERNEL_REASON = "This is one of the tables the platform ships, so its columns are not changed from a screen. Make your own table to change columns.";
|
|
381
383
|
DATABASE_LOCKED_REASON = "This database is locked, so its columns and settings are read-only. Unlock it to change them.";
|
|
@@ -8009,12 +8011,63 @@ init_choiceLooks();
|
|
|
8009
8011
|
var import_field_formats7 = require("@ai-matrx/design-system/field-formats");
|
|
8010
8012
|
|
|
8011
8013
|
// src/formattedValue.tsx
|
|
8012
|
-
var
|
|
8014
|
+
var import_react34 = require("react");
|
|
8013
8015
|
var import_data_table2 = require("@ai-matrx/design-system/data-table");
|
|
8014
8016
|
var import_field_formats5 = require("@ai-matrx/design-system/field-formats");
|
|
8015
|
-
var
|
|
8017
|
+
var import_design_system22 = require("@ai-matrx/design-system");
|
|
8016
8018
|
var import_outbound_react3 = require("@ai-matrx/kit/outbound-react");
|
|
8019
|
+
|
|
8020
|
+
// src/LinkPreviewCard.tsx
|
|
8021
|
+
var import_react33 = require("react");
|
|
8022
|
+
var import_design_system21 = require("@ai-matrx/design-system");
|
|
8023
|
+
init_host();
|
|
8017
8024
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
8025
|
+
var answers = /* @__PURE__ */ new Map();
|
|
8026
|
+
function LinkPreviewCard({ url, children }) {
|
|
8027
|
+
const port = useRecordsUi().linkPreview;
|
|
8028
|
+
const [preview, setPreview] = (0, import_react33.useState)(void 0);
|
|
8029
|
+
const [open, setOpen] = (0, import_react33.useState)(false);
|
|
8030
|
+
const timer = (0, import_react33.useRef)(null);
|
|
8031
|
+
(0, import_react33.useEffect)(() => () => void (timer.current && clearTimeout(timer.current)), []);
|
|
8032
|
+
if (!port) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children });
|
|
8033
|
+
const ask = () => {
|
|
8034
|
+
if (preview !== void 0) return;
|
|
8035
|
+
let pending = answers.get(url);
|
|
8036
|
+
if (!pending) {
|
|
8037
|
+
pending = port.read(url).catch(() => null);
|
|
8038
|
+
answers.set(url, pending);
|
|
8039
|
+
}
|
|
8040
|
+
void pending.then((found) => setPreview(found));
|
|
8041
|
+
};
|
|
8042
|
+
const enter = () => {
|
|
8043
|
+
ask();
|
|
8044
|
+
if (timer.current) clearTimeout(timer.current);
|
|
8045
|
+
timer.current = setTimeout(() => setOpen(true), 350);
|
|
8046
|
+
};
|
|
8047
|
+
const leave = () => {
|
|
8048
|
+
if (timer.current) clearTimeout(timer.current);
|
|
8049
|
+
setOpen(false);
|
|
8050
|
+
};
|
|
8051
|
+
const shown2 = preview && (preview.title || preview.description || preview.imageUrl) ? preview : null;
|
|
8052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_design_system21.HoverCard, { open: open && shown2 !== null, onOpenChange: (next) => next ? void 0 : setOpen(false), children: [
|
|
8053
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_design_system21.HoverCardTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "inline-flex min-w-0 max-w-full", onMouseEnter: enter, onMouseLeave: leave, onFocus: enter, onBlur: leave, children }) }),
|
|
8054
|
+
shown2 ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_design_system21.HoverCardContent, { align: "start", className: "w-72 space-y-1.5 p-2 text-xs", "data-records-link-preview": "", children: [
|
|
8055
|
+
shown2.imageUrl ? (
|
|
8056
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
8057
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("img", { src: shown2.imageUrl, alt: "", className: "h-28 w-full rounded object-cover", referrerPolicy: "no-referrer" })
|
|
8058
|
+
) : null,
|
|
8059
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
8060
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_design_system21.SiteIcon, { site: url, iconUrl: shown2.faviconUrl, className: "h-3.5 w-3.5" }),
|
|
8061
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "truncate text-muted-foreground", children: shown2.siteName ?? "" })
|
|
8062
|
+
] }),
|
|
8063
|
+
shown2.title ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "line-clamp-2 font-medium", children: shown2.title }) : null,
|
|
8064
|
+
shown2.description ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "line-clamp-3 text-muted-foreground", children: shown2.description }) : null
|
|
8065
|
+
] }) : null
|
|
8066
|
+
] });
|
|
8067
|
+
}
|
|
8068
|
+
|
|
8069
|
+
// src/formattedValue.tsx
|
|
8070
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
8018
8071
|
var LINK = "inline-flex min-w-0 items-center gap-1 text-primary hover:underline";
|
|
8019
8072
|
var own2 = (event) => event.stopPropagation();
|
|
8020
8073
|
function numberOf2(value) {
|
|
@@ -8032,11 +8085,11 @@ function RatingStars({
|
|
|
8032
8085
|
label,
|
|
8033
8086
|
selectFirst
|
|
8034
8087
|
}) {
|
|
8035
|
-
const armed = (0,
|
|
8088
|
+
const armed = (0, import_react34.useRef)(true);
|
|
8036
8089
|
const score = numberOf2(value) ?? 0;
|
|
8037
8090
|
const shown2 = Math.round(score);
|
|
8038
8091
|
const said2 = `${shown2} out of ${max}`;
|
|
8039
|
-
return /* @__PURE__ */ (0,
|
|
8092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
8040
8093
|
"span",
|
|
8041
8094
|
{
|
|
8042
8095
|
"data-records-rating": "",
|
|
@@ -8048,8 +8101,8 @@ function RatingStars({
|
|
|
8048
8101
|
children: Array.from({ length: max }, (_, i) => {
|
|
8049
8102
|
const n = i + 1;
|
|
8050
8103
|
const lit = n <= shown2;
|
|
8051
|
-
const star = /* @__PURE__ */ (0,
|
|
8052
|
-
return onRate ? /* @__PURE__ */ (0,
|
|
8104
|
+
const star = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { "aria-hidden": true, className: (0, import_design_system22.cn)("text-sm leading-none", lit ? "text-amber-400" : "text-muted-foreground/40"), children: "\u2605" });
|
|
8105
|
+
return onRate ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
8053
8106
|
"button",
|
|
8054
8107
|
{
|
|
8055
8108
|
type: "button",
|
|
@@ -8074,7 +8127,7 @@ function RatingStars({
|
|
|
8074
8127
|
children: star
|
|
8075
8128
|
},
|
|
8076
8129
|
n
|
|
8077
|
-
) : /* @__PURE__ */ (0,
|
|
8130
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: star }, n);
|
|
8078
8131
|
})
|
|
8079
8132
|
}
|
|
8080
8133
|
);
|
|
@@ -8082,20 +8135,20 @@ function RatingStars({
|
|
|
8082
8135
|
function rich(id, text, raw, format) {
|
|
8083
8136
|
switch (id) {
|
|
8084
8137
|
case "email":
|
|
8085
|
-
return /* @__PURE__ */ (0,
|
|
8138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("a", { href: `mailto:${text}`, className: LINK, onClick: own2, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "truncate", children: readableLink(text) }) });
|
|
8086
8139
|
case "url":
|
|
8087
|
-
return /* @__PURE__ */ (0,
|
|
8140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(LinkPreviewCard, { url: text.includes("://") ? text : `https://${text}`, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_outbound_react3.OutboundLink, { href: text.includes("://") ? text : `https://${text}`, className: LINK, onClick: own2, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "truncate", children: text }) }) });
|
|
8088
8141
|
case "phone":
|
|
8089
|
-
return /* @__PURE__ */ (0,
|
|
8142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("a", { href: `tel:${text.replace(/[^\d+]/g, "")}`, className: LINK, onClick: own2, title: text, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "truncate tabular-nums", children: (0, import_field_formats5.formatPhone)(text) }) });
|
|
8090
8143
|
case "address":
|
|
8091
|
-
return /* @__PURE__ */ (0,
|
|
8144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
8092
8145
|
import_outbound_react3.OutboundLink,
|
|
8093
8146
|
{
|
|
8094
8147
|
href: `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(text)}`,
|
|
8095
8148
|
className: LINK,
|
|
8096
8149
|
title: "Open in maps",
|
|
8097
8150
|
onClick: own2,
|
|
8098
|
-
children: /* @__PURE__ */ (0,
|
|
8151
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "truncate", children: text })
|
|
8099
8152
|
}
|
|
8100
8153
|
);
|
|
8101
8154
|
case "progress": {
|
|
@@ -8103,8 +8156,8 @@ function rich(id, text, raw, format) {
|
|
|
8103
8156
|
if (n === null) return void 0;
|
|
8104
8157
|
const pct = format.options?.percentScale === "fraction" ? n * 100 : n;
|
|
8105
8158
|
const clamped = Math.max(0, Math.min(100, pct));
|
|
8106
|
-
return /* @__PURE__ */ (0,
|
|
8107
|
-
/* @__PURE__ */ (0,
|
|
8159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "inline-flex w-full min-w-0 items-center gap-2", title: text, children: [
|
|
8160
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
8108
8161
|
"span",
|
|
8109
8162
|
{
|
|
8110
8163
|
role: "progressbar",
|
|
@@ -8112,24 +8165,24 @@ function rich(id, text, raw, format) {
|
|
|
8112
8165
|
"aria-valuemax": 100,
|
|
8113
8166
|
"aria-valuenow": Math.round(clamped),
|
|
8114
8167
|
className: "h-1.5 min-w-8 flex-1 overflow-hidden rounded-full bg-muted",
|
|
8115
|
-
children: /* @__PURE__ */ (0,
|
|
8168
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: (0, import_design_system22.cn)("block h-full rounded-full", pct >= 100 ? "bg-emerald-500" : "bg-primary"), style: { width: `${clamped}%` } })
|
|
8116
8169
|
}
|
|
8117
8170
|
),
|
|
8118
|
-
/* @__PURE__ */ (0,
|
|
8171
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: text })
|
|
8119
8172
|
] });
|
|
8120
8173
|
}
|
|
8121
8174
|
case "color":
|
|
8122
|
-
return /* @__PURE__ */ (0,
|
|
8123
|
-
/* @__PURE__ */ (0,
|
|
8124
|
-
/* @__PURE__ */ (0,
|
|
8175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
8176
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "h-4 w-4 shrink-0 rounded border border-border", style: { backgroundColor: text } }),
|
|
8177
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("code", { className: "font-mono text-xs", children: text })
|
|
8125
8178
|
] });
|
|
8126
8179
|
case "tags": {
|
|
8127
8180
|
const items = Array.isArray(raw) ? raw.map(String) : text.split(",").map((s) => s.trim()).filter(Boolean);
|
|
8128
8181
|
if (items.length === 0) return void 0;
|
|
8129
|
-
return /* @__PURE__ */ (0,
|
|
8182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "flex flex-wrap items-center gap-1", children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "inline-flex items-center rounded-md border border-border bg-muted px-1.5 py-0.5 text-xs", children: item }, `${item}-${i}`)) });
|
|
8130
8183
|
}
|
|
8131
8184
|
case "rating":
|
|
8132
|
-
return numberOf2(raw) === null ? void 0 : /* @__PURE__ */ (0,
|
|
8185
|
+
return numberOf2(raw) === null ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RatingStars, { value: raw, max: format.options?.ratingMax ?? 5 });
|
|
8133
8186
|
default:
|
|
8134
8187
|
return void 0;
|
|
8135
8188
|
}
|
|
@@ -8144,16 +8197,16 @@ function FormattedValue({
|
|
|
8144
8197
|
const score = numberOf2(value);
|
|
8145
8198
|
const max = format.options?.ratingMax ?? 5;
|
|
8146
8199
|
if (def?.id === "rating" && onRate && (value === null || value === void 0 || value === "" || score !== null && score >= 0 && score <= max)) {
|
|
8147
|
-
return /* @__PURE__ */ (0,
|
|
8200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, onRate, selectFirst });
|
|
8148
8201
|
}
|
|
8149
8202
|
const result = (0, import_field_formats5.formatFieldValue)(value, format);
|
|
8150
|
-
if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */ (0,
|
|
8203
|
+
if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_data_table2.FormattedCell, { result });
|
|
8151
8204
|
const look = fieldLookFor(def.id);
|
|
8152
8205
|
if (look) {
|
|
8153
8206
|
const View = look.View;
|
|
8154
|
-
return /* @__PURE__ */ (0,
|
|
8207
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(View, { value, format });
|
|
8155
8208
|
}
|
|
8156
|
-
return rich(def.id, result.text, value, format) ?? /* @__PURE__ */ (0,
|
|
8209
|
+
return rich(def.id, result.text, value, format) ?? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_data_table2.FormattedCell, { result });
|
|
8157
8210
|
}
|
|
8158
8211
|
function linkChipText(raw) {
|
|
8159
8212
|
try {
|
|
@@ -8169,55 +8222,6 @@ function linkChipText(raw) {
|
|
|
8169
8222
|
// src/values.tsx
|
|
8170
8223
|
init_host();
|
|
8171
8224
|
|
|
8172
|
-
// src/LinkPreviewCard.tsx
|
|
8173
|
-
var import_react34 = require("react");
|
|
8174
|
-
var import_design_system22 = require("@ai-matrx/design-system");
|
|
8175
|
-
init_host();
|
|
8176
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
8177
|
-
var answers = /* @__PURE__ */ new Map();
|
|
8178
|
-
function LinkPreviewCard({ url, children }) {
|
|
8179
|
-
const port = useRecordsUi().linkPreview;
|
|
8180
|
-
const [preview, setPreview] = (0, import_react34.useState)(void 0);
|
|
8181
|
-
const [open, setOpen] = (0, import_react34.useState)(false);
|
|
8182
|
-
const timer = (0, import_react34.useRef)(null);
|
|
8183
|
-
(0, import_react34.useEffect)(() => () => void (timer.current && clearTimeout(timer.current)), []);
|
|
8184
|
-
if (!port) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children });
|
|
8185
|
-
const ask = () => {
|
|
8186
|
-
if (preview !== void 0) return;
|
|
8187
|
-
let pending = answers.get(url);
|
|
8188
|
-
if (!pending) {
|
|
8189
|
-
pending = port.read(url).catch(() => null);
|
|
8190
|
-
answers.set(url, pending);
|
|
8191
|
-
}
|
|
8192
|
-
void pending.then((found) => setPreview(found));
|
|
8193
|
-
};
|
|
8194
|
-
const enter = () => {
|
|
8195
|
-
ask();
|
|
8196
|
-
if (timer.current) clearTimeout(timer.current);
|
|
8197
|
-
timer.current = setTimeout(() => setOpen(true), 350);
|
|
8198
|
-
};
|
|
8199
|
-
const leave = () => {
|
|
8200
|
-
if (timer.current) clearTimeout(timer.current);
|
|
8201
|
-
setOpen(false);
|
|
8202
|
-
};
|
|
8203
|
-
const shown2 = preview && (preview.title || preview.description || preview.imageUrl) ? preview : null;
|
|
8204
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_design_system22.HoverCard, { open: open && shown2 !== null, onOpenChange: (next) => next ? void 0 : setOpen(false), children: [
|
|
8205
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_design_system22.HoverCardTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "inline-flex min-w-0 max-w-full", onMouseEnter: enter, onMouseLeave: leave, onFocus: enter, onBlur: leave, children }) }),
|
|
8206
|
-
shown2 ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_design_system22.HoverCardContent, { align: "start", className: "w-72 space-y-1.5 p-2 text-xs", "data-records-link-preview": "", children: [
|
|
8207
|
-
shown2.imageUrl ? (
|
|
8208
|
-
// eslint-disable-next-line @next/next/no-img-element
|
|
8209
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("img", { src: shown2.imageUrl, alt: "", className: "h-28 w-full rounded object-cover", referrerPolicy: "no-referrer" })
|
|
8210
|
-
) : null,
|
|
8211
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
8212
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_design_system22.SiteIcon, { site: url, iconUrl: shown2.faviconUrl, className: "h-3.5 w-3.5" }),
|
|
8213
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "truncate text-muted-foreground", children: shown2.siteName ?? "" })
|
|
8214
|
-
] }),
|
|
8215
|
-
shown2.title ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "line-clamp-2 font-medium", children: shown2.title }) : null,
|
|
8216
|
-
shown2.description ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "line-clamp-3 text-muted-foreground", children: shown2.description }) : null
|
|
8217
|
-
] }) : null
|
|
8218
|
-
] });
|
|
8219
|
-
}
|
|
8220
|
-
|
|
8221
8225
|
// src/gridAttachments.tsx
|
|
8222
8226
|
var import_react36 = require("react");
|
|
8223
8227
|
var import_react37 = require("@ai-matrx/records/react");
|