@contember/react-devbar 2.1.0-alpha.36 → 2.1.0-alpha.39
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/index.cjs +17 -0
- package/dist/development/index.cjs.map +1 -0
- package/dist/development/index.js +17 -0
- package/dist/development/index.js.map +1 -0
- package/dist/development/src/DevErrorManager.cjs +110 -0
- package/dist/development/src/DevErrorManager.cjs.map +1 -0
- package/dist/development/src/DevErrorManager.js +110 -0
- package/dist/development/src/DevErrorManager.js.map +1 -0
- package/dist/development/src/errorHandling.cjs +55 -0
- package/dist/development/src/errorHandling.cjs.map +1 -0
- package/dist/development/src/errorHandling.js +55 -0
- package/dist/development/src/errorHandling.js.map +1 -0
- package/dist/development/src/hooks/useCopyErrorMarkdown.cjs +101 -0
- package/dist/development/src/hooks/useCopyErrorMarkdown.cjs.map +1 -0
- package/dist/development/src/hooks/useCopyErrorMarkdown.js +101 -0
- package/dist/development/src/hooks/useCopyErrorMarkdown.js.map +1 -0
- package/dist/development/src/hooks/useParsedStacktrace.cjs +67 -0
- package/dist/development/src/hooks/useParsedStacktrace.cjs.map +1 -0
- package/dist/development/src/hooks/useParsedStacktrace.js +45 -0
- package/dist/development/src/hooks/useParsedStacktrace.js.map +1 -0
- package/dist/development/src/ui/DevBar/DevBar.cjs +193 -0
- package/dist/development/src/ui/DevBar/DevBar.cjs.map +1 -0
- package/dist/development/src/ui/DevBar/DevBar.js +193 -0
- package/dist/development/src/ui/DevBar/DevBar.js.map +1 -0
- package/dist/development/src/ui/DevError/DevError.cjs +33 -0
- package/dist/development/src/ui/DevError/DevError.cjs.map +1 -0
- package/dist/development/src/ui/DevError/DevError.js +33 -0
- package/dist/development/src/ui/DevError/DevError.js.map +1 -0
- package/dist/development/src/ui/DevError/DevErrorBadge.cjs +21 -0
- package/dist/development/src/ui/DevError/DevErrorBadge.cjs.map +1 -0
- package/dist/development/src/ui/DevError/DevErrorBadge.js +21 -0
- package/dist/development/src/ui/DevError/DevErrorBadge.js.map +1 -0
- package/dist/development/src/ui/DevError/DevErrorCopy.cjs +36 -0
- package/dist/development/src/ui/DevError/DevErrorCopy.cjs.map +1 -0
- package/dist/development/src/ui/DevError/DevErrorCopy.js +36 -0
- package/dist/development/src/ui/DevError/DevErrorCopy.js.map +1 -0
- package/dist/development/src/ui/DevError/DevErrorInner.cjs +79 -0
- package/dist/development/src/ui/DevError/DevErrorInner.cjs.map +1 -0
- package/dist/development/src/ui/DevError/DevErrorInner.js +79 -0
- package/dist/development/src/ui/DevError/DevErrorInner.js.map +1 -0
- package/dist/development/src/ui/DevError/DevErrorList.cjs +119 -0
- package/dist/development/src/ui/DevError/DevErrorList.cjs.map +1 -0
- package/dist/development/src/ui/DevError/DevErrorList.js +119 -0
- package/dist/development/src/ui/DevError/DevErrorList.js.map +1 -0
- package/dist/development/src/ui/DevError/StackTrace.cjs +82 -0
- package/dist/development/src/ui/DevError/StackTrace.cjs.map +1 -0
- package/dist/development/src/ui/DevError/StackTrace.js +82 -0
- package/dist/development/src/ui/DevError/StackTrace.js.map +1 -0
- package/dist/production/index.cjs +17 -0
- package/dist/production/index.cjs.map +1 -0
- package/dist/production/index.js +17 -0
- package/dist/production/index.js.map +1 -0
- package/dist/production/src/errorHandling.cjs +39 -0
- package/dist/production/src/errorHandling.cjs.map +1 -0
- package/dist/production/src/errorHandling.js +39 -0
- package/dist/production/src/errorHandling.js.map +1 -0
- package/dist/production/src/hooks/useCopyErrorMarkdown.cjs +101 -0
- package/dist/production/src/hooks/useCopyErrorMarkdown.cjs.map +1 -0
- package/dist/production/src/hooks/useCopyErrorMarkdown.js +101 -0
- package/dist/production/src/hooks/useCopyErrorMarkdown.js.map +1 -0
- package/dist/production/src/hooks/useParsedStacktrace.cjs +67 -0
- package/dist/production/src/hooks/useParsedStacktrace.cjs.map +1 -0
- package/dist/production/src/hooks/useParsedStacktrace.js +45 -0
- package/dist/production/src/hooks/useParsedStacktrace.js.map +1 -0
- package/dist/production/src/ui/DevBar/DevBar.cjs +125 -0
- package/dist/production/src/ui/DevBar/DevBar.cjs.map +1 -0
- package/dist/production/src/ui/DevBar/DevBar.js +125 -0
- package/dist/production/src/ui/DevBar/DevBar.js.map +1 -0
- package/dist/production/src/ui/DevError/DevError.cjs +13 -0
- package/dist/production/src/ui/DevError/DevError.cjs.map +1 -0
- package/dist/production/src/ui/DevError/DevError.js +13 -0
- package/dist/production/src/ui/DevError/DevError.js.map +1 -0
- package/dist/production/src/ui/DevError/DevErrorBadge.cjs +13 -0
- package/dist/production/src/ui/DevError/DevErrorBadge.cjs.map +1 -0
- package/dist/production/src/ui/DevError/DevErrorBadge.js +13 -0
- package/dist/production/src/ui/DevError/DevErrorBadge.js.map +1 -0
- package/dist/production/src/ui/DevError/DevErrorCopy.cjs +28 -0
- package/dist/production/src/ui/DevError/DevErrorCopy.cjs.map +1 -0
- package/dist/production/src/ui/DevError/DevErrorCopy.js +28 -0
- package/dist/production/src/ui/DevError/DevErrorCopy.js.map +1 -0
- package/dist/production/src/ui/DevError/DevErrorInner.cjs +23 -0
- package/dist/production/src/ui/DevError/DevErrorInner.cjs.map +1 -0
- package/dist/production/src/ui/DevError/DevErrorInner.js +23 -0
- package/dist/production/src/ui/DevError/DevErrorInner.js.map +1 -0
- package/dist/production/src/ui/DevError/DevErrorList.cjs +51 -0
- package/dist/production/src/ui/DevError/DevErrorList.cjs.map +1 -0
- package/dist/production/src/ui/DevError/DevErrorList.js +51 -0
- package/dist/production/src/ui/DevError/DevErrorList.js.map +1 -0
- package/dist/production/src/ui/DevError/StackTrace.cjs +39 -0
- package/dist/production/src/ui/DevError/StackTrace.cjs.map +1 -0
- package/dist/production/src/ui/DevError/StackTrace.js +39 -0
- package/dist/production/src/ui/DevError/StackTrace.js.map +1 -0
- package/dist/types/DevErrorManager.d.ts +15 -0
- package/dist/types/DevErrorManager.d.ts.map +1 -0
- package/dist/types/errorHandling.d.ts +6 -0
- package/dist/types/errorHandling.d.ts.map +1 -0
- package/dist/types/hooks/useCopyErrorMarkdown.d.ts +12 -0
- package/dist/types/hooks/useCopyErrorMarkdown.d.ts.map +1 -0
- package/dist/types/hooks/useParsedStacktrace.d.ts +10 -0
- package/dist/types/hooks/useParsedStacktrace.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/dist/types/ui/DevBar/DevBar.d.ts +13 -0
- package/dist/types/ui/DevBar/DevBar.d.ts.map +1 -0
- package/dist/types/ui/DevBar/index.d.ts +2 -0
- package/dist/types/ui/DevBar/index.d.ts.map +1 -0
- package/dist/types/ui/DevError/DevError.d.ts +6 -0
- package/dist/types/ui/DevError/DevError.d.ts.map +1 -0
- package/dist/types/ui/DevError/DevErrorBadge.d.ts +7 -0
- package/dist/types/ui/DevError/DevErrorBadge.d.ts.map +1 -0
- package/dist/types/ui/DevError/DevErrorCopy.d.ts +6 -0
- package/dist/types/ui/DevError/DevErrorCopy.d.ts.map +1 -0
- package/dist/types/ui/DevError/DevErrorInner.d.ts +7 -0
- package/dist/types/ui/DevError/DevErrorInner.d.ts.map +1 -0
- package/dist/types/ui/DevError/DevErrorList.d.ts +13 -0
- package/dist/types/ui/DevError/DevErrorList.d.ts.map +1 -0
- package/dist/types/ui/DevError/StackTrace.d.ts +5 -0
- package/dist/types/ui/DevError/StackTrace.d.ts.map +1 -0
- package/dist/types/ui/DevError/index.d.ts +5 -0
- package/dist/types/ui/DevError/index.d.ts.map +1 -0
- package/dist/types/ui/DevError/types.d.ts +15 -0
- package/dist/types/ui/DevError/types.d.ts.map +1 -0
- package/package.json +10 -10
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
25
|
+
const React = require("react");
|
|
26
|
+
const parseStacktrace = async (e) => {
|
|
27
|
+
let StackTracey;
|
|
28
|
+
try {
|
|
29
|
+
StackTracey = (await import("stacktracey")).default;
|
|
30
|
+
} catch {
|
|
31
|
+
return void 0;
|
|
32
|
+
}
|
|
33
|
+
return (await new StackTracey(e).withSourcesAsync()).items.map((it) => ({
|
|
34
|
+
filename: it.fileShort,
|
|
35
|
+
line: it.line,
|
|
36
|
+
callee: it.callee,
|
|
37
|
+
thirdParty: it.thirdParty,
|
|
38
|
+
sourceCodeLines: it.sourceFile?.lines
|
|
39
|
+
}));
|
|
40
|
+
};
|
|
41
|
+
const createInitialError = (e) => ({
|
|
42
|
+
error: e,
|
|
43
|
+
cause: e instanceof Error && "cause" in e && e.cause !== void 0 ? createInitialError(e.cause) : void 0
|
|
44
|
+
});
|
|
45
|
+
const useProcessedError = (e) => {
|
|
46
|
+
const [error, setError] = React.useState(() => createInitialError(e));
|
|
47
|
+
React.useEffect(() => {
|
|
48
|
+
setError(createInitialError(e));
|
|
49
|
+
if (!(e instanceof Error)) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const createErrorWithStackTrace = async (e2) => {
|
|
53
|
+
return {
|
|
54
|
+
error: e2,
|
|
55
|
+
parsedStackStrace: e2 instanceof Error ? await parseStacktrace(e2) : void 0,
|
|
56
|
+
cause: e2 instanceof Error && "cause" in e2 && e2.cause !== void 0 ? await createErrorWithStackTrace(e2.cause) : void 0
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
(async () => {
|
|
60
|
+
setError(await createErrorWithStackTrace(e));
|
|
61
|
+
})();
|
|
62
|
+
}, [e]);
|
|
63
|
+
return error;
|
|
64
|
+
};
|
|
65
|
+
exports.parseStacktrace = parseStacktrace;
|
|
66
|
+
exports.useProcessedError = useProcessedError;
|
|
67
|
+
//# sourceMappingURL=useParsedStacktrace.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useParsedStacktrace.cjs","sources":["../../../../../packages/react-devbar/src/hooks/useParsedStacktrace.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { ErrorType, ProcessedError } from '../ui/DevError'\n\nexport const parseStacktrace = async (e: Error) => {\n\tlet StackTracey\n\ttry {\n\t\tStackTracey = (await import('stacktracey')).default\n\t} catch {\n\t\treturn undefined\n\t}\n\treturn (await new StackTracey(e).withSourcesAsync()).items.map(it => ({\n\t\tfilename: it.fileShort,\n\t\tline: it.line,\n\t\tcallee: it.callee,\n\t\tthirdParty: it.thirdParty,\n\t\tsourceCodeLines: it.sourceFile?.lines,\n\t}))\n}\n\nconst createInitialError = (e: ErrorType): ProcessedError => ({\n\terror: e,\n\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? createInitialError((e as any).cause) : undefined,\n})\n\nexport const useProcessedError = (e: ErrorType): ProcessedError => {\n\tconst [error, setError] = useState<ProcessedError>(() => createInitialError(e))\n\tuseEffect(() => {\n\t\tsetError(createInitialError(e))\n\t\tif (!(e instanceof Error)) {\n\t\t\treturn\n\t\t}\n\t\tconst createErrorWithStackTrace = async (e: ErrorType): Promise<ProcessedError> => {\n\t\t\treturn {\n\t\t\t\terror: e,\n\t\t\t\tparsedStackStrace: e instanceof Error ? await parseStacktrace(e) : undefined,\n\t\t\t\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? await createErrorWithStackTrace((e as any).cause) : undefined,\n\t\t\t}\n\t\t}\n\t\t;(async () => {\n\t\t\tsetError(await createErrorWithStackTrace(e))\n\t\t})()\n\t}, [e])\n\n\treturn error\n}\n"],"names":["useState","useEffect","e"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGO,MAAM,kBAAkB,OAAO,MAAa;AAClD,MAAI;AACJ,MAAI;AACH,mBAAe,MAAM,OAAO,aAAa,GAAG;AAAA,EAC7C,QAAQ;AACP,WAAO;AAAA,EACR;AACA,UAAQ,MAAM,IAAI,YAAY,CAAC,EAAE,iBAAA,GAAoB,MAAM,IAAI,CAAA,QAAO;AAAA,IACrE,UAAU,GAAG;AAAA,IACb,MAAM,GAAG;AAAA,IACT,QAAQ,GAAG;AAAA,IACX,YAAY,GAAG;AAAA,IACf,iBAAiB,GAAG,YAAY;AAAA,EAAA,EAC/B;AACH;AAEA,MAAM,qBAAqB,CAAC,OAAkC;AAAA,EAC7D,OAAO;AAAA,EACP,OAAO,aAAa,SAAS,WAAW,KAAM,EAAU,UAAU,SAAY,mBAAoB,EAAU,KAAK,IAAI;AACtH;AAEO,MAAM,oBAAoB,CAAC,MAAiC;AAClE,QAAM,CAAC,OAAO,QAAQ,IAAIA,MAAAA,SAAyB,MAAM,mBAAmB,CAAC,CAAC;AAC9EC,QAAAA,UAAU,MAAM;AACf,aAAS,mBAAmB,CAAC,CAAC;AAC9B,QAAI,EAAE,aAAa,QAAQ;AAC1B;AAAA,IACD;AACA,UAAM,4BAA4B,OAAOC,OAA0C;AAClF,aAAO;AAAA,QACN,OAAOA;AAAAA,QACP,mBAAmBA,cAAa,QAAQ,MAAM,gBAAgBA,EAAC,IAAI;AAAA,QACnE,OAAOA,cAAa,SAAS,WAAWA,MAAMA,GAAU,UAAU,SAAY,MAAM,0BAA2BA,GAAU,KAAK,IAAI;AAAA,MAAA;AAAA,IAEpI;AACC,KAAC,YAAY;AACb,eAAS,MAAM,0BAA0B,CAAC,CAAC;AAAA,IAC5C,GAAA;AAAA,EACD,GAAG,CAAC,CAAC,CAAC;AAEN,SAAO;AACR;;;"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
const parseStacktrace = async (e) => {
|
|
3
|
+
let StackTracey;
|
|
4
|
+
try {
|
|
5
|
+
StackTracey = (await import("stacktracey")).default;
|
|
6
|
+
} catch {
|
|
7
|
+
return void 0;
|
|
8
|
+
}
|
|
9
|
+
return (await new StackTracey(e).withSourcesAsync()).items.map((it) => ({
|
|
10
|
+
filename: it.fileShort,
|
|
11
|
+
line: it.line,
|
|
12
|
+
callee: it.callee,
|
|
13
|
+
thirdParty: it.thirdParty,
|
|
14
|
+
sourceCodeLines: it.sourceFile?.lines
|
|
15
|
+
}));
|
|
16
|
+
};
|
|
17
|
+
const createInitialError = (e) => ({
|
|
18
|
+
error: e,
|
|
19
|
+
cause: e instanceof Error && "cause" in e && e.cause !== void 0 ? createInitialError(e.cause) : void 0
|
|
20
|
+
});
|
|
21
|
+
const useProcessedError = (e) => {
|
|
22
|
+
const [error, setError] = useState(() => createInitialError(e));
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
setError(createInitialError(e));
|
|
25
|
+
if (!(e instanceof Error)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const createErrorWithStackTrace = async (e2) => {
|
|
29
|
+
return {
|
|
30
|
+
error: e2,
|
|
31
|
+
parsedStackStrace: e2 instanceof Error ? await parseStacktrace(e2) : void 0,
|
|
32
|
+
cause: e2 instanceof Error && "cause" in e2 && e2.cause !== void 0 ? await createErrorWithStackTrace(e2.cause) : void 0
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
(async () => {
|
|
36
|
+
setError(await createErrorWithStackTrace(e));
|
|
37
|
+
})();
|
|
38
|
+
}, [e]);
|
|
39
|
+
return error;
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
parseStacktrace,
|
|
43
|
+
useProcessedError
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=useParsedStacktrace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useParsedStacktrace.js","sources":["../../../../../packages/react-devbar/src/hooks/useParsedStacktrace.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { ErrorType, ProcessedError } from '../ui/DevError'\n\nexport const parseStacktrace = async (e: Error) => {\n\tlet StackTracey\n\ttry {\n\t\tStackTracey = (await import('stacktracey')).default\n\t} catch {\n\t\treturn undefined\n\t}\n\treturn (await new StackTracey(e).withSourcesAsync()).items.map(it => ({\n\t\tfilename: it.fileShort,\n\t\tline: it.line,\n\t\tcallee: it.callee,\n\t\tthirdParty: it.thirdParty,\n\t\tsourceCodeLines: it.sourceFile?.lines,\n\t}))\n}\n\nconst createInitialError = (e: ErrorType): ProcessedError => ({\n\terror: e,\n\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? createInitialError((e as any).cause) : undefined,\n})\n\nexport const useProcessedError = (e: ErrorType): ProcessedError => {\n\tconst [error, setError] = useState<ProcessedError>(() => createInitialError(e))\n\tuseEffect(() => {\n\t\tsetError(createInitialError(e))\n\t\tif (!(e instanceof Error)) {\n\t\t\treturn\n\t\t}\n\t\tconst createErrorWithStackTrace = async (e: ErrorType): Promise<ProcessedError> => {\n\t\t\treturn {\n\t\t\t\terror: e,\n\t\t\t\tparsedStackStrace: e instanceof Error ? await parseStacktrace(e) : undefined,\n\t\t\t\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? await createErrorWithStackTrace((e as any).cause) : undefined,\n\t\t\t}\n\t\t}\n\t\t;(async () => {\n\t\t\tsetError(await createErrorWithStackTrace(e))\n\t\t})()\n\t}, [e])\n\n\treturn error\n}\n"],"names":["e"],"mappings":";AAGO,MAAM,kBAAkB,OAAO,MAAa;AAClD,MAAI;AACJ,MAAI;AACH,mBAAe,MAAM,OAAO,aAAa,GAAG;AAAA,EAC7C,QAAQ;AACP,WAAO;AAAA,EACR;AACA,UAAQ,MAAM,IAAI,YAAY,CAAC,EAAE,iBAAA,GAAoB,MAAM,IAAI,CAAA,QAAO;AAAA,IACrE,UAAU,GAAG;AAAA,IACb,MAAM,GAAG;AAAA,IACT,QAAQ,GAAG;AAAA,IACX,YAAY,GAAG;AAAA,IACf,iBAAiB,GAAG,YAAY;AAAA,EAAA,EAC/B;AACH;AAEA,MAAM,qBAAqB,CAAC,OAAkC;AAAA,EAC7D,OAAO;AAAA,EACP,OAAO,aAAa,SAAS,WAAW,KAAM,EAAU,UAAU,SAAY,mBAAoB,EAAU,KAAK,IAAI;AACtH;AAEO,MAAM,oBAAoB,CAAC,MAAiC;AAClE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAyB,MAAM,mBAAmB,CAAC,CAAC;AAC9E,YAAU,MAAM;AACf,aAAS,mBAAmB,CAAC,CAAC;AAC9B,QAAI,EAAE,aAAa,QAAQ;AAC1B;AAAA,IACD;AACA,UAAM,4BAA4B,OAAOA,OAA0C;AAClF,aAAO;AAAA,QACN,OAAOA;AAAAA,QACP,mBAAmBA,cAAa,QAAQ,MAAM,gBAAgBA,EAAC,IAAI;AAAA,QACnE,OAAOA,cAAa,SAAS,WAAWA,MAAMA,GAAU,UAAU,SAAY,MAAM,0BAA2BA,GAAU,KAAK,IAAI;AAAA,MAAA;AAAA,IAEpI;AACC,KAAC,YAAY;AACb,eAAS,MAAM,0BAA0B,CAAC,CAAC;AAAA,IAC5C,GAAA;AAAA,EACD,GAAG,CAAC,CAAC,CAAC;AAEN,SAAO;AACR;"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
|
+
const reactUtils = require("@contember/react-utils");
|
|
5
|
+
const utilities = require("@contember/utilities");
|
|
6
|
+
const React = require("react");
|
|
7
|
+
const className = (cls) => cls ? `cui-devBar-${cls}` : "cui-devBar";
|
|
8
|
+
const DevBar = ({
|
|
9
|
+
breakpoint = 768,
|
|
10
|
+
children
|
|
11
|
+
}) => {
|
|
12
|
+
const [expanded, setExpanded] = React.useState(false);
|
|
13
|
+
const isSmallScreen = reactUtils.useWindowSize().width < breakpoint;
|
|
14
|
+
const handleToggle = reactUtils.useReferentiallyStableCallback(() => {
|
|
15
|
+
setExpanded((expanded2) => !expanded2);
|
|
16
|
+
});
|
|
17
|
+
React.useEffect(() => {
|
|
18
|
+
function handleKeyDown(event) {
|
|
19
|
+
if (event.code === "KeyJ" && (event.ctrlKey || event.metaKey)) {
|
|
20
|
+
event.preventDefault();
|
|
21
|
+
event.stopPropagation();
|
|
22
|
+
handleToggle();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
26
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
27
|
+
}, [expanded, handleToggle]);
|
|
28
|
+
const devBarContentRef = React.useRef(null);
|
|
29
|
+
reactUtils.useOnElementClickOutsideCallback(devBarContentRef, () => {
|
|
30
|
+
if (expanded) {
|
|
31
|
+
setExpanded(false);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const id = `dev-bar-panel${reactUtils.useId()}`;
|
|
35
|
+
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(
|
|
36
|
+
"section",
|
|
37
|
+
{
|
|
38
|
+
"data-transparent": "true",
|
|
39
|
+
"data-overrides-lucide-icons": "true",
|
|
40
|
+
"data-expanded": utilities.dataAttribute(expanded),
|
|
41
|
+
"data-small-screen": utilities.dataAttribute(isSmallScreen),
|
|
42
|
+
className: className(null),
|
|
43
|
+
children: /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { ref: devBarContentRef, className: className("content"), children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(
|
|
44
|
+
"div",
|
|
45
|
+
{
|
|
46
|
+
"data-expanded": true,
|
|
47
|
+
id,
|
|
48
|
+
role: "dialog",
|
|
49
|
+
style: { display: "contents" },
|
|
50
|
+
children: /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("panels"), children }, void 0, false, {
|
|
51
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
52
|
+
lineNumber: 60,
|
|
53
|
+
columnNumber: 6
|
|
54
|
+
}, void 0)
|
|
55
|
+
},
|
|
56
|
+
void 0,
|
|
57
|
+
false,
|
|
58
|
+
{
|
|
59
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
60
|
+
lineNumber: 54,
|
|
61
|
+
columnNumber: 5
|
|
62
|
+
},
|
|
63
|
+
void 0
|
|
64
|
+
) }, void 0, false, {
|
|
65
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
66
|
+
lineNumber: 53,
|
|
67
|
+
columnNumber: 4
|
|
68
|
+
}, void 0)
|
|
69
|
+
},
|
|
70
|
+
void 0,
|
|
71
|
+
false,
|
|
72
|
+
{
|
|
73
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
74
|
+
lineNumber: 46,
|
|
75
|
+
columnNumber: 3
|
|
76
|
+
},
|
|
77
|
+
void 0
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
const DevPanel = ({ heading, icon, children, preview }) => {
|
|
81
|
+
const id = `cui-devBar-panel-${reactUtils.useId()}`;
|
|
82
|
+
const dialogRef = React.useRef(null);
|
|
83
|
+
const triggerRef = React.useRef(null);
|
|
84
|
+
const handleOpen = React.useCallback(() => {
|
|
85
|
+
dialogRef.current?.showModal();
|
|
86
|
+
}, []);
|
|
87
|
+
const handleClose = React.useCallback(() => {
|
|
88
|
+
dialogRef.current?.close();
|
|
89
|
+
}, []);
|
|
90
|
+
React.useEffect(() => {
|
|
91
|
+
const dialog = dialogRef.current;
|
|
92
|
+
if (!dialog) return;
|
|
93
|
+
const handleClickOutside = (event) => {
|
|
94
|
+
const rect = dialog.getBoundingClientRect();
|
|
95
|
+
const isInDialog = rect.top <= event.clientY && event.clientY <= rect.top + rect.height && rect.left <= event.clientX && event.clientX <= rect.left + rect.width;
|
|
96
|
+
if (!isInDialog) {
|
|
97
|
+
dialog.close();
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
dialog.addEventListener("click", handleClickOutside);
|
|
101
|
+
return () => dialog.removeEventListener("click", handleClickOutside);
|
|
102
|
+
}, []);
|
|
103
|
+
React.useEffect(() => {
|
|
104
|
+
const handleEscape = (event) => {
|
|
105
|
+
if (event.key === "Escape") {
|
|
106
|
+
handleClose();
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
document.addEventListener("keydown", handleEscape);
|
|
110
|
+
return () => document.removeEventListener("keydown", handleEscape);
|
|
111
|
+
}, [handleClose]);
|
|
112
|
+
return /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("trigger"), children: [
|
|
113
|
+
/* @__PURE__ */ jsxDevRuntime.jsxDEV(
|
|
114
|
+
"button",
|
|
115
|
+
{
|
|
116
|
+
type: "button",
|
|
117
|
+
ref: triggerRef,
|
|
118
|
+
tabIndex: 0,
|
|
119
|
+
"aria-haspopup": "dialog",
|
|
120
|
+
"aria-controls": id,
|
|
121
|
+
className: className("trigger-label"),
|
|
122
|
+
onClick: handleOpen,
|
|
123
|
+
children: [
|
|
124
|
+
icon,
|
|
125
|
+
/* @__PURE__ */ jsxDevRuntime.jsxDEV("span", { className: className("trigger-label-text"), children: preview ?? heading }, void 0, false, {
|
|
126
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
127
|
+
lineNumber: 132,
|
|
128
|
+
columnNumber: 5
|
|
129
|
+
}, void 0)
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
void 0,
|
|
133
|
+
true,
|
|
134
|
+
{
|
|
135
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
136
|
+
lineNumber: 122,
|
|
137
|
+
columnNumber: 4
|
|
138
|
+
},
|
|
139
|
+
void 0
|
|
140
|
+
),
|
|
141
|
+
/* @__PURE__ */ jsxDevRuntime.jsxDEV("dialog", { ref: dialogRef, id, className: className("panel"), children: /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("panel-content"), children: [
|
|
142
|
+
/* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("panel-header"), children: [
|
|
143
|
+
/* @__PURE__ */ jsxDevRuntime.jsxDEV("h2", { className: "h4", children: heading }, void 0, false, {
|
|
144
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
145
|
+
lineNumber: 140,
|
|
146
|
+
columnNumber: 7
|
|
147
|
+
}, void 0),
|
|
148
|
+
/* @__PURE__ */ jsxDevRuntime.jsxDEV(
|
|
149
|
+
"button",
|
|
150
|
+
{
|
|
151
|
+
type: "button",
|
|
152
|
+
onClick: handleClose,
|
|
153
|
+
className: className("close-button"),
|
|
154
|
+
"aria-label": "Close",
|
|
155
|
+
children: "✕"
|
|
156
|
+
},
|
|
157
|
+
void 0,
|
|
158
|
+
false,
|
|
159
|
+
{
|
|
160
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
161
|
+
lineNumber: 141,
|
|
162
|
+
columnNumber: 7
|
|
163
|
+
},
|
|
164
|
+
void 0
|
|
165
|
+
)
|
|
166
|
+
] }, void 0, true, {
|
|
167
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
168
|
+
lineNumber: 139,
|
|
169
|
+
columnNumber: 6
|
|
170
|
+
}, void 0),
|
|
171
|
+
/* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("panel-body"), children }, void 0, false, {
|
|
172
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
173
|
+
lineNumber: 150,
|
|
174
|
+
columnNumber: 6
|
|
175
|
+
}, void 0)
|
|
176
|
+
] }, void 0, true, {
|
|
177
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
178
|
+
lineNumber: 138,
|
|
179
|
+
columnNumber: 5
|
|
180
|
+
}, void 0) }, void 0, false, {
|
|
181
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
182
|
+
lineNumber: 137,
|
|
183
|
+
columnNumber: 4
|
|
184
|
+
}, void 0)
|
|
185
|
+
] }, void 0, true, {
|
|
186
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
187
|
+
lineNumber: 121,
|
|
188
|
+
columnNumber: 3
|
|
189
|
+
}, void 0);
|
|
190
|
+
};
|
|
191
|
+
exports.DevBar = DevBar;
|
|
192
|
+
exports.DevPanel = DevPanel;
|
|
193
|
+
//# sourceMappingURL=DevBar.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DevBar.cjs","sources":["../../../../../../packages/react-devbar/src/ui/DevBar/DevBar.tsx"],"sourcesContent":["import { useId, useOnElementClickOutsideCallback, useReferentiallyStableCallback, useWindowSize } from '@contember/react-utils'\nimport { dataAttribute } from '@contember/utilities'\nimport { type PropsWithChildren, type ReactNode, useCallback, useEffect, useRef, useState } from 'react'\n\nconst className = (cls: string | null) => cls ? `cui-devBar-${cls}` : 'cui-devBar'\n\nexport const DevBar = ({\n\tbreakpoint = 768,\n\tchildren,\n}: PropsWithChildren<{\n\tbreakpoint?: number\n}>) => {\n\tconst [expanded, setExpanded] = useState(false)\n\tconst isSmallScreen = useWindowSize().width < breakpoint\n\n\tconst handleToggle = useReferentiallyStableCallback(() => {\n\t\tsetExpanded(expanded => !expanded)\n\t})\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: intentional\n\tuseEffect(() => {\n\t\tfunction handleKeyDown(event: KeyboardEvent) {\n\t\t\tif (event.code === 'KeyJ' && (event.ctrlKey || event.metaKey)) {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tevent.stopPropagation()\n\n\t\t\t\thandleToggle()\n\t\t\t}\n\t\t}\n\n\t\tdocument.addEventListener('keydown', handleKeyDown)\n\t\treturn () => document.removeEventListener('keydown', handleKeyDown)\n\t}, [expanded, handleToggle])\n\n\tconst devBarContentRef = useRef<HTMLDivElement>(null)\n\n\tuseOnElementClickOutsideCallback(devBarContentRef, () => {\n\t\tif (expanded) {\n\t\t\tsetExpanded(false)\n\t\t}\n\t})\n\n\tconst id = `dev-bar-panel${useId()}`\n\n\treturn (\n\t\t<section\n\t\t\tdata-transparent=\"true\"\n\t\t\tdata-overrides-lucide-icons=\"true\"\n\t\t\tdata-expanded={dataAttribute(expanded)}\n\t\t\tdata-small-screen={dataAttribute(isSmallScreen)}\n\t\t\tclassName={className(null)}\n\t\t>\n\t\t\t<div ref={devBarContentRef} className={className('content')}>\n\t\t\t\t<div\n\t\t\t\t\tdata-expanded={true}\n\t\t\t\t\tid={id}\n\t\t\t\t\trole=\"dialog\"\n\t\t\t\t\tstyle={{ display: 'contents' }}\n\t\t\t\t>\n\t\t\t\t\t<div className={className('panels')}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</section>\n\t)\n}\n\ninterface DevPanelProps {\n\ticon: ReactNode\n\theading: ReactNode\n\tchildren: ReactNode\n\tpreview?: ReactNode\n}\n\nexport const DevPanel = ({ heading, icon, children, preview }: DevPanelProps) => {\n\tconst id = `cui-devBar-panel-${useId()}`\n\tconst dialogRef = useRef<HTMLDialogElement>(null)\n\tconst triggerRef = useRef<HTMLButtonElement>(null)\n\n\tconst handleOpen = useCallback(() => {\n\t\tdialogRef.current?.showModal()\n\t}, [])\n\n\tconst handleClose = useCallback(() => {\n\t\tdialogRef.current?.close()\n\t}, [])\n\n\tuseEffect(() => {\n\t\tconst dialog = dialogRef.current\n\t\tif (!dialog) return\n\n\t\tconst handleClickOutside = (event: MouseEvent) => {\n\t\t\tconst rect = dialog.getBoundingClientRect()\n\t\t\tconst isInDialog = rect.top <= event.clientY\n\t\t\t\t&& event.clientY <= rect.top + rect.height\n\t\t\t\t&& rect.left <= event.clientX\n\t\t\t\t&& event.clientX <= rect.left + rect.width\n\n\t\t\tif (!isInDialog) {\n\t\t\t\tdialog.close()\n\t\t\t}\n\t\t}\n\n\t\tdialog.addEventListener('click', handleClickOutside)\n\t\treturn () => dialog.removeEventListener('click', handleClickOutside)\n\t}, [])\n\n\tuseEffect(() => {\n\t\tconst handleEscape = (event: KeyboardEvent) => {\n\t\t\tif (event.key === 'Escape') {\n\t\t\t\thandleClose()\n\t\t\t}\n\t\t}\n\n\t\tdocument.addEventListener('keydown', handleEscape)\n\t\treturn () => document.removeEventListener('keydown', handleEscape)\n\t}, [handleClose])\n\n\treturn (\n\t\t<div className={className('trigger')}>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tref={triggerRef}\n\t\t\t\ttabIndex={0}\n\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\taria-controls={id}\n\t\t\t\tclassName={className('trigger-label')}\n\t\t\t\tonClick={handleOpen}\n\t\t\t>\n\t\t\t\t{icon}\n\t\t\t\t<span className={className('trigger-label-text')}>\n\t\t\t\t\t{preview ?? heading}\n\t\t\t\t</span>\n\t\t\t</button>\n\n\t\t\t<dialog ref={dialogRef} id={id} className={className('panel')}>\n\t\t\t\t<div className={className('panel-content')}>\n\t\t\t\t\t<div className={className('panel-header')}>\n\t\t\t\t\t\t<h2 className=\"h4\">{heading}</h2>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tonClick={handleClose}\n\t\t\t\t\t\t\tclassName={className('close-button')}\n\t\t\t\t\t\t\taria-label=\"Close\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t✕\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className={className('panel-body')}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</dialog>\n\t\t</div>\n\t)\n}\n"],"names":["useState","useWindowSize","useReferentiallyStableCallback","expanded","useEffect","useRef","useOnElementClickOutsideCallback","useId","jsxDEV","dataAttribute","this","useCallback"],"mappings":";;;;;;AAIA,MAAM,YAAY,CAAC,QAAuB,MAAM,cAAc,GAAG,KAAK;AAE/D,MAAM,SAAS,CAAC;AAAA,EACtB,aAAa;AAAA,EACb;AACD,MAEO;AACN,QAAM,CAAC,UAAU,WAAW,IAAIA,MAAAA,SAAS,KAAK;AAC9C,QAAM,gBAAgBC,WAAAA,gBAAgB,QAAQ;AAE9C,QAAM,eAAeC,WAAAA,+BAA+B,MAAM;AACzD,gBAAY,CAAAC,cAAY,CAACA,SAAQ;AAAA,EAClC,CAAC;AAGDC,QAAAA,UAAU,MAAM;AACf,aAAS,cAAc,OAAsB;AAC5C,UAAI,MAAM,SAAS,WAAW,MAAM,WAAW,MAAM,UAAU;AAC9D,cAAM,eAAA;AACN,cAAM,gBAAA;AAEN,qBAAA;AAAA,MACD;AAAA,IACD;AAEA,aAAS,iBAAiB,WAAW,aAAa;AAClD,WAAO,M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,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAA,GAAAA,MAEA;AAAA,IAAA,EAAA,GAdD,QAAA,MAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAeA,EAAA,GAhBD,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAiBA;AAAA,EAAA,EAAA,GAjCD,QAAA,MAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAkCA;AAEF;;;"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
|
+
import { useWindowSize, useReferentiallyStableCallback, useOnElementClickOutsideCallback, useId } from "@contember/react-utils";
|
|
3
|
+
import { dataAttribute } from "@contember/utilities";
|
|
4
|
+
import { useState, useEffect, useRef, useCallback } from "react";
|
|
5
|
+
const className = (cls) => cls ? `cui-devBar-${cls}` : "cui-devBar";
|
|
6
|
+
const DevBar = ({
|
|
7
|
+
breakpoint = 768,
|
|
8
|
+
children
|
|
9
|
+
}) => {
|
|
10
|
+
const [expanded, setExpanded] = useState(false);
|
|
11
|
+
const isSmallScreen = useWindowSize().width < breakpoint;
|
|
12
|
+
const handleToggle = useReferentiallyStableCallback(() => {
|
|
13
|
+
setExpanded((expanded2) => !expanded2);
|
|
14
|
+
});
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
function handleKeyDown(event) {
|
|
17
|
+
if (event.code === "KeyJ" && (event.ctrlKey || event.metaKey)) {
|
|
18
|
+
event.preventDefault();
|
|
19
|
+
event.stopPropagation();
|
|
20
|
+
handleToggle();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
24
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
25
|
+
}, [expanded, handleToggle]);
|
|
26
|
+
const devBarContentRef = useRef(null);
|
|
27
|
+
useOnElementClickOutsideCallback(devBarContentRef, () => {
|
|
28
|
+
if (expanded) {
|
|
29
|
+
setExpanded(false);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const id = `dev-bar-panel${useId()}`;
|
|
33
|
+
return /* @__PURE__ */ jsxDEV(
|
|
34
|
+
"section",
|
|
35
|
+
{
|
|
36
|
+
"data-transparent": "true",
|
|
37
|
+
"data-overrides-lucide-icons": "true",
|
|
38
|
+
"data-expanded": dataAttribute(expanded),
|
|
39
|
+
"data-small-screen": dataAttribute(isSmallScreen),
|
|
40
|
+
className: className(null),
|
|
41
|
+
children: /* @__PURE__ */ jsxDEV("div", { ref: devBarContentRef, className: className("content"), children: /* @__PURE__ */ jsxDEV(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
"data-expanded": true,
|
|
45
|
+
id,
|
|
46
|
+
role: "dialog",
|
|
47
|
+
style: { display: "contents" },
|
|
48
|
+
children: /* @__PURE__ */ jsxDEV("div", { className: className("panels"), children }, void 0, false, {
|
|
49
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
50
|
+
lineNumber: 60,
|
|
51
|
+
columnNumber: 6
|
|
52
|
+
}, void 0)
|
|
53
|
+
},
|
|
54
|
+
void 0,
|
|
55
|
+
false,
|
|
56
|
+
{
|
|
57
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
58
|
+
lineNumber: 54,
|
|
59
|
+
columnNumber: 5
|
|
60
|
+
},
|
|
61
|
+
void 0
|
|
62
|
+
) }, void 0, false, {
|
|
63
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
64
|
+
lineNumber: 53,
|
|
65
|
+
columnNumber: 4
|
|
66
|
+
}, void 0)
|
|
67
|
+
},
|
|
68
|
+
void 0,
|
|
69
|
+
false,
|
|
70
|
+
{
|
|
71
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
72
|
+
lineNumber: 46,
|
|
73
|
+
columnNumber: 3
|
|
74
|
+
},
|
|
75
|
+
void 0
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
const DevPanel = ({ heading, icon, children, preview }) => {
|
|
79
|
+
const id = `cui-devBar-panel-${useId()}`;
|
|
80
|
+
const dialogRef = useRef(null);
|
|
81
|
+
const triggerRef = useRef(null);
|
|
82
|
+
const handleOpen = useCallback(() => {
|
|
83
|
+
dialogRef.current?.showModal();
|
|
84
|
+
}, []);
|
|
85
|
+
const handleClose = useCallback(() => {
|
|
86
|
+
dialogRef.current?.close();
|
|
87
|
+
}, []);
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
const dialog = dialogRef.current;
|
|
90
|
+
if (!dialog) return;
|
|
91
|
+
const handleClickOutside = (event) => {
|
|
92
|
+
const rect = dialog.getBoundingClientRect();
|
|
93
|
+
const isInDialog = rect.top <= event.clientY && event.clientY <= rect.top + rect.height && rect.left <= event.clientX && event.clientX <= rect.left + rect.width;
|
|
94
|
+
if (!isInDialog) {
|
|
95
|
+
dialog.close();
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
dialog.addEventListener("click", handleClickOutside);
|
|
99
|
+
return () => dialog.removeEventListener("click", handleClickOutside);
|
|
100
|
+
}, []);
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
const handleEscape = (event) => {
|
|
103
|
+
if (event.key === "Escape") {
|
|
104
|
+
handleClose();
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
document.addEventListener("keydown", handleEscape);
|
|
108
|
+
return () => document.removeEventListener("keydown", handleEscape);
|
|
109
|
+
}, [handleClose]);
|
|
110
|
+
return /* @__PURE__ */ jsxDEV("div", { className: className("trigger"), children: [
|
|
111
|
+
/* @__PURE__ */ jsxDEV(
|
|
112
|
+
"button",
|
|
113
|
+
{
|
|
114
|
+
type: "button",
|
|
115
|
+
ref: triggerRef,
|
|
116
|
+
tabIndex: 0,
|
|
117
|
+
"aria-haspopup": "dialog",
|
|
118
|
+
"aria-controls": id,
|
|
119
|
+
className: className("trigger-label"),
|
|
120
|
+
onClick: handleOpen,
|
|
121
|
+
children: [
|
|
122
|
+
icon,
|
|
123
|
+
/* @__PURE__ */ jsxDEV("span", { className: className("trigger-label-text"), children: preview ?? heading }, void 0, false, {
|
|
124
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
125
|
+
lineNumber: 132,
|
|
126
|
+
columnNumber: 5
|
|
127
|
+
}, void 0)
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
void 0,
|
|
131
|
+
true,
|
|
132
|
+
{
|
|
133
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
134
|
+
lineNumber: 122,
|
|
135
|
+
columnNumber: 4
|
|
136
|
+
},
|
|
137
|
+
void 0
|
|
138
|
+
),
|
|
139
|
+
/* @__PURE__ */ jsxDEV("dialog", { ref: dialogRef, id, className: className("panel"), children: /* @__PURE__ */ jsxDEV("div", { className: className("panel-content"), children: [
|
|
140
|
+
/* @__PURE__ */ jsxDEV("div", { className: className("panel-header"), children: [
|
|
141
|
+
/* @__PURE__ */ jsxDEV("h2", { className: "h4", children: heading }, void 0, false, {
|
|
142
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
143
|
+
lineNumber: 140,
|
|
144
|
+
columnNumber: 7
|
|
145
|
+
}, void 0),
|
|
146
|
+
/* @__PURE__ */ jsxDEV(
|
|
147
|
+
"button",
|
|
148
|
+
{
|
|
149
|
+
type: "button",
|
|
150
|
+
onClick: handleClose,
|
|
151
|
+
className: className("close-button"),
|
|
152
|
+
"aria-label": "Close",
|
|
153
|
+
children: "✕"
|
|
154
|
+
},
|
|
155
|
+
void 0,
|
|
156
|
+
false,
|
|
157
|
+
{
|
|
158
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
159
|
+
lineNumber: 141,
|
|
160
|
+
columnNumber: 7
|
|
161
|
+
},
|
|
162
|
+
void 0
|
|
163
|
+
)
|
|
164
|
+
] }, void 0, true, {
|
|
165
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
166
|
+
lineNumber: 139,
|
|
167
|
+
columnNumber: 6
|
|
168
|
+
}, void 0),
|
|
169
|
+
/* @__PURE__ */ jsxDEV("div", { className: className("panel-body"), children }, void 0, false, {
|
|
170
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
171
|
+
lineNumber: 150,
|
|
172
|
+
columnNumber: 6
|
|
173
|
+
}, void 0)
|
|
174
|
+
] }, void 0, true, {
|
|
175
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
176
|
+
lineNumber: 138,
|
|
177
|
+
columnNumber: 5
|
|
178
|
+
}, void 0) }, void 0, false, {
|
|
179
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
180
|
+
lineNumber: 137,
|
|
181
|
+
columnNumber: 4
|
|
182
|
+
}, void 0)
|
|
183
|
+
] }, void 0, true, {
|
|
184
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
185
|
+
lineNumber: 121,
|
|
186
|
+
columnNumber: 3
|
|
187
|
+
}, void 0);
|
|
188
|
+
};
|
|
189
|
+
export {
|
|
190
|
+
DevBar,
|
|
191
|
+
DevPanel
|
|
192
|
+
};
|
|
193
|
+
//# sourceMappingURL=DevBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DevBar.js","sources":["../../../../../../packages/react-devbar/src/ui/DevBar/DevBar.tsx"],"sourcesContent":["import { useId, useOnElementClickOutsideCallback, useReferentiallyStableCallback, useWindowSize } from '@contember/react-utils'\nimport { dataAttribute } from '@contember/utilities'\nimport { type PropsWithChildren, type ReactNode, useCallback, useEffect, useRef, useState } from 'react'\n\nconst className = (cls: string | null) => cls ? `cui-devBar-${cls}` : 'cui-devBar'\n\nexport const DevBar = ({\n\tbreakpoint = 768,\n\tchildren,\n}: PropsWithChildren<{\n\tbreakpoint?: number\n}>) => {\n\tconst [expanded, setExpanded] = useState(false)\n\tconst isSmallScreen = useWindowSize().width < breakpoint\n\n\tconst handleToggle = useReferentiallyStableCallback(() => {\n\t\tsetExpanded(expanded => !expanded)\n\t})\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: intentional\n\tuseEffect(() => {\n\t\tfunction handleKeyDown(event: KeyboardEvent) {\n\t\t\tif (event.code === 'KeyJ' && (event.ctrlKey || event.metaKey)) {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tevent.stopPropagation()\n\n\t\t\t\thandleToggle()\n\t\t\t}\n\t\t}\n\n\t\tdocument.addEventListener('keydown', handleKeyDown)\n\t\treturn () => document.removeEventListener('keydown', handleKeyDown)\n\t}, [expanded, handleToggle])\n\n\tconst devBarContentRef = useRef<HTMLDivElement>(null)\n\n\tuseOnElementClickOutsideCallback(devBarContentRef, () => {\n\t\tif (expanded) {\n\t\t\tsetExpanded(false)\n\t\t}\n\t})\n\n\tconst id = `dev-bar-panel${useId()}`\n\n\treturn (\n\t\t<section\n\t\t\tdata-transparent=\"true\"\n\t\t\tdata-overrides-lucide-icons=\"true\"\n\t\t\tdata-expanded={dataAttribute(expanded)}\n\t\t\tdata-small-screen={dataAttribute(isSmallScreen)}\n\t\t\tclassName={className(null)}\n\t\t>\n\t\t\t<div ref={devBarContentRef} className={className('content')}>\n\t\t\t\t<div\n\t\t\t\t\tdata-expanded={true}\n\t\t\t\t\tid={id}\n\t\t\t\t\trole=\"dialog\"\n\t\t\t\t\tstyle={{ display: 'contents' }}\n\t\t\t\t>\n\t\t\t\t\t<div className={className('panels')}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</section>\n\t)\n}\n\ninterface DevPanelProps {\n\ticon: ReactNode\n\theading: ReactNode\n\tchildren: ReactNode\n\tpreview?: ReactNode\n}\n\nexport const DevPanel = ({ heading, icon, children, preview }: DevPanelProps) => {\n\tconst id = `cui-devBar-panel-${useId()}`\n\tconst dialogRef = useRef<HTMLDialogElement>(null)\n\tconst triggerRef = useRef<HTMLButtonElement>(null)\n\n\tconst handleOpen = useCallback(() => {\n\t\tdialogRef.current?.showModal()\n\t}, [])\n\n\tconst handleClose = useCallback(() => {\n\t\tdialogRef.current?.close()\n\t}, [])\n\n\tuseEffect(() => {\n\t\tconst dialog = dialogRef.current\n\t\tif (!dialog) return\n\n\t\tconst handleClickOutside = (event: MouseEvent) => {\n\t\t\tconst rect = dialog.getBoundingClientRect()\n\t\t\tconst isInDialog = rect.top <= event.clientY\n\t\t\t\t&& event.clientY <= rect.top + rect.height\n\t\t\t\t&& rect.left <= event.clientX\n\t\t\t\t&& event.clientX <= rect.left + rect.width\n\n\t\t\tif (!isInDialog) {\n\t\t\t\tdialog.close()\n\t\t\t}\n\t\t}\n\n\t\tdialog.addEventListener('click', handleClickOutside)\n\t\treturn () => dialog.removeEventListener('click', handleClickOutside)\n\t}, [])\n\n\tuseEffect(() => {\n\t\tconst handleEscape = (event: KeyboardEvent) => {\n\t\t\tif (event.key === 'Escape') {\n\t\t\t\thandleClose()\n\t\t\t}\n\t\t}\n\n\t\tdocument.addEventListener('keydown', handleEscape)\n\t\treturn () => document.removeEventListener('keydown', handleEscape)\n\t}, [handleClose])\n\n\treturn (\n\t\t<div className={className('trigger')}>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tref={triggerRef}\n\t\t\t\ttabIndex={0}\n\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\taria-controls={id}\n\t\t\t\tclassName={className('trigger-label')}\n\t\t\t\tonClick={handleOpen}\n\t\t\t>\n\t\t\t\t{icon}\n\t\t\t\t<span className={className('trigger-label-text')}>\n\t\t\t\t\t{preview ?? heading}\n\t\t\t\t</span>\n\t\t\t</button>\n\n\t\t\t<dialog ref={dialogRef} id={id} className={className('panel')}>\n\t\t\t\t<div className={className('panel-content')}>\n\t\t\t\t\t<div className={className('panel-header')}>\n\t\t\t\t\t\t<h2 className=\"h4\">{heading}</h2>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tonClick={handleClose}\n\t\t\t\t\t\t\tclassName={className('close-button')}\n\t\t\t\t\t\t\taria-label=\"Close\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t✕\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className={className('panel-body')}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</dialog>\n\t\t</div>\n\t)\n}\n"],"names":["expanded","this"],"mappings":";;;;AAIA,MAAM,YAAY,CAAC,QAAuB,MAAM,cAAc,GAAG,KAAK;AAE/D,MAAM,SAAS,CAAC;AAAA,EACtB,aAAa;AAAA,EACb;AACD,MAEO;AACN,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAC9C,QAAM,gBAAgB,gBAAgB,QAAQ;AAE9C,QAAM,eAAe,+BAA+B,MAAM;AACzD,gBAAY,CAAAA,cAAY,CAACA,SAAQ;AAAA,EAClC,CAAC;AAGD,YAAU,MAAM;AACf,aAAS,cAAc,OAAsB;AAC5C,UAAI,MAAM,SAAS,WAAW,MAAM,WAAW,MAAM,UAAU;AAC9D,cAAM,eAAA;AACN,cAAM,gBAAA;AAEN,qBAAA;AAAA,MACD;AAAA,IACD;AAEA,aAAS,iBAAiB,WAAW,aAAa;AAClD,WAAO,MAAM,SAAS,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A,EAAA,GAhBD,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAiBA;AAAA,EAAA,EAAA,GAjCD,QAAA,MAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAkCA;AAEF;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
|
+
const DevErrorInner = require("./DevErrorInner.cjs");
|
|
5
|
+
const className = (cls) => cls ? `cui-devError-${cls}` : "cui-devError";
|
|
6
|
+
function DevError(props) {
|
|
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, {
|
|
9
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevError.tsx",
|
|
10
|
+
lineNumber: 14,
|
|
11
|
+
columnNumber: 6
|
|
12
|
+
}, this) }, void 0, false, {
|
|
13
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevError.tsx",
|
|
14
|
+
lineNumber: 13,
|
|
15
|
+
columnNumber: 5
|
|
16
|
+
}, this),
|
|
17
|
+
/* @__PURE__ */ jsxDevRuntime.jsxDEV(DevErrorInner.DevErrorInner, { error: props.error }, void 0, false, {
|
|
18
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevError.tsx",
|
|
19
|
+
lineNumber: 16,
|
|
20
|
+
columnNumber: 5
|
|
21
|
+
}, this)
|
|
22
|
+
] }, void 0, true, {
|
|
23
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevError.tsx",
|
|
24
|
+
lineNumber: 12,
|
|
25
|
+
columnNumber: 4
|
|
26
|
+
}, this) }, void 0, false, {
|
|
27
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevError.tsx",
|
|
28
|
+
lineNumber: 11,
|
|
29
|
+
columnNumber: 3
|
|
30
|
+
}, this);
|
|
31
|
+
}
|
|
32
|
+
exports.DevError = DevError;
|
|
33
|
+
//# sourceMappingURL=DevError.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DevError.cjs","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevError.tsx"],"sourcesContent":["import { DevErrorInner, DevErrorInnerProps } from './DevErrorInner'\n\nexport interface DevErrorProps extends DevErrorInnerProps {\n\tsource: string\n}\n\nconst className = (cls?: string | null) => cls ? `cui-devError-${cls}` : 'cui-devError'\n\nexport function DevError(props: DevErrorProps) {\n\treturn (\n\t\t<div className={className()}>\n\t\t\t<div className={className('in')}>\n\t\t\t\t<div className={className('bar')}>\n\t\t\t\t\t<div className={className('errorSource')}>{props.source}</div>\n\t\t\t\t</div>\n\t\t\t\t<DevErrorInner error={props.error} />\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"names":["jsxDEV","DevErrorInner"],"mappings":";;;;AAMA,MAAM,YAAY,CAAC,QAAwB,MAAM,gBAAgB,GAAG,KAAK;AAElE,SAAS,SAAS,OAAsB;AAC9C,SACCA,8BAAAA,OAAC,OAAA,EAAI,WAAW,UAAA,GACf,+CAAC,OAAA,EAAI,WAAW,UAAU,IAAI,GAC7B,UAAA;AAAA,IAAAA,qCAAC,OAAA,EAAI,WAAW,UAAU,KAAK,GAC9B,UAAAA,8BAAAA,OAAC,OAAA,EAAI,WAAW,UAAU,aAAa,GAAI,UAAA,MAAM,OAAA,GAAjD,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAA,IAAwD,EAAA,GADzD,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAA,IAEA;AAAA,IACAA,8BAAAA,OAACC,cAAAA,eAAA,EAAc,OAAO,MAAM,MAAA,GAA5B,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAA,IAAmC;AAAA,EAAA,EAAA,GAJpC,QAAA,MAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAA,IAKA,EAAA,GAND,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAA,IAOA;AAEF;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
|
+
import { DevErrorInner } from "./DevErrorInner.js";
|
|
3
|
+
const className = (cls) => cls ? `cui-devError-${cls}` : "cui-devError";
|
|
4
|
+
function DevError(props) {
|
|
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, {
|
|
7
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevError.tsx",
|
|
8
|
+
lineNumber: 14,
|
|
9
|
+
columnNumber: 6
|
|
10
|
+
}, this) }, void 0, false, {
|
|
11
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevError.tsx",
|
|
12
|
+
lineNumber: 13,
|
|
13
|
+
columnNumber: 5
|
|
14
|
+
}, this),
|
|
15
|
+
/* @__PURE__ */ jsxDEV(DevErrorInner, { error: props.error }, void 0, false, {
|
|
16
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevError.tsx",
|
|
17
|
+
lineNumber: 16,
|
|
18
|
+
columnNumber: 5
|
|
19
|
+
}, this)
|
|
20
|
+
] }, void 0, true, {
|
|
21
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevError.tsx",
|
|
22
|
+
lineNumber: 12,
|
|
23
|
+
columnNumber: 4
|
|
24
|
+
}, this) }, void 0, false, {
|
|
25
|
+
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevError/DevError.tsx",
|
|
26
|
+
lineNumber: 11,
|
|
27
|
+
columnNumber: 3
|
|
28
|
+
}, this);
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
DevError
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=DevError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DevError.js","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevError.tsx"],"sourcesContent":["import { DevErrorInner, DevErrorInnerProps } from './DevErrorInner'\n\nexport interface DevErrorProps extends DevErrorInnerProps {\n\tsource: string\n}\n\nconst className = (cls?: string | null) => cls ? `cui-devError-${cls}` : 'cui-devError'\n\nexport function DevError(props: DevErrorProps) {\n\treturn (\n\t\t<div className={className()}>\n\t\t\t<div className={className('in')}>\n\t\t\t\t<div className={className('bar')}>\n\t\t\t\t\t<div className={className('errorSource')}>{props.source}</div>\n\t\t\t\t</div>\n\t\t\t\t<DevErrorInner error={props.error} />\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"names":[],"mappings":";;AAMA,MAAM,YAAY,CAAC,QAAwB,MAAM,gBAAgB,GAAG,KAAK;AAElE,SAAS,SAAS,OAAsB;AAC9C,SACC,uBAAC,OAAA,EAAI,WAAW,UAAA,GACf,iCAAC,OAAA,EAAI,WAAW,UAAU,IAAI,GAC7B,UAAA;AAAA,IAAA,uBAAC,OAAA,EAAI,WAAW,UAAU,KAAK,GAC9B,UAAA,uBAAC,OAAA,EAAI,WAAW,UAAU,aAAa,GAAI,UAAA,MAAM,OAAA,GAAjD,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAA,IAAwD,EAAA,GADzD,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAA,IAEA;AAAA,IACA,uBAAC,eAAA,EAAc,OAAO,MAAM,MAAA,GAA5B,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAA,IAAmC;AAAA,EAAA,EAAA,GAJpC,QAAA,MAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAA,IAKA,EAAA,GAND,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAA,IAOA;AAEF;"}
|