devlog-ui 0.1.0 → 0.1.2
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 +1 -1
- package/dist/index.cjs +66 -24
- package/dist/index.js +199 -157
- package/dist/noop.cjs +0 -1
- package/dist/noop.js +0 -1
- package/package.json +4 -4
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/noop.cjs.map +0 -1
- package/dist/noop.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -22,16 +22,16 @@ function F(t, e) {
|
|
|
22
22
|
}
|
|
23
23
|
return !1;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function le(t) {
|
|
26
26
|
if (t === void 0) return "undefined";
|
|
27
27
|
if (t === null) return "null";
|
|
28
28
|
if (typeof t == "string") return `"${t}"`;
|
|
29
29
|
if (typeof t == "number" || typeof t == "boolean") return String(t);
|
|
30
30
|
if (Array.isArray(t))
|
|
31
|
-
return t.length === 0 ? "[]" : t.length <= 3 ? `[${t.map(
|
|
31
|
+
return t.length === 0 ? "[]" : t.length <= 3 ? `[${t.map(le).join(", ")}]` : `[${t.length} items]`;
|
|
32
32
|
if (w(t)) {
|
|
33
33
|
const e = Object.keys(t);
|
|
34
|
-
return e.length === 0 ? "{}" : e.length <= 2 ? `{${e.map((n) => `${n}: ${
|
|
34
|
+
return e.length === 0 ? "{}" : e.length <= 2 ? `{${e.map((n) => `${n}: ${le(t[n])}`).join(", ")}}` : `{${e.length} keys}`;
|
|
35
35
|
}
|
|
36
36
|
return String(t);
|
|
37
37
|
}
|
|
@@ -65,40 +65,40 @@ function ve(t, e, n = "", o = !1) {
|
|
|
65
65
|
}), r;
|
|
66
66
|
const s = /* @__PURE__ */ new Set([...Object.keys(t), ...Object.keys(e)]);
|
|
67
67
|
for (const c of s) {
|
|
68
|
-
const
|
|
69
|
-
!
|
|
70
|
-
path:
|
|
68
|
+
const a = n ? `${n}.${c}` : c, l = t[c], d = e[c], u = c in t, h = c in e;
|
|
69
|
+
!u && h ? r.push({
|
|
70
|
+
path: a,
|
|
71
71
|
type: "added",
|
|
72
72
|
newValue: d
|
|
73
|
-
}) :
|
|
74
|
-
path:
|
|
73
|
+
}) : u && !h ? r.push({
|
|
74
|
+
path: a,
|
|
75
75
|
type: "removed",
|
|
76
|
-
oldValue:
|
|
77
|
-
}) : w(
|
|
78
|
-
path:
|
|
76
|
+
oldValue: l
|
|
77
|
+
}) : w(l) && w(d) ? r.push(...ve(l, d, a, o)) : Array.isArray(l) && Array.isArray(d) ? F(l, d) ? o && r.push({
|
|
78
|
+
path: a,
|
|
79
79
|
type: "unchanged",
|
|
80
|
-
oldValue:
|
|
80
|
+
oldValue: l,
|
|
81
81
|
newValue: d
|
|
82
82
|
}) : r.push({
|
|
83
|
-
path:
|
|
83
|
+
path: a,
|
|
84
84
|
type: "changed",
|
|
85
|
-
oldValue:
|
|
85
|
+
oldValue: l,
|
|
86
86
|
newValue: d
|
|
87
|
-
}) : F(
|
|
88
|
-
path:
|
|
87
|
+
}) : F(l, d) ? o && r.push({
|
|
88
|
+
path: a,
|
|
89
89
|
type: "unchanged",
|
|
90
|
-
oldValue:
|
|
90
|
+
oldValue: l,
|
|
91
91
|
newValue: d
|
|
92
92
|
}) : r.push({
|
|
93
|
-
path:
|
|
93
|
+
path: a,
|
|
94
94
|
type: "changed",
|
|
95
|
-
oldValue:
|
|
95
|
+
oldValue: l,
|
|
96
96
|
newValue: d
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
return r;
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function ae(t, e) {
|
|
102
102
|
const n = ve(t, e, "", !1), o = {
|
|
103
103
|
added: 0,
|
|
104
104
|
removed: 0,
|
|
@@ -113,7 +113,7 @@ function Ft(t) {
|
|
|
113
113
|
return t.summary.added > 0 || t.summary.removed > 0 || t.summary.changed > 0;
|
|
114
114
|
}
|
|
115
115
|
const Fe = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 };
|
|
116
|
-
function
|
|
116
|
+
function Ae() {
|
|
117
117
|
try {
|
|
118
118
|
if (typeof import.meta < "u" && Fe)
|
|
119
119
|
return !1;
|
|
@@ -129,11 +129,11 @@ function Oe() {
|
|
|
129
129
|
return !0;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
const
|
|
132
|
+
const Oe = {
|
|
133
133
|
maxLogs: 1e3,
|
|
134
134
|
persist: !1,
|
|
135
135
|
minLevel: "debug",
|
|
136
|
-
enabled:
|
|
136
|
+
enabled: Ae()
|
|
137
137
|
};
|
|
138
138
|
function He() {
|
|
139
139
|
const t = "devlogger_session_id";
|
|
@@ -286,7 +286,7 @@ class Pe {
|
|
|
286
286
|
p(this, "spans", /* @__PURE__ */ new Map());
|
|
287
287
|
p(this, "subscribers", /* @__PURE__ */ new Set());
|
|
288
288
|
p(this, "spanSubscribers", /* @__PURE__ */ new Set());
|
|
289
|
-
p(this, "config", { ...
|
|
289
|
+
p(this, "config", { ...Oe });
|
|
290
290
|
p(this, "sessionId");
|
|
291
291
|
p(this, "globalContext", {});
|
|
292
292
|
this.sessionId = He();
|
|
@@ -298,7 +298,7 @@ class Pe {
|
|
|
298
298
|
try {
|
|
299
299
|
if (!this.config.enabled || se[e] < se[this.config.minLevel])
|
|
300
300
|
return;
|
|
301
|
-
const c = Object.keys(this.globalContext).length > 0 || r ? { ...this.globalContext, ...r } : void 0,
|
|
301
|
+
const c = Object.keys(this.globalContext).length > 0 || r ? { ...this.globalContext, ...r } : void 0, a = {
|
|
302
302
|
id: ze(),
|
|
303
303
|
timestamp: Date.now(),
|
|
304
304
|
level: e,
|
|
@@ -309,7 +309,7 @@ class Pe {
|
|
|
309
309
|
context: c,
|
|
310
310
|
spanId: s
|
|
311
311
|
};
|
|
312
|
-
this.store(
|
|
312
|
+
this.store(a), this.notify(a);
|
|
313
313
|
} catch (c) {
|
|
314
314
|
typeof console < "u" && console.warn && console.warn("[DevLogger] Internal error:", c);
|
|
315
315
|
}
|
|
@@ -576,22 +576,22 @@ class Pe {
|
|
|
576
576
|
search: s,
|
|
577
577
|
pretty: c = !0
|
|
578
578
|
} = e;
|
|
579
|
-
let
|
|
579
|
+
let a = [...this.logs];
|
|
580
580
|
if (o !== void 0 && o > 0) {
|
|
581
|
-
const
|
|
582
|
-
|
|
581
|
+
const l = Date.now() - o;
|
|
582
|
+
a = a.filter((d) => d.timestamp >= l);
|
|
583
583
|
}
|
|
584
584
|
if (r && r.length > 0) {
|
|
585
|
-
const
|
|
586
|
-
|
|
585
|
+
const l = new Set(r);
|
|
586
|
+
a = a.filter((d) => l.has(d.level));
|
|
587
587
|
}
|
|
588
588
|
if (s) {
|
|
589
|
-
const
|
|
590
|
-
|
|
591
|
-
(d) => d.message.toLowerCase().includes(
|
|
589
|
+
const l = s.toLowerCase();
|
|
590
|
+
a = a.filter(
|
|
591
|
+
(d) => d.message.toLowerCase().includes(l) || JSON.stringify(d.data).toLowerCase().includes(l)
|
|
592
592
|
);
|
|
593
593
|
}
|
|
594
|
-
return n === "text" ? this.formatLogsAsText(
|
|
594
|
+
return n === "text" ? this.formatLogsAsText(a) : c ? JSON.stringify(a, null, 2) : JSON.stringify(a);
|
|
595
595
|
} catch {
|
|
596
596
|
return "[]";
|
|
597
597
|
}
|
|
@@ -601,10 +601,10 @@ class Pe {
|
|
|
601
601
|
*/
|
|
602
602
|
formatLogsAsText(e) {
|
|
603
603
|
return e.map((n) => {
|
|
604
|
-
const o = new Date(n.timestamp).toISOString(), r = n.level.toUpperCase().padEnd(5), s = `${n.source.file}:${n.source.line}`, c = n.context ? ` [${Object.entries(n.context).map(([d,
|
|
604
|
+
const o = new Date(n.timestamp).toISOString(), r = n.level.toUpperCase().padEnd(5), s = `${n.source.file}:${n.source.line}`, c = n.context ? ` [${Object.entries(n.context).map(([d, u]) => `${d}=${u}`).join(", ")}]` : "", a = n.spanId ? ` (span: ${n.spanId})` : "", l = n.data.length > 0 ? `
|
|
605
605
|
Data: ${JSON.stringify(n.data)}` : "";
|
|
606
|
-
return `[${o}] ${r} ${n.message}${c}${
|
|
607
|
-
Source: ${s}${
|
|
606
|
+
return `[${o}] ${r} ${n.message}${c}${a}
|
|
607
|
+
Source: ${s}${l}`;
|
|
608
608
|
}).join(`
|
|
609
609
|
|
|
610
610
|
`);
|
|
@@ -626,7 +626,7 @@ class Pe {
|
|
|
626
626
|
*/
|
|
627
627
|
diff(e, n, o, r = "info") {
|
|
628
628
|
try {
|
|
629
|
-
const s =
|
|
629
|
+
const s = ae(n, o);
|
|
630
630
|
return this.log(r, e, [
|
|
631
631
|
{
|
|
632
632
|
__type: "Diff",
|
|
@@ -647,7 +647,7 @@ class Pe {
|
|
|
647
647
|
*/
|
|
648
648
|
computeDiff(e, n) {
|
|
649
649
|
try {
|
|
650
|
-
return
|
|
650
|
+
return ae(e, n);
|
|
651
651
|
} catch {
|
|
652
652
|
return {
|
|
653
653
|
changes: [],
|
|
@@ -656,7 +656,7 @@ class Pe {
|
|
|
656
656
|
}
|
|
657
657
|
}
|
|
658
658
|
}
|
|
659
|
-
const
|
|
659
|
+
const f = new Pe(), g = {
|
|
660
660
|
// Background
|
|
661
661
|
bgPrimary: "#1e1e1e",
|
|
662
662
|
bgSecondary: "#252526",
|
|
@@ -1285,14 +1285,14 @@ function xe(t) {
|
|
|
1285
1285
|
const n = t.data.length > 0, o = Ge(t.data), r = t.context && Object.keys(t.context).length > 0, s = `data-${t.id}`, c = () => {
|
|
1286
1286
|
if (!n) return "";
|
|
1287
1287
|
if (o) {
|
|
1288
|
-
const
|
|
1289
|
-
if (
|
|
1288
|
+
const a = t.data.find(ye);
|
|
1289
|
+
if (a)
|
|
1290
1290
|
return `
|
|
1291
1291
|
<div class="log-data log-data-diff">
|
|
1292
1292
|
<button class="log-data-toggle" data-target="${s}">
|
|
1293
1293
|
diff
|
|
1294
1294
|
</button>
|
|
1295
|
-
<div class="log-data-content" id="${s}">${je(
|
|
1295
|
+
<div class="log-data-content" id="${s}">${je(a)}</div>
|
|
1296
1296
|
</div>
|
|
1297
1297
|
`;
|
|
1298
1298
|
}
|
|
@@ -1315,9 +1315,9 @@ function xe(t) {
|
|
|
1315
1315
|
<div class="log-message">${M(t.message)}</div>
|
|
1316
1316
|
${c()}
|
|
1317
1317
|
`, n) {
|
|
1318
|
-
const
|
|
1319
|
-
|
|
1320
|
-
|
|
1318
|
+
const a = e.querySelector(".log-data-toggle"), l = e.querySelector(`#${s}`);
|
|
1319
|
+
a && l && a.addEventListener("click", () => {
|
|
1320
|
+
a.classList.toggle("expanded"), l.classList.toggle("visible");
|
|
1321
1321
|
});
|
|
1322
1322
|
}
|
|
1323
1323
|
return e;
|
|
@@ -1438,27 +1438,27 @@ class Qe {
|
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
1440
|
}
|
|
1441
|
-
const H = new Qe(), ge = 500,
|
|
1441
|
+
const H = new Qe(), ge = 500, ue = 700;
|
|
1442
1442
|
let b = null;
|
|
1443
1443
|
function Ze() {
|
|
1444
1444
|
try {
|
|
1445
1445
|
if (b && !b.closed)
|
|
1446
1446
|
return b.focus(), b;
|
|
1447
|
-
const t = Math.max(0, (screen.width - ge) / 2), e = Math.max(0, (screen.height -
|
|
1447
|
+
const t = Math.max(0, (screen.width - ge) / 2), e = Math.max(0, (screen.height - ue) / 2), n = tt();
|
|
1448
1448
|
return b = window.open(
|
|
1449
1449
|
"",
|
|
1450
1450
|
"devlogger-popout",
|
|
1451
|
-
`width=${ge},height=${
|
|
1451
|
+
`width=${ge},height=${ue},left=${t},top=${e},resizable=yes,scrollbars=yes`
|
|
1452
1452
|
), b ? (b.document.open(), b.document.write(n), b.document.close(), b.addEventListener("load", () => {
|
|
1453
1453
|
setTimeout(() => {
|
|
1454
|
-
H.sendSyncResponse(
|
|
1454
|
+
H.sendSyncResponse(f.getLogs());
|
|
1455
1455
|
}, 100);
|
|
1456
1456
|
}), b) : (console.warn("[DevLogger] Pop-out blocked by browser"), null);
|
|
1457
1457
|
} catch (t) {
|
|
1458
1458
|
return console.warn("[DevLogger] Failed to open pop-out:", t), null;
|
|
1459
1459
|
}
|
|
1460
1460
|
}
|
|
1461
|
-
function
|
|
1461
|
+
function fe() {
|
|
1462
1462
|
try {
|
|
1463
1463
|
b && !b.closed && b.close(), b = null;
|
|
1464
1464
|
} catch {
|
|
@@ -1901,6 +1901,7 @@ function tt() {
|
|
|
1901
1901
|
<button class="btn btn-copy" id="btn-copy-json" title="Copy as JSON">JSON</button>
|
|
1902
1902
|
<button class="btn btn-copy" id="btn-copy-text" title="Copy as Text">TXT</button>
|
|
1903
1903
|
<button class="btn btn-timeline" id="btn-timeline" title="Toggle Timeline">Timeline</button>
|
|
1904
|
+
<button class="btn btn-timeline" id="btn-timeline-pause" title="Pause/Resume Timeline" style="display: none;">⏸</button>
|
|
1904
1905
|
<button class="btn" id="btn-clear">Clear</button>
|
|
1905
1906
|
</div>
|
|
1906
1907
|
</div>
|
|
@@ -1925,6 +1926,7 @@ function tt() {
|
|
|
1925
1926
|
</div>
|
|
1926
1927
|
<input type="text" class="filter-input" id="filter-search" placeholder="Search logs..." data-filter="search">
|
|
1927
1928
|
<input type="text" class="filter-input" id="filter-file" placeholder="Filter by file..." data-filter="file" style="max-width: 120px;">
|
|
1929
|
+
<button class="filter-clear-btn" title="Clear all filters">✕</button>
|
|
1928
1930
|
</div>
|
|
1929
1931
|
<div class="filter-status" id="filter-status" style="display: none;"></div>
|
|
1930
1932
|
</div>
|
|
@@ -1962,6 +1964,7 @@ function tt() {
|
|
|
1962
1964
|
const btnCopyJson = document.getElementById('btn-copy-json');
|
|
1963
1965
|
const btnCopyText = document.getElementById('btn-copy-text');
|
|
1964
1966
|
const btnTimeline = document.getElementById('btn-timeline');
|
|
1967
|
+
const btnTimelinePause = document.getElementById('btn-timeline-pause');
|
|
1965
1968
|
const timelineContainer = document.getElementById('timeline-container');
|
|
1966
1969
|
const timelineCanvas = document.getElementById('timeline-canvas');
|
|
1967
1970
|
const timelineTooltip = document.getElementById('timeline-tooltip');
|
|
@@ -1971,6 +1974,7 @@ function tt() {
|
|
|
1971
1974
|
let timelineVisible = false;
|
|
1972
1975
|
let timelineWindow = 30000; // 30 seconds default
|
|
1973
1976
|
let timelineInterval = null;
|
|
1977
|
+
let timelinePaused = false;
|
|
1974
1978
|
const LEVEL_COLORS = {
|
|
1975
1979
|
debug: '#6e6e6e',
|
|
1976
1980
|
info: '#3794ff',
|
|
@@ -1980,6 +1984,7 @@ function tt() {
|
|
|
1980
1984
|
const filterSearch = document.getElementById('filter-search');
|
|
1981
1985
|
const filterFile = document.getElementById('filter-file');
|
|
1982
1986
|
const filterStatus = document.getElementById('filter-status');
|
|
1987
|
+
const filterClearBtn = document.querySelector('.filter-clear-btn');
|
|
1983
1988
|
|
|
1984
1989
|
// Connect to broadcast channel
|
|
1985
1990
|
function connect() {
|
|
@@ -2235,12 +2240,14 @@ function tt() {
|
|
|
2235
2240
|
|
|
2236
2241
|
// Export logs as JSON
|
|
2237
2242
|
function exportLogsJson() {
|
|
2238
|
-
|
|
2243
|
+
const logsToExport = getFilteredLogs();
|
|
2244
|
+
return JSON.stringify(logsToExport, null, 2);
|
|
2239
2245
|
}
|
|
2240
2246
|
|
|
2241
2247
|
// Export logs as text
|
|
2242
2248
|
function exportLogsText() {
|
|
2243
|
-
|
|
2249
|
+
const logsToExport = getFilteredLogs();
|
|
2250
|
+
return logsToExport.map(log => {
|
|
2244
2251
|
const time = new Date(log.timestamp).toISOString();
|
|
2245
2252
|
const level = log.level.toUpperCase().padEnd(5);
|
|
2246
2253
|
const source = log.source.file + ':' + log.source.line;
|
|
@@ -2322,12 +2329,36 @@ function tt() {
|
|
|
2322
2329
|
renderAllLogs();
|
|
2323
2330
|
});
|
|
2324
2331
|
|
|
2332
|
+
// Filter: Clear button
|
|
2333
|
+
if (filterClearBtn) {
|
|
2334
|
+
filterClearBtn.addEventListener('click', () => {
|
|
2335
|
+
// Reset all filters
|
|
2336
|
+
filter.levels = new Set(['debug', 'info', 'warn', 'error']);
|
|
2337
|
+
filter.search = '';
|
|
2338
|
+
filter.file = '';
|
|
2339
|
+
|
|
2340
|
+
// Reset UI elements
|
|
2341
|
+
filterSearch.value = '';
|
|
2342
|
+
filterFile.value = '';
|
|
2343
|
+
document.querySelectorAll('.filter-level-btn').forEach(btn => {
|
|
2344
|
+
btn.classList.add('active');
|
|
2345
|
+
});
|
|
2346
|
+
|
|
2347
|
+
// Re-render
|
|
2348
|
+
renderAllLogs();
|
|
2349
|
+
});
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2325
2352
|
// Timeline: Toggle button
|
|
2326
2353
|
btnTimeline.addEventListener('click', () => {
|
|
2327
2354
|
timelineVisible = !timelineVisible;
|
|
2328
2355
|
timelineContainer.style.display = timelineVisible ? 'block' : 'none';
|
|
2329
2356
|
btnTimeline.classList.toggle('active', timelineVisible);
|
|
2357
|
+
btnTimelinePause.style.display = timelineVisible ? 'inline-block' : 'none';
|
|
2330
2358
|
if (timelineVisible) {
|
|
2359
|
+
timelinePaused = false;
|
|
2360
|
+
btnTimelinePause.textContent = '⏸';
|
|
2361
|
+
btnTimelinePause.classList.remove('active');
|
|
2331
2362
|
resizeCanvas();
|
|
2332
2363
|
drawTimeline();
|
|
2333
2364
|
startTimelineRefresh();
|
|
@@ -2336,6 +2367,18 @@ function tt() {
|
|
|
2336
2367
|
}
|
|
2337
2368
|
});
|
|
2338
2369
|
|
|
2370
|
+
// Timeline: Pause/Resume button
|
|
2371
|
+
btnTimelinePause.addEventListener('click', () => {
|
|
2372
|
+
timelinePaused = !timelinePaused;
|
|
2373
|
+
btnTimelinePause.textContent = timelinePaused ? '▶' : '⏸';
|
|
2374
|
+
btnTimelinePause.classList.toggle('active', timelinePaused);
|
|
2375
|
+
if (timelinePaused) {
|
|
2376
|
+
stopTimelineRefresh();
|
|
2377
|
+
} else {
|
|
2378
|
+
startTimelineRefresh();
|
|
2379
|
+
}
|
|
2380
|
+
});
|
|
2381
|
+
|
|
2339
2382
|
// Timeline: Time window buttons
|
|
2340
2383
|
document.querySelectorAll('.timeline-btn[data-window]').forEach(btn => {
|
|
2341
2384
|
btn.addEventListener('click', (e) => {
|
|
@@ -2566,7 +2609,7 @@ function rt(t) {
|
|
|
2566
2609
|
n.className = "devlogger-toggle", n.innerHTML = "📋", n.title = "Toggle DevLogger (Ctrl+Shift+L)", n.addEventListener("click", () => j.toggle()), t.appendChild(n), i.toggleBtn = n;
|
|
2567
2610
|
const o = document.createElement("div");
|
|
2568
2611
|
o.className = "devlogger-container hidden";
|
|
2569
|
-
const r =
|
|
2612
|
+
const r = f.getLogs(), s = U(r, i.filter);
|
|
2570
2613
|
o.innerHTML = `
|
|
2571
2614
|
<div class="devlogger-header">
|
|
2572
2615
|
<div class="devlogger-title">
|
|
@@ -2588,11 +2631,11 @@ function rt(t) {
|
|
|
2588
2631
|
<span class="devlogger-shortcut">Ctrl+Shift+L to toggle</span>
|
|
2589
2632
|
</div>
|
|
2590
2633
|
`, i.badge = o.querySelector(".devlogger-badge"), i.logsList = o.querySelector(".devlogger-logs"), i.filterBar = o.querySelector(".filter-bar-container"), o.querySelectorAll("[data-action]").forEach((c) => {
|
|
2591
|
-
c.addEventListener("click", (
|
|
2592
|
-
const
|
|
2593
|
-
switch (
|
|
2634
|
+
c.addEventListener("click", (a) => {
|
|
2635
|
+
const l = a.currentTarget.dataset.action, d = a.currentTarget;
|
|
2636
|
+
switch (l) {
|
|
2594
2637
|
case "clear":
|
|
2595
|
-
|
|
2638
|
+
f.clear(), H.sendClear(), y();
|
|
2596
2639
|
break;
|
|
2597
2640
|
case "popout":
|
|
2598
2641
|
j.popout();
|
|
@@ -2601,13 +2644,13 @@ function rt(t) {
|
|
|
2601
2644
|
j.close();
|
|
2602
2645
|
break;
|
|
2603
2646
|
case "copy-json":
|
|
2604
|
-
|
|
2605
|
-
he(d,
|
|
2647
|
+
f.copyLogs({ format: "json" }).then((u) => {
|
|
2648
|
+
he(d, u);
|
|
2606
2649
|
});
|
|
2607
2650
|
break;
|
|
2608
2651
|
case "copy-text":
|
|
2609
|
-
|
|
2610
|
-
he(d,
|
|
2652
|
+
f.copyLogs({ format: "text" }).then((u) => {
|
|
2653
|
+
he(d, u);
|
|
2611
2654
|
});
|
|
2612
2655
|
break;
|
|
2613
2656
|
}
|
|
@@ -2616,7 +2659,7 @@ function rt(t) {
|
|
|
2616
2659
|
}
|
|
2617
2660
|
function I() {
|
|
2618
2661
|
if (!i.filterBar) return;
|
|
2619
|
-
const t =
|
|
2662
|
+
const t = f.getLogs(), e = U(t, i.filter);
|
|
2620
2663
|
i.filterBar.innerHTML = ot(i.filter, t.length, e.length), it();
|
|
2621
2664
|
}
|
|
2622
2665
|
function it() {
|
|
@@ -2642,7 +2685,7 @@ function it() {
|
|
|
2642
2685
|
}
|
|
2643
2686
|
function y() {
|
|
2644
2687
|
if (!i.logsList) return;
|
|
2645
|
-
const t =
|
|
2688
|
+
const t = f.getLogs(), e = U(t, i.filter);
|
|
2646
2689
|
if (i.logsList.innerHTML = "", t.length === 0)
|
|
2647
2690
|
i.logsList.appendChild(Xe());
|
|
2648
2691
|
else if (e.length === 0) {
|
|
@@ -2661,7 +2704,7 @@ function y() {
|
|
|
2661
2704
|
}
|
|
2662
2705
|
function st(t) {
|
|
2663
2706
|
if (!i.logsList) return;
|
|
2664
|
-
const e =
|
|
2707
|
+
const e = f.getLogs(), n = U(e, i.filter);
|
|
2665
2708
|
if (n.some((r) => r.id === t.id)) {
|
|
2666
2709
|
const r = i.logsList.querySelector(".devlogger-empty, .devlogger-no-results");
|
|
2667
2710
|
r && r.remove(), i.logsList.appendChild(xe(t));
|
|
@@ -2675,7 +2718,7 @@ function we(t, e) {
|
|
|
2675
2718
|
}
|
|
2676
2719
|
function Z() {
|
|
2677
2720
|
if (!i.filterBar) return;
|
|
2678
|
-
const t =
|
|
2721
|
+
const t = f.getLogs(), e = U(t, i.filter), n = te(i.filter), o = i.filterBar.querySelector(".filter-bar");
|
|
2679
2722
|
o && o.classList.toggle("filter-active", n);
|
|
2680
2723
|
let r = i.filterBar.querySelector(".filter-status");
|
|
2681
2724
|
if (n) {
|
|
@@ -2693,13 +2736,13 @@ function ne() {
|
|
|
2693
2736
|
function be(t) {
|
|
2694
2737
|
t.key.toLowerCase() === Q.key && t.ctrlKey === Q.ctrlKey && t.shiftKey === Q.shiftKey && (t.preventDefault(), j.toggle());
|
|
2695
2738
|
}
|
|
2696
|
-
function
|
|
2739
|
+
function lt(t) {
|
|
2697
2740
|
switch (t.type) {
|
|
2698
2741
|
case "CLEAR_LOGS":
|
|
2699
|
-
|
|
2742
|
+
f.clear(), y();
|
|
2700
2743
|
break;
|
|
2701
2744
|
case "SYNC_REQUEST":
|
|
2702
|
-
H.sendSyncResponse(
|
|
2745
|
+
H.sendSyncResponse(f.getLogs());
|
|
2703
2746
|
break;
|
|
2704
2747
|
}
|
|
2705
2748
|
}
|
|
@@ -2709,14 +2752,14 @@ const j = {
|
|
|
2709
2752
|
*/
|
|
2710
2753
|
init() {
|
|
2711
2754
|
try {
|
|
2712
|
-
if (i.initialized || !
|
|
2755
|
+
if (i.initialized || !f.isEnabled() || typeof document > "u")
|
|
2713
2756
|
return;
|
|
2714
2757
|
const t = document.createElement("div");
|
|
2715
2758
|
t.id = "devlogger-host", document.body.appendChild(t), i.host = t;
|
|
2716
2759
|
const e = t.attachShadow({ mode: "open" });
|
|
2717
|
-
i.shadow = e, rt(e), i.unsubscribe =
|
|
2760
|
+
i.shadow = e, rt(e), i.unsubscribe = f.subscribe((n) => {
|
|
2718
2761
|
st(n), H.sendLog(n);
|
|
2719
|
-
}), i.channelUnsubscribe = H.subscribe(
|
|
2762
|
+
}), i.channelUnsubscribe = H.subscribe(lt), document.addEventListener("keydown", be), i.initialized = !0;
|
|
2720
2763
|
} catch (t) {
|
|
2721
2764
|
console.warn("[DevLogger UI] Init error:", t);
|
|
2722
2765
|
}
|
|
@@ -2759,7 +2802,7 @@ const j = {
|
|
|
2759
2802
|
* Close the pop-out window
|
|
2760
2803
|
*/
|
|
2761
2804
|
closePopout() {
|
|
2762
|
-
|
|
2805
|
+
fe();
|
|
2763
2806
|
},
|
|
2764
2807
|
/**
|
|
2765
2808
|
* Check if pop-out window is open
|
|
@@ -2796,7 +2839,7 @@ const j = {
|
|
|
2796
2839
|
*/
|
|
2797
2840
|
destroy() {
|
|
2798
2841
|
try {
|
|
2799
|
-
|
|
2842
|
+
fe(), i.unsubscribe && (i.unsubscribe(), i.unsubscribe = null), i.channelUnsubscribe && (i.channelUnsubscribe(), i.channelUnsubscribe = null), document.removeEventListener("keydown", be), i.host && (i.host.remove(), i.host = null), i.initialized = !1, i.visible = !1, i.shadow = null, i.container = null, i.logsList = null, i.filterBar = null, i.toggleBtn = null, i.badge = null, i.filter = z();
|
|
2800
2843
|
} catch {
|
|
2801
2844
|
}
|
|
2802
2845
|
},
|
|
@@ -2818,15 +2861,15 @@ const j = {
|
|
|
2818
2861
|
errorPrefix: "[Uncaught Error]",
|
|
2819
2862
|
rejectionPrefix: "[Unhandled Rejection]"
|
|
2820
2863
|
};
|
|
2821
|
-
let N = !1, L = { ...Le }, P = null,
|
|
2822
|
-
function
|
|
2864
|
+
let N = !1, L = { ...Le }, P = null, A = null;
|
|
2865
|
+
function at(t, e, n, o, r) {
|
|
2823
2866
|
try {
|
|
2824
|
-
const s = r || (t instanceof ErrorEvent ? t.error : null), c = s?.message || String(t),
|
|
2825
|
-
|
|
2867
|
+
const s = r || (t instanceof ErrorEvent ? t.error : null), c = s?.message || String(t), a = s?.stack;
|
|
2868
|
+
f.error(`${L.errorPrefix} ${c}`, {
|
|
2826
2869
|
source: e || "unknown",
|
|
2827
2870
|
line: n || 0,
|
|
2828
2871
|
column: o || 0,
|
|
2829
|
-
stack:
|
|
2872
|
+
stack: a,
|
|
2830
2873
|
originalError: s ? {
|
|
2831
2874
|
name: s.name,
|
|
2832
2875
|
message: s.message,
|
|
@@ -2850,7 +2893,7 @@ function ct(t) {
|
|
|
2850
2893
|
name: e.name,
|
|
2851
2894
|
message: e.message,
|
|
2852
2895
|
stack: e.stack
|
|
2853
|
-
}) : typeof e == "string" ? n = e : (n = "Unknown rejection reason", o = { reason: e }),
|
|
2896
|
+
}) : typeof e == "string" ? n = e : (n = "Unknown rejection reason", o = { reason: e }), f.error(`${L.rejectionPrefix} ${n}`, o);
|
|
2854
2897
|
} catch {
|
|
2855
2898
|
}
|
|
2856
2899
|
}
|
|
@@ -2862,7 +2905,7 @@ function dt(t = {}) {
|
|
|
2862
2905
|
try {
|
|
2863
2906
|
if (typeof window > "u")
|
|
2864
2907
|
return;
|
|
2865
|
-
L = { ...Le, ...t }, P = window.onerror, L.captureErrors && (window.onerror =
|
|
2908
|
+
L = { ...Le, ...t }, P = window.onerror, L.captureErrors && (window.onerror = at), L.captureRejections && (A = ct, window.addEventListener("unhandledrejection", A)), N = !0;
|
|
2866
2909
|
} catch {
|
|
2867
2910
|
}
|
|
2868
2911
|
}
|
|
@@ -2871,17 +2914,17 @@ function gt() {
|
|
|
2871
2914
|
try {
|
|
2872
2915
|
if (typeof window > "u")
|
|
2873
2916
|
return;
|
|
2874
|
-
window.onerror = P,
|
|
2917
|
+
window.onerror = P, A && window.removeEventListener("unhandledrejection", A), P = null, A = null, N = !1;
|
|
2875
2918
|
} catch {
|
|
2876
2919
|
}
|
|
2877
2920
|
}
|
|
2878
|
-
function
|
|
2921
|
+
function ut() {
|
|
2879
2922
|
return N;
|
|
2880
2923
|
}
|
|
2881
|
-
function
|
|
2924
|
+
function ft() {
|
|
2882
2925
|
return { ...L };
|
|
2883
2926
|
}
|
|
2884
|
-
const
|
|
2927
|
+
const At = {
|
|
2885
2928
|
/**
|
|
2886
2929
|
* Install global error handlers
|
|
2887
2930
|
*
|
|
@@ -2906,11 +2949,11 @@ const Ot = {
|
|
|
2906
2949
|
/**
|
|
2907
2950
|
* Check if error capture is currently active
|
|
2908
2951
|
*/
|
|
2909
|
-
isActive:
|
|
2952
|
+
isActive: ut,
|
|
2910
2953
|
/**
|
|
2911
2954
|
* Get current configuration
|
|
2912
2955
|
*/
|
|
2913
|
-
getConfig:
|
|
2956
|
+
getConfig: ft
|
|
2914
2957
|
}, J = "devlogger_persisted_logs", oe = "devlogger_session_active", Se = {
|
|
2915
2958
|
storage: "session",
|
|
2916
2959
|
maxPersisted: 500,
|
|
@@ -3000,7 +3043,7 @@ function X() {
|
|
|
3000
3043
|
}
|
|
3001
3044
|
function mt() {
|
|
3002
3045
|
if (!R) return;
|
|
3003
|
-
const t =
|
|
3046
|
+
const t = f.getLogs();
|
|
3004
3047
|
vt([...t]);
|
|
3005
3048
|
}
|
|
3006
3049
|
function yt(t = {}) {
|
|
@@ -3011,7 +3054,7 @@ function yt(t = {}) {
|
|
|
3011
3054
|
try {
|
|
3012
3055
|
if (typeof window > "u")
|
|
3013
3056
|
return;
|
|
3014
|
-
S = { ...Se, ...t }, re = pt(), ht(), W =
|
|
3057
|
+
S = { ...Se, ...t }, re = pt(), ht(), W = f.subscribe(mt), window.addEventListener("beforeunload", X), window.addEventListener("pagehide", X), R = !0;
|
|
3015
3058
|
} catch {
|
|
3016
3059
|
}
|
|
3017
3060
|
}
|
|
@@ -3033,7 +3076,7 @@ function Lt() {
|
|
|
3033
3076
|
function St() {
|
|
3034
3077
|
try {
|
|
3035
3078
|
const t = $e();
|
|
3036
|
-
return t.length === 0 ? 0 : (
|
|
3079
|
+
return t.length === 0 ? 0 : (f.importLogs(t), t.length);
|
|
3037
3080
|
} catch {
|
|
3038
3081
|
return 0;
|
|
3039
3082
|
}
|
|
@@ -3047,7 +3090,7 @@ function kt() {
|
|
|
3047
3090
|
function $t() {
|
|
3048
3091
|
return { ...S };
|
|
3049
3092
|
}
|
|
3050
|
-
const
|
|
3093
|
+
const Ot = {
|
|
3051
3094
|
/**
|
|
3052
3095
|
* Enable log persistence
|
|
3053
3096
|
*
|
|
@@ -3115,7 +3158,7 @@ const At = {
|
|
|
3115
3158
|
ignorePatterns: [],
|
|
3116
3159
|
context: {}
|
|
3117
3160
|
};
|
|
3118
|
-
let E = null,
|
|
3161
|
+
let E = null, O = null, T = null, B = !1, v = { ...Ee };
|
|
3119
3162
|
function Te(t) {
|
|
3120
3163
|
for (const e of v.ignorePatterns)
|
|
3121
3164
|
if (typeof e == "string") {
|
|
@@ -3151,90 +3194,90 @@ function Et() {
|
|
|
3151
3194
|
const o = typeof e == "string" ? e : e instanceof URL ? e.href : e.url;
|
|
3152
3195
|
if (Te(o))
|
|
3153
3196
|
return E(e, n);
|
|
3154
|
-
const { host: r, path: s } = Ie(o), c = n?.method || "GET",
|
|
3197
|
+
const { host: r, path: s } = Ie(o), c = n?.method || "GET", a = `${c} ${s}`, l = f.span(a, {
|
|
3155
3198
|
...v.context,
|
|
3156
3199
|
type: "fetch",
|
|
3157
3200
|
method: c,
|
|
3158
3201
|
host: r
|
|
3159
3202
|
});
|
|
3160
|
-
if (
|
|
3203
|
+
if (l.info(`Request started: ${o}`), v.includeHeaders && n?.headers && l.debug("Request headers", n.headers), v.includeBody && n?.body)
|
|
3161
3204
|
try {
|
|
3162
|
-
const
|
|
3163
|
-
|
|
3205
|
+
const u = typeof n.body == "string" ? Y(n.body) : n.body;
|
|
3206
|
+
l.debug("Request body", u);
|
|
3164
3207
|
} catch {
|
|
3165
|
-
|
|
3208
|
+
l.debug("Request body", "[Unable to parse]");
|
|
3166
3209
|
}
|
|
3167
3210
|
const d = performance.now();
|
|
3168
3211
|
try {
|
|
3169
|
-
const
|
|
3170
|
-
if (
|
|
3171
|
-
if (
|
|
3212
|
+
const u = await E(e, n), h = Math.round(performance.now() - d);
|
|
3213
|
+
if (u.ok) {
|
|
3214
|
+
if (l.info(`Response: ${u.status} ${u.statusText} (${h}ms)`), v.includeResponse)
|
|
3172
3215
|
try {
|
|
3173
|
-
const K = await
|
|
3174
|
-
|
|
3216
|
+
const K = await u.clone().text(), m = Y(Re(K, v.maxResponseLength));
|
|
3217
|
+
l.debug("Response body", m);
|
|
3175
3218
|
} catch {
|
|
3176
|
-
|
|
3219
|
+
l.debug("Response body", "[Unable to read]");
|
|
3177
3220
|
}
|
|
3178
|
-
|
|
3221
|
+
l.end();
|
|
3179
3222
|
} else
|
|
3180
|
-
|
|
3181
|
-
return
|
|
3182
|
-
} catch (
|
|
3223
|
+
l.warn(`Response: ${u.status} ${u.statusText} (${h}ms)`), l.fail();
|
|
3224
|
+
return u;
|
|
3225
|
+
} catch (u) {
|
|
3183
3226
|
const h = Math.round(performance.now() - d);
|
|
3184
|
-
throw
|
|
3227
|
+
throw l.error(`Request failed after ${h}ms`, u), l.fail(), u;
|
|
3185
3228
|
}
|
|
3186
3229
|
};
|
|
3187
3230
|
}
|
|
3188
3231
|
function Tt() {
|
|
3189
|
-
|
|
3232
|
+
O = XMLHttpRequest.prototype.open, T = XMLHttpRequest.prototype.send, XMLHttpRequest.prototype.open = function(t, e, n = !0, o, r) {
|
|
3190
3233
|
const s = typeof e == "string" ? e : e.href;
|
|
3191
3234
|
return this.__networkCapture = {
|
|
3192
3235
|
method: t,
|
|
3193
3236
|
url: s,
|
|
3194
3237
|
ignored: Te(s)
|
|
3195
|
-
},
|
|
3238
|
+
}, O.call(this, t, e, n, o, r);
|
|
3196
3239
|
}, XMLHttpRequest.prototype.send = function(t) {
|
|
3197
3240
|
const e = this.__networkCapture;
|
|
3198
3241
|
if (!e || e.ignored)
|
|
3199
3242
|
return T.call(this, t);
|
|
3200
|
-
const { method: n, url: o } = e, { host: r, path: s } = Ie(o), c = `${n} ${s}`,
|
|
3243
|
+
const { method: n, url: o } = e, { host: r, path: s } = Ie(o), c = `${n} ${s}`, a = f.span(c, {
|
|
3201
3244
|
...v.context,
|
|
3202
3245
|
type: "xhr",
|
|
3203
3246
|
method: n,
|
|
3204
3247
|
host: r
|
|
3205
3248
|
});
|
|
3206
|
-
if (
|
|
3249
|
+
if (a.info(`XHR Request started: ${o}`), v.includeBody && t)
|
|
3207
3250
|
try {
|
|
3208
3251
|
const d = typeof t == "string" ? Y(t) : t;
|
|
3209
|
-
|
|
3252
|
+
a.debug("Request body", d);
|
|
3210
3253
|
} catch {
|
|
3211
|
-
|
|
3254
|
+
a.debug("Request body", "[Unable to parse]");
|
|
3212
3255
|
}
|
|
3213
|
-
const
|
|
3256
|
+
const l = performance.now();
|
|
3214
3257
|
return this.addEventListener("load", () => {
|
|
3215
|
-
const d = Math.round(performance.now() -
|
|
3258
|
+
const d = Math.round(performance.now() - l);
|
|
3216
3259
|
if (this.status >= 200 && this.status < 400) {
|
|
3217
|
-
if (
|
|
3218
|
-
const
|
|
3219
|
-
|
|
3260
|
+
if (a.info(`Response: ${this.status} ${this.statusText} (${d}ms)`), v.includeResponse && this.responseText) {
|
|
3261
|
+
const u = Y(Re(this.responseText, v.maxResponseLength));
|
|
3262
|
+
a.debug("Response body", u);
|
|
3220
3263
|
}
|
|
3221
|
-
|
|
3264
|
+
a.end();
|
|
3222
3265
|
} else
|
|
3223
|
-
|
|
3266
|
+
a.warn(`Response: ${this.status} ${this.statusText} (${d}ms)`), a.fail();
|
|
3224
3267
|
}), this.addEventListener("error", () => {
|
|
3225
|
-
const d = Math.round(performance.now() -
|
|
3226
|
-
|
|
3268
|
+
const d = Math.round(performance.now() - l);
|
|
3269
|
+
a.error(`XHR Request failed after ${d}ms`), a.fail();
|
|
3227
3270
|
}), this.addEventListener("abort", () => {
|
|
3228
|
-
const d = Math.round(performance.now() -
|
|
3229
|
-
|
|
3271
|
+
const d = Math.round(performance.now() - l);
|
|
3272
|
+
a.warn(`XHR Request aborted after ${d}ms`), a.fail();
|
|
3230
3273
|
}), this.addEventListener("timeout", () => {
|
|
3231
|
-
const d = Math.round(performance.now() -
|
|
3232
|
-
|
|
3274
|
+
const d = Math.round(performance.now() - l);
|
|
3275
|
+
a.error(`XHR Request timeout after ${d}ms`), a.fail();
|
|
3233
3276
|
}), T.call(this, t);
|
|
3234
3277
|
};
|
|
3235
3278
|
}
|
|
3236
3279
|
function It() {
|
|
3237
|
-
|
|
3280
|
+
O && (XMLHttpRequest.prototype.open = O, O = null), T && (XMLHttpRequest.prototype.send = T, T = null);
|
|
3238
3281
|
}
|
|
3239
3282
|
const Ht = {
|
|
3240
3283
|
/**
|
|
@@ -3244,7 +3287,7 @@ const Ht = {
|
|
|
3244
3287
|
try {
|
|
3245
3288
|
if (B)
|
|
3246
3289
|
return;
|
|
3247
|
-
v = { ...Ee, ...t }, v.captureFetch && typeof globalThis.fetch == "function" && (E = globalThis.fetch, globalThis.fetch = Et()), v.captureXHR && typeof XMLHttpRequest < "u" && Tt(), B = !0,
|
|
3290
|
+
v = { ...Ee, ...t }, v.captureFetch && typeof globalThis.fetch == "function" && (E = globalThis.fetch, globalThis.fetch = Et()), v.captureXHR && typeof XMLHttpRequest < "u" && Tt(), B = !0, f.debug("[NetworkCapture] Installed", {
|
|
3248
3291
|
fetch: v.captureFetch,
|
|
3249
3292
|
xhr: v.captureXHR
|
|
3250
3293
|
});
|
|
@@ -3259,7 +3302,7 @@ const Ht = {
|
|
|
3259
3302
|
try {
|
|
3260
3303
|
if (!B)
|
|
3261
3304
|
return;
|
|
3262
|
-
E && (globalThis.fetch = E, E = null), It(), B = !1,
|
|
3305
|
+
E && (globalThis.fetch = E, E = null), It(), B = !1, f.debug("[NetworkCapture] Uninstalled");
|
|
3263
3306
|
} catch (t) {
|
|
3264
3307
|
console.warn("[NetworkCapture] Uninstall error:", t);
|
|
3265
3308
|
}
|
|
@@ -3424,51 +3467,51 @@ class Dt {
|
|
|
3424
3467
|
if (!this.canvas || !this.ctx) return;
|
|
3425
3468
|
const e = this.ctx, n = this.canvas.width, o = this.canvas.height, r = Date.now(), s = r - this.config.timeWindow;
|
|
3426
3469
|
e.fillStyle = "#1e1e1e", e.fillRect(0, 0, n, o), this.spanBounds.clear(), this.logBounds.clear(), this.drawTimeGrid(e, n, o, s, r);
|
|
3427
|
-
const c =
|
|
3428
|
-
this.config.showSpans && this.drawSpans(e,
|
|
3470
|
+
const c = f.getLogs().filter((l) => l.timestamp >= s), a = f.getSpans().filter((l) => l.startTime >= s || l.endTime && l.endTime >= s);
|
|
3471
|
+
this.config.showSpans && this.drawSpans(e, a, n, o, s, r), this.config.showLogs && this.drawLogs(e, c, n, o, s, r);
|
|
3429
3472
|
}
|
|
3430
3473
|
drawTimeGrid(e, n, o, r, s) {
|
|
3431
|
-
const c = s - r,
|
|
3474
|
+
const c = s - r, a = 6;
|
|
3432
3475
|
e.strokeStyle = "#333", e.lineWidth = 1, e.font = "10px SF Mono, monospace", e.fillStyle = "#666";
|
|
3433
|
-
for (let
|
|
3434
|
-
const d =
|
|
3476
|
+
for (let l = 0; l <= a; l++) {
|
|
3477
|
+
const d = l / a * n, u = r + c * l / a;
|
|
3435
3478
|
e.beginPath(), e.moveTo(d, 0), e.lineTo(d, o), e.stroke();
|
|
3436
|
-
const h = new Date(
|
|
3479
|
+
const h = new Date(u), C = `${h.getMinutes().toString().padStart(2, "0")}:${h.getSeconds().toString().padStart(2, "0")}`;
|
|
3437
3480
|
e.fillText(C, d + 2, o - 4);
|
|
3438
3481
|
}
|
|
3439
3482
|
}
|
|
3440
3483
|
drawSpans(e, n, o, r, s, c) {
|
|
3441
|
-
const
|
|
3442
|
-
let C =
|
|
3484
|
+
const a = c - s, l = 20, d = 4, u = 20, h = n.filter((m) => !m.parentId);
|
|
3485
|
+
let C = u;
|
|
3443
3486
|
const K = (m, _, Mt = 0) => {
|
|
3444
|
-
const D = (m.startTime - s) /
|
|
3445
|
-
e.fillStyle = ie + "40", e.fillRect(D, _, V,
|
|
3487
|
+
const D = (m.startTime - s) / a * o, _e = ((m.endTime || c) - s) / a * o, V = Math.max(_e - D, 2), ie = _t[m.status];
|
|
3488
|
+
e.fillStyle = ie + "40", e.fillRect(D, _, V, l), e.strokeStyle = ie, e.lineWidth = 1, e.strokeRect(D, _, V, l), e.fillStyle = "#ccc", e.font = "10px SF Mono, monospace";
|
|
3446
3489
|
const De = m.duration ? `${m.name} (${m.duration}ms)` : m.name;
|
|
3447
3490
|
return e.fillText(De, D + 4, _ + 14, V - 8), this.spanBounds.set(m.id, {
|
|
3448
3491
|
x: D,
|
|
3449
3492
|
y: _,
|
|
3450
3493
|
w: V,
|
|
3451
|
-
h:
|
|
3452
|
-
}), _ +
|
|
3494
|
+
h: l
|
|
3495
|
+
}), _ + l + d;
|
|
3453
3496
|
};
|
|
3454
3497
|
for (const m of h)
|
|
3455
3498
|
C = K(m, C);
|
|
3456
3499
|
}
|
|
3457
3500
|
drawLogs(e, n, o, r, s, c) {
|
|
3458
|
-
const
|
|
3459
|
-
for (const
|
|
3460
|
-
const h = (
|
|
3461
|
-
e.fillStyle = C, e.beginPath(), e.moveTo(h, r - d), e.lineTo(h -
|
|
3501
|
+
const a = c - s, l = 8, d = 30;
|
|
3502
|
+
for (const u of n) {
|
|
3503
|
+
const h = (u.timestamp - s) / a * o, C = Rt[u.level];
|
|
3504
|
+
e.fillStyle = C, e.beginPath(), e.moveTo(h, r - d), e.lineTo(h - l / 2, r - d - l), e.lineTo(h + l / 2, r - d - l), e.closePath(), e.fill(), this.logBounds.set(u.id, {
|
|
3462
3505
|
x: h,
|
|
3463
|
-
y: r - d -
|
|
3464
|
-
r:
|
|
3506
|
+
y: r - d - l / 2,
|
|
3507
|
+
r: l
|
|
3465
3508
|
});
|
|
3466
3509
|
}
|
|
3467
3510
|
}
|
|
3468
3511
|
handleMouseMove(e) {
|
|
3469
3512
|
if (!this.canvas || !this.tooltip) return;
|
|
3470
3513
|
const n = this.canvas.getBoundingClientRect(), o = e.clientX - n.left, r = e.clientY - n.top;
|
|
3471
|
-
for (const s of
|
|
3514
|
+
for (const s of f.getSpans()) {
|
|
3472
3515
|
const c = this.spanBounds.get(s.id);
|
|
3473
3516
|
if (c && o >= c.x && o <= c.x + c.w && r >= c.y && r <= c.y + c.h) {
|
|
3474
3517
|
this.showTooltip(e, `
|
|
@@ -3480,7 +3523,7 @@ class Dt {
|
|
|
3480
3523
|
return;
|
|
3481
3524
|
}
|
|
3482
3525
|
}
|
|
3483
|
-
for (const s of
|
|
3526
|
+
for (const s of f.getLogs()) {
|
|
3484
3527
|
const c = this.logBounds.get(s.id);
|
|
3485
3528
|
if (c && Math.sqrt((o - c.x) ** 2 + (r - c.y) ** 2) <= c.r) {
|
|
3486
3529
|
this.showTooltip(e, `
|
|
@@ -3514,16 +3557,15 @@ function zt(t) {
|
|
|
3514
3557
|
const Nt = "0.1.0";
|
|
3515
3558
|
export {
|
|
3516
3559
|
j as DevLoggerUI,
|
|
3517
|
-
|
|
3518
|
-
|
|
3560
|
+
At as ErrorCapture,
|
|
3561
|
+
Ot as LogPersistence,
|
|
3519
3562
|
Ht as NetworkCapture,
|
|
3520
3563
|
Dt as Timeline,
|
|
3521
3564
|
Nt as VERSION,
|
|
3522
3565
|
ve as computeDiff,
|
|
3523
|
-
|
|
3566
|
+
ae as createDiffResult,
|
|
3524
3567
|
zt as createTimeline,
|
|
3525
|
-
|
|
3568
|
+
le as formatValue,
|
|
3526
3569
|
Ft as hasChanges,
|
|
3527
|
-
|
|
3570
|
+
f as logger
|
|
3528
3571
|
};
|
|
3529
|
-
//# sourceMappingURL=index.js.map
|