@contember/react-devbar 2.1.0-alpha.29 → 2.1.0-alpha.30
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/dist/development/src/hooks/useCopyErrorMarkdown.cjs +101 -0
- package/dist/development/src/hooks/useCopyErrorMarkdown.cjs.map +1 -0
- package/dist/development/src/hooks/useCopyErrorMarkdown.js +101 -0
- package/dist/development/src/hooks/useCopyErrorMarkdown.js.map +1 -0
- package/dist/development/src/ui/DevBar/DevBar.cjs +9 -7
- package/dist/development/src/ui/DevBar/DevBar.cjs.map +1 -1
- package/dist/development/src/ui/DevBar/DevBar.js +9 -7
- package/dist/development/src/ui/DevBar/DevBar.js.map +1 -1
- package/dist/development/src/ui/DevError/DevErrorCopy.cjs +36 -0
- package/dist/development/src/ui/DevError/DevErrorCopy.cjs.map +1 -0
- package/dist/development/src/ui/DevError/DevErrorCopy.js +36 -0
- package/dist/development/src/ui/DevError/DevErrorCopy.js.map +1 -0
- package/dist/development/src/ui/DevError/DevErrorList.cjs +30 -22
- package/dist/development/src/ui/DevError/DevErrorList.cjs.map +1 -1
- package/dist/development/src/ui/DevError/DevErrorList.js +30 -22
- package/dist/development/src/ui/DevError/DevErrorList.js.map +1 -1
- package/dist/production/src/hooks/useCopyErrorMarkdown.cjs +101 -0
- package/dist/production/src/hooks/useCopyErrorMarkdown.cjs.map +1 -0
- package/dist/production/src/hooks/useCopyErrorMarkdown.js +101 -0
- package/dist/production/src/hooks/useCopyErrorMarkdown.js.map +1 -0
- package/dist/production/src/ui/DevBar/DevBar.cjs +2 -0
- package/dist/production/src/ui/DevBar/DevBar.cjs.map +1 -1
- package/dist/production/src/ui/DevBar/DevBar.js +2 -0
- package/dist/production/src/ui/DevBar/DevBar.js.map +1 -1
- package/dist/production/src/ui/DevError/DevErrorCopy.cjs +28 -0
- package/dist/production/src/ui/DevError/DevErrorCopy.cjs.map +1 -0
- package/dist/production/src/ui/DevError/DevErrorCopy.js +28 -0
- package/dist/production/src/ui/DevError/DevErrorCopy.js.map +1 -0
- package/dist/production/src/ui/DevError/DevErrorList.cjs +10 -6
- package/dist/production/src/ui/DevError/DevErrorList.cjs.map +1 -1
- package/dist/production/src/ui/DevError/DevErrorList.js +10 -6
- package/dist/production/src/ui/DevError/DevErrorList.js.map +1 -1
- package/dist/types/hooks/useCopyErrorMarkdown.d.ts +12 -0
- package/dist/types/hooks/useCopyErrorMarkdown.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/ui/DevBar/DevBar.d.ts +1 -1
- package/dist/types/ui/DevBar/DevBar.d.ts.map +1 -1
- package/dist/types/ui/DevError/DevErrorCopy.d.ts +6 -0
- package/dist/types/ui/DevError/DevErrorCopy.d.ts.map +1 -0
- package/dist/types/ui/DevError/DevErrorList.d.ts +1 -1
- package/dist/types/ui/DevError/DevErrorList.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/hooks/useCopyErrorMarkdown.ts +128 -0
- package/src/index.css +27 -0
- package/src/ui/DevBar/DevBar.tsx +3 -1
- package/src/ui/DevError/DevErrorCopy.tsx +31 -0
- package/src/ui/DevError/DevErrorList.tsx +12 -7
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
|
-
const DevErrorInner = require("./DevErrorInner.cjs");
|
|
5
4
|
const React = require("react");
|
|
5
|
+
const DevErrorInner = require("./DevErrorInner.cjs");
|
|
6
|
+
const DevErrorCopy = require("./DevErrorCopy.cjs");
|
|
6
7
|
const className = (cls) => cls ? `cui-devError-${cls}` : "cui-devError";
|
|
7
8
|
function DevErrorList({
|
|
8
9
|
currentError,
|
|
@@ -22,9 +23,16 @@ function DevErrorList({
|
|
|
22
23
|
}, []);
|
|
23
24
|
return /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className(), children: /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("in"), children: [
|
|
24
25
|
/* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("bar"), children: [
|
|
25
|
-
/* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("errorSource"), children:
|
|
26
|
+
/* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("errorSource"), children: [
|
|
27
|
+
currentErrorSource,
|
|
28
|
+
/* @__PURE__ */ jsxDevRuntime.jsxDEV(DevErrorCopy.DevErrorCopy, { currentError, currentErrorSource }, void 0, false, {
|
|
29
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
30
|
+
lineNumber: 43,
|
|
31
|
+
columnNumber: 7
|
|
32
|
+
}, this)
|
|
33
|
+
] }, void 0, true, {
|
|
26
34
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
27
|
-
lineNumber:
|
|
35
|
+
lineNumber: 41,
|
|
28
36
|
columnNumber: 6
|
|
29
37
|
}, this),
|
|
30
38
|
/* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("actions"), children: [
|
|
@@ -36,74 +44,74 @@ function DevErrorList({
|
|
|
36
44
|
errorCount
|
|
37
45
|
] }, void 0, true, {
|
|
38
46
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
39
|
-
lineNumber:
|
|
47
|
+
lineNumber: 48,
|
|
40
48
|
columnNumber: 9
|
|
41
49
|
}, this),
|
|
42
50
|
/* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("switcherButtons"), children: [
|
|
43
|
-
/* @__PURE__ */ jsxDevRuntime.jsxDEV("button", { className: className("switcherButton"), onClick: onPrevious, children: "←" }, void 0, false, {
|
|
51
|
+
/* @__PURE__ */ jsxDevRuntime.jsxDEV("button", { type: "button", className: className("switcherButton"), onClick: onPrevious, children: "←" }, void 0, false, {
|
|
44
52
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
45
|
-
lineNumber:
|
|
53
|
+
lineNumber: 52,
|
|
46
54
|
columnNumber: 10
|
|
47
55
|
}, this),
|
|
48
|
-
/* @__PURE__ */ jsxDevRuntime.jsxDEV("button", { className: className("switcherButton"), onClick: onNext, children: "→" }, void 0, false, {
|
|
56
|
+
/* @__PURE__ */ jsxDevRuntime.jsxDEV("button", { type: "button", className: className("switcherButton"), onClick: onNext, children: "→" }, void 0, false, {
|
|
49
57
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
50
|
-
lineNumber:
|
|
58
|
+
lineNumber: 55,
|
|
51
59
|
columnNumber: 10
|
|
52
60
|
}, this)
|
|
53
61
|
] }, void 0, true, {
|
|
54
62
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
55
|
-
lineNumber:
|
|
63
|
+
lineNumber: 51,
|
|
56
64
|
columnNumber: 9
|
|
57
65
|
}, this)
|
|
58
66
|
] }, void 0, true, {
|
|
59
67
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
60
|
-
lineNumber:
|
|
68
|
+
lineNumber: 47,
|
|
61
69
|
columnNumber: 8
|
|
62
70
|
}, this) : null,
|
|
63
|
-
/* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("close"), children: /* @__PURE__ */ jsxDevRuntime.jsxDEV("button", { className: className("closeButton"), onClick: onClose, children: "✕" }, void 0, false, {
|
|
71
|
+
/* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("close"), children: /* @__PURE__ */ jsxDevRuntime.jsxDEV("button", { type: "button", className: className("closeButton"), onClick: onClose, children: "✕" }, void 0, false, {
|
|
64
72
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
65
|
-
lineNumber:
|
|
73
|
+
lineNumber: 62,
|
|
66
74
|
columnNumber: 8
|
|
67
75
|
}, this) }, void 0, false, {
|
|
68
76
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
69
|
-
lineNumber:
|
|
77
|
+
lineNumber: 61,
|
|
70
78
|
columnNumber: 7
|
|
71
79
|
}, this)
|
|
72
80
|
] }, void 0, true, {
|
|
73
81
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
74
|
-
lineNumber:
|
|
82
|
+
lineNumber: 45,
|
|
75
83
|
columnNumber: 6
|
|
76
84
|
}, this),
|
|
77
|
-
/* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("close"), children: /* @__PURE__ */ jsxDevRuntime.jsxDEV("button", { className: className("closeButton"), onClick: onClear, children: "Clear errors" }, void 0, false, {
|
|
85
|
+
/* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("close"), children: /* @__PURE__ */ jsxDevRuntime.jsxDEV("button", { type: "button", className: className("closeButton"), onClick: onClear, children: "Clear errors" }, void 0, false, {
|
|
78
86
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
79
|
-
lineNumber:
|
|
87
|
+
lineNumber: 68,
|
|
80
88
|
columnNumber: 7
|
|
81
89
|
}, this) }, void 0, false, {
|
|
82
90
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
83
|
-
lineNumber:
|
|
91
|
+
lineNumber: 67,
|
|
84
92
|
columnNumber: 6
|
|
85
93
|
}, this)
|
|
86
94
|
] }, void 0, true, {
|
|
87
95
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
88
|
-
lineNumber:
|
|
96
|
+
lineNumber: 40,
|
|
89
97
|
columnNumber: 5
|
|
90
98
|
}, this),
|
|
91
99
|
/* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("content"), children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(DevErrorInner.DevErrorInner, { error: currentError }, void 0, false, {
|
|
92
100
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
93
|
-
lineNumber:
|
|
101
|
+
lineNumber: 74,
|
|
94
102
|
columnNumber: 6
|
|
95
103
|
}, this) }, void 0, false, {
|
|
96
104
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
97
|
-
lineNumber:
|
|
105
|
+
lineNumber: 73,
|
|
98
106
|
columnNumber: 5
|
|
99
107
|
}, this)
|
|
100
108
|
] }, void 0, true, {
|
|
101
109
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
102
|
-
lineNumber:
|
|
110
|
+
lineNumber: 39,
|
|
103
111
|
columnNumber: 4
|
|
104
112
|
}, this) }, void 0, false, {
|
|
105
113
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
106
|
-
lineNumber:
|
|
114
|
+
lineNumber: 38,
|
|
107
115
|
columnNumber: 3
|
|
108
116
|
}, this);
|
|
109
117
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevErrorList.cjs","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevErrorList.tsx"],"sourcesContent":["import { DevErrorInner } from './DevErrorInner'\nimport { ProcessedError } from './types'\nimport {
|
|
1
|
+
{"version":3,"file":"DevErrorList.cjs","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevErrorList.tsx"],"sourcesContent":["import { useEffect } from 'react'\nimport { DevErrorInner } from './DevErrorInner'\nimport type { ProcessedError } from './types'\nimport { DevErrorCopy } from './DevErrorCopy'\n\nexport interface DevErrorListProps {\n\tcurrentError: ProcessedError\n\tcurrentErrorSource: string\n\tcurrentErrorIndex: number\n\terrorCount: number\n\tonPrevious: () => void\n\tonNext: () => void\n\tonClose: () => void\n\tonClear: () => void\n}\n\nconst className = (cls?: string | null) => cls ? `cui-devError-${cls}` : 'cui-devError'\n\nexport function DevErrorList({\n\tcurrentError,\n\tcurrentErrorIndex,\n\tcurrentErrorSource,\n\terrorCount,\n\tonClose,\n\tonNext,\n\tonPrevious,\n\tonClear,\n}: DevErrorListProps) {\n\n\tuseEffect(() => {\n\t\tdocument.body.classList.add('cui-devError-body')\n\t\treturn () => {\n\t\t\tdocument.body.classList.remove('cui-devError-body')\n\t\t}\n\t}, [])\n\n\treturn (\n\t\t<div className={className()}>\n\t\t\t<div className={className('in')}>\n\t\t\t\t<div className={className('bar')}>\n\t\t\t\t\t<div className={className('errorSource')}>\n\t\t\t\t\t\t{currentErrorSource}\n\t\t\t\t\t\t<DevErrorCopy currentError={currentError} currentErrorSource={currentErrorSource} />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className={className('actions')}>\n\t\t\t\t\t\t{errorCount > 1 ? (\n\t\t\t\t\t\t\t<div className={className('switcher')}>\n\t\t\t\t\t\t\t\t<p className={className('errorCount')}>\n\t\t\t\t\t\t\t\t\tError {currentErrorIndex + 1} of {errorCount}\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t<div className={className('switcherButtons')}>\n\t\t\t\t\t\t\t\t\t<button type=\"button\" className={className('switcherButton')} onClick={onPrevious}>\n\t\t\t\t\t\t\t\t\t\t←\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t<button type=\"button\" className={className('switcherButton')} onClick={onNext}>\n\t\t\t\t\t\t\t\t\t\t→\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t<div className={className('close')}>\n\t\t\t\t\t\t\t<button type=\"button\" className={className('closeButton')} onClick={onClose}>\n\t\t\t\t\t\t\t\t✕\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className={className('close')}>\n\t\t\t\t\t\t<button type=\"button\" className={className('closeButton')} onClick={onClear}>\n\t\t\t\t\t\t\tClear errors\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className={className('content')}>\n\t\t\t\t\t<DevErrorInner error={currentError} />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"names":["useEffect","jsxDEV","DevErrorCopy","DevErrorInner"],"mappings":";;;;;;AAgBA,MAAM,YAAY,CAAC,QAAwB,MAAM,gBAAgB,GAAG,KAAK;AAElE,SAAS,aAAa;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAsB;AAErBA,QAAAA,UAAU,MAAM;AACN,aAAA,KAAK,UAAU,IAAI,mBAAmB;AAC/C,WAAO,MAAM;AACH,eAAA,KAAK,UAAU,OAAO,mBAAmB;AAAA,IACnD;AAAA,EACD,GAAG,EAAE;AAGJ,SAAAC,8BAAA,OAAC,OAAI,EAAA,WAAW,UAAU,GACzB,+CAAC,OAAI,EAAA,WAAW,UAAU,IAAI,GAC7B,UAAA;AAAA,IAAAA,8BAAA,OAAC,OAAI,EAAA,WAAW,UAAU,KAAK,GAC9B,UAAA;AAAA,MAAAA,8BAAA,OAAC,OAAI,EAAA,WAAW,UAAU,aAAa,GACrC,UAAA;AAAA,QAAA;AAAA,QACDA,8BAAA,OAACC,aAAa,cAAA,EAAA,cAA4B,mBAA1C,GAAA,QAAA,OAAA;AAAA,UAAA,UAAA;AAAA,UAAA,YAAA;AAAA,UAAA,cAAA;AAAA,QAAA,GAAkF,IAAA;AAAA,MAAA,KAFnF,QAAA,MAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MA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AAAA,IAAA,cAAA;AAAA,EAuCA,GAAA,IAAA;AAEF;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
|
-
import { DevErrorInner } from "./DevErrorInner.js";
|
|
3
2
|
import { useEffect } from "react";
|
|
3
|
+
import { DevErrorInner } from "./DevErrorInner.js";
|
|
4
|
+
import { DevErrorCopy } from "./DevErrorCopy.js";
|
|
4
5
|
const className = (cls) => cls ? `cui-devError-${cls}` : "cui-devError";
|
|
5
6
|
function DevErrorList({
|
|
6
7
|
currentError,
|
|
@@ -20,9 +21,16 @@ function DevErrorList({
|
|
|
20
21
|
}, []);
|
|
21
22
|
return /* @__PURE__ */ jsxDEV("div", { className: className(), children: /* @__PURE__ */ jsxDEV("div", { className: className("in"), children: [
|
|
22
23
|
/* @__PURE__ */ jsxDEV("div", { className: className("bar"), children: [
|
|
23
|
-
/* @__PURE__ */ jsxDEV("div", { className: className("errorSource"), children:
|
|
24
|
+
/* @__PURE__ */ jsxDEV("div", { className: className("errorSource"), children: [
|
|
25
|
+
currentErrorSource,
|
|
26
|
+
/* @__PURE__ */ jsxDEV(DevErrorCopy, { currentError, currentErrorSource }, void 0, false, {
|
|
27
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
28
|
+
lineNumber: 43,
|
|
29
|
+
columnNumber: 7
|
|
30
|
+
}, this)
|
|
31
|
+
] }, void 0, true, {
|
|
24
32
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
25
|
-
lineNumber:
|
|
33
|
+
lineNumber: 41,
|
|
26
34
|
columnNumber: 6
|
|
27
35
|
}, this),
|
|
28
36
|
/* @__PURE__ */ jsxDEV("div", { className: className("actions"), children: [
|
|
@@ -34,74 +42,74 @@ function DevErrorList({
|
|
|
34
42
|
errorCount
|
|
35
43
|
] }, void 0, true, {
|
|
36
44
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
37
|
-
lineNumber:
|
|
45
|
+
lineNumber: 48,
|
|
38
46
|
columnNumber: 9
|
|
39
47
|
}, this),
|
|
40
48
|
/* @__PURE__ */ jsxDEV("div", { className: className("switcherButtons"), children: [
|
|
41
|
-
/* @__PURE__ */ jsxDEV("button", { className: className("switcherButton"), onClick: onPrevious, children: "←" }, void 0, false, {
|
|
49
|
+
/* @__PURE__ */ jsxDEV("button", { type: "button", className: className("switcherButton"), onClick: onPrevious, children: "←" }, void 0, false, {
|
|
42
50
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
43
|
-
lineNumber:
|
|
51
|
+
lineNumber: 52,
|
|
44
52
|
columnNumber: 10
|
|
45
53
|
}, this),
|
|
46
|
-
/* @__PURE__ */ jsxDEV("button", { className: className("switcherButton"), onClick: onNext, children: "→" }, void 0, false, {
|
|
54
|
+
/* @__PURE__ */ jsxDEV("button", { type: "button", className: className("switcherButton"), onClick: onNext, children: "→" }, void 0, false, {
|
|
47
55
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
48
|
-
lineNumber:
|
|
56
|
+
lineNumber: 55,
|
|
49
57
|
columnNumber: 10
|
|
50
58
|
}, this)
|
|
51
59
|
] }, void 0, true, {
|
|
52
60
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
53
|
-
lineNumber:
|
|
61
|
+
lineNumber: 51,
|
|
54
62
|
columnNumber: 9
|
|
55
63
|
}, this)
|
|
56
64
|
] }, void 0, true, {
|
|
57
65
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
58
|
-
lineNumber:
|
|
66
|
+
lineNumber: 47,
|
|
59
67
|
columnNumber: 8
|
|
60
68
|
}, this) : null,
|
|
61
|
-
/* @__PURE__ */ jsxDEV("div", { className: className("close"), children: /* @__PURE__ */ jsxDEV("button", { className: className("closeButton"), onClick: onClose, children: "✕" }, void 0, false, {
|
|
69
|
+
/* @__PURE__ */ jsxDEV("div", { className: className("close"), children: /* @__PURE__ */ jsxDEV("button", { type: "button", className: className("closeButton"), onClick: onClose, children: "✕" }, void 0, false, {
|
|
62
70
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
63
|
-
lineNumber:
|
|
71
|
+
lineNumber: 62,
|
|
64
72
|
columnNumber: 8
|
|
65
73
|
}, this) }, void 0, false, {
|
|
66
74
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
67
|
-
lineNumber:
|
|
75
|
+
lineNumber: 61,
|
|
68
76
|
columnNumber: 7
|
|
69
77
|
}, this)
|
|
70
78
|
] }, void 0, true, {
|
|
71
79
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
72
|
-
lineNumber:
|
|
80
|
+
lineNumber: 45,
|
|
73
81
|
columnNumber: 6
|
|
74
82
|
}, this),
|
|
75
|
-
/* @__PURE__ */ jsxDEV("div", { className: className("close"), children: /* @__PURE__ */ jsxDEV("button", { className: className("closeButton"), onClick: onClear, children: "Clear errors" }, void 0, false, {
|
|
83
|
+
/* @__PURE__ */ jsxDEV("div", { className: className("close"), children: /* @__PURE__ */ jsxDEV("button", { type: "button", className: className("closeButton"), onClick: onClear, children: "Clear errors" }, void 0, false, {
|
|
76
84
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
77
|
-
lineNumber:
|
|
85
|
+
lineNumber: 68,
|
|
78
86
|
columnNumber: 7
|
|
79
87
|
}, this) }, void 0, false, {
|
|
80
88
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
81
|
-
lineNumber:
|
|
89
|
+
lineNumber: 67,
|
|
82
90
|
columnNumber: 6
|
|
83
91
|
}, this)
|
|
84
92
|
] }, void 0, true, {
|
|
85
93
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
86
|
-
lineNumber:
|
|
94
|
+
lineNumber: 40,
|
|
87
95
|
columnNumber: 5
|
|
88
96
|
}, this),
|
|
89
97
|
/* @__PURE__ */ jsxDEV("div", { className: className("content"), children: /* @__PURE__ */ jsxDEV(DevErrorInner, { error: currentError }, void 0, false, {
|
|
90
98
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
91
|
-
lineNumber:
|
|
99
|
+
lineNumber: 74,
|
|
92
100
|
columnNumber: 6
|
|
93
101
|
}, this) }, void 0, false, {
|
|
94
102
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
95
|
-
lineNumber:
|
|
103
|
+
lineNumber: 73,
|
|
96
104
|
columnNumber: 5
|
|
97
105
|
}, this)
|
|
98
106
|
] }, void 0, true, {
|
|
99
107
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
100
|
-
lineNumber:
|
|
108
|
+
lineNumber: 39,
|
|
101
109
|
columnNumber: 4
|
|
102
110
|
}, this) }, void 0, false, {
|
|
103
111
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorList.tsx",
|
|
104
|
-
lineNumber:
|
|
112
|
+
lineNumber: 38,
|
|
105
113
|
columnNumber: 3
|
|
106
114
|
}, this);
|
|
107
115
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevErrorList.js","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevErrorList.tsx"],"sourcesContent":["import { DevErrorInner } from './DevErrorInner'\nimport { ProcessedError } from './types'\nimport {
|
|
1
|
+
{"version":3,"file":"DevErrorList.js","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevErrorList.tsx"],"sourcesContent":["import { useEffect } from 'react'\nimport { DevErrorInner } from './DevErrorInner'\nimport type { ProcessedError } from './types'\nimport { DevErrorCopy } from './DevErrorCopy'\n\nexport interface DevErrorListProps {\n\tcurrentError: ProcessedError\n\tcurrentErrorSource: string\n\tcurrentErrorIndex: number\n\terrorCount: number\n\tonPrevious: () => void\n\tonNext: () => void\n\tonClose: () => void\n\tonClear: () => void\n}\n\nconst className = (cls?: string | null) => cls ? `cui-devError-${cls}` : 'cui-devError'\n\nexport function DevErrorList({\n\tcurrentError,\n\tcurrentErrorIndex,\n\tcurrentErrorSource,\n\terrorCount,\n\tonClose,\n\tonNext,\n\tonPrevious,\n\tonClear,\n}: DevErrorListProps) {\n\n\tuseEffect(() => {\n\t\tdocument.body.classList.add('cui-devError-body')\n\t\treturn () => {\n\t\t\tdocument.body.classList.remove('cui-devError-body')\n\t\t}\n\t}, [])\n\n\treturn (\n\t\t<div className={className()}>\n\t\t\t<div className={className('in')}>\n\t\t\t\t<div className={className('bar')}>\n\t\t\t\t\t<div className={className('errorSource')}>\n\t\t\t\t\t\t{currentErrorSource}\n\t\t\t\t\t\t<DevErrorCopy currentError={currentError} currentErrorSource={currentErrorSource} />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className={className('actions')}>\n\t\t\t\t\t\t{errorCount > 1 ? (\n\t\t\t\t\t\t\t<div className={className('switcher')}>\n\t\t\t\t\t\t\t\t<p className={className('errorCount')}>\n\t\t\t\t\t\t\t\t\tError {currentErrorIndex + 1} of {errorCount}\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t<div className={className('switcherButtons')}>\n\t\t\t\t\t\t\t\t\t<button type=\"button\" className={className('switcherButton')} onClick={onPrevious}>\n\t\t\t\t\t\t\t\t\t\t←\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t<button type=\"button\" className={className('switcherButton')} onClick={onNext}>\n\t\t\t\t\t\t\t\t\t\t→\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t<div className={className('close')}>\n\t\t\t\t\t\t\t<button type=\"button\" className={className('closeButton')} onClick={onClose}>\n\t\t\t\t\t\t\t\t✕\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className={className('close')}>\n\t\t\t\t\t\t<button type=\"button\" className={className('closeButton')} onClick={onClear}>\n\t\t\t\t\t\t\tClear errors\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className={className('content')}>\n\t\t\t\t\t<DevErrorInner error={currentError} />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"names":[],"mappings":";;;;AAgBA,MAAM,YAAY,CAAC,QAAwB,MAAM,gBAAgB,GAAG,KAAK;AAElE,SAAS,aAAa;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAsB;AAErB,YAAU,MAAM;AACN,aAAA,KAAK,UAAU,IAAI,mBAAmB;AAC/C,WAAO,MAAM;AACH,eAAA,KAAK,UAAU,OAAO,mBAAmB;AAAA,IACnD;AAAA,EACD,GAAG,EAAE;AAGJ,SAAA,uBAAC,OAAI,EAAA,WAAW,UAAU,GACzB,iCAAC,OAAI,EAAA,WAAW,UAAU,IAAI,GAC7B,UAAA;AAAA,IAAA,uBAAC,OAAI,EAAA,WAAW,UAAU,KAAK,GAC9B,UAAA;AAAA,MAAA,uBAAC,OAAI,EAAA,WAAW,UAAU,aAAa,GACrC,UAAA;AAAA,QAAA;AAAA,QACD,uBAAC,cAAa,EAAA,cAA4B,mBAA1C,GAAA,QAAA,OAAA;AAAA,UAAA,UAAA;AAAA,UAAA,YAAA;AAAA,UAAA,cAAA;AAAA,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AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAuCA,GAAA,IAAA;AAEF;"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const convertStackTraceToMarkdown = (stackTrace, lines) => {
|
|
5
|
+
stackTrace.forEach((frame, index) => {
|
|
6
|
+
lines.push(`**Frame ${index + 1}:**`);
|
|
7
|
+
lines.push("");
|
|
8
|
+
lines.push(`- **File:** ${frame.filename}${frame.line ? `:${frame.line}` : ""}`);
|
|
9
|
+
if (frame.callee) {
|
|
10
|
+
lines.push(`- **Function:** ${frame.callee}`);
|
|
11
|
+
}
|
|
12
|
+
lines.push("");
|
|
13
|
+
if (frame.line !== void 0 && frame.sourceCodeLines) {
|
|
14
|
+
lines.push("**Source Code:**");
|
|
15
|
+
lines.push("");
|
|
16
|
+
lines.push("```typescript");
|
|
17
|
+
frame.sourceCodeLines.forEach((codeLine, lineIndex) => {
|
|
18
|
+
const lineNumber = lineIndex + 1;
|
|
19
|
+
if (frame.line && lineNumber + 5 >= frame.line && lineNumber - 3 <= frame.line) {
|
|
20
|
+
const isErrorLine = lineNumber === frame.line;
|
|
21
|
+
const marker = isErrorLine ? ">>> " : " ";
|
|
22
|
+
lines.push(`${marker}${lineNumber.toString().padStart(3)}: ${codeLine}`);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
lines.push("```");
|
|
26
|
+
lines.push("");
|
|
27
|
+
}
|
|
28
|
+
lines.push("---");
|
|
29
|
+
lines.push("");
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
const convertErrorToMarkdownRecursive = (error, lines, level) => {
|
|
33
|
+
const errorObject = error.error instanceof Error ? error.error : void 0;
|
|
34
|
+
const prefix = "#".repeat(level + 1);
|
|
35
|
+
if (errorObject) {
|
|
36
|
+
lines.push(`${prefix} ${errorObject.name}`);
|
|
37
|
+
lines.push("");
|
|
38
|
+
if (errorObject.message) {
|
|
39
|
+
lines.push(`**Message:** ${errorObject.message}`);
|
|
40
|
+
lines.push("");
|
|
41
|
+
}
|
|
42
|
+
if ("details" in errorObject && errorObject.details) {
|
|
43
|
+
lines.push(`**Details:** ${errorObject.details}`);
|
|
44
|
+
lines.push("");
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
lines.push(`${prefix} Unknown Error`);
|
|
48
|
+
lines.push("");
|
|
49
|
+
}
|
|
50
|
+
if (error.parsedStackStrace) {
|
|
51
|
+
lines.push(`${"#".repeat(level + 2)} Stack Trace`);
|
|
52
|
+
lines.push("");
|
|
53
|
+
convertStackTraceToMarkdown(error.parsedStackStrace, lines);
|
|
54
|
+
} else if (errorObject?.stack) {
|
|
55
|
+
lines.push(`${"#".repeat(level + 2)} Stack Trace`);
|
|
56
|
+
lines.push("");
|
|
57
|
+
lines.push("```");
|
|
58
|
+
lines.push(errorObject.stack);
|
|
59
|
+
lines.push("```");
|
|
60
|
+
lines.push("");
|
|
61
|
+
}
|
|
62
|
+
if (error.cause) {
|
|
63
|
+
lines.push(`${"#".repeat(level + 2)} Caused By`);
|
|
64
|
+
lines.push("");
|
|
65
|
+
convertErrorToMarkdownRecursive(error.cause, lines, level + 1);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const convertErrorToMarkdown = (error, source) => {
|
|
69
|
+
const lines = [];
|
|
70
|
+
lines.push("# Contember Error Report");
|
|
71
|
+
lines.push("");
|
|
72
|
+
lines.push(`**Source:** ${source}`);
|
|
73
|
+
lines.push("");
|
|
74
|
+
convertErrorToMarkdownRecursive(error, lines, 1);
|
|
75
|
+
return lines.join("\n");
|
|
76
|
+
};
|
|
77
|
+
const useCopyErrorMarkdown = ({ currentError, currentErrorSource }) => {
|
|
78
|
+
const [copyStatus, setCopyStatus] = React.useState("idle");
|
|
79
|
+
React.useEffect(() => {
|
|
80
|
+
setCopyStatus("idle");
|
|
81
|
+
}, [currentError]);
|
|
82
|
+
const handleCopyMarkdown = async () => {
|
|
83
|
+
setCopyStatus("copying");
|
|
84
|
+
try {
|
|
85
|
+
const markdown = convertErrorToMarkdown(currentError, currentErrorSource);
|
|
86
|
+
await navigator.clipboard.writeText(markdown);
|
|
87
|
+
setCopyStatus("success");
|
|
88
|
+
} catch (err) {
|
|
89
|
+
console.error("Failed to copy markdown:", err);
|
|
90
|
+
setCopyStatus("error");
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const isClipboardSupported = !!navigator?.clipboard;
|
|
94
|
+
return {
|
|
95
|
+
copyStatus,
|
|
96
|
+
handleCopyMarkdown,
|
|
97
|
+
isClipboardSupported
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
exports.useCopyErrorMarkdown = useCopyErrorMarkdown;
|
|
101
|
+
//# sourceMappingURL=useCopyErrorMarkdown.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCopyErrorMarkdown.cjs","sources":["../../../../../packages/react-devbar/src/hooks/useCopyErrorMarkdown.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport type { ParsedStackTrace, ProcessedError } from '../ui/DevError/types'\n\nconst convertStackTraceToMarkdown = (stackTrace: ParsedStackTrace, lines: string[]) => {\n\tstackTrace.forEach((frame, index) => {\n\t\tlines.push(`**Frame ${index + 1}:**`)\n\t\tlines.push('')\n\t\tlines.push(`- **File:** ${frame.filename}${frame.line ? `:${frame.line}` : ''}`)\n\n\t\tif (frame.callee) {\n\t\t\tlines.push(`- **Function:** ${frame.callee}`)\n\t\t}\n\n\t\tlines.push('')\n\n\t\tif (frame.line !== undefined && frame.sourceCodeLines) {\n\t\t\tlines.push('**Source Code:**')\n\t\t\tlines.push('')\n\t\t\tlines.push('```typescript')\n\n\t\t\tframe.sourceCodeLines.forEach((codeLine, lineIndex) => {\n\t\t\t\tconst lineNumber = lineIndex + 1\n\t\t\t\t// Show context around the error line (similar to the UI logic)\n\t\t\t\tif (frame.line && lineNumber + 5 >= frame.line && lineNumber - 3 <= frame.line) {\n\t\t\t\t\tconst isErrorLine = lineNumber === frame.line\n\t\t\t\t\tconst marker = isErrorLine ? '>>> ' : ' '\n\t\t\t\t\tlines.push(`${marker}${lineNumber.toString().padStart(3)}: ${codeLine}`)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tlines.push('```')\n\t\t\tlines.push('')\n\t\t}\n\n\t\tlines.push('---')\n\t\tlines.push('')\n\t})\n}\n\nconst convertErrorToMarkdownRecursive = (error: ProcessedError, lines: string[], level: number) => {\n\tconst errorObject = error.error instanceof Error ? error.error : undefined\n\tconst prefix = '#'.repeat(level + 1)\n\n\tif (errorObject) {\n\t\tlines.push(`${prefix} ${errorObject.name}`)\n\t\tlines.push('')\n\n\t\tif (errorObject.message) {\n\t\t\tlines.push(`**Message:** ${errorObject.message}`)\n\t\t\tlines.push('')\n\t\t}\n\n\t\tif ('details' in errorObject && (errorObject as Error & { details?: unknown }).details) {\n\t\t\tlines.push(`**Details:** ${(errorObject as Error & { details: string }).details}`)\n\t\t\tlines.push('')\n\t\t}\n\t} else {\n\t\tlines.push(`${prefix} Unknown Error`)\n\t\tlines.push('')\n\t}\n\n\tif (error.parsedStackStrace) {\n\t\tlines.push(`${'#'.repeat(level + 2)} Stack Trace`)\n\t\tlines.push('')\n\t\tconvertStackTraceToMarkdown(error.parsedStackStrace, lines)\n\t} else if (errorObject?.stack) {\n\t\tlines.push(`${'#'.repeat(level + 2)} Stack Trace`)\n\t\tlines.push('')\n\t\tlines.push('```')\n\t\tlines.push(errorObject.stack)\n\t\tlines.push('```')\n\t\tlines.push('')\n\t}\n\n\tif (error.cause) {\n\t\tlines.push(`${'#'.repeat(level + 2)} Caused By`)\n\t\tlines.push('')\n\t\tconvertErrorToMarkdownRecursive(error.cause, lines, level + 1)\n\t}\n}\n\nconst convertErrorToMarkdown = (error: ProcessedError, source: string): string => {\n\tconst lines: string[] = []\n\n\tlines.push('# Contember Error Report')\n\tlines.push('')\n\tlines.push(`**Source:** ${source}`)\n\tlines.push('')\n\n\tconvertErrorToMarkdownRecursive(error, lines, 1)\n\n\treturn lines.join('\\n')\n}\n\ntype CopyMarkdownProps = {\n\tcurrentError: ProcessedError\n\tcurrentErrorSource: string\n}\n\nexport const useCopyErrorMarkdown = ({ currentError, currentErrorSource }: CopyMarkdownProps) => {\n\tconst [copyStatus, setCopyStatus] = useState<'idle' | 'copying' | 'success' | 'error'>('idle')\n\t\n\tuseEffect(() => {\n\t\tsetCopyStatus('idle')\n\t}, [currentError])\n\t\n\tconst handleCopyMarkdown = async () => {\n\t\tsetCopyStatus('copying')\n\t\ttry {\n\t\t\tconst markdown = convertErrorToMarkdown(currentError, currentErrorSource)\n\t\t\tawait navigator.clipboard.writeText(markdown)\n\t\t\tsetCopyStatus('success')\n\t\t} catch (err) {\n\t\t\tconsole.error('Failed to copy markdown:', err)\n\t\t\tsetCopyStatus('error')\n\t\t}\n\t}\n\n\n\n\tconst isClipboardSupported = !!navigator?.clipboard\n\n\treturn {\n\t\tcopyStatus,\n\t\thandleCopyMarkdown,\n\t\tisClipboardSupported,\n\t}\n}\n"],"names":["useState","useEffect"],"mappings":";;;AAGA,MAAM,8BAA8B,CAAC,YAA8B,UAAoB;AAC3E,aAAA,QAAQ,CAAC,OAAO,UAAU;AACpC,UAAM,KAAK,WAAW,QAAQ,CAAC,KAAK;AACpC,UAAM,KAAK,EAAE;AACb,UAAM,KAAK,eAAe,MAAM,QAAQ,GAAG,MAAM,OAAO,IAAI,MAAM,IAAI,KAAK,EAAE,EAAE;AAE/E,QAAI,MAAM,QAAQ;AACjB,YAAM,KAAK,mBAAmB,MAAM,MAAM,EAAE;AAAA,IAAA;AAG7C,UAAM,KAAK,EAAE;AAEb,QAAI,MAAM,SAAS,UAAa,MAAM,iBAAiB;AACtD,YAAM,KAAK,kBAAkB;AAC7B,YAAM,KAAK,EAAE;AACb,YAAM,KAAK,eAAe;AAE1B,YAAM,gBAAg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jD,UAAM,KAAK,EAAE;AACb,UAAM,KAAK,KAAK;AACV,UAAA,KAAK,YAAY,KAAK;AAC5B,UAAM,KAAK,KAAK;AAChB,UAAM,KAAK,EAAE;AAAA,EAAA;AAGd,MAAI,MAAM,OAAO;AAChB,UAAM,KAAK,GAAG,IAAI,OAAO,QAAQ,CAAC,CAAC,YAAY;AAC/C,UAAM,KAAK,EAAE;AACb,oCAAgC,MAAM,OAAO,OAAO,QAAQ,CAAC;AAAA,EAAA;AAE/D;AAEA,MAAM,yBAAyB,CAAC,OAAuB,WAA2B;AACjF,QAAM,QAAkB,CAAC;AAEzB,QAAM,KAAK,0BAA0B;AACrC,QAAM,KAAK,EAAE;AACP,QAAA,KAAK,eAAe,MAAM,EAAE;AAClC,QAAM,KAAK,EAAE;AAEmB,kCAAA,OAAO,OAAO,CAAC;AAExC,SAAA,MAAM,KAAK,IAAI;AACvB;AAOO,MAAM,uBAAuB,CAAC,EAAE,cAAc,yBAA4C;AAChG,QAAM,CAAC,YAAY,aAAa,IAAIA,MAAAA,SAAmD,MAAM;AAE7FC,QAAAA,UAAU,MAAM;AACf,kBAAc,MAAM;AAAA,EAAA,GAClB,CAAC,YAAY,CAAC;AAEjB,QAAM,qBAAqB,YAAY;AACtC,kBAAc,SAAS;AACnB,QAAA;AACG,YAAA,WAAW,uBAAuB,cAAc,kBAAkB;AAClE,YAAA,UAAU,UAAU,UAAU,QAAQ;AAC5C,oBAAc,SAAS;AAAA,aACf,KAAK;AACL,cAAA,MAAM,4BAA4B,GAAG;AAC7C,oBAAc,OAAO;AAAA,IAAA;AAAA,EAEvB;AAIM,QAAA,uBAAuB,CAAC,CAAC,WAAW;AAEnC,SAAA;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;;"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
const convertStackTraceToMarkdown = (stackTrace, lines) => {
|
|
3
|
+
stackTrace.forEach((frame, index) => {
|
|
4
|
+
lines.push(`**Frame ${index + 1}:**`);
|
|
5
|
+
lines.push("");
|
|
6
|
+
lines.push(`- **File:** ${frame.filename}${frame.line ? `:${frame.line}` : ""}`);
|
|
7
|
+
if (frame.callee) {
|
|
8
|
+
lines.push(`- **Function:** ${frame.callee}`);
|
|
9
|
+
}
|
|
10
|
+
lines.push("");
|
|
11
|
+
if (frame.line !== void 0 && frame.sourceCodeLines) {
|
|
12
|
+
lines.push("**Source Code:**");
|
|
13
|
+
lines.push("");
|
|
14
|
+
lines.push("```typescript");
|
|
15
|
+
frame.sourceCodeLines.forEach((codeLine, lineIndex) => {
|
|
16
|
+
const lineNumber = lineIndex + 1;
|
|
17
|
+
if (frame.line && lineNumber + 5 >= frame.line && lineNumber - 3 <= frame.line) {
|
|
18
|
+
const isErrorLine = lineNumber === frame.line;
|
|
19
|
+
const marker = isErrorLine ? ">>> " : " ";
|
|
20
|
+
lines.push(`${marker}${lineNumber.toString().padStart(3)}: ${codeLine}`);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
lines.push("```");
|
|
24
|
+
lines.push("");
|
|
25
|
+
}
|
|
26
|
+
lines.push("---");
|
|
27
|
+
lines.push("");
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
const convertErrorToMarkdownRecursive = (error, lines, level) => {
|
|
31
|
+
const errorObject = error.error instanceof Error ? error.error : void 0;
|
|
32
|
+
const prefix = "#".repeat(level + 1);
|
|
33
|
+
if (errorObject) {
|
|
34
|
+
lines.push(`${prefix} ${errorObject.name}`);
|
|
35
|
+
lines.push("");
|
|
36
|
+
if (errorObject.message) {
|
|
37
|
+
lines.push(`**Message:** ${errorObject.message}`);
|
|
38
|
+
lines.push("");
|
|
39
|
+
}
|
|
40
|
+
if ("details" in errorObject && errorObject.details) {
|
|
41
|
+
lines.push(`**Details:** ${errorObject.details}`);
|
|
42
|
+
lines.push("");
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
lines.push(`${prefix} Unknown Error`);
|
|
46
|
+
lines.push("");
|
|
47
|
+
}
|
|
48
|
+
if (error.parsedStackStrace) {
|
|
49
|
+
lines.push(`${"#".repeat(level + 2)} Stack Trace`);
|
|
50
|
+
lines.push("");
|
|
51
|
+
convertStackTraceToMarkdown(error.parsedStackStrace, lines);
|
|
52
|
+
} else if (errorObject?.stack) {
|
|
53
|
+
lines.push(`${"#".repeat(level + 2)} Stack Trace`);
|
|
54
|
+
lines.push("");
|
|
55
|
+
lines.push("```");
|
|
56
|
+
lines.push(errorObject.stack);
|
|
57
|
+
lines.push("```");
|
|
58
|
+
lines.push("");
|
|
59
|
+
}
|
|
60
|
+
if (error.cause) {
|
|
61
|
+
lines.push(`${"#".repeat(level + 2)} Caused By`);
|
|
62
|
+
lines.push("");
|
|
63
|
+
convertErrorToMarkdownRecursive(error.cause, lines, level + 1);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const convertErrorToMarkdown = (error, source) => {
|
|
67
|
+
const lines = [];
|
|
68
|
+
lines.push("# Contember Error Report");
|
|
69
|
+
lines.push("");
|
|
70
|
+
lines.push(`**Source:** ${source}`);
|
|
71
|
+
lines.push("");
|
|
72
|
+
convertErrorToMarkdownRecursive(error, lines, 1);
|
|
73
|
+
return lines.join("\n");
|
|
74
|
+
};
|
|
75
|
+
const useCopyErrorMarkdown = ({ currentError, currentErrorSource }) => {
|
|
76
|
+
const [copyStatus, setCopyStatus] = useState("idle");
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
setCopyStatus("idle");
|
|
79
|
+
}, [currentError]);
|
|
80
|
+
const handleCopyMarkdown = async () => {
|
|
81
|
+
setCopyStatus("copying");
|
|
82
|
+
try {
|
|
83
|
+
const markdown = convertErrorToMarkdown(currentError, currentErrorSource);
|
|
84
|
+
await navigator.clipboard.writeText(markdown);
|
|
85
|
+
setCopyStatus("success");
|
|
86
|
+
} catch (err) {
|
|
87
|
+
console.error("Failed to copy markdown:", err);
|
|
88
|
+
setCopyStatus("error");
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const isClipboardSupported = !!navigator?.clipboard;
|
|
92
|
+
return {
|
|
93
|
+
copyStatus,
|
|
94
|
+
handleCopyMarkdown,
|
|
95
|
+
isClipboardSupported
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
export {
|
|
99
|
+
useCopyErrorMarkdown
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=useCopyErrorMarkdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCopyErrorMarkdown.js","sources":["../../../../../packages/react-devbar/src/hooks/useCopyErrorMarkdown.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport type { ParsedStackTrace, ProcessedError } from '../ui/DevError/types'\n\nconst convertStackTraceToMarkdown = (stackTrace: ParsedStackTrace, lines: string[]) => {\n\tstackTrace.forEach((frame, index) => {\n\t\tlines.push(`**Frame ${index + 1}:**`)\n\t\tlines.push('')\n\t\tlines.push(`- **File:** ${frame.filename}${frame.line ? `:${frame.line}` : ''}`)\n\n\t\tif (frame.callee) {\n\t\t\tlines.push(`- **Function:** ${frame.callee}`)\n\t\t}\n\n\t\tlines.push('')\n\n\t\tif (frame.line !== undefined && frame.sourceCodeLines) {\n\t\t\tlines.push('**Source Code:**')\n\t\t\tlines.push('')\n\t\t\tlines.push('```typescript')\n\n\t\t\tframe.sourceCodeLines.forEach((codeLine, lineIndex) => {\n\t\t\t\tconst lineNumber = lineIndex + 1\n\t\t\t\t// Show context around the error line (similar to the UI logic)\n\t\t\t\tif (frame.line && lineNumber + 5 >= frame.line && lineNumber - 3 <= frame.line) {\n\t\t\t\t\tconst isErrorLine = lineNumber === frame.line\n\t\t\t\t\tconst marker = isErrorLine ? '>>> ' : ' '\n\t\t\t\t\tlines.push(`${marker}${lineNumber.toString().padStart(3)}: ${codeLine}`)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tlines.push('```')\n\t\t\tlines.push('')\n\t\t}\n\n\t\tlines.push('---')\n\t\tlines.push('')\n\t})\n}\n\nconst convertErrorToMarkdownRecursive = (error: ProcessedError, lines: string[], level: number) => {\n\tconst errorObject = error.error instanceof Error ? error.error : undefined\n\tconst prefix = '#'.repeat(level + 1)\n\n\tif (errorObject) {\n\t\tlines.push(`${prefix} ${errorObject.name}`)\n\t\tlines.push('')\n\n\t\tif (errorObject.message) {\n\t\t\tlines.push(`**Message:** ${errorObject.message}`)\n\t\t\tlines.push('')\n\t\t}\n\n\t\tif ('details' in errorObject && (errorObject as Error & { details?: unknown }).details) {\n\t\t\tlines.push(`**Details:** ${(errorObject as Error & { details: string }).details}`)\n\t\t\tlines.push('')\n\t\t}\n\t} else {\n\t\tlines.push(`${prefix} Unknown Error`)\n\t\tlines.push('')\n\t}\n\n\tif (error.parsedStackStrace) {\n\t\tlines.push(`${'#'.repeat(level + 2)} Stack Trace`)\n\t\tlines.push('')\n\t\tconvertStackTraceToMarkdown(error.parsedStackStrace, lines)\n\t} else if (errorObject?.stack) {\n\t\tlines.push(`${'#'.repeat(level + 2)} Stack Trace`)\n\t\tlines.push('')\n\t\tlines.push('```')\n\t\tlines.push(errorObject.stack)\n\t\tlines.push('```')\n\t\tlines.push('')\n\t}\n\n\tif (error.cause) {\n\t\tlines.push(`${'#'.repeat(level + 2)} Caused By`)\n\t\tlines.push('')\n\t\tconvertErrorToMarkdownRecursive(error.cause, lines, level + 1)\n\t}\n}\n\nconst convertErrorToMarkdown = (error: ProcessedError, source: string): string => {\n\tconst lines: string[] = []\n\n\tlines.push('# Contember Error Report')\n\tlines.push('')\n\tlines.push(`**Source:** ${source}`)\n\tlines.push('')\n\n\tconvertErrorToMarkdownRecursive(error, lines, 1)\n\n\treturn lines.join('\\n')\n}\n\ntype CopyMarkdownProps = {\n\tcurrentError: ProcessedError\n\tcurrentErrorSource: string\n}\n\nexport const useCopyErrorMarkdown = ({ currentError, currentErrorSource }: CopyMarkdownProps) => {\n\tconst [copyStatus, setCopyStatus] = useState<'idle' | 'copying' | 'success' | 'error'>('idle')\n\t\n\tuseEffect(() => {\n\t\tsetCopyStatus('idle')\n\t}, [currentError])\n\t\n\tconst handleCopyMarkdown = async () => {\n\t\tsetCopyStatus('copying')\n\t\ttry {\n\t\t\tconst markdown = convertErrorToMarkdown(currentError, currentErrorSource)\n\t\t\tawait navigator.clipboard.writeText(markdown)\n\t\t\tsetCopyStatus('success')\n\t\t} catch (err) {\n\t\t\tconsole.error('Failed to copy markdown:', err)\n\t\t\tsetCopyStatus('error')\n\t\t}\n\t}\n\n\n\n\tconst isClipboardSupported = !!navigator?.clipboard\n\n\treturn {\n\t\tcopyStatus,\n\t\thandleCopyMarkdown,\n\t\tisClipboardSupported,\n\t}\n}\n"],"names":[],"mappings":";AAGA,MAAM,8BAA8B,CAAC,YAA8B,UAAoB;AAC3E,aAAA,QAAQ,CAAC,OAAO,UAAU;AACpC,UAAM,KAAK,WAAW,QAAQ,CAAC,KAAK;AACpC,UAAM,KAAK,EAAE;AACb,UAAM,KAAK,eAAe,MAAM,QAAQ,GAAG,MAAM,OAAO,IAAI,MAAM,IAAI,KAAK,EAAE,EAAE;AAE/E,QAAI,MAAM,QAAQ;AACjB,YAAM,KAAK,mBAAmB,MAAM,MAAM,EAAE;AAAA,IAAA;AAG7C,UAAM,KAAK,EAAE;AAEb,QAAI,MAAM,SAAS,UAAa,MAAM,iBAAiB;AACtD,YAAM,KAAK,kBAAkB;AAC7B,YAAM,KAAK,EAAE;AACb,YAAM,KAAK,eAAe;AAE1B,YAAM,gBAAgB,QAAQ,CAAC,UAAU,cAAc;AACtD,cAAM,aAAa,YAAY;AAE3B,YAAA,MAAM,QAAQ,aAAa,KAAK,MAAM,QAAQ,aAAa,KAAK,MAAM,MAAM;AACzE,gBAAA,cAAc,eAAe,MAAM;AACnC,gBAAA,SAAS,cAAc,SAAS;AACtC,gBAAM,KAAK,GAAG,MAAM,GAAG,WAAW,WAAW,SAAS,CAAC,CAAC,KAAK,QAAQ,EAAE;AAAA,QAAA;AAAA,MACx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AA;AAE/D;AAEA,MAAM,yBAAyB,CAAC,OAAuB,WAA2B;AACjF,QAAM,QAAkB,CAAC;AAEzB,QAAM,KAAK,0BAA0B;AACrC,QAAM,KAAK,EAAE;AACP,QAAA,KAAK,eAAe,MAAM,EAAE;AAClC,QAAM,KAAK,EAAE;AAEmB,kCAAA,OAAO,OAAO,CAAC;AAExC,SAAA,MAAM,KAAK,IAAI;AACvB;AAOO,MAAM,uBAAuB,CAAC,EAAE,cAAc,yBAA4C;AAChG,QAAM,CAAC,YAAY,aAAa,IAAI,SAAmD,MAAM;AAE7F,YAAU,MAAM;AACf,kBAAc,MAAM;AAAA,EAAA,GAClB,CAAC,YAAY,CAAC;AAEjB,QAAM,qBAAqB,YAAY;AACtC,kBAAc,SAAS;AACnB,QAAA;AACG,YAAA,WAAW,uBAAuB,cAAc,kBAAkB;AAClE,YAAA,UAAU,UAAU,UAAU,QAAQ;AAC5C,oBAAc,SAAS;AAAA,aACf,KAAK;AACL,cAAA,MAAM,4BAA4B,GAAG;AAC7C,oBAAc,OAAO;AAAA,IAAA;AAAA,EAEvB;AAIM,QAAA,uBAAuB,CAAC,CAAC,WAAW;AAEnC,SAAA;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;"}
|
|
@@ -89,6 +89,7 @@ const DevPanel = ({ heading, icon, children, preview }) => {
|
|
|
89
89
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
90
90
|
"button",
|
|
91
91
|
{
|
|
92
|
+
type: "button",
|
|
92
93
|
ref: triggerRef,
|
|
93
94
|
tabIndex: 0,
|
|
94
95
|
"aria-haspopup": "dialog",
|
|
@@ -107,6 +108,7 @@ const DevPanel = ({ heading, icon, children, preview }) => {
|
|
|
107
108
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
108
109
|
"button",
|
|
109
110
|
{
|
|
111
|
+
type: "button",
|
|
110
112
|
onClick: handleClose,
|
|
111
113
|
className: className("close-button"),
|
|
112
114
|
"aria-label": "Close",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevBar.cjs","sources":["../../../../../../packages/react-devbar/src/ui/DevBar/DevBar.tsx"],"sourcesContent":["import {\n\tuseId,\n\tuseOnElementClickOutsideCallback,\n\tuseReferentiallyStableCallback,\n\tuseWindowSize,\n} from '@contember/react-utils'\nimport { dataAttribute } from '@contember/utilities'\nimport { PropsWithChildren, ReactNode, useCallback, useEffect, useRef, useState } from 'react'\n\nconst className = (cls: string | null) => cls ? `cui-devBar-${cls}` : 'cui-devBar'\n\nexport const DevBar = ({\n\tbreakpoint = 768,\n\tchildren,\n}: PropsWithChildren<{\n\tbreakpoint?: number\n}>) => {\n\tconst [expanded, setExpanded] = useState(false)\n\tconst isSmallScreen = useWindowSize().width < breakpoint\n\n\tconst handleToggle = useReferentiallyStableCallback(() => {\n\t\tsetExpanded(expanded => !expanded)\n\t})\n\n\tuseEffect(() => {\n\t\tfunction handleKeyDown(event: KeyboardEvent) {\n\t\t\tif (event.code === 'KeyJ' && (event.ctrlKey || event.metaKey)) {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tevent.stopPropagation()\n\n\t\t\t\thandleToggle()\n\t\t\t}\n\t\t}\n\n\t\tdocument.addEventListener('keydown', handleKeyDown)\n\t\treturn () => document.removeEventListener('keydown', handleKeyDown)\n\t}, [expanded, handleToggle])\n\n\tconst devBarContentRef = useRef<HTMLDivElement>(null)\n\n\tuseOnElementClickOutsideCallback(devBarContentRef, () => {\n\t\tif (expanded) {\n\t\t\tsetExpanded(false)\n\t\t}\n\t})\n\n\tconst id = `dev-bar-panel${useId()}`\n\n\treturn (\n\t\t<section\n\t\t\tdata-transparent=\"true\"\n\t\t\tdata-overrides-lucide-icons=\"true\"\n\t\t\tdata-expanded={dataAttribute(expanded)}\n\t\t\tdata-small-screen={dataAttribute(isSmallScreen)}\n\t\t\tclassName={className(null)}\n\t\t>\n\t\t\t<div ref={devBarContentRef} className={className('content')}>\n\t\t\t\t<div\n\t\t\t\t\tdata-expanded={true}\n\t\t\t\t\tid={id}\n\t\t\t\t\trole=\"dialog\"\n\t\t\t\t\tstyle={{ display: 'contents' }}\n\t\t\t\t>\n\t\t\t\t\t<div className={className('panels')}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</section>\n\t)\n}\n\ninterface DevPanelProps {\n\ticon: ReactNode\n\theading: ReactNode\n\tchildren: ReactNode\n\tpreview?: ReactNode\n}\n\nexport const DevPanel = ({ heading, icon, children, preview }: DevPanelProps) => {\n\tconst id = `cui-devBar-panel-${useId()}`\n\tconst dialogRef = useRef<HTMLDialogElement>(null)\n\tconst triggerRef = useRef<HTMLButtonElement>(null)\n\n\tconst handleOpen = useCallback(() => {\n\t\tdialogRef.current?.showModal()\n\t}, [])\n\n\tconst handleClose = useCallback(() => {\n\t\tdialogRef.current?.close()\n\t}, [])\n\n\tuseEffect(() => {\n\t\tconst dialog = dialogRef.current\n\t\tif (!dialog) return\n\n\t\tconst handleClickOutside = (event: MouseEvent) => {\n\t\t\tconst rect = dialog.getBoundingClientRect()\n\t\t\tconst isInDialog = (\n\t\t\t\trect.top <= event.clientY &&\n\t\t\t\tevent.clientY <= rect.top + rect.height &&\n\t\t\t\trect.left <= event.clientX &&\n\t\t\t\tevent.clientX <= rect.left + rect.width\n\t\t\t)\n\n\t\t\tif (!isInDialog) {\n\t\t\t\tdialog.close()\n\t\t\t}\n\t\t}\n\n\t\tdialog.addEventListener('click', handleClickOutside)\n\t\treturn () => dialog.removeEventListener('click', handleClickOutside)\n\t}, [])\n\n\tuseEffect(() => {\n\t\tconst handleEscape = (event: KeyboardEvent) => {\n\t\t\tif (event.key === 'Escape') {\n\t\t\t\thandleClose()\n\t\t\t}\n\t\t}\n\n\t\tdocument.addEventListener('keydown', handleEscape)\n\t\treturn () => document.removeEventListener('keydown', handleEscape)\n\t}, [handleClose])\n\n\treturn (\n\t\t<div className={className('trigger')}>\n\t\t\t<button\n\t\t\t\tref={triggerRef}\n\t\t\t\ttabIndex={0}\n\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\taria-controls={id}\n\t\t\t\tclassName={className('trigger-label')}\n\t\t\t\tonClick={handleOpen}\n\t\t\t>\n\t\t\t\t{icon}\n\t\t\t\t<span className={className('trigger-label-text')}>\n\t\t\t\t\t{preview ?? heading}\n\t\t\t\t</span>\n\t\t\t</button>\n\n\t\t\t<dialog ref={dialogRef} id={id} className={className('panel')}>\n\t\t\t\t<div className={className('panel-content')}>\n\t\t\t\t\t<div className={className('panel-header')}>\n\t\t\t\t\t\t<h2 className=\"h4\">{heading}</h2>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tonClick={handleClose}\n\t\t\t\t\t\t\tclassName={className('close-button')}\n\t\t\t\t\t\t\taria-label=\"Close\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t✕\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className={className('panel-body')}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</dialog>\n\t\t</div>\n\t)\n}\n"],"names":["useState","useWindowSize","useReferentiallyStableCallback","expanded","useEffect","useRef","useOnElementClickOutsideCallback","useId","jsx","dataAttribute","useCallback","jsxs"],"mappings":";;;;;;AASA,MAAM,YAAY,CAAC,QAAuB,MAAM,cAAc,GAAG,KAAK;AAE/D,MAAM,SAAS,CAAC;AAAA,EACtB,aAAa;AAAA,EACb;AACD,MAEO;AACN,QAAM,CAAC,UAAU,WAAW,IAAIA,MAAAA,SAAS,KAAK;AACxC,QAAA,gBAAgBC,WAAAA,gBAAgB,QAAQ;AAExC,QAAA,eAAeC,WAAAA,+BAA+B,MAAM;AAC7C,gBAAA,CAAAC,cAAY,CAACA,SAAQ;AAAA,EAAA,CACjC;AAEDC,QAAAA,UAAU,MAAM;AACf,aAAS,cAAc,OAAsB;AAC5C,UAAI,MAAM,SAAS,WAAW,MAAM,WAAW,MAAM,UA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EAAA,WAAW,UAAU,cAAc,GACvC,UAAA;AAAA,QAACH,2BAAA,IAAA,MAAA,EAAG,WAAU,MAAM,UAAQ,SAAA;AAAA,QAC5BA,2BAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACA,SAAS;AAAA,YACT,WAAW,UAAU,cAAc;AAAA,YACnC,cAAW;AAAA,YACX,UAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAED,GACD;AAAA,qCACC,OAAI,EAAA,WAAW,UAAU,YAAY,GACpC,SACF,CAAA;AAAA,IAAA,EAAA,CACD,EACD,CAAA;AAAA,EAAA,GACD;AAEF;;;"}
|
|
1
|
+
{"version":3,"file":"DevBar.cjs","sources":["../../../../../../packages/react-devbar/src/ui/DevBar/DevBar.tsx"],"sourcesContent":["import {\n\tuseId,\n\tuseOnElementClickOutsideCallback,\n\tuseReferentiallyStableCallback,\n\tuseWindowSize,\n} from '@contember/react-utils'\nimport { dataAttribute } from '@contember/utilities'\nimport { type PropsWithChildren, type ReactNode, useCallback, useEffect, useRef, useState } from 'react'\n\nconst className = (cls: string | null) => cls ? `cui-devBar-${cls}` : 'cui-devBar'\n\nexport const DevBar = ({\n\tbreakpoint = 768,\n\tchildren,\n}: PropsWithChildren<{\n\tbreakpoint?: number\n}>) => {\n\tconst [expanded, setExpanded] = useState(false)\n\tconst isSmallScreen = useWindowSize().width < breakpoint\n\n\tconst handleToggle = useReferentiallyStableCallback(() => {\n\t\tsetExpanded(expanded => !expanded)\n\t})\n\n\tuseEffect(() => {\n\t\tfunction handleKeyDown(event: KeyboardEvent) {\n\t\t\tif (event.code === 'KeyJ' && (event.ctrlKey || event.metaKey)) {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tevent.stopPropagation()\n\n\t\t\t\thandleToggle()\n\t\t\t}\n\t\t}\n\n\t\tdocument.addEventListener('keydown', handleKeyDown)\n\t\treturn () => document.removeEventListener('keydown', handleKeyDown)\n\t}, [expanded, handleToggle])\n\n\tconst devBarContentRef = useRef<HTMLDivElement>(null)\n\n\tuseOnElementClickOutsideCallback(devBarContentRef, () => {\n\t\tif (expanded) {\n\t\t\tsetExpanded(false)\n\t\t}\n\t})\n\n\tconst id = `dev-bar-panel${useId()}`\n\n\treturn (\n\t\t<section\n\t\t\tdata-transparent=\"true\"\n\t\t\tdata-overrides-lucide-icons=\"true\"\n\t\t\tdata-expanded={dataAttribute(expanded)}\n\t\t\tdata-small-screen={dataAttribute(isSmallScreen)}\n\t\t\tclassName={className(null)}\n\t\t>\n\t\t\t<div ref={devBarContentRef} className={className('content')}>\n\t\t\t\t<div\n\t\t\t\t\tdata-expanded={true}\n\t\t\t\t\tid={id}\n\t\t\t\t\trole=\"dialog\"\n\t\t\t\t\tstyle={{ display: 'contents' }}\n\t\t\t\t>\n\t\t\t\t\t<div className={className('panels')}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</section>\n\t)\n}\n\ninterface DevPanelProps {\n\ticon: ReactNode\n\theading: ReactNode\n\tchildren: ReactNode\n\tpreview?: ReactNode\n}\n\nexport const DevPanel = ({ heading, icon, children, preview }: DevPanelProps) => {\n\tconst id = `cui-devBar-panel-${useId()}`\n\tconst dialogRef = useRef<HTMLDialogElement>(null)\n\tconst triggerRef = useRef<HTMLButtonElement>(null)\n\n\tconst handleOpen = useCallback(() => {\n\t\tdialogRef.current?.showModal()\n\t}, [])\n\n\tconst handleClose = useCallback(() => {\n\t\tdialogRef.current?.close()\n\t}, [])\n\n\tuseEffect(() => {\n\t\tconst dialog = dialogRef.current\n\t\tif (!dialog) return\n\n\t\tconst handleClickOutside = (event: MouseEvent) => {\n\t\t\tconst rect = dialog.getBoundingClientRect()\n\t\t\tconst isInDialog = (\n\t\t\t\trect.top <= event.clientY &&\n\t\t\t\tevent.clientY <= rect.top + rect.height &&\n\t\t\t\trect.left <= event.clientX &&\n\t\t\t\tevent.clientX <= rect.left + rect.width\n\t\t\t)\n\n\t\t\tif (!isInDialog) {\n\t\t\t\tdialog.close()\n\t\t\t}\n\t\t}\n\n\t\tdialog.addEventListener('click', handleClickOutside)\n\t\treturn () => dialog.removeEventListener('click', handleClickOutside)\n\t}, [])\n\n\tuseEffect(() => {\n\t\tconst handleEscape = (event: KeyboardEvent) => {\n\t\t\tif (event.key === 'Escape') {\n\t\t\t\thandleClose()\n\t\t\t}\n\t\t}\n\n\t\tdocument.addEventListener('keydown', handleEscape)\n\t\treturn () => document.removeEventListener('keydown', handleEscape)\n\t}, [handleClose])\n\n\treturn (\n\t\t<div className={className('trigger')}>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tref={triggerRef}\n\t\t\t\ttabIndex={0}\n\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\taria-controls={id}\n\t\t\t\tclassName={className('trigger-label')}\n\t\t\t\tonClick={handleOpen}\n\t\t\t>\n\t\t\t\t{icon}\n\t\t\t\t<span className={className('trigger-label-text')}>\n\t\t\t\t\t{preview ?? heading}\n\t\t\t\t</span>\n\t\t\t</button>\n\n\t\t\t<dialog ref={dialogRef} id={id} className={className('panel')}>\n\t\t\t\t<div className={className('panel-content')}>\n\t\t\t\t\t<div className={className('panel-header')}>\n\t\t\t\t\t\t<h2 className=\"h4\">{heading}</h2>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tonClick={handleClose}\n\t\t\t\t\t\t\tclassName={className('close-button')}\n\t\t\t\t\t\t\taria-label=\"Close\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t✕\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className={className('panel-body')}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</dialog>\n\t\t</div>\n\t)\n}\n"],"names":["useState","useWindowSize","useReferentiallyStableCallback","expanded","useEffect","useRef","useOnElementClickOutsideCallback","useId","jsx","dataAttribute","useCallback","jsxs"],"mappings":";;;;;;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,QACA,MAAK;AAAA,QACL,KAAK;AAAA,QACL,UAAU;AAAA,QACV,iBAAc;AAAA,QACd,iBAAe;AAAA,QACf,WAAW,UAAU,eAAe;AAAA,QACpC,SAAS;AAAA,QAER,UAAA;AAAA,UAAA;AAAA,yCACA,QAAK,EAAA,WAAW,UAAU,oBAAoB,GAC7C,qBAAW,QACb,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACD;AAAA,IAECH,2BAAA,IAAA,UAAA,EAAO,KAAK,WAAW,IAAQ,WAAW,UAAU,OAAO,GAC3D,UAACG,2BAAA,KAAA,OAAA,EAAI,WAAW,UAAU,eAAe,GACxC,UAAA;AAAA,MAAAA,2BAAA,KAAC,OAAI,EAAA,WAAW,UAAU,cAAc,GACvC,UAAA;AAAA,QAACH,2BAAA,IAAA,MAAA,EAAG,WAAU,MAAM,UAAQ,SAAA;AAAA,QAC5BA,2BAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACA,MAAK;AAAA,YACL,SAAS;AAAA,YACT,WAAW,UAAU,cAAc;AAAA,YACnC,cAAW;AAAA,YACX,UAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAED,GACD;AAAA,qCACC,OAAI,EAAA,WAAW,UAAU,YAAY,GACpC,SACF,CAAA;AAAA,IAAA,EAAA,CACD,EACD,CAAA;AAAA,EAAA,GACD;AAEF;;;"}
|
|
@@ -87,6 +87,7 @@ const DevPanel = ({ heading, icon, children, preview }) => {
|
|
|
87
87
|
/* @__PURE__ */ jsxs(
|
|
88
88
|
"button",
|
|
89
89
|
{
|
|
90
|
+
type: "button",
|
|
90
91
|
ref: triggerRef,
|
|
91
92
|
tabIndex: 0,
|
|
92
93
|
"aria-haspopup": "dialog",
|
|
@@ -105,6 +106,7 @@ const DevPanel = ({ heading, icon, children, preview }) => {
|
|
|
105
106
|
/* @__PURE__ */ jsx(
|
|
106
107
|
"button",
|
|
107
108
|
{
|
|
109
|
+
type: "button",
|
|
108
110
|
onClick: handleClose,
|
|
109
111
|
className: className("close-button"),
|
|
110
112
|
"aria-label": "Close",
|