@ai-matrx/design-system 0.86.357 → 0.86.359

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.
Files changed (91) hide show
  1. package/CHANGELOG.md +30 -2
  2. package/dist/carousel.js +6 -6
  3. package/dist/{chunk-T4D7WAV7.js → chunk-42GFQMLA.js} +2 -2
  4. package/dist/{chunk-POJ3RR3K.js → chunk-B5D3VIMC.js} +1 -1
  5. package/dist/{chunk-POJ3RR3K.js.map → chunk-B5D3VIMC.js.map} +1 -1
  6. package/dist/{chunk-FRJ4PPA2.js → chunk-CZGZV35G.js} +2 -2
  7. package/dist/{chunk-ACZALXD6.js → chunk-K3XWUACX.js} +3 -3
  8. package/dist/{chunk-TV2IDHPZ.js → chunk-K5ZQROWN.js} +4 -4
  9. package/dist/{chunk-U46XUQI7.js → chunk-KSCSH7AO.js} +16 -14
  10. package/dist/chunk-KSCSH7AO.js.map +1 -0
  11. package/dist/{chunk-MTE6N7XU.js → chunk-NFJ63LIH.js} +2 -2
  12. package/dist/{chunk-XZGYKKCE.js → chunk-OUQT72UL.js} +3 -3
  13. package/dist/{chunk-WUD23YTG.js → chunk-P56Y43RL.js} +6 -6
  14. package/dist/{chunk-GMNROZQJ.js → chunk-QTPW44IJ.js} +2 -2
  15. package/dist/{chunk-QA7EHFRX.js → chunk-T3FKFPCW.js} +5 -5
  16. package/dist/{chunk-X6ZRHJQP.js → chunk-T57DLONB.js} +20 -11
  17. package/dist/chunk-T57DLONB.js.map +1 -0
  18. package/dist/{chunk-SOCNWQMX.js → chunk-TEMAM5ET.js} +3 -3
  19. package/dist/{chunk-CH2NWSES.js → chunk-TIV6M7Q7.js} +3 -3
  20. package/dist/{chunk-6XNYYROM.js → chunk-WVEDW5VO.js} +2 -2
  21. package/dist/clipboard-fallback-dialog.js +2 -2
  22. package/dist/controls.cjs +19 -10
  23. package/dist/controls.cjs.map +1 -1
  24. package/dist/controls.js +6 -6
  25. package/dist/data-table/data-row-inspector.cjs +99 -11
  26. package/dist/data-table/data-row-inspector.cjs.map +1 -1
  27. package/dist/data-table/data-row-inspector.js +8 -7
  28. package/dist/data-table/data-row-window.cjs +99 -11
  29. package/dist/data-table/data-row-window.cjs.map +1 -1
  30. package/dist/data-table/data-row-window.js +9 -8
  31. package/dist/data-table/drill-chart.js +1 -1
  32. package/dist/data-table/host.cjs.map +1 -1
  33. package/dist/data-table/host.d.cts +6 -2
  34. package/dist/data-table/host.d.ts +6 -2
  35. package/dist/data-table/host.js +1 -1
  36. package/dist/data-table/index.cjs +39 -37
  37. package/dist/data-table/index.cjs.map +1 -1
  38. package/dist/data-table/index.d.cts +6 -2
  39. package/dist/data-table/index.d.ts +6 -2
  40. package/dist/data-table/index.js +19 -23
  41. package/dist/data-table/index.js.map +1 -1
  42. package/dist/data-table/pagination.cjs +19 -10
  43. package/dist/data-table/pagination.cjs.map +1 -1
  44. package/dist/data-table/pagination.js +4 -4
  45. package/dist/data-table/uuid-cell.cjs +99 -11
  46. package/dist/data-table/uuid-cell.cjs.map +1 -1
  47. package/dist/data-table/uuid-cell.js +5 -4
  48. package/dist/desktop.cjs +20 -11
  49. package/dist/desktop.cjs.map +1 -1
  50. package/dist/desktop.d.cts +1 -1
  51. package/dist/desktop.d.ts +1 -1
  52. package/dist/desktop.js +13 -13
  53. package/dist/desktop.js.map +1 -1
  54. package/dist/email-input-dialog.js +1 -1
  55. package/dist/index.cjs +31 -22
  56. package/dist/index.cjs.map +1 -1
  57. package/dist/index.d.cts +9 -9
  58. package/dist/index.d.ts +9 -9
  59. package/dist/index.js +20 -20
  60. package/dist/item.cjs +19 -10
  61. package/dist/item.cjs.map +1 -1
  62. package/dist/item.js +5 -5
  63. package/dist/lite-table.js +3 -3
  64. package/dist/menu-look.cjs +19 -10
  65. package/dist/menu-look.cjs.map +1 -1
  66. package/dist/menu-look.js +2 -2
  67. package/dist/record-list.cjs +19 -10
  68. package/dist/record-list.cjs.map +1 -1
  69. package/dist/record-list.js +6 -6
  70. package/dist/settings.js +3 -3
  71. package/dist/swipe-deck.cjs +11 -2
  72. package/dist/swipe-deck.cjs.map +1 -1
  73. package/dist/swipe-deck.js +12 -3
  74. package/dist/swipe-deck.js.map +1 -1
  75. package/dist/text-input-dialog.js +1 -1
  76. package/dist/writing-field.js +3 -3
  77. package/package.json +2 -2
  78. package/dist/chunk-U46XUQI7.js.map +0 -1
  79. package/dist/chunk-X6ZRHJQP.js.map +0 -1
  80. /package/dist/{chunk-T4D7WAV7.js.map → chunk-42GFQMLA.js.map} +0 -0
  81. /package/dist/{chunk-FRJ4PPA2.js.map → chunk-CZGZV35G.js.map} +0 -0
  82. /package/dist/{chunk-ACZALXD6.js.map → chunk-K3XWUACX.js.map} +0 -0
  83. /package/dist/{chunk-TV2IDHPZ.js.map → chunk-K5ZQROWN.js.map} +0 -0
  84. /package/dist/{chunk-MTE6N7XU.js.map → chunk-NFJ63LIH.js.map} +0 -0
  85. /package/dist/{chunk-XZGYKKCE.js.map → chunk-OUQT72UL.js.map} +0 -0
  86. /package/dist/{chunk-WUD23YTG.js.map → chunk-P56Y43RL.js.map} +0 -0
  87. /package/dist/{chunk-GMNROZQJ.js.map → chunk-QTPW44IJ.js.map} +0 -0
  88. /package/dist/{chunk-QA7EHFRX.js.map → chunk-T3FKFPCW.js.map} +0 -0
  89. /package/dist/{chunk-SOCNWQMX.js.map → chunk-TEMAM5ET.js.map} +0 -0
  90. /package/dist/{chunk-CH2NWSES.js.map → chunk-TIV6M7Q7.js.map} +0 -0
  91. /package/dist/{chunk-6XNYYROM.js.map → chunk-WVEDW5VO.js.map} +0 -0
@@ -1,30 +1,31 @@
1
1
  "use client";
2
2
  import {
3
3
  DataRowInspector
4
- } from "../chunk-WUD23YTG.js";
4
+ } from "../chunk-P56Y43RL.js";
5
5
  import "../chunk-UEQK6PFD.js";
6
6
  import "../chunk-PTYKILZE.js";
7
- import "../chunk-FRJ4PPA2.js";
7
+ import "../chunk-CZGZV35G.js";
8
8
  import "../chunk-KPZX2M2C.js";
9
9
  import "../chunk-GLZJ7WZK.js";
10
10
  import "../chunk-B3LDW3IQ.js";
11
11
  import "../chunk-FXT7PZAF.js";
12
- import "../chunk-MTE6N7XU.js";
12
+ import "../chunk-NFJ63LIH.js";
13
13
  import "../chunk-WFBPCMPF.js";
14
14
  import "../chunk-KGW373MK.js";
15
15
  import "../chunk-7ZCD4AZS.js";
16
16
  import "../chunk-OPF265PU.js";
17
17
  import "../chunk-QFP4BUKZ.js";
18
- import "../chunk-U46XUQI7.js";
19
- import "../chunk-6XNYYROM.js";
18
+ import "../chunk-KSCSH7AO.js";
19
+ import "../chunk-WVEDW5VO.js";
20
20
  import "../chunk-BD77DHUO.js";
21
21
  import "../chunk-BKCJUFD3.js";
22
22
  import "../chunk-PIQJULQB.js";
23
23
  import "../chunk-MOZRIHJF.js";
24
- import "../chunk-X6ZRHJQP.js";
24
+ import "../chunk-T57DLONB.js";
25
25
  import "../chunk-BNXNIN2S.js";
26
+ import "../chunk-HS6GMHKZ.js";
26
27
  import "../chunk-ORXB4A5E.js";
27
- import "../chunk-POJ3RR3K.js";
28
+ import "../chunk-B5D3VIMC.js";
28
29
  import "../chunk-4JAYMFQO.js";
29
30
  import "../chunk-WFITMVDB.js";
30
31
  import "../chunk-WAT2XW7L.js";
@@ -2346,13 +2346,14 @@ function useTableNotice() {
2346
2346
  const [message, setMessage] = (0, import_react5.useState)(null);
2347
2347
  const notify = (0, import_react5.useMemo)(
2348
2348
  () => ({
2349
- success(text) {
2350
- if (host.notify) host.notify.success(text);
2351
- else setMessage({ text, error: false });
2349
+ // A card is a short title and an optional line (NOTICE_TEXT_BUDGET); the inline fallback joins them.
2350
+ success(text, options) {
2351
+ if (host.notify) host.notify.success(text, options);
2352
+ else setMessage({ text: options?.description ? `${text}. ${options.description}` : text, error: false });
2352
2353
  },
2353
- error(text) {
2354
- if (host.notify) host.notify.error(text);
2355
- else setMessage({ text, error: true });
2354
+ error(text, options) {
2355
+ if (host.notify) host.notify.error(text, options);
2356
+ else setMessage({ text: options?.description ? `${text}. ${options.description}` : text, error: true });
2356
2357
  }
2357
2358
  }),
2358
2359
  [host]
@@ -2381,6 +2382,95 @@ function displayId(id, show = "auto") {
2381
2382
  return id;
2382
2383
  }
2383
2384
 
2385
+ // src/desktop/errors.ts
2386
+ var RULES = [
2387
+ { code: "ENOENT", test: /\b(spawn\s+\S+\s+)?ENOENT\b|command not found|no such file or directory/i, cause: "A program or file it needs isn't on this computer. Install it or update Matrx, then try again." },
2388
+ { code: "EACCES", test: /\bEACCES\b|\bEPERM\b|permission denied|operation not permitted|not authori[sz]ed by the user/i, cause: "Matrx isn't allowed to do that. Grant access in System Settings \u203A Privacy & Security, then try again." },
2389
+ { code: "EADDRINUSE", test: /\bEADDRINUSE\b|address already in use|port .* (is )?(already )?in use/i, cause: "Another program is already using that port. Stop it, or choose another port." },
2390
+ { code: "ECONNREFUSED", test: /\bECONNREFUSED\b|connection refused/i, cause: "The service isn't answering. It may have stopped; start it again." },
2391
+ { code: "OFFLINE", test: /\bENOTFOUND\b|\bEAI_AGAIN\b|\bENETUNREACH\b|getaddrinfo|network (is )?unreachable|failed to fetch|offline/i, cause: "Can't reach the internet. Check the connection and try again." },
2392
+ { code: "TIMEOUT", test: /\bETIMEDOUT\b|timed? ?out|\bTIMEOUT\b|deadline exceeded/i, cause: "It took too long to answer. Try again in a moment." },
2393
+ { code: "ENOSPC", test: /\bENOSPC\b|no space left/i, cause: "The disk is full. Free some space, then try again." },
2394
+ { code: "ENOMEM", test: /\bENOMEM\b|out of memory|cannot allocate memory/i, cause: "The computer ran out of memory. Close something and try again." },
2395
+ { code: "UNAUTHORIZED", test: /\b401\b|unauthori[sz]ed|invalid (api )?key|not signed in|jwt expired|session expired/i, cause: "You're signed out, or the key was refused. Sign in again." },
2396
+ { code: "FORBIDDEN", test: /\b403\b|forbidden/i, cause: "This account isn't allowed to do that." },
2397
+ { code: "NOT_FOUND", test: /\b404\b|not found/i, cause: "It isn't there any more. Refresh and try again." },
2398
+ { code: "RATE_LIMIT", test: /\b429\b|rate.?limit|too many requests/i, cause: "Too many requests just now. Wait a moment and try again." },
2399
+ { code: "SERVER", test: /\b5\d\d\b|internal server error|bad gateway|service unavailable/i, cause: "The server had a problem. Try again in a moment." },
2400
+ { code: "EXITED", test: /exited with code|process exited|crashed|SIGKILL|SIGSEGV|SIGTERM/i, cause: "The service stopped unexpectedly. Start it again; Copy details if it keeps happening." }
2401
+ ];
2402
+ var RAW = /\b[A-Z]{2,}[A-Z_]*\b|[\\/][\w.-]+[\\/]|\bat \S+ \(|\{|\}|errno|stack|undefined|null|\bspawn\b/;
2403
+ function rawText(error) {
2404
+ if (error instanceof Error) return error.message || error.name;
2405
+ if (typeof error === "string") return error;
2406
+ if (error && typeof error === "object" && "message" in error && typeof error.message === "string") {
2407
+ return error.message;
2408
+ }
2409
+ return "";
2410
+ }
2411
+ function describeError(error, fallback = "Something went wrong. Try again.") {
2412
+ const detail = rawText(error).trim();
2413
+ if (!detail) return { cause: fallback, detail: "" };
2414
+ for (const rule of RULES) {
2415
+ if (rule.test.test(detail)) return { cause: rule.cause, detail, code: rule.code };
2416
+ }
2417
+ if (!RAW.test(detail) && detail.length <= 160) return { cause: detail, detail: "" };
2418
+ return { cause: fallback, detail };
2419
+ }
2420
+
2421
+ // src/error-sentence.ts
2422
+ function errorSentenceOf(error) {
2423
+ if (error == null || error === true || error === false) return "";
2424
+ if (typeof error === "string") return error;
2425
+ if (typeof error !== "object") return String(error);
2426
+ const message = error.message;
2427
+ return typeof message === "string" ? message : "";
2428
+ }
2429
+ var TIMED_OUT_SENTENCE = "That took too long. Nothing was lost; try again.";
2430
+ var FALLBACK_ERROR_SENTENCE = "Something went wrong. Try again.";
2431
+ var CARD_ERROR_LINE = {
2432
+ OFFLINE: "No connection",
2433
+ TIMEOUT: "Took too long. Nothing was lost.",
2434
+ UNAUTHORIZED: "Signed out. Sign in again.",
2435
+ FORBIDDEN: "Not allowed for this account",
2436
+ NOT_FOUND: "Not found. Refresh and retry.",
2437
+ RATE_LIMIT: "Too many requests. Wait a moment.",
2438
+ SERVER: "Server problem. Try again soon.",
2439
+ FALLBACK: "Something went wrong"
2440
+ };
2441
+ function isTimedOutError(error, message, code) {
2442
+ if (code === "57014" || code === "timed_out") return true;
2443
+ if (error && typeof error === "object") {
2444
+ const o = error;
2445
+ if (o.code === "57014" || o.code === "timed_out" || o.sqlstate === "57014") return true;
2446
+ }
2447
+ const text = `${message ?? ""} ${errorSentenceOf(error)}`;
2448
+ return /canceling statement due to statement timeout/i.test(text);
2449
+ }
2450
+ function offlineText(text) {
2451
+ const t = text.trim();
2452
+ return t !== "" && (describeError(t).code === "OFFLINE" || /networkerror|network request failed|load failed/i.test(t));
2453
+ }
2454
+ var ANY_HOST_CODES = /* @__PURE__ */ new Set(["OFFLINE", "TIMEOUT", "UNAUTHORIZED", "FORBIDDEN", "NOT_FOUND", "RATE_LIMIT", "SERVER"]);
2455
+ var MACHINE_PREFIX = /^\s*(?:\[[\w./-]+\]\s*|[a-z][\w]*(?:[._][\w]+)+:\s+)/;
2456
+ var RAW_TEXT = /\b(?:Type|Reference|Syntax|Range|Internal|Eval|URI)Error\b|\bat\s+[\w$.<>]+\s*\(|\.(?:[cm]?[jt]sx?|py):\d+|(?:^|[\s(])(?:\/[\w.@-]+){2,}|\bundefined is not\b|\bcannot read propert(?:y|ies)\b|\bis not a function\b|\bunexpected token\b/i;
2457
+ function peopleErrorSentence(error, message, options = {}) {
2458
+ const card = options.card === true;
2459
+ if (isTimedOutError(error, message, options.code)) return card ? CARD_ERROR_LINE.TIMEOUT : TIMED_OUT_SENTENCE;
2460
+ const fallback = options.fallback ?? (card ? CARD_ERROR_LINE.FALLBACK : FALLBACK_ERROR_SENTENCE);
2461
+ const raw = message?.trim() || errorSentenceOf(error).trim();
2462
+ if (!raw) return fallback;
2463
+ let text = raw;
2464
+ for (let i = 0; i < 3 && MACHINE_PREFIX.test(text); i++) text = text.replace(MACHINE_PREFIX, "").trim();
2465
+ if (!text) return fallback;
2466
+ if (offlineText(text) || RAW_TEXT.test(text) || text !== raw) {
2467
+ const said = describeError(text, fallback);
2468
+ if (!said.code || !ANY_HOST_CODES.has(said.code)) return fallback;
2469
+ return card ? CARD_ERROR_LINE[said.code] : said.cause;
2470
+ }
2471
+ return text;
2472
+ }
2473
+
2384
2474
  // src/record-id.tsx
2385
2475
  var import_jsx_runtime20 = require("react/jsx-runtime");
2386
2476
  function RecordId({
@@ -2442,7 +2532,7 @@ function RecordId({
2442
2532
  e.preventDefault();
2443
2533
  void (0, import_clipboard.copyText)(value).then((ok) => {
2444
2534
  if (!ok) {
2445
- notify?.error(`Couldn't copy ${copyLabel}`);
2535
+ notify?.error("Not copied", { description: copyLabel });
2446
2536
  return;
2447
2537
  }
2448
2538
  setCopied(true);
@@ -2458,12 +2548,10 @@ function RecordId({
2458
2548
  try {
2459
2549
  const result = await onOpen(value);
2460
2550
  if (result === "forbidden") {
2461
- notify?.error("You don't have access to open this record");
2551
+ notify?.error("No access", { description: "This account can't open this record" });
2462
2552
  }
2463
2553
  } catch (err) {
2464
- notify?.error(
2465
- `Couldn't open: ${err instanceof Error ? err.message : String(err)}`
2466
- );
2554
+ notify?.error("Not opened", { description: peopleErrorSentence(err, null, { card: true }) });
2467
2555
  } finally {
2468
2556
  setOpening(false);
2469
2557
  }