mtxuilib 0.8.29 → 0.8.31

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.
@@ -1 +1 @@
1
- {"version":3,"file":"MtErrorBoundary.d.ts","sourceRoot":"","sources":["../../src/components/MtErrorBoundary.tsx"],"names":[],"mappings":"AAGA,OAAO,EAOL,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,UAAU,kBAAmB,SAAQ,aAAa;IAChD,kBAAkB,EAAE,MAAM,IAAI,CAAC;CAChC;AAmFD,UAAU,oBAAqB,SAAQ,iBAAiB;IACtD,QAAQ,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACnD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC;IAC/D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,8DAK7B,oBAAoB,4CAsBtB,CAAC"}
1
+ {"version":3,"file":"MtErrorBoundary.d.ts","sourceRoot":"","sources":["../../src/components/MtErrorBoundary.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEH,KAAK,iBAAiB,EAMzB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,UAAU,kBAAmB,SAAQ,aAAa;IAChD,kBAAkB,EAAE,MAAM,IAAI,CAAC;CAChC;AA8FD,UAAU,oBAAqB,SAAQ,iBAAiB;IACtD,QAAQ,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACnD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC;IAC/D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,8DAK7B,oBAAoB,4CAsBtB,CAAC"}
@@ -19,7 +19,7 @@ function ErrorFallback({ error: rawError, resetErrorBoundary }) {
19
19
  console.log("client error3", error);
20
20
  }
21
21
  }, [error]);
22
- return (_jsxs("div", { role: "alert", className: "flex flex-col items-center justify-center w-full h-full min-h-[120px] p-2 relative", children: [_jsxs("div", { className: "flex flex-col items-center gap-2", children: [_jsx(AlertTriangle, { className: "h-8 w-8 text-muted-foreground/60" }), _jsxs("button", { type: "button", onClick: handleRetry, className: "flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors rounded hover:bg-muted/50", title: "Retry", children: [_jsx(RefreshCw, { className: "size-3" }), _jsx("span", { children: "Retry" })] })] }), _jsx("button", { type: "button", onClick: toggleDebug, className: "absolute top-1 right-1 p-1 text-muted-foreground/40 hover:text-muted-foreground transition-colors rounded", title: "Debug info", children: _jsx(Bug, { className: "size-3" }) }), showDebug && (_jsx("div", { className: "fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4", children: _jsxs("div", { className: "bg-background border rounded-lg shadow-lg max-w-2xl w-full max-h-[80vh] overflow-hidden", children: [_jsxs("div", { className: "flex items-center justify-between p-3 border-b", children: [_jsx("h3", { className: "text-sm font-medium", children: "Error Details" }), _jsx("button", { type: "button", onClick: toggleDebug, className: "p-1 text-muted-foreground hover:text-foreground transition-colors rounded", children: _jsx(X, { className: "size-4" }) })] }), _jsx("div", { className: "p-3 overflow-auto max-h-[60vh]", children: _jsxs("div", { className: "space-y-3", children: [_jsxs("div", { children: [_jsx("h4", { className: "text-xs font-medium text-muted-foreground mb-1", children: "Message" }), _jsx("p", { className: "text-xs font-mono bg-muted p-2 rounded", children: error.message })] }), _jsxs("div", { children: [_jsx("h4", { className: "text-xs font-medium text-muted-foreground mb-1", children: "Stack Trace" }), _jsx("pre", { className: "text-xs font-mono bg-muted p-2 rounded overflow-auto max-h-40", children: error.stack || "No stack trace available" })] })] }) })] }) }))] }));
22
+ return (_jsxs("div", { role: "alert", className: "flex flex-col items-center justify-center w-full h-full min-h-[120px] p-4 relative bg-destructive/5 border border-destructive/20 rounded-md", children: [_jsxs("div", { className: "flex flex-col items-center gap-3 text-center", children: [_jsx("div", { className: "bg-destructive/10 p-2 rounded-full", children: _jsx(AlertTriangle, { className: "h-6 w-6 text-destructive" }) }), _jsxs("div", { className: "space-y-1", children: [_jsx("h3", { className: "text-sm font-semibold text-destructive", children: "\u7EC4\u4EF6\u53D1\u751F\u9519\u8BEF" }), _jsx("p", { className: "text-xs text-muted-foreground max-w-[250px] break-words line-clamp-3", children: error.message || "发生了未知错误" })] }), _jsxs("button", { type: "button", onClick: handleRetry, className: "flex items-center gap-1.5 px-3 py-1.5 mt-2 text-xs font-medium bg-background border shadow-sm hover:bg-muted transition-colors rounded-md", title: "Retry", children: [_jsx(RefreshCw, { className: "size-3.5" }), _jsx("span", { children: "\u91CD\u8BD5\u52A0\u8F7D" })] })] }), _jsx("button", { type: "button", onClick: toggleDebug, className: "absolute top-2 right-2 p-1.5 text-muted-foreground/40 hover:text-muted-foreground hover:bg-muted transition-colors rounded", title: "Debug info", children: _jsx(Bug, { className: "size-3.5" }) }), showDebug && (_jsx("div", { className: "fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4", children: _jsxs("div", { className: "bg-background border rounded-lg shadow-lg max-w-2xl w-full max-h-[80vh] overflow-hidden", children: [_jsxs("div", { className: "flex items-center justify-between p-3 border-b", children: [_jsx("h3", { className: "text-sm font-medium", children: "Error Details" }), _jsx("button", { type: "button", onClick: toggleDebug, className: "p-1 text-muted-foreground hover:text-foreground transition-colors rounded", children: _jsx(X, { className: "size-4" }) })] }), _jsx("div", { className: "p-3 overflow-auto max-h-[60vh]", children: _jsxs("div", { className: "space-y-3", children: [_jsxs("div", { children: [_jsx("h4", { className: "text-xs font-medium text-muted-foreground mb-1", children: "Message" }), _jsx("p", { className: "text-xs font-mono bg-muted p-2 rounded", children: error.message })] }), _jsxs("div", { children: [_jsx("h4", { className: "text-xs font-medium text-muted-foreground mb-1", children: "Stack Trace" }), _jsx("pre", { className: "text-xs font-mono bg-muted p-2 rounded overflow-auto max-h-40", children: error.stack || "No stack trace available" })] })] }) })] }) }))] }));
23
23
  }
24
24
  /**
25
25
  * Minimal error boundary component using react-error-boundary with React 19 startTransition
@@ -1 +1 @@
1
- {"version":3,"file":"MtErrorBoundary.js","sourceRoot":"","sources":["../../src/components/MtErrorBoundary.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EACL,QAAQ,EACR,eAAe,EACf,WAAW,EACX,SAAS,EACT,QAAQ,GAGT,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAMrD,SAAS,aAAa,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAsB;IAChF,MAAM,KAAK,GAAG,QAAQ,YAAY,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IACjF,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAElD,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE;QACnC,eAAe,CAAC,GAAG,EAAE;YACnB,kBAAkB,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAEzB,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE;QACnC,YAAY,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC,EAAE,E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AC;AACJ,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mtxuilib",
3
- "version": "0.8.29",
3
+ "version": "0.8.31",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -2,13 +2,13 @@
2
2
 
3
3
  import { AlertTriangle, Bug, RefreshCw, X } from "lucide-react";
4
4
  import {
5
- Suspense,
6
- startTransition,
7
- useCallback,
8
- useEffect,
9
- useState,
10
- type ErrorInfo,
11
- type PropsWithChildren,
5
+ type ErrorInfo,
6
+ type PropsWithChildren,
7
+ Suspense,
8
+ startTransition,
9
+ useCallback,
10
+ useEffect,
11
+ useState,
12
12
  } from "react";
13
13
  import type { FallbackProps } from "react-error-boundary";
14
14
  import { ErrorBoundary } from "react-error-boundary";
@@ -38,18 +38,29 @@ function ErrorFallback({ error: rawError, resetErrorBoundary }: ErrorFallbackPro
38
38
  }, [error]);
39
39
 
40
40
  return (
41
- <div role="alert" className="flex flex-col items-center justify-center w-full h-full min-h-[120px] p-2 relative">
42
- {/* Main error display - minimal and icon-focused */}
43
- <div className="flex flex-col items-center gap-2">
44
- <AlertTriangle className="h-8 w-8 text-muted-foreground/60" />
41
+ <div
42
+ role="alert"
43
+ className="flex flex-col items-center justify-center w-full h-full min-h-[120px] p-4 relative bg-destructive/5 border border-destructive/20 rounded-md"
44
+ >
45
+ {/* Main error display - icon and message-focused */}
46
+ <div className="flex flex-col items-center gap-3 text-center">
47
+ <div className="bg-destructive/10 p-2 rounded-full">
48
+ <AlertTriangle className="h-6 w-6 text-destructive" />
49
+ </div>
50
+ <div className="space-y-1">
51
+ <h3 className="text-sm font-semibold text-destructive">组件发生错误</h3>
52
+ <p className="text-xs text-muted-foreground max-w-[250px] break-words line-clamp-3">
53
+ {error.message || "发生了未知错误"}
54
+ </p>
55
+ </div>
45
56
  <button
46
57
  type="button"
47
58
  onClick={handleRetry}
48
- className="flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors rounded hover:bg-muted/50"
59
+ className="flex items-center gap-1.5 px-3 py-1.5 mt-2 text-xs font-medium bg-background border shadow-sm hover:bg-muted transition-colors rounded-md"
49
60
  title="Retry"
50
61
  >
51
- <RefreshCw className="size-3" />
52
- <span>Retry</span>
62
+ <RefreshCw className="size-3.5" />
63
+ <span>重试加载</span>
53
64
  </button>
54
65
  </div>
55
66
 
@@ -57,10 +68,10 @@ function ErrorFallback({ error: rawError, resetErrorBoundary }: ErrorFallbackPro
57
68
  <button
58
69
  type="button"
59
70
  onClick={toggleDebug}
60
- className="absolute top-1 right-1 p-1 text-muted-foreground/40 hover:text-muted-foreground transition-colors rounded"
71
+ className="absolute top-2 right-2 p-1.5 text-muted-foreground/40 hover:text-muted-foreground hover:bg-muted transition-colors rounded"
61
72
  title="Debug info"
62
73
  >
63
- <Bug className="size-3" />
74
+ <Bug className="size-3.5" />
64
75
  </button>
65
76
 
66
77
  {/* Debug modal */}