@contember/react-devbar 2.1.0-alpha.3 → 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.
Files changed (47) hide show
  1. package/dist/development/src/hooks/useCopyErrorMarkdown.cjs +101 -0
  2. package/dist/development/src/hooks/useCopyErrorMarkdown.cjs.map +1 -0
  3. package/dist/development/src/hooks/useCopyErrorMarkdown.js +101 -0
  4. package/dist/development/src/hooks/useCopyErrorMarkdown.js.map +1 -0
  5. package/dist/development/src/ui/DevBar/DevBar.cjs +9 -7
  6. package/dist/development/src/ui/DevBar/DevBar.cjs.map +1 -1
  7. package/dist/development/src/ui/DevBar/DevBar.js +9 -7
  8. package/dist/development/src/ui/DevBar/DevBar.js.map +1 -1
  9. package/dist/development/src/ui/DevError/DevErrorCopy.cjs +36 -0
  10. package/dist/development/src/ui/DevError/DevErrorCopy.cjs.map +1 -0
  11. package/dist/development/src/ui/DevError/DevErrorCopy.js +36 -0
  12. package/dist/development/src/ui/DevError/DevErrorCopy.js.map +1 -0
  13. package/dist/development/src/ui/DevError/DevErrorList.cjs +30 -22
  14. package/dist/development/src/ui/DevError/DevErrorList.cjs.map +1 -1
  15. package/dist/development/src/ui/DevError/DevErrorList.js +30 -22
  16. package/dist/development/src/ui/DevError/DevErrorList.js.map +1 -1
  17. package/dist/production/src/hooks/useCopyErrorMarkdown.cjs +101 -0
  18. package/dist/production/src/hooks/useCopyErrorMarkdown.cjs.map +1 -0
  19. package/dist/production/src/hooks/useCopyErrorMarkdown.js +101 -0
  20. package/dist/production/src/hooks/useCopyErrorMarkdown.js.map +1 -0
  21. package/dist/production/src/ui/DevBar/DevBar.cjs +2 -0
  22. package/dist/production/src/ui/DevBar/DevBar.cjs.map +1 -1
  23. package/dist/production/src/ui/DevBar/DevBar.js +2 -0
  24. package/dist/production/src/ui/DevBar/DevBar.js.map +1 -1
  25. package/dist/production/src/ui/DevError/DevErrorCopy.cjs +28 -0
  26. package/dist/production/src/ui/DevError/DevErrorCopy.cjs.map +1 -0
  27. package/dist/production/src/ui/DevError/DevErrorCopy.js +28 -0
  28. package/dist/production/src/ui/DevError/DevErrorCopy.js.map +1 -0
  29. package/dist/production/src/ui/DevError/DevErrorList.cjs +10 -6
  30. package/dist/production/src/ui/DevError/DevErrorList.cjs.map +1 -1
  31. package/dist/production/src/ui/DevError/DevErrorList.js +10 -6
  32. package/dist/production/src/ui/DevError/DevErrorList.js.map +1 -1
  33. package/dist/types/hooks/useCopyErrorMarkdown.d.ts +12 -0
  34. package/dist/types/hooks/useCopyErrorMarkdown.d.ts.map +1 -0
  35. package/dist/types/tsconfig.tsbuildinfo +1 -1
  36. package/dist/types/ui/DevBar/DevBar.d.ts +1 -1
  37. package/dist/types/ui/DevBar/DevBar.d.ts.map +1 -1
  38. package/dist/types/ui/DevError/DevErrorCopy.d.ts +6 -0
  39. package/dist/types/ui/DevError/DevErrorCopy.d.ts.map +1 -0
  40. package/dist/types/ui/DevError/DevErrorList.d.ts +1 -1
  41. package/dist/types/ui/DevError/DevErrorList.d.ts.map +1 -1
  42. package/package.json +3 -3
  43. package/src/hooks/useCopyErrorMarkdown.ts +128 -0
  44. package/src/index.css +27 -0
  45. package/src/ui/DevBar/DevBar.tsx +3 -1
  46. package/src/ui/DevError/DevErrorCopy.tsx +31 -0
  47. package/src/ui/DevError/DevErrorList.tsx +12 -7
@@ -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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CAAC,CAAC,cAAc;AACjD,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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AA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;"}
@@ -113,6 +113,7 @@ const DevPanel = ({ heading, icon, children, preview }) => {
113
113
  /* @__PURE__ */ jsxDevRuntime.jsxDEV(
114
114
  "button",
115
115
  {
116
+ type: "button",
116
117
  ref: triggerRef,
117
118
  tabIndex: 0,
118
119
  "aria-haspopup": "dialog",
@@ -123,7 +124,7 @@ const DevPanel = ({ heading, icon, children, preview }) => {
123
124
  icon,
124
125
  /* @__PURE__ */ jsxDevRuntime.jsxDEV("span", { className: className("trigger-label-text"), children: preview ?? heading }, void 0, false, {
125
126
  fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
126
- lineNumber: 137,
127
+ lineNumber: 138,
127
128
  columnNumber: 5
128
129
  }, void 0)
129
130
  ]
@@ -141,12 +142,13 @@ const DevPanel = ({ heading, icon, children, preview }) => {
141
142
  /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("panel-header"), children: [
142
143
  /* @__PURE__ */ jsxDevRuntime.jsxDEV("h2", { className: "h4", children: heading }, void 0, false, {
143
144
  fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
144
- lineNumber: 145,
145
+ lineNumber: 146,
145
146
  columnNumber: 7
146
147
  }, void 0),
147
148
  /* @__PURE__ */ jsxDevRuntime.jsxDEV(
148
149
  "button",
149
150
  {
151
+ type: "button",
150
152
  onClick: handleClose,
151
153
  className: className("close-button"),
152
154
  "aria-label": "Close",
@@ -156,28 +158,28 @@ const DevPanel = ({ heading, icon, children, preview }) => {
156
158
  false,
157
159
  {
158
160
  fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
159
- lineNumber: 146,
161
+ lineNumber: 147,
160
162
  columnNumber: 7
161
163
  },
162
164
  void 0
163
165
  )
164
166
  ] }, void 0, true, {
165
167
  fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
166
- lineNumber: 144,
168
+ lineNumber: 145,
167
169
  columnNumber: 6
168
170
  }, void 0),
169
171
  /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("panel-body"), children }, void 0, false, {
170
172
  fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
171
- lineNumber: 154,
173
+ lineNumber: 156,
172
174
  columnNumber: 6
173
175
  }, void 0)
174
176
  ] }, void 0, true, {
175
177
  fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
176
- lineNumber: 143,
178
+ lineNumber: 144,
177
179
  columnNumber: 5
178
180
  }, void 0) }, void 0, false, {
179
181
  fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
180
- lineNumber: 142,
182
+ lineNumber: 143,
181
183
  columnNumber: 4
182
184
  }, void 0)
183
185
  ] }, void 0, true, {
@@ -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","jsxDEV","dataAttribute","this","useCallback"],"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,UAAU;AAC9D,cAAM,eAAe;AACrB,cAAM,gBAAgB;AAET,qBAAA;AAAA,MAAA;AAAA,IACd;AAGQ,aAAA,iBAAiB,WAAW,aAAa;AAClD,WAAO,MAAM,SAAS,oBAAoB,WAAW,aAAa;AAAA,EAAA,GAChE,CAAC,UAAU,YAAY,CAAC;AAErB,QAAA,mBAAmBC,aAAuB,IAAI;AAEpDC,aAAA,iCAAiC,kBAAkB,MAAM;AACxD,QAAI,UAAU;AACb,kBAAY,KAAK;AAAA,IAAA;AAAA,EAClB,CACA;AAEK,QAAA,KAAK,gBAAgBC,WAAAA,MAAO,CAAA;AAGjC,SAAAC,8BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,oBAAiB;AAAA,MACjB,+BAA4B;AAAA,MAC5B,iBAAeC,wBAAc,QAAQ;AAAA,MACrC,qBAAmBA,wBAAc,aAAa;AAAA,MAC9C,WAAW,UAAU,IAAI;AAAA,MAEzB,+CAAC,OAAI,EAAA,KAAK,kBAAkB,WAAW,UAAU,SAAS,GACzD,UAAAD,8BAAA;AAAA,QAAC;AAAA,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A,MAAA,EAAG,WAAU,MAAM,UAApB,QAAA,GAAA,QAAA,OAAA;AAAA,UAAA,UAAA;AAAA,UAAA,YAAA;AAAA,UAAA,cAAA;AAAA,QAA4B,GAAAE,MAAA;AAAA,QAC5BF,8BAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACA,SAAS;AAAA,YACT,WAAW,UAAU,cAAc;AAAA,YACnC,cAAW;AAAA,YACX,UAAA;AAAA,UAAA;AAAA,UAJD;AAAA,UAAA;AAAA,UAAA;AAAA,YAAA,UAAA;AAAA,YAAA,YAAA;AAAA,YAAA,cAAA;AAAA,UAAA;AAAA,UAAAE;AAAAA,QAAA;AAAA,MAMA,KARD,QAAA,MAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MASA,GAAAA,MAAA;AAAA,2CACC,OAAI,EAAA,WAAW,UAAU,YAAY,GACpC,SADF,GAAA,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAA,GAEAA,MAAA;AAAA,IAAA,KAbD,QAAA,MAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAcA,EAfD,GAAA,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAgBAA,MAAA;AAAA,EAAA,KA/BD,QAAA,MAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAgCA,GAAAA,MAAA;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","jsxDEV","dataAttribute","this","useCallback"],"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,UAAU;AAC9D,cAAM,eAAe;AACrB,cAAM,gBAAgB;AAET,qBAAA;AAAA,MAAA;AAAA,IACd;AAGQ,aAAA,iBAAiB,WAAW,aAAa;AAClD,WAAO,MAAM,SAAS,oBAAoB,WAAW,aAAa;AAAA,EAAA,GAChE,CAAC,UAAU,YAAY,CAAC;AAErB,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AAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAeA,EAhBD,GAAA,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAiBAA,MAAA;AAAA,EAAA,KAjCD,QAAA,MAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAkCA,GAAAA,MAAA;AAEF;;;"}
@@ -111,6 +111,7 @@ const DevPanel = ({ heading, icon, children, preview }) => {
111
111
  /* @__PURE__ */ jsxDEV(
112
112
  "button",
113
113
  {
114
+ type: "button",
114
115
  ref: triggerRef,
115
116
  tabIndex: 0,
116
117
  "aria-haspopup": "dialog",
@@ -121,7 +122,7 @@ const DevPanel = ({ heading, icon, children, preview }) => {
121
122
  icon,
122
123
  /* @__PURE__ */ jsxDEV("span", { className: className("trigger-label-text"), children: preview ?? heading }, void 0, false, {
123
124
  fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
124
- lineNumber: 137,
125
+ lineNumber: 138,
125
126
  columnNumber: 5
126
127
  }, void 0)
127
128
  ]
@@ -139,12 +140,13 @@ const DevPanel = ({ heading, icon, children, preview }) => {
139
140
  /* @__PURE__ */ jsxDEV("div", { className: className("panel-header"), children: [
140
141
  /* @__PURE__ */ jsxDEV("h2", { className: "h4", children: heading }, void 0, false, {
141
142
  fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
142
- lineNumber: 145,
143
+ lineNumber: 146,
143
144
  columnNumber: 7
144
145
  }, void 0),
145
146
  /* @__PURE__ */ jsxDEV(
146
147
  "button",
147
148
  {
149
+ type: "button",
148
150
  onClick: handleClose,
149
151
  className: className("close-button"),
150
152
  "aria-label": "Close",
@@ -154,28 +156,28 @@ const DevPanel = ({ heading, icon, children, preview }) => {
154
156
  false,
155
157
  {
156
158
  fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
157
- lineNumber: 146,
159
+ lineNumber: 147,
158
160
  columnNumber: 7
159
161
  },
160
162
  void 0
161
163
  )
162
164
  ] }, void 0, true, {
163
165
  fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
164
- lineNumber: 144,
166
+ lineNumber: 145,
165
167
  columnNumber: 6
166
168
  }, void 0),
167
169
  /* @__PURE__ */ jsxDEV("div", { className: className("panel-body"), children }, void 0, false, {
168
170
  fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
169
- lineNumber: 154,
171
+ lineNumber: 156,
170
172
  columnNumber: 6
171
173
  }, void 0)
172
174
  ] }, void 0, true, {
173
175
  fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
174
- lineNumber: 143,
176
+ lineNumber: 144,
175
177
  columnNumber: 5
176
178
  }, void 0) }, void 0, false, {
177
179
  fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
178
- lineNumber: 142,
180
+ lineNumber: 143,
179
181
  columnNumber: 4
180
182
  }, void 0)
181
183
  ] }, void 0, true, {
@@ -1 +1 @@
1
- {"version":3,"file":"DevBar.js","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":["expanded","this"],"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,IAAI,SAAS,KAAK;AACxC,QAAA,gBAAgB,gBAAgB,QAAQ;AAExC,QAAA,eAAe,+BAA+B,MAAM;AAC7C,gBAAA,CAAAA,cAAY,CAACA,SAAQ;AAAA,EAAA,CACjC;AAED,YAAU,MAAM;AACf,aAAS,cAAc,OAAsB;AAC5C,UAAI,MAAM,SAAS,WAAW,MAAM,WAAW,MAAM,UAAU;AAC9D,cAAM,eAAe;AACrB,cAAM,gBAAgB;AAET,qBAAA;AAAA,MAAA;AAAA,IACd;AAGQ,aAAA,iBAAiB,WAAW,aAAa;AAClD,WAAO,MAAM,SAAS,oBAAoB,WAAW,aAAa;AAAA,EAAA,GAChE,CAAC,UAAU,YAAY,CAAC;AAErB,QAAA,mBAAmB,OAAuB,IAAI;AAEpD,mCAAiC,kBAAkB,MAAM;AACxD,QAAI,UAAU;AACb,kBAAY,KAAK;AAAA,IAAA;AAAA,EAClB,CACA;AAEK,QAAA,KAAK,gBAAgB,MAAO,CAAA;AAGjC,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,oBAAiB;AAAA,MACjB,+BAA4B;AAAA,MAC5B,iBAAe,cAAc,QAAQ;AAAA,MACrC,qBAAmB,cAAc,aAAa;AAAA,MAC9C,WAAW,UAAU,IAAI;AAAA,MAEzB,iCAAC,OAAI,EAAA,KAAK,kBAAkB,WAAW,UAAU,SAAS,GACzD,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA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AA;AAAA,UAAA,cAAA;AAAA,QAA4B,GAAAA,MAAA;AAAA,QAC5B;AAAA,UAAC;AAAA,UAAA;AAAA,YACA,SAAS;AAAA,YACT,WAAW,UAAU,cAAc;AAAA,YACnC,cAAW;AAAA,YACX,UAAA;AAAA,UAAA;AAAA,UAJD;AAAA,UAAA;AAAA,UAAA;AAAA,YAAA,UAAA;AAAA,YAAA,YAAA;AAAA,YAAA,cAAA;AAAA,UAAA;AAAA,UAAAA;AAAAA,QAAA;AAAA,MAMA,KARD,QAAA,MAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MASA,GAAAA,MAAA;AAAA,6BACC,OAAI,EAAA,WAAW,UAAU,YAAY,GACpC,SADF,GAAA,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAA,GAEAA,MAAA;AAAA,IAAA,KAbD,QAAA,MAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAcA,EAfD,GAAA,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAgBAA,MAAA;AAAA,EAAA,KA/BD,QAAA,MAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAgCA,GAAAA,MAAA;AAEF;"}
1
+ {"version":3,"file":"DevBar.js","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":["expanded","this"],"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,IAAI,SAAS,KAAK;AACxC,QAAA,gBAAgB,gBAAgB,QAAQ;AAExC,QAAA,eAAe,+BAA+B,MAAM;AAC7C,gBAAA,CAAAA,cAAY,CAACA,SAAQ;AAAA,EAAA,CACjC;AAED,YAAU,MAAM;AACf,aAAS,cAAc,OAAsB;AAC5C,UAAI,MAAM,SAAS,WAAW,MAAM,WAAW,MAAM,UAAU;AAC9D,cAAM,eAAe;AACrB,cAAM,gBAAgB;AAET,qBAAA;AAAA,MAAA;AAAA,IACd;AAGQ,aAAA,iBAAiB,WAAW,aAAa;AAClD,WAAO,MAAM,SAAS,oBAAoB,WAAW,aAAa;AAAA,EAAA,GAChE,CAAC,UAAU,YAAY,CAAC;AAErB,QAAA,mBAAmB,OAAuB,IAAI;AAEpD,mCAAiC,kBAAkB,MAAM;AACxD,QAAI,UAAU;AACb,kBAAY,KAAK;AAAA,IAAA;AAAA,EAClB,CACA;AAEK,QAAA,KAAK,gBAAgB,MAAO,CAAA;AAGjC,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,oBAAiB;AAAA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 const jsxDevRuntime = require("react/jsx-dev-runtime");
4
+ const useCopyErrorMarkdown = require("../../hooks/useCopyErrorMarkdown.cjs");
5
+ const DevErrorCopy = ({ currentError, currentErrorSource }) => {
6
+ const { copyStatus, handleCopyMarkdown, isClipboardSupported } = useCopyErrorMarkdown.useCopyErrorMarkdown({ currentError, currentErrorSource });
7
+ if (!isClipboardSupported) {
8
+ return null;
9
+ }
10
+ return /* @__PURE__ */ jsxDevRuntime.jsxDEV(
11
+ "button",
12
+ {
13
+ type: "button",
14
+ className: "cui-devError-copyButton",
15
+ onClick: handleCopyMarkdown,
16
+ disabled: copyStatus === "copying",
17
+ title: "Copy current error as Markdown",
18
+ children: {
19
+ success: "Copied!",
20
+ copying: "Copying...",
21
+ error: "❌ Copy Failed",
22
+ idle: "Copy as Markdown"
23
+ }[copyStatus]
24
+ },
25
+ void 0,
26
+ false,
27
+ {
28
+ fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorCopy.tsx",
29
+ lineNumber: 15,
30
+ columnNumber: 3
31
+ },
32
+ void 0
33
+ );
34
+ };
35
+ exports.DevErrorCopy = DevErrorCopy;
36
+ //# sourceMappingURL=DevErrorCopy.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DevErrorCopy.cjs","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevErrorCopy.tsx"],"sourcesContent":["import { useCopyErrorMarkdown } from '../../hooks/useCopyErrorMarkdown'\nimport { ProcessedError } from './types'\n\nexport const DevErrorCopy = ({ currentError, currentErrorSource }: {\n\tcurrentError: ProcessedError\n\tcurrentErrorSource: string\n}) => {\n\tconst { copyStatus, handleCopyMarkdown, isClipboardSupported } = useCopyErrorMarkdown({ currentError, currentErrorSource })\n\n\tif (!isClipboardSupported) {\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclassName=\"cui-devError-copyButton\"\n\t\t\tonClick={handleCopyMarkdown}\n\t\t\tdisabled={copyStatus === 'copying'}\n\t\t\ttitle=\"Copy current error as Markdown\"\n\t\t>\n\t\t\t{({\n\t\t\t\tsuccess: 'Copied!',\n\t\t\t\tcopying: 'Copying...',\n\t\t\t\terror: '❌ Copy Failed',\n\t\t\t\tidle: 'Copy as Markdown',\n\t\t\t}[copyStatus])}\n\t\t</button>\n\t)\n\n}\n"],"names":["useCopyErrorMarkdown","jsxDEV","this"],"mappings":";;;;AAGO,MAAM,eAAe,CAAC,EAAE,cAAc,yBAGvC;AACC,QAAA,EAAE,YAAY,oBAAoB,qBAAA,IAAyBA,qBAAAA,qBAAqB,EAAE,cAAc,oBAAoB;AAE1H,MAAI,CAAC,sBAAsB;AACnB,WAAA;AAAA,EAAA;AAIP,SAAAC,8BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,MAAK;AAAA,MACL,WAAU;AAAA,MACV,SAAS;AAAA,MACT,UAAU,eAAe;AAAA,MACzB,OAAM;AAAA,MAEJ,UAAA;AAAA,QACD,SAAS;AAAA,QACT,SAAS;AAAA,QACT,OAAO;AAAA,QACP,MAAM;AAAA,MAAA,EACL,UAAU;AAAA,IAAA;AAAA,IAZb;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAC;AAAAA,EAaA;AAGF;;"}
@@ -0,0 +1,36 @@
1
+ import { jsxDEV } from "react/jsx-dev-runtime";
2
+ import { useCopyErrorMarkdown } from "../../hooks/useCopyErrorMarkdown.js";
3
+ const DevErrorCopy = ({ currentError, currentErrorSource }) => {
4
+ const { copyStatus, handleCopyMarkdown, isClipboardSupported } = useCopyErrorMarkdown({ currentError, currentErrorSource });
5
+ if (!isClipboardSupported) {
6
+ return null;
7
+ }
8
+ return /* @__PURE__ */ jsxDEV(
9
+ "button",
10
+ {
11
+ type: "button",
12
+ className: "cui-devError-copyButton",
13
+ onClick: handleCopyMarkdown,
14
+ disabled: copyStatus === "copying",
15
+ title: "Copy current error as Markdown",
16
+ children: {
17
+ success: "Copied!",
18
+ copying: "Copying...",
19
+ error: "❌ Copy Failed",
20
+ idle: "Copy as Markdown"
21
+ }[copyStatus]
22
+ },
23
+ void 0,
24
+ false,
25
+ {
26
+ fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevErrorCopy.tsx",
27
+ lineNumber: 15,
28
+ columnNumber: 3
29
+ },
30
+ void 0
31
+ );
32
+ };
33
+ export {
34
+ DevErrorCopy
35
+ };
36
+ //# sourceMappingURL=DevErrorCopy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DevErrorCopy.js","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevErrorCopy.tsx"],"sourcesContent":["import { useCopyErrorMarkdown } from '../../hooks/useCopyErrorMarkdown'\nimport { ProcessedError } from './types'\n\nexport const DevErrorCopy = ({ currentError, currentErrorSource }: {\n\tcurrentError: ProcessedError\n\tcurrentErrorSource: string\n}) => {\n\tconst { copyStatus, handleCopyMarkdown, isClipboardSupported } = useCopyErrorMarkdown({ currentError, currentErrorSource })\n\n\tif (!isClipboardSupported) {\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclassName=\"cui-devError-copyButton\"\n\t\t\tonClick={handleCopyMarkdown}\n\t\t\tdisabled={copyStatus === 'copying'}\n\t\t\ttitle=\"Copy current error as Markdown\"\n\t\t>\n\t\t\t{({\n\t\t\t\tsuccess: 'Copied!',\n\t\t\t\tcopying: 'Copying...',\n\t\t\t\terror: '❌ Copy Failed',\n\t\t\t\tidle: 'Copy as Markdown',\n\t\t\t}[copyStatus])}\n\t\t</button>\n\t)\n\n}\n"],"names":["this"],"mappings":";;AAGO,MAAM,eAAe,CAAC,EAAE,cAAc,yBAGvC;AACC,QAAA,EAAE,YAAY,oBAAoB,qBAAA,IAAyB,qBAAqB,EAAE,cAAc,oBAAoB;AAE1H,MAAI,CAAC,sBAAsB;AACnB,WAAA;AAAA,EAAA;AAIP,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,MAAK;AAAA,MACL,WAAU;AAAA,MACV,SAAS;AAAA,MACT,UAAU,eAAe;AAAA,MACzB,OAAM;AAAA,MAEJ,UAAA;AAAA,QACD,SAAS;AAAA,QACT,SAAS;AAAA,QACT,OAAO;AAAA,QACP,MAAM;AAAA,MAAA,EACL,UAAU;AAAA,IAAA;AAAA,IAZb;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAaA;AAGF;"}