@expo/metro-runtime 0.0.0
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/LICENSE +13 -0
- package/README.md +3 -0
- package/assets/alert-triangle.png +0 -0
- package/assets/chevron-left.png +0 -0
- package/assets/chevron-right.png +0 -0
- package/assets/close.png +0 -0
- package/assets/loader.png +0 -0
- package/asyncRequire.js +1 -0
- package/build/HMRClient.d.ts +17 -0
- package/build/HMRClient.d.ts.map +1 -0
- package/build/HMRClient.js +250 -0
- package/build/HMRClient.js.map +1 -0
- package/build/HMRClient.native.d.ts +1 -0
- package/build/HMRClient.native.d.ts.map +1 -0
- package/build/HMRClient.native.js +2 -0
- package/build/HMRClient.native.js.map +1 -0
- package/build/LoadingView.d.ts +8 -0
- package/build/LoadingView.d.ts.map +1 -0
- package/build/LoadingView.js +21 -0
- package/build/LoadingView.js.map +1 -0
- package/build/LoadingView.native.d.ts +1 -0
- package/build/LoadingView.native.d.ts.map +1 -0
- package/build/LoadingView.native.js +2 -0
- package/build/LoadingView.native.js.map +1 -0
- package/build/asyncRequire/buildAsyncRequire.d.ts +24 -0
- package/build/asyncRequire/buildAsyncRequire.d.ts.map +1 -0
- package/build/asyncRequire/buildAsyncRequire.js +50 -0
- package/build/asyncRequire/buildAsyncRequire.js.map +1 -0
- package/build/asyncRequire/buildUrlForBundle.d.ts +8 -0
- package/build/asyncRequire/buildUrlForBundle.d.ts.map +1 -0
- package/build/asyncRequire/buildUrlForBundle.js +25 -0
- package/build/asyncRequire/buildUrlForBundle.js.map +1 -0
- package/build/asyncRequire/buildUrlForBundle.native.d.ts +2 -0
- package/build/asyncRequire/buildUrlForBundle.native.d.ts.map +1 -0
- package/build/asyncRequire/buildUrlForBundle.native.js +25 -0
- package/build/asyncRequire/buildUrlForBundle.native.js.map +1 -0
- package/build/asyncRequire/fetchAsync.d.ts +5 -0
- package/build/asyncRequire/fetchAsync.d.ts.map +1 -0
- package/build/asyncRequire/fetchAsync.js +19 -0
- package/build/asyncRequire/fetchAsync.js.map +1 -0
- package/build/asyncRequire/fetchAsync.native.d.ts +12 -0
- package/build/asyncRequire/fetchAsync.native.d.ts.map +1 -0
- package/build/asyncRequire/fetchAsync.native.js +57 -0
- package/build/asyncRequire/fetchAsync.native.js.map +1 -0
- package/build/asyncRequire/fetchThenEval.d.ts +7 -0
- package/build/asyncRequire/fetchThenEval.d.ts.map +1 -0
- package/build/asyncRequire/fetchThenEval.js +30 -0
- package/build/asyncRequire/fetchThenEval.js.map +1 -0
- package/build/asyncRequire/fetchThenEval.web.d.ts +6 -0
- package/build/asyncRequire/fetchThenEval.web.d.ts.map +1 -0
- package/build/asyncRequire/fetchThenEval.web.js +29 -0
- package/build/asyncRequire/fetchThenEval.web.js.map +1 -0
- package/build/asyncRequire/index.d.ts +2 -0
- package/build/asyncRequire/index.d.ts.map +1 -0
- package/build/asyncRequire/index.js +5 -0
- package/build/asyncRequire/index.js.map +1 -0
- package/build/asyncRequire/loadBundle.android.d.ts +2 -0
- package/build/asyncRequire/loadBundle.android.d.ts.map +1 -0
- package/build/asyncRequire/loadBundle.android.js +22 -0
- package/build/asyncRequire/loadBundle.android.js.map +1 -0
- package/build/asyncRequire/loadBundle.d.ts +2 -0
- package/build/asyncRequire/loadBundle.d.ts.map +1 -0
- package/build/asyncRequire/loadBundle.js +6 -0
- package/build/asyncRequire/loadBundle.js.map +1 -0
- package/build/asyncRequire/loadBundlePolyfill.d.ts +7 -0
- package/build/asyncRequire/loadBundlePolyfill.d.ts.map +1 -0
- package/build/asyncRequire/loadBundlePolyfill.js +40 -0
- package/build/asyncRequire/loadBundlePolyfill.js.map +1 -0
- package/build/effects.d.ts +2 -0
- package/build/effects.d.ts.map +1 -0
- package/build/effects.js +16 -0
- package/build/effects.js.map +1 -0
- package/build/effects.native.d.ts +1 -0
- package/build/effects.native.d.ts.map +1 -0
- package/build/effects.native.js +1 -0
- package/build/effects.native.js.map +1 -0
- package/build/error-overlay/Data/LogBoxData.d.ts +60 -0
- package/build/error-overlay/Data/LogBoxData.d.ts.map +1 -0
- package/build/error-overlay/Data/LogBoxData.js +386 -0
- package/build/error-overlay/Data/LogBoxData.js.map +1 -0
- package/build/error-overlay/Data/LogBoxLog.d.ts +61 -0
- package/build/error-overlay/Data/LogBoxLog.d.ts.map +1 -0
- package/build/error-overlay/Data/LogBoxLog.js +148 -0
- package/build/error-overlay/Data/LogBoxLog.js.map +1 -0
- package/build/error-overlay/Data/LogBoxSymbolication.d.ts +17 -0
- package/build/error-overlay/Data/LogBoxSymbolication.d.ts.map +1 -0
- package/build/error-overlay/Data/LogBoxSymbolication.js +56 -0
- package/build/error-overlay/Data/LogBoxSymbolication.js.map +1 -0
- package/build/error-overlay/Data/LogContext.d.ts +14 -0
- package/build/error-overlay/Data/LogContext.d.ts.map +1 -0
- package/build/error-overlay/Data/LogContext.js +27 -0
- package/build/error-overlay/Data/LogContext.js.map +1 -0
- package/build/error-overlay/Data/parseLogBoxLog.d.ts +45 -0
- package/build/error-overlay/Data/parseLogBoxLog.d.ts.map +1 -0
- package/build/error-overlay/Data/parseLogBoxLog.js +286 -0
- package/build/error-overlay/Data/parseLogBoxLog.js.map +1 -0
- package/build/error-overlay/ErrorOverlay.d.ts +18 -0
- package/build/error-overlay/ErrorOverlay.d.ts.map +1 -0
- package/build/error-overlay/ErrorOverlay.js +146 -0
- package/build/error-overlay/ErrorOverlay.js.map +1 -0
- package/build/error-overlay/LogBox.d.ts +16 -0
- package/build/error-overlay/LogBox.d.ts.map +1 -0
- package/build/error-overlay/LogBox.js +31 -0
- package/build/error-overlay/LogBox.js.map +1 -0
- package/build/error-overlay/LogBox.web.d.ts +23 -0
- package/build/error-overlay/LogBox.web.d.ts.map +1 -0
- package/build/error-overlay/LogBox.web.js +129 -0
- package/build/error-overlay/LogBox.web.js.map +1 -0
- package/build/error-overlay/UI/AnsiHighlight.d.ts +6 -0
- package/build/error-overlay/UI/AnsiHighlight.d.ts.map +1 -0
- package/build/error-overlay/UI/AnsiHighlight.js +86 -0
- package/build/error-overlay/UI/AnsiHighlight.js.map +1 -0
- package/build/error-overlay/UI/LogBoxButton.d.ts +14 -0
- package/build/error-overlay/UI/LogBoxButton.d.ts.map +1 -0
- package/build/error-overlay/UI/LogBoxButton.js +59 -0
- package/build/error-overlay/UI/LogBoxButton.js.map +1 -0
- package/build/error-overlay/UI/LogBoxMessage.d.ts +11 -0
- package/build/error-overlay/UI/LogBoxMessage.d.ts.map +1 -0
- package/build/error-overlay/UI/LogBoxMessage.js +53 -0
- package/build/error-overlay/UI/LogBoxMessage.js.map +1 -0
- package/build/error-overlay/UI/LogBoxStyle.d.ts +22 -0
- package/build/error-overlay/UI/LogBoxStyle.d.ts.map +1 -0
- package/build/error-overlay/UI/LogBoxStyle.js +68 -0
- package/build/error-overlay/UI/LogBoxStyle.js.map +1 -0
- package/build/error-overlay/UI/constants.d.ts +2 -0
- package/build/error-overlay/UI/constants.d.ts.map +1 -0
- package/build/error-overlay/UI/constants.js +10 -0
- package/build/error-overlay/UI/constants.js.map +1 -0
- package/build/error-overlay/formatProjectFilePath.d.ts +2 -0
- package/build/error-overlay/formatProjectFilePath.d.ts.map +1 -0
- package/build/error-overlay/formatProjectFilePath.js +27 -0
- package/build/error-overlay/formatProjectFilePath.js.map +1 -0
- package/build/error-overlay/index.d.ts +3 -0
- package/build/error-overlay/index.d.ts.map +1 -0
- package/build/error-overlay/index.js +30 -0
- package/build/error-overlay/index.js.map +1 -0
- package/build/error-overlay/modules/ExceptionsManager/index.d.ts +38 -0
- package/build/error-overlay/modules/ExceptionsManager/index.d.ts.map +1 -0
- package/build/error-overlay/modules/ExceptionsManager/index.js +80 -0
- package/build/error-overlay/modules/ExceptionsManager/index.js.map +1 -0
- package/build/error-overlay/modules/ExceptionsManager/index.native.d.ts +2 -0
- package/build/error-overlay/modules/ExceptionsManager/index.native.d.ts.map +1 -0
- package/build/error-overlay/modules/ExceptionsManager/index.native.js +3 -0
- package/build/error-overlay/modules/ExceptionsManager/index.native.js.map +1 -0
- package/build/error-overlay/modules/NativeLogBox/index.d.ts +6 -0
- package/build/error-overlay/modules/NativeLogBox/index.d.ts.map +1 -0
- package/build/error-overlay/modules/NativeLogBox/index.js +34 -0
- package/build/error-overlay/modules/NativeLogBox/index.js.map +1 -0
- package/build/error-overlay/modules/NativeLogBox/index.native.d.ts +3 -0
- package/build/error-overlay/modules/NativeLogBox/index.native.d.ts.map +1 -0
- package/build/error-overlay/modules/NativeLogBox/index.native.js +8 -0
- package/build/error-overlay/modules/NativeLogBox/index.native.js.map +1 -0
- package/build/error-overlay/modules/openFileInEditor/index.d.ts +3 -0
- package/build/error-overlay/modules/openFileInEditor/index.d.ts.map +1 -0
- package/build/error-overlay/modules/openFileInEditor/index.js +15 -0
- package/build/error-overlay/modules/openFileInEditor/index.js.map +1 -0
- package/build/error-overlay/modules/openFileInEditor/index.native.d.ts +3 -0
- package/build/error-overlay/modules/openFileInEditor/index.native.d.ts.map +1 -0
- package/build/error-overlay/modules/openFileInEditor/index.native.js +8 -0
- package/build/error-overlay/modules/openFileInEditor/index.native.js.map +1 -0
- package/build/error-overlay/modules/parseErrorStack/index.d.ts +6 -0
- package/build/error-overlay/modules/parseErrorStack/index.d.ts.map +1 -0
- package/build/error-overlay/modules/parseErrorStack/index.js +25 -0
- package/build/error-overlay/modules/parseErrorStack/index.js.map +1 -0
- package/build/error-overlay/modules/parseErrorStack/parseHermesStack.d.ts +3 -0
- package/build/error-overlay/modules/parseErrorStack/parseHermesStack.d.ts.map +1 -0
- package/build/error-overlay/modules/parseErrorStack/parseHermesStack.js +9 -0
- package/build/error-overlay/modules/parseErrorStack/parseHermesStack.js.map +1 -0
- package/build/error-overlay/modules/stringifySafe/index.d.ts +20 -0
- package/build/error-overlay/modules/stringifySafe/index.d.ts.map +1 -0
- package/build/error-overlay/modules/stringifySafe/index.js +117 -0
- package/build/error-overlay/modules/stringifySafe/index.js.map +1 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.d.ts +24 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.d.ts.map +1 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.js +19 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.js.map +1 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.native.d.ts +3 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.native.d.ts.map +1 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.native.js +8 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.native.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.d.ts +5 -0
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js +113 -0
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorFooter.d.ts +7 -0
- package/build/error-overlay/overlay/LogBoxInspectorFooter.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorFooter.js +111 -0
- package/build/error-overlay/overlay/LogBoxInspectorFooter.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorHeader.d.ts +8 -0
- package/build/error-overlay/overlay/LogBoxInspectorHeader.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorHeader.js +139 -0
- package/build/error-overlay/overlay/LogBoxInspectorHeader.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.d.ts +12 -0
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js +116 -0
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorSection.d.ts +8 -0
- package/build/error-overlay/overlay/LogBoxInspectorSection.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorSection.js +70 -0
- package/build/error-overlay/overlay/LogBoxInspectorSection.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.d.ts +8 -0
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js +127 -0
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.d.ts +11 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js +103 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.d.ts +10 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js +177 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js.map +1 -0
- package/build/error-overlay/toast/ErrorToast.d.ts +11 -0
- package/build/error-overlay/toast/ErrorToast.d.ts.map +1 -0
- package/build/error-overlay/toast/ErrorToast.js +147 -0
- package/build/error-overlay/toast/ErrorToast.js.map +1 -0
- package/build/error-overlay/toast/ErrorToastContainer.d.ts +4 -0
- package/build/error-overlay/toast/ErrorToastContainer.d.ts.map +1 -0
- package/build/error-overlay/toast/ErrorToastContainer.js +7 -0
- package/build/error-overlay/toast/ErrorToastContainer.js.map +1 -0
- package/build/error-overlay/toast/ErrorToastContainer.web.d.ts +12 -0
- package/build/error-overlay/toast/ErrorToastContainer.web.d.ts.map +1 -0
- package/build/error-overlay/toast/ErrorToastContainer.web.js +83 -0
- package/build/error-overlay/toast/ErrorToastContainer.web.js.map +1 -0
- package/build/error-overlay/toast/ErrorToastMessage.d.ts +5 -0
- package/build/error-overlay/toast/ErrorToastMessage.d.ts.map +1 -0
- package/build/error-overlay/toast/ErrorToastMessage.js +50 -0
- package/build/error-overlay/toast/ErrorToastMessage.js.map +1 -0
- package/build/error-overlay/useRejectionHandler.d.ts +3 -0
- package/build/error-overlay/useRejectionHandler.d.ts.map +1 -0
- package/build/error-overlay/useRejectionHandler.js +60 -0
- package/build/error-overlay/useRejectionHandler.js.map +1 -0
- package/build/getDevServer.d.ts +8 -0
- package/build/getDevServer.d.ts.map +1 -0
- package/build/getDevServer.js +37 -0
- package/build/getDevServer.js.map +1 -0
- package/build/getDevServer.native.d.ts +1 -0
- package/build/getDevServer.native.d.ts.map +1 -0
- package/build/getDevServer.native.js +2 -0
- package/build/getDevServer.native.js.map +1 -0
- package/build/index.d.ts +2 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +4 -0
- package/build/index.js.map +1 -0
- package/build/messageSocket.d.ts +3 -0
- package/build/messageSocket.d.ts.map +1 -0
- package/build/messageSocket.js +24 -0
- package/build/messageSocket.js.map +1 -0
- package/build/setupFastRefresh.d.ts +10 -0
- package/build/setupFastRefresh.d.ts.map +1 -0
- package/build/setupFastRefresh.js +23 -0
- package/build/setupFastRefresh.js.map +1 -0
- package/build/setupHMR.d.ts +2 -0
- package/build/setupHMR.d.ts.map +1 -0
- package/build/setupHMR.js +14 -0
- package/build/setupHMR.js.map +1 -0
- package/error-overlay.d.ts +1 -0
- package/error-overlay.js +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.LogBoxInspectorStackFrame = void 0;
|
|
30
|
+
/**
|
|
31
|
+
* Copyright (c) Evan Bacon.
|
|
32
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the MIT license found in the
|
|
35
|
+
* LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/
|
|
37
|
+
const react_1 = __importDefault(require("react"));
|
|
38
|
+
const react_native_1 = require("react-native");
|
|
39
|
+
const LogBoxButton_1 = require("../UI/LogBoxButton");
|
|
40
|
+
const LogBoxStyle = __importStar(require("../UI/LogBoxStyle"));
|
|
41
|
+
const constants_1 = require("../UI/constants");
|
|
42
|
+
const formatProjectFilePath_1 = require("../formatProjectFilePath");
|
|
43
|
+
function LogBoxInspectorStackFrame(props) {
|
|
44
|
+
const { frame, onPress } = props;
|
|
45
|
+
const column = frame.column != null && parseInt(String(frame.column), 10);
|
|
46
|
+
const location = (0, formatProjectFilePath_1.formatProjectFileName)(frame.file) +
|
|
47
|
+
(frame.lineNumber != null
|
|
48
|
+
? ":" +
|
|
49
|
+
frame.lineNumber +
|
|
50
|
+
(column && !isNaN(column) ? ":" + (column + 1) : "")
|
|
51
|
+
: "");
|
|
52
|
+
return (react_1.default.createElement(react_native_1.View, { style: styles.frameContainer },
|
|
53
|
+
react_1.default.createElement(LogBoxButton_1.LogBoxButton, { backgroundColor: {
|
|
54
|
+
default: "transparent",
|
|
55
|
+
pressed: onPress ? LogBoxStyle.getBackgroundColor(1) : "transparent",
|
|
56
|
+
}, onPress: onPress, style: styles.frame },
|
|
57
|
+
react_1.default.createElement(react_native_1.Text, { style: [styles.name, frame.collapse === true && styles.dim] }, frame.methodName),
|
|
58
|
+
react_1.default.createElement(react_native_1.Text, { ellipsizeMode: "middle", numberOfLines: 1, style: [styles.location, frame.collapse === true && styles.dim] }, location))));
|
|
59
|
+
}
|
|
60
|
+
exports.LogBoxInspectorStackFrame = LogBoxInspectorStackFrame;
|
|
61
|
+
const styles = react_native_1.StyleSheet.create({
|
|
62
|
+
frameContainer: {
|
|
63
|
+
flexDirection: "row",
|
|
64
|
+
paddingHorizontal: 15,
|
|
65
|
+
},
|
|
66
|
+
frame: {
|
|
67
|
+
flex: 1,
|
|
68
|
+
paddingVertical: 4,
|
|
69
|
+
paddingHorizontal: 10,
|
|
70
|
+
borderRadius: 5,
|
|
71
|
+
},
|
|
72
|
+
lineLocation: {
|
|
73
|
+
flexDirection: "row",
|
|
74
|
+
},
|
|
75
|
+
name: {
|
|
76
|
+
color: LogBoxStyle.getTextColor(1),
|
|
77
|
+
fontSize: 14,
|
|
78
|
+
includeFontPadding: false,
|
|
79
|
+
lineHeight: 18,
|
|
80
|
+
fontWeight: "400",
|
|
81
|
+
fontFamily: constants_1.CODE_FONT,
|
|
82
|
+
},
|
|
83
|
+
location: {
|
|
84
|
+
color: LogBoxStyle.getTextColor(0.8),
|
|
85
|
+
fontSize: 12,
|
|
86
|
+
fontWeight: "300",
|
|
87
|
+
includeFontPadding: false,
|
|
88
|
+
lineHeight: 16,
|
|
89
|
+
paddingLeft: 10,
|
|
90
|
+
},
|
|
91
|
+
dim: {
|
|
92
|
+
color: LogBoxStyle.getTextColor(0.4),
|
|
93
|
+
fontWeight: "300",
|
|
94
|
+
},
|
|
95
|
+
line: {
|
|
96
|
+
color: LogBoxStyle.getTextColor(0.8),
|
|
97
|
+
fontSize: 12,
|
|
98
|
+
fontWeight: "300",
|
|
99
|
+
includeFontPadding: false,
|
|
100
|
+
lineHeight: 16,
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
//# sourceMappingURL=LogBoxInspectorStackFrame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogBoxInspectorStackFrame.js","sourceRoot":"","sources":["../../../src/error-overlay/overlay/LogBoxInspectorStackFrame.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,kDAA0B;AAC1B,+CAA6E;AAG7E,qDAAkD;AAClD,+DAAiD;AACjD,+CAA4C;AAC5C,oEAAiE;AAOjE,SAAgB,yBAAyB,CAAC,KAAY;IACpD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACjC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,IAAI,IAAI,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;IAC1E,MAAM,QAAQ,GACZ,IAAA,6CAAqB,EAAC,KAAK,CAAC,IAAI,CAAC;QACjC,CAAC,KAAK,CAAC,UAAU,IAAI,IAAI;YACvB,CAAC,CAAC,GAAG;gBACH,KAAK,CAAC,UAAU;gBAChB,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACtD,CAAC,CAAC,EAAE,CAAC,CAAC;IACV,OAAO,CACL,8BAAC,mBAAI,IAAC,K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ACpC,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,kBAAkB,EAAE,KAAK;QACzB,UAAU,EAAE,EAAE;QACd,WAAW,EAAE,EAAE;KAChB;IACD,GAAG,EAAE;QACH,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC;QACpC,UAAU,EAAE,KAAK;KAClB;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC;QACpC,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,kBAAkB,EAAE,KAAK;QACzB,UAAU,EAAE,EAAE;KACf;CACF,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) Evan Bacon.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport React from \"react\";\nimport { GestureResponderEvent, StyleSheet, Text, View } from \"react-native\";\nimport { StackFrame } from \"stacktrace-parser\";\n\nimport { LogBoxButton } from \"../UI/LogBoxButton\";\nimport * as LogBoxStyle from \"../UI/LogBoxStyle\";\nimport { CODE_FONT } from \"../UI/constants\";\nimport { formatProjectFileName } from \"../formatProjectFilePath\";\n\ntype Props = {\n frame: StackFrame & { collapse?: boolean };\n onPress?: (event: GestureResponderEvent) => void;\n};\n\nexport function LogBoxInspectorStackFrame(props: Props) {\n const { frame, onPress } = props;\n const column = frame.column != null && parseInt(String(frame.column), 10);\n const location =\n formatProjectFileName(frame.file) +\n (frame.lineNumber != null\n ? \":\" +\n frame.lineNumber +\n (column && !isNaN(column) ? \":\" + (column + 1) : \"\")\n : \"\");\n return (\n <View style={styles.frameContainer}>\n <LogBoxButton\n backgroundColor={{\n default: \"transparent\",\n pressed: onPress ? LogBoxStyle.getBackgroundColor(1) : \"transparent\",\n }}\n onPress={onPress}\n style={styles.frame}\n >\n <Text style={[styles.name, frame.collapse === true && styles.dim]}>\n {frame.methodName}\n </Text>\n <Text\n ellipsizeMode=\"middle\"\n numberOfLines={1}\n style={[styles.location, frame.collapse === true && styles.dim]}\n >\n {location}\n </Text>\n </LogBoxButton>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n frameContainer: {\n flexDirection: \"row\",\n paddingHorizontal: 15,\n },\n frame: {\n flex: 1,\n paddingVertical: 4,\n paddingHorizontal: 10,\n borderRadius: 5,\n },\n lineLocation: {\n flexDirection: \"row\",\n },\n name: {\n color: LogBoxStyle.getTextColor(1),\n fontSize: 14,\n includeFontPadding: false,\n lineHeight: 18,\n fontWeight: \"400\",\n fontFamily: CODE_FONT,\n },\n location: {\n color: LogBoxStyle.getTextColor(0.8),\n fontSize: 12,\n fontWeight: \"300\",\n includeFontPadding: false,\n lineHeight: 16,\n paddingLeft: 10,\n },\n dim: {\n color: LogBoxStyle.getTextColor(0.4),\n fontWeight: \"300\",\n },\n line: {\n color: LogBoxStyle.getTextColor(0.8),\n fontSize: 12,\n fontWeight: \"300\",\n includeFontPadding: false,\n lineHeight: 16,\n },\n});\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StackType } from "../Data/LogBoxLog";
|
|
2
|
+
import type { Stack } from "../Data/LogBoxSymbolication";
|
|
3
|
+
declare type Props = {
|
|
4
|
+
type: StackType;
|
|
5
|
+
onRetry: () => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function getCollapseMessage(stackFrames: Stack, collapsed: boolean): string;
|
|
8
|
+
export declare function LogBoxInspectorStackFrames({ onRetry, type }: Props): JSX.Element | null;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=LogBoxInspectorStackFrames.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogBoxInspectorStackFrames.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/overlay/LogBoxInspectorStackFrames.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AASzD,aAAK,KAAK,GAAG;IACX,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,KAAK,EAClB,SAAS,EAAE,OAAO,GACjB,MAAM,CA+BR;AAED,wBAAgB,0BAA0B,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,sBAgDlE"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.LogBoxInspectorStackFrames = exports.getCollapseMessage = void 0;
|
|
30
|
+
/**
|
|
31
|
+
* Copyright (c) Evan Bacon.
|
|
32
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the MIT license found in the
|
|
35
|
+
* LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/
|
|
37
|
+
const react_1 = __importStar(require("react"));
|
|
38
|
+
const react_native_1 = require("react-native");
|
|
39
|
+
const LogContext_1 = require("../Data/LogContext");
|
|
40
|
+
const LogBoxButton_1 = require("../UI/LogBoxButton");
|
|
41
|
+
const LogBoxStyle = __importStar(require("../UI/LogBoxStyle"));
|
|
42
|
+
const openFileInEditor_1 = __importDefault(require("../modules/openFileInEditor"));
|
|
43
|
+
const LogBoxInspectorSection_1 = require("./LogBoxInspectorSection");
|
|
44
|
+
const LogBoxInspectorSourceMapStatus_1 = require("./LogBoxInspectorSourceMapStatus");
|
|
45
|
+
const LogBoxInspectorStackFrame_1 = require("./LogBoxInspectorStackFrame");
|
|
46
|
+
function getCollapseMessage(stackFrames, collapsed) {
|
|
47
|
+
if (stackFrames.length === 0) {
|
|
48
|
+
return "No frames to show";
|
|
49
|
+
}
|
|
50
|
+
const collapsedCount = stackFrames.reduce((count, { collapse }) => {
|
|
51
|
+
if (collapse === true) {
|
|
52
|
+
return count + 1;
|
|
53
|
+
}
|
|
54
|
+
return count;
|
|
55
|
+
}, 0);
|
|
56
|
+
if (collapsedCount === 0) {
|
|
57
|
+
return "Showing all frames";
|
|
58
|
+
}
|
|
59
|
+
const framePlural = `frame${collapsedCount > 1 ? "s" : ""}`;
|
|
60
|
+
if (collapsedCount === stackFrames.length) {
|
|
61
|
+
return collapsed
|
|
62
|
+
? `See${collapsedCount > 1 ? " all " : " "}${collapsedCount} collapsed ${framePlural}`
|
|
63
|
+
: `Collapse${collapsedCount > 1 ? " all " : " "}${collapsedCount} ${framePlural}`;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
return collapsed
|
|
67
|
+
? `See ${collapsedCount} more ${framePlural}`
|
|
68
|
+
: `Collapse ${collapsedCount} ${framePlural}`;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.getCollapseMessage = getCollapseMessage;
|
|
72
|
+
function LogBoxInspectorStackFrames({ onRetry, type }) {
|
|
73
|
+
var _a;
|
|
74
|
+
const log = (0, LogContext_1.useSelectedLog)();
|
|
75
|
+
const [collapsed, setCollapsed] = (0, react_1.useState)(() => {
|
|
76
|
+
var _a;
|
|
77
|
+
// Only collapse frames initially if some frames are not collapsed.
|
|
78
|
+
return (_a = log.getAvailableStack(type)) === null || _a === void 0 ? void 0 : _a.some(({ collapse }) => !collapse);
|
|
79
|
+
});
|
|
80
|
+
function getStackList() {
|
|
81
|
+
var _a;
|
|
82
|
+
if (collapsed === true) {
|
|
83
|
+
return (_a = log.getAvailableStack(type)) === null || _a === void 0 ? void 0 : _a.filter(({ collapse }) => !collapse);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
return log.getAvailableStack(type);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (((_a = log.getAvailableStack(type)) === null || _a === void 0 ? void 0 : _a.length) === 0) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
return (react_1.default.createElement(LogBoxInspectorSection_1.LogBoxInspectorSection, { heading: type === "component" ? "Component Stack" : "Call Stack", action: react_1.default.createElement(LogBoxInspectorSourceMapStatus_1.LogBoxInspectorSourceMapStatus, { onPress: log.symbolicated[type].status === "FAILED" ? onRetry : null, status: log.symbolicated[type].status }) },
|
|
93
|
+
log.symbolicated[type].status !== "COMPLETE" && (react_1.default.createElement(react_native_1.View, { style: stackStyles.hintBox },
|
|
94
|
+
react_1.default.createElement(react_native_1.Text, { style: stackStyles.hintText }, "This call stack is not symbolicated. Some features are unavailable such as viewing the function name or tapping to open files."))),
|
|
95
|
+
react_1.default.createElement(StackFrameList, { list: getStackList(), status: log.symbolicated[type].status }),
|
|
96
|
+
react_1.default.createElement(StackFrameFooter, { onPress: () => setCollapsed(!collapsed), message: getCollapseMessage(log.getAvailableStack(type), !!collapsed) })));
|
|
97
|
+
}
|
|
98
|
+
exports.LogBoxInspectorStackFrames = LogBoxInspectorStackFrames;
|
|
99
|
+
function StackFrameList({ list, status, }) {
|
|
100
|
+
return list.map((frame, index) => {
|
|
101
|
+
const { file, lineNumber } = frame;
|
|
102
|
+
return (react_1.default.createElement(LogBoxInspectorStackFrame_1.LogBoxInspectorStackFrame, { key: index, frame: frame, onPress: status === "COMPLETE" && file != null && lineNumber != null
|
|
103
|
+
? () => (0, openFileInEditor_1.default)(file, lineNumber)
|
|
104
|
+
: undefined }));
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function StackFrameFooter({ message, onPress, }) {
|
|
108
|
+
return (react_1.default.createElement(react_native_1.View, { style: stackStyles.collapseContainer },
|
|
109
|
+
react_1.default.createElement(LogBoxButton_1.LogBoxButton, { backgroundColor: {
|
|
110
|
+
default: "transparent",
|
|
111
|
+
pressed: LogBoxStyle.getBackgroundColor(1),
|
|
112
|
+
}, onPress: onPress, style: stackStyles.collapseButton },
|
|
113
|
+
react_1.default.createElement(react_native_1.Text, { style: stackStyles.collapse }, message))));
|
|
114
|
+
}
|
|
115
|
+
const stackStyles = react_native_1.StyleSheet.create({
|
|
116
|
+
section: {
|
|
117
|
+
marginTop: 15,
|
|
118
|
+
},
|
|
119
|
+
heading: {
|
|
120
|
+
alignItems: "center",
|
|
121
|
+
flexDirection: "row",
|
|
122
|
+
paddingHorizontal: 12,
|
|
123
|
+
marginBottom: 10,
|
|
124
|
+
},
|
|
125
|
+
headingText: {
|
|
126
|
+
color: LogBoxStyle.getTextColor(1),
|
|
127
|
+
flex: 1,
|
|
128
|
+
fontSize: 20,
|
|
129
|
+
fontWeight: "600",
|
|
130
|
+
includeFontPadding: false,
|
|
131
|
+
lineHeight: 20,
|
|
132
|
+
},
|
|
133
|
+
body: {
|
|
134
|
+
paddingBottom: 10,
|
|
135
|
+
},
|
|
136
|
+
bodyText: {
|
|
137
|
+
color: LogBoxStyle.getTextColor(1),
|
|
138
|
+
fontSize: 14,
|
|
139
|
+
includeFontPadding: false,
|
|
140
|
+
lineHeight: 18,
|
|
141
|
+
fontWeight: "500",
|
|
142
|
+
paddingHorizontal: 27,
|
|
143
|
+
},
|
|
144
|
+
hintText: {
|
|
145
|
+
color: LogBoxStyle.getTextColor(0.7),
|
|
146
|
+
fontSize: 13,
|
|
147
|
+
includeFontPadding: false,
|
|
148
|
+
lineHeight: 18,
|
|
149
|
+
fontWeight: "400",
|
|
150
|
+
marginHorizontal: 10,
|
|
151
|
+
},
|
|
152
|
+
hintBox: {
|
|
153
|
+
backgroundColor: LogBoxStyle.getBackgroundColor(),
|
|
154
|
+
marginHorizontal: 10,
|
|
155
|
+
paddingHorizontal: 5,
|
|
156
|
+
paddingVertical: 10,
|
|
157
|
+
borderRadius: 5,
|
|
158
|
+
marginBottom: 5,
|
|
159
|
+
},
|
|
160
|
+
collapseContainer: {
|
|
161
|
+
marginLeft: 15,
|
|
162
|
+
flexDirection: "row",
|
|
163
|
+
},
|
|
164
|
+
collapseButton: {
|
|
165
|
+
borderRadius: 5,
|
|
166
|
+
},
|
|
167
|
+
collapse: {
|
|
168
|
+
color: LogBoxStyle.getTextColor(0.7),
|
|
169
|
+
fontSize: 12,
|
|
170
|
+
fontWeight: "300",
|
|
171
|
+
lineHeight: 20,
|
|
172
|
+
marginTop: 0,
|
|
173
|
+
paddingHorizontal: 10,
|
|
174
|
+
paddingVertical: 5,
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
//# sourceMappingURL=LogBoxInspectorStackFrames.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogBoxInspectorStackFrames.js","sourceRoot":"","sources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AAC;KAChB;IACD,iBAAiB,EAAE;QACjB,UAAU,EAAE,EAAE;QACd,aAAa,EAAE,KAAK;KACrB;IACD,cAAc,EAAE;QACd,YAAY,EAAE,CAAC;KAChB;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC;QACpC,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,UAAU,EAAE,EAAE;QACd,SAAS,EAAE,CAAC;QACZ,iBAAiB,EAAE,EAAE;QACrB,eAAe,EAAE,CAAC;KACnB;CACF,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) Evan Bacon.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport React, { useState } from \"react\";\nimport { StyleSheet, Text, View } from \"react-native\";\n\nimport type { StackType } from \"../Data/LogBoxLog\";\nimport type { Stack } from \"../Data/LogBoxSymbolication\";\nimport { useSelectedLog } from \"../Data/LogContext\";\nimport { LogBoxButton } from \"../UI/LogBoxButton\";\nimport * as LogBoxStyle from \"../UI/LogBoxStyle\";\nimport openFileInEditor from \"../modules/openFileInEditor\";\nimport { LogBoxInspectorSection } from \"./LogBoxInspectorSection\";\nimport { LogBoxInspectorSourceMapStatus } from \"./LogBoxInspectorSourceMapStatus\";\nimport { LogBoxInspectorStackFrame } from \"./LogBoxInspectorStackFrame\";\n\ntype Props = {\n type: StackType;\n onRetry: () => void;\n};\n\nexport function getCollapseMessage(\n stackFrames: Stack,\n collapsed: boolean\n): string {\n if (stackFrames.length === 0) {\n return \"No frames to show\";\n }\n\n const collapsedCount = stackFrames.reduce((count, { collapse }) => {\n if (collapse === true) {\n return count + 1;\n }\n\n return count;\n }, 0);\n\n if (collapsedCount === 0) {\n return \"Showing all frames\";\n }\n\n const framePlural = `frame${collapsedCount > 1 ? \"s\" : \"\"}`;\n if (collapsedCount === stackFrames.length) {\n return collapsed\n ? `See${\n collapsedCount > 1 ? \" all \" : \" \"\n }${collapsedCount} collapsed ${framePlural}`\n : `Collapse${\n collapsedCount > 1 ? \" all \" : \" \"\n }${collapsedCount} ${framePlural}`;\n } else {\n return collapsed\n ? `See ${collapsedCount} more ${framePlural}`\n : `Collapse ${collapsedCount} ${framePlural}`;\n }\n}\n\nexport function LogBoxInspectorStackFrames({ onRetry, type }: Props) {\n const log = useSelectedLog();\n\n const [collapsed, setCollapsed] = useState(() => {\n // Only collapse frames initially if some frames are not collapsed.\n return log.getAvailableStack(type)?.some(({ collapse }) => !collapse);\n });\n\n function getStackList() {\n if (collapsed === true) {\n return log.getAvailableStack(type)?.filter(({ collapse }) => !collapse);\n } else {\n return log.getAvailableStack(type);\n }\n }\n\n if (log.getAvailableStack(type)?.length === 0) {\n return null;\n }\n\n return (\n <LogBoxInspectorSection\n heading={type === \"component\" ? \"Component Stack\" : \"Call Stack\"}\n action={\n <LogBoxInspectorSourceMapStatus\n onPress={log.symbolicated[type].status === \"FAILED\" ? onRetry : null}\n status={log.symbolicated[type].status}\n />\n }\n >\n {log.symbolicated[type].status !== \"COMPLETE\" && (\n <View style={stackStyles.hintBox}>\n <Text style={stackStyles.hintText}>\n This call stack is not symbolicated. Some features are unavailable\n such as viewing the function name or tapping to open files.\n </Text>\n </View>\n )}\n <StackFrameList\n list={getStackList()!}\n status={log.symbolicated[type].status}\n />\n <StackFrameFooter\n onPress={() => setCollapsed(!collapsed)}\n message={getCollapseMessage(log.getAvailableStack(type)!, !!collapsed)}\n />\n </LogBoxInspectorSection>\n );\n}\n\nfunction StackFrameList({\n list,\n status,\n}: {\n list: Stack;\n status: \"NONE\" | \"PENDING\" | \"COMPLETE\" | \"FAILED\";\n}): any {\n return list.map((frame, index) => {\n const { file, lineNumber } = frame;\n return (\n <LogBoxInspectorStackFrame\n key={index}\n frame={frame}\n onPress={\n status === \"COMPLETE\" && file != null && lineNumber != null\n ? () => openFileInEditor(file, lineNumber)\n : undefined\n }\n />\n );\n });\n}\n\nfunction StackFrameFooter({\n message,\n onPress,\n}: {\n message: string;\n onPress: () => void;\n}) {\n return (\n <View style={stackStyles.collapseContainer}>\n <LogBoxButton\n backgroundColor={{\n default: \"transparent\",\n pressed: LogBoxStyle.getBackgroundColor(1),\n }}\n onPress={onPress}\n style={stackStyles.collapseButton}\n >\n <Text style={stackStyles.collapse}>{message}</Text>\n </LogBoxButton>\n </View>\n );\n}\n\nconst stackStyles = StyleSheet.create({\n section: {\n marginTop: 15,\n },\n heading: {\n alignItems: \"center\",\n flexDirection: \"row\",\n paddingHorizontal: 12,\n marginBottom: 10,\n },\n headingText: {\n color: LogBoxStyle.getTextColor(1),\n flex: 1,\n fontSize: 20,\n fontWeight: \"600\",\n includeFontPadding: false,\n lineHeight: 20,\n },\n body: {\n paddingBottom: 10,\n },\n bodyText: {\n color: LogBoxStyle.getTextColor(1),\n fontSize: 14,\n includeFontPadding: false,\n lineHeight: 18,\n fontWeight: \"500\",\n paddingHorizontal: 27,\n },\n hintText: {\n color: LogBoxStyle.getTextColor(0.7),\n fontSize: 13,\n includeFontPadding: false,\n lineHeight: 18,\n fontWeight: \"400\",\n marginHorizontal: 10,\n },\n hintBox: {\n backgroundColor: LogBoxStyle.getBackgroundColor(),\n marginHorizontal: 10,\n paddingHorizontal: 5,\n paddingVertical: 10,\n borderRadius: 5,\n marginBottom: 5,\n },\n collapseContainer: {\n marginLeft: 15,\n flexDirection: \"row\",\n },\n collapseButton: {\n borderRadius: 5,\n },\n collapse: {\n color: LogBoxStyle.getTextColor(0.7),\n fontSize: 12,\n fontWeight: \"300\",\n lineHeight: 20,\n marginTop: 0,\n paddingHorizontal: 10,\n paddingVertical: 5,\n },\n});\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LogBoxLog } from "../Data/LogBoxLog";
|
|
2
|
+
declare type Props = {
|
|
3
|
+
log: LogBoxLog;
|
|
4
|
+
totalLogCount: number;
|
|
5
|
+
level: "warn" | "error";
|
|
6
|
+
onPressOpen: () => void;
|
|
7
|
+
onPressDismiss: () => void;
|
|
8
|
+
};
|
|
9
|
+
export declare function ErrorToast(props: Props): JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=ErrorToast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorToast.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/toast/ErrorToast.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAI9C,aAAK,KAAK,GAAG;IACX,GAAG,EAAE,SAAS,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AAUF,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,eA8BtC"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ErrorToast = void 0;
|
|
27
|
+
/**
|
|
28
|
+
* Copyright (c) Evan Bacon.
|
|
29
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/
|
|
34
|
+
const react_views_1 = require("@bacons/react-views");
|
|
35
|
+
const react_1 = __importStar(require("react"));
|
|
36
|
+
const LogBoxData = __importStar(require("../Data/LogBoxData"));
|
|
37
|
+
const LogBoxStyle = __importStar(require("../UI/LogBoxStyle"));
|
|
38
|
+
const ErrorToastMessage_1 = require("./ErrorToastMessage");
|
|
39
|
+
function useSymbolicatedLog(log) {
|
|
40
|
+
// Eagerly symbolicate so the stack is available when pressing to inspect.
|
|
41
|
+
(0, react_1.useEffect)(() => {
|
|
42
|
+
LogBoxData.symbolicateLogLazy("stack", log);
|
|
43
|
+
LogBoxData.symbolicateLogLazy("component", log);
|
|
44
|
+
}, [log]);
|
|
45
|
+
}
|
|
46
|
+
function ErrorToast(props) {
|
|
47
|
+
const { totalLogCount, level, log } = props;
|
|
48
|
+
useSymbolicatedLog(log);
|
|
49
|
+
return (react_1.default.createElement(react_views_1.View, { style: toastStyles.container },
|
|
50
|
+
react_1.default.createElement(react_views_1.Pressable, { style: { flex: 1 }, onPress: props.onPressOpen }, ({ hovered, pressed }) => (react_1.default.createElement(react_views_1.View, { style: [
|
|
51
|
+
toastStyles.press,
|
|
52
|
+
{
|
|
53
|
+
transitionDuration: "150ms",
|
|
54
|
+
backgroundColor: pressed
|
|
55
|
+
? "#323232"
|
|
56
|
+
: hovered
|
|
57
|
+
? "#111111"
|
|
58
|
+
: LogBoxStyle.getBackgroundColor(),
|
|
59
|
+
},
|
|
60
|
+
] },
|
|
61
|
+
react_1.default.createElement(Count, { count: totalLogCount, level: level }),
|
|
62
|
+
react_1.default.createElement(ErrorToastMessage_1.ErrorToastMessage, { message: log.message }),
|
|
63
|
+
react_1.default.createElement(Dismiss, { onPress: props.onPressDismiss }))))));
|
|
64
|
+
}
|
|
65
|
+
exports.ErrorToast = ErrorToast;
|
|
66
|
+
function Count({ count, level }) {
|
|
67
|
+
return (react_1.default.createElement(react_views_1.View, { style: [countStyles.inside, countStyles[level]] },
|
|
68
|
+
react_1.default.createElement(react_views_1.Text, { style: countStyles.text }, count <= 1 ? "!" : count)));
|
|
69
|
+
}
|
|
70
|
+
function Dismiss({ onPress }) {
|
|
71
|
+
return (react_1.default.createElement(react_views_1.Pressable, { style: {
|
|
72
|
+
marginLeft: 5,
|
|
73
|
+
}, hitSlop: {
|
|
74
|
+
top: 12,
|
|
75
|
+
right: 10,
|
|
76
|
+
bottom: 12,
|
|
77
|
+
left: 10,
|
|
78
|
+
}, onPress: onPress }, ({ hovered, pressed }) => (react_1.default.createElement(react_views_1.View, { style: [
|
|
79
|
+
dismissStyles.press,
|
|
80
|
+
hovered && { opacity: 0.8 },
|
|
81
|
+
pressed && { opacity: 0.5 },
|
|
82
|
+
] },
|
|
83
|
+
react_1.default.createElement(react_views_1.Image, { source: require("@expo/metro-runtime/assets/close.png"), style: dismissStyles.image })))));
|
|
84
|
+
}
|
|
85
|
+
const countStyles = react_views_1.StyleSheet.create({
|
|
86
|
+
warn: {
|
|
87
|
+
backgroundColor: LogBoxStyle.getWarningColor(1),
|
|
88
|
+
},
|
|
89
|
+
error: {
|
|
90
|
+
backgroundColor: LogBoxStyle.getErrorColor(1),
|
|
91
|
+
},
|
|
92
|
+
log: {
|
|
93
|
+
backgroundColor: LogBoxStyle.getLogColor(1),
|
|
94
|
+
},
|
|
95
|
+
inside: {
|
|
96
|
+
marginRight: 8,
|
|
97
|
+
minWidth: 22,
|
|
98
|
+
aspectRatio: 1,
|
|
99
|
+
paddingHorizontal: 4,
|
|
100
|
+
borderRadius: 11,
|
|
101
|
+
justifyContent: "center",
|
|
102
|
+
alignItems: "center",
|
|
103
|
+
},
|
|
104
|
+
text: {
|
|
105
|
+
color: LogBoxStyle.getTextColor(1),
|
|
106
|
+
fontSize: 14,
|
|
107
|
+
lineHeight: 18,
|
|
108
|
+
textAlign: "center",
|
|
109
|
+
fontWeight: "600",
|
|
110
|
+
textShadowColor: LogBoxStyle.getBackgroundColor(0.8),
|
|
111
|
+
textShadowOffset: { width: 0, height: 0 },
|
|
112
|
+
textShadowRadius: 3,
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
const dismissStyles = react_views_1.StyleSheet.create({
|
|
116
|
+
press: {
|
|
117
|
+
backgroundColor: "#323232",
|
|
118
|
+
height: 20,
|
|
119
|
+
width: 20,
|
|
120
|
+
borderRadius: 25,
|
|
121
|
+
alignItems: "center",
|
|
122
|
+
justifyContent: "center",
|
|
123
|
+
},
|
|
124
|
+
image: {
|
|
125
|
+
height: 8,
|
|
126
|
+
width: 8,
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
const toastStyles = react_views_1.StyleSheet.create({
|
|
130
|
+
container: {
|
|
131
|
+
height: 48,
|
|
132
|
+
justifyContent: "center",
|
|
133
|
+
marginBottom: 4,
|
|
134
|
+
},
|
|
135
|
+
press: {
|
|
136
|
+
borderWidth: 1,
|
|
137
|
+
borderRadius: 8,
|
|
138
|
+
overflow: "hidden",
|
|
139
|
+
flexDirection: "row",
|
|
140
|
+
alignItems: "center",
|
|
141
|
+
borderColor: "#323232",
|
|
142
|
+
backgroundColor: LogBoxStyle.getBackgroundColor(),
|
|
143
|
+
flex: 1,
|
|
144
|
+
paddingHorizontal: 12,
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
//# sourceMappingURL=ErrorToast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorToast.js","sourceRoot":"","sources":["../../../src/error-overlay/toast/ErrorToast.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,qDAA+E;AAC/E,+CAAyC;AAEzC,+DAAiD;AAEjD,+DAAiD;AACjD,2DAAwD;AAUxD,SAAS,kBAAkB,CAAC,GAAc;IACxC,0EAA0E;IAC1E,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,UAAU,CAAC,kBAAkB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC5C,UAAU,CAAC,kBAAkB,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AACZ,CAAC;AAED,SAAgB,UAAU,CAAC,KAAY;IACrC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;IAE5C,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAExB,OAAO,CACL,8BAAC,kBAAI,IAAC,KAAK,EAAE,WAAW,CAAC,SAAS;QAChC,8BAAC,uBAAS,IAAC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,WAAW,IACtD,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CACzB,8BAAC,kBAAI,IACH,KAAK,EAAE;gBACL,WAAW,CAAC,KAAK;gBACjB;oBACE,kBAAkB,EAAE,OAAO;oBAC3B,eAAe,EAAE,OAAO;wBACtB,CAAC,CAAC,SAAS;wBACX,CAAC,CAAC,OAAO;4BACT,CAAC,CAAC,SAAS;4BACX,CAAC,CAAC,WAAW,CAAC,kBAAkB,EAAE;iBACrC;aACF;YAED,8BAAC,KAAK,IAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,GA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AAE,CAAC;QACf,QAAQ,EAAE,QAAQ;QAClB,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;QACpB,WAAW,EAAE,SAAS;QACtB,eAAe,EAAE,WAAW,CAAC,kBAAkB,EAAE;QACjD,IAAI,EAAE,CAAC;QACP,iBAAiB,EAAE,EAAE;KACtB;CACF,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) Evan Bacon.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Image, Pressable, StyleSheet, Text, View } from \"@bacons/react-views\";\nimport React, { useEffect } from \"react\";\n\nimport * as LogBoxData from \"../Data/LogBoxData\";\nimport { LogBoxLog } from \"../Data/LogBoxLog\";\nimport * as LogBoxStyle from \"../UI/LogBoxStyle\";\nimport { ErrorToastMessage } from \"./ErrorToastMessage\";\n\ntype Props = {\n log: LogBoxLog;\n totalLogCount: number;\n level: \"warn\" | \"error\";\n onPressOpen: () => void;\n onPressDismiss: () => void;\n};\n\nfunction useSymbolicatedLog(log: LogBoxLog) {\n // Eagerly symbolicate so the stack is available when pressing to inspect.\n useEffect(() => {\n LogBoxData.symbolicateLogLazy(\"stack\", log);\n LogBoxData.symbolicateLogLazy(\"component\", log);\n }, [log]);\n}\n\nexport function ErrorToast(props: Props) {\n const { totalLogCount, level, log } = props;\n\n useSymbolicatedLog(log);\n\n return (\n <View style={toastStyles.container}>\n <Pressable style={{ flex: 1 }} onPress={props.onPressOpen}>\n {({ hovered, pressed }) => (\n <View\n style={[\n toastStyles.press,\n {\n transitionDuration: \"150ms\",\n backgroundColor: pressed\n ? \"#323232\"\n : hovered\n ? \"#111111\"\n : LogBoxStyle.getBackgroundColor(),\n },\n ]}\n >\n <Count count={totalLogCount} level={level} />\n <ErrorToastMessage message={log.message} />\n <Dismiss onPress={props.onPressDismiss} />\n </View>\n )}\n </Pressable>\n </View>\n );\n}\n\nfunction Count({ count, level }: { count: number; level: Props[\"level\"] }) {\n return (\n <View style={[countStyles.inside, countStyles[level]]}>\n <Text style={countStyles.text}>{count <= 1 ? \"!\" : count}</Text>\n </View>\n );\n}\n\nfunction Dismiss({ onPress }: { onPress: () => void }) {\n return (\n <Pressable\n style={{\n marginLeft: 5,\n }}\n hitSlop={{\n top: 12,\n right: 10,\n bottom: 12,\n left: 10,\n }}\n onPress={onPress}\n >\n {({ hovered, pressed }) => (\n <View\n style={[\n dismissStyles.press,\n hovered && { opacity: 0.8 },\n pressed && { opacity: 0.5 },\n ]}\n >\n <Image\n source={require(\"@expo/metro-runtime/assets/close.png\")}\n style={dismissStyles.image}\n />\n </View>\n )}\n </Pressable>\n );\n}\n\nconst countStyles = StyleSheet.create({\n warn: {\n backgroundColor: LogBoxStyle.getWarningColor(1),\n },\n error: {\n backgroundColor: LogBoxStyle.getErrorColor(1),\n },\n log: {\n backgroundColor: LogBoxStyle.getLogColor(1),\n },\n inside: {\n marginRight: 8,\n minWidth: 22,\n aspectRatio: 1,\n paddingHorizontal: 4,\n borderRadius: 11,\n justifyContent: \"center\",\n alignItems: \"center\",\n },\n text: {\n color: LogBoxStyle.getTextColor(1),\n fontSize: 14,\n lineHeight: 18,\n textAlign: \"center\",\n fontWeight: \"600\",\n textShadowColor: LogBoxStyle.getBackgroundColor(0.8),\n textShadowOffset: { width: 0, height: 0 },\n textShadowRadius: 3,\n },\n});\n\nconst dismissStyles = StyleSheet.create({\n press: {\n backgroundColor: \"#323232\",\n height: 20,\n width: 20,\n borderRadius: 25,\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n image: {\n height: 8,\n width: 8,\n },\n});\n\nconst toastStyles = StyleSheet.create({\n container: {\n height: 48,\n justifyContent: \"center\",\n marginBottom: 4,\n },\n press: {\n borderWidth: 1,\n borderRadius: 8,\n overflow: \"hidden\",\n flexDirection: \"row\",\n alignItems: \"center\",\n borderColor: \"#323232\",\n backgroundColor: LogBoxStyle.getBackgroundColor(),\n flex: 1,\n paddingHorizontal: 12,\n },\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorToastContainer.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/toast/ErrorToastContainer.tsx"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAAE,QAAQ,EAAE;;CAAA,OAEvD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorToastContainer.js","sourceRoot":"","sources":["../../../src/error-overlay/toast/ErrorToastContainer.tsx"],"names":[],"mappings":";;AAAA,SAAwB,mBAAmB,CAAC,EAAE,QAAQ,EAAE;IACtD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAFD,sCAEC","sourcesContent":["export default function ErrorToastContainer({ children }) {\n return children;\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Evan Bacon.
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import React from "react";
|
|
9
|
+
export declare function ErrorToastContainer(): JSX.Element | null;
|
|
10
|
+
declare const _default: React.Component<object, {}, any>;
|
|
11
|
+
export default _default;
|
|
12
|
+
//# sourceMappingURL=ErrorToastContainer.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorToastContainer.web.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/toast/ErrorToastContainer.web.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAA+B,MAAM,OAAO,CAAC;AASpD,wBAAgB,mBAAmB,uBAOlC;;AAsED,wBAAgE"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ErrorToastContainer = void 0;
|
|
27
|
+
/**
|
|
28
|
+
* Copyright (c) Evan Bacon.
|
|
29
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/
|
|
34
|
+
const react_1 = __importStar(require("react"));
|
|
35
|
+
const react_native_1 = require("react-native");
|
|
36
|
+
const LogBoxData = __importStar(require("../Data/LogBoxData"));
|
|
37
|
+
const LogContext_1 = require("../Data/LogContext");
|
|
38
|
+
const useRejectionHandler_1 = require("../useRejectionHandler");
|
|
39
|
+
const ErrorToast_1 = require("./ErrorToast");
|
|
40
|
+
function ErrorToastContainer() {
|
|
41
|
+
(0, useRejectionHandler_1.useRejectionHandler)();
|
|
42
|
+
const { logs, isDisabled } = (0, LogContext_1.useLogs)();
|
|
43
|
+
if (!logs.length || isDisabled) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return react_1.default.createElement(ErrorToastStack, { logs: logs });
|
|
47
|
+
}
|
|
48
|
+
exports.ErrorToastContainer = ErrorToastContainer;
|
|
49
|
+
function ErrorToastStack({ logs }) {
|
|
50
|
+
const onDismissWarns = (0, react_1.useCallback)(() => {
|
|
51
|
+
LogBoxData.clearWarnings();
|
|
52
|
+
}, []);
|
|
53
|
+
const onDismissErrors = (0, react_1.useCallback)(() => {
|
|
54
|
+
LogBoxData.clearErrors();
|
|
55
|
+
}, []);
|
|
56
|
+
const setSelectedLog = (0, react_1.useCallback)((index) => {
|
|
57
|
+
LogBoxData.setSelectedLog(index);
|
|
58
|
+
}, []);
|
|
59
|
+
function openLog(log) {
|
|
60
|
+
let index = logs.length - 1;
|
|
61
|
+
// Stop at zero because if we don't find any log, we'll open the first log.
|
|
62
|
+
while (index > 0 && logs[index] !== log) {
|
|
63
|
+
index -= 1;
|
|
64
|
+
}
|
|
65
|
+
setSelectedLog(index);
|
|
66
|
+
}
|
|
67
|
+
const warnings = (0, react_1.useMemo)(() => logs.filter((log) => log.level === "warn"), [logs]);
|
|
68
|
+
const errors = (0, react_1.useMemo)(() => logs.filter((log) => log.level === "error" || log.level === "fatal"), [logs]);
|
|
69
|
+
return (react_1.default.createElement(react_native_1.View, { style: styles.list },
|
|
70
|
+
warnings.length > 0 && (react_1.default.createElement(ErrorToast_1.ErrorToast, { log: warnings[warnings.length - 1], level: "warn", totalLogCount: warnings.length, onPressOpen: () => openLog(warnings[warnings.length - 1]), onPressDismiss: onDismissWarns })),
|
|
71
|
+
errors.length > 0 && (react_1.default.createElement(ErrorToast_1.ErrorToast, { log: errors[errors.length - 1], level: "error", totalLogCount: errors.length, onPressOpen: () => openLog(errors[errors.length - 1]), onPressDismiss: onDismissErrors }))));
|
|
72
|
+
}
|
|
73
|
+
const styles = react_native_1.StyleSheet.create({
|
|
74
|
+
list: {
|
|
75
|
+
bottom: 6,
|
|
76
|
+
left: 10,
|
|
77
|
+
right: 10,
|
|
78
|
+
position: "absolute",
|
|
79
|
+
maxWidth: 320,
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
exports.default = LogBoxData.withSubscription(ErrorToastContainer);
|
|
83
|
+
//# sourceMappingURL=ErrorToastContainer.web.js.map
|