@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.
Files changed (53) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/carousel.js +2 -2
  3. package/dist/chunk-LJKF267O.js +168 -0
  4. package/dist/chunk-LJKF267O.js.map +1 -0
  5. package/dist/{chunk-CFCWQDGC.js → chunk-RLM4RSED.js} +5 -23
  6. package/dist/chunk-RLM4RSED.js.map +1 -0
  7. package/dist/{chunk-UGQRAQTE.js → chunk-XXZA2JUP.js} +2 -2
  8. package/dist/{chunk-FLWSEDUW.js → chunk-ZMUPFGQO.js} +2 -2
  9. package/dist/controls.cjs +85 -1
  10. package/dist/controls.cjs.map +1 -1
  11. package/dist/controls.js +2 -2
  12. package/dist/data-table/drill-chart.cjs +85 -1
  13. package/dist/data-table/drill-chart.cjs.map +1 -1
  14. package/dist/data-table/drill-chart.js +1 -1
  15. package/dist/data-table/index.cjs +85 -1
  16. package/dist/data-table/index.cjs.map +1 -1
  17. package/dist/data-table/index.js +1 -1
  18. package/dist/desktop.cjs +159 -81
  19. package/dist/desktop.cjs.map +1 -1
  20. package/dist/desktop.css +8 -5
  21. package/dist/desktop.d.cts +0 -5
  22. package/dist/desktop.d.ts +0 -5
  23. package/dist/desktop.js +70 -70
  24. package/dist/desktop.js.map +1 -1
  25. package/dist/email-input-dialog.cjs +85 -1
  26. package/dist/email-input-dialog.cjs.map +1 -1
  27. package/dist/email-input-dialog.js +1 -1
  28. package/dist/index.cjs +118 -24
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.d.cts +17 -1
  31. package/dist/index.d.ts +17 -1
  32. package/dist/index.js +20 -12
  33. package/dist/index.js.map +1 -1
  34. package/dist/lite-table.cjs +86 -19
  35. package/dist/lite-table.cjs.map +1 -1
  36. package/dist/lite-table.js +2 -2
  37. package/dist/notice-material.css +28 -0
  38. package/dist/record-list.cjs +86 -19
  39. package/dist/record-list.cjs.map +1 -1
  40. package/dist/record-list.js +2 -2
  41. package/dist/styles.css +1 -0
  42. package/dist/swipe-deck.cjs +85 -1
  43. package/dist/swipe-deck.cjs.map +1 -1
  44. package/dist/swipe-deck.js +1 -1
  45. package/dist/text-input-dialog.cjs +85 -1
  46. package/dist/text-input-dialog.cjs.map +1 -1
  47. package/dist/text-input-dialog.js +1 -1
  48. package/package.json +2 -2
  49. package/dist/chunk-CFCWQDGC.js.map +0 -1
  50. package/dist/chunk-HKLIRHT2.js +0 -71
  51. package/dist/chunk-HKLIRHT2.js.map +0 -1
  52. /package/dist/{chunk-UGQRAQTE.js.map → chunk-XXZA2JUP.js.map} +0 -0
  53. /package/dist/{chunk-FLWSEDUW.js.map → chunk-ZMUPFGQO.js.map} +0 -0
@@ -6,12 +6,12 @@ import {
6
6
  ReadEmpty,
7
7
  ReadStaleNotice,
8
8
  readOf
9
- } from "./chunk-CFCWQDGC.js";
9
+ } from "./chunk-RLM4RSED.js";
10
10
  import {
11
11
  MAC_TABLE_ATTRIBUTE,
12
12
  MAC_TABLE_SLOTS
13
13
  } from "./chunk-5JZSBNEY.js";
14
- import "./chunk-HKLIRHT2.js";
14
+ import "./chunk-LJKF267O.js";
15
15
  import {
16
16
  getTapTargetLinkComponent
17
17
  } from "./chunk-WFBPCMPF.js";
@@ -0,0 +1,28 @@
1
+ /* THE NOTICE MATERIAL (@ai-matrx/design-system/notice-stack) — one definition for the web's toast
2
+ and Matrx 2's floating notice card: the macOS notification banner's translucent, blurred
3
+ material (NSPopover's), a 14 pt radius and the popover shadow. The tone lives in the icon only.
4
+ Imported by styles.css, which both hosts load. Values are AppKit's popover material, the same
5
+ ones desktop.css names --mx-popover / --mx-shadow-popover. */
6
+ :root {
7
+ --notice-material: rgb(250 250 250 / 0.86);
8
+ --notice-material-shadow: 0 0 0 0.5px rgb(0 0 0 / 0.12), 0 12px 40px rgb(0 0 0 / 0.22);
9
+ --notice-material-filter: blur(30px) saturate(1.8);
10
+ --notice-material-radius: 14px;
11
+ }
12
+ .dark {
13
+ --notice-material: rgb(40 40 42 / 0.86);
14
+ --notice-material-shadow: 0 0 0 0.5px rgb(255 255 255 / 0.1), 0 12px 40px rgb(0 0 0 / 0.5);
15
+ }
16
+
17
+ /* Matrx 2: the notice stack's card (desktop/layout.tsx Notices + desktop/state.tsx Banner). */
18
+ [data-slot="banner"][data-float],
19
+ /* The web: sonner's card. Sonner's own sheet paints [data-styled=true] with --normal-bg (white), so
20
+ the material is named at a higher specificity than that rule, never with !important. */
21
+ [data-sonner-toaster] [data-sonner-toast][data-styled="true"] {
22
+ background: var(--notice-material);
23
+ -webkit-backdrop-filter: var(--notice-material-filter);
24
+ backdrop-filter: var(--notice-material-filter);
25
+ box-shadow: var(--notice-material-shadow);
26
+ border-radius: var(--notice-material-radius);
27
+ border-color: transparent;
28
+ }
@@ -293,6 +293,85 @@ Button.displayName = "Button";
293
293
 
294
294
  // src/error-box.tsx
295
295
  var React2 = __toESM(require("react"), 1);
296
+
297
+ // src/desktop/errors.ts
298
+ var RULES = [
299
+ { 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." },
300
+ { 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." },
301
+ { 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." },
302
+ { code: "ECONNREFUSED", test: /\bECONNREFUSED\b|connection refused/i, cause: "The service isn't answering. It may have stopped; start it again." },
303
+ { 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." },
304
+ { code: "TIMEOUT", test: /\bETIMEDOUT\b|timed? ?out|\bTIMEOUT\b|deadline exceeded/i, cause: "It took too long to answer. Try again in a moment." },
305
+ { code: "ENOSPC", test: /\bENOSPC\b|no space left/i, cause: "The disk is full. Free some space, then try again." },
306
+ { code: "ENOMEM", test: /\bENOMEM\b|out of memory|cannot allocate memory/i, cause: "The computer ran out of memory. Close something and try again." },
307
+ { 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." },
308
+ { code: "FORBIDDEN", test: /\b403\b|forbidden/i, cause: "This account isn't allowed to do that." },
309
+ { code: "NOT_FOUND", test: /\b404\b|not found/i, cause: "It isn't there any more. Refresh and try again." },
310
+ { code: "RATE_LIMIT", test: /\b429\b|rate.?limit|too many requests/i, cause: "Too many requests just now. Wait a moment and try again." },
311
+ { 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." },
312
+ { 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." }
313
+ ];
314
+ var RAW = /\b[A-Z]{2,}[A-Z_]*\b|[\\/][\w.-]+[\\/]|\bat \S+ \(|\{|\}|errno|stack|undefined|null|\bspawn\b/;
315
+ function rawText(error) {
316
+ if (error instanceof Error) return error.message || error.name;
317
+ if (typeof error === "string") return error;
318
+ if (error && typeof error === "object" && "message" in error && typeof error.message === "string") {
319
+ return error.message;
320
+ }
321
+ return "";
322
+ }
323
+ function describeError(error, fallback = "Something went wrong. Try again.") {
324
+ const detail = rawText(error).trim();
325
+ if (!detail) return { cause: fallback, detail: "" };
326
+ for (const rule of RULES) {
327
+ if (rule.test.test(detail)) return { cause: rule.cause, detail, code: rule.code };
328
+ }
329
+ if (!RAW.test(detail) && detail.length <= 160) return { cause: detail, detail: "" };
330
+ return { cause: fallback, detail };
331
+ }
332
+
333
+ // src/error-sentence.ts
334
+ function errorSentenceOf(error) {
335
+ if (error == null || error === true || error === false) return "";
336
+ if (typeof error === "string") return error;
337
+ if (typeof error !== "object") return String(error);
338
+ const message = error.message;
339
+ return typeof message === "string" ? message : "";
340
+ }
341
+ var TIMED_OUT_SENTENCE = "That took too long. Nothing was lost; try again.";
342
+ var FALLBACK_ERROR_SENTENCE = "Something went wrong. Try again.";
343
+ function isTimedOutError(error, message, code) {
344
+ if (code === "57014" || code === "timed_out") return true;
345
+ if (error && typeof error === "object") {
346
+ const o = error;
347
+ if (o.code === "57014" || o.code === "timed_out" || o.sqlstate === "57014") return true;
348
+ }
349
+ const text = `${message ?? ""} ${errorSentenceOf(error)}`;
350
+ return /canceling statement due to statement timeout/i.test(text);
351
+ }
352
+ function offlineText(text) {
353
+ const t = text.trim();
354
+ return t !== "" && (describeError(t).code === "OFFLINE" || /networkerror|network request failed|load failed/i.test(t));
355
+ }
356
+ var ANY_HOST_CODES = /* @__PURE__ */ new Set(["OFFLINE", "TIMEOUT", "UNAUTHORIZED", "FORBIDDEN", "NOT_FOUND", "RATE_LIMIT", "SERVER"]);
357
+ var MACHINE_PREFIX = /^\s*(?:\[[\w./-]+\]\s*|[a-z][\w]*(?:[._][\w]+)+:\s+)/;
358
+ 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;
359
+ function peopleErrorSentence(error, message, options = {}) {
360
+ if (isTimedOutError(error, message, options.code)) return TIMED_OUT_SENTENCE;
361
+ const fallback = options.fallback ?? FALLBACK_ERROR_SENTENCE;
362
+ const raw = message?.trim() || errorSentenceOf(error).trim();
363
+ if (!raw) return fallback;
364
+ let text = raw;
365
+ for (let i = 0; i < 3 && MACHINE_PREFIX.test(text); i++) text = text.replace(MACHINE_PREFIX, "").trim();
366
+ if (!text) return fallback;
367
+ if (offlineText(text) || RAW_TEXT.test(text) || text !== raw) {
368
+ const said = describeError(text, fallback);
369
+ return said.code && ANY_HOST_CODES.has(said.code) ? said.cause : fallback;
370
+ }
371
+ return text;
372
+ }
373
+
374
+ // src/error-box.tsx
296
375
  var import_jsx_runtime3 = require("react/jsx-runtime");
297
376
  var CONTEXT_KEY = /* @__PURE__ */ Symbol.for("@ai-matrx/design-system/error-actions");
298
377
  var registry = globalThis;
@@ -311,6 +390,11 @@ function ErrorActions(props) {
311
390
  if (!render) return null;
312
391
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: render(props) });
313
392
  }
393
+ function sayable(body, error) {
394
+ if (typeof body === "string") return peopleErrorSentence(error, body);
395
+ if (Array.isArray(body)) return body.map((b) => typeof b === "string" && b.trim() ? peopleErrorSentence(error, b) : b);
396
+ return body;
397
+ }
314
398
  var ErrorBox = React2.forwardRef(function ErrorBox2({
315
399
  as = "p",
316
400
  message,
@@ -334,30 +418,13 @@ var ErrorBox = React2.forwardRef(function ErrorBox2({
334
418
  ...origin !== void 0 ? { origin } : {}
335
419
  };
336
420
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Tag, { ref, role: "alert", "data-error-box": "", ...rest, children: [
337
- children ?? message,
421
+ sayable(children ?? message, error),
338
422
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ErrorActions, { ...facts })
339
423
  ] });
340
424
  });
341
425
 
342
426
  // src/error-notice.tsx
343
427
  var import_jsx_runtime4 = require("react/jsx-runtime");
344
- function errorSentenceOf(error) {
345
- if (error == null || error === true || error === false) return "";
346
- if (typeof error === "string") return error;
347
- if (typeof error !== "object") return String(error);
348
- const message = error.message;
349
- return typeof message === "string" ? message : "";
350
- }
351
- var TIMED_OUT_SENTENCE = "That took too long. Nothing was lost; try again.";
352
- function isTimedOutError(error, message, code) {
353
- if (code === "57014" || code === "timed_out") return true;
354
- if (error && typeof error === "object") {
355
- const o = error;
356
- if (o.code === "57014" || o.code === "timed_out" || o.sqlstate === "57014") return true;
357
- }
358
- const text = `${message ?? ""} ${errorSentenceOf(error)}`;
359
- return /canceling statement due to statement timeout/i.test(text);
360
- }
361
428
  function ErrorNotice({
362
429
  title,
363
430
  message,
@@ -377,7 +444,7 @@ function ErrorNotice({
377
444
  className
378
445
  }) {
379
446
  const timedOut = isTimedOutError(error, message, code);
380
- const sentence = timedOut ? TIMED_OUT_SENTENCE : message?.trim() || errorSentenceOf(error).trim() || "Something went wrong.";
447
+ const sentence = peopleErrorSentence(error, message, { code });
381
448
  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);
382
449
  const menus = useErrorCardMenus();
383
450
  const input = {