@contember/react-devbar 2.1.0-alpha.3 → 2.1.0-alpha.35

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 (114) hide show
  1. package/package.json +11 -11
  2. package/src/errorHandling.tsx +1 -8
  3. package/src/hooks/useCopyErrorMarkdown.ts +127 -0
  4. package/src/hooks/useParsedStacktrace.ts +1 -1
  5. package/src/index.css +27 -0
  6. package/src/ui/DevBar/DevBar.tsx +9 -13
  7. package/src/ui/DevError/DevErrorBadge.tsx +0 -1
  8. package/src/ui/DevError/DevErrorCopy.tsx +30 -0
  9. package/src/ui/DevError/DevErrorInner.tsx +26 -26
  10. package/src/ui/DevError/DevErrorList.tsx +25 -19
  11. package/src/ui/DevError/StackTrace.tsx +1 -4
  12. package/dist/development/index.cjs +0 -17
  13. package/dist/development/index.cjs.map +0 -1
  14. package/dist/development/index.js +0 -17
  15. package/dist/development/index.js.map +0 -1
  16. package/dist/development/src/DevErrorManager.cjs +0 -110
  17. package/dist/development/src/DevErrorManager.cjs.map +0 -1
  18. package/dist/development/src/DevErrorManager.js +0 -110
  19. package/dist/development/src/DevErrorManager.js.map +0 -1
  20. package/dist/development/src/errorHandling.cjs +0 -75
  21. package/dist/development/src/errorHandling.cjs.map +0 -1
  22. package/dist/development/src/errorHandling.js +0 -58
  23. package/dist/development/src/errorHandling.js.map +0 -1
  24. package/dist/development/src/hooks/useParsedStacktrace.cjs +0 -67
  25. package/dist/development/src/hooks/useParsedStacktrace.cjs.map +0 -1
  26. package/dist/development/src/hooks/useParsedStacktrace.js +0 -45
  27. package/dist/development/src/hooks/useParsedStacktrace.js.map +0 -1
  28. package/dist/development/src/ui/DevBar/DevBar.cjs +0 -191
  29. package/dist/development/src/ui/DevBar/DevBar.cjs.map +0 -1
  30. package/dist/development/src/ui/DevBar/DevBar.js +0 -191
  31. package/dist/development/src/ui/DevBar/DevBar.js.map +0 -1
  32. package/dist/development/src/ui/DevError/DevError.cjs +0 -33
  33. package/dist/development/src/ui/DevError/DevError.cjs.map +0 -1
  34. package/dist/development/src/ui/DevError/DevError.js +0 -33
  35. package/dist/development/src/ui/DevError/DevError.js.map +0 -1
  36. package/dist/development/src/ui/DevError/DevErrorBadge.cjs +0 -21
  37. package/dist/development/src/ui/DevError/DevErrorBadge.cjs.map +0 -1
  38. package/dist/development/src/ui/DevError/DevErrorBadge.js +0 -21
  39. package/dist/development/src/ui/DevError/DevErrorBadge.js.map +0 -1
  40. package/dist/development/src/ui/DevError/DevErrorInner.cjs +0 -79
  41. package/dist/development/src/ui/DevError/DevErrorInner.cjs.map +0 -1
  42. package/dist/development/src/ui/DevError/DevErrorInner.js +0 -79
  43. package/dist/development/src/ui/DevError/DevErrorInner.js.map +0 -1
  44. package/dist/development/src/ui/DevError/DevErrorList.cjs +0 -111
  45. package/dist/development/src/ui/DevError/DevErrorList.cjs.map +0 -1
  46. package/dist/development/src/ui/DevError/DevErrorList.js +0 -111
  47. package/dist/development/src/ui/DevError/DevErrorList.js.map +0 -1
  48. package/dist/development/src/ui/DevError/StackTrace.cjs +0 -82
  49. package/dist/development/src/ui/DevError/StackTrace.cjs.map +0 -1
  50. package/dist/development/src/ui/DevError/StackTrace.js +0 -82
  51. package/dist/development/src/ui/DevError/StackTrace.js.map +0 -1
  52. package/dist/production/index.cjs +0 -17
  53. package/dist/production/index.cjs.map +0 -1
  54. package/dist/production/index.js +0 -17
  55. package/dist/production/index.js.map +0 -1
  56. package/dist/production/src/errorHandling.cjs +0 -59
  57. package/dist/production/src/errorHandling.cjs.map +0 -1
  58. package/dist/production/src/errorHandling.js +0 -42
  59. package/dist/production/src/errorHandling.js.map +0 -1
  60. package/dist/production/src/hooks/useParsedStacktrace.cjs +0 -67
  61. package/dist/production/src/hooks/useParsedStacktrace.cjs.map +0 -1
  62. package/dist/production/src/hooks/useParsedStacktrace.js +0 -45
  63. package/dist/production/src/hooks/useParsedStacktrace.js.map +0 -1
  64. package/dist/production/src/ui/DevBar/DevBar.cjs +0 -123
  65. package/dist/production/src/ui/DevBar/DevBar.cjs.map +0 -1
  66. package/dist/production/src/ui/DevBar/DevBar.js +0 -123
  67. package/dist/production/src/ui/DevBar/DevBar.js.map +0 -1
  68. package/dist/production/src/ui/DevError/DevError.cjs +0 -13
  69. package/dist/production/src/ui/DevError/DevError.cjs.map +0 -1
  70. package/dist/production/src/ui/DevError/DevError.js +0 -13
  71. package/dist/production/src/ui/DevError/DevError.js.map +0 -1
  72. package/dist/production/src/ui/DevError/DevErrorBadge.cjs +0 -13
  73. package/dist/production/src/ui/DevError/DevErrorBadge.cjs.map +0 -1
  74. package/dist/production/src/ui/DevError/DevErrorBadge.js +0 -13
  75. package/dist/production/src/ui/DevError/DevErrorBadge.js.map +0 -1
  76. package/dist/production/src/ui/DevError/DevErrorInner.cjs +0 -23
  77. package/dist/production/src/ui/DevError/DevErrorInner.cjs.map +0 -1
  78. package/dist/production/src/ui/DevError/DevErrorInner.js +0 -23
  79. package/dist/production/src/ui/DevError/DevErrorInner.js.map +0 -1
  80. package/dist/production/src/ui/DevError/DevErrorList.cjs +0 -47
  81. package/dist/production/src/ui/DevError/DevErrorList.cjs.map +0 -1
  82. package/dist/production/src/ui/DevError/DevErrorList.js +0 -47
  83. package/dist/production/src/ui/DevError/DevErrorList.js.map +0 -1
  84. package/dist/production/src/ui/DevError/StackTrace.cjs +0 -39
  85. package/dist/production/src/ui/DevError/StackTrace.cjs.map +0 -1
  86. package/dist/production/src/ui/DevError/StackTrace.js +0 -39
  87. package/dist/production/src/ui/DevError/StackTrace.js.map +0 -1
  88. package/dist/types/DevErrorManager.d.ts +0 -15
  89. package/dist/types/DevErrorManager.d.ts.map +0 -1
  90. package/dist/types/errorHandling.d.ts +0 -6
  91. package/dist/types/errorHandling.d.ts.map +0 -1
  92. package/dist/types/hooks/useParsedStacktrace.d.ts +0 -10
  93. package/dist/types/hooks/useParsedStacktrace.d.ts.map +0 -1
  94. package/dist/types/index.d.ts +0 -5
  95. package/dist/types/index.d.ts.map +0 -1
  96. package/dist/types/tsconfig.tsbuildinfo +0 -1
  97. package/dist/types/ui/DevBar/DevBar.d.ts +0 -13
  98. package/dist/types/ui/DevBar/DevBar.d.ts.map +0 -1
  99. package/dist/types/ui/DevBar/index.d.ts +0 -2
  100. package/dist/types/ui/DevBar/index.d.ts.map +0 -1
  101. package/dist/types/ui/DevError/DevError.d.ts +0 -6
  102. package/dist/types/ui/DevError/DevError.d.ts.map +0 -1
  103. package/dist/types/ui/DevError/DevErrorBadge.d.ts +0 -7
  104. package/dist/types/ui/DevError/DevErrorBadge.d.ts.map +0 -1
  105. package/dist/types/ui/DevError/DevErrorInner.d.ts +0 -7
  106. package/dist/types/ui/DevError/DevErrorInner.d.ts.map +0 -1
  107. package/dist/types/ui/DevError/DevErrorList.d.ts +0 -13
  108. package/dist/types/ui/DevError/DevErrorList.d.ts.map +0 -1
  109. package/dist/types/ui/DevError/StackTrace.d.ts +0 -5
  110. package/dist/types/ui/DevError/StackTrace.d.ts.map +0 -1
  111. package/dist/types/ui/DevError/index.d.ts +0 -5
  112. package/dist/types/ui/DevError/index.d.ts.map +0 -1
  113. package/dist/types/ui/DevError/types.d.ts +0 -15
  114. package/dist/types/ui/DevError/types.d.ts.map +0 -1
@@ -1,67 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
25
- const React = require("react");
26
- const parseStacktrace = async (e) => {
27
- let StackTracey;
28
- try {
29
- StackTracey = (await import("stacktracey")).default;
30
- } catch {
31
- return void 0;
32
- }
33
- return (await new StackTracey(e).withSourcesAsync()).items.map((it) => ({
34
- filename: it.fileShort,
35
- line: it.line,
36
- callee: it.callee,
37
- thirdParty: it.thirdParty,
38
- sourceCodeLines: it.sourceFile?.lines
39
- }));
40
- };
41
- const createInitialError = (e) => ({
42
- error: e,
43
- cause: e instanceof Error && "cause" in e && e.cause !== void 0 ? createInitialError(e.cause) : void 0
44
- });
45
- const useProcessedError = (e) => {
46
- const [error, setError] = React.useState(() => createInitialError(e));
47
- React.useEffect(() => {
48
- setError(createInitialError(e));
49
- if (!(e instanceof Error)) {
50
- return;
51
- }
52
- const createErrorWithStackTrace = async (e2) => {
53
- return {
54
- error: e2,
55
- parsedStackStrace: e2 instanceof Error ? await parseStacktrace(e2) : void 0,
56
- cause: e2 instanceof Error && "cause" in e2 && e2.cause !== void 0 ? await createErrorWithStackTrace(e2.cause) : void 0
57
- };
58
- };
59
- (async () => {
60
- setError(await createErrorWithStackTrace(e));
61
- })();
62
- }, [e]);
63
- return error;
64
- };
65
- exports.parseStacktrace = parseStacktrace;
66
- exports.useProcessedError = useProcessedError;
67
- //# sourceMappingURL=useParsedStacktrace.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useParsedStacktrace.cjs","sources":["../../../../../packages/react-devbar/src/hooks/useParsedStacktrace.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { ErrorType, ProcessedError } from '../ui/DevError'\n\nexport const parseStacktrace = async (e: Error) => {\n\tlet StackTracey\n\ttry {\n\t\tStackTracey = (await import('stacktracey')).default\n\t} catch {\n\t\treturn undefined\n\t}\n\treturn (await new StackTracey(e).withSourcesAsync()).items.map(it => ({\n\t\tfilename: it.fileShort,\n\t\tline: it.line,\n\t\tcallee: it.callee,\n\t\tthirdParty: it.thirdParty,\n\t\tsourceCodeLines: it.sourceFile?.lines,\n\t}))\n}\n\nconst createInitialError = (e: ErrorType): ProcessedError => ({\n\terror: e,\n\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? createInitialError((e as any).cause) : undefined,\n})\n\nexport const useProcessedError = (e: ErrorType): ProcessedError => {\n\tconst [error, setError] = useState<ProcessedError>(() => createInitialError(e))\n\tuseEffect(() => {\n\t\tsetError(createInitialError(e))\n\t\tif (!(e instanceof Error)) {\n\t\t\treturn\n\t\t}\n\t\tconst createErrorWithStackTrace = async (e: ErrorType): Promise<ProcessedError> => {\n\t\t\treturn {\n\t\t\t\terror: e,\n\t\t\t\tparsedStackStrace: e instanceof Error ? await parseStacktrace(e) : undefined,\n\t\t\t\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? await createErrorWithStackTrace((e as any).cause) : undefined,\n\t\t\t}\n\t\t}\n\t\t(async () => {\n\t\t\tsetError(await createErrorWithStackTrace(e))\n\t\t})()\n\t}, [e])\n\n\treturn error\n}\n"],"names":["useState","useEffect","e"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGa,MAAA,kBAAkB,OAAO,MAAa;AAC9C,MAAA;AACA,MAAA;AACY,mBAAA,MAAM,OAAO,aAAa,GAAG;AAAA,EAAA,QACrC;AACA,WAAA;AAAA,EAAA;AAEA,UAAA,MAAM,IAAI,YAAY,CAAC,EAAE,iBAAiB,GAAG,MAAM,IAAI,CAAO,QAAA;AAAA,IACrE,UAAU,GAAG;AAAA,IACb,MAAM,GAAG;AAAA,IACT,QAAQ,GAAG;AAAA,IACX,YAAY,GAAG;AAAA,IACf,iBAAiB,GAAG,YAAY;AAAA,EAAA,EAC/B;AACH;AAEA,MAAM,qBAAqB,CAAC,OAAkC;AAAA,EAC7D,OAAO;AAAA,EACP,OAAO,aAAa,SAAS,WAAW,KAAM,EAAU,UAAU,SAAY,mBAAoB,EAAU,KAAK,IAAI;AACtH;AAEa,MAAA,oBAAoB,CAAC,MAAiC;AAC5D,QAAA,CAAC,OAAO,QAAQ,IAAIA,eAAyB,MAAM,mBAAmB,CAAC,CAAC;AAC9EC,QAAAA,UAAU,MAAM;AACN,aAAA,mBAAmB,CAAC,CAAC;AAC1B,QAAA,EAAE,aAAa,QAAQ;AAC1B;AAAA,IAAA;AAEK,UAAA,4BAA4B,OAAOC,OAA0C;AAC3E,aAAA;AAAA,QACN,OAAOA;AAAAA,QACP,mBAAmBA,cAAa,QAAQ,MAAM,gBAAgBA,EAAC,IAAI;AAAA,QACnE,OAAOA,cAAa,SAAS,WAAWA,MAAMA,GAAU,UAAU,SAAY,MAAM,0BAA2BA,GAAU,KAAK,IAAI;AAAA,MACnI;AAAA,IACD;AACA,KAAC,YAAY;AACH,eAAA,MAAM,0BAA0B,CAAC,CAAC;AAAA,IAAA,GACzC;AAAA,EAAA,GACD,CAAC,CAAC,CAAC;AAEC,SAAA;AACR;;;"}
@@ -1,45 +0,0 @@
1
- import { useState, useEffect } from "react";
2
- const parseStacktrace = async (e) => {
3
- let StackTracey;
4
- try {
5
- StackTracey = (await import("stacktracey")).default;
6
- } catch {
7
- return void 0;
8
- }
9
- return (await new StackTracey(e).withSourcesAsync()).items.map((it) => ({
10
- filename: it.fileShort,
11
- line: it.line,
12
- callee: it.callee,
13
- thirdParty: it.thirdParty,
14
- sourceCodeLines: it.sourceFile?.lines
15
- }));
16
- };
17
- const createInitialError = (e) => ({
18
- error: e,
19
- cause: e instanceof Error && "cause" in e && e.cause !== void 0 ? createInitialError(e.cause) : void 0
20
- });
21
- const useProcessedError = (e) => {
22
- const [error, setError] = useState(() => createInitialError(e));
23
- useEffect(() => {
24
- setError(createInitialError(e));
25
- if (!(e instanceof Error)) {
26
- return;
27
- }
28
- const createErrorWithStackTrace = async (e2) => {
29
- return {
30
- error: e2,
31
- parsedStackStrace: e2 instanceof Error ? await parseStacktrace(e2) : void 0,
32
- cause: e2 instanceof Error && "cause" in e2 && e2.cause !== void 0 ? await createErrorWithStackTrace(e2.cause) : void 0
33
- };
34
- };
35
- (async () => {
36
- setError(await createErrorWithStackTrace(e));
37
- })();
38
- }, [e]);
39
- return error;
40
- };
41
- export {
42
- parseStacktrace,
43
- useProcessedError
44
- };
45
- //# sourceMappingURL=useParsedStacktrace.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useParsedStacktrace.js","sources":["../../../../../packages/react-devbar/src/hooks/useParsedStacktrace.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { ErrorType, ProcessedError } from '../ui/DevError'\n\nexport const parseStacktrace = async (e: Error) => {\n\tlet StackTracey\n\ttry {\n\t\tStackTracey = (await import('stacktracey')).default\n\t} catch {\n\t\treturn undefined\n\t}\n\treturn (await new StackTracey(e).withSourcesAsync()).items.map(it => ({\n\t\tfilename: it.fileShort,\n\t\tline: it.line,\n\t\tcallee: it.callee,\n\t\tthirdParty: it.thirdParty,\n\t\tsourceCodeLines: it.sourceFile?.lines,\n\t}))\n}\n\nconst createInitialError = (e: ErrorType): ProcessedError => ({\n\terror: e,\n\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? createInitialError((e as any).cause) : undefined,\n})\n\nexport const useProcessedError = (e: ErrorType): ProcessedError => {\n\tconst [error, setError] = useState<ProcessedError>(() => createInitialError(e))\n\tuseEffect(() => {\n\t\tsetError(createInitialError(e))\n\t\tif (!(e instanceof Error)) {\n\t\t\treturn\n\t\t}\n\t\tconst createErrorWithStackTrace = async (e: ErrorType): Promise<ProcessedError> => {\n\t\t\treturn {\n\t\t\t\terror: e,\n\t\t\t\tparsedStackStrace: e instanceof Error ? await parseStacktrace(e) : undefined,\n\t\t\t\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? await createErrorWithStackTrace((e as any).cause) : undefined,\n\t\t\t}\n\t\t}\n\t\t(async () => {\n\t\t\tsetError(await createErrorWithStackTrace(e))\n\t\t})()\n\t}, [e])\n\n\treturn error\n}\n"],"names":["e"],"mappings":";AAGa,MAAA,kBAAkB,OAAO,MAAa;AAC9C,MAAA;AACA,MAAA;AACY,mBAAA,MAAM,OAAO,aAAa,GAAG;AAAA,EAAA,QACrC;AACA,WAAA;AAAA,EAAA;AAEA,UAAA,MAAM,IAAI,YAAY,CAAC,EAAE,iBAAiB,GAAG,MAAM,IAAI,CAAO,QAAA;AAAA,IACrE,UAAU,GAAG;AAAA,IACb,MAAM,GAAG;AAAA,IACT,QAAQ,GAAG;AAAA,IACX,YAAY,GAAG;AAAA,IACf,iBAAiB,GAAG,YAAY;AAAA,EAAA,EAC/B;AACH;AAEA,MAAM,qBAAqB,CAAC,OAAkC;AAAA,EAC7D,OAAO;AAAA,EACP,OAAO,aAAa,SAAS,WAAW,KAAM,EAAU,UAAU,SAAY,mBAAoB,EAAU,KAAK,IAAI;AACtH;AAEa,MAAA,oBAAoB,CAAC,MAAiC;AAC5D,QAAA,CAAC,OAAO,QAAQ,IAAI,SAAyB,MAAM,mBAAmB,CAAC,CAAC;AAC9E,YAAU,MAAM;AACN,aAAA,mBAAmB,CAAC,CAAC;AAC1B,QAAA,EAAE,aAAa,QAAQ;AAC1B;AAAA,IAAA;AAEK,UAAA,4BAA4B,OAAOA,OAA0C;AAC3E,aAAA;AAAA,QACN,OAAOA;AAAAA,QACP,mBAAmBA,cAAa,QAAQ,MAAM,gBAAgBA,EAAC,IAAI;AAAA,QACnE,OAAOA,cAAa,SAAS,WAAWA,MAAMA,GAAU,UAAU,SAAY,MAAM,0BAA2BA,GAAU,KAAK,IAAI;AAAA,MACnI;AAAA,IACD;AACA,KAAC,YAAY;AACH,eAAA,MAAM,0BAA0B,CAAC,CAAC;AAAA,IAAA,GACzC;AAAA,EAAA,GACD,CAAC,CAAC,CAAC;AAEC,SAAA;AACR;"}
@@ -1,123 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const reactUtils = require("@contember/react-utils");
5
- const utilities = require("@contember/utilities");
6
- const React = require("react");
7
- const className = (cls) => cls ? `cui-devBar-${cls}` : "cui-devBar";
8
- const DevBar = ({
9
- breakpoint = 768,
10
- children
11
- }) => {
12
- const [expanded, setExpanded] = React.useState(false);
13
- const isSmallScreen = reactUtils.useWindowSize().width < breakpoint;
14
- const handleToggle = reactUtils.useReferentiallyStableCallback(() => {
15
- setExpanded((expanded2) => !expanded2);
16
- });
17
- React.useEffect(() => {
18
- function handleKeyDown(event) {
19
- if (event.code === "KeyJ" && (event.ctrlKey || event.metaKey)) {
20
- event.preventDefault();
21
- event.stopPropagation();
22
- handleToggle();
23
- }
24
- }
25
- document.addEventListener("keydown", handleKeyDown);
26
- return () => document.removeEventListener("keydown", handleKeyDown);
27
- }, [expanded, handleToggle]);
28
- const devBarContentRef = React.useRef(null);
29
- reactUtils.useOnElementClickOutsideCallback(devBarContentRef, () => {
30
- if (expanded) {
31
- setExpanded(false);
32
- }
33
- });
34
- const id = `dev-bar-panel${reactUtils.useId()}`;
35
- return /* @__PURE__ */ jsxRuntime.jsx(
36
- "section",
37
- {
38
- "data-transparent": "true",
39
- "data-overrides-lucide-icons": "true",
40
- "data-expanded": utilities.dataAttribute(expanded),
41
- "data-small-screen": utilities.dataAttribute(isSmallScreen),
42
- className: className(null),
43
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: devBarContentRef, className: className("content"), children: /* @__PURE__ */ jsxRuntime.jsx(
44
- "div",
45
- {
46
- "data-expanded": true,
47
- id,
48
- role: "dialog",
49
- style: { display: "contents" },
50
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: className("panels"), children })
51
- }
52
- ) })
53
- }
54
- );
55
- };
56
- const DevPanel = ({ heading, icon, children, preview }) => {
57
- const id = `cui-devBar-panel-${reactUtils.useId()}`;
58
- const dialogRef = React.useRef(null);
59
- const triggerRef = React.useRef(null);
60
- const handleOpen = React.useCallback(() => {
61
- dialogRef.current?.showModal();
62
- }, []);
63
- const handleClose = React.useCallback(() => {
64
- dialogRef.current?.close();
65
- }, []);
66
- React.useEffect(() => {
67
- const dialog = dialogRef.current;
68
- if (!dialog) return;
69
- const handleClickOutside = (event) => {
70
- const rect = dialog.getBoundingClientRect();
71
- const isInDialog = rect.top <= event.clientY && event.clientY <= rect.top + rect.height && rect.left <= event.clientX && event.clientX <= rect.left + rect.width;
72
- if (!isInDialog) {
73
- dialog.close();
74
- }
75
- };
76
- dialog.addEventListener("click", handleClickOutside);
77
- return () => dialog.removeEventListener("click", handleClickOutside);
78
- }, []);
79
- React.useEffect(() => {
80
- const handleEscape = (event) => {
81
- if (event.key === "Escape") {
82
- handleClose();
83
- }
84
- };
85
- document.addEventListener("keydown", handleEscape);
86
- return () => document.removeEventListener("keydown", handleEscape);
87
- }, [handleClose]);
88
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: className("trigger"), children: [
89
- /* @__PURE__ */ jsxRuntime.jsxs(
90
- "button",
91
- {
92
- ref: triggerRef,
93
- tabIndex: 0,
94
- "aria-haspopup": "dialog",
95
- "aria-controls": id,
96
- className: className("trigger-label"),
97
- onClick: handleOpen,
98
- children: [
99
- icon,
100
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: className("trigger-label-text"), children: preview ?? heading })
101
- ]
102
- }
103
- ),
104
- /* @__PURE__ */ jsxRuntime.jsx("dialog", { ref: dialogRef, id, className: className("panel"), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: className("panel-content"), children: [
105
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: className("panel-header"), children: [
106
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "h4", children: heading }),
107
- /* @__PURE__ */ jsxRuntime.jsx(
108
- "button",
109
- {
110
- onClick: handleClose,
111
- className: className("close-button"),
112
- "aria-label": "Close",
113
- children: "✕"
114
- }
115
- )
116
- ] }),
117
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: className("panel-body"), children })
118
- ] }) })
119
- ] });
120
- };
121
- exports.DevBar = DevBar;
122
- exports.DevPanel = DevPanel;
123
- //# sourceMappingURL=DevBar.cjs.map
@@ -1 +0,0 @@
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;A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,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,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,123 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useWindowSize, useReferentiallyStableCallback, useOnElementClickOutsideCallback, useId } from "@contember/react-utils";
3
- import { dataAttribute } from "@contember/utilities";
4
- import { useState, useEffect, useRef, useCallback } from "react";
5
- const className = (cls) => cls ? `cui-devBar-${cls}` : "cui-devBar";
6
- const DevBar = ({
7
- breakpoint = 768,
8
- children
9
- }) => {
10
- const [expanded, setExpanded] = useState(false);
11
- const isSmallScreen = useWindowSize().width < breakpoint;
12
- const handleToggle = useReferentiallyStableCallback(() => {
13
- setExpanded((expanded2) => !expanded2);
14
- });
15
- useEffect(() => {
16
- function handleKeyDown(event) {
17
- if (event.code === "KeyJ" && (event.ctrlKey || event.metaKey)) {
18
- event.preventDefault();
19
- event.stopPropagation();
20
- handleToggle();
21
- }
22
- }
23
- document.addEventListener("keydown", handleKeyDown);
24
- return () => document.removeEventListener("keydown", handleKeyDown);
25
- }, [expanded, handleToggle]);
26
- const devBarContentRef = useRef(null);
27
- useOnElementClickOutsideCallback(devBarContentRef, () => {
28
- if (expanded) {
29
- setExpanded(false);
30
- }
31
- });
32
- const id = `dev-bar-panel${useId()}`;
33
- return /* @__PURE__ */ jsx(
34
- "section",
35
- {
36
- "data-transparent": "true",
37
- "data-overrides-lucide-icons": "true",
38
- "data-expanded": dataAttribute(expanded),
39
- "data-small-screen": dataAttribute(isSmallScreen),
40
- className: className(null),
41
- children: /* @__PURE__ */ jsx("div", { ref: devBarContentRef, className: className("content"), children: /* @__PURE__ */ jsx(
42
- "div",
43
- {
44
- "data-expanded": true,
45
- id,
46
- role: "dialog",
47
- style: { display: "contents" },
48
- children: /* @__PURE__ */ jsx("div", { className: className("panels"), children })
49
- }
50
- ) })
51
- }
52
- );
53
- };
54
- const DevPanel = ({ heading, icon, children, preview }) => {
55
- const id = `cui-devBar-panel-${useId()}`;
56
- const dialogRef = useRef(null);
57
- const triggerRef = useRef(null);
58
- const handleOpen = useCallback(() => {
59
- dialogRef.current?.showModal();
60
- }, []);
61
- const handleClose = useCallback(() => {
62
- dialogRef.current?.close();
63
- }, []);
64
- useEffect(() => {
65
- const dialog = dialogRef.current;
66
- if (!dialog) return;
67
- const handleClickOutside = (event) => {
68
- const rect = dialog.getBoundingClientRect();
69
- const isInDialog = rect.top <= event.clientY && event.clientY <= rect.top + rect.height && rect.left <= event.clientX && event.clientX <= rect.left + rect.width;
70
- if (!isInDialog) {
71
- dialog.close();
72
- }
73
- };
74
- dialog.addEventListener("click", handleClickOutside);
75
- return () => dialog.removeEventListener("click", handleClickOutside);
76
- }, []);
77
- useEffect(() => {
78
- const handleEscape = (event) => {
79
- if (event.key === "Escape") {
80
- handleClose();
81
- }
82
- };
83
- document.addEventListener("keydown", handleEscape);
84
- return () => document.removeEventListener("keydown", handleEscape);
85
- }, [handleClose]);
86
- return /* @__PURE__ */ jsxs("div", { className: className("trigger"), children: [
87
- /* @__PURE__ */ jsxs(
88
- "button",
89
- {
90
- ref: triggerRef,
91
- tabIndex: 0,
92
- "aria-haspopup": "dialog",
93
- "aria-controls": id,
94
- className: className("trigger-label"),
95
- onClick: handleOpen,
96
- children: [
97
- icon,
98
- /* @__PURE__ */ jsx("span", { className: className("trigger-label-text"), children: preview ?? heading })
99
- ]
100
- }
101
- ),
102
- /* @__PURE__ */ jsx("dialog", { ref: dialogRef, id, className: className("panel"), children: /* @__PURE__ */ jsxs("div", { className: className("panel-content"), children: [
103
- /* @__PURE__ */ jsxs("div", { className: className("panel-header"), children: [
104
- /* @__PURE__ */ jsx("h2", { className: "h4", children: heading }),
105
- /* @__PURE__ */ jsx(
106
- "button",
107
- {
108
- onClick: handleClose,
109
- className: className("close-button"),
110
- "aria-label": "Close",
111
- children: "✕"
112
- }
113
- )
114
- ] }),
115
- /* @__PURE__ */ jsx("div", { className: className("panel-body"), children })
116
- ] }) })
117
- ] });
118
- };
119
- export {
120
- DevBar,
121
- DevPanel
122
- };
123
- //# sourceMappingURL=DevBar.js.map
@@ -1 +0,0 @@
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\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AA,QACV,iBAAc;AAAA,QACd,iBAAe;AAAA,QACf,WAAW,UAAU,eAAe;AAAA,QACpC,SAAS;AAAA,QAER,UAAA;AAAA,UAAA;AAAA,8BACA,QAAK,EAAA,WAAW,UAAU,oBAAoB,GAC7C,qBAAW,QACb,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACD;AAAA,IAEC,oBAAA,UAAA,EAAO,KAAK,WAAW,IAAQ,WAAW,UAAU,OAAO,GAC3D,UAAC,qBAAA,OAAA,EAAI,WAAW,UAAU,eAAe,GACxC,UAAA;AAAA,MAAA,qBAAC,OAAI,EAAA,WAAW,UAAU,cAAc,GACvC,UAAA;AAAA,QAAC,oBAAA,MAAA,EAAG,WAAU,MAAM,UAAQ,SAAA;AAAA,QAC5B;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,0BACC,OAAI,EAAA,WAAW,UAAU,YAAY,GACpC,SACF,CAAA;AAAA,IAAA,EAAA,CACD,EACD,CAAA;AAAA,EAAA,GACD;AAEF;"}
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const DevErrorInner = require("./DevErrorInner.cjs");
5
- const className = (cls) => cls ? `cui-devError-${cls}` : "cui-devError";
6
- function DevError(props) {
7
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: className(), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: className("in"), children: [
8
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: className("bar"), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: className("errorSource"), children: props.source }) }),
9
- /* @__PURE__ */ jsxRuntime.jsx(DevErrorInner.DevErrorInner, { error: props.error })
10
- ] }) });
11
- }
12
- exports.DevError = DevError;
13
- //# sourceMappingURL=DevError.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DevError.cjs","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevError.tsx"],"sourcesContent":["import { DevErrorInner, DevErrorInnerProps } from './DevErrorInner'\n\nexport interface DevErrorProps extends DevErrorInnerProps {\n\tsource: string\n}\n\nconst className = (cls?: string | null) => cls ? `cui-devError-${cls}` : 'cui-devError'\n\nexport function DevError(props: DevErrorProps) {\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')}>{props.source}</div>\n\t\t\t\t</div>\n\t\t\t\t<DevErrorInner error={props.error} />\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"names":["jsx","DevErrorInner"],"mappings":";;;;AAMA,MAAM,YAAY,CAAC,QAAwB,MAAM,gBAAgB,GAAG,KAAK;AAElE,SAAS,SAAS,OAAsB;AAE7C,SAAAA,2BAAA,IAAC,OAAI,EAAA,WAAW,UAAU,GACzB,0CAAC,OAAI,EAAA,WAAW,UAAU,IAAI,GAC7B,UAAA;AAAA,IAAAA,2BAAA,IAAC,OAAI,EAAA,WAAW,UAAU,KAAK,GAC9B,UAAAA,+BAAC,OAAI,EAAA,WAAW,UAAU,aAAa,GAAI,UAAA,MAAM,OAAO,CAAA,GACzD;AAAA,IACCA,2BAAAA,IAAAC,cAAAA,eAAA,EAAc,OAAO,MAAM,MAAO,CAAA;AAAA,EAAA,EAAA,CACpC,EACD,CAAA;AAEF;;"}
@@ -1,13 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { DevErrorInner } from "./DevErrorInner.js";
3
- const className = (cls) => cls ? `cui-devError-${cls}` : "cui-devError";
4
- function DevError(props) {
5
- return /* @__PURE__ */ jsx("div", { className: className(), children: /* @__PURE__ */ jsxs("div", { className: className("in"), children: [
6
- /* @__PURE__ */ jsx("div", { className: className("bar"), children: /* @__PURE__ */ jsx("div", { className: className("errorSource"), children: props.source }) }),
7
- /* @__PURE__ */ jsx(DevErrorInner, { error: props.error })
8
- ] }) });
9
- }
10
- export {
11
- DevError
12
- };
13
- //# sourceMappingURL=DevError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DevError.js","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevError.tsx"],"sourcesContent":["import { DevErrorInner, DevErrorInnerProps } from './DevErrorInner'\n\nexport interface DevErrorProps extends DevErrorInnerProps {\n\tsource: string\n}\n\nconst className = (cls?: string | null) => cls ? `cui-devError-${cls}` : 'cui-devError'\n\nexport function DevError(props: DevErrorProps) {\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')}>{props.source}</div>\n\t\t\t\t</div>\n\t\t\t\t<DevErrorInner error={props.error} />\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"names":[],"mappings":";;AAMA,MAAM,YAAY,CAAC,QAAwB,MAAM,gBAAgB,GAAG,KAAK;AAElE,SAAS,SAAS,OAAsB;AAE7C,SAAA,oBAAC,OAAI,EAAA,WAAW,UAAU,GACzB,+BAAC,OAAI,EAAA,WAAW,UAAU,IAAI,GAC7B,UAAA;AAAA,IAAA,oBAAC,OAAI,EAAA,WAAW,UAAU,KAAK,GAC9B,UAAA,oBAAC,OAAI,EAAA,WAAW,UAAU,aAAa,GAAI,UAAA,MAAM,OAAO,CAAA,GACzD;AAAA,IACC,oBAAA,eAAA,EAAc,OAAO,MAAM,MAAO,CAAA;AAAA,EAAA,EAAA,CACpC,EACD,CAAA;AAEF;"}
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const className = (cls) => cls ? `cui-devErrorBadge-${cls}` : "cui-devErrorBadge";
5
- function DevErrorBadge({ errorCount, onOpen, onClear }) {
6
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: className(), children: /* @__PURE__ */ jsxRuntime.jsxs("a", { className: className("button"), onClick: onOpen, children: [
7
- errorCount,
8
- " ",
9
- errorCount > 1 ? "errors" : "error"
10
- ] }) });
11
- }
12
- exports.DevErrorBadge = DevErrorBadge;
13
- //# sourceMappingURL=DevErrorBadge.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DevErrorBadge.cjs","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevErrorBadge.tsx"],"sourcesContent":["export interface DevErrorBadgeProps {\n\tonOpen: () => void\n\tonClear: () => void\n\terrorCount: number\n}\n\n\nconst className = (cls?: string | null) => cls ? `cui-devErrorBadge-${cls}` : 'cui-devErrorBadge'\n\nexport function DevErrorBadge({ errorCount, onOpen, onClear }: DevErrorBadgeProps) {\n\treturn (\n\t\t<div className={className()}>\n\t\t\t<a className={className('button')} onClick={onOpen}>\n\t\t\t\t{errorCount} {errorCount > 1 ? 'errors' : 'error'}\n\t\t\t</a>\n\t\t</div>\n\t)\n}\n"],"names":["jsx","jsxs"],"mappings":";;;AAOA,MAAM,YAAY,CAAC,QAAwB,MAAM,qBAAqB,GAAG,KAAK;AAEvE,SAAS,cAAc,EAAE,YAAY,QAAQ,WAA+B;AAClF,SACEA,2BAAAA,IAAA,OAAA,EAAI,WAAW,UAAA,GACf,UAAAC,2BAAA,KAAC,KAAE,EAAA,WAAW,UAAU,QAAQ,GAAG,SAAS,QAC1C,UAAA;AAAA,IAAA;AAAA,IAAW;AAAA,IAAE,aAAa,IAAI,WAAW;AAAA,EAAA,EAAA,CAC3C,EACD,CAAA;AAEF;;"}
@@ -1,13 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- const className = (cls) => cls ? `cui-devErrorBadge-${cls}` : "cui-devErrorBadge";
3
- function DevErrorBadge({ errorCount, onOpen, onClear }) {
4
- return /* @__PURE__ */ jsx("div", { className: className(), children: /* @__PURE__ */ jsxs("a", { className: className("button"), onClick: onOpen, children: [
5
- errorCount,
6
- " ",
7
- errorCount > 1 ? "errors" : "error"
8
- ] }) });
9
- }
10
- export {
11
- DevErrorBadge
12
- };
13
- //# sourceMappingURL=DevErrorBadge.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DevErrorBadge.js","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevErrorBadge.tsx"],"sourcesContent":["export interface DevErrorBadgeProps {\n\tonOpen: () => void\n\tonClear: () => void\n\terrorCount: number\n}\n\n\nconst className = (cls?: string | null) => cls ? `cui-devErrorBadge-${cls}` : 'cui-devErrorBadge'\n\nexport function DevErrorBadge({ errorCount, onOpen, onClear }: DevErrorBadgeProps) {\n\treturn (\n\t\t<div className={className()}>\n\t\t\t<a className={className('button')} onClick={onOpen}>\n\t\t\t\t{errorCount} {errorCount > 1 ? 'errors' : 'error'}\n\t\t\t</a>\n\t\t</div>\n\t)\n}\n"],"names":[],"mappings":";AAOA,MAAM,YAAY,CAAC,QAAwB,MAAM,qBAAqB,GAAG,KAAK;AAEvE,SAAS,cAAc,EAAE,YAAY,QAAQ,WAA+B;AAClF,SACE,oBAAA,OAAA,EAAI,WAAW,UAAA,GACf,UAAA,qBAAC,KAAE,EAAA,WAAW,UAAU,QAAQ,GAAG,SAAS,QAC1C,UAAA;AAAA,IAAA;AAAA,IAAW;AAAA,IAAE,aAAa,IAAI,WAAW;AAAA,EAAA,EAAA,CAC3C,EACD,CAAA;AAEF;"}
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const StackTrace = require("./StackTrace.cjs");
5
- const className = (cls) => cls ? `cui-devError-${cls}` : "cui-devError";
6
- function DevErrorInner({ error, level = 1 }) {
7
- let errorObject = error.error instanceof Error ? error.error : void 0;
8
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: className("header"), children: errorObject ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10
- /* @__PURE__ */ jsxRuntime.jsx("h1", { className: className("errorName"), children: errorObject.name }),
11
- error.cause && /* @__PURE__ */ jsxRuntime.jsx("a", { href: `#error-${level}`, className: className("causeLink"), children: "caused by >" }),
12
- errorObject.message && /* @__PURE__ */ jsxRuntime.jsx("h2", { className: className("errorMessage"), children: errorObject.message }),
13
- "details" in errorObject && /* @__PURE__ */ jsxRuntime.jsx("div", { className: className("errorDetails"), children: errorObject.details })
14
- ] }) : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: className("errorName"), children: "Unknown error" }) }),
15
- error.parsedStackStrace ? /* @__PURE__ */ jsxRuntime.jsx(StackTrace.StackTrace, { stackTrace: error.parsedStackStrace }) : errorObject?.stack ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: className("stack"), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: className("stack-dump"), children: errorObject.stack }) }) : null,
16
- error.cause ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
17
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: className("causedBy"), id: `error-${level}`, children: "Caused by" }),
18
- /* @__PURE__ */ jsxRuntime.jsx(DevErrorInner, { error: error.cause, level: level + 1 })
19
- ] }) : null
20
- ] });
21
- }
22
- exports.DevErrorInner = DevErrorInner;
23
- //# sourceMappingURL=DevErrorInner.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DevErrorInner.cjs","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevErrorInner.tsx"],"sourcesContent":["import { StackTrace } from './StackTrace'\nimport type { ProcessedError } from './types'\n\nexport interface DevErrorInnerProps {\n\terror: ProcessedError\n\tlevel?: number\n}\n\n\nconst className = (cls?: string | null) => cls ? `cui-devError-${cls}` : 'cui-devError'\n\nexport function DevErrorInner({ error, level = 1 }: DevErrorInnerProps) {\n\n\tlet errorObject: Error | undefined = error.error instanceof Error ? error.error : undefined\n\n\treturn (\n\t\t<>\n\t\t\t<div className={className('header')}>\n\t\t\t\t{errorObject ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<h1 className={className('errorName')}>{errorObject.name}</h1>\n\t\t\t\t\t\t{error.cause && <a href={`#error-${level}`} className={className('causeLink')}>caused by &gt;</a>}\n\t\t\t\t\t\t{errorObject.message && <h2 className={className('errorMessage')}>{errorObject.message}</h2>}\n\t\t\t\t\t\t{'details' in errorObject && <div className={className('errorDetails')}>{(errorObject as any).details}</div>}\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\t<h1 className={className('errorName')}>Unknown error</h1>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t\t{error.parsedStackStrace ? (\n\t\t\t\t<StackTrace stackTrace={error.parsedStackStrace} />\n\t\t\t) : errorObject?.stack ? (\n\t\t\t\t<div className={className('stack')}>\n\t\t\t\t\t<div className={className('stack-dump')}>{errorObject.stack}</div>\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t\t{error.cause ? (\n\t\t\t\t<>\n\t\t\t\t\t<div className={className('causedBy')} id={`error-${level}`}>\n\t\t\t\t\t\tCaused by\n\t\t\t\t\t</div>\n\t\t\t\t\t<DevErrorInner error={error.cause} level={level + 1} />\n\t\t\t\t</>\n\t\t\t) : null}\n\t\t</>\n\t)\n}\n"],"names":["jsxs","Fragment","jsx","StackTrace"],"mappings":";;;;AASA,MAAM,YAAY,CAAC,QAAwB,MAAM,gBAAgB,GAAG,KAAK;AAElE,SAAS,cAAc,EAAE,OAAO,QAAQ,KAAyB;AAEvE,MAAI,cAAiC,MAAM,iBAAiB,QAAQ,MAAM,QAAQ;AAElF,SAEEA,2BAAA,KAAAC,qBAAA,EAAA,UAAA;AAAA,IAAAC,2BAAAA,IAAC,SAAI,WAAW,UAAU,QAAQ,GAChC,wBAECF,2BAAAA,KAAAC,WAAA,UAAA,EAAA,UAAA;AAAA,MAAAC,+BAAC,QAAG,WAAW,UAAU,WAAW,GAAI,sBAAY,MAAK;AAAA,MACxD,MAAM,SAAUA,2BAAA,IAAA,KAAA,EAAE,MAAM,UAAU,KAAK,IAAI,WAAW,UAAU,WAAW,GAAG,UAAc,eAAA;AAAA,MAC5F,YAAY,WAAYA,+BAAA,MAAA,EAAG,WAAW,UAAU,cAAc,GAAI,UAAA,YAAY,QAAQ,CAAA;AAAA,MACtF,aAAa,eAAgBA,+BAAA,OAAA,EAAI,WAAW,UAAU,cAAc,GAAK,UAAA,YAAoB,QAAQ,CAAA;AAAA,IACvG,EAAA,CAAA,mCAEC,MAAG,EAAA,WAAW,UAAU,WAAW,GAAG,2BAAa,EAEtD,CAAA;AAAA,IACC,MAAM,oBACNA,2BAAAA,IAACC,WAAAA,YAAW,EAAA,YAAY,MAAM,kBAAmB,CAAA,IAC9C,aAAa,QACfD,2BAAAA,IAAA,OAAA,EAAI,WAAW,UAAU,OAAO,GAChC,UAAAA,2BAAA,IAAC,OAAI,EAAA,WAAW,UAAU,YAAY,GAAI,UAAA,YAAY,MAAM,CAAA,EAAA,CAC7D,IACG;AAAA,IACH,MAAM,QAELF,2BAAAA,KAAAC,WAAA,UAAA,EAAA,UAAA;AAAA,MAACC,2BAAAA,IAAA,OAAA,EAAI,WAAW,UAAU,UAAU,GAAG,IAAI,SAAS,KAAK,IAAI,UAE7D,YAAA,CAAA;AAAA,qCACC,eAAc,EAAA,OAAO,MAAM,OAAO,OAAO,QAAQ,EAAG,CAAA;AAAA,IAAA,EAAA,CACtD,IACG;AAAA,EAAA,GACL;AAEF;;"}
@@ -1,23 +0,0 @@
1
- import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
- import { StackTrace } from "./StackTrace.js";
3
- const className = (cls) => cls ? `cui-devError-${cls}` : "cui-devError";
4
- function DevErrorInner({ error, level = 1 }) {
5
- let errorObject = error.error instanceof Error ? error.error : void 0;
6
- return /* @__PURE__ */ jsxs(Fragment, { children: [
7
- /* @__PURE__ */ jsx("div", { className: className("header"), children: errorObject ? /* @__PURE__ */ jsxs(Fragment, { children: [
8
- /* @__PURE__ */ jsx("h1", { className: className("errorName"), children: errorObject.name }),
9
- error.cause && /* @__PURE__ */ jsx("a", { href: `#error-${level}`, className: className("causeLink"), children: "caused by >" }),
10
- errorObject.message && /* @__PURE__ */ jsx("h2", { className: className("errorMessage"), children: errorObject.message }),
11
- "details" in errorObject && /* @__PURE__ */ jsx("div", { className: className("errorDetails"), children: errorObject.details })
12
- ] }) : /* @__PURE__ */ jsx("h1", { className: className("errorName"), children: "Unknown error" }) }),
13
- error.parsedStackStrace ? /* @__PURE__ */ jsx(StackTrace, { stackTrace: error.parsedStackStrace }) : errorObject?.stack ? /* @__PURE__ */ jsx("div", { className: className("stack"), children: /* @__PURE__ */ jsx("div", { className: className("stack-dump"), children: errorObject.stack }) }) : null,
14
- error.cause ? /* @__PURE__ */ jsxs(Fragment, { children: [
15
- /* @__PURE__ */ jsx("div", { className: className("causedBy"), id: `error-${level}`, children: "Caused by" }),
16
- /* @__PURE__ */ jsx(DevErrorInner, { error: error.cause, level: level + 1 })
17
- ] }) : null
18
- ] });
19
- }
20
- export {
21
- DevErrorInner
22
- };
23
- //# sourceMappingURL=DevErrorInner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DevErrorInner.js","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevErrorInner.tsx"],"sourcesContent":["import { StackTrace } from './StackTrace'\nimport type { ProcessedError } from './types'\n\nexport interface DevErrorInnerProps {\n\terror: ProcessedError\n\tlevel?: number\n}\n\n\nconst className = (cls?: string | null) => cls ? `cui-devError-${cls}` : 'cui-devError'\n\nexport function DevErrorInner({ error, level = 1 }: DevErrorInnerProps) {\n\n\tlet errorObject: Error | undefined = error.error instanceof Error ? error.error : undefined\n\n\treturn (\n\t\t<>\n\t\t\t<div className={className('header')}>\n\t\t\t\t{errorObject ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<h1 className={className('errorName')}>{errorObject.name}</h1>\n\t\t\t\t\t\t{error.cause && <a href={`#error-${level}`} className={className('causeLink')}>caused by &gt;</a>}\n\t\t\t\t\t\t{errorObject.message && <h2 className={className('errorMessage')}>{errorObject.message}</h2>}\n\t\t\t\t\t\t{'details' in errorObject && <div className={className('errorDetails')}>{(errorObject as any).details}</div>}\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\t<h1 className={className('errorName')}>Unknown error</h1>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t\t{error.parsedStackStrace ? (\n\t\t\t\t<StackTrace stackTrace={error.parsedStackStrace} />\n\t\t\t) : errorObject?.stack ? (\n\t\t\t\t<div className={className('stack')}>\n\t\t\t\t\t<div className={className('stack-dump')}>{errorObject.stack}</div>\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t\t{error.cause ? (\n\t\t\t\t<>\n\t\t\t\t\t<div className={className('causedBy')} id={`error-${level}`}>\n\t\t\t\t\t\tCaused by\n\t\t\t\t\t</div>\n\t\t\t\t\t<DevErrorInner error={error.cause} level={level + 1} />\n\t\t\t\t</>\n\t\t\t) : null}\n\t\t</>\n\t)\n}\n"],"names":[],"mappings":";;AASA,MAAM,YAAY,CAAC,QAAwB,MAAM,gBAAgB,GAAG,KAAK;AAElE,SAAS,cAAc,EAAE,OAAO,QAAQ,KAAyB;AAEvE,MAAI,cAAiC,MAAM,iBAAiB,QAAQ,MAAM,QAAQ;AAElF,SAEE,qBAAA,UAAA,EAAA,UAAA;AAAA,IAAA,oBAAC,SAAI,WAAW,UAAU,QAAQ,GAChC,wBAEC,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAA,oBAAC,QAAG,WAAW,UAAU,WAAW,GAAI,sBAAY,MAAK;AAAA,MACxD,MAAM,SAAU,oBAAA,KAAA,EAAE,MAAM,UAAU,KAAK,IAAI,WAAW,UAAU,WAAW,GAAG,UAAc,eAAA;AAAA,MAC5F,YAAY,WAAY,oBAAA,MAAA,EAAG,WAAW,UAAU,cAAc,GAAI,UAAA,YAAY,QAAQ,CAAA;AAAA,MACtF,aAAa,eAAgB,oBAAA,OAAA,EAAI,WAAW,UAAU,cAAc,GAAK,UAAA,YAAoB,QAAQ,CAAA;AAAA,IACvG,EAAA,CAAA,wBAEC,MAAG,EAAA,WAAW,UAAU,WAAW,GAAG,2BAAa,EAEtD,CAAA;AAAA,IACC,MAAM,oBACN,oBAAC,YAAW,EAAA,YAAY,MAAM,kBAAmB,CAAA,IAC9C,aAAa,QACf,oBAAA,OAAA,EAAI,WAAW,UAAU,OAAO,GAChC,UAAA,oBAAC,OAAI,EAAA,WAAW,UAAU,YAAY,GAAI,UAAA,YAAY,MAAM,CAAA,EAAA,CAC7D,IACG;AAAA,IACH,MAAM,QAEL,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAC,oBAAA,OAAA,EAAI,WAAW,UAAU,UAAU,GAAG,IAAI,SAAS,KAAK,IAAI,UAE7D,YAAA,CAAA;AAAA,0BACC,eAAc,EAAA,OAAO,MAAM,OAAO,OAAO,QAAQ,EAAG,CAAA;AAAA,IAAA,EAAA,CACtD,IACG;AAAA,EAAA,GACL;AAEF;"}
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const DevErrorInner = require("./DevErrorInner.cjs");
5
- const React = require("react");
6
- const className = (cls) => cls ? `cui-devError-${cls}` : "cui-devError";
7
- function DevErrorList({
8
- currentError,
9
- currentErrorIndex,
10
- currentErrorSource,
11
- errorCount,
12
- onClose,
13
- onNext,
14
- onPrevious,
15
- onClear
16
- }) {
17
- React.useEffect(() => {
18
- document.body.classList.add("cui-devError-body");
19
- return () => {
20
- document.body.classList.remove("cui-devError-body");
21
- };
22
- }, []);
23
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: className(), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: className("in"), children: [
24
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: className("bar"), children: [
25
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: className("errorSource"), children: currentErrorSource }),
26
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: className("actions"), children: [
27
- errorCount > 1 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: className("switcher"), children: [
28
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: className("errorCount"), children: [
29
- "Error ",
30
- currentErrorIndex + 1,
31
- " of ",
32
- errorCount
33
- ] }),
34
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: className("switcherButtons"), children: [
35
- /* @__PURE__ */ jsxRuntime.jsx("button", { className: className("switcherButton"), onClick: onPrevious, children: "←" }),
36
- /* @__PURE__ */ jsxRuntime.jsx("button", { className: className("switcherButton"), onClick: onNext, children: "→" })
37
- ] })
38
- ] }) : null,
39
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: className("close"), children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: className("closeButton"), onClick: onClose, children: "✕" }) })
40
- ] }),
41
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: className("close"), children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: className("closeButton"), onClick: onClear, children: "Clear errors" }) })
42
- ] }),
43
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: className("content"), children: /* @__PURE__ */ jsxRuntime.jsx(DevErrorInner.DevErrorInner, { error: currentError }) })
44
- ] }) });
45
- }
46
- exports.DevErrorList = DevErrorList;
47
- //# sourceMappingURL=DevErrorList.cjs.map
@@ -1 +0,0 @@
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 { useEffect } from 'react'\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\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')}>{currentErrorSource}</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 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 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 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 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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