@buoy-gg/console 7.0.40 → 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 -65
- 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 -587
- 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 -573
- package/lib/module/store/sanitize.js +1 -77
- package/lib/module/sync/consoleSyncAdapter.js +1 -82
- package/lib/web/index.mjs +17 -0
- package/package.json +39 -5
- 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,309 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* consoleFormat — port of DevTools `panels/console/ConsoleFormat.ts`.
|
|
5
|
-
*
|
|
6
|
-
* Implements the WHATWG console Formatter: %s/%d/%i/%f/%o/%O/%c/%_ substitutions
|
|
7
|
-
* plus ANSI SGR (\x1B[…m) styling. Where DevTools works over V8 RemoteObjects we
|
|
8
|
-
* work over raw JS values; the substitution/ANSI logic is otherwise 1:1.
|
|
9
|
-
*
|
|
10
|
-
* Output is a flat list of tokens the row renderer consumes:
|
|
11
|
-
* - { type: 'string', value, style? } — text, optionally styled by %c / ANSI
|
|
12
|
-
* - { type: 'value', value, mode } — an object/array substitution (%o/%O)
|
|
13
|
-
* or a trailing non-string argument
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import { ansiColors } from "./theme";
|
|
17
|
-
// VGA color palette (matches DevTools ANSI_COLORS / ANSI_BRIGHT_COLORS).
|
|
18
|
-
const ANSI_COLORS = ["black", "red", "green", "yellow", "blue", "magenta", "cyan", "gray"];
|
|
19
|
-
const ANSI_BRIGHT_COLORS = ["darkgray", "lightred", "lightgreen", "lightyellow", "lightblue", "lightmagenta", "lightcyan", "white"];
|
|
20
|
-
|
|
21
|
-
/** A console arg's `description` (string form) — DevTools uses RemoteObject.description. */
|
|
22
|
-
function description(arg) {
|
|
23
|
-
if (typeof arg === "string") return arg;
|
|
24
|
-
if (arg === undefined) return "undefined";
|
|
25
|
-
if (arg === null) return "null";
|
|
26
|
-
if (typeof arg === "number" || typeof arg === "boolean" || typeof arg === "bigint") {
|
|
27
|
-
return String(arg);
|
|
28
|
-
}
|
|
29
|
-
if (arg instanceof Error) return arg.stack ?? `${arg.name}: ${arg.message}`;
|
|
30
|
-
if (typeof arg === "function") return `ƒ ${arg.name || "(anonymous)"}`;
|
|
31
|
-
try {
|
|
32
|
-
return JSON.stringify(arg);
|
|
33
|
-
} catch {
|
|
34
|
-
return String(arg);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// \x1B is the ANSI escape (ESC) — intentional, for parsing color codes.
|
|
39
|
-
// eslint-disable-next-line no-control-regex
|
|
40
|
-
const FORMAT_RE = /%([%_Oocsdfi])|\x1B\[([\d;]*)m/;
|
|
41
|
-
|
|
42
|
-
/** Does the first arg actually need the substitution engine? */
|
|
43
|
-
function hasFormatting(fmt) {
|
|
44
|
-
return FORMAT_RE.test(fmt);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** Convert a CSS declaration string (from %c or ANSI) into an RN TextStyle. */
|
|
48
|
-
function cssToTextStyle(css) {
|
|
49
|
-
const style = {};
|
|
50
|
-
let any = false;
|
|
51
|
-
for (const decl of css.split(";")) {
|
|
52
|
-
const idx = decl.indexOf(":");
|
|
53
|
-
if (idx === -1) continue;
|
|
54
|
-
const prop = decl.slice(0, idx).trim().toLowerCase();
|
|
55
|
-
let value = decl.slice(idx + 1).trim();
|
|
56
|
-
if (!value) continue;
|
|
57
|
-
// Resolve DevTools ANSI color vars to concrete hex.
|
|
58
|
-
const varMatch = value.match(/var\(--console-color-([a-z]+)\)/);
|
|
59
|
-
if (varMatch) value = ansiColors[varMatch[1]] ?? value;
|
|
60
|
-
switch (prop) {
|
|
61
|
-
case "color":
|
|
62
|
-
style.color = value;
|
|
63
|
-
any = true;
|
|
64
|
-
break;
|
|
65
|
-
case "background-color":
|
|
66
|
-
case "background":
|
|
67
|
-
style.backgroundColor = value;
|
|
68
|
-
any = true;
|
|
69
|
-
break;
|
|
70
|
-
case "font-weight":
|
|
71
|
-
style.fontWeight = value === "lighter" ? "300" : value;
|
|
72
|
-
any = true;
|
|
73
|
-
break;
|
|
74
|
-
case "font-style":
|
|
75
|
-
if (value === "italic") {
|
|
76
|
-
style.fontStyle = "italic";
|
|
77
|
-
any = true;
|
|
78
|
-
}
|
|
79
|
-
break;
|
|
80
|
-
case "font-size":
|
|
81
|
-
{
|
|
82
|
-
const n = parseFloat(value);
|
|
83
|
-
if (!Number.isNaN(n)) {
|
|
84
|
-
style.fontSize = n;
|
|
85
|
-
any = true;
|
|
86
|
-
}
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
case "text-decoration":
|
|
90
|
-
case "text-decoration-line":
|
|
91
|
-
if (value.includes("underline") && value.includes("line-through")) {
|
|
92
|
-
style.textDecorationLine = "underline line-through";
|
|
93
|
-
} else if (value.includes("underline")) {
|
|
94
|
-
style.textDecorationLine = "underline";
|
|
95
|
-
} else if (value.includes("line-through")) {
|
|
96
|
-
style.textDecorationLine = "line-through";
|
|
97
|
-
}
|
|
98
|
-
any = true;
|
|
99
|
-
break;
|
|
100
|
-
default:
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return any ? style : undefined;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/** Apply one ANSI SGR sequence to the running style map (DevTools algorithm). */
|
|
108
|
-
function applyAnsi(codes, currentStyle) {
|
|
109
|
-
const addTextDecoration = value => {
|
|
110
|
-
const td = currentStyle.get("text-decoration") ?? "";
|
|
111
|
-
if (!td.includes(value)) currentStyle.set("text-decoration", `${td} ${value}`);
|
|
112
|
-
};
|
|
113
|
-
const removeTextDecoration = value => {
|
|
114
|
-
const td = currentStyle.get("text-decoration")?.replace(` ${value}`, "");
|
|
115
|
-
if (td) currentStyle.set("text-decoration", td);else currentStyle.delete("text-decoration");
|
|
116
|
-
};
|
|
117
|
-
while (codes.length) {
|
|
118
|
-
const code = codes.shift();
|
|
119
|
-
switch (code) {
|
|
120
|
-
case 0:
|
|
121
|
-
currentStyle.clear();
|
|
122
|
-
break;
|
|
123
|
-
case 1:
|
|
124
|
-
currentStyle.set("font-weight", "bold");
|
|
125
|
-
break;
|
|
126
|
-
case 2:
|
|
127
|
-
currentStyle.set("font-weight", "lighter");
|
|
128
|
-
break;
|
|
129
|
-
case 3:
|
|
130
|
-
currentStyle.set("font-style", "italic");
|
|
131
|
-
break;
|
|
132
|
-
case 4:
|
|
133
|
-
addTextDecoration("underline");
|
|
134
|
-
break;
|
|
135
|
-
case 9:
|
|
136
|
-
addTextDecoration("line-through");
|
|
137
|
-
break;
|
|
138
|
-
case 22:
|
|
139
|
-
currentStyle.delete("font-weight");
|
|
140
|
-
break;
|
|
141
|
-
case 23:
|
|
142
|
-
currentStyle.delete("font-style");
|
|
143
|
-
break;
|
|
144
|
-
case 24:
|
|
145
|
-
removeTextDecoration("underline");
|
|
146
|
-
break;
|
|
147
|
-
case 29:
|
|
148
|
-
removeTextDecoration("line-through");
|
|
149
|
-
break;
|
|
150
|
-
case 38:
|
|
151
|
-
case 48:
|
|
152
|
-
if (codes.shift() === 2) {
|
|
153
|
-
const r = codes.shift() ?? 0;
|
|
154
|
-
const g = codes.shift() ?? 0;
|
|
155
|
-
const b = codes.shift() ?? 0;
|
|
156
|
-
currentStyle.set(code === 38 ? "color" : "background-color", `rgb(${r},${g},${b})`);
|
|
157
|
-
}
|
|
158
|
-
break;
|
|
159
|
-
case 39:
|
|
160
|
-
case 49:
|
|
161
|
-
currentStyle.delete(code === 39 ? "color" : "background-color");
|
|
162
|
-
break;
|
|
163
|
-
default:
|
|
164
|
-
{
|
|
165
|
-
const color = ANSI_COLORS[code - 30] ?? ANSI_BRIGHT_COLORS[code - 90];
|
|
166
|
-
if (color !== undefined) {
|
|
167
|
-
currentStyle.set("color", `var(--console-color-${color})`);
|
|
168
|
-
} else {
|
|
169
|
-
const bg = ANSI_COLORS[code - 40] ?? ANSI_BRIGHT_COLORS[code - 100];
|
|
170
|
-
if (bg !== undefined) currentStyle.set("background-color", `var(--console-color-${bg})`);
|
|
171
|
-
}
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/** Run the substitution engine over a format string + its args. */
|
|
179
|
-
function formatWithSubstitutions(fmtIn, args) {
|
|
180
|
-
let fmt = fmtIn;
|
|
181
|
-
const tokens = [];
|
|
182
|
-
const currentStyle = new Map();
|
|
183
|
-
let cssStyle;
|
|
184
|
-
const pushString = value => {
|
|
185
|
-
if (!value) return;
|
|
186
|
-
const last = tokens[tokens.length - 1];
|
|
187
|
-
if (last && last.type === "string" && styleEq(last.style, cssStyle)) {
|
|
188
|
-
last.value += value;
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
tokens.push({
|
|
192
|
-
type: "string",
|
|
193
|
-
value,
|
|
194
|
-
style: cssStyle
|
|
195
|
-
});
|
|
196
|
-
};
|
|
197
|
-
let argIndex = 0;
|
|
198
|
-
for (let match = FORMAT_RE.exec(fmt); match !== null; match = FORMAT_RE.exec(fmt)) {
|
|
199
|
-
pushString(match.input.substring(0, match.index));
|
|
200
|
-
let substitution;
|
|
201
|
-
const specifier = match[1];
|
|
202
|
-
switch (specifier) {
|
|
203
|
-
case "%":
|
|
204
|
-
pushString("%");
|
|
205
|
-
substitution = "";
|
|
206
|
-
break;
|
|
207
|
-
case "s":
|
|
208
|
-
if (argIndex < args.length) substitution = description(args[argIndex++]);
|
|
209
|
-
break;
|
|
210
|
-
case "c":
|
|
211
|
-
if (argIndex < args.length) {
|
|
212
|
-
cssStyle = cssToTextStyle(description(args[argIndex++]));
|
|
213
|
-
substitution = "";
|
|
214
|
-
}
|
|
215
|
-
break;
|
|
216
|
-
case "o":
|
|
217
|
-
case "O":
|
|
218
|
-
if (argIndex < args.length) {
|
|
219
|
-
tokens.push({
|
|
220
|
-
type: "value",
|
|
221
|
-
value: args[argIndex++],
|
|
222
|
-
mode: specifier === "O" ? "generic" : "optimal"
|
|
223
|
-
});
|
|
224
|
-
substitution = "";
|
|
225
|
-
}
|
|
226
|
-
break;
|
|
227
|
-
case "_":
|
|
228
|
-
if (argIndex < args.length) {
|
|
229
|
-
argIndex++;
|
|
230
|
-
substitution = "";
|
|
231
|
-
}
|
|
232
|
-
break;
|
|
233
|
-
case "d":
|
|
234
|
-
case "f":
|
|
235
|
-
case "i":
|
|
236
|
-
{
|
|
237
|
-
if (argIndex < args.length) {
|
|
238
|
-
const v = args[argIndex++];
|
|
239
|
-
let n = typeof v !== "number" ? NaN : v;
|
|
240
|
-
if (specifier !== "f") n = Math.floor(n);
|
|
241
|
-
substitution = n;
|
|
242
|
-
}
|
|
243
|
-
break;
|
|
244
|
-
}
|
|
245
|
-
case undefined:
|
|
246
|
-
{
|
|
247
|
-
const codes = (match[2] || "0").split(";").map(c => c ? parseInt(c, 10) : 0);
|
|
248
|
-
applyAnsi(codes, currentStyle);
|
|
249
|
-
const css = [...currentStyle.entries()].map(([k, val]) => `${k}:${val.trimStart()}`).join(";");
|
|
250
|
-
cssStyle = cssToTextStyle(css);
|
|
251
|
-
substitution = "";
|
|
252
|
-
break;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
if (substitution === undefined) {
|
|
256
|
-
pushString(match[0]);
|
|
257
|
-
substitution = "";
|
|
258
|
-
}
|
|
259
|
-
fmt = substitution + match.input.substring(match.index + match[0].length);
|
|
260
|
-
}
|
|
261
|
-
pushString(fmt);
|
|
262
|
-
return {
|
|
263
|
-
tokens,
|
|
264
|
-
rest: args.slice(argIndex)
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
function styleEq(a, b) {
|
|
268
|
-
if (a === b) return true;
|
|
269
|
-
if (!a || !b) return false;
|
|
270
|
-
return JSON.stringify(a) === JSON.stringify(b);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* Format a console call's arguments into renderable tokens, mirroring how the
|
|
275
|
-
* DevTools console renders a message: if the first arg is a format string it
|
|
276
|
-
* drives substitution, then any leftover args are appended (space-separated).
|
|
277
|
-
*/
|
|
278
|
-
export function formatConsoleMessage(args) {
|
|
279
|
-
if (args.length === 0) return [];
|
|
280
|
-
let tokens = [];
|
|
281
|
-
let rest = args;
|
|
282
|
-
if (typeof args[0] === "string" && hasFormatting(args[0])) {
|
|
283
|
-
const result = formatWithSubstitutions(args[0], args.slice(1));
|
|
284
|
-
tokens = result.tokens;
|
|
285
|
-
rest = result.rest;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// Append remaining args (the common case: console.log("x", obj, 1)).
|
|
289
|
-
for (const arg of rest) {
|
|
290
|
-
if (tokens.length > 0) tokens.push({
|
|
291
|
-
type: "string",
|
|
292
|
-
value: " "
|
|
293
|
-
});
|
|
294
|
-
if (typeof arg === "string") {
|
|
295
|
-
tokens.push({
|
|
296
|
-
type: "string",
|
|
297
|
-
value: arg
|
|
298
|
-
});
|
|
299
|
-
} else {
|
|
300
|
-
tokens.push({
|
|
301
|
-
type: "value",
|
|
302
|
-
value: arg,
|
|
303
|
-
mode: "optimal"
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
return tokens;
|
|
308
|
-
}
|
|
309
|
-
//# sourceMappingURL=consoleFormat.js.map
|
|
1
|
+
"use strict";import{ansiColors as x}from"./theme";const p=["black","red","green","yellow","blue","magenta","cyan","gray"];const g=["darkgray","lightred","lightgreen","lightyellow","lightblue","lightmagenta","lightcyan","white"];function k(t){if(typeof t==="string")return t;if(t===void 0)return"undefined";if(t===null)return"null";if(typeof t==="number"||typeof t==="boolean"||typeof t==="bigint"){return String(t)}if(t instanceof Error)return t.stack??`${t.name}: ${t.message}`;if(typeof t==="function")return`\u0192 ${t.name||"(anonymous)"}`;try{return JSON.stringify(t)}catch{return String(t)}}const b=/%([%_Oocsdfi])|\x1B\[([\d;]*)m/;function w(t){return b.test(t)}function m(t){const e={};let s=false;for(const i of t.split(";")){const o=i.indexOf(":");if(o===-1)continue;const r=i.slice(0,o).trim().toLowerCase();let n=i.slice(o+1).trim();if(!n)continue;const l=n.match(/var\(--console-color-([a-z]+)\)/);if(l)n=x[l[1]]??n;switch(r){case"color":e.color=n;s=true;break;case"background-color":case"background":e.backgroundColor=n;s=true;break;case"font-weight":e.fontWeight=n==="lighter"?"300":n;s=true;break;case"font-style":if(n==="italic"){e.fontStyle="italic";s=true}break;case"font-size":{const c=parseFloat(n);if(!Number.isNaN(c)){e.fontSize=c;s=true}break}case"text-decoration":case"text-decoration-line":if(n.includes("underline")&&n.includes("line-through")){e.textDecorationLine="underline line-through"}else if(n.includes("underline")){e.textDecorationLine="underline"}else if(n.includes("line-through")){e.textDecorationLine="line-through"}s=true;break;default:break}}return s?e:void 0}function $(t,e){const s=o=>{const r=e.get("text-decoration")??"";if(!r.includes(o))e.set("text-decoration",`${r} ${o}`)};const i=o=>{const r=e.get("text-decoration")?.replace(` ${o}`,"");if(r)e.set("text-decoration",r);else e.delete("text-decoration")};while(t.length){const o=t.shift();switch(o){case 0:e.clear();break;case 1:e.set("font-weight","bold");break;case 2:e.set("font-weight","lighter");break;case 3:e.set("font-style","italic");break;case 4:s("underline");break;case 9:s("line-through");break;case 22:e.delete("font-weight");break;case 23:e.delete("font-style");break;case 24:i("underline");break;case 29:i("line-through");break;case 38:case 48:if(t.shift()===2){const r=t.shift()??0;const n=t.shift()??0;const l=t.shift()??0;e.set(o===38?"color":"background-color",`rgb(${r},${n},${l})`)}break;case 39:case 49:e.delete(o===39?"color":"background-color");break;default:{const r=p[o-30]??g[o-90];if(r!==void 0){e.set("color",`var(--console-color-${r})`)}else{const n=p[o-40]??g[o-100];if(n!==void 0)e.set("background-color",`var(--console-color-${n})`)}break}}}}function O(t,e){let s=t;const i=[];const o=new Map;let r;const n=c=>{if(!c)return;const a=i[i.length-1];if(a&&a.type==="string"&&v(a.style,r)){a.value+=c;return}i.push({type:"string",value:c,style:r})};let l=0;for(let c=b.exec(s);c!==null;c=b.exec(s)){n(c.input.substring(0,c.index));let a;const h=c[1];switch(h){case"%":n("%");a="";break;case"s":if(l<e.length)a=k(e[l++]);break;case"c":if(l<e.length){r=m(k(e[l++]));a=""}break;case"o":case"O":if(l<e.length){i.push({type:"value",value:e[l++],mode:h==="O"?"generic":"optimal"});a=""}break;case"_":if(l<e.length){l++;a=""}break;case"d":case"f":case"i":{if(l<e.length){const u=e[l++];let f=typeof u!=="number"?NaN:u;if(h!=="f")f=Math.floor(f);a=f}break}case void 0:{const u=(c[2]||"0").split(";").map(d=>d?parseInt(d,10):0);$(u,o);const f=[...o.entries()].map(([d,y])=>`${d}:${y.trimStart()}`).join(";");r=m(f);a="";break}}if(a===void 0){n(c[0]);a=""}s=a+c.input.substring(c.index+c[0].length)}n(s);return{tokens:i,rest:e.slice(l)}}function v(t,e){if(t===e)return true;if(!t||!e)return false;return JSON.stringify(t)===JSON.stringify(e)}export function formatConsoleMessage(t){if(t.length===0)return[];let e=[];let s=t;if(typeof t[0]==="string"&&w(t[0])){const i=O(t[0],t.slice(1));e=i.tokens;s=i.rest}for(const i of s){if(e.length>0)e.push({type:"string",value:" "});if(typeof i==="string"){e.push({type:"string",value:i})}else{e.push({type:"value",value:i,mode:"optimal"})}}return e}
|
|
@@ -1,183 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* origin — attributes a console call to *where it came from*, and provides the
|
|
5
|
-
* lnav-style colored connecting bracket helpers.
|
|
6
|
-
*
|
|
7
|
-
* Three independent signals (captured in the store at log time):
|
|
8
|
-
* - **component** — nearest owning React component (React.captureOwnerStack,
|
|
9
|
-
* dev only; null outside render / in async callbacks)
|
|
10
|
-
* - **function** — the enclosing function of the call site (JS stack)
|
|
11
|
-
* - **callSite** — the exact `file:line` of the call site (JS stack)
|
|
12
|
-
*
|
|
13
|
-
* The view groups consecutive same-source rows and draws a colored bracket
|
|
14
|
-
* gutter (┌ │ └ ─) exactly like lnav's per-file gutter.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Our own capture frames, matched by FUNCTION NAME. This is the primary filter:
|
|
19
|
-
* in a Metro/Hermes bundle every frame shares one bundle URL, so filename
|
|
20
|
-
* filtering can't distinguish them — and that URL often contains `node_modules`
|
|
21
|
-
* (e.g. expo-router/entry.bundle), which would wrongly reject *every* frame.
|
|
22
|
-
* The first frame after these is the real caller (framework internals sit
|
|
23
|
-
* deeper in the stack, after the app frame).
|
|
24
|
-
*/
|
|
25
|
-
const INTERNAL_FUNC = /^(buoyConsoleProxy|record|cleanStack|captureOwnerStack|formatArgs|formatArg)$/;
|
|
26
|
-
|
|
27
|
-
/** Narrow filename guard — only our own module (used when stacks carry real
|
|
28
|
-
* file paths, e.g. on web/V8 rather than a single Hermes bundle). */
|
|
29
|
-
const INTERNAL_FILE = /consoleLogStore/;
|
|
30
|
-
function isInternalFrame(frame) {
|
|
31
|
-
if (frame.func && INTERNAL_FUNC.test(frame.func.replace(/^Object\./, ""))) {
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
return Boolean(frame.file && INTERNAL_FILE.test(frame.file));
|
|
35
|
-
}
|
|
36
|
-
/** Parse a V8 or Hermes stack string into frames. */
|
|
37
|
-
function parseFrames(stack) {
|
|
38
|
-
const frames = [];
|
|
39
|
-
for (const raw of stack.split("\n")) {
|
|
40
|
-
const line = raw.trim();
|
|
41
|
-
if (!line || line === "Error") continue;
|
|
42
|
-
// V8: "at func (file:line:col)"
|
|
43
|
-
let m = line.match(/^at\s+(.+?)\s+\((.+?):(\d+):(\d+)\)$/);
|
|
44
|
-
if (m) {
|
|
45
|
-
frames.push({
|
|
46
|
-
func: m[1],
|
|
47
|
-
file: m[2],
|
|
48
|
-
line: Number(m[3])
|
|
49
|
-
});
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
// V8: "at file:line:col"
|
|
53
|
-
m = line.match(/^at\s+(.+?):(\d+):(\d+)$/);
|
|
54
|
-
if (m) {
|
|
55
|
-
frames.push({
|
|
56
|
-
file: m[1],
|
|
57
|
-
line: Number(m[2])
|
|
58
|
-
});
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
// Hermes: "func@file:line:col"
|
|
62
|
-
m = line.match(/^(.*?)@(.+?):(\d+):(\d+)$/);
|
|
63
|
-
if (m) {
|
|
64
|
-
frames.push({
|
|
65
|
-
func: m[1] || undefined,
|
|
66
|
-
file: m[2],
|
|
67
|
-
line: Number(m[3])
|
|
68
|
-
});
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return frames;
|
|
73
|
-
}
|
|
74
|
-
function basename(file) {
|
|
75
|
-
if (!file) return undefined;
|
|
76
|
-
const noQuery = file.split("?")[0];
|
|
77
|
-
return noQuery.split("/").pop() || noQuery;
|
|
78
|
-
}
|
|
79
|
-
function cleanFunctionName(func) {
|
|
80
|
-
if (!func) return undefined;
|
|
81
|
-
const f = func.replace(/^Object\./, "").trim();
|
|
82
|
-
if (!f || f === "<anonymous>" || f === "anonymous") return undefined;
|
|
83
|
-
return f;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/** First component name from a React owner stack (nearest owner). */
|
|
87
|
-
function firstComponent(ownerStack) {
|
|
88
|
-
if (!ownerStack) return undefined;
|
|
89
|
-
for (const raw of ownerStack.split("\n")) {
|
|
90
|
-
const m = raw.trim().match(/^at\s+([A-Za-z_$][\w$]*)/);
|
|
91
|
-
if (m) return m[1];
|
|
92
|
-
}
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/** Derive the origin of a log from its captured JS stack + React owner stack. */
|
|
97
|
-
export function parseOrigin(stack, ownerStack) {
|
|
98
|
-
const component = firstComponent(ownerStack);
|
|
99
|
-
let appFrame;
|
|
100
|
-
if (stack) {
|
|
101
|
-
const frames = parseFrames(stack);
|
|
102
|
-
appFrame = frames.find(f => !isInternalFrame(f));
|
|
103
|
-
}
|
|
104
|
-
const functionName = cleanFunctionName(appFrame?.func);
|
|
105
|
-
const file = basename(appFrame?.file);
|
|
106
|
-
const line = appFrame?.line;
|
|
107
|
-
const callSite = file && line != null ? `${file}:${line}` : undefined;
|
|
108
|
-
if (!component && !functionName && !callSite) return undefined;
|
|
109
|
-
return {
|
|
110
|
-
component,
|
|
111
|
-
functionName,
|
|
112
|
-
callSite,
|
|
113
|
-
file,
|
|
114
|
-
line
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// ─── Grouping by dimension ───────────────────────────────────────────────────
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Stable key used to group consecutive rows (null = ungrouped).
|
|
122
|
-
*
|
|
123
|
-
* Each dimension falls back to the next-best signal so a row is never lumped
|
|
124
|
-
* into a single catch-all bucket: a handler-fired log (no React owner) still
|
|
125
|
-
* differentiates by its function / call site under "Component".
|
|
126
|
-
*/
|
|
127
|
-
export function sourceKey(origin, dim) {
|
|
128
|
-
if (dim === "off" || !origin) return dim === "off" ? null : "—unknown—";
|
|
129
|
-
if (dim === "component") {
|
|
130
|
-
return origin.component ?? origin.functionName ?? origin.callSite ?? "—unknown—";
|
|
131
|
-
}
|
|
132
|
-
if (dim === "function") {
|
|
133
|
-
return origin.functionName ?? origin.callSite ?? origin.component ?? "—anonymous—";
|
|
134
|
-
}
|
|
135
|
-
return origin.callSite ?? origin.functionName ?? "—unknown—";
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/** Human label shown next to the row. */
|
|
139
|
-
export function sourceLabel(origin, dim) {
|
|
140
|
-
if (!origin) return "(unknown)";
|
|
141
|
-
if (dim === "component") {
|
|
142
|
-
if (origin.component) return origin.component;
|
|
143
|
-
if (origin.functionName) return `ƒ ${origin.functionName}`;
|
|
144
|
-
return origin.callSite ?? "(unknown)";
|
|
145
|
-
}
|
|
146
|
-
if (dim === "function") {
|
|
147
|
-
if (origin.functionName) return origin.functionName;
|
|
148
|
-
return origin.callSite ?? "(anonymous)";
|
|
149
|
-
}
|
|
150
|
-
if (dim === "callsite") {
|
|
151
|
-
if (origin.functionName && origin.callSite) return `${origin.functionName} · ${origin.callSite}`;
|
|
152
|
-
return origin.callSite ?? (origin.functionName ? `ƒ ${origin.functionName}` : "(unknown)");
|
|
153
|
-
}
|
|
154
|
-
return "";
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// ─── Color + bracket ─────────────────────────────────────────────────────────
|
|
158
|
-
|
|
159
|
-
function hashString(s) {
|
|
160
|
-
let h = 0;
|
|
161
|
-
for (let i = 0; i < s.length; i++) h = h * 31 + s.charCodeAt(i) | 0;
|
|
162
|
-
return Math.abs(h);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/** Stable, readable color for a source key (bright enough for a dark surface). */
|
|
166
|
-
export function colorForKey(key) {
|
|
167
|
-
const hue = hashString(key) % 360;
|
|
168
|
-
return `hsl(${hue}, 70%, 66%)`;
|
|
169
|
-
}
|
|
170
|
-
/** lnav gutter glyph: ┌ run-start · │ run-middle · └ run-end · ─ single. */
|
|
171
|
-
export function bracketGlyph(bracket) {
|
|
172
|
-
switch (bracket) {
|
|
173
|
-
case "top":
|
|
174
|
-
return "┌";
|
|
175
|
-
case "bottom":
|
|
176
|
-
return "└";
|
|
177
|
-
case "single":
|
|
178
|
-
return "─";
|
|
179
|
-
default:
|
|
180
|
-
return "│";
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
//# sourceMappingURL=origin.js.map
|
|
1
|
+
"use strict";const s=/^(buoyConsoleProxy|record|cleanStack|captureOwnerStack|formatArgs|formatArg)$/;const i=/consoleLogStore/;function m(n){if(n.func&&s.test(n.func.replace(/^Object\./,""))){return true}return Boolean(n.file&&i.test(n.file))}function p(n){const e=[];for(const u of n.split("\n")){const c=u.trim();if(!c||c==="Error")continue;let t=c.match(/^at\s+(.+?)\s+\((.+?):(\d+):(\d+)\)$/);if(t){e.push({func:t[1],file:t[2],line:Number(t[3])});continue}t=c.match(/^at\s+(.+?):(\d+):(\d+)$/);if(t){e.push({file:t[1],line:Number(t[2])});continue}t=c.match(/^(.*?)@(.+?):(\d+):(\d+)$/);if(t){e.push({func:t[1]||void 0,file:t[2],line:Number(t[3])});continue}}return e}function d(n){if(!n)return void 0;const e=n.split("?")[0];return e.split("/").pop()||e}function N(n){if(!n)return void 0;const e=n.replace(/^Object\./,"").trim();if(!e||e==="<anonymous>"||e==="anonymous")return void 0;return e}function h(n){if(!n)return void 0;for(const e of n.split("\n")){const u=e.trim().match(/^at\s+([A-Za-z_$][\w$]*)/);if(u)return u[1]}return void 0}export function parseOrigin(n,e){const u=h(e);let c;if(n){const a=p(n);c=a.find(l=>!m(l))}const t=N(c?.func);const o=d(c?.file);const r=c?.line;const f=o&&r!=null?`${o}:${r}`:void 0;if(!u&&!t&&!f)return void 0;return{component:u,functionName:t,callSite:f,file:o,line:r}}export function sourceKey(n,e){if(e==="off"||!n)return e==="off"?null:"\u2014unknown\u2014";if(e==="component"){return n.component??n.functionName??n.callSite??"\u2014unknown\u2014"}if(e==="function"){return n.functionName??n.callSite??n.component??"\u2014anonymous\u2014"}return n.callSite??n.functionName??"\u2014unknown\u2014"}export function sourceLabel(n,e){if(!n)return"(unknown)";if(e==="component"){if(n.component)return n.component;if(n.functionName)return`\u0192 ${n.functionName}`;return n.callSite??"(unknown)"}if(e==="function"){if(n.functionName)return n.functionName;return n.callSite??"(anonymous)"}if(e==="callsite"){if(n.functionName&&n.callSite)return`${n.functionName} \xB7 ${n.callSite}`;return n.callSite??(n.functionName?`\u0192 ${n.functionName}`:"(unknown)")}return""}function $(n){let e=0;for(let u=0;u<n.length;u++)e=e*31+n.charCodeAt(u)|0;return Math.abs(e)}export function colorForKey(n){const e=$(n)%360;return`hsl(${e}, 70%, 66%)`}export function bracketGlyph(n){switch(n){case"top":return"\u250C";case"bottom":return"\u2514";case"single":return"\u2500";default:return"\u2502"}}
|
|
@@ -1,143 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Console palette — a dark theme whose CHROME entries (surfaces, dividers,
|
|
5
|
-
* default/secondary text) come from Buoy's `night` tokens so the console reads
|
|
6
|
-
* as part of the night suite, while the Chrome-DevTools DATA colours (level
|
|
7
|
-
* rows, value types, links, ANSI) stay classic — they tell the user something
|
|
8
|
-
* about the logged data.
|
|
9
|
-
* `lightTheme` below holds the exact DevTools light tokens and `consoleTheme`
|
|
10
|
-
* picks between the two from the host app's surface. Every shipped theme is
|
|
11
|
-
* dark today, so the light branch is currently unreachable — it is kept because
|
|
12
|
-
* the probe is what makes this correct if a light surface ever returns.
|
|
13
|
-
*
|
|
14
|
-
* Not themed: `ansiColors` below is the dark-theme ANSI palette, so ANSI
|
|
15
|
-
* escape sequences in captured output keep their dark-console colours.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
import { monoFont, night } from "@buoy-gg/shared-ui";
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Monospace font — re-exported from shared-ui so the console keeps its import
|
|
22
|
-
* site. The per-platform choice (Menlo on iOS, the curated stack on web) lives
|
|
23
|
-
* in `packages/shared/src/ui/fonts.ts`.
|
|
24
|
-
*/
|
|
25
|
-
export { monoFont };
|
|
26
|
-
/** Resolved DevTools light-theme tokens. Unreachable today — see the header. */
|
|
27
|
-
export const lightTheme = {
|
|
28
|
-
baseContainer: "#ffffff",
|
|
29
|
-
// --sys-color-cdt-base-container (neutral99 ≈ white)
|
|
30
|
-
surfaceError: "#fceaea",
|
|
31
|
-
// --sys-color-surface-error rgb(252 235 235)
|
|
32
|
-
surfaceYellow: "#fef6d5",
|
|
33
|
-
// --sys-color-surface-yellow rgb(254 246 213)
|
|
34
|
-
divider: "#e8eaed",
|
|
35
|
-
// --sys-color-divider (primary90, lightened for contrast)
|
|
36
|
-
inputBackground: "#f1f3f4",
|
|
37
|
-
menuBackground: "#ffffff",
|
|
38
|
-
onSurface: "#1f1f1f",
|
|
39
|
-
// neutral10
|
|
40
|
-
onSurfaceYellow: "#3e2f00",
|
|
41
|
-
// yellow20
|
|
42
|
-
onErrorContainer: "#410e0b",
|
|
43
|
-
// error10
|
|
44
|
-
tokenSubtle: "#757575",
|
|
45
|
-
// neutral50
|
|
46
|
-
primary: "#0b57d0",
|
|
47
|
-
// primary40 (links)
|
|
48
|
-
valueNumber: "#0842a0",
|
|
49
|
-
// token-attribute-value (blue30)
|
|
50
|
-
valueString: "#c5221f",
|
|
51
|
-
// token-property-special (error50, slightly deepened)
|
|
52
|
-
valueBigint: "#146c2e",
|
|
53
|
-
// token-comment (green40)
|
|
54
|
-
valueNode: "#1f1f1f",
|
|
55
|
-
// token-variable (= on-surface)
|
|
56
|
-
valueNullish: "rgba(31,31,31,0.5)",
|
|
57
|
-
// state-disabled
|
|
58
|
-
valuePreview: "rgba(31,31,31,0.62)"
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
/** Dark theme (active) — night chrome, classic DevTools data colours. */
|
|
62
|
-
export const darkTheme = {
|
|
63
|
-
baseContainer: "#0A0A0C",
|
|
64
|
-
// desktop inline shell base (modal path is transparent)
|
|
65
|
-
surfaceError: "rgba(255,69,58,0.15)",
|
|
66
|
-
// semantic.errorBackground
|
|
67
|
-
surfaceYellow: "rgba(255,235,59,0.13)",
|
|
68
|
-
// semantic.warningBackground
|
|
69
|
-
divider: night.color.fillTertiary,
|
|
70
|
-
// row hairlines + nesting guides (strong enough to stay visible)
|
|
71
|
-
inputBackground: night.color.surfaceElevated,
|
|
72
|
-
menuBackground: night.color.surface,
|
|
73
|
-
onSurface: night.color.text,
|
|
74
|
-
onSurfaceYellow: "#FFE9A3",
|
|
75
|
-
// light warm yellow on dark warning row
|
|
76
|
-
onErrorContainer: "#FFB4AB",
|
|
77
|
-
// light red on dark error row
|
|
78
|
-
tokenSubtle: night.color.textSecondary,
|
|
79
|
-
// timestamps, previews
|
|
80
|
-
primary: "#40CCFF",
|
|
81
|
-
// semantic.infoLight (links, ~9:1)
|
|
82
|
-
valueNumber: "#FF9F1C",
|
|
83
|
-
// orange (number + boolean)
|
|
84
|
-
valueString: "#7EE787",
|
|
85
|
-
// green (string/regexp/symbol)
|
|
86
|
-
valueBigint: "#A1A1A6",
|
|
87
|
-
// muted (bigint)
|
|
88
|
-
valueNode: "#F5F5F7",
|
|
89
|
-
// default text (DOM node / variable)
|
|
90
|
-
valueNullish: "#8E8E93",
|
|
91
|
-
// text.muted (null/undefined)
|
|
92
|
-
valuePreview: "#A1A1A6" // object preview (italic)
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* The active console palette.
|
|
97
|
-
*
|
|
98
|
-
* `darkTheme`, always. `macOSColors` is the dark palette on every surface Buoy
|
|
99
|
-
* renders on, so there is nothing to pick between — this used to probe the host
|
|
100
|
-
* surface's luminance for a light dashboard theme that no longer exists.
|
|
101
|
-
* `lightTheme` above is kept because it is the real Chrome DevTools light token
|
|
102
|
-
* set and predates that experiment; swap it in here if a light surface returns.
|
|
103
|
-
*/
|
|
104
|
-
export const consoleTheme = darkTheme;
|
|
105
|
-
|
|
106
|
-
/** ANSI 16-color palette (dark theme), from consoleView.css `--console-color-*`. */
|
|
107
|
-
export const ansiColors = {
|
|
108
|
-
black: "#000",
|
|
109
|
-
red: "rgb(237 78 76)",
|
|
110
|
-
green: "rgb(1 200 1)",
|
|
111
|
-
yellow: "rgb(210 192 87)",
|
|
112
|
-
blue: "rgb(39 116 240)",
|
|
113
|
-
magenta: "rgb(161 66 244)",
|
|
114
|
-
cyan: "rgb(18 181 203)",
|
|
115
|
-
gray: "rgb(207 208 208)",
|
|
116
|
-
darkgray: "rgb(137 137 137)",
|
|
117
|
-
lightred: "rgb(242 139 130)",
|
|
118
|
-
lightgreen: "rgb(161 247 181)",
|
|
119
|
-
lightyellow: "rgb(221 251 85)",
|
|
120
|
-
lightblue: "rgb(102 157 246)",
|
|
121
|
-
lightmagenta: "rgb(214 112 214)",
|
|
122
|
-
lightcyan: "rgb(132 240 255)",
|
|
123
|
-
white: "#fff"
|
|
124
|
-
};
|
|
125
|
-
export const levelStyles = {
|
|
126
|
-
verbose: {
|
|
127
|
-
text: consoleTheme.tokenSubtle
|
|
128
|
-
},
|
|
129
|
-
info: {
|
|
130
|
-
text: consoleTheme.onSurface
|
|
131
|
-
},
|
|
132
|
-
warning: {
|
|
133
|
-
background: consoleTheme.surfaceYellow,
|
|
134
|
-
text: consoleTheme.onSurfaceYellow,
|
|
135
|
-
icon: "warning"
|
|
136
|
-
},
|
|
137
|
-
error: {
|
|
138
|
-
background: consoleTheme.surfaceError,
|
|
139
|
-
text: consoleTheme.onErrorContainer,
|
|
140
|
-
icon: "error"
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
//# sourceMappingURL=theme.js.map
|
|
1
|
+
"use strict";import{monoFont as r,night as e}from"@buoy-gg/shared-ui";export{r as monoFont};export const lightTheme={baseContainer:"#ffffff",surfaceError:"#fceaea",surfaceYellow:"#fef6d5",divider:"#e8eaed",inputBackground:"#f1f3f4",menuBackground:"#ffffff",onSurface:"#1f1f1f",onSurfaceYellow:"#3e2f00",onErrorContainer:"#410e0b",tokenSubtle:"#757575",primary:"#0b57d0",valueNumber:"#0842a0",valueString:"#c5221f",valueBigint:"#146c2e",valueNode:"#1f1f1f",valueNullish:"rgba(31,31,31,0.5)",valuePreview:"rgba(31,31,31,0.62)"};export const darkTheme={baseContainer:"#0A0A0C",surfaceError:"rgba(255,69,58,0.15)",surfaceYellow:"rgba(255,235,59,0.13)",divider:e.color.fillTertiary,inputBackground:e.color.surfaceElevated,menuBackground:e.color.surface,onSurface:e.color.text,onSurfaceYellow:"#FFE9A3",onErrorContainer:"#FFB4AB",tokenSubtle:e.color.textSecondary,primary:"#40CCFF",valueNumber:"#FF9F1C",valueString:"#7EE787",valueBigint:"#A1A1A6",valueNode:"#F5F5F7",valueNullish:"#8E8E93",valuePreview:"#A1A1A6"};export const consoleTheme=darkTheme;export const ansiColors={black:"#000",red:"rgb(237 78 76)",green:"rgb(1 200 1)",yellow:"rgb(210 192 87)",blue:"rgb(39 116 240)",magenta:"rgb(161 66 244)",cyan:"rgb(18 181 203)",gray:"rgb(207 208 208)",darkgray:"rgb(137 137 137)",lightred:"rgb(242 139 130)",lightgreen:"rgb(161 247 181)",lightyellow:"rgb(221 251 85)",lightblue:"rgb(102 157 246)",lightmagenta:"rgb(214 112 214)",lightcyan:"rgb(132 240 255)",white:"#fff"};export const levelStyles={verbose:{text:consoleTheme.tokenSubtle},info:{text:consoleTheme.onSurface},warning:{background:consoleTheme.surfaceYellow,text:consoleTheme.onSurfaceYellow,icon:"warning"},error:{background:consoleTheme.surfaceError,text:consoleTheme.onErrorContainer,icon:"error"}};
|