@contember/react-devbar 1.3.0-alpha.27 → 2.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/development/ui/DevBar/DevBar.cjs +9 -10
- package/dist/development/ui/DevBar/DevBar.cjs.map +1 -1
- package/dist/development/ui/DevBar/DevBar.js +10 -11
- package/dist/development/ui/DevBar/DevBar.js.map +1 -1
- package/dist/development/ui/DevError/DevError.cjs +3 -4
- package/dist/development/ui/DevError/DevError.cjs.map +1 -1
- package/dist/development/ui/DevError/DevError.js +3 -4
- package/dist/development/ui/DevError/DevError.js.map +1 -1
- package/dist/development/ui/DevError/DevErrorBadge.cjs +4 -5
- package/dist/development/ui/DevError/DevErrorBadge.cjs.map +1 -1
- package/dist/development/ui/DevError/DevErrorBadge.js +4 -5
- package/dist/development/ui/DevError/DevErrorBadge.js.map +1 -1
- package/dist/development/ui/DevError/DevErrorInner.cjs +23 -24
- package/dist/development/ui/DevError/DevErrorInner.cjs.map +1 -1
- package/dist/development/ui/DevError/DevErrorInner.js +23 -24
- package/dist/development/ui/DevError/DevErrorInner.js.map +1 -1
- package/dist/development/ui/DevError/DevErrorList.cjs +24 -25
- package/dist/development/ui/DevError/DevErrorList.cjs.map +1 -1
- package/dist/development/ui/DevError/DevErrorList.js +24 -25
- package/dist/development/ui/DevError/DevErrorList.js.map +1 -1
- package/dist/development/ui/DevError/StackTrace.cjs +20 -22
- package/dist/development/ui/DevError/StackTrace.cjs.map +1 -1
- package/dist/development/ui/DevError/StackTrace.js +20 -22
- package/dist/development/ui/DevError/StackTrace.js.map +1 -1
- package/dist/production/ui/DevBar/DevBar.cjs +2 -3
- package/dist/production/ui/DevBar/DevBar.cjs.map +1 -1
- package/dist/production/ui/DevBar/DevBar.js +3 -4
- package/dist/production/ui/DevBar/DevBar.js.map +1 -1
- package/dist/production/ui/DevError/DevError.cjs +3 -4
- package/dist/production/ui/DevError/DevError.cjs.map +1 -1
- package/dist/production/ui/DevError/DevError.js +3 -4
- package/dist/production/ui/DevError/DevError.js.map +1 -1
- package/dist/production/ui/DevError/DevErrorBadge.cjs +2 -3
- package/dist/production/ui/DevError/DevErrorBadge.cjs.map +1 -1
- package/dist/production/ui/DevError/DevErrorBadge.js +2 -3
- package/dist/production/ui/DevError/DevErrorBadge.js.map +1 -1
- package/dist/production/ui/DevError/DevErrorInner.cjs +9 -10
- package/dist/production/ui/DevError/DevErrorInner.cjs.map +1 -1
- package/dist/production/ui/DevError/DevErrorInner.js +9 -10
- package/dist/production/ui/DevError/DevErrorInner.js.map +1 -1
- package/dist/production/ui/DevError/DevErrorList.cjs +11 -12
- package/dist/production/ui/DevError/DevErrorList.cjs.map +1 -1
- package/dist/production/ui/DevError/DevErrorList.js +11 -12
- package/dist/production/ui/DevError/DevErrorList.js.map +1 -1
- package/dist/production/ui/DevError/StackTrace.cjs +10 -12
- package/dist/production/ui/DevError/StackTrace.cjs.map +1 -1
- package/dist/production/ui/DevError/StackTrace.js +10 -12
- package/dist/production/ui/DevError/StackTrace.js.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/ui/DevBar/DevBar.d.ts.map +1 -1
- package/dist/types/ui/DevError/DevError.d.ts.map +1 -1
- package/dist/types/ui/DevError/DevErrorBadge.d.ts.map +1 -1
- package/dist/types/ui/DevError/DevErrorInner.d.ts.map +1 -1
- package/dist/types/ui/DevError/DevErrorList.d.ts.map +1 -1
- package/dist/types/ui/DevError/StackTrace.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/ui/DevBar/DevBar.tsx +4 -5
- package/src/ui/DevError/DevError.tsx +6 -6
- package/src/ui/DevError/DevErrorBadge.tsx +5 -6
- package/src/ui/DevError/DevErrorInner.tsx +12 -11
- package/src/ui/DevError/DevErrorList.tsx +13 -15
- package/src/ui/DevError/StackTrace.tsx +11 -13
|
@@ -1,42 +1,40 @@
|
|
|
1
1
|
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
|
-
|
|
2
|
+
const className = (cls) => cls ? `cui-devError-${cls}` : "cui-devError";
|
|
3
3
|
const StackTrace = ({ stackTrace }) => {
|
|
4
|
-
|
|
5
|
-
return /* @__PURE__ */ jsxDEV("div", { className: componentClassName("stack"), children: stackTrace.map((it, index) => /* @__PURE__ */ jsxDEV(StackFrame, { stackFrame: it }, index, false, {
|
|
4
|
+
return /* @__PURE__ */ jsxDEV("div", { className: className("stack"), children: stackTrace.map((it, index) => /* @__PURE__ */ jsxDEV(StackFrame, { stackFrame: it }, index, false, {
|
|
6
5
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/StackTrace.tsx",
|
|
7
|
-
lineNumber:
|
|
6
|
+
lineNumber: 9,
|
|
8
7
|
columnNumber: 5
|
|
9
8
|
}, void 0)) }, void 0, false, {
|
|
10
9
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/StackTrace.tsx",
|
|
11
|
-
lineNumber:
|
|
10
|
+
lineNumber: 7,
|
|
12
11
|
columnNumber: 3
|
|
13
12
|
}, void 0);
|
|
14
13
|
};
|
|
15
14
|
const StackFrame = ({ stackFrame }) => {
|
|
16
|
-
const componentClassName = useClassNameFactory("devError");
|
|
17
15
|
const line = stackFrame.line;
|
|
18
|
-
return /* @__PURE__ */ jsxDEV("div", { className:
|
|
19
|
-
/* @__PURE__ */ jsxDEV("div", { className:
|
|
20
|
-
/* @__PURE__ */ jsxDEV("div", { className:
|
|
16
|
+
return /* @__PURE__ */ jsxDEV("div", { className: className("stackFrame"), children: [
|
|
17
|
+
/* @__PURE__ */ jsxDEV("div", { className: className("stackFrameHeader"), children: [
|
|
18
|
+
/* @__PURE__ */ jsxDEV("div", { className: className("stackFrameSource"), children: [
|
|
21
19
|
stackFrame.filename,
|
|
22
20
|
":",
|
|
23
21
|
line
|
|
24
22
|
] }, void 0, true, {
|
|
25
23
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/StackTrace.tsx",
|
|
26
|
-
lineNumber:
|
|
24
|
+
lineNumber: 21,
|
|
27
25
|
columnNumber: 5
|
|
28
26
|
}, void 0),
|
|
29
|
-
stackFrame.callee && /* @__PURE__ */ jsxDEV("div", { className:
|
|
27
|
+
stackFrame.callee && /* @__PURE__ */ jsxDEV("div", { className: className("stackFrameCallee"), children: stackFrame.callee }, void 0, false, {
|
|
30
28
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/StackTrace.tsx",
|
|
31
|
-
lineNumber:
|
|
29
|
+
lineNumber: 24,
|
|
32
30
|
columnNumber: 27
|
|
33
31
|
}, void 0)
|
|
34
32
|
] }, void 0, true, {
|
|
35
33
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/StackTrace.tsx",
|
|
36
|
-
lineNumber:
|
|
34
|
+
lineNumber: 20,
|
|
37
35
|
columnNumber: 4
|
|
38
36
|
}, void 0),
|
|
39
|
-
line !== void 0 && stackFrame.sourceCodeLines && /* @__PURE__ */ jsxDEV("div", { className:
|
|
37
|
+
line !== void 0 && stackFrame.sourceCodeLines && /* @__PURE__ */ jsxDEV("div", { className: className("stackFrameCode"), children: stackFrame.sourceCodeLines.map((it, index) => {
|
|
40
38
|
const lineNumber = index + 1;
|
|
41
39
|
if (lineNumber + 5 < line || lineNumber - 3 > line) {
|
|
42
40
|
return null;
|
|
@@ -44,16 +42,16 @@ const StackFrame = ({ stackFrame }) => {
|
|
|
44
42
|
return /* @__PURE__ */ jsxDEV(
|
|
45
43
|
"div",
|
|
46
44
|
{
|
|
47
|
-
className:
|
|
45
|
+
className: `${className("stackFrameLine")} ${lineNumber === line && "is-active"}`,
|
|
48
46
|
children: [
|
|
49
|
-
/* @__PURE__ */ jsxDEV("div", { className:
|
|
47
|
+
/* @__PURE__ */ jsxDEV("div", { className: className("stackFrameLineNumber"), children: lineNumber }, void 0, false, {
|
|
50
48
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/StackTrace.tsx",
|
|
51
|
-
lineNumber:
|
|
49
|
+
lineNumber: 38,
|
|
52
50
|
columnNumber: 9
|
|
53
51
|
}, void 0),
|
|
54
|
-
/* @__PURE__ */ jsxDEV("div", { className:
|
|
52
|
+
/* @__PURE__ */ jsxDEV("div", { className: className("stackFrameLineCode"), children: it }, void 0, false, {
|
|
55
53
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/StackTrace.tsx",
|
|
56
|
-
lineNumber:
|
|
54
|
+
lineNumber: 39,
|
|
57
55
|
columnNumber: 9
|
|
58
56
|
}, void 0)
|
|
59
57
|
]
|
|
@@ -62,19 +60,19 @@ const StackFrame = ({ stackFrame }) => {
|
|
|
62
60
|
true,
|
|
63
61
|
{
|
|
64
62
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/StackTrace.tsx",
|
|
65
|
-
lineNumber:
|
|
63
|
+
lineNumber: 34,
|
|
66
64
|
columnNumber: 8
|
|
67
65
|
},
|
|
68
66
|
void 0
|
|
69
67
|
);
|
|
70
68
|
}) }, void 0, false, {
|
|
71
69
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/StackTrace.tsx",
|
|
72
|
-
lineNumber:
|
|
70
|
+
lineNumber: 27,
|
|
73
71
|
columnNumber: 5
|
|
74
72
|
}, void 0)
|
|
75
73
|
] }, void 0, true, {
|
|
76
74
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/StackTrace.tsx",
|
|
77
|
-
lineNumber:
|
|
75
|
+
lineNumber: 19,
|
|
78
76
|
columnNumber: 3
|
|
79
77
|
}, void 0);
|
|
80
78
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StackTrace.js","sources":["../../../../src/ui/DevError/StackTrace.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"StackTrace.js","sources":["../../../../src/ui/DevError/StackTrace.tsx"],"sourcesContent":["import { ParsedStackFrame, ParsedStackTrace } from './types'\n\n\nconst className = (cls?: string | null) => cls ? `cui-devError-${cls}` : 'cui-devError'\nexport const StackTrace = ({ stackTrace }: { stackTrace: ParsedStackTrace }) => {\n\treturn (\n\t\t<div className={className('stack')}>\n\t\t\t{stackTrace.map((it, index) => (\n\t\t\t\t<StackFrame stackFrame={it} key={index} />\n\t\t\t))}\n\t\t</div>\n\t)\n}\n\nconst StackFrame = ({ stackFrame }: { stackFrame: ParsedStackFrame }) => {\n\tconst line = stackFrame.line\n\n\treturn (\n\t\t<div className={className('stackFrame')}>\n\t\t\t<div className={className('stackFrameHeader')}>\n\t\t\t\t<div className={className('stackFrameSource')}>\n\t\t\t\t\t{stackFrame.filename}:{line}\n\t\t\t\t</div>\n\t\t\t\t{stackFrame.callee && <div className={className('stackFrameCallee')}>{stackFrame.callee}</div>}\n\t\t\t</div>\n\t\t\t{line !== undefined && stackFrame.sourceCodeLines && (\n\t\t\t\t<div className={className('stackFrameCode')}>\n\t\t\t\t\t{stackFrame.sourceCodeLines.map((it, index) => {\n\t\t\t\t\t\tconst lineNumber = index + 1\n\t\t\t\t\t\tif (lineNumber + 5 < line || lineNumber - 3 > line) {\n\t\t\t\t\t\t\treturn null\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={`${className('stackFrameLine')} ${lineNumber === line && 'is-active'}`}\n\t\t\t\t\t\t\t\tkey={lineNumber}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<div className={className('stackFrameLineNumber')}>{lineNumber}</div>\n\t\t\t\t\t\t\t\t<div className={className('stackFrameLineCode')}>{it}</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)\n\t\t\t\t\t})}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n"],"names":["this"],"mappings":";AAGA,MAAM,YAAY,CAAC,QAAwB,MAAM,gBAAgB,GAAG,KAAK;AAClE,MAAM,aAAa,CAAC,EAAE,iBAAmD;AAC/E,SACE,uBAAA,OAAA,EAAI,WAAW,UAAU,OAAO,GAC/B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AA;AAAA,UACA,WAAW,GAAG,UAAU,gBAAgB,CAAC,IAAI,eAAe,QAAQ,WAAW;AAAA,UAG/E,UAAA;AAAA,YAAA,uBAAC,OAAI,EAAA,WAAW,UAAU,sBAAsB,GAAI,UAApD,WAAA,GAAA,QAAA,OAAA;AAAA,cAAA,UAAA;AAAA,cAAA,YAAA;AAAA,cAAA,cAAA;AAAA,YAA+D,GAAAA,MAAA;AAAA,mCAC9D,OAAI,EAAA,WAAW,UAAU,oBAAoB,GAAI,UAAlD,GAAA,GAAA,QAAA,OAAA;AAAA,cAAA,UAAA;AAAA,cAAA,YAAA;AAAA,cAAA,cAAA;AAAA,YAAqD,GAAAA,MAAA;AAAA,UAAA;AAAA,QAAA;AAAA,QAHhD;AAAA,QAFN;AAAA,QAAA;AAAA,UAAA,UAAA;AAAA,UAAA,YAAA;AAAA,UAAA,cAAA;AAAA,QAAA;AAAA,QAAAA;AAAAA,MAAA;AAAA,IAMA,CAED,EAfF,GAAA,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAgBA,GAAAA,MAAA;AAAA,EAAA,KAxBF,QAAA,MAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EA0BA,GAAAA,MAAA;AAEF;"}
|
|
@@ -4,12 +4,12 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const reactUtils = require("@contember/react-utils");
|
|
5
5
|
const utilities = require("@contember/utilities");
|
|
6
6
|
const react = require("react");
|
|
7
|
+
const className = (cls) => cls ? `cui-devBar-${cls}` : "cui-devBar";
|
|
7
8
|
const DevBar = ({
|
|
8
9
|
breakpoint = 768,
|
|
9
10
|
children,
|
|
10
11
|
brand
|
|
11
12
|
}) => {
|
|
12
|
-
const className = reactUtils.useClassNameFactory("devBar");
|
|
13
13
|
const [expanded, setExpanded] = react.useState(true);
|
|
14
14
|
const isSmallScreen = reactUtils.useWindowSize().width < breakpoint;
|
|
15
15
|
const toggleButtonRef = react.useRef(null);
|
|
@@ -100,7 +100,6 @@ const DevBar = ({
|
|
|
100
100
|
};
|
|
101
101
|
const DevPanel = ({ heading, icon, children, preview }) => {
|
|
102
102
|
const id = `cui-devBar-panel-${reactUtils.useId()}`;
|
|
103
|
-
const className = reactUtils.useClassNameFactory("devBar");
|
|
104
103
|
const [expanded, setExpanded] = react.useState(false);
|
|
105
104
|
const mouseEnterTimeStampRef = react.useRef(void 0);
|
|
106
105
|
const devPanelRef = react.useRef(null);
|
|
@@ -149,7 +148,7 @@ const DevPanel = ({ heading, icon, children, preview }) => {
|
|
|
149
148
|
]
|
|
150
149
|
}
|
|
151
150
|
),
|
|
152
|
-
expanded && /* @__PURE__ */ jsxRuntime.jsx("div", { tabIndex: 0, id, role: "dialog", className: className("panel"
|
|
151
|
+
expanded && /* @__PURE__ */ jsxRuntime.jsx("div", { tabIndex: 0, id, role: "dialog", className: className("panel"), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: className("panel-content"), children: [
|
|
153
152
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "h4", children: heading }),
|
|
154
153
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: className("panel-body"), children })
|
|
155
154
|
] }) })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevBar.cjs","sources":["../../../../src/ui/DevBar/DevBar.tsx"],"sourcesContent":["import {\n\
|
|
1
|
+
{"version":3,"file":"DevBar.cjs","sources":["../../../../src/ui/DevBar/DevBar.tsx"],"sourcesContent":["import {\n\tuseId,\n\tuseOnElementClickOutsideCallback,\n\tuseOnElementMouseEnterDelayedCallback,\n\tuseReferentiallyStableCallback,\n\tuseWindowSize,\n} from '@contember/react-utils'\nimport { dataAttribute } from '@contember/utilities'\nimport { PropsWithChildren, ReactNode, 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\tbrand,\n}: PropsWithChildren<{\n\tbrand?: ReactNode;\n\tbreakpoint?: number;\n}>) => {\n\tconst [expanded, setExpanded] = useState(true)\n\tconst isSmallScreen = useWindowSize().width < breakpoint\n\tconst toggleButtonRef = useRef<HTMLButtonElement>(null)\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\tif (expanded) {\n\t\t\t\t\tsetExpanded(false)\n\t\t\t\t\ttoggleButtonRef.current?.blur()\n\t\t\t\t} else {\n\t\t\t\t\tif (toggleButtonRef.current !== document.activeElement) {\n\t\t\t\t\t\ttoggleButtonRef.current?.focus()\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttoggleButtonRef.current?.blur()\n\t\t\t\t\t}\n\t\t\t\t}\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\ttoggleButtonRef.current?.blur()\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\n\t\t\tdata-overrides-lucide-icons\n\t\t\tdata-expanded={dataAttribute(expanded)}\n\t\t\tdata-small-screen={dataAttribute(isSmallScreen)}\n\t\t\tclassName={className(null)}\n\t\t\tonKeyDown={event => {\n\t\t\t\tif (event.code === 'Escape') {\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\tevent.stopPropagation()\n\n\t\t\t\t\tif (expanded) {\n\t\t\t\t\t\tsetExpanded(false)\n\t\t\t\t\t} else if (document.activeElement && document.activeElement instanceof HTMLElement) {\n\t\t\t\t\t\tdocument.activeElement.blur()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}}\n\t\t>\n\t\t\t<style>{`svg { pointer-events: none }`}</style>\n\t\t\t<div ref={devBarContentRef} className={className('content')}>\n\t\t\t\t<div\n\t\t\t\t\tdata-expanded={dataAttribute(expanded)}\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('brand')}>\n\t\t\t\t\t\t{brand}\n\n\t\t\t\t\t</div>\n\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\n\t\t\t\t</div>\n\n\t\t\t\t<button\n\t\t\t\t\tref={toggleButtonRef}\n\t\t\t\t\tid=\"dev-bar-toggle-button\"\n\t\t\t\t\taria-label=\"Toggle Contember Developer Toolbar\"\n\t\t\t\t\taria-controls={id}\n\t\t\t\t\taria-expanded={expanded}\n\t\t\t\t\tclassName={className('close')}\n\t\t\t\t\tonClick={handleToggle}\n\t\t\t\t\ttabIndex={0}\n\t\t\t\t>\n\t\t\t\t\t{expanded ? '🗙' : 'ᐸ'}\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</section>\n\t)\n}\n\nexport const DevPanel = ({ heading, icon, children, preview }: {\n\ticon: ReactNode;\n\theading: ReactNode,\n\tchildren: ReactNode,\n\tpreview?: ReactNode\n}) => {\n\tconst id = `cui-devBar-panel-${useId()}`\n\tconst [expanded, setExpanded] = useState(false)\n\tconst mouseEnterTimeStampRef = useRef<ReturnType<typeof Date.now> | undefined>(undefined)\n\n\tconst devPanelRef = useRef<HTMLDivElement>(null)\n\n\tuseOnElementMouseEnterDelayedCallback(devPanelRef, useReferentiallyStableCallback(({ type }) => {\n\t\tif (type === 'mouseenter') {\n\t\t\tmouseEnterTimeStampRef.current = Date.now() + 300\n\t\t\tsetExpanded(true)\n\t\t}\n\t}))\n\n\treturn (\n\t\t<div\n\t\t\tref={devPanelRef}\n\t\t\tdata-expanded={dataAttribute(expanded)}\n\t\t\tclassName={className('trigger')}\n\t\t\tonMouseLeave={useReferentiallyStableCallback(() => {\n\t\t\t\tsetExpanded(false)\n\t\t\t})}\n\t\t\tonKeyDown={useReferentiallyStableCallback(event => {\n\t\t\t\tif (expanded && event.code === 'Escape') {\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\tevent.stopPropagation()\n\t\t\t\t\tsetExpanded(false)\n\t\t\t\t}\n\t\t\t})}\n\t\t>\n\t\t\t<button\n\t\t\t\ttabIndex={0}\n\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\taria-controls={id}\n\t\t\t\taria-expanded={expanded}\n\t\t\t\tclassName={className('trigger-label')}\n\t\t\t\tonClick={useReferentiallyStableCallback(() => {\n\t\t\t\t\tif (mouseEnterTimeStampRef.current && Date.now() < mouseEnterTimeStampRef.current) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetExpanded(expanded => !expanded)\n\t\t\t\t\t\tmouseEnterTimeStampRef.current = undefined\n\t\t\t\t\t}\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t{icon}\n\t\t\t\t<span className={className('trigger-label-text')}>{preview ?? heading}</span>\n\t\t\t</button>\n\t\t\t{expanded && (\n\t\t\t\t<div tabIndex={0} id={id} role=\"dialog\" className={className('panel')}>\n\t\t\t\t\t<div className={className('panel-content')}>\n\t\t\t\t\t\t<h2 className=\"h4\">\n\t\t\t\t\t\t\t{heading}\n\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t<div className={className('panel-body')}>\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n"],"names":["useState","useWindowSize","useRef","useReferentiallyStableCallback","expanded","useEffect","useOnElementClickOutsideCallback","useId","jsxs","dataAttribute","jsx","useOnElementMouseEnterDelayedCallback"],"mappings":";;;;;;AAUA,MAAM,YAAY,CAAC,QAAuB,MAAM,cAAc,GAAG,KAAK;AAE/D,MAAM,SAAS,CAAC;AAAA,EACtB,aAAa;AAAA,EACb;AAAA,EACA;AACD,MAGO;AACN,QAAM,CAAC,UAAU,WAAW,IAAIA,eAAS,IAAI;AACvC,QAAA,gBAAgBC,WAAAA,gBAAgB,QAAQ;AACxC,QAAA,kBAAkBC,aAA0B,IAAI;AAEhD,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;AAEtB,YAAI,UAAU;AACb,sBAAY,KAAK;AACjB,0BAAgB,SAAS;QAAK,OACxB;AACF,cAAA,gBAAgB,YAAY,SAAS,eAAe;AACvD,4BAAgB,SAAS;UAAM,OACzB;AACN,4BAAgB,SAAS;UAC1B;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAES,aAAA,iBAAiB,WAAW,aAAa;AAClD,WAAO,MAAM,SAAS,oBAAoB,WAAW,aAAa;AAAA,EAAA,GAChE,CAAC,UAAU,YAAY,CAAC;AAErB,QAAA,mBAAmBH,aAAuB,IAAI;AAEpDI,aAAA,iCAAiC,kBAAkB,MAAM;AACxD,QAAI,UAAU;AACb,kBAAY,KAAK;AACjB,sBAAgB,SAAS;IAC1B;AAAA,EAAA,CACA;AAEK,QAAA,KAAK,gBAAgBC,WAAA,MAAA,CAAO;AAGjC,SAAAC,2BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,oBAAgB;AAAA,MAChB,+BAA2B;AAAA,MAC3B,iB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AAAF,2BAAAA,KAAC,SAAI,WAAW,UAAU,eAAe,GACxC,UAAA;AAAA,UAACE,2BAAA,IAAA,MAAA,EAAG,WAAU,MACZ,UACF,SAAA;AAAA,yCACC,OAAI,EAAA,WAAW,UAAU,YAAY,GACpC,UACF;AAAA,QAAA,EAAA,CACD,EACD,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIJ;;;"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useWindowSize, useReferentiallyStableCallback, useOnElementClickOutsideCallback, useId, useOnElementMouseEnterDelayedCallback } from "@contember/react-utils";
|
|
3
3
|
import { dataAttribute } from "@contember/utilities";
|
|
4
4
|
import { useState, useRef, useEffect } from "react";
|
|
5
|
+
const className = (cls) => cls ? `cui-devBar-${cls}` : "cui-devBar";
|
|
5
6
|
const DevBar = ({
|
|
6
7
|
breakpoint = 768,
|
|
7
8
|
children,
|
|
8
9
|
brand
|
|
9
10
|
}) => {
|
|
10
|
-
const className = useClassNameFactory("devBar");
|
|
11
11
|
const [expanded, setExpanded] = useState(true);
|
|
12
12
|
const isSmallScreen = useWindowSize().width < breakpoint;
|
|
13
13
|
const toggleButtonRef = useRef(null);
|
|
@@ -98,7 +98,6 @@ const DevBar = ({
|
|
|
98
98
|
};
|
|
99
99
|
const DevPanel = ({ heading, icon, children, preview }) => {
|
|
100
100
|
const id = `cui-devBar-panel-${useId()}`;
|
|
101
|
-
const className = useClassNameFactory("devBar");
|
|
102
101
|
const [expanded, setExpanded] = useState(false);
|
|
103
102
|
const mouseEnterTimeStampRef = useRef(void 0);
|
|
104
103
|
const devPanelRef = useRef(null);
|
|
@@ -147,7 +146,7 @@ const DevPanel = ({ heading, icon, children, preview }) => {
|
|
|
147
146
|
]
|
|
148
147
|
}
|
|
149
148
|
),
|
|
150
|
-
expanded && /* @__PURE__ */ jsx("div", { tabIndex: 0, id, role: "dialog", className: className("panel"
|
|
149
|
+
expanded && /* @__PURE__ */ jsx("div", { tabIndex: 0, id, role: "dialog", className: className("panel"), children: /* @__PURE__ */ jsxs("div", { className: className("panel-content"), children: [
|
|
151
150
|
/* @__PURE__ */ jsx("h2", { className: "h4", children: heading }),
|
|
152
151
|
/* @__PURE__ */ jsx("div", { className: className("panel-body"), children })
|
|
153
152
|
] }) })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevBar.js","sources":["../../../../src/ui/DevBar/DevBar.tsx"],"sourcesContent":["import {\n\
|
|
1
|
+
{"version":3,"file":"DevBar.js","sources":["../../../../src/ui/DevBar/DevBar.tsx"],"sourcesContent":["import {\n\tuseId,\n\tuseOnElementClickOutsideCallback,\n\tuseOnElementMouseEnterDelayedCallback,\n\tuseReferentiallyStableCallback,\n\tuseWindowSize,\n} from '@contember/react-utils'\nimport { dataAttribute } from '@contember/utilities'\nimport { PropsWithChildren, ReactNode, 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\tbrand,\n}: PropsWithChildren<{\n\tbrand?: ReactNode;\n\tbreakpoint?: number;\n}>) => {\n\tconst [expanded, setExpanded] = useState(true)\n\tconst isSmallScreen = useWindowSize().width < breakpoint\n\tconst toggleButtonRef = useRef<HTMLButtonElement>(null)\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\tif (expanded) {\n\t\t\t\t\tsetExpanded(false)\n\t\t\t\t\ttoggleButtonRef.current?.blur()\n\t\t\t\t} else {\n\t\t\t\t\tif (toggleButtonRef.current !== document.activeElement) {\n\t\t\t\t\t\ttoggleButtonRef.current?.focus()\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttoggleButtonRef.current?.blur()\n\t\t\t\t\t}\n\t\t\t\t}\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\ttoggleButtonRef.current?.blur()\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\n\t\t\tdata-overrides-lucide-icons\n\t\t\tdata-expanded={dataAttribute(expanded)}\n\t\t\tdata-small-screen={dataAttribute(isSmallScreen)}\n\t\t\tclassName={className(null)}\n\t\t\tonKeyDown={event => {\n\t\t\t\tif (event.code === 'Escape') {\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\tevent.stopPropagation()\n\n\t\t\t\t\tif (expanded) {\n\t\t\t\t\t\tsetExpanded(false)\n\t\t\t\t\t} else if (document.activeElement && document.activeElement instanceof HTMLElement) {\n\t\t\t\t\t\tdocument.activeElement.blur()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}}\n\t\t>\n\t\t\t<style>{`svg { pointer-events: none }`}</style>\n\t\t\t<div ref={devBarContentRef} className={className('content')}>\n\t\t\t\t<div\n\t\t\t\t\tdata-expanded={dataAttribute(expanded)}\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('brand')}>\n\t\t\t\t\t\t{brand}\n\n\t\t\t\t\t</div>\n\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\n\t\t\t\t</div>\n\n\t\t\t\t<button\n\t\t\t\t\tref={toggleButtonRef}\n\t\t\t\t\tid=\"dev-bar-toggle-button\"\n\t\t\t\t\taria-label=\"Toggle Contember Developer Toolbar\"\n\t\t\t\t\taria-controls={id}\n\t\t\t\t\taria-expanded={expanded}\n\t\t\t\t\tclassName={className('close')}\n\t\t\t\t\tonClick={handleToggle}\n\t\t\t\t\ttabIndex={0}\n\t\t\t\t>\n\t\t\t\t\t{expanded ? '🗙' : 'ᐸ'}\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</section>\n\t)\n}\n\nexport const DevPanel = ({ heading, icon, children, preview }: {\n\ticon: ReactNode;\n\theading: ReactNode,\n\tchildren: ReactNode,\n\tpreview?: ReactNode\n}) => {\n\tconst id = `cui-devBar-panel-${useId()}`\n\tconst [expanded, setExpanded] = useState(false)\n\tconst mouseEnterTimeStampRef = useRef<ReturnType<typeof Date.now> | undefined>(undefined)\n\n\tconst devPanelRef = useRef<HTMLDivElement>(null)\n\n\tuseOnElementMouseEnterDelayedCallback(devPanelRef, useReferentiallyStableCallback(({ type }) => {\n\t\tif (type === 'mouseenter') {\n\t\t\tmouseEnterTimeStampRef.current = Date.now() + 300\n\t\t\tsetExpanded(true)\n\t\t}\n\t}))\n\n\treturn (\n\t\t<div\n\t\t\tref={devPanelRef}\n\t\t\tdata-expanded={dataAttribute(expanded)}\n\t\t\tclassName={className('trigger')}\n\t\t\tonMouseLeave={useReferentiallyStableCallback(() => {\n\t\t\t\tsetExpanded(false)\n\t\t\t})}\n\t\t\tonKeyDown={useReferentiallyStableCallback(event => {\n\t\t\t\tif (expanded && event.code === 'Escape') {\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\tevent.stopPropagation()\n\t\t\t\t\tsetExpanded(false)\n\t\t\t\t}\n\t\t\t})}\n\t\t>\n\t\t\t<button\n\t\t\t\ttabIndex={0}\n\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\taria-controls={id}\n\t\t\t\taria-expanded={expanded}\n\t\t\t\tclassName={className('trigger-label')}\n\t\t\t\tonClick={useReferentiallyStableCallback(() => {\n\t\t\t\t\tif (mouseEnterTimeStampRef.current && Date.now() < mouseEnterTimeStampRef.current) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetExpanded(expanded => !expanded)\n\t\t\t\t\t\tmouseEnterTimeStampRef.current = undefined\n\t\t\t\t\t}\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t{icon}\n\t\t\t\t<span className={className('trigger-label-text')}>{preview ?? heading}</span>\n\t\t\t</button>\n\t\t\t{expanded && (\n\t\t\t\t<div tabIndex={0} id={id} role=\"dialog\" className={className('panel')}>\n\t\t\t\t\t<div className={className('panel-content')}>\n\t\t\t\t\t\t<h2 className=\"h4\">\n\t\t\t\t\t\t\t{heading}\n\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t<div className={className('panel-body')}>\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n"],"names":["expanded"],"mappings":";;;;AAUA,MAAM,YAAY,CAAC,QAAuB,MAAM,cAAc,GAAG,KAAK;AAE/D,MAAM,SAAS,CAAC;AAAA,EACtB,aAAa;AAAA,EACb;AAAA,EACA;AACD,MAGO;AACN,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,IAAI;AACvC,QAAA,gBAAgB,gBAAgB,QAAQ;AACxC,QAAA,kBAAkB,OAA0B,IAAI;AAEhD,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;AAEtB,YAAI,UAAU;AACb,sBAAY,KAAK;AACjB,0BAAgB,SAAS;QAAK,OACxB;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,SAAS,+BAA+B,MAAM;AAC7C,kBAAI,uBAAuB,WAAW,KAAK,IAAI,IAAI,uBAAuB,SAAS;AAClF;AAAA,cAAA,OACM;AACM,4BAAA,CAAAA,cAAY,CAACA,SAAQ;AACjC,uCAAuB,UAAU;AAAA,cAClC;AAAA,YAAA,CACA;AAAA,YAEA,UAAA;AAAA,cAAA;AAAA,kCACA,QAAK,EAAA,WAAW,UAAU,oBAAoB,GAAI,qBAAW,SAAQ;AAAA,YAAA;AAAA,UAAA;AAAA,QACvE;AAAA,QACC,YACC,oBAAA,OAAA,EAAI,UAAU,GAAG,IAAQ,MAAK,UAAS,WAAW,UAAU,OAAO,GACnE,UAAA,qBAAC,SAAI,WAAW,UAAU,eAAe,GACxC,UAAA;AAAA,UAAC,oBAAA,MAAA,EAAG,WAAU,MACZ,UACF,SAAA;AAAA,8BACC,OAAI,EAAA,WAAW,UAAU,YAAY,GACpC,UACF;AAAA,QAAA,EAAA,CACD,EACD,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIJ;"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const reactUtils = require("@contember/react-utils");
|
|
5
4
|
const DevErrorInner = require("./DevErrorInner.cjs");
|
|
5
|
+
const className = (cls) => cls ? `cui-devError-${cls}` : "cui-devError";
|
|
6
6
|
function DevError(props) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: componentClassName("bar"), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: componentClassName("errorSource"), children: props.source }) }),
|
|
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 }) }),
|
|
10
9
|
/* @__PURE__ */ jsxRuntime.jsx(DevErrorInner.DevErrorInner, { error: props.error })
|
|
11
10
|
] }) });
|
|
12
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevError.cjs","sources":["../../../../src/ui/DevError/DevError.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"DevError.cjs","sources":["../../../../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\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;AAG7C,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,EACpC,CAAA,EACD,CAAA;AAEF;;"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useClassNameFactory } from "@contember/react-utils";
|
|
3
2
|
import { DevErrorInner } from "./DevErrorInner.js";
|
|
3
|
+
const className = (cls) => cls ? `cui-devError-${cls}` : "cui-devError";
|
|
4
4
|
function DevError(props) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/* @__PURE__ */ jsx("div", { className: componentClassName("bar"), children: /* @__PURE__ */ jsx("div", { className: componentClassName("errorSource"), children: props.source }) }),
|
|
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 }) }),
|
|
8
7
|
/* @__PURE__ */ jsx(DevErrorInner, { error: props.error })
|
|
9
8
|
] }) });
|
|
10
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevError.js","sources":["../../../../src/ui/DevError/DevError.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"DevError.js","sources":["../../../../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\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;AAG7C,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,EACpC,CAAA,EACD,CAAA;AAEF;"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const
|
|
4
|
+
const className = (cls) => cls ? `cui-devErrorBadge-${cls}` : "cui-devErrorBadge";
|
|
5
5
|
function DevErrorBadge({ errorCount, onOpen }) {
|
|
6
|
-
|
|
7
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: componentClassName(), children: /* @__PURE__ */ jsxRuntime.jsxs("a", { className: componentClassName("button"), onClick: onOpen, children: [
|
|
6
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: className(), children: /* @__PURE__ */ jsxRuntime.jsxs("a", { className: className("button"), onClick: onOpen, children: [
|
|
8
7
|
errorCount,
|
|
9
8
|
" ",
|
|
10
9
|
errorCount > 1 ? "errors" : "error"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevErrorBadge.cjs","sources":["../../../../src/ui/DevError/DevErrorBadge.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"DevErrorBadge.cjs","sources":["../../../../src/ui/DevError/DevErrorBadge.tsx"],"sourcesContent":["export interface DevErrorBadgeProps {\n\tonOpen: () => void\n\terrorCount: number\n}\n\n\nconst className = (cls?: string | null) => cls ? `cui-devErrorBadge-${cls}` : 'cui-devErrorBadge'\n\nexport function DevErrorBadge({ errorCount, onOpen }: 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":";;;AAMA,MAAM,YAAY,CAAC,QAAwB,MAAM,qBAAqB,GAAG,KAAK;AAEvE,SAAS,cAAc,EAAE,YAAY,UAA8B;AACzE,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,EAC3C,CAAA,EACD,CAAA;AAEF;;"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
|
|
2
|
+
const className = (cls) => cls ? `cui-devErrorBadge-${cls}` : "cui-devErrorBadge";
|
|
3
3
|
function DevErrorBadge({ errorCount, onOpen }) {
|
|
4
|
-
|
|
5
|
-
return /* @__PURE__ */ jsx("div", { className: componentClassName(), children: /* @__PURE__ */ jsxs("a", { className: componentClassName("button"), onClick: onOpen, children: [
|
|
4
|
+
return /* @__PURE__ */ jsx("div", { className: className(), children: /* @__PURE__ */ jsxs("a", { className: className("button"), onClick: onOpen, children: [
|
|
6
5
|
errorCount,
|
|
7
6
|
" ",
|
|
8
7
|
errorCount > 1 ? "errors" : "error"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevErrorBadge.js","sources":["../../../../src/ui/DevError/DevErrorBadge.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"DevErrorBadge.js","sources":["../../../../src/ui/DevError/DevErrorBadge.tsx"],"sourcesContent":["export interface DevErrorBadgeProps {\n\tonOpen: () => void\n\terrorCount: number\n}\n\n\nconst className = (cls?: string | null) => cls ? `cui-devErrorBadge-${cls}` : 'cui-devErrorBadge'\n\nexport function DevErrorBadge({ errorCount, onOpen }: 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":";AAMA,MAAM,YAAY,CAAC,QAAwB,MAAM,qBAAqB,GAAG,KAAK;AAEvE,SAAS,cAAc,EAAE,YAAY,UAA8B;AACzE,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,EAC3C,CAAA,EACD,CAAA;AAEF;"}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const reactUtils = require("@contember/react-utils");
|
|
5
4
|
const StackTrace = require("./StackTrace.cjs");
|
|
5
|
+
const className = (cls) => cls ? `cui-devError-${cls}` : "cui-devError";
|
|
6
6
|
function DevErrorInner({ error, level = 1 }) {
|
|
7
|
-
const componentClassName = reactUtils.useClassNameFactory("devError");
|
|
8
7
|
let errorObject = error.error instanceof Error ? error.error : void 0;
|
|
9
8
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
11
|
-
/* @__PURE__ */ jsxRuntime.jsx("h1", { className:
|
|
12
|
-
error.cause && /* @__PURE__ */ jsxRuntime.jsx("a", { href: `#error-${level}`, className:
|
|
13
|
-
errorObject.message && /* @__PURE__ */ jsxRuntime.jsx("h2", { className:
|
|
14
|
-
"details" in errorObject && /* @__PURE__ */ jsxRuntime.jsx("h3", { className:
|
|
15
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("h1", { className:
|
|
16
|
-
error.parsedStackStrace ? /* @__PURE__ */ jsxRuntime.jsx(StackTrace.StackTrace, { stackTrace: error.parsedStackStrace }) : errorObject?.stack ? /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
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("h3", { 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,
|
|
17
16
|
error.cause ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
18
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
17
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: className("causedBy"), id: `error-${level}`, children: "Caused by" }),
|
|
19
18
|
/* @__PURE__ */ jsxRuntime.jsx(DevErrorInner, { error: error.cause, level: level + 1 })
|
|
20
19
|
] }) : null
|
|
21
20
|
] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevErrorInner.cjs","sources":["../../../../src/ui/DevError/DevErrorInner.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"DevErrorInner.cjs","sources":["../../../../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 ></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 && <h3 className={className('errorDetails')}>{(errorObject as any).details}</h3>}\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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I,UAE7D,YAAA,CAAA;AAAA,qCACC,eAAc,EAAA,OAAO,MAAM,OAAO,OAAO,QAAQ,GAAG;AAAA,IAAA,EAAA,CACtD,IACG;AAAA,EACL,EAAA,CAAA;AAEF;;"}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useClassNameFactory } from "@contember/react-utils";
|
|
3
2
|
import { StackTrace } from "./StackTrace.js";
|
|
3
|
+
const className = (cls) => cls ? `cui-devError-${cls}` : "cui-devError";
|
|
4
4
|
function DevErrorInner({ error, level = 1 }) {
|
|
5
|
-
const componentClassName = useClassNameFactory("devError");
|
|
6
5
|
let errorObject = error.error instanceof Error ? error.error : void 0;
|
|
7
6
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8
|
-
/* @__PURE__ */ jsx("div", { className:
|
|
9
|
-
/* @__PURE__ */ jsx("h1", { className:
|
|
10
|
-
error.cause && /* @__PURE__ */ jsx("a", { href: `#error-${level}`, className:
|
|
11
|
-
errorObject.message && /* @__PURE__ */ jsx("h2", { className:
|
|
12
|
-
"details" in errorObject && /* @__PURE__ */ jsx("h3", { className:
|
|
13
|
-
] }) : /* @__PURE__ */ jsx("h1", { className:
|
|
14
|
-
error.parsedStackStrace ? /* @__PURE__ */ jsx(StackTrace, { stackTrace: error.parsedStackStrace }) : errorObject?.stack ? /* @__PURE__ */ jsx("div", { className:
|
|
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("h3", { 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,
|
|
15
14
|
error.cause ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
16
|
-
/* @__PURE__ */ jsx("div", { className:
|
|
15
|
+
/* @__PURE__ */ jsx("div", { className: className("causedBy"), id: `error-${level}`, children: "Caused by" }),
|
|
17
16
|
/* @__PURE__ */ jsx(DevErrorInner, { error: error.cause, level: level + 1 })
|
|
18
17
|
] }) : null
|
|
19
18
|
] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevErrorInner.js","sources":["../../../../src/ui/DevError/DevErrorInner.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"DevErrorInner.js","sources":["../../../../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 ></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 && <h3 className={className('errorDetails')}>{(errorObject as any).details}</h3>}\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,MAAA,EAAG,WAAW,UAAU,cAAc,GAAK,UAAA,YAAoB,QAAQ,CAAA;AAAA,IACtG,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,GAAG;AAAA,IAAA,EAAA,CACtD,IACG;AAAA,EACL,EAAA,CAAA;AAEF;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const reactUtils = require("@contember/react-utils");
|
|
5
4
|
const DevErrorInner = require("./DevErrorInner.cjs");
|
|
5
|
+
const className = (cls) => cls ? `cui-devError-${cls}` : "cui-devError";
|
|
6
6
|
function DevErrorList({
|
|
7
7
|
currentError,
|
|
8
8
|
currentErrorIndex,
|
|
@@ -12,24 +12,23 @@ function DevErrorList({
|
|
|
12
12
|
onNext,
|
|
13
13
|
onPrevious
|
|
14
14
|
}) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/* @__PURE__ */ jsxRuntime.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: componentClassName("errorCount"), children: [
|
|
15
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: className(), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: className("in"), children: [
|
|
16
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: className("bar"), children: [
|
|
17
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: className("errorSource"), children: currentErrorSource }),
|
|
18
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: className("actions"), children: [
|
|
19
|
+
errorCount > 1 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: className("switcher"), children: [
|
|
20
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: className("errorCount"), children: [
|
|
22
21
|
"Error ",
|
|
23
22
|
currentErrorIndex + 1,
|
|
24
23
|
" of ",
|
|
25
24
|
errorCount
|
|
26
25
|
] }),
|
|
27
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
28
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { className:
|
|
29
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { className:
|
|
26
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: className("switcherButtons"), children: [
|
|
27
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { className: className("switcherButton"), onClick: onPrevious, children: "ᐊ" }),
|
|
28
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { className: className("switcherButton"), onClick: onNext, children: "ᐅ" })
|
|
30
29
|
] })
|
|
31
30
|
] }) : null,
|
|
32
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
31
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: className("close"), children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: className("closeButton"), onClick: onClose, children: "🗙" }) })
|
|
33
32
|
] })
|
|
34
33
|
] }),
|
|
35
34
|
/* @__PURE__ */ jsxRuntime.jsx(DevErrorInner.DevErrorInner, { error: currentError })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevErrorList.cjs","sources":["../../../../src/ui/DevError/DevErrorList.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"DevErrorList.cjs","sources":["../../../../src/ui/DevError/DevErrorList.tsx"],"sourcesContent":["import { DevErrorInner } from './DevErrorInner'\nimport { ProcessedError } from './types'\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}\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}: DevErrorListProps) {\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</div>\n\n\t\t\t\t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