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