@contember/react-devbar 1.3.0-alpha.27 → 2.0.0-alpha.1
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
|
@@ -4,12 +4,12 @@ const jsxDevRuntime = require("react/jsx-dev-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);
|
|
@@ -140,7 +140,6 @@ const DevBar = ({
|
|
|
140
140
|
};
|
|
141
141
|
const DevPanel = ({ heading, icon, children, preview }) => {
|
|
142
142
|
const id = `cui-devBar-panel-${reactUtils.useId()}`;
|
|
143
|
-
const className = reactUtils.useClassNameFactory("devBar");
|
|
144
143
|
const [expanded, setExpanded] = react.useState(false);
|
|
145
144
|
const mouseEnterTimeStampRef = react.useRef(void 0);
|
|
146
145
|
const devPanelRef = react.useRef(null);
|
|
@@ -187,7 +186,7 @@ const DevPanel = ({ heading, icon, children, preview }) => {
|
|
|
187
186
|
icon,
|
|
188
187
|
/* @__PURE__ */ jsxDevRuntime.jsxDEV("span", { className: className("trigger-label-text"), children: preview ?? heading }, void 0, false, {
|
|
189
188
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
190
|
-
lineNumber:
|
|
189
|
+
lineNumber: 170,
|
|
191
190
|
columnNumber: 5
|
|
192
191
|
}, void 0)
|
|
193
192
|
]
|
|
@@ -196,29 +195,29 @@ const DevPanel = ({ heading, icon, children, preview }) => {
|
|
|
196
195
|
true,
|
|
197
196
|
{
|
|
198
197
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
199
|
-
lineNumber:
|
|
198
|
+
lineNumber: 154,
|
|
200
199
|
columnNumber: 4
|
|
201
200
|
},
|
|
202
201
|
void 0
|
|
203
202
|
),
|
|
204
|
-
expanded && /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { tabIndex: 0, id, role: "dialog", className: className("panel"
|
|
203
|
+
expanded && /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { tabIndex: 0, id, role: "dialog", className: className("panel"), children: /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("panel-content"), children: [
|
|
205
204
|
/* @__PURE__ */ jsxDevRuntime.jsxDEV("h2", { className: "h4", children: heading }, void 0, false, {
|
|
206
205
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
207
|
-
lineNumber:
|
|
206
|
+
lineNumber: 175,
|
|
208
207
|
columnNumber: 7
|
|
209
208
|
}, void 0),
|
|
210
209
|
/* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("panel-body"), children }, void 0, false, {
|
|
211
210
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
212
|
-
lineNumber:
|
|
211
|
+
lineNumber: 178,
|
|
213
212
|
columnNumber: 7
|
|
214
213
|
}, void 0)
|
|
215
214
|
] }, void 0, true, {
|
|
216
215
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
217
|
-
lineNumber:
|
|
216
|
+
lineNumber: 174,
|
|
218
217
|
columnNumber: 6
|
|
219
218
|
}, void 0) }, void 0, false, {
|
|
220
219
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
221
|
-
lineNumber:
|
|
220
|
+
lineNumber: 173,
|
|
222
221
|
columnNumber: 5
|
|
223
222
|
}, void 0)
|
|
224
223
|
]
|
|
@@ -227,7 +226,7 @@ const DevPanel = ({ heading, icon, children, preview }) => {
|
|
|
227
226
|
true,
|
|
228
227
|
{
|
|
229
228
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
230
|
-
lineNumber:
|
|
229
|
+
lineNumber: 139,
|
|
231
230
|
columnNumber: 3
|
|
232
231
|
},
|
|
233
232
|
void 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevBar.cjs","sources":["../../../../src/ui/DevBar/DevBar.tsx"],"sourcesContent":["import {\n\tuseClassNameFactory,\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\nexport const DevBar = ({\n\tbreakpoint = 768,\n\tchildren,\n\tbrand,\n}: PropsWithChildren<{\n\tbrand?: ReactNode;\n\tbreakpoint?: number;\n}>) => {\n\tconst className = useClassNameFactory('devBar')\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 className = useClassNameFactory('devBar')\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', 'dangerously-remove-native-focus-outline')}>\n\t\t\t\t\t<div className={className('panel-content', 'native-focus-outline-handler')}>\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":["useClassNameFactory","useState","useWindowSize","useRef","useReferentiallyStableCallback","expanded","useEffect","useOnElementClickOutsideCallback","useId","jsxDEV","dataAttribute","this","useOnElementMouseEnterDelayedCallback"],"mappings":";;;;;;AAWO,MAAM,SAAS,CAAC;AAAA,EACtB,aAAa;AAAA,EACb;AAAA,EACA;AACD,MAGO;AACA,QAAA,YAAYA,+BAAoB,QAAQ;AAC9C,QAAM,CAAC,UAAU,WAAW,IAAIC,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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AAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAhBvE;AAAA,UAAA;AAAA,UAAA;AAAA,YAAA,UAAA;AAAA,YAAA,YAAA;AAAA,YAAA,cAAA;AAAA,UAAA;AAAA,UAAAA;AAAAA,QAiBA;AAAA,QACC,YACCF,8BAAAA,OAAA,OAAA,EAAI,UAAU,GAAG,IAAQ,MAAK,UAAS,WAAW,UAAU,SAAS,yCAAyC,GAC9G,UAACA,8BAAA,OAAA,OAAA,EAAI,WAAW,UAAU,iBAAiB,8BAA8B,GACxE,UAAA;AAAA,UAACA,qCAAA,MAAA,EAAG,WAAU,MACZ,UADF,QAAA,GAAA,QAAA,OAAA;AAAA,YAAA,UAAA;AAAA,YAAA,YAAA;AAAA,YAAA,cAAA;AAAA,UAEA,GAAAE,MAAA;AAAA,+CACC,OAAI,EAAA,WAAW,UAAU,YAAY,GACpC,SADF,GAAA,QAAA,OAAA;AAAA,YAAA,UAAA;AAAA,YAAA,YAAA;AAAA,YAAA,cAAA;AAAA,UAEA,GAAAA,MAAA;AAAA,QAAA,KAND,QAAA,MAAA;AAAA,UAAA,UAAA;AAAA,UAAA,YAAA;AAAA,UAAA,cAAA;AAAA,QAAA,GAAAA,MAOA,EARD,GAAA,QAAA,OAAA;AAAA,UAAA,UAAA;AAAA,UAAA,YAAA;AAAA,UAAA,cAAA;AAAA,QASA,GAAAA,MAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IA3CF;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AA+CF;;;"}
|
|
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","jsxDEV","dataAttribute","this","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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UAAA;AAAA,YAAA,YAAA;AAAA,YAAA,cAAA;AAAA,UAEA,GAAAE,MAAA;AAAA,+CACC,OAAI,EAAA,WAAW,UAAU,YAAY,GACpC,SADF,GAAA,QAAA,OAAA;AAAA,YAAA,UAAA;AAAA,YAAA,YAAA;AAAA,YAAA,cAAA;AAAA,UAEA,GAAAA,MAAA;AAAA,QAAA,KAND,QAAA,MAAA;AAAA,UAAA,UAAA;AAAA,UAAA,YAAA;AAAA,UAAA,cAAA;AAAA,QAAA,GAAAA,MAOA,EARD,GAAA,QAAA,OAAA;AAAA,UAAA,UAAA;AAAA,UAAA,YAAA;AAAA,UAAA,cAAA;AAAA,QASA,GAAAA,MAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IA3CF;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AA+CF;;;"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsxDEV } from "react/jsx-dev-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);
|
|
@@ -138,7 +138,6 @@ const DevBar = ({
|
|
|
138
138
|
};
|
|
139
139
|
const DevPanel = ({ heading, icon, children, preview }) => {
|
|
140
140
|
const id = `cui-devBar-panel-${useId()}`;
|
|
141
|
-
const className = useClassNameFactory("devBar");
|
|
142
141
|
const [expanded, setExpanded] = useState(false);
|
|
143
142
|
const mouseEnterTimeStampRef = useRef(void 0);
|
|
144
143
|
const devPanelRef = useRef(null);
|
|
@@ -185,7 +184,7 @@ const DevPanel = ({ heading, icon, children, preview }) => {
|
|
|
185
184
|
icon,
|
|
186
185
|
/* @__PURE__ */ jsxDEV("span", { className: className("trigger-label-text"), children: preview ?? heading }, void 0, false, {
|
|
187
186
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
188
|
-
lineNumber:
|
|
187
|
+
lineNumber: 170,
|
|
189
188
|
columnNumber: 5
|
|
190
189
|
}, void 0)
|
|
191
190
|
]
|
|
@@ -194,29 +193,29 @@ const DevPanel = ({ heading, icon, children, preview }) => {
|
|
|
194
193
|
true,
|
|
195
194
|
{
|
|
196
195
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
197
|
-
lineNumber:
|
|
196
|
+
lineNumber: 154,
|
|
198
197
|
columnNumber: 4
|
|
199
198
|
},
|
|
200
199
|
void 0
|
|
201
200
|
),
|
|
202
|
-
expanded && /* @__PURE__ */ jsxDEV("div", { tabIndex: 0, id, role: "dialog", className: className("panel"
|
|
201
|
+
expanded && /* @__PURE__ */ jsxDEV("div", { tabIndex: 0, id, role: "dialog", className: className("panel"), children: /* @__PURE__ */ jsxDEV("div", { className: className("panel-content"), children: [
|
|
203
202
|
/* @__PURE__ */ jsxDEV("h2", { className: "h4", children: heading }, void 0, false, {
|
|
204
203
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
205
|
-
lineNumber:
|
|
204
|
+
lineNumber: 175,
|
|
206
205
|
columnNumber: 7
|
|
207
206
|
}, void 0),
|
|
208
207
|
/* @__PURE__ */ jsxDEV("div", { className: className("panel-body"), children }, void 0, false, {
|
|
209
208
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
210
|
-
lineNumber:
|
|
209
|
+
lineNumber: 178,
|
|
211
210
|
columnNumber: 7
|
|
212
211
|
}, void 0)
|
|
213
212
|
] }, void 0, true, {
|
|
214
213
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
215
|
-
lineNumber:
|
|
214
|
+
lineNumber: 174,
|
|
216
215
|
columnNumber: 6
|
|
217
216
|
}, void 0) }, void 0, false, {
|
|
218
217
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
219
|
-
lineNumber:
|
|
218
|
+
lineNumber: 173,
|
|
220
219
|
columnNumber: 5
|
|
221
220
|
}, void 0)
|
|
222
221
|
]
|
|
@@ -225,7 +224,7 @@ const DevPanel = ({ heading, icon, children, preview }) => {
|
|
|
225
224
|
true,
|
|
226
225
|
{
|
|
227
226
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
228
|
-
lineNumber:
|
|
227
|
+
lineNumber: 139,
|
|
229
228
|
columnNumber: 3
|
|
230
229
|
},
|
|
231
230
|
void 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevBar.js","sources":["../../../../src/ui/DevBar/DevBar.tsx"],"sourcesContent":["import {\n\tuseClassNameFactory,\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\nexport const DevBar = ({\n\tbreakpoint = 768,\n\tchildren,\n\tbrand,\n}: PropsWithChildren<{\n\tbrand?: ReactNode;\n\tbreakpoint?: number;\n}>) => {\n\tconst className = useClassNameFactory('devBar')\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 className = useClassNameFactory('devBar')\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', 'dangerously-remove-native-focus-outline')}>\n\t\t\t\t\t<div className={className('panel-content', 'native-focus-outline-handler')}>\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","this"],"mappings":";;;;AAWO,MAAM,SAAS,CAAC;AAAA,EACtB,aAAa;AAAA,EACb;AA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AA;AAAA,MAAA;AAAA,IAAA;AAAA,IA3CF;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AA+CF;"}
|
|
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","this"],"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;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,WAA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UAAU,eAAe,GACxC,UAAA;AAAA,UAAC,uBAAA,MAAA,EAAG,WAAU,MACZ,UADF,QAAA,GAAA,QAAA,OAAA;AAAA,YAAA,UAAA;AAAA,YAAA,YAAA;AAAA,YAAA,cAAA;AAAA,UAEA,GAAAA,MAAA;AAAA,iCACC,OAAI,EAAA,WAAW,UAAU,YAAY,GACpC,SADF,GAAA,QAAA,OAAA;AAAA,YAAA,UAAA;AAAA,YAAA,YAAA;AAAA,YAAA,cAAA;AAAA,UAEA,GAAAA,MAAA;AAAA,QAAA,KAND,QAAA,MAAA;AAAA,UAAA,UAAA;AAAA,UAAA,YAAA;AAAA,UAAA,cAAA;AAAA,QAAA,GAAAA,MAOA,EARD,GAAA,QAAA,OAAA;AAAA,UAAA,UAAA;AAAA,UAAA,YAAA;AAAA,UAAA,cAAA;AAAA,QASA,GAAAA,MAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IA3CF;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AA+CF;"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxDevRuntime = require("react/jsx-dev-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__ */ jsxDevRuntime.jsxDEV("div", { className: componentClassName("bar"), children: /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: componentClassName("errorSource"), children: props.source }, void 0, false, {
|
|
7
|
+
return /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className(), children: /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("in"), children: [
|
|
8
|
+
/* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("bar"), children: /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("errorSource"), children: props.source }, void 0, false, {
|
|
10
9
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/DevError.tsx",
|
|
11
10
|
lineNumber: 15,
|
|
12
11
|
columnNumber: 6
|
|
@@ -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":["jsxDEV","DevErrorInner"],"mappings":";;;;AAMA,MAAM,YAAY,CAAC,QAAwB,MAAM,gBAAgB,GAAG,KAAK;AAElE,SAAS,SAAS,OAAsB;AAG7C,SAAAA,8BAAA,OAAC,OAAI,EAAA,WAAW,UAAU,GACzB,+CAAC,OAAI,EAAA,WAAW,UAAU,IAAI,GAC7B,UAAA;AAAA,IAAAA,qCAAC,OAAI,EAAA,WAAW,UAAU,KAAK,GAC9B,UAAAA,8BAAAA,OAAC,OAAI,EAAA,WAAW,UAAU,aAAa,GAAI,UAAA,MAAM,OAAjD,GAAA,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAA,IAAwD,EADzD,GAAA,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAEA,GAAA,IAAA;AAAA,IACCA,qCAAAC,cAAAA,eAAA,EAAc,OAAO,MAAM,SAA5B,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAmC,GAAA,IAAA;AAAA,EAAA,KAJpC,QAAA,MAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAA,IAKA,EAND,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAOA,GAAA,IAAA;AAEF;;"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsxDEV } from "react/jsx-dev-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__ */ jsxDEV("div", { className: componentClassName("bar"), children: /* @__PURE__ */ jsxDEV("div", { className: componentClassName("errorSource"), children: props.source }, void 0, false, {
|
|
5
|
+
return /* @__PURE__ */ jsxDEV("div", { className: className(), children: /* @__PURE__ */ jsxDEV("div", { className: className("in"), children: [
|
|
6
|
+
/* @__PURE__ */ jsxDEV("div", { className: className("bar"), children: /* @__PURE__ */ jsxDEV("div", { className: className("errorSource"), children: props.source }, void 0, false, {
|
|
8
7
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/DevError.tsx",
|
|
9
8
|
lineNumber: 15,
|
|
10
9
|
columnNumber: 6
|
|
@@ -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,uBAAC,OAAI,EAAA,WAAW,UAAU,GACzB,iCAAC,OAAI,EAAA,WAAW,UAAU,IAAI,GAC7B,UAAA;AAAA,IAAA,uBAAC,OAAI,EAAA,WAAW,UAAU,KAAK,GAC9B,UAAA,uBAAC,OAAI,EAAA,WAAW,UAAU,aAAa,GAAI,UAAA,MAAM,OAAjD,GAAA,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAA,IAAwD,EADzD,GAAA,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAEA,GAAA,IAAA;AAAA,IACC,uBAAA,eAAA,EAAc,OAAO,MAAM,SAA5B,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAmC,GAAA,IAAA;AAAA,EAAA,KAJpC,QAAA,MAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAA,IAKA,EAND,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAOA,GAAA,IAAA;AAEF;"}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
|
-
const
|
|
4
|
+
const className = (cls) => cls ? `cui-devErrorBadge-${cls}` : "cui-devErrorBadge";
|
|
5
5
|
function DevErrorBadge({ errorCount, onOpen }) {
|
|
6
|
-
|
|
7
|
-
return /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: componentClassName(), children: /* @__PURE__ */ jsxDevRuntime.jsxDEV("a", { className: componentClassName("button"), onClick: onOpen, children: [
|
|
6
|
+
return /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className(), children: /* @__PURE__ */ jsxDevRuntime.jsxDEV("a", { className: className("button"), onClick: onOpen, children: [
|
|
8
7
|
errorCount,
|
|
9
8
|
" ",
|
|
10
9
|
errorCount > 1 ? "errors" : "error"
|
|
11
10
|
] }, void 0, true, {
|
|
12
11
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/DevErrorBadge.tsx",
|
|
13
|
-
lineNumber:
|
|
12
|
+
lineNumber: 12,
|
|
14
13
|
columnNumber: 4
|
|
15
14
|
}, this) }, void 0, false, {
|
|
16
15
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/DevErrorBadge.tsx",
|
|
17
|
-
lineNumber:
|
|
16
|
+
lineNumber: 11,
|
|
18
17
|
columnNumber: 3
|
|
19
18
|
}, this);
|
|
20
19
|
}
|
|
@@ -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":["jsxDEV"],"mappings":";;;AAMA,MAAM,YAAY,CAAC,QAAwB,MAAM,qBAAqB,GAAG,KAAK;AAEvE,SAAS,cAAc,EAAE,YAAY,UAA8B;AACzE,SACEA,8BAAAA,OAAA,OAAA,EAAI,WAAW,UAAA,GACf,UAAAA,8BAAA,OAAC,KAAE,EAAA,WAAW,UAAU,QAAQ,GAAG,SAAS,QAC1C,UAAA;AAAA,IAAA;AAAA,IAAW;AAAA,IAAE,aAAa,IAAI,WAAW;AAAA,EAAA,KAD3C,QAAA,MAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAA,IAEA,EAHD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAIA,GAAA,IAAA;AAEF;;"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
|
-
|
|
2
|
+
const className = (cls) => cls ? `cui-devErrorBadge-${cls}` : "cui-devErrorBadge";
|
|
3
3
|
function DevErrorBadge({ errorCount, onOpen }) {
|
|
4
|
-
|
|
5
|
-
return /* @__PURE__ */ jsxDEV("div", { className: componentClassName(), children: /* @__PURE__ */ jsxDEV("a", { className: componentClassName("button"), onClick: onOpen, children: [
|
|
4
|
+
return /* @__PURE__ */ jsxDEV("div", { className: className(), children: /* @__PURE__ */ jsxDEV("a", { className: className("button"), onClick: onOpen, children: [
|
|
6
5
|
errorCount,
|
|
7
6
|
" ",
|
|
8
7
|
errorCount > 1 ? "errors" : "error"
|
|
9
8
|
] }, void 0, true, {
|
|
10
9
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/DevErrorBadge.tsx",
|
|
11
|
-
lineNumber:
|
|
10
|
+
lineNumber: 12,
|
|
12
11
|
columnNumber: 4
|
|
13
12
|
}, this) }, void 0, false, {
|
|
14
13
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/DevErrorBadge.tsx",
|
|
15
|
-
lineNumber:
|
|
14
|
+
lineNumber: 11,
|
|
16
15
|
columnNumber: 3
|
|
17
16
|
}, this);
|
|
18
17
|
}
|
|
@@ -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,uBAAA,OAAA,EAAI,WAAW,UAAA,GACf,UAAA,uBAAC,KAAE,EAAA,WAAW,UAAU,QAAQ,GAAG,SAAS,QAC1C,UAAA;AAAA,IAAA;AAAA,IAAW;AAAA,IAAE,aAAa,IAAI,WAAW;AAAA,EAAA,KAD3C,QAAA,MAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAA,IAEA,EAHD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAIA,GAAA,IAAA;AAEF;"}
|
|
@@ -1,78 +1,77 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxDevRuntime = require("react/jsx-dev-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__ */ jsxDevRuntime.jsxDEV(jsxDevRuntime.Fragment, { children: [
|
|
10
|
-
/* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className:
|
|
11
|
-
/* @__PURE__ */ jsxDevRuntime.jsxDEV("h1", { className:
|
|
9
|
+
/* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("header"), children: errorObject ? /* @__PURE__ */ jsxDevRuntime.jsxDEV(jsxDevRuntime.Fragment, { children: [
|
|
10
|
+
/* @__PURE__ */ jsxDevRuntime.jsxDEV("h1", { className: className("errorName"), children: errorObject.name }, void 0, false, {
|
|
12
11
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/DevErrorInner.tsx",
|
|
13
|
-
lineNumber:
|
|
12
|
+
lineNumber: 21,
|
|
14
13
|
columnNumber: 7
|
|
15
14
|
}, this),
|
|
16
|
-
error.cause && /* @__PURE__ */ jsxDevRuntime.jsxDEV("a", { href: `#error-${level}`, className:
|
|
15
|
+
error.cause && /* @__PURE__ */ jsxDevRuntime.jsxDEV("a", { href: `#error-${level}`, className: className("causeLink"), children: "caused by >" }, void 0, false, {
|
|
17
16
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/DevErrorInner.tsx",
|
|
18
|
-
lineNumber:
|
|
17
|
+
lineNumber: 22,
|
|
19
18
|
columnNumber: 23
|
|
20
19
|
}, this),
|
|
21
|
-
errorObject.message && /* @__PURE__ */ jsxDevRuntime.jsxDEV("h2", { className:
|
|
20
|
+
errorObject.message && /* @__PURE__ */ jsxDevRuntime.jsxDEV("h2", { className: className("errorMessage"), children: errorObject.message }, void 0, false, {
|
|
22
21
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/DevErrorInner.tsx",
|
|
23
|
-
lineNumber:
|
|
22
|
+
lineNumber: 23,
|
|
24
23
|
columnNumber: 31
|
|
25
24
|
}, this),
|
|
26
|
-
"details" in errorObject && /* @__PURE__ */ jsxDevRuntime.jsxDEV("h3", { className:
|
|
25
|
+
"details" in errorObject && /* @__PURE__ */ jsxDevRuntime.jsxDEV("h3", { className: className("errorDetails"), children: errorObject.details }, void 0, false, {
|
|
27
26
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/DevErrorInner.tsx",
|
|
28
|
-
lineNumber:
|
|
27
|
+
lineNumber: 24,
|
|
29
28
|
columnNumber: 36
|
|
30
29
|
}, this)
|
|
31
30
|
] }, void 0, true, {
|
|
32
31
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/DevErrorInner.tsx",
|
|
33
|
-
lineNumber:
|
|
32
|
+
lineNumber: 20,
|
|
34
33
|
columnNumber: 6
|
|
35
|
-
}, this) : /* @__PURE__ */ jsxDevRuntime.jsxDEV("h1", { className:
|
|
34
|
+
}, this) : /* @__PURE__ */ jsxDevRuntime.jsxDEV("h1", { className: className("errorName"), children: "Unknown error" }, void 0, false, {
|
|
36
35
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/DevErrorInner.tsx",
|
|
37
|
-
lineNumber:
|
|
36
|
+
lineNumber: 27,
|
|
38
37
|
columnNumber: 6
|
|
39
38
|
}, this) }, void 0, false, {
|
|
40
39
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/DevErrorInner.tsx",
|
|
41
|
-
lineNumber:
|
|
40
|
+
lineNumber: 18,
|
|
42
41
|
columnNumber: 4
|
|
43
42
|
}, this),
|
|
44
43
|
error.parsedStackStrace ? /* @__PURE__ */ jsxDevRuntime.jsxDEV(StackTrace.StackTrace, { stackTrace: error.parsedStackStrace }, void 0, false, {
|
|
45
44
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/DevErrorInner.tsx",
|
|
46
|
-
lineNumber:
|
|
45
|
+
lineNumber: 31,
|
|
47
46
|
columnNumber: 5
|
|
48
|
-
}, this) : errorObject?.stack ? /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className:
|
|
47
|
+
}, this) : errorObject?.stack ? /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("stack"), children: /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("stack-dump"), children: errorObject.stack }, void 0, false, {
|
|
49
48
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/DevErrorInner.tsx",
|
|
50
|
-
lineNumber:
|
|
49
|
+
lineNumber: 34,
|
|
51
50
|
columnNumber: 6
|
|
52
51
|
}, this) }, void 0, false, {
|
|
53
52
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/DevErrorInner.tsx",
|
|
54
|
-
lineNumber:
|
|
53
|
+
lineNumber: 33,
|
|
55
54
|
columnNumber: 5
|
|
56
55
|
}, this) : null,
|
|
57
56
|
error.cause ? /* @__PURE__ */ jsxDevRuntime.jsxDEV(jsxDevRuntime.Fragment, { children: [
|
|
58
|
-
/* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className:
|
|
57
|
+
/* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("causedBy"), id: `error-${level}`, children: "Caused by" }, void 0, false, {
|
|
59
58
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/DevErrorInner.tsx",
|
|
60
|
-
lineNumber:
|
|
59
|
+
lineNumber: 39,
|
|
61
60
|
columnNumber: 6
|
|
62
61
|
}, this),
|
|
63
62
|
/* @__PURE__ */ jsxDevRuntime.jsxDEV(DevErrorInner, { error: error.cause, level: level + 1 }, void 0, false, {
|
|
64
63
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/DevErrorInner.tsx",
|
|
65
|
-
lineNumber:
|
|
64
|
+
lineNumber: 42,
|
|
66
65
|
columnNumber: 6
|
|
67
66
|
}, this)
|
|
68
67
|
] }, void 0, true, {
|
|
69
68
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/DevErrorInner.tsx",
|
|
70
|
-
lineNumber:
|
|
69
|
+
lineNumber: 38,
|
|
71
70
|
columnNumber: 5
|
|
72
71
|
}, this) : null
|
|
73
72
|
] }, void 0, true, {
|
|
74
73
|
fileName: "/__w/interface/interface/packages/react-devbar/src/ui/DevError/DevErrorInner.tsx",
|
|
75
|
-
lineNumber:
|
|
74
|
+
lineNumber: 17,
|
|
76
75
|
columnNumber: 3
|
|
77
76
|
}, this);
|
|
78
77
|
}
|
|
@@ -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) : null}\n\t\t</>\n\t)\n}\n"],"names":["jsxDEV","Fragment","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,8BAAA,OAAAC,wBAAA,EAAA,UAAA;AAAA,IAAAD,8BAAAA,OAAC,SAAI,WAAW,UAAU,QAAQ,GAChC,wBAECA,8BAAAA,OAAAC,cAAA,UAAA,EAAA,UAAA;AAAA,MAAAD,8BAAAA,OAAC,QA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