@ai-matrx/design-system 0.86.354 → 0.86.356
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 +31 -2
- package/dist/carousel.js +3 -3
- package/dist/{chunk-UGQRAQTE.js → chunk-2PO3N42Q.js} +3 -3
- package/dist/{chunk-ZRHVA3DL.js → chunk-AV5C4YLL.js} +2 -1
- package/dist/{chunk-ZRHVA3DL.js.map → chunk-AV5C4YLL.js.map} +1 -1
- package/dist/chunk-LJKF267O.js +168 -0
- package/dist/chunk-LJKF267O.js.map +1 -0
- package/dist/{chunk-CFCWQDGC.js → chunk-RLM4RSED.js} +5 -23
- package/dist/chunk-RLM4RSED.js.map +1 -0
- package/dist/{chunk-FLWSEDUW.js → chunk-ZMUPFGQO.js} +2 -2
- package/dist/controls.cjs +86 -1
- package/dist/controls.cjs.map +1 -1
- package/dist/controls.js +3 -3
- package/dist/data-table/drill-chart.cjs +85 -1
- package/dist/data-table/drill-chart.cjs.map +1 -1
- package/dist/data-table/drill-chart.js +1 -1
- package/dist/data-table/index.cjs +85 -1
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.js +1 -1
- package/dist/desktop.cjs +159 -81
- package/dist/desktop.cjs.map +1 -1
- package/dist/desktop.css +8 -5
- package/dist/desktop.d.cts +0 -5
- package/dist/desktop.d.ts +0 -5
- package/dist/desktop.js +70 -70
- package/dist/desktop.js.map +1 -1
- package/dist/email-input-dialog.cjs +85 -1
- package/dist/email-input-dialog.cjs.map +1 -1
- package/dist/email-input-dialog.js +1 -1
- package/dist/index.cjs +114 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -22
- package/dist/index.d.ts +38 -22
- package/dist/index.js +16 -8
- package/dist/index.js.map +1 -1
- package/dist/lite-table.cjs +86 -19
- package/dist/lite-table.cjs.map +1 -1
- package/dist/lite-table.js +2 -2
- package/dist/notice-material.css +28 -0
- package/dist/record-list.cjs +86 -19
- package/dist/record-list.cjs.map +1 -1
- package/dist/record-list.js +2 -2
- package/dist/settings.cjs +1 -0
- package/dist/settings.cjs.map +1 -1
- package/dist/settings.js +1 -1
- package/dist/styles.css +1 -0
- package/dist/swipe-deck.cjs +95 -2
- package/dist/swipe-deck.cjs.map +1 -1
- package/dist/swipe-deck.css +2 -0
- package/dist/swipe-deck.js +11 -2
- package/dist/swipe-deck.js.map +1 -1
- package/dist/text-input-dialog.cjs +85 -1
- package/dist/text-input-dialog.cjs.map +1 -1
- package/dist/text-input-dialog.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-CFCWQDGC.js.map +0 -1
- package/dist/chunk-HKLIRHT2.js +0 -71
- package/dist/chunk-HKLIRHT2.js.map +0 -1
- /package/dist/{chunk-UGQRAQTE.js.map → chunk-2PO3N42Q.js.map} +0 -0
- /package/dist/{chunk-FLWSEDUW.js.map → chunk-ZMUPFGQO.js.map} +0 -0
package/dist/lite-table.cjs
CHANGED
|
@@ -229,6 +229,85 @@ Button.displayName = "Button";
|
|
|
229
229
|
|
|
230
230
|
// src/error-box.tsx
|
|
231
231
|
var React2 = __toESM(require("react"), 1);
|
|
232
|
+
|
|
233
|
+
// src/desktop/errors.ts
|
|
234
|
+
var RULES = [
|
|
235
|
+
{ 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." },
|
|
236
|
+
{ 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." },
|
|
237
|
+
{ 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." },
|
|
238
|
+
{ code: "ECONNREFUSED", test: /\bECONNREFUSED\b|connection refused/i, cause: "The service isn't answering. It may have stopped; start it again." },
|
|
239
|
+
{ 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." },
|
|
240
|
+
{ code: "TIMEOUT", test: /\bETIMEDOUT\b|timed? ?out|\bTIMEOUT\b|deadline exceeded/i, cause: "It took too long to answer. Try again in a moment." },
|
|
241
|
+
{ code: "ENOSPC", test: /\bENOSPC\b|no space left/i, cause: "The disk is full. Free some space, then try again." },
|
|
242
|
+
{ code: "ENOMEM", test: /\bENOMEM\b|out of memory|cannot allocate memory/i, cause: "The computer ran out of memory. Close something and try again." },
|
|
243
|
+
{ 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." },
|
|
244
|
+
{ code: "FORBIDDEN", test: /\b403\b|forbidden/i, cause: "This account isn't allowed to do that." },
|
|
245
|
+
{ code: "NOT_FOUND", test: /\b404\b|not found/i, cause: "It isn't there any more. Refresh and try again." },
|
|
246
|
+
{ code: "RATE_LIMIT", test: /\b429\b|rate.?limit|too many requests/i, cause: "Too many requests just now. Wait a moment and try again." },
|
|
247
|
+
{ 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." },
|
|
248
|
+
{ 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." }
|
|
249
|
+
];
|
|
250
|
+
var RAW = /\b[A-Z]{2,}[A-Z_]*\b|[\\/][\w.-]+[\\/]|\bat \S+ \(|\{|\}|errno|stack|undefined|null|\bspawn\b/;
|
|
251
|
+
function rawText(error) {
|
|
252
|
+
if (error instanceof Error) return error.message || error.name;
|
|
253
|
+
if (typeof error === "string") return error;
|
|
254
|
+
if (error && typeof error === "object" && "message" in error && typeof error.message === "string") {
|
|
255
|
+
return error.message;
|
|
256
|
+
}
|
|
257
|
+
return "";
|
|
258
|
+
}
|
|
259
|
+
function describeError(error, fallback = "Something went wrong. Try again.") {
|
|
260
|
+
const detail = rawText(error).trim();
|
|
261
|
+
if (!detail) return { cause: fallback, detail: "" };
|
|
262
|
+
for (const rule of RULES) {
|
|
263
|
+
if (rule.test.test(detail)) return { cause: rule.cause, detail, code: rule.code };
|
|
264
|
+
}
|
|
265
|
+
if (!RAW.test(detail) && detail.length <= 160) return { cause: detail, detail: "" };
|
|
266
|
+
return { cause: fallback, detail };
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// src/error-sentence.ts
|
|
270
|
+
function errorSentenceOf(error) {
|
|
271
|
+
if (error == null || error === true || error === false) return "";
|
|
272
|
+
if (typeof error === "string") return error;
|
|
273
|
+
if (typeof error !== "object") return String(error);
|
|
274
|
+
const message = error.message;
|
|
275
|
+
return typeof message === "string" ? message : "";
|
|
276
|
+
}
|
|
277
|
+
var TIMED_OUT_SENTENCE = "That took too long. Nothing was lost; try again.";
|
|
278
|
+
var FALLBACK_ERROR_SENTENCE = "Something went wrong. Try again.";
|
|
279
|
+
function isTimedOutError(error, message, code) {
|
|
280
|
+
if (code === "57014" || code === "timed_out") return true;
|
|
281
|
+
if (error && typeof error === "object") {
|
|
282
|
+
const o = error;
|
|
283
|
+
if (o.code === "57014" || o.code === "timed_out" || o.sqlstate === "57014") return true;
|
|
284
|
+
}
|
|
285
|
+
const text = `${message ?? ""} ${errorSentenceOf(error)}`;
|
|
286
|
+
return /canceling statement due to statement timeout/i.test(text);
|
|
287
|
+
}
|
|
288
|
+
function offlineText(text) {
|
|
289
|
+
const t = text.trim();
|
|
290
|
+
return t !== "" && (describeError(t).code === "OFFLINE" || /networkerror|network request failed|load failed/i.test(t));
|
|
291
|
+
}
|
|
292
|
+
var ANY_HOST_CODES = /* @__PURE__ */ new Set(["OFFLINE", "TIMEOUT", "UNAUTHORIZED", "FORBIDDEN", "NOT_FOUND", "RATE_LIMIT", "SERVER"]);
|
|
293
|
+
var MACHINE_PREFIX = /^\s*(?:\[[\w./-]+\]\s*|[a-z][\w]*(?:[._][\w]+)+:\s+)/;
|
|
294
|
+
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;
|
|
295
|
+
function peopleErrorSentence(error, message, options = {}) {
|
|
296
|
+
if (isTimedOutError(error, message, options.code)) return TIMED_OUT_SENTENCE;
|
|
297
|
+
const fallback = options.fallback ?? FALLBACK_ERROR_SENTENCE;
|
|
298
|
+
const raw = message?.trim() || errorSentenceOf(error).trim();
|
|
299
|
+
if (!raw) return fallback;
|
|
300
|
+
let text = raw;
|
|
301
|
+
for (let i = 0; i < 3 && MACHINE_PREFIX.test(text); i++) text = text.replace(MACHINE_PREFIX, "").trim();
|
|
302
|
+
if (!text) return fallback;
|
|
303
|
+
if (offlineText(text) || RAW_TEXT.test(text) || text !== raw) {
|
|
304
|
+
const said = describeError(text, fallback);
|
|
305
|
+
return said.code && ANY_HOST_CODES.has(said.code) ? said.cause : fallback;
|
|
306
|
+
}
|
|
307
|
+
return text;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// src/error-box.tsx
|
|
232
311
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
233
312
|
var CONTEXT_KEY = /* @__PURE__ */ Symbol.for("@ai-matrx/design-system/error-actions");
|
|
234
313
|
var registry = globalThis;
|
|
@@ -247,6 +326,11 @@ function ErrorActions(props) {
|
|
|
247
326
|
if (!render) return null;
|
|
248
327
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: render(props) });
|
|
249
328
|
}
|
|
329
|
+
function sayable(body, error) {
|
|
330
|
+
if (typeof body === "string") return peopleErrorSentence(error, body);
|
|
331
|
+
if (Array.isArray(body)) return body.map((b) => typeof b === "string" && b.trim() ? peopleErrorSentence(error, b) : b);
|
|
332
|
+
return body;
|
|
333
|
+
}
|
|
250
334
|
var ErrorBox = React2.forwardRef(function ErrorBox2({
|
|
251
335
|
as = "p",
|
|
252
336
|
message,
|
|
@@ -270,30 +354,13 @@ var ErrorBox = React2.forwardRef(function ErrorBox2({
|
|
|
270
354
|
...origin !== void 0 ? { origin } : {}
|
|
271
355
|
};
|
|
272
356
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Tag, { ref, role: "alert", "data-error-box": "", ...rest, children: [
|
|
273
|
-
children ?? message,
|
|
357
|
+
sayable(children ?? message, error),
|
|
274
358
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ErrorActions, { ...facts })
|
|
275
359
|
] });
|
|
276
360
|
});
|
|
277
361
|
|
|
278
362
|
// src/error-notice.tsx
|
|
279
363
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
280
|
-
function errorSentenceOf(error) {
|
|
281
|
-
if (error == null || error === true || error === false) return "";
|
|
282
|
-
if (typeof error === "string") return error;
|
|
283
|
-
if (typeof error !== "object") return String(error);
|
|
284
|
-
const message = error.message;
|
|
285
|
-
return typeof message === "string" ? message : "";
|
|
286
|
-
}
|
|
287
|
-
var TIMED_OUT_SENTENCE = "That took too long. Nothing was lost; try again.";
|
|
288
|
-
function isTimedOutError(error, message, code) {
|
|
289
|
-
if (code === "57014" || code === "timed_out") return true;
|
|
290
|
-
if (error && typeof error === "object") {
|
|
291
|
-
const o = error;
|
|
292
|
-
if (o.code === "57014" || o.code === "timed_out" || o.sqlstate === "57014") return true;
|
|
293
|
-
}
|
|
294
|
-
const text = `${message ?? ""} ${errorSentenceOf(error)}`;
|
|
295
|
-
return /canceling statement due to statement timeout/i.test(text);
|
|
296
|
-
}
|
|
297
364
|
function ErrorNotice({
|
|
298
365
|
title,
|
|
299
366
|
message,
|
|
@@ -313,7 +380,7 @@ function ErrorNotice({
|
|
|
313
380
|
className
|
|
314
381
|
}) {
|
|
315
382
|
const timedOut = isTimedOutError(error, message, code);
|
|
316
|
-
const sentence =
|
|
383
|
+
const sentence = peopleErrorSentence(error, message, { code });
|
|
317
384
|
const actions = actionsProp ?? (timedOut && onRetry ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Button, { type: "button", size: "sm", variant: "outline", "data-error-retry": "", onClick: onRetry, children: "Try again" }) : void 0);
|
|
318
385
|
const menus = useErrorCardMenus();
|
|
319
386
|
const input = {
|