@buoy-gg/console 7.0.41 → 7.0.42
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 +2 -2
- 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
|
@@ -1,249 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* ConsoleValue — RN approximation of DevTools' object/value rendering
|
|
5
|
-
* (ObjectPropertiesSection + RemoteObjectPreviewFormatter).
|
|
6
|
-
*
|
|
7
|
-
* Primitives render with the DevTools dark-theme `object-value-*` token colors.
|
|
8
|
-
* Objects/arrays render an italic one-line preview with an expand triangle;
|
|
9
|
-
* expanding reveals a property tree (lazy, recursive). Matches the console's
|
|
10
|
-
* collapsed-preview / click-to-expand behavior.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import React, { useState } from "react";
|
|
14
|
-
import { Text, View, TouchableOpacity, StyleSheet } from "react-native";
|
|
15
|
-
import { consoleTheme, monoFont } from "./theme";
|
|
16
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
-
const MAX_PREVIEW_PROPERTIES = 5;
|
|
18
|
-
const MAX_PREVIEW_ARRAY = 6;
|
|
19
|
-
function kindOf(value) {
|
|
20
|
-
if (value === null) return "null";
|
|
21
|
-
if (value === undefined) return "undefined";
|
|
22
|
-
if (Array.isArray(value)) return "array";
|
|
23
|
-
if (value instanceof Error) return "error";
|
|
24
|
-
const t = typeof value;
|
|
25
|
-
if (t === "number") return "number";
|
|
26
|
-
if (t === "bigint") return "bigint";
|
|
27
|
-
if (t === "boolean") return "boolean";
|
|
28
|
-
if (t === "string") return "string";
|
|
29
|
-
if (t === "function") return "function";
|
|
30
|
-
if (t === "symbol") return "symbol";
|
|
31
|
-
return "object";
|
|
32
|
-
}
|
|
33
|
-
const KIND_COLOR = {
|
|
34
|
-
number: consoleTheme.valueNumber,
|
|
35
|
-
bigint: consoleTheme.valueBigint,
|
|
36
|
-
boolean: consoleTheme.valueNumber,
|
|
37
|
-
string: consoleTheme.valueString,
|
|
38
|
-
null: consoleTheme.valueNullish,
|
|
39
|
-
undefined: consoleTheme.valueNullish,
|
|
40
|
-
symbol: consoleTheme.valueString,
|
|
41
|
-
function: consoleTheme.valueNode
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/** The constructor/type label DevTools shows before an object's preview. */
|
|
45
|
-
function constructorName(value) {
|
|
46
|
-
if (Array.isArray(value)) return "";
|
|
47
|
-
const proto = Object.getPrototypeOf(value);
|
|
48
|
-
if (!proto) return "Object";
|
|
49
|
-
const name = proto.constructor?.name;
|
|
50
|
-
return !name || name === "Object" ? "" : name;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/** One-line scalar text for a value (used inside previews). */
|
|
54
|
-
function scalarText(value) {
|
|
55
|
-
const kind = kindOf(value);
|
|
56
|
-
switch (kind) {
|
|
57
|
-
case "string":
|
|
58
|
-
return `'${value}'`;
|
|
59
|
-
case "function":
|
|
60
|
-
{
|
|
61
|
-
const name = value.name;
|
|
62
|
-
return `ƒ ${name || ""}`.trimEnd();
|
|
63
|
-
}
|
|
64
|
-
case "symbol":
|
|
65
|
-
return value.toString();
|
|
66
|
-
case "bigint":
|
|
67
|
-
return `${String(value)}n`;
|
|
68
|
-
case "array":
|
|
69
|
-
return `Array(${value.length})`;
|
|
70
|
-
case "error":
|
|
71
|
-
return value.name;
|
|
72
|
-
case "object":
|
|
73
|
-
{
|
|
74
|
-
const name = constructorName(value);
|
|
75
|
-
return name ? `${name} {…}` : "{…}";
|
|
76
|
-
}
|
|
77
|
-
default:
|
|
78
|
-
return String(value);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/** Build the collapsed italic preview string for an object/array. */
|
|
83
|
-
function buildPreview(value) {
|
|
84
|
-
if (Array.isArray(value)) {
|
|
85
|
-
const head = value.slice(0, MAX_PREVIEW_ARRAY).map(v => scalarText(v)).join(", ");
|
|
86
|
-
const more = value.length > MAX_PREVIEW_ARRAY ? ", …" : "";
|
|
87
|
-
return `(${value.length}) [${head}${more}]`;
|
|
88
|
-
}
|
|
89
|
-
const entries = Object.entries(value);
|
|
90
|
-
const head = entries.slice(0, MAX_PREVIEW_PROPERTIES).map(([k, v]) => `${k}: ${scalarText(v)}`).join(", ");
|
|
91
|
-
const more = entries.length > MAX_PREVIEW_PROPERTIES ? ", …" : "";
|
|
92
|
-
const ctor = constructorName(value);
|
|
93
|
-
const prefix = ctor ? `${ctor} ` : "";
|
|
94
|
-
return `${prefix}{${head}${more}}`;
|
|
95
|
-
}
|
|
96
|
-
function isExpandable(value) {
|
|
97
|
-
const kind = kindOf(value);
|
|
98
|
-
if (kind === "array") return value.length > 0;
|
|
99
|
-
if (kind === "object") return Object.keys(value).length > 0;
|
|
100
|
-
if (kind === "error") return true;
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
const Triangle = ({
|
|
104
|
-
open
|
|
105
|
-
}) => /*#__PURE__*/_jsx(Text, {
|
|
106
|
-
style: [styles.triangle, open && styles.triangleOpen],
|
|
107
|
-
children: "\u25B6"
|
|
108
|
-
});
|
|
109
|
-
/** Render a single console argument / property value. */
|
|
110
|
-
export function ConsoleValue({
|
|
111
|
-
value,
|
|
112
|
-
depth = 0
|
|
113
|
-
}) {
|
|
114
|
-
const [expanded, setExpanded] = useState(false);
|
|
115
|
-
const kind = kindOf(value);
|
|
116
|
-
|
|
117
|
-
// Errors: collapsed to a single "Name: message" line (like Chrome / the web
|
|
118
|
-
// dashboard), expandable to the full stack. Avoids dumping a 100-line stack
|
|
119
|
-
// inline on native, where the arg is a real Error (not a sanitized object).
|
|
120
|
-
if (kind === "error") {
|
|
121
|
-
const err = value;
|
|
122
|
-
const head = `${err.name}: ${err.message}`.split("\n")[0];
|
|
123
|
-
const stack = err.stack && err.stack.trim() !== head.trim() ? err.stack : undefined;
|
|
124
|
-
if (!stack) {
|
|
125
|
-
return /*#__PURE__*/_jsx(Text, {
|
|
126
|
-
style: [styles.mono, {
|
|
127
|
-
color: consoleTheme.onErrorContainer
|
|
128
|
-
}],
|
|
129
|
-
numberOfLines: 1,
|
|
130
|
-
children: head
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
134
|
-
style: styles.objectContainer,
|
|
135
|
-
children: [/*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
136
|
-
style: styles.objectHeader,
|
|
137
|
-
activeOpacity: 0.6,
|
|
138
|
-
onPress: () => setExpanded(e => !e),
|
|
139
|
-
children: [/*#__PURE__*/_jsx(Triangle, {
|
|
140
|
-
open: expanded
|
|
141
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
142
|
-
style: [styles.mono, styles.errorHead],
|
|
143
|
-
numberOfLines: expanded ? undefined : 1,
|
|
144
|
-
children: head
|
|
145
|
-
})]
|
|
146
|
-
}), expanded ? /*#__PURE__*/_jsx(Text, {
|
|
147
|
-
style: [styles.mono, styles.errorStack],
|
|
148
|
-
children: stack
|
|
149
|
-
}) : null]
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
if (!isExpandable(value)) {
|
|
153
|
-
const color = KIND_COLOR[kind] ?? consoleTheme.onSurface;
|
|
154
|
-
return /*#__PURE__*/_jsx(Text, {
|
|
155
|
-
style: [styles.mono, {
|
|
156
|
-
color
|
|
157
|
-
}],
|
|
158
|
-
children: scalarText(value)
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
const obj = value;
|
|
162
|
-
const entries = Array.isArray(obj) ? obj.map((v, i) => [String(i), v]) : Object.entries(obj);
|
|
163
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
164
|
-
style: styles.objectContainer,
|
|
165
|
-
children: [/*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
166
|
-
onPress: () => setExpanded(e => !e),
|
|
167
|
-
activeOpacity: 0.6,
|
|
168
|
-
style: styles.objectHeader,
|
|
169
|
-
children: [/*#__PURE__*/_jsx(Triangle, {
|
|
170
|
-
open: expanded
|
|
171
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
172
|
-
style: [styles.mono, styles.preview],
|
|
173
|
-
numberOfLines: expanded ? undefined : 1,
|
|
174
|
-
children: buildPreview(obj)
|
|
175
|
-
})]
|
|
176
|
-
}), expanded && depth < 6 ? /*#__PURE__*/_jsx(View, {
|
|
177
|
-
style: styles.children,
|
|
178
|
-
children: entries.map(([key, v]) => /*#__PURE__*/_jsxs(View, {
|
|
179
|
-
style: styles.propertyRow,
|
|
180
|
-
children: [/*#__PURE__*/_jsxs(Text, {
|
|
181
|
-
style: [styles.mono, styles.propertyKey],
|
|
182
|
-
children: [key, ":"]
|
|
183
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
184
|
-
style: styles.propertyValue,
|
|
185
|
-
children: /*#__PURE__*/_jsx(ConsoleValue, {
|
|
186
|
-
value: v,
|
|
187
|
-
depth: depth + 1
|
|
188
|
-
})
|
|
189
|
-
})]
|
|
190
|
-
}, key))
|
|
191
|
-
}) : null]
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
const monoStyle = {
|
|
195
|
-
fontFamily: monoFont,
|
|
196
|
-
fontSize: 12,
|
|
197
|
-
lineHeight: 16
|
|
198
|
-
};
|
|
199
|
-
const styles = StyleSheet.create({
|
|
200
|
-
mono: monoStyle,
|
|
201
|
-
objectContainer: {
|
|
202
|
-
flexDirection: "column"
|
|
203
|
-
},
|
|
204
|
-
objectHeader: {
|
|
205
|
-
flexDirection: "row",
|
|
206
|
-
alignItems: "flex-start"
|
|
207
|
-
},
|
|
208
|
-
triangle: {
|
|
209
|
-
color: consoleTheme.tokenSubtle,
|
|
210
|
-
fontSize: 8,
|
|
211
|
-
lineHeight: 16,
|
|
212
|
-
width: 12
|
|
213
|
-
},
|
|
214
|
-
triangleOpen: {
|
|
215
|
-
transform: [{
|
|
216
|
-
rotate: "90deg"
|
|
217
|
-
}]
|
|
218
|
-
},
|
|
219
|
-
preview: {
|
|
220
|
-
color: consoleTheme.valuePreview,
|
|
221
|
-
fontStyle: "italic",
|
|
222
|
-
flexShrink: 1
|
|
223
|
-
},
|
|
224
|
-
errorHead: {
|
|
225
|
-
color: consoleTheme.onErrorContainer,
|
|
226
|
-
flexShrink: 1
|
|
227
|
-
},
|
|
228
|
-
errorStack: {
|
|
229
|
-
color: consoleTheme.tokenSubtle,
|
|
230
|
-
marginLeft: 14,
|
|
231
|
-
marginTop: 1
|
|
232
|
-
},
|
|
233
|
-
children: {
|
|
234
|
-
marginLeft: 14,
|
|
235
|
-
flexDirection: "column"
|
|
236
|
-
},
|
|
237
|
-
propertyRow: {
|
|
238
|
-
flexDirection: "row",
|
|
239
|
-
alignItems: "flex-start"
|
|
240
|
-
},
|
|
241
|
-
propertyKey: {
|
|
242
|
-
color: consoleTheme.valueNode,
|
|
243
|
-
marginRight: 6
|
|
244
|
-
},
|
|
245
|
-
propertyValue: {
|
|
246
|
-
flexShrink: 1
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
//# sourceMappingURL=ConsoleValue.js.map
|
|
1
|
+
"use strict";import H,{useState as k}from"react";import{Text as l,View as d,TouchableOpacity as h,StyleSheet as A}from"react-native";import{consoleTheme as i,monoFont as E}from"./theme";import{jsx as c,jsxs as f}from"react/jsx-runtime";const j=5;const S=6;function b(e){if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";if(e instanceof Error)return"error";const r=typeof e;if(r==="number")return"number";if(r==="bigint")return"bigint";if(r==="boolean")return"boolean";if(r==="string")return"string";if(r==="function")return"function";if(r==="symbol")return"symbol";return"object"}const w={number:i.valueNumber,bigint:i.valueBigint,boolean:i.valueNumber,string:i.valueString,null:i.valueNullish,undefined:i.valueNullish,symbol:i.valueString,function:i.valueNode};function x(e){if(Array.isArray(e))return"";const r=Object.getPrototypeOf(e);if(!r)return"Object";const o=r.constructor?.name;return!o||o==="Object"?"":o}function p(e){const r=b(e);switch(r){case"string":return`'${e}'`;case"function":{const o=e.name;return`\u0192 ${o||""}`.trimEnd()}case"symbol":return e.toString();case"bigint":return`${String(e)}n`;case"array":return`Array(${e.length})`;case"error":return e.name;case"object":{const o=x(e);return o?`${o} {\u2026}`:"{\u2026}"}default:return String(e)}}function R(e){if(Array.isArray(e)){const m=e.slice(0,S).map(s=>p(s)).join(", ");const t=e.length>S?", \u2026":"";return`(${e.length}) [${m}${t}]`}const r=Object.entries(e);const o=r.slice(0,j).map(([m,t])=>`${m}: ${p(t)}`).join(", ");const y=r.length>j?", \u2026":"";const u=x(e);const a=u?`${u} `:"";return`${a}{${o}${y}}`}function P(e){const r=b(e);if(r==="array")return e.length>0;if(r==="object")return Object.keys(e).length>0;if(r==="error")return true;return false}const O=({open:e})=>c(l,{style:[n.triangle,e&&n.triangleOpen],children:"\u25B6"});export function ConsoleValue({value:e,depth:r=0}){const[o,y]=k(false);const u=b(e);if(u==="error"){const t=e;const s=`${t.name}: ${t.message}`.split("\n")[0];const g=t.stack&&t.stack.trim()!==s.trim()?t.stack:void 0;if(!g){return c(l,{style:[n.mono,{color:i.onErrorContainer}],numberOfLines:1,children:s})}return f(d,{style:n.objectContainer,children:[f(h,{style:n.objectHeader,activeOpacity:.6,onPress:()=>y($=>!$),children:[c(O,{open:o}),c(l,{style:[n.mono,n.errorHead],numberOfLines:o?void 0:1,children:s})]}),o?c(l,{style:[n.mono,n.errorStack],children:g}):null]})}if(!P(e)){const t=w[u]??i.onSurface;return c(l,{style:[n.mono,{color:t}],children:p(e)})}const a=e;const m=Array.isArray(a)?a.map((t,s)=>[String(s),t]):Object.entries(a);return f(d,{style:n.objectContainer,children:[f(h,{onPress:()=>y(t=>!t),activeOpacity:.6,style:n.objectHeader,children:[c(O,{open:o}),c(l,{style:[n.mono,n.preview],numberOfLines:o?void 0:1,children:R(a)})]}),o&&r<6?c(d,{style:n.children,children:m.map(([t,s])=>f(d,{style:n.propertyRow,children:[f(l,{style:[n.mono,n.propertyKey],children:[t,":"]}),c(d,{style:n.propertyValue,children:c(ConsoleValue,{value:s,depth:r+1})})]},t))}):null]})}const N={fontFamily:E,fontSize:12,lineHeight:16};const n=A.create({mono:N,objectContainer:{flexDirection:"column"},objectHeader:{flexDirection:"row",alignItems:"flex-start"},triangle:{color:i.tokenSubtle,fontSize:8,lineHeight:16,width:12},triangleOpen:{transform:[{rotate:"90deg"}]},preview:{color:i.valuePreview,fontStyle:"italic",flexShrink:1},errorHead:{color:i.onErrorContainer,flexShrink:1},errorStack:{color:i.tokenSubtle,marginLeft:14,marginTop:1},children:{marginLeft:14,flexDirection:"column"},propertyRow:{flexDirection:"row",alignItems:"flex-start"},propertyKey:{color:i.valueNode,marginRight:6},propertyValue:{flexShrink:1}});
|
|
@@ -1,49 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* ConsoleView — self-contained Console panel (header bar + body) for embedding
|
|
5
|
-
* outside a JsModal (the desktop dashboard inline tool, or any standalone use).
|
|
6
|
-
*
|
|
7
|
-
* Inside the mobile floating menu, ConsoleModal composes the same pieces but
|
|
8
|
-
* routes the header into JsModal's `customContent` instead.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import React from "react";
|
|
12
|
-
import { View, StyleSheet } from "react-native";
|
|
13
|
-
import { macOSColors, windowDragProps } from "@buoy-gg/shared-ui";
|
|
14
|
-
import { ConsoleHeader } from "./ConsoleHeader";
|
|
15
|
-
import { ConsoleBody } from "./ConsoleBody";
|
|
16
|
-
import { useConsoleController } from "./useConsoleController";
|
|
17
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
-
export function ConsoleView() {
|
|
19
|
-
const c = useConsoleController();
|
|
20
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
21
|
-
style: styles.container,
|
|
22
|
-
children: [/*#__PURE__*/_jsx(View, {
|
|
23
|
-
style: styles.headerBar,
|
|
24
|
-
...windowDragProps,
|
|
25
|
-
children: /*#__PURE__*/_jsx(ConsoleHeader, {
|
|
26
|
-
c: c
|
|
27
|
-
})
|
|
28
|
-
}), /*#__PURE__*/_jsx(ConsoleBody, {
|
|
29
|
-
c: c
|
|
30
|
-
})]
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
const styles = StyleSheet.create({
|
|
34
|
-
container: {
|
|
35
|
-
flex: 1,
|
|
36
|
-
// Transparent so the desktop workbench's hoisted sky (one field spanning
|
|
37
|
-
// sidebar + panel) shows through — the shell paints its base beneath it.
|
|
38
|
-
backgroundColor: "transparent"
|
|
39
|
-
},
|
|
40
|
-
headerBar: {
|
|
41
|
-
paddingHorizontal: 12,
|
|
42
|
-
paddingVertical: 8,
|
|
43
|
-
// Clear, like Bench — the host's hoisted sky shows through the header.
|
|
44
|
-
backgroundColor: "transparent",
|
|
45
|
-
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
46
|
-
borderBottomColor: macOSColors.border.default
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
//# sourceMappingURL=ConsoleView.js.map
|
|
1
|
+
"use strict";import p from"react";import{View as e,StyleSheet as t}from"react-native";import{macOSColors as a,windowDragProps as s}from"@buoy-gg/shared-ui";import{ConsoleHeader as i}from"./ConsoleHeader";import{ConsoleBody as l}from"./ConsoleBody";import{useConsoleController as d}from"./useConsoleController";import{jsx as o,jsxs as c}from"react/jsx-runtime";export function ConsoleView(){const r=d();return c(e,{style:n.container,children:[o(e,{style:n.headerBar,...s,children:o(i,{c:r})}),o(l,{c:r})]})}const n=t.create({container:{flex:1,backgroundColor:"transparent"},headerBar:{paddingHorizontal:12,paddingVertical:8,backgroundColor:"transparent",borderBottomWidth:t.hairlineWidth,borderBottomColor:a.border.default}});
|
|
@@ -1,119 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* consoleFilter — port of DevTools `panels/console/ConsoleFilter.ts` plus the
|
|
5
|
-
* `TextUtils.FilterParser` text-filter grammar.
|
|
6
|
-
*
|
|
7
|
-
* - Level mask: 4 levels (verbose/info/warning/error); "Default" = all but verbose.
|
|
8
|
-
* - Text filter: space-separated tokens, AND-combined. Each token may be a plain
|
|
9
|
-
* substring, a `/regex/`, or `key:value` (url/source/context), and a leading
|
|
10
|
-
* `-` negates it. Our captured entries have no url/source/context fields, so
|
|
11
|
-
* keyed tokens degrade to a substring test against the rendered message.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
export const ALL_LEVELS = {
|
|
15
|
-
verbose: true,
|
|
16
|
-
info: true,
|
|
17
|
-
warning: true,
|
|
18
|
-
error: true
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/** "Default levels": everything except Verbose. */
|
|
22
|
-
export const DEFAULT_LEVELS = {
|
|
23
|
-
...ALL_LEVELS,
|
|
24
|
-
verbose: false
|
|
25
|
-
};
|
|
26
|
-
const KEY_VALUE_RE = /^([\w-]+):(.+)$/;
|
|
27
|
-
const REGEXP_RE = /^\/(.+)\/$/;
|
|
28
|
-
|
|
29
|
-
/** Parse a filter query string into AND-combined parsed filters. */
|
|
30
|
-
export function parseFilterQuery(query) {
|
|
31
|
-
const filters = [];
|
|
32
|
-
for (const rawToken of query.split(/\s+/)) {
|
|
33
|
-
if (!rawToken) continue;
|
|
34
|
-
let token = rawToken;
|
|
35
|
-
let negative = false;
|
|
36
|
-
if (token.startsWith("-") && token.length > 1) {
|
|
37
|
-
negative = true;
|
|
38
|
-
token = token.slice(1);
|
|
39
|
-
}
|
|
40
|
-
const kv = token.match(KEY_VALUE_RE);
|
|
41
|
-
if (kv) {
|
|
42
|
-
filters.push({
|
|
43
|
-
key: kv[1].toLowerCase(),
|
|
44
|
-
text: kv[2],
|
|
45
|
-
negative
|
|
46
|
-
});
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
const rx = token.match(REGEXP_RE);
|
|
50
|
-
if (rx) {
|
|
51
|
-
try {
|
|
52
|
-
filters.push({
|
|
53
|
-
regex: new RegExp(rx[1], "im"),
|
|
54
|
-
negative
|
|
55
|
-
});
|
|
56
|
-
continue;
|
|
57
|
-
} catch {
|
|
58
|
-
// Invalid regex falls back to literal text (DevTools does the same).
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
filters.push({
|
|
62
|
-
text: token,
|
|
63
|
-
negative
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
return filters;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/** Does the entry's rendered text contain `text` (case-insensitive)? */
|
|
70
|
-
function textMatches(entry, text) {
|
|
71
|
-
return entry.message.toLowerCase().includes(text.toLowerCase());
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/** Apply the parsed text filters (all must pass). */
|
|
75
|
-
function applyFilters(entry, parsed) {
|
|
76
|
-
for (const filter of parsed) {
|
|
77
|
-
if (filter.regex) {
|
|
78
|
-
if (filter.regex.test(entry.message) === filter.negative) return false;
|
|
79
|
-
} else if (filter.text) {
|
|
80
|
-
// Keyed tokens (url:/source:/context:) degrade to a substring test since
|
|
81
|
-
// captured RN logs carry no such fields.
|
|
82
|
-
if (textMatches(entry, filter.text) === filter.negative) return false;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/** DevTools ConsoleFilter.shouldBeVisible, adapted to our entry model. */
|
|
89
|
-
export function shouldBeVisible(entry, levelsMask, parsed) {
|
|
90
|
-
// Group-end markers are control rows, never filtered out (handled by the view).
|
|
91
|
-
if (entry.method === "groupEnd") return true;
|
|
92
|
-
if (!levelsMask[entry.level]) return false;
|
|
93
|
-
return applyFilters(entry, parsed);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// ─── Level menu summary text (DevTools updateLevelMenuButtonText) ────────────
|
|
97
|
-
|
|
98
|
-
const LEVEL_LABEL = {
|
|
99
|
-
verbose: "Verbose",
|
|
100
|
-
info: "Info",
|
|
101
|
-
warning: "Warnings",
|
|
102
|
-
error: "Errors"
|
|
103
|
-
};
|
|
104
|
-
const LEVEL_ORDER = ["verbose", "info", "warning", "error"];
|
|
105
|
-
function masksEqual(a, b) {
|
|
106
|
-
return LEVEL_ORDER.every(l => a[l] === b[l]);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/** The summary shown on the level menu button. */
|
|
110
|
-
export function levelMenuSummary(mask) {
|
|
111
|
-
if (masksEqual(mask, ALL_LEVELS)) return "All levels";
|
|
112
|
-
if (masksEqual(mask, DEFAULT_LEVELS)) return "Default levels";
|
|
113
|
-
const enabled = LEVEL_ORDER.filter(l => mask[l]);
|
|
114
|
-
if (enabled.length === 0) return "Hide all";
|
|
115
|
-
if (enabled.length === 1) return `${LEVEL_LABEL[enabled[0]]} only`;
|
|
116
|
-
return "Custom levels";
|
|
117
|
-
}
|
|
118
|
-
export { LEVEL_LABEL, LEVEL_ORDER };
|
|
119
|
-
//# sourceMappingURL=consoleFilter.js.map
|
|
1
|
+
"use strict";export const ALL_LEVELS={verbose:true,info:true,warning:true,error:true};export const DEFAULT_LEVELS={...ALL_LEVELS,verbose:false};const a=/^([\w-]+):(.+)$/;const c=/^\/(.+)\/$/;export function parseFilterQuery(e){const t=[];for(const r of e.split(/\s+/)){if(!r)continue;let n=r;let o=false;if(n.startsWith("-")&&n.length>1){o=true;n=n.slice(1)}const s=n.match(a);if(s){t.push({key:s[1].toLowerCase(),text:s[2],negative:o});continue}const u=n.match(c);if(u){try{t.push({regex:new RegExp(u[1],"im"),negative:o});continue}catch{}}t.push({text:n,negative:o})}return t}function E(e,t){return e.message.toLowerCase().includes(t.toLowerCase())}function g(e,t){for(const r of t){if(r.regex){if(r.regex.test(e.message)===r.negative)return false}else if(r.text){if(E(e,r.text)===r.negative)return false}}return true}export function shouldBeVisible(e,t,r){if(e.method==="groupEnd")return true;if(!t[e.level])return false;return g(e,r)}const l={verbose:"Verbose",info:"Info",warning:"Warnings",error:"Errors"};const i=["verbose","info","warning","error"];function f(e,t){return i.every(r=>e[r]===t[r])}export function levelMenuSummary(e){if(f(e,ALL_LEVELS))return"All levels";if(f(e,DEFAULT_LEVELS))return"Default levels";const t=i.filter(r=>e[r]);if(t.length===0)return"Hide all";if(t.length===1)return`${l[t[0]]} only`;return"Custom levels"}export{l as LEVEL_LABEL,i as LEVEL_ORDER};
|