@buoy-gg/console 7.0.41 → 7.0.43
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/README.md +11 -69
- package/lib/commonjs/components/ConsoleIcon.js +1 -19
- package/lib/commonjs/components/ConsoleLogList.js +1 -152
- package/lib/commonjs/components/ConsoleModal.js +1 -48
- package/lib/commonjs/components/ConsoleRoot.js +1 -37
- package/lib/commonjs/devtools/ConsoleBody.js +1 -234
- package/lib/commonjs/devtools/ConsoleHeader.js +1 -114
- package/lib/commonjs/devtools/ConsoleMessageRow.js +1 -356
- package/lib/commonjs/devtools/ConsoleValue.js +1 -254
- package/lib/commonjs/devtools/ConsoleView.js +1 -54
- package/lib/commonjs/devtools/consoleFilter.js +1 -125
- package/lib/commonjs/devtools/consoleFormat.js +1 -313
- package/lib/commonjs/devtools/origin.js +1 -191
- package/lib/commonjs/devtools/theme.js +1 -152
- package/lib/commonjs/devtools/useConsoleController.js +1 -82
- package/lib/commonjs/devtools/useConsoleMessages.js +1 -241
- package/lib/commonjs/hooks/useConsoleLogs.js +1 -23
- package/lib/commonjs/index.js +1 -181
- package/lib/commonjs/preset.js +1 -63
- package/lib/commonjs/store/consoleLogStore.js +6 -589
- package/lib/commonjs/store/sanitize.js +1 -83
- package/lib/commonjs/sync/consoleSyncAdapter.js +1 -86
- package/lib/module/components/ConsoleIcon.js +1 -12
- package/lib/module/components/ConsoleLogList.js +1 -147
- package/lib/module/components/ConsoleModal.js +1 -44
- package/lib/module/components/ConsoleRoot.js +1 -33
- package/lib/module/devtools/ConsoleBody.js +1 -229
- package/lib/module/devtools/ConsoleHeader.js +1 -109
- package/lib/module/devtools/ConsoleMessageRow.js +1 -352
- package/lib/module/devtools/ConsoleValue.js +1 -249
- package/lib/module/devtools/ConsoleView.js +1 -49
- package/lib/module/devtools/consoleFilter.js +1 -119
- package/lib/module/devtools/consoleFormat.js +1 -309
- package/lib/module/devtools/origin.js +1 -183
- package/lib/module/devtools/theme.js +1 -143
- package/lib/module/devtools/useConsoleController.js +1 -79
- package/lib/module/devtools/useConsoleMessages.js +1 -238
- package/lib/module/hooks/useConsoleLogs.js +1 -19
- package/lib/module/index.js +1 -52
- package/lib/module/preset.js +1 -61
- package/lib/module/store/consoleLogStore.js +6 -575
- package/lib/module/store/sanitize.js +1 -77
- package/lib/module/sync/consoleSyncAdapter.js +1 -82
- package/lib/web/index.mjs +11 -12
- package/package.json +3 -6
- package/lib/commonjs/components/ConsoleIcon.js.map +0 -1
- package/lib/commonjs/components/ConsoleLogList.js.map +0 -1
- package/lib/commonjs/components/ConsoleModal.js.map +0 -1
- package/lib/commonjs/components/ConsoleRoot.js.map +0 -1
- package/lib/commonjs/devtools/ConsoleBody.js.map +0 -1
- package/lib/commonjs/devtools/ConsoleHeader.js.map +0 -1
- package/lib/commonjs/devtools/ConsoleMessageRow.js.map +0 -1
- package/lib/commonjs/devtools/ConsoleValue.js.map +0 -1
- package/lib/commonjs/devtools/ConsoleView.js.map +0 -1
- package/lib/commonjs/devtools/consoleFilter.js.map +0 -1
- package/lib/commonjs/devtools/consoleFormat.js.map +0 -1
- package/lib/commonjs/devtools/origin.js.map +0 -1
- package/lib/commonjs/devtools/theme.js.map +0 -1
- package/lib/commonjs/devtools/useConsoleController.js.map +0 -1
- package/lib/commonjs/devtools/useConsoleMessages.js.map +0 -1
- package/lib/commonjs/hooks/useConsoleLogs.js.map +0 -1
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/preset.js.map +0 -1
- package/lib/commonjs/store/consoleLogStore.js.map +0 -1
- package/lib/commonjs/store/sanitize.js.map +0 -1
- package/lib/commonjs/sync/consoleSyncAdapter.js.map +0 -1
- package/lib/module/components/ConsoleIcon.js.map +0 -1
- package/lib/module/components/ConsoleLogList.js.map +0 -1
- package/lib/module/components/ConsoleModal.js.map +0 -1
- package/lib/module/components/ConsoleRoot.js.map +0 -1
- package/lib/module/devtools/ConsoleBody.js.map +0 -1
- package/lib/module/devtools/ConsoleHeader.js.map +0 -1
- package/lib/module/devtools/ConsoleMessageRow.js.map +0 -1
- package/lib/module/devtools/ConsoleValue.js.map +0 -1
- package/lib/module/devtools/ConsoleView.js.map +0 -1
- package/lib/module/devtools/consoleFilter.js.map +0 -1
- package/lib/module/devtools/consoleFormat.js.map +0 -1
- package/lib/module/devtools/origin.js.map +0 -1
- package/lib/module/devtools/theme.js.map +0 -1
- package/lib/module/devtools/useConsoleController.js.map +0 -1
- package/lib/module/devtools/useConsoleMessages.js.map +0 -1
- package/lib/module/hooks/useConsoleLogs.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/preset.js.map +0 -1
- package/lib/module/store/consoleLogStore.js.map +0 -1
- package/lib/module/store/sanitize.js.map +0 -1
- package/lib/module/sync/consoleSyncAdapter.js.map +0 -1
- package/lib/typescript/components/ConsoleIcon.d.ts.map +0 -1
- package/lib/typescript/components/ConsoleLogList.d.ts.map +0 -1
- package/lib/typescript/components/ConsoleModal.d.ts.map +0 -1
- package/lib/typescript/components/ConsoleRoot.d.ts.map +0 -1
- package/lib/typescript/devtools/ConsoleBody.d.ts.map +0 -1
- package/lib/typescript/devtools/ConsoleHeader.d.ts.map +0 -1
- package/lib/typescript/devtools/ConsoleMessageRow.d.ts.map +0 -1
- package/lib/typescript/devtools/ConsoleValue.d.ts.map +0 -1
- package/lib/typescript/devtools/ConsoleView.d.ts.map +0 -1
- package/lib/typescript/devtools/consoleFilter.d.ts.map +0 -1
- package/lib/typescript/devtools/consoleFormat.d.ts.map +0 -1
- package/lib/typescript/devtools/origin.d.ts.map +0 -1
- package/lib/typescript/devtools/theme.d.ts.map +0 -1
- package/lib/typescript/devtools/useConsoleController.d.ts.map +0 -1
- package/lib/typescript/devtools/useConsoleMessages.d.ts.map +0 -1
- package/lib/typescript/hooks/useConsoleLogs.d.ts.map +0 -1
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
- package/lib/typescript/store/consoleLogStore.d.ts.map +0 -1
- package/lib/typescript/store/sanitize.d.ts.map +0 -1
- package/lib/typescript/sync/consoleSyncAdapter.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,85 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# @buoy-gg/console
|
|
4
4
|
|
|
5
5
|
Read captured JavaScript console logs in your React Native app. Filter messages by level, search their contents, and inspect logged objects.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
<a href="https://buoy.gg/buoy/latest/docs/tools/console"><b>Console guide</b></a> · <a href="https://buoy.gg">buoy.gg</a> · <a href="https://github.com/Buoy-gg/buoy">All tools</a>
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
[](https://www.npmjs.com/package/@buoy-gg/console) [](https://www.npmjs.com/package/@buoy-gg/console)
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
npm install @buoy-gg/core @buoy-gg/console
|
|
13
|
-
```
|
|
11
|
+
<a href="https://buoy.gg/buoy/latest/docs/tools/console"><img src="https://raw.githubusercontent.com/Buoy-gg/buoy/main/.github/readme/tools/console.png" alt="Watch the Console film on buoy.gg" width="640" /></a>
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
</div>
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
## Install
|
|
18
16
|
|
|
19
17
|
```bash
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
For Expo, initialize Buoy before rendering the menu:
|
|
24
|
-
|
|
25
|
-
```tsx
|
|
26
|
-
import { Buoy } from "@buoy-gg/core";
|
|
27
|
-
|
|
28
|
-
Buoy.init({ licenseKey: process.env.EXPO_PUBLIC_BUOY_KEY });
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
The login command writes the Expo key to `.env.local`. For React Native CLI, pass the key from your app’s environment configuration; React Native does not load `.env.local` automatically. Mount `FloatingDevTools` inside the same providers as your screens and restart the development server after installation. The [Quick Start](https://buoy.gg/buoy/latest/docs/quick-start) shows the complete root component setup.
|
|
32
|
-
|
|
33
|
-
## Quick start
|
|
34
|
-
|
|
35
|
-
After initialization and account admission, Console captures supported JavaScript logs. It can retain logs emitted before the panel opens:
|
|
36
|
-
|
|
37
|
-
```tsx
|
|
38
|
-
import { FloatingDevTools } from "@buoy-gg/core";
|
|
39
|
-
|
|
40
|
-
export default function App() {
|
|
41
|
-
return (
|
|
42
|
-
<>
|
|
43
|
-
{/* your app */}
|
|
44
|
-
<FloatingDevTools /> {/* Console tool auto-detected, capture auto-starts */}
|
|
45
|
-
</>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
18
|
+
npm install @buoy-gg/core @buoy-gg/console
|
|
48
19
|
```
|
|
49
20
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
> Upgrading? Older versions required mounting `<ConsoleRoot />` manually. That's automatic now; an existing manual mount is harmless (capture install is idempotent) and can be deleted.
|
|
53
|
-
|
|
54
|
-
## Check the integration
|
|
55
|
-
|
|
56
|
-
After Buoy is initialized and your account is admitted, trigger a `console.log` in your app and find it in Console. Logs removed by your release build and native crash reports are not captured JavaScript console messages.
|
|
57
|
-
|
|
58
|
-
## What you get
|
|
21
|
+
Console patches `console.*` directly, so there is no logger integration or Babel plugin to set up.
|
|
59
22
|
|
|
60
|
-
|
|
61
|
-
- **Fatal crashes captured too** — uncaught JS errors (including fatal render crashes) are hooked from React Native's global error handler and recorded as `[FATAL]`-tagged error entries, so a crashed app's last words are in the log instead of nowhere.
|
|
62
|
-
- **Live, color-coded stream** — `log`, `info`, `warn`, and `error` stream in as they happen, color-coded by level.
|
|
63
|
-
- **Chrome-DevTools-style panel** — a 1:1 port of the Chrome console view: objects and arrays are formatted and expandable, just like the browser.
|
|
64
|
-
- **Filter by level** — focus on just errors and warnings when you're chasing a bug.
|
|
65
|
-
- **Search** — filter messages by substring to find the exact log you care about.
|
|
66
|
-
- **Preserve log** — an optional setting keeps the buffer across reloads, honored from the very first log.
|
|
67
|
-
- **Read production logs** — Buoy runs on-device in any build, so you can read console output from a release build with no cable and no Metro connection.
|
|
68
|
-
|
|
69
|
-
## Desktop & AI
|
|
70
|
-
|
|
71
|
-
To connect a React Native app to [Buoy Desktop](https://github.com/Buoy-gg/Buoy-Desktop) or MCP, install `@buoy-gg/external-sync` and follow the [Desktop connection guide](https://buoy.gg/buoy/latest/docs/desktop). Sign in to Desktop separately. [MCP setup](https://buoy.gg/buoy/latest/docs/mcp) also requires a process account and Pro access. Available remote actions depend on the tool and app integration.
|
|
72
|
-
|
|
73
|
-
## Account and plan requirements
|
|
74
|
-
|
|
75
|
-
Use a Free or Pro Buoy account. History limits and paid features vary by tool; see [pricing](https://buoy.gg/pricing). Production access requires Pro where supported. Development-only hooks and actions remain unavailable in release builds.
|
|
23
|
+
The [Console guide](https://buoy.gg/buoy/latest/docs/tools/console) covers setup, what it captures and its limits. New to Buoy? Start with the [Quick start](https://buoy.gg/buoy/latest/docs/quick-start).
|
|
76
24
|
|
|
77
25
|
---
|
|
78
26
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
Proprietary software. © Buoy LLC. [Terms](https://buoy.gg/terms)
|
|
82
|
-
|
|
83
|
-
## Web support (unreleased)
|
|
84
|
-
|
|
85
|
-
Register this package’s /web namespace in FloatingDevTools modules to use its shared panels and actions in a browser app. The browser build is available in this checkout and has not been published yet. See the [web setup guide](https://buoy.gg/buoy/latest/docs/web-preview) for registration, dependencies, and browser boundaries.
|
|
27
|
+
<sub>Part of <a href="https://buoy.gg">Buoy</a>, developer tools that live inside your app. Proprietary software. © Buoy LLC. <a href="https://buoy.gg/terms">Terms</a></sub>
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "CONSOLE_ICON_COLOR", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _sharedUi.CONSOLE_ICON_COLOR;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "ConsoleIcon", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _sharedUi.ConsoleIcon;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
19
|
-
//# sourceMappingURL=ConsoleIcon.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"CONSOLE_ICON_COLOR",{enumerable:true,get:function(){return _sharedUi.CONSOLE_ICON_COLOR}});Object.defineProperty(exports,"ConsoleIcon",{enumerable:true,get:function(){return _sharedUi.ConsoleIcon}});var _sharedUi=require("@buoy-gg/shared-ui");
|
|
@@ -1,152 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ConsoleLogList = ConsoleLogList;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _useConsoleLogs = require("../hooks/useConsoleLogs");
|
|
10
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
11
|
-
var _consoleLogStore = require("../store/consoleLogStore");
|
|
12
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
const LEVEL_COLOR = {
|
|
15
|
-
verbose: "#9b9b9b",
|
|
16
|
-
info: _sharedUi.night.color.text,
|
|
17
|
-
warning: "#e2c08d",
|
|
18
|
-
error: "#f48771"
|
|
19
|
-
};
|
|
20
|
-
function formatTime(ts) {
|
|
21
|
-
const d = new Date(ts);
|
|
22
|
-
const pad = (n, len = 2) => String(n).padStart(len, "0");
|
|
23
|
-
return `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}.${pad(d.getMilliseconds(), 3)}`;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Basic console log list — a flat, newest-last stream of captured entries.
|
|
28
|
-
* This is the proof-of-concept view; it will be replaced by a 1:1 port of
|
|
29
|
-
* Chrome DevTools' console once capture is verified.
|
|
30
|
-
*/
|
|
31
|
-
function ConsoleLogList() {
|
|
32
|
-
const {
|
|
33
|
-
logs
|
|
34
|
-
} = (0, _useConsoleLogs.useConsoleLogs)();
|
|
35
|
-
const renderItem = ({
|
|
36
|
-
item
|
|
37
|
-
}) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
38
|
-
style: styles.row,
|
|
39
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
40
|
-
style: styles.time,
|
|
41
|
-
children: formatTime(item.timestamp)
|
|
42
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
43
|
-
style: [styles.level, {
|
|
44
|
-
color: LEVEL_COLOR[item.level]
|
|
45
|
-
}],
|
|
46
|
-
children: item.level.toUpperCase()
|
|
47
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
48
|
-
style: [styles.message, {
|
|
49
|
-
color: LEVEL_COLOR[item.level]
|
|
50
|
-
}],
|
|
51
|
-
numberOfLines: 3,
|
|
52
|
-
children: item.message
|
|
53
|
-
})]
|
|
54
|
-
});
|
|
55
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
56
|
-
style: styles.container,
|
|
57
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
58
|
-
style: styles.header,
|
|
59
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
60
|
-
style: styles.headerTitle,
|
|
61
|
-
children: ["Console (", logs.length, ")"]
|
|
62
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
63
|
-
onPress: () => (0, _consoleLogStore.clearEntries)(),
|
|
64
|
-
style: styles.clearButton,
|
|
65
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
66
|
-
style: styles.clearText,
|
|
67
|
-
children: "Clear"
|
|
68
|
-
})
|
|
69
|
-
})]
|
|
70
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.FlatList, {
|
|
71
|
-
data: logs,
|
|
72
|
-
keyExtractor: item => String(item.id),
|
|
73
|
-
renderItem: renderItem,
|
|
74
|
-
ListEmptyComponent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ToolEmptyState, {
|
|
75
|
-
testID: "buoy-console-empty"
|
|
76
|
-
// printing = "console streaming; logs arriving" — armed and
|
|
77
|
-
// waiting for the first line.
|
|
78
|
-
,
|
|
79
|
-
otto: "printing",
|
|
80
|
-
title: "No console logs captured yet",
|
|
81
|
-
message: "console.log, .warn and .error from your app land here as they run."
|
|
82
|
-
}),
|
|
83
|
-
contentContainerStyle: logs.length === 0 ? styles.emptyContainer : undefined
|
|
84
|
-
})]
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
const styles = _reactNative.StyleSheet.create({
|
|
88
|
-
container: {
|
|
89
|
-
flex: 1,
|
|
90
|
-
// Transparent so the night sheet's star field shows through.
|
|
91
|
-
backgroundColor: "transparent"
|
|
92
|
-
},
|
|
93
|
-
header: {
|
|
94
|
-
flexDirection: "row",
|
|
95
|
-
alignItems: "center",
|
|
96
|
-
justifyContent: "space-between",
|
|
97
|
-
paddingHorizontal: 12,
|
|
98
|
-
paddingVertical: 8,
|
|
99
|
-
borderBottomWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
100
|
-
borderBottomColor: _sharedUi.night.color.border
|
|
101
|
-
},
|
|
102
|
-
headerTitle: {
|
|
103
|
-
color: _sharedUi.night.color.text,
|
|
104
|
-
fontSize: 13,
|
|
105
|
-
fontWeight: "600"
|
|
106
|
-
},
|
|
107
|
-
clearButton: {
|
|
108
|
-
paddingHorizontal: 10,
|
|
109
|
-
paddingVertical: 4,
|
|
110
|
-
borderRadius: 4,
|
|
111
|
-
backgroundColor: _sharedUi.night.color.surfaceElevated
|
|
112
|
-
},
|
|
113
|
-
clearText: {
|
|
114
|
-
color: _sharedUi.night.color.text,
|
|
115
|
-
fontSize: 12
|
|
116
|
-
},
|
|
117
|
-
row: {
|
|
118
|
-
flexDirection: "row",
|
|
119
|
-
paddingHorizontal: 12,
|
|
120
|
-
paddingVertical: 4,
|
|
121
|
-
borderBottomWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
122
|
-
borderBottomColor: _sharedUi.night.color.separator,
|
|
123
|
-
gap: 8
|
|
124
|
-
},
|
|
125
|
-
time: {
|
|
126
|
-
color: _sharedUi.night.color.textTertiary,
|
|
127
|
-
fontSize: 11,
|
|
128
|
-
fontVariant: ["tabular-nums"],
|
|
129
|
-
minWidth: 86
|
|
130
|
-
},
|
|
131
|
-
level: {
|
|
132
|
-
fontSize: 11,
|
|
133
|
-
fontWeight: "700",
|
|
134
|
-
minWidth: 44
|
|
135
|
-
},
|
|
136
|
-
message: {
|
|
137
|
-
flex: 1,
|
|
138
|
-
fontSize: 12,
|
|
139
|
-
fontFamily: _sharedUi.monoFont
|
|
140
|
-
},
|
|
141
|
-
empty: {
|
|
142
|
-
color: _sharedUi.night.color.textTertiary,
|
|
143
|
-
fontSize: 13,
|
|
144
|
-
textAlign: "center"
|
|
145
|
-
},
|
|
146
|
-
emptyContainer: {
|
|
147
|
-
flexGrow: 1,
|
|
148
|
-
alignItems: "center",
|
|
149
|
-
justifyContent: "center"
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
//# sourceMappingURL=ConsoleLogList.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConsoleLogList=ConsoleLogList;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _useConsoleLogs=require("../hooks/useConsoleLogs");var _sharedUi=require("@buoy-gg/shared-ui");var _consoleLogStore=require("../store/consoleLogStore");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}const LEVEL_COLOR={verbose:"#9b9b9b",info:_sharedUi.night.color.text,warning:"#e2c08d",error:"#f48771"};function formatTime(t){const o=new Date(t);const e=(r,n=2)=>String(r).padStart(n,"0");return`${e(o.getHours())}:${e(o.getMinutes())}:${e(o.getSeconds())}.${e(o.getMilliseconds(),3)}`}function ConsoleLogList(){const{logs:t}=(0,_useConsoleLogs.useConsoleLogs)();const o=({item:e})=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.row,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.time,children:formatTime(e.timestamp)}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.level,{color:LEVEL_COLOR[e.level]}],children:e.level.toUpperCase()}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.message,{color:LEVEL_COLOR[e.level]}],numberOfLines:3,children:e.message})]});return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.header,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.headerTitle,children:["Console (",t.length,")"]}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>(0,_consoleLogStore.clearEntries)(),style:styles.clearButton,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.clearText,children:"Clear"})})]}),(0,_jsxRuntime.jsx)(_reactNative.FlatList,{data:t,keyExtractor:e=>String(e.id),renderItem:o,ListEmptyComponent:(0,_jsxRuntime.jsx)(_sharedUi.ToolEmptyState,{testID:"buoy-console-empty",otto:"printing",title:"No console logs captured yet",message:"console.log, .warn and .error from your app land here as they run."}),contentContainerStyle:t.length===0?styles.emptyContainer:void 0})]})}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:"transparent"},header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:12,paddingVertical:8,borderBottomWidth:_reactNative.StyleSheet.hairlineWidth,borderBottomColor:_sharedUi.night.color.border},headerTitle:{color:_sharedUi.night.color.text,fontSize:13,fontWeight:"600"},clearButton:{paddingHorizontal:10,paddingVertical:4,borderRadius:4,backgroundColor:_sharedUi.night.color.surfaceElevated},clearText:{color:_sharedUi.night.color.text,fontSize:12},row:{flexDirection:"row",paddingHorizontal:12,paddingVertical:4,borderBottomWidth:_reactNative.StyleSheet.hairlineWidth,borderBottomColor:_sharedUi.night.color.separator,gap:8},time:{color:_sharedUi.night.color.textTertiary,fontSize:11,fontVariant:["tabular-nums"],minWidth:86},level:{fontSize:11,fontWeight:"700",minWidth:44},message:{flex:1,fontSize:12,fontFamily:_sharedUi.monoFont},empty:{color:_sharedUi.night.color.textTertiary,fontSize:13,textAlign:"center"},emptyContainer:{flexGrow:1,alignItems:"center",justifyContent:"center"}});
|
|
@@ -1,48 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ConsoleModal = ConsoleModal;
|
|
7
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
8
|
-
var _useConsoleController = require("../devtools/useConsoleController");
|
|
9
|
-
var _ConsoleHeader = require("../devtools/ConsoleHeader");
|
|
10
|
-
var _ConsoleBody = require("../devtools/ConsoleBody");
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
/**
|
|
13
|
-
* ConsoleModal
|
|
14
|
-
*
|
|
15
|
-
* Bottom-sheet wrapper for the console, rendered by FloatingDevTools when the
|
|
16
|
-
* Console tool is opened. The controls live in the shared ModalHeader
|
|
17
|
-
* (`customContent`) — matching Network/Events — and the body is the log list.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
function ConsoleModal({
|
|
21
|
-
visible,
|
|
22
|
-
onClose,
|
|
23
|
-
onBack,
|
|
24
|
-
onMinimize,
|
|
25
|
-
persistenceKey
|
|
26
|
-
}) {
|
|
27
|
-
const c = (0, _useConsoleController.useConsoleController)();
|
|
28
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.JsModal, {
|
|
29
|
-
visible: visible,
|
|
30
|
-
onClose: onClose,
|
|
31
|
-
onMinimize: onMinimize,
|
|
32
|
-
persistenceKey: persistenceKey,
|
|
33
|
-
header: {
|
|
34
|
-
showToggleButton: true,
|
|
35
|
-
customContent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ConsoleHeader.ConsoleHeader, {
|
|
36
|
-
c: c,
|
|
37
|
-
onBack: onBack
|
|
38
|
-
})
|
|
39
|
-
},
|
|
40
|
-
enablePersistence: true,
|
|
41
|
-
initialMode: "bottomSheet",
|
|
42
|
-
disableScrollWrapper: true,
|
|
43
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ConsoleBody.ConsoleBody, {
|
|
44
|
-
c: c
|
|
45
|
-
})
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=ConsoleModal.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConsoleModal=ConsoleModal;var _sharedUi=require("@buoy-gg/shared-ui");var _useConsoleController=require("../devtools/useConsoleController");var _ConsoleHeader=require("../devtools/ConsoleHeader");var _ConsoleBody=require("../devtools/ConsoleBody");var _jsxRuntime=require("react/jsx-runtime");function ConsoleModal({visible:o,onClose:r,onBack:s,onMinimize:l,persistenceKey:n}){const e=(0,_useConsoleController.useConsoleController)();return(0,_jsxRuntime.jsx)(_sharedUi.JsModal,{visible:o,onClose:r,onMinimize:l,persistenceKey:n,header:{showToggleButton:true,customContent:(0,_jsxRuntime.jsx)(_ConsoleHeader.ConsoleHeader,{c:e,onBack:s})},enablePersistence:true,initialMode:"bottomSheet",disableScrollWrapper:true,children:(0,_jsxRuntime.jsx)(_ConsoleBody.ConsoleBody,{c:e})})}
|
|
@@ -1,37 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ConsoleRoot = ConsoleRoot;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
9
|
-
var _consoleLogStore = require("../store/consoleLogStore");
|
|
10
|
-
let owners = 0;
|
|
11
|
-
/** Bounded private startup capture; persistence begins only after admission. */
|
|
12
|
-
function ConsoleRoot() {
|
|
13
|
-
(0, _react.useEffect)(() => {
|
|
14
|
-
++owners;
|
|
15
|
-
let active = true;
|
|
16
|
-
const reconcile = () => {
|
|
17
|
-
if (!active) return;
|
|
18
|
-
const access = (0, _sharedUi.getAccountAccess)();
|
|
19
|
-
if (access.status === "locked") {
|
|
20
|
-
(0, _consoleLogStore.uninstallConsoleCapture)();
|
|
21
|
-
(0, _consoleLogStore.clearEntries)();
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
(0, _consoleLogStore.installConsoleCapture)();
|
|
25
|
-
if (access.status === "admitted") void (0, _consoleLogStore.initConsolePersistence)();
|
|
26
|
-
};
|
|
27
|
-
const off = (0, _sharedUi.subscribeAccountAccess)(reconcile);
|
|
28
|
-
reconcile();
|
|
29
|
-
return () => {
|
|
30
|
-
active = false;
|
|
31
|
-
off();
|
|
32
|
-
if (--owners === 0) (0, _consoleLogStore.uninstallConsoleCapture)();
|
|
33
|
-
};
|
|
34
|
-
}, []);
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=ConsoleRoot.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConsoleRoot=ConsoleRoot;var _react=require("react");var _sharedUi=require("@buoy-gg/shared-ui");var _consoleLogStore=require("../store/consoleLogStore");let owners=0;function ConsoleRoot(){(0,_react.useEffect)(()=>{++owners;let e=true;const t=()=>{if(!e)return;const o=(0,_sharedUi.getAccountAccess)();if(o.status==="locked"){(0,_consoleLogStore.uninstallConsoleCapture)();(0,_consoleLogStore.clearEntries)();return}(0,_consoleLogStore.installConsoleCapture)();if(o.status==="admitted")void(0,_consoleLogStore.initConsolePersistence)()};const r=(0,_sharedUi.subscribeAccountAccess)(t);t();return()=>{e=false;r();if(--owners===0)(0,_consoleLogStore.uninstallConsoleCapture)()}},[]);return null}
|
|
@@ -1,234 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ConsoleBody = ConsoleBody;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
10
|
-
var _ConsoleMessageRow = require("./ConsoleMessageRow");
|
|
11
|
-
var _consoleFilter = require("./consoleFilter");
|
|
12
|
-
var _consoleLogStore = require("../store/consoleLogStore");
|
|
13
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
|
-
/**
|
|
16
|
-
* ConsoleBody — the modal body. Renders the virtualized log list, or (when a
|
|
17
|
-
* header action selected it) a back-navigable Log levels / Console settings
|
|
18
|
-
* sub-view, mirroring how Network swaps its body to a filter sub-view.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
function ConsoleBody({
|
|
22
|
-
c
|
|
23
|
-
}) {
|
|
24
|
-
if (c.view === "filters") return /*#__PURE__*/(0, _jsxRuntime.jsx)(FiltersView, {
|
|
25
|
-
c: c
|
|
26
|
-
});
|
|
27
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ConsoleList, {
|
|
28
|
-
c: c
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// ─── Log list ────────────────────────────────────────────────────────────────
|
|
33
|
-
|
|
34
|
-
function ConsoleList({
|
|
35
|
-
c
|
|
36
|
-
}) {
|
|
37
|
-
const listRef = (0, _react.useRef)(null);
|
|
38
|
-
const stickToBottom = (0, _react.useRef)(true);
|
|
39
|
-
const renderItem = (0, _react.useCallback)(({
|
|
40
|
-
item
|
|
41
|
-
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_ConsoleMessageRow.ConsoleMessageRow, {
|
|
42
|
-
row: item,
|
|
43
|
-
showTimestamps: c.showTimestamps,
|
|
44
|
-
onToggleGroup: c.onToggleGroup,
|
|
45
|
-
onToggleCluster: c.onToggleCluster
|
|
46
|
-
}), [c.showTimestamps, c.onToggleGroup, c.onToggleCluster]);
|
|
47
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.FlatList, {
|
|
48
|
-
ref: listRef,
|
|
49
|
-
data: c.rows,
|
|
50
|
-
keyExtractor: item => item.key,
|
|
51
|
-
renderItem: renderItem,
|
|
52
|
-
style: styles.list,
|
|
53
|
-
..._sharedUi.LOG_LIST_PRESET,
|
|
54
|
-
onContentSizeChange: () => {
|
|
55
|
-
if (stickToBottom.current) listRef.current?.scrollToEnd({
|
|
56
|
-
animated: false
|
|
57
|
-
});
|
|
58
|
-
},
|
|
59
|
-
onScroll: e => {
|
|
60
|
-
const {
|
|
61
|
-
contentOffset,
|
|
62
|
-
contentSize,
|
|
63
|
-
layoutMeasurement
|
|
64
|
-
} = e.nativeEvent;
|
|
65
|
-
const distanceFromBottom = contentSize.height - (contentOffset.y + layoutMeasurement.height);
|
|
66
|
-
stickToBottom.current = distanceFromBottom < 40;
|
|
67
|
-
},
|
|
68
|
-
scrollEventThrottle: 100
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// ─── Sub-views ───────────────────────────────────────────────────────────────
|
|
73
|
-
|
|
74
|
-
function CheckRow({
|
|
75
|
-
on,
|
|
76
|
-
label,
|
|
77
|
-
subtext,
|
|
78
|
-
onPress
|
|
79
|
-
}) {
|
|
80
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
81
|
-
style: styles.row,
|
|
82
|
-
onPress: onPress,
|
|
83
|
-
activeOpacity: 0.7,
|
|
84
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
85
|
-
style: [styles.checkbox, on && styles.checkboxOn],
|
|
86
|
-
children: on ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Check, {
|
|
87
|
-
size: 12,
|
|
88
|
-
color: _sharedUi.night.color.onAccent,
|
|
89
|
-
strokeWidth: 3
|
|
90
|
-
}) : null
|
|
91
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
92
|
-
style: styles.rowTextCol,
|
|
93
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
94
|
-
style: styles.rowLabel,
|
|
95
|
-
children: label
|
|
96
|
-
}), subtext ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
97
|
-
style: styles.rowSubtext,
|
|
98
|
-
children: subtext
|
|
99
|
-
}) : null]
|
|
100
|
-
})]
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
function SectionLabel({
|
|
104
|
-
text
|
|
105
|
-
}) {
|
|
106
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
107
|
-
style: styles.sectionLabel,
|
|
108
|
-
children: text
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
function FiltersView({
|
|
112
|
-
c
|
|
113
|
-
}) {
|
|
114
|
-
const preserveLog = (0, _react.useSyncExternalStore)(_consoleLogStore.subscribePreserveLog, _consoleLogStore.getPreserveLog, _consoleLogStore.getPreserveLog);
|
|
115
|
-
const toggle = level => c.setLevelsMask({
|
|
116
|
-
...c.levelsMask,
|
|
117
|
-
[level]: !c.levelsMask[level]
|
|
118
|
-
});
|
|
119
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
|
|
120
|
-
style: styles.subView,
|
|
121
|
-
contentContainerStyle: styles.subViewContent,
|
|
122
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(SectionLabel, {
|
|
123
|
-
text: "Log levels"
|
|
124
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
125
|
-
style: styles.presetRow,
|
|
126
|
-
onPress: () => c.setLevelsMask({
|
|
127
|
-
..._consoleFilter.DEFAULT_LEVELS
|
|
128
|
-
}),
|
|
129
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
130
|
-
style: styles.presetText,
|
|
131
|
-
children: "Default (hide verbose)"
|
|
132
|
-
})
|
|
133
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
134
|
-
style: styles.presetRow,
|
|
135
|
-
onPress: () => c.setLevelsMask({
|
|
136
|
-
..._consoleFilter.ALL_LEVELS
|
|
137
|
-
}),
|
|
138
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
139
|
-
style: styles.presetText,
|
|
140
|
-
children: "All levels"
|
|
141
|
-
})
|
|
142
|
-
}), _consoleFilter.LEVEL_ORDER.map(level => /*#__PURE__*/(0, _jsxRuntime.jsx)(CheckRow, {
|
|
143
|
-
on: c.levelsMask[level],
|
|
144
|
-
label: _consoleFilter.LEVEL_LABEL[level],
|
|
145
|
-
onPress: () => toggle(level)
|
|
146
|
-
}, level)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
147
|
-
style: styles.divider
|
|
148
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(SectionLabel, {
|
|
149
|
-
text: "Settings"
|
|
150
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(CheckRow, {
|
|
151
|
-
on: c.showTimestamps,
|
|
152
|
-
label: "Show timestamps",
|
|
153
|
-
onPress: () => c.setShowTimestamps(s => !s)
|
|
154
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(CheckRow, {
|
|
155
|
-
on: preserveLog,
|
|
156
|
-
label: "Preserve log",
|
|
157
|
-
subtext: "Do not clear log on reload",
|
|
158
|
-
onPress: () => (0, _consoleLogStore.setPreserveLog)(!preserveLog)
|
|
159
|
-
})]
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
const styles = _reactNative.StyleSheet.create({
|
|
163
|
-
list: {
|
|
164
|
-
flex: 1,
|
|
165
|
-
// Transparent so JsModal's ToolBackground shows through (the modal paints opaque base beneath it).
|
|
166
|
-
backgroundColor: "transparent"
|
|
167
|
-
},
|
|
168
|
-
subView: {
|
|
169
|
-
flex: 1,
|
|
170
|
-
// Transparent so the night sheet's star field shows through.
|
|
171
|
-
backgroundColor: "transparent"
|
|
172
|
-
},
|
|
173
|
-
subViewContent: {
|
|
174
|
-
padding: 12
|
|
175
|
-
},
|
|
176
|
-
sectionLabel: {
|
|
177
|
-
color: _sharedUi.night.color.textTertiary,
|
|
178
|
-
fontSize: 11,
|
|
179
|
-
textTransform: "uppercase",
|
|
180
|
-
letterSpacing: 0.5,
|
|
181
|
-
marginTop: 4,
|
|
182
|
-
marginBottom: 4,
|
|
183
|
-
paddingHorizontal: 8
|
|
184
|
-
},
|
|
185
|
-
presetRow: {
|
|
186
|
-
paddingVertical: 10,
|
|
187
|
-
paddingHorizontal: 8
|
|
188
|
-
},
|
|
189
|
-
presetText: {
|
|
190
|
-
color: _sharedUi.night.color.accent,
|
|
191
|
-
fontSize: 14,
|
|
192
|
-
fontWeight: "600"
|
|
193
|
-
},
|
|
194
|
-
divider: {
|
|
195
|
-
height: _reactNative.StyleSheet.hairlineWidth,
|
|
196
|
-
backgroundColor: _sharedUi.night.color.border,
|
|
197
|
-
marginVertical: 6
|
|
198
|
-
},
|
|
199
|
-
row: {
|
|
200
|
-
flexDirection: "row",
|
|
201
|
-
alignItems: "center",
|
|
202
|
-
paddingVertical: 10,
|
|
203
|
-
paddingHorizontal: 8,
|
|
204
|
-
gap: 12
|
|
205
|
-
},
|
|
206
|
-
rowTextCol: {
|
|
207
|
-
flexDirection: "column",
|
|
208
|
-
flex: 1
|
|
209
|
-
},
|
|
210
|
-
rowLabel: {
|
|
211
|
-
color: _sharedUi.night.color.text,
|
|
212
|
-
fontSize: 14
|
|
213
|
-
},
|
|
214
|
-
rowSubtext: {
|
|
215
|
-
color: _sharedUi.night.color.textTertiary,
|
|
216
|
-
fontSize: 12,
|
|
217
|
-
marginTop: 1
|
|
218
|
-
},
|
|
219
|
-
checkbox: {
|
|
220
|
-
width: 18,
|
|
221
|
-
height: 18,
|
|
222
|
-
borderRadius: 4,
|
|
223
|
-
borderWidth: 1,
|
|
224
|
-
borderColor: _sharedUi.night.color.fillTertiary,
|
|
225
|
-
alignItems: "center",
|
|
226
|
-
justifyContent: "center"
|
|
227
|
-
},
|
|
228
|
-
// Solid accent (not accentSoft) so the onAccent check glyph stays legible.
|
|
229
|
-
checkboxOn: {
|
|
230
|
-
backgroundColor: _sharedUi.night.color.accent,
|
|
231
|
-
borderColor: _sharedUi.night.color.accent
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
//# sourceMappingURL=ConsoleBody.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConsoleBody=ConsoleBody;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _ConsoleMessageRow=require("./ConsoleMessageRow");var _consoleFilter=require("./consoleFilter");var _consoleLogStore=require("../store/consoleLogStore");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,r){if("function"==typeof WeakMap)var n=new WeakMap,o=new WeakMap;return(_interopRequireWildcard=function(t,c){if(!c&&t&&t.__esModule)return t;var s,i,l={__proto__:null,default:t};if(null===t||"object"!=typeof t&&"function"!=typeof t)return l;if(s=c?o:n){if(s.has(t))return s.get(t);s.set(t,l)}for(const a in t)"default"!==a&&{}.hasOwnProperty.call(t,a)&&((i=(s=Object.defineProperty)&&Object.getOwnPropertyDescriptor(t,a))&&(i.get||i.set)?s(l,a,i):l[a]=t[a]);return l})(e,r)}function ConsoleBody({c:e}){if(e.view==="filters")return(0,_jsxRuntime.jsx)(FiltersView,{c:e});return(0,_jsxRuntime.jsx)(ConsoleList,{c:e})}function ConsoleList({c:e}){const r=(0,_react.useRef)(null);const n=(0,_react.useRef)(true);const o=(0,_react.useCallback)(({item:t})=>(0,_jsxRuntime.jsx)(_ConsoleMessageRow.ConsoleMessageRow,{row:t,showTimestamps:e.showTimestamps,onToggleGroup:e.onToggleGroup,onToggleCluster:e.onToggleCluster}),[e.showTimestamps,e.onToggleGroup,e.onToggleCluster]);return(0,_jsxRuntime.jsx)(_reactNative.FlatList,{ref:r,data:e.rows,keyExtractor:t=>t.key,renderItem:o,style:styles.list,..._sharedUi.LOG_LIST_PRESET,onContentSizeChange:()=>{if(n.current)r.current?.scrollToEnd({animated:false})},onScroll:t=>{const{contentOffset:c,contentSize:s,layoutMeasurement:i}=t.nativeEvent;const l=s.height-(c.y+i.height);n.current=l<40},scrollEventThrottle:100})}function CheckRow({on:e,label:r,subtext:n,onPress:o}){return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.row,onPress:o,activeOpacity:.7,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.checkbox,e&&styles.checkboxOn],children:e?(0,_jsxRuntime.jsx)(_sharedUi.Check,{size:12,color:_sharedUi.night.color.onAccent,strokeWidth:3}):null}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.rowTextCol,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowLabel,children:r}),n?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowSubtext,children:n}):null]})]})}function SectionLabel({text:e}){return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionLabel,children:e})}function FiltersView({c:e}){const r=(0,_react.useSyncExternalStore)(_consoleLogStore.subscribePreserveLog,_consoleLogStore.getPreserveLog,_consoleLogStore.getPreserveLog);const n=o=>e.setLevelsMask({...e.levelsMask,[o]:!e.levelsMask[o]});return(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.subView,contentContainerStyle:styles.subViewContent,children:[(0,_jsxRuntime.jsx)(SectionLabel,{text:"Log levels"}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.presetRow,onPress:()=>e.setLevelsMask({..._consoleFilter.DEFAULT_LEVELS}),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.presetText,children:"Default (hide verbose)"})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.presetRow,onPress:()=>e.setLevelsMask({..._consoleFilter.ALL_LEVELS}),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.presetText,children:"All levels"})}),_consoleFilter.LEVEL_ORDER.map(o=>(0,_jsxRuntime.jsx)(CheckRow,{on:e.levelsMask[o],label:_consoleFilter.LEVEL_LABEL[o],onPress:()=>n(o)},o)),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.divider}),(0,_jsxRuntime.jsx)(SectionLabel,{text:"Settings"}),(0,_jsxRuntime.jsx)(CheckRow,{on:e.showTimestamps,label:"Show timestamps",onPress:()=>e.setShowTimestamps(o=>!o)}),(0,_jsxRuntime.jsx)(CheckRow,{on:r,label:"Preserve log",subtext:"Do not clear log on reload",onPress:()=>(0,_consoleLogStore.setPreserveLog)(!r)})]})}const styles=_reactNative.StyleSheet.create({list:{flex:1,backgroundColor:"transparent"},subView:{flex:1,backgroundColor:"transparent"},subViewContent:{padding:12},sectionLabel:{color:_sharedUi.night.color.textTertiary,fontSize:11,textTransform:"uppercase",letterSpacing:.5,marginTop:4,marginBottom:4,paddingHorizontal:8},presetRow:{paddingVertical:10,paddingHorizontal:8},presetText:{color:_sharedUi.night.color.accent,fontSize:14,fontWeight:"600"},divider:{height:_reactNative.StyleSheet.hairlineWidth,backgroundColor:_sharedUi.night.color.border,marginVertical:6},row:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:8,gap:12},rowTextCol:{flexDirection:"column",flex:1},rowLabel:{color:_sharedUi.night.color.text,fontSize:14},rowSubtext:{color:_sharedUi.night.color.textTertiary,fontSize:12,marginTop:1},checkbox:{width:18,height:18,borderRadius:4,borderWidth:1,borderColor:_sharedUi.night.color.fillTertiary,alignItems:"center",justifyContent:"center"},checkboxOn:{backgroundColor:_sharedUi.night.color.accent,borderColor:_sharedUi.night.color.accent}});
|