@ai-matrx/design-system 0.86.353 → 0.86.355
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 +14 -0
- package/dist/carousel.js +2 -2
- 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-UGQRAQTE.js → chunk-XXZA2JUP.js} +2 -2
- package/dist/{chunk-FLWSEDUW.js → chunk-ZMUPFGQO.js} +2 -2
- package/dist/controls.cjs +85 -1
- package/dist/controls.cjs.map +1 -1
- package/dist/controls.js +2 -2
- 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 +118 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +20 -12
- 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/styles.css +1 -0
- package/dist/swipe-deck.cjs +85 -1
- package/dist/swipe-deck.cjs.map +1 -1
- package/dist/swipe-deck.js +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-XXZA2JUP.js.map} +0 -0
- /package/dist/{chunk-FLWSEDUW.js.map → chunk-ZMUPFGQO.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1306,6 +1306,103 @@ var init_drawer = __esm({
|
|
|
1306
1306
|
}
|
|
1307
1307
|
});
|
|
1308
1308
|
|
|
1309
|
+
// src/desktop/errors.ts
|
|
1310
|
+
function rawText(error) {
|
|
1311
|
+
if (error instanceof Error) return error.message || error.name;
|
|
1312
|
+
if (typeof error === "string") return error;
|
|
1313
|
+
if (error && typeof error === "object" && "message" in error && typeof error.message === "string") {
|
|
1314
|
+
return error.message;
|
|
1315
|
+
}
|
|
1316
|
+
return "";
|
|
1317
|
+
}
|
|
1318
|
+
function describeError(error, fallback = "Something went wrong. Try again.") {
|
|
1319
|
+
const detail = rawText(error).trim();
|
|
1320
|
+
if (!detail) return { cause: fallback, detail: "" };
|
|
1321
|
+
for (const rule of RULES) {
|
|
1322
|
+
if (rule.test.test(detail)) return { cause: rule.cause, detail, code: rule.code };
|
|
1323
|
+
}
|
|
1324
|
+
if (!RAW.test(detail) && detail.length <= 160) return { cause: detail, detail: "" };
|
|
1325
|
+
return { cause: fallback, detail };
|
|
1326
|
+
}
|
|
1327
|
+
var RULES, RAW;
|
|
1328
|
+
var init_errors = __esm({
|
|
1329
|
+
"src/desktop/errors.ts"() {
|
|
1330
|
+
"use strict";
|
|
1331
|
+
RULES = [
|
|
1332
|
+
{ 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." },
|
|
1333
|
+
{ 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." },
|
|
1334
|
+
{ 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." },
|
|
1335
|
+
{ code: "ECONNREFUSED", test: /\bECONNREFUSED\b|connection refused/i, cause: "The service isn't answering. It may have stopped; start it again." },
|
|
1336
|
+
{ 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." },
|
|
1337
|
+
{ code: "TIMEOUT", test: /\bETIMEDOUT\b|timed? ?out|\bTIMEOUT\b|deadline exceeded/i, cause: "It took too long to answer. Try again in a moment." },
|
|
1338
|
+
{ code: "ENOSPC", test: /\bENOSPC\b|no space left/i, cause: "The disk is full. Free some space, then try again." },
|
|
1339
|
+
{ code: "ENOMEM", test: /\bENOMEM\b|out of memory|cannot allocate memory/i, cause: "The computer ran out of memory. Close something and try again." },
|
|
1340
|
+
{ 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." },
|
|
1341
|
+
{ code: "FORBIDDEN", test: /\b403\b|forbidden/i, cause: "This account isn't allowed to do that." },
|
|
1342
|
+
{ code: "NOT_FOUND", test: /\b404\b|not found/i, cause: "It isn't there any more. Refresh and try again." },
|
|
1343
|
+
{ code: "RATE_LIMIT", test: /\b429\b|rate.?limit|too many requests/i, cause: "Too many requests just now. Wait a moment and try again." },
|
|
1344
|
+
{ 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." },
|
|
1345
|
+
{ 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." }
|
|
1346
|
+
];
|
|
1347
|
+
RAW = /\b[A-Z]{2,}[A-Z_]*\b|[\\/][\w.-]+[\\/]|\bat \S+ \(|\{|\}|errno|stack|undefined|null|\bspawn\b/;
|
|
1348
|
+
}
|
|
1349
|
+
});
|
|
1350
|
+
|
|
1351
|
+
// src/error-sentence.ts
|
|
1352
|
+
function errorSentenceOf(error) {
|
|
1353
|
+
if (error == null || error === true || error === false) return "";
|
|
1354
|
+
if (typeof error === "string") return error;
|
|
1355
|
+
if (typeof error !== "object") return String(error);
|
|
1356
|
+
const message = error.message;
|
|
1357
|
+
return typeof message === "string" ? message : "";
|
|
1358
|
+
}
|
|
1359
|
+
function isTimedOutError(error, message, code) {
|
|
1360
|
+
if (code === "57014" || code === "timed_out") return true;
|
|
1361
|
+
if (error && typeof error === "object") {
|
|
1362
|
+
const o = error;
|
|
1363
|
+
if (o.code === "57014" || o.code === "timed_out" || o.sqlstate === "57014") return true;
|
|
1364
|
+
}
|
|
1365
|
+
const text = `${message ?? ""} ${errorSentenceOf(error)}`;
|
|
1366
|
+
return /canceling statement due to statement timeout/i.test(text);
|
|
1367
|
+
}
|
|
1368
|
+
function isOfflineError(error, message) {
|
|
1369
|
+
if (typeof navigator !== "undefined" && navigator.onLine === false) return true;
|
|
1370
|
+
return offlineText(`${message ?? ""} ${errorSentenceOf(error)}`);
|
|
1371
|
+
}
|
|
1372
|
+
function offlineText(text) {
|
|
1373
|
+
const t = text.trim();
|
|
1374
|
+
return t !== "" && (describeError(t).code === "OFFLINE" || /networkerror|network request failed|load failed/i.test(t));
|
|
1375
|
+
}
|
|
1376
|
+
function isRawErrorText(text) {
|
|
1377
|
+
return MACHINE_PREFIX.test(text) || RAW_TEXT.test(text);
|
|
1378
|
+
}
|
|
1379
|
+
function peopleErrorSentence(error, message, options = {}) {
|
|
1380
|
+
if (isTimedOutError(error, message, options.code)) return TIMED_OUT_SENTENCE;
|
|
1381
|
+
const fallback = options.fallback ?? FALLBACK_ERROR_SENTENCE;
|
|
1382
|
+
const raw = message?.trim() || errorSentenceOf(error).trim();
|
|
1383
|
+
if (!raw) return fallback;
|
|
1384
|
+
let text = raw;
|
|
1385
|
+
for (let i = 0; i < 3 && MACHINE_PREFIX.test(text); i++) text = text.replace(MACHINE_PREFIX, "").trim();
|
|
1386
|
+
if (!text) return fallback;
|
|
1387
|
+
if (offlineText(text) || RAW_TEXT.test(text) || text !== raw) {
|
|
1388
|
+
const said = describeError(text, fallback);
|
|
1389
|
+
return said.code && ANY_HOST_CODES.has(said.code) ? said.cause : fallback;
|
|
1390
|
+
}
|
|
1391
|
+
return text;
|
|
1392
|
+
}
|
|
1393
|
+
var TIMED_OUT_SENTENCE, FALLBACK_ERROR_SENTENCE, ANY_HOST_CODES, MACHINE_PREFIX, RAW_TEXT;
|
|
1394
|
+
var init_error_sentence = __esm({
|
|
1395
|
+
"src/error-sentence.ts"() {
|
|
1396
|
+
"use strict";
|
|
1397
|
+
init_errors();
|
|
1398
|
+
TIMED_OUT_SENTENCE = "That took too long. Nothing was lost; try again.";
|
|
1399
|
+
FALLBACK_ERROR_SENTENCE = "Something went wrong. Try again.";
|
|
1400
|
+
ANY_HOST_CODES = /* @__PURE__ */ new Set(["OFFLINE", "TIMEOUT", "UNAUTHORIZED", "FORBIDDEN", "NOT_FOUND", "RATE_LIMIT", "SERVER"]);
|
|
1401
|
+
MACHINE_PREFIX = /^\s*(?:\[[\w./-]+\]\s*|[a-z][\w]*(?:[._][\w]+)+:\s+)/;
|
|
1402
|
+
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;
|
|
1403
|
+
}
|
|
1404
|
+
});
|
|
1405
|
+
|
|
1309
1406
|
// src/error-box.tsx
|
|
1310
1407
|
function ErrorActionsProvider({
|
|
1311
1408
|
render,
|
|
@@ -1330,11 +1427,17 @@ function ErrorActions(props) {
|
|
|
1330
1427
|
if (!render) return null;
|
|
1331
1428
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: render(props) });
|
|
1332
1429
|
}
|
|
1430
|
+
function sayable(body, error) {
|
|
1431
|
+
if (typeof body === "string") return peopleErrorSentence(error, body);
|
|
1432
|
+
if (Array.isArray(body)) return body.map((b) => typeof b === "string" && b.trim() ? peopleErrorSentence(error, b) : b);
|
|
1433
|
+
return body;
|
|
1434
|
+
}
|
|
1333
1435
|
var React8, import_jsx_runtime10, CONTEXT_KEY, registry2, ErrorActionsContext, MENUS_KEY, menusRegistry, ErrorCardMenusContext, ErrorBox;
|
|
1334
1436
|
var init_error_box = __esm({
|
|
1335
1437
|
"src/error-box.tsx"() {
|
|
1336
1438
|
"use strict";
|
|
1337
1439
|
React8 = __toESM(require("react"), 1);
|
|
1440
|
+
init_error_sentence();
|
|
1338
1441
|
import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1339
1442
|
CONTEXT_KEY = /* @__PURE__ */ Symbol.for("@ai-matrx/design-system/error-actions");
|
|
1340
1443
|
registry2 = globalThis;
|
|
@@ -1365,7 +1468,7 @@ var init_error_box = __esm({
|
|
|
1365
1468
|
...origin !== void 0 ? { origin } : {}
|
|
1366
1469
|
};
|
|
1367
1470
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Tag, { ref, role: "alert", "data-error-box": "", ...rest, children: [
|
|
1368
|
-
children ?? message,
|
|
1471
|
+
sayable(children ?? message, error),
|
|
1369
1472
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ErrorActions, { ...facts })
|
|
1370
1473
|
] });
|
|
1371
1474
|
});
|
|
@@ -4387,6 +4490,7 @@ __export(src_exports, {
|
|
|
4387
4490
|
ErrorBox: () => ErrorBox,
|
|
4388
4491
|
ErrorCardMenusProvider: () => ErrorCardMenusProvider,
|
|
4389
4492
|
ErrorNotice: () => ErrorNotice,
|
|
4493
|
+
FALLBACK_ERROR_SENTENCE: () => FALLBACK_ERROR_SENTENCE,
|
|
4390
4494
|
FIELD_SURFACE_CLASS: () => FIELD_SURFACE_CLASS,
|
|
4391
4495
|
FIRST_USE_HINT_DETAIL_MAX: () => FIRST_USE_HINT_DETAIL_MAX,
|
|
4392
4496
|
FIRST_USE_HINT_TITLE_MAX: () => FIRST_USE_HINT_TITLE_MAX,
|
|
@@ -4619,6 +4723,8 @@ __export(src_exports, {
|
|
|
4619
4723
|
insertLines: () => insertLines,
|
|
4620
4724
|
isInsideFloatingLayer: () => isInsideFloatingLayer,
|
|
4621
4725
|
isModalLayerOpen: () => isModalLayerOpen,
|
|
4726
|
+
isOfflineError: () => isOfflineError,
|
|
4727
|
+
isRawErrorText: () => isRawErrorText,
|
|
4622
4728
|
isRecordUuid: () => isRecordUuid,
|
|
4623
4729
|
isTimedOutError: () => isTimedOutError,
|
|
4624
4730
|
keepFloatingLayersInside: () => keepFloatingLayersInside,
|
|
@@ -4634,6 +4740,7 @@ __export(src_exports, {
|
|
|
4634
4740
|
parseSocial: () => parseSocial,
|
|
4635
4741
|
parseUrl: () => parseUrl,
|
|
4636
4742
|
peekRecordData: () => peekRecordData,
|
|
4743
|
+
peopleErrorSentence: () => peopleErrorSentence,
|
|
4637
4744
|
phoneGrid: () => phoneGrid,
|
|
4638
4745
|
placeBox: () => placeBox,
|
|
4639
4746
|
placementOf: () => placementOf,
|
|
@@ -5409,24 +5516,8 @@ init_icons();
|
|
|
5409
5516
|
init_cn();
|
|
5410
5517
|
init_button();
|
|
5411
5518
|
init_error_box();
|
|
5519
|
+
init_error_sentence();
|
|
5412
5520
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
5413
|
-
function errorSentenceOf(error) {
|
|
5414
|
-
if (error == null || error === true || error === false) return "";
|
|
5415
|
-
if (typeof error === "string") return error;
|
|
5416
|
-
if (typeof error !== "object") return String(error);
|
|
5417
|
-
const message = error.message;
|
|
5418
|
-
return typeof message === "string" ? message : "";
|
|
5419
|
-
}
|
|
5420
|
-
var TIMED_OUT_SENTENCE = "That took too long. Nothing was lost; try again.";
|
|
5421
|
-
function isTimedOutError(error, message, code) {
|
|
5422
|
-
if (code === "57014" || code === "timed_out") return true;
|
|
5423
|
-
if (error && typeof error === "object") {
|
|
5424
|
-
const o = error;
|
|
5425
|
-
if (o.code === "57014" || o.code === "timed_out" || o.sqlstate === "57014") return true;
|
|
5426
|
-
}
|
|
5427
|
-
const text = `${message ?? ""} ${errorSentenceOf(error)}`;
|
|
5428
|
-
return /canceling statement due to statement timeout/i.test(text);
|
|
5429
|
-
}
|
|
5430
5521
|
function ErrorNotice({
|
|
5431
5522
|
title,
|
|
5432
5523
|
message,
|
|
@@ -5446,7 +5537,7 @@ function ErrorNotice({
|
|
|
5446
5537
|
className
|
|
5447
5538
|
}) {
|
|
5448
5539
|
const timedOut = isTimedOutError(error, message, code);
|
|
5449
|
-
const sentence =
|
|
5540
|
+
const sentence = peopleErrorSentence(error, message, { code });
|
|
5450
5541
|
const actions2 = actionsProp ?? (timedOut && onRetry ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Button, { type: "button", size: "sm", variant: "outline", "data-error-retry": "", onClick: onRetry, children: "Try again" }) : void 0);
|
|
5451
5542
|
const menus = useErrorCardMenus();
|
|
5452
5543
|
const input = {
|
|
@@ -5538,6 +5629,9 @@ function ErrorNotice({
|
|
|
5538
5629
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(menus.Boundary, { title: menuTitle, text: menuText, children: card });
|
|
5539
5630
|
}
|
|
5540
5631
|
|
|
5632
|
+
// src/index.ts
|
|
5633
|
+
init_error_sentence();
|
|
5634
|
+
|
|
5541
5635
|
// src/read-state/read-gate.tsx
|
|
5542
5636
|
init_icons();
|
|
5543
5637
|
|
|
@@ -14534,7 +14628,7 @@ function EmailValue({ email, owner, state = "ok", peek = true, about }) {
|
|
|
14534
14628
|
...ok ? { primary: { label: "Send email", onSelect: () => window.location.assign(mailtoHref(parsed.address)) } } : {},
|
|
14535
14629
|
copyData: { email: parsed.address, ...owner ? { owner } : {} }
|
|
14536
14630
|
};
|
|
14537
|
-
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ValueShell, { kind: "email", glyph: MailGlyph, text: parsed.address, copy: parsed.address, state, record, peek, about });
|
|
14631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ValueShell, { kind: "email", glyph: MailGlyph, text: parsed.address, copy: parsed.address, state, record, peek, ...about !== void 0 ? { about } : {} });
|
|
14538
14632
|
}
|
|
14539
14633
|
function PhoneValue({ phone, owner, state = "ok", peek = true, defaultCallingCode = "1", about }) {
|
|
14540
14634
|
const parsed = parsePhone(phone, defaultCallingCode);
|
|
@@ -14559,7 +14653,7 @@ function PhoneValue({ phone, owner, state = "ok", peek = true, defaultCallingCod
|
|
|
14559
14653
|
...ok ? { primary: { label: "Call", onSelect: () => window.location.assign(telHref(parsed)) } } : {},
|
|
14560
14654
|
copyData: { phone: parsed.e164 ?? parsed.raw, display: parsed.display, ...parsed.region ? { region: parsed.region } : {}, ...owner ? { owner } : {} }
|
|
14561
14655
|
};
|
|
14562
|
-
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ValueShell, { kind: "phone number", glyph: PhoneGlyph, text: parsed.display, copy: parsed.e164 ?? parsed.raw, state, record, peek, about });
|
|
14656
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ValueShell, { kind: "phone number", glyph: PhoneGlyph, text: parsed.display, copy: parsed.e164 ?? parsed.raw, state, record, peek, ...about !== void 0 ? { about } : {} });
|
|
14563
14657
|
}
|
|
14564
14658
|
var VALIDATION_TONE = { verified: "success", partial: "warning", unknown: "danger" };
|
|
14565
14659
|
var VALIDATION_TEXT = { verified: "Verified address", partial: "Partly matched", unknown: "No match found" };
|
|
@@ -14618,7 +14712,7 @@ function AddressValue({ address, owner, state = "ok", peek = true, multiline = f
|
|
|
14618
14712
|
state,
|
|
14619
14713
|
record,
|
|
14620
14714
|
peek,
|
|
14621
|
-
about,
|
|
14715
|
+
...about !== void 0 ? { about } : {},
|
|
14622
14716
|
...multiline ? { wrap: true } : {}
|
|
14623
14717
|
}
|
|
14624
14718
|
);
|
|
@@ -14660,7 +14754,7 @@ function SocialHandleValue(props) {
|
|
|
14660
14754
|
state,
|
|
14661
14755
|
record: socialRecord(parsed, props, glyph),
|
|
14662
14756
|
peek,
|
|
14663
|
-
about: props.about
|
|
14757
|
+
...props.about !== void 0 ? { about: props.about } : {}
|
|
14664
14758
|
}
|
|
14665
14759
|
);
|
|
14666
14760
|
}
|
|
@@ -14684,7 +14778,7 @@ function UrlValue({ url, title, owner, state = "ok", peek = true, icon = true, a
|
|
|
14684
14778
|
...ok ? { primary: { label: "Open", onSelect: () => (0, import_outbound2.openOutbound)(parsed.href) } } : {},
|
|
14685
14779
|
copyData: { url: parsed.href ?? url, domain: parsed.domain, ...title ? { title } : {} }
|
|
14686
14780
|
};
|
|
14687
|
-
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ValueShell, { kind: "link", ...icon ? { glyph: GlobeIcon } : {}, text: parsed.display, copy: parsed.href ?? url, state, record, peek, about });
|
|
14781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ValueShell, { kind: "link", ...icon ? { glyph: GlobeIcon } : {}, text: parsed.display, copy: parsed.href ?? url, state, record, peek, ...about !== void 0 ? { about } : {} });
|
|
14688
14782
|
}
|
|
14689
14783
|
function ContactValue({ type, value, platform, followers, title, icon, ...common }) {
|
|
14690
14784
|
switch (type) {
|