@ai-matrx/design-system 0.86.356 → 0.86.358

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 (131) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/auth-gate-dialog.js +2 -2
  3. package/dist/carousel.js +11 -10
  4. package/dist/carousel.js.map +1 -1
  5. package/dist/{chunk-UWTODOMD.js → chunk-2BQAHLU3.js} +4 -4
  6. package/dist/{chunk-T4D7WAV7.js → chunk-42GFQMLA.js} +2 -2
  7. package/dist/chunk-5Z5GTXKL.js +79 -0
  8. package/dist/chunk-5Z5GTXKL.js.map +1 -0
  9. package/dist/{chunk-POJ3RR3K.js → chunk-B5D3VIMC.js} +1 -1
  10. package/dist/{chunk-POJ3RR3K.js.map → chunk-B5D3VIMC.js.map} +1 -1
  11. package/dist/{chunk-4WSXAP24.js → chunk-BB5LA7FQ.js} +3 -1
  12. package/dist/chunk-BB5LA7FQ.js.map +1 -0
  13. package/dist/{chunk-FRJ4PPA2.js → chunk-CZGZV35G.js} +2 -2
  14. package/dist/{chunk-RLM4RSED.js → chunk-GUGBVQ4T.js} +6 -4
  15. package/dist/{chunk-RLM4RSED.js.map → chunk-GUGBVQ4T.js.map} +1 -1
  16. package/dist/{chunk-LJKF267O.js → chunk-HS6GMHKZ.js} +18 -76
  17. package/dist/chunk-HS6GMHKZ.js.map +1 -0
  18. package/dist/{chunk-2PO3N42Q.js → chunk-K3XWUACX.js} +5 -5
  19. package/dist/{chunk-ZMUPFGQO.js → chunk-K5ZQROWN.js} +5 -5
  20. package/dist/{chunk-U46XUQI7.js → chunk-KSCSH7AO.js} +16 -14
  21. package/dist/chunk-KSCSH7AO.js.map +1 -0
  22. package/dist/{chunk-MTE6N7XU.js → chunk-NFJ63LIH.js} +2 -2
  23. package/dist/{chunk-CFUXEGW2.js → chunk-OUQT72UL.js} +4 -4
  24. package/dist/{chunk-WUD23YTG.js → chunk-P56Y43RL.js} +6 -6
  25. package/dist/{chunk-GMNROZQJ.js → chunk-QTPW44IJ.js} +2 -2
  26. package/dist/{chunk-QA7EHFRX.js → chunk-T3FKFPCW.js} +5 -5
  27. package/dist/{chunk-X6ZRHJQP.js → chunk-T57DLONB.js} +20 -11
  28. package/dist/chunk-T57DLONB.js.map +1 -0
  29. package/dist/{chunk-SOCNWQMX.js → chunk-TEMAM5ET.js} +3 -3
  30. package/dist/{chunk-CH2NWSES.js → chunk-TIV6M7Q7.js} +3 -3
  31. package/dist/{chunk-6XNYYROM.js → chunk-WVEDW5VO.js} +2 -2
  32. package/dist/clipboard-fallback-dialog.js +4 -4
  33. package/dist/controls.cjs +34 -13
  34. package/dist/controls.cjs.map +1 -1
  35. package/dist/controls.js +9 -8
  36. package/dist/data-table/data-row-inspector.cjs +99 -11
  37. package/dist/data-table/data-row-inspector.cjs.map +1 -1
  38. package/dist/data-table/data-row-inspector.js +8 -7
  39. package/dist/data-table/data-row-window.cjs +99 -11
  40. package/dist/data-table/data-row-window.cjs.map +1 -1
  41. package/dist/data-table/data-row-window.js +11 -10
  42. package/dist/data-table/drill-chart.cjs +15 -3
  43. package/dist/data-table/drill-chart.cjs.map +1 -1
  44. package/dist/data-table/drill-chart.js +2 -1
  45. package/dist/data-table/drill-chart.js.map +1 -1
  46. package/dist/data-table/host.cjs.map +1 -1
  47. package/dist/data-table/host.d.cts +6 -2
  48. package/dist/data-table/host.d.ts +6 -2
  49. package/dist/data-table/host.js +1 -1
  50. package/dist/data-table/index.cjs +54 -40
  51. package/dist/data-table/index.cjs.map +1 -1
  52. package/dist/data-table/index.d.cts +6 -2
  53. package/dist/data-table/index.d.ts +6 -2
  54. package/dist/data-table/index.js +25 -28
  55. package/dist/data-table/index.js.map +1 -1
  56. package/dist/data-table/pagination.cjs +19 -10
  57. package/dist/data-table/pagination.cjs.map +1 -1
  58. package/dist/data-table/pagination.js +4 -4
  59. package/dist/data-table/uuid-cell.cjs +99 -11
  60. package/dist/data-table/uuid-cell.cjs.map +1 -1
  61. package/dist/data-table/uuid-cell.js +5 -4
  62. package/dist/desktop.cjs +45 -15
  63. package/dist/desktop.cjs.map +1 -1
  64. package/dist/desktop.js +23 -15
  65. package/dist/desktop.js.map +1 -1
  66. package/dist/email-input-dialog.cjs +15 -3
  67. package/dist/email-input-dialog.cjs.map +1 -1
  68. package/dist/email-input-dialog.js +4 -3
  69. package/dist/email-input-dialog.js.map +1 -1
  70. package/dist/error-sentence.cjs +130 -0
  71. package/dist/error-sentence.cjs.map +1 -0
  72. package/dist/error-sentence.d.cts +49 -0
  73. package/dist/error-sentence.d.ts +49 -0
  74. package/dist/error-sentence.js +22 -0
  75. package/dist/error-sentence.js.map +1 -0
  76. package/dist/index.cjs +47 -26
  77. package/dist/index.cjs.map +1 -1
  78. package/dist/index.d.cts +12 -10
  79. package/dist/index.d.ts +12 -10
  80. package/dist/index.js +30 -28
  81. package/dist/index.js.map +1 -1
  82. package/dist/item.cjs +19 -10
  83. package/dist/item.cjs.map +1 -1
  84. package/dist/item.js +7 -7
  85. package/dist/lite-table.cjs +15 -3
  86. package/dist/lite-table.cjs.map +1 -1
  87. package/dist/lite-table.js +5 -4
  88. package/dist/lite-table.js.map +1 -1
  89. package/dist/menu-look.cjs +19 -10
  90. package/dist/menu-look.cjs.map +1 -1
  91. package/dist/menu-look.js +2 -2
  92. package/dist/notice-stack.cjs +2 -0
  93. package/dist/notice-stack.cjs.map +1 -1
  94. package/dist/notice-stack.d.cts +11 -1
  95. package/dist/notice-stack.d.ts +11 -1
  96. package/dist/notice-stack.js +3 -1
  97. package/dist/record-list.cjs +34 -13
  98. package/dist/record-list.cjs.map +1 -1
  99. package/dist/record-list.js +8 -7
  100. package/dist/record-list.js.map +1 -1
  101. package/dist/sandbox-gate-dialog.js +2 -2
  102. package/dist/scope-mismatch-dialog.js +2 -2
  103. package/dist/settings.js +3 -3
  104. package/dist/swipe-deck.cjs +15 -3
  105. package/dist/swipe-deck.cjs.map +1 -1
  106. package/dist/swipe-deck.js +2 -1
  107. package/dist/swipe-deck.js.map +1 -1
  108. package/dist/text-input-dialog.cjs +15 -3
  109. package/dist/text-input-dialog.cjs.map +1 -1
  110. package/dist/text-input-dialog.js +4 -3
  111. package/dist/text-input-dialog.js.map +1 -1
  112. package/dist/value-prompts-dialog.js +2 -2
  113. package/dist/writing-field.js +5 -5
  114. package/package.json +12 -2
  115. package/dist/chunk-4WSXAP24.js.map +0 -1
  116. package/dist/chunk-LJKF267O.js.map +0 -1
  117. package/dist/chunk-U46XUQI7.js.map +0 -1
  118. package/dist/chunk-X6ZRHJQP.js.map +0 -1
  119. /package/dist/{chunk-UWTODOMD.js.map → chunk-2BQAHLU3.js.map} +0 -0
  120. /package/dist/{chunk-T4D7WAV7.js.map → chunk-42GFQMLA.js.map} +0 -0
  121. /package/dist/{chunk-FRJ4PPA2.js.map → chunk-CZGZV35G.js.map} +0 -0
  122. /package/dist/{chunk-2PO3N42Q.js.map → chunk-K3XWUACX.js.map} +0 -0
  123. /package/dist/{chunk-ZMUPFGQO.js.map → chunk-K5ZQROWN.js.map} +0 -0
  124. /package/dist/{chunk-MTE6N7XU.js.map → chunk-NFJ63LIH.js.map} +0 -0
  125. /package/dist/{chunk-CFUXEGW2.js.map → chunk-OUQT72UL.js.map} +0 -0
  126. /package/dist/{chunk-WUD23YTG.js.map → chunk-P56Y43RL.js.map} +0 -0
  127. /package/dist/{chunk-GMNROZQJ.js.map → chunk-QTPW44IJ.js.map} +0 -0
  128. /package/dist/{chunk-QA7EHFRX.js.map → chunk-T3FKFPCW.js.map} +0 -0
  129. /package/dist/{chunk-SOCNWQMX.js.map → chunk-TEMAM5ET.js.map} +0 -0
  130. /package/dist/{chunk-CH2NWSES.js.map → chunk-TIV6M7Q7.js.map} +0 -0
  131. /package/dist/{chunk-6XNYYROM.js.map → chunk-WVEDW5VO.js.map} +0 -0
@@ -2,16 +2,16 @@
2
2
  import {
3
3
  DEFAULT_TABLE_PAGE_SIZES,
4
4
  GenericTablePagination
5
- } from "../chunk-SOCNWQMX.js";
6
- import "../chunk-6XNYYROM.js";
5
+ } from "../chunk-TEMAM5ET.js";
6
+ import "../chunk-WVEDW5VO.js";
7
7
  import "../chunk-BD77DHUO.js";
8
8
  import "../chunk-BKCJUFD3.js";
9
9
  import "../chunk-PIQJULQB.js";
10
10
  import "../chunk-MOZRIHJF.js";
11
- import "../chunk-X6ZRHJQP.js";
11
+ import "../chunk-T57DLONB.js";
12
12
  import "../chunk-BNXNIN2S.js";
13
13
  import "../chunk-ORXB4A5E.js";
14
- import "../chunk-POJ3RR3K.js";
14
+ import "../chunk-B5D3VIMC.js";
15
15
  import "../chunk-4JAYMFQO.js";
16
16
  import "../chunk-WFITMVDB.js";
17
17
  import "../chunk-WAT2XW7L.js";
@@ -151,13 +151,14 @@ function useTableNotice() {
151
151
  const [message, setMessage] = (0, import_react2.useState)(null);
152
152
  const notify = (0, import_react2.useMemo)(
153
153
  () => ({
154
- success(text) {
155
- if (host.notify) host.notify.success(text);
156
- else setMessage({ text, error: false });
154
+ // A card is a short title and an optional line (NOTICE_TEXT_BUDGET); the inline fallback joins them.
155
+ success(text, options) {
156
+ if (host.notify) host.notify.success(text, options);
157
+ else setMessage({ text: options?.description ? `${text}. ${options.description}` : text, error: false });
157
158
  },
158
- error(text) {
159
- if (host.notify) host.notify.error(text);
160
- else setMessage({ text, error: true });
159
+ error(text, options) {
160
+ if (host.notify) host.notify.error(text, options);
161
+ else setMessage({ text: options?.description ? `${text}. ${options.description}` : text, error: true });
161
162
  }
162
163
  }),
163
164
  [host]
@@ -1124,6 +1125,95 @@ function displayId(id, show = "auto") {
1124
1125
  return id;
1125
1126
  }
1126
1127
 
1128
+ // src/desktop/errors.ts
1129
+ var RULES = [
1130
+ { 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." },
1131
+ { 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." },
1132
+ { 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." },
1133
+ { code: "ECONNREFUSED", test: /\bECONNREFUSED\b|connection refused/i, cause: "The service isn't answering. It may have stopped; start it again." },
1134
+ { 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." },
1135
+ { code: "TIMEOUT", test: /\bETIMEDOUT\b|timed? ?out|\bTIMEOUT\b|deadline exceeded/i, cause: "It took too long to answer. Try again in a moment." },
1136
+ { code: "ENOSPC", test: /\bENOSPC\b|no space left/i, cause: "The disk is full. Free some space, then try again." },
1137
+ { code: "ENOMEM", test: /\bENOMEM\b|out of memory|cannot allocate memory/i, cause: "The computer ran out of memory. Close something and try again." },
1138
+ { 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." },
1139
+ { code: "FORBIDDEN", test: /\b403\b|forbidden/i, cause: "This account isn't allowed to do that." },
1140
+ { code: "NOT_FOUND", test: /\b404\b|not found/i, cause: "It isn't there any more. Refresh and try again." },
1141
+ { code: "RATE_LIMIT", test: /\b429\b|rate.?limit|too many requests/i, cause: "Too many requests just now. Wait a moment and try again." },
1142
+ { 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." },
1143
+ { 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." }
1144
+ ];
1145
+ var RAW = /\b[A-Z]{2,}[A-Z_]*\b|[\\/][\w.-]+[\\/]|\bat \S+ \(|\{|\}|errno|stack|undefined|null|\bspawn\b/;
1146
+ function rawText(error) {
1147
+ if (error instanceof Error) return error.message || error.name;
1148
+ if (typeof error === "string") return error;
1149
+ if (error && typeof error === "object" && "message" in error && typeof error.message === "string") {
1150
+ return error.message;
1151
+ }
1152
+ return "";
1153
+ }
1154
+ function describeError(error, fallback = "Something went wrong. Try again.") {
1155
+ const detail = rawText(error).trim();
1156
+ if (!detail) return { cause: fallback, detail: "" };
1157
+ for (const rule of RULES) {
1158
+ if (rule.test.test(detail)) return { cause: rule.cause, detail, code: rule.code };
1159
+ }
1160
+ if (!RAW.test(detail) && detail.length <= 160) return { cause: detail, detail: "" };
1161
+ return { cause: fallback, detail };
1162
+ }
1163
+
1164
+ // src/error-sentence.ts
1165
+ function errorSentenceOf(error) {
1166
+ if (error == null || error === true || error === false) return "";
1167
+ if (typeof error === "string") return error;
1168
+ if (typeof error !== "object") return String(error);
1169
+ const message = error.message;
1170
+ return typeof message === "string" ? message : "";
1171
+ }
1172
+ var TIMED_OUT_SENTENCE = "That took too long. Nothing was lost; try again.";
1173
+ var FALLBACK_ERROR_SENTENCE = "Something went wrong. Try again.";
1174
+ var CARD_ERROR_LINE = {
1175
+ OFFLINE: "No connection",
1176
+ TIMEOUT: "Took too long. Nothing was lost.",
1177
+ UNAUTHORIZED: "Signed out. Sign in again.",
1178
+ FORBIDDEN: "Not allowed for this account",
1179
+ NOT_FOUND: "Not found. Refresh and retry.",
1180
+ RATE_LIMIT: "Too many requests. Wait a moment.",
1181
+ SERVER: "Server problem. Try again soon.",
1182
+ FALLBACK: "Something went wrong"
1183
+ };
1184
+ function isTimedOutError(error, message, code) {
1185
+ if (code === "57014" || code === "timed_out") return true;
1186
+ if (error && typeof error === "object") {
1187
+ const o = error;
1188
+ if (o.code === "57014" || o.code === "timed_out" || o.sqlstate === "57014") return true;
1189
+ }
1190
+ const text = `${message ?? ""} ${errorSentenceOf(error)}`;
1191
+ return /canceling statement due to statement timeout/i.test(text);
1192
+ }
1193
+ function offlineText(text) {
1194
+ const t = text.trim();
1195
+ return t !== "" && (describeError(t).code === "OFFLINE" || /networkerror|network request failed|load failed/i.test(t));
1196
+ }
1197
+ var ANY_HOST_CODES = /* @__PURE__ */ new Set(["OFFLINE", "TIMEOUT", "UNAUTHORIZED", "FORBIDDEN", "NOT_FOUND", "RATE_LIMIT", "SERVER"]);
1198
+ var MACHINE_PREFIX = /^\s*(?:\[[\w./-]+\]\s*|[a-z][\w]*(?:[._][\w]+)+:\s+)/;
1199
+ 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;
1200
+ function peopleErrorSentence(error, message, options = {}) {
1201
+ const card = options.card === true;
1202
+ if (isTimedOutError(error, message, options.code)) return card ? CARD_ERROR_LINE.TIMEOUT : TIMED_OUT_SENTENCE;
1203
+ const fallback = options.fallback ?? (card ? CARD_ERROR_LINE.FALLBACK : FALLBACK_ERROR_SENTENCE);
1204
+ const raw = message?.trim() || errorSentenceOf(error).trim();
1205
+ if (!raw) return fallback;
1206
+ let text = raw;
1207
+ for (let i = 0; i < 3 && MACHINE_PREFIX.test(text); i++) text = text.replace(MACHINE_PREFIX, "").trim();
1208
+ if (!text) return fallback;
1209
+ if (offlineText(text) || RAW_TEXT.test(text) || text !== raw) {
1210
+ const said = describeError(text, fallback);
1211
+ if (!said.code || !ANY_HOST_CODES.has(said.code)) return fallback;
1212
+ return card ? CARD_ERROR_LINE[said.code] : said.cause;
1213
+ }
1214
+ return text;
1215
+ }
1216
+
1127
1217
  // src/record-id.tsx
1128
1218
  var import_jsx_runtime10 = require("react/jsx-runtime");
1129
1219
  function RecordId({
@@ -1185,7 +1275,7 @@ function RecordId({
1185
1275
  e.preventDefault();
1186
1276
  void (0, import_clipboard.copyText)(value).then((ok) => {
1187
1277
  if (!ok) {
1188
- notify?.error(`Couldn't copy ${copyLabel}`);
1278
+ notify?.error("Not copied", { description: copyLabel });
1189
1279
  return;
1190
1280
  }
1191
1281
  setCopied(true);
@@ -1201,12 +1291,10 @@ function RecordId({
1201
1291
  try {
1202
1292
  const result = await onOpen(value);
1203
1293
  if (result === "forbidden") {
1204
- notify?.error("You don't have access to open this record");
1294
+ notify?.error("No access", { description: "This account can't open this record" });
1205
1295
  }
1206
1296
  } catch (err) {
1207
- notify?.error(
1208
- `Couldn't open: ${err instanceof Error ? err.message : String(err)}`
1209
- );
1297
+ notify?.error("Not opened", { description: peopleErrorSentence(err, null, { card: true }) });
1210
1298
  } finally {
1211
1299
  setOpening(false);
1212
1300
  }