batchkit-devtools 0.3.4 → 0.3.6

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.
@@ -1,904 +0,0 @@
1
- import { delegateEvents as V, template as S, style as n, insert as f, createComponent as w, effect as z, memo as A, setAttribute as Q, setStyleProperty as re, addEventListener as Ae, className as ue, render as Ie } from "solid-js/web";
2
- import { createRoot as De, createSignal as Z, createMemo as fe, For as ee, Show as j, onMount as Oe } from "solid-js";
3
- import { __setDevtoolsHook as Ee } from "batchkit";
4
- let Re = 0;
5
- function Ne(a) {
6
- if (!a) return;
7
- const t = a.split(`
8
- `);
9
- for (const i of t)
10
- if (i.includes("batch") && !i.includes("batchkit") && !i.includes("node_modules")) {
11
- const r = i.match(/at\s+.*?\s+\(?(.*?:\d+:\d+)\)?$/);
12
- if (r) return r[1];
13
- }
14
- for (const i of t.slice(2))
15
- if (!i.includes("batchkit") && !i.includes("node_modules")) {
16
- const r = i.match(/at\s+.*?\s+\(?(.*?:\d+:\d+)\)?$/);
17
- if (r) return r[1];
18
- }
19
- }
20
- function je() {
21
- const [a, t] = Z({
22
- batchers: /* @__PURE__ */ new Map(),
23
- events: [],
24
- batches: /* @__PURE__ */ new Map(),
25
- selectedBatcher: null,
26
- isOpen: !1
27
- }), i = /* @__PURE__ */ new Set();
28
- function r() {
29
- const d = a();
30
- for (const p of i)
31
- p(d);
32
- }
33
- function e(d) {
34
- t((p) => {
35
- const o = new Map(p.batchers);
36
- return o.set(d.name, d), { ...p, batchers: o };
37
- }), r();
38
- }
39
- function l(d, p) {
40
- const o = { ...p, batcherName: d };
41
- t((y) => {
42
- const k = [...y.events, o], x = new Map(y.batches);
43
- if (o.type === "schedule") {
44
- const h = {
45
- batchId: o.batchId,
46
- batcherName: d,
47
- keys: [],
48
- status: "scheduled",
49
- scheduledAt: o.timestamp
50
- };
51
- x.set(o.batchId, h);
52
- }
53
- if (o.type === "dispatch") {
54
- const h = x.get(o.batchId);
55
- h && x.set(o.batchId, {
56
- ...h,
57
- keys: o.keys,
58
- status: "dispatching",
59
- dispatchedAt: o.timestamp
60
- });
61
- }
62
- if (o.type === "resolve") {
63
- const h = x.get(o.batchId);
64
- h && x.set(o.batchId, {
65
- ...h,
66
- status: "resolved",
67
- completedAt: o.timestamp,
68
- duration: o.duration
69
- });
70
- }
71
- if (o.type === "error") {
72
- const h = x.get(o.batchId);
73
- h && x.set(o.batchId, {
74
- ...h,
75
- status: "error",
76
- completedAt: o.timestamp,
77
- error: o.error
78
- });
79
- }
80
- if (o.type === "abort") {
81
- const h = x.get(o.batchId);
82
- h && x.set(o.batchId, {
83
- ...h,
84
- status: "aborted",
85
- completedAt: o.timestamp
86
- });
87
- }
88
- return { ...y, events: k, batches: x };
89
- }), r();
90
- }
91
- function s(d) {
92
- return i.add(d), d(a()), () => i.delete(d);
93
- }
94
- function u() {
95
- return a();
96
- }
97
- function v() {
98
- t((d) => ({
99
- ...d,
100
- events: [],
101
- batches: /* @__PURE__ */ new Map()
102
- })), r();
103
- }
104
- function g() {
105
- t((d) => ({ ...d, isOpen: !0 })), r();
106
- }
107
- function $() {
108
- t((d) => ({ ...d, isOpen: !1 })), r();
109
- }
110
- function m() {
111
- t((d) => ({ ...d, isOpen: !d.isOpen })), r();
112
- }
113
- return Ee({
114
- onBatcherCreated({ fn: d, name: p, stack: o }) {
115
- const y = !p, k = p ?? `unnamed-${++Re}`, x = d.toString().slice(0, 500), h = Ne(o);
116
- return e({
117
- name: k,
118
- registeredAt: performance.now(),
119
- isUnnamed: y,
120
- fnSource: x,
121
- location: h
122
- }), (C) => {
123
- l(k, C);
124
- };
125
- }
126
- }), {
127
- subscribe: s,
128
- getStore: u,
129
- clear: v,
130
- open: g,
131
- close: $,
132
- toggle: m,
133
- _setStore: t,
134
- _store: a
135
- };
136
- }
137
- let B = null;
138
- function Fe() {
139
- if (typeof window > "u")
140
- throw new Error("DevTools can only be used in browser environment");
141
- return B || (B = De(() => je())), B;
142
- }
143
- function W() {
144
- if (!B)
145
- throw new Error(
146
- "DevTools registry not initialized. Call initRegistry() first."
147
- );
148
- return B;
149
- }
150
- function Ke() {
151
- const a = W();
152
- if (a._store)
153
- return a._store;
154
- const [t, i] = Z(a.getStore());
155
- return a.subscribe(i), t;
156
- }
157
- function Le(a) {
158
- var t;
159
- B && ((t = B._setStore) == null || t.call(B, (i) => ({
160
- ...i,
161
- selectedBatcher: a
162
- })));
163
- }
164
- var Me = /* @__PURE__ */ S("<div>"), He = /* @__PURE__ */ S("<div><div></div><div><span> gets</span><span> batches"), Ge = /* @__PURE__ */ S("<div><div style=font-size:11px;color:#78716c;margin-bottom:4px>No batchers yet</div><div style=font-size:11px;color:#57534e>Call batch() to see it here");
165
- const Ue = {
166
- flex: "1",
167
- "overflow-y": "auto"
168
- }, ve = {
169
- padding: "8px 12px",
170
- cursor: "pointer",
171
- "border-bottom": "1px solid #292524",
172
- "border-left": "2px solid transparent"
173
- }, We = {
174
- ...ve,
175
- background: "#1c1917",
176
- "border-left-color": "#a8a29e"
177
- }, ge = {
178
- "font-size": "13px",
179
- color: "#d6d3d1",
180
- "margin-bottom": "2px"
181
- }, qe = {
182
- ...ge,
183
- color: "#78716c",
184
- "font-style": "italic"
185
- }, Pe = {
186
- "font-size": "11px",
187
- color: "#78716c"
188
- }, ie = {
189
- display: "inline-flex",
190
- "align-items": "center",
191
- gap: "4px",
192
- "margin-right": "8px"
193
- }, Xe = {
194
- display: "flex",
195
- "flex-direction": "column",
196
- "align-items": "center",
197
- "justify-content": "center",
198
- height: "100%",
199
- color: "#57534e",
200
- "text-align": "center",
201
- padding: "24px 12px"
202
- }, Ye = (a) => {
203
- const t = fe(() => Array.from(a.batchers.values())), i = (e) => {
204
- const l = a.events.filter((v) => v.batcherName === e), s = l.filter((v) => v.type === "get").length, u = l.filter((v) => v.type === "resolve").length;
205
- return {
206
- gets: s,
207
- batches: u
208
- };
209
- }, r = (e) => {
210
- a.selectedBatcher === e ? a.onSelect(null) : a.onSelect(e);
211
- };
212
- return (() => {
213
- var e = Me();
214
- return n(e, Ue), f(e, w(ee, {
215
- get each() {
216
- return t();
217
- },
218
- children: (l) => {
219
- const s = () => i(l.name), u = () => a.selectedBatcher === l.name;
220
- return (() => {
221
- var v = He(), g = v.firstChild, $ = g.nextSibling, m = $.firstChild, _ = m.firstChild, d = m.nextSibling, p = d.firstChild;
222
- return v.$$click = () => r(l.name), f(g, () => l.name), n($, Pe), f(m, () => s().gets, _), f(d, () => s().batches, p), z((o) => {
223
- var y = u() ? We : ve, k = l.isUnnamed ? qe : ge, x = ie, h = ie;
224
- return o.e = n(v, y, o.e), o.t = n(g, k, o.t), o.a = n(m, x, o.a), o.o = n(d, h, o.o), o;
225
- }, {
226
- e: void 0,
227
- t: void 0,
228
- a: void 0,
229
- o: void 0
230
- }), v;
231
- })();
232
- }
233
- }), null), f(e, (() => {
234
- var l = A(() => t().length === 0);
235
- return () => l() && (() => {
236
- var s = Ge(), u = s.firstChild;
237
- return u.nextSibling, n(s, Xe), s;
238
- })();
239
- })(), null), e;
240
- })();
241
- };
242
- V(["click"]);
243
- var Je = /* @__PURE__ */ S("<div>"), Qe = /* @__PURE__ */ S("<div><div style=font-size:11px;color:#78716c;margin-bottom:4px>No batches yet</div><div style=font-size:11px;color:#57534e>Batches appear as requests are processed"), Ve = /* @__PURE__ */ S("<div><div></div><div></div><div></div><div>");
244
- const Ze = {
245
- display: "flex",
246
- "flex-direction": "column",
247
- gap: "1px"
248
- }, et = {
249
- display: "flex",
250
- "align-items": "center",
251
- gap: "12px",
252
- padding: "6px 8px",
253
- background: "#1c1917",
254
- "font-size": "11px"
255
- }, tt = {
256
- "font-size": "11px",
257
- color: "#78716c",
258
- "min-width": "80px"
259
- }, N = {
260
- padding: "2px 6px",
261
- "font-size": "10px",
262
- "font-weight": "500",
263
- "text-transform": "uppercase",
264
- "letter-spacing": "0.3px"
265
- }, nt = {
266
- scheduled: {
267
- ...N,
268
- background: "#422006",
269
- color: "#fbbf24"
270
- },
271
- dispatching: {
272
- ...N,
273
- background: "#1e3a5f",
274
- color: "#60a5fa"
275
- },
276
- resolved: {
277
- ...N,
278
- background: "#14532d",
279
- color: "#4ade80"
280
- },
281
- error: {
282
- ...N,
283
- background: "#450a0a",
284
- color: "#f87171"
285
- },
286
- aborted: {
287
- ...N,
288
- background: "#292524",
289
- color: "#a8a29e"
290
- }
291
- }, rt = {
292
- flex: "1",
293
- "font-size": "11px",
294
- color: "#a8a29e",
295
- "white-space": "nowrap",
296
- overflow: "hidden",
297
- "text-overflow": "ellipsis"
298
- }, it = {
299
- "font-size": "11px",
300
- color: "#57534e",
301
- "min-width": "50px",
302
- "text-align": "right"
303
- }, ot = {
304
- display: "flex",
305
- "flex-direction": "column",
306
- "align-items": "center",
307
- "justify-content": "center",
308
- height: "100%",
309
- color: "#57534e",
310
- "text-align": "center",
311
- padding: "32px"
312
- }, lt = (a) => {
313
- const t = (e) => e === void 0 ? "-" : e < 1 ? "<1ms" : e < 1e3 ? `${Math.round(e)}ms` : `${(e / 1e3).toFixed(2)}s`, i = (e) => {
314
- if (e.length === 0) return "-";
315
- const l = e.slice(0, 3).map((s) => String(s)).join(", ");
316
- return e.length > 3 ? `${l} +${e.length - 3}` : l;
317
- }, r = () => [...a.batches].sort((e, l) => l.scheduledAt - e.scheduledAt);
318
- return (() => {
319
- var e = Je();
320
- return n(e, Ze), f(e, w(j, {
321
- get when() {
322
- return r().length > 0;
323
- },
324
- get fallback() {
325
- return (() => {
326
- var l = Qe(), s = l.firstChild;
327
- return s.nextSibling, n(l, ot), l;
328
- })();
329
- },
330
- get children() {
331
- return w(ee, {
332
- get each() {
333
- return r();
334
- },
335
- children: (l) => (() => {
336
- var s = Ve(), u = s.firstChild, v = u.nextSibling, g = v.nextSibling, $ = g.nextSibling;
337
- return n(s, et), n(u, tt), f(u, () => l.batchId), f(v, () => l.status), n(g, rt), f(g, () => i(l.keys)), n($, it), f($, () => t(l.duration)), z((m) => {
338
- var _ = nt[l.status] || N, d = l.keys.map(String).join(", ");
339
- return m.e = n(v, _, m.e), d !== m.t && Q(g, "title", m.t = d), m;
340
- }, {
341
- e: void 0,
342
- t: void 0
343
- }), s;
344
- })()
345
- });
346
- }
347
- })), e;
348
- })();
349
- };
350
- var st = /* @__PURE__ */ S("<div>"), at = /* @__PURE__ */ S("<div><div style=font-size:11px;color:#78716c;margin-bottom:4px>No events</div><div style=font-size:11px;color:#57534e>Events appear as batchers process requests"), ct = /* @__PURE__ */ S("<div><span></span><span></span><span>");
351
- const dt = {
352
- display: "flex",
353
- "flex-direction": "column",
354
- gap: "1px",
355
- "font-size": "11px"
356
- }, ut = {
357
- display: "flex",
358
- gap: "12px",
359
- padding: "4px 8px",
360
- background: "#1c1917"
361
- }, ft = {
362
- color: "#57534e",
363
- "min-width": "60px"
364
- }, vt = {
365
- "min-width": "60px",
366
- "font-weight": "500"
367
- }, gt = {
368
- get: "#60a5fa",
369
- dedup: "#c084fc",
370
- schedule: "#fbbf24",
371
- dispatch: "#22d3ee",
372
- resolve: "#4ade80",
373
- error: "#f87171",
374
- abort: "#a8a29e"
375
- }, ht = {
376
- color: "#78716c",
377
- flex: "1",
378
- "white-space": "nowrap",
379
- overflow: "hidden",
380
- "text-overflow": "ellipsis"
381
- }, bt = {
382
- display: "flex",
383
- "flex-direction": "column",
384
- "align-items": "center",
385
- "justify-content": "center",
386
- height: "100%",
387
- color: "#57534e",
388
- "text-align": "center",
389
- padding: "32px"
390
- }, xt = (a) => {
391
- const t = (e) => (e / 1e3).toFixed(3) + "s", i = (e) => {
392
- switch (e.type) {
393
- case "get":
394
- return `key: ${String(e.key)}`;
395
- case "dedup":
396
- return `key: ${String(e.key)} (dedup)`;
397
- case "schedule":
398
- return `batch: ${e.batchId}, size: ${e.size}`;
399
- case "dispatch":
400
- return `batch: ${e.batchId}, keys: [${e.keys.map(String).join(", ")}]`;
401
- case "resolve":
402
- return `batch: ${e.batchId}, ${e.duration.toFixed(1)}ms`;
403
- case "error":
404
- return `batch: ${e.batchId}, ${e.error.message}`;
405
- case "abort":
406
- return `batch: ${e.batchId}`;
407
- default:
408
- return "";
409
- }
410
- }, r = () => [...a.events].reverse();
411
- return (() => {
412
- var e = st();
413
- return n(e, dt), f(e, w(j, {
414
- get when() {
415
- return r().length > 0;
416
- },
417
- get fallback() {
418
- return (() => {
419
- var l = at(), s = l.firstChild;
420
- return s.nextSibling, n(l, bt), l;
421
- })();
422
- },
423
- get children() {
424
- return w(ee, {
425
- get each() {
426
- return r();
427
- },
428
- children: (l) => (() => {
429
- var s = ct(), u = s.firstChild, v = u.nextSibling, g = v.nextSibling;
430
- return n(s, ut), n(u, ft), f(u, () => t(l.timestamp)), f(v, () => l.type), n(g, ht), f(g, () => i(l)), z(($) => n(v, {
431
- ...vt,
432
- color: gt[l.type]
433
- }, $)), s;
434
- })()
435
- });
436
- }
437
- })), e;
438
- })();
439
- };
440
- var mt = /* @__PURE__ */ S("<div><div><div>Gets</div><div></div></div><div><div>Batches</div><div></div></div><div><div>Deduped</div><div><span>(<!>%)</span></div></div><div><div>Avg Size</div><div></div></div><div><div>Avg Time</div><div><span>ms</span></div></div><div><div>Err / Abort</div><div><span></span><span style=color:#57534e> / </span><span>");
441
- const pt = {
442
- display: "grid",
443
- "grid-template-columns": "repeat(auto-fit, minmax(120px, 1fr))",
444
- gap: "1px",
445
- background: "#292524"
446
- }, O = {
447
- padding: "12px",
448
- background: "#1c1917"
449
- }, E = {
450
- "font-size": "11px",
451
- "text-transform": "uppercase",
452
- "letter-spacing": "0.5px",
453
- color: "#78716c",
454
- "margin-bottom": "4px"
455
- }, R = {
456
- "font-size": "20px",
457
- "font-weight": "500",
458
- color: "#f5f5f4"
459
- }, oe = {
460
- "font-size": "11px",
461
- color: "#57534e",
462
- "margin-left": "2px"
463
- }, yt = (a) => {
464
- const t = fe(() => {
465
- const i = a.events, r = a.batches, e = i.filter((d) => d.type === "get").length, l = i.filter((d) => d.type === "dedup").length, s = r.filter((d) => d.status === "resolved"), u = s.length, v = u > 0 ? s.reduce((d, p) => d + p.keys.length, 0) / u : 0, g = u > 0 ? s.reduce((d, p) => d + (p.duration || 0), 0) / u : 0, $ = r.filter((d) => d.status === "error").length, m = r.filter((d) => d.status === "aborted").length, _ = e > 0 ? l / e * 100 : 0;
466
- return {
467
- totalGets: e,
468
- totalBatches: u,
469
- dedupedKeys: l,
470
- avgBatchSize: v,
471
- avgDuration: g,
472
- errors: $,
473
- aborts: m,
474
- dedupRate: _
475
- };
476
- });
477
- return (() => {
478
- var i = mt(), r = i.firstChild, e = r.firstChild, l = e.nextSibling, s = r.nextSibling, u = s.firstChild, v = u.nextSibling, g = s.nextSibling, $ = g.firstChild, m = $.nextSibling, _ = m.firstChild, d = _.firstChild, p = d.nextSibling;
479
- p.nextSibling;
480
- var o = g.nextSibling, y = o.firstChild, k = y.nextSibling, x = o.nextSibling, h = x.firstChild, C = h.nextSibling, H = C.firstChild, F = x.nextSibling, I = F.firstChild, D = I.nextSibling, T = D.firstChild, K = T.nextSibling, L = K.nextSibling;
481
- return n(i, pt), f(l, () => t().totalGets), f(v, () => t().totalBatches), f(m, () => t().dedupedKeys, _), f(_, () => t().dedupRate.toFixed(0), p), f(k, () => t().avgBatchSize.toFixed(1)), f(C, () => t().avgDuration.toFixed(0), H), f(T, () => t().errors), f(L, () => t().aborts), z((c) => {
482
- var b = O, G = E, q = R, P = O, X = E, Y = R, J = O, xe = E, me = R, pe = oe, ye = O, Se = E, $e = R, we = O, _e = E, ke = R, Ce = oe, ze = O, Be = E, Te = R, te = t().errors > 0 ? "#f87171" : "#f5f5f4", ne = t().aborts > 0 ? "#fbbf24" : "#f5f5f4";
483
- return c.e = n(r, b, c.e), c.t = n(e, G, c.t), c.a = n(l, q, c.a), c.o = n(s, P, c.o), c.i = n(u, X, c.i), c.n = n(v, Y, c.n), c.s = n(g, J, c.s), c.h = n($, xe, c.h), c.r = n(m, me, c.r), c.d = n(_, pe, c.d), c.l = n(o, ye, c.l), c.u = n(y, Se, c.u), c.c = n(k, $e, c.c), c.w = n(x, we, c.w), c.m = n(h, _e, c.m), c.f = n(C, ke, c.f), c.y = n(H, Ce, c.y), c.g = n(F, ze, c.g), c.p = n(I, Be, c.p), c.b = n(D, Te, c.b), te !== c.T && re(T, "color", c.T = te), ne !== c.A && re(L, "color", c.A = ne), c;
484
- }, {
485
- e: void 0,
486
- t: void 0,
487
- a: void 0,
488
- o: void 0,
489
- i: void 0,
490
- n: void 0,
491
- s: void 0,
492
- h: void 0,
493
- r: void 0,
494
- d: void 0,
495
- l: void 0,
496
- u: void 0,
497
- c: void 0,
498
- w: void 0,
499
- m: void 0,
500
- f: void 0,
501
- y: void 0,
502
- g: void 0,
503
- p: void 0,
504
- b: void 0,
505
- T: void 0,
506
- A: void 0
507
- }), i;
508
- })();
509
- };
510
- var le = /* @__PURE__ */ S("<div>"), St = /* @__PURE__ */ S("<div><div style=font-size:11px;color:#78716c;margin-bottom:4px>No batcher selected</div><div style=font-size:11px;color:#57534e>Click a batcher to see its trace info"), $t = /* @__PURE__ */ S("<div><div>Location</div><div>"), wt = /* @__PURE__ */ S("<div><div>Function</div><div>"), _t = /* @__PURE__ */ S('<div style="height:auto;padding:24px 0"><div style=font-size:11px;color:#57534e>No trace metadata available'), kt = /* @__PURE__ */ S("<span style=color:#78716c;font-weight:normal;font-style:italic> (unnamed)");
511
- const Ct = {
512
- padding: "12px",
513
- height: "100%",
514
- "overflow-y": "auto"
515
- }, se = {
516
- display: "flex",
517
- "flex-direction": "column",
518
- "align-items": "center",
519
- "justify-content": "center",
520
- height: "100%",
521
- color: "#57534e",
522
- "text-align": "center"
523
- }, ae = {
524
- "margin-bottom": "16px"
525
- }, ce = {
526
- color: "#78716c",
527
- "margin-bottom": "6px",
528
- "font-size": "10px",
529
- "text-transform": "uppercase",
530
- "letter-spacing": "0.5px"
531
- }, he = {
532
- background: "#1c1917",
533
- padding: "8px 10px",
534
- "font-size": "11px",
535
- color: "#d6d3d1",
536
- border: "1px solid #292524"
537
- }, zt = {
538
- ...he,
539
- "white-space": "pre-wrap",
540
- "word-break": "break-all",
541
- "max-height": "300px",
542
- "overflow-y": "auto",
543
- "font-family": "ui-monospace, monospace"
544
- }, Bt = {
545
- "font-size": "14px",
546
- "font-weight": "600",
547
- color: "#f5f5f4",
548
- "margin-bottom": "16px"
549
- }, Tt = (a) => (() => {
550
- var t = le();
551
- return n(t, Ct), f(t, w(j, {
552
- get when() {
553
- return a.batcher;
554
- },
555
- get fallback() {
556
- return (() => {
557
- var i = St(), r = i.firstChild;
558
- return r.nextSibling, z((e) => n(i, se, e)), i;
559
- })();
560
- },
561
- children: (i) => [(() => {
562
- var r = le();
563
- return n(r, Bt), f(r, () => i().name, null), f(r, (() => {
564
- var e = A(() => !!i().isUnnamed);
565
- return () => e() && kt();
566
- })(), null), r;
567
- })(), w(j, {
568
- get when() {
569
- return i().location;
570
- },
571
- get children() {
572
- var r = $t(), e = r.firstChild, l = e.nextSibling;
573
- return f(l, () => i().location), z((s) => {
574
- var u = ae, v = ce, g = he;
575
- return s.e = n(r, u, s.e), s.t = n(e, v, s.t), s.a = n(l, g, s.a), s;
576
- }, {
577
- e: void 0,
578
- t: void 0,
579
- a: void 0
580
- }), r;
581
- }
582
- }), w(j, {
583
- get when() {
584
- return i().fnSource;
585
- },
586
- get children() {
587
- var r = wt(), e = r.firstChild, l = e.nextSibling;
588
- return f(l, () => i().fnSource), z((s) => {
589
- var u = ae, v = ce, g = zt;
590
- return s.e = n(r, u, s.e), s.t = n(e, v, s.t), s.a = n(l, g, s.a), s;
591
- }, {
592
- e: void 0,
593
- t: void 0,
594
- a: void 0
595
- }), r;
596
- }
597
- }), w(j, {
598
- get when() {
599
- return A(() => !i().location)() && !i().fnSource;
600
- },
601
- get children() {
602
- var r = _t();
603
- return r.firstChild, z((e) => n(r, {
604
- ...se
605
- }, e)), r;
606
- }
607
- })]
608
- })), t;
609
- })();
610
- var At = /* @__PURE__ */ S("<button>");
611
- const be = {
612
- position: "fixed",
613
- bottom: "16px",
614
- right: "16px",
615
- width: "40px",
616
- height: "40px",
617
- border: "1px solid #44403c",
618
- background: "#1c1917",
619
- color: "#a8a29e",
620
- cursor: "pointer",
621
- display: "flex",
622
- "align-items": "center",
623
- "justify-content": "center",
624
- "z-index": "99999",
625
- "font-family": "ui-monospace, monospace"
626
- }, It = {
627
- ...be,
628
- background: "#292524",
629
- color: "#f5f5f4",
630
- "border-color": "#57534e"
631
- }, Dt = (a) => {
632
- const t = () => ({
633
- ...a.isOpen ? It : be,
634
- ...a.style
635
- });
636
- return (() => {
637
- var i = At();
638
- return Ae(i, "click", a.onClick, !0), f(i, () => a.isOpen ? "[×]" : "[=]"), z((r) => {
639
- var e = a.class, l = t(), s = a.isOpen ? "Close BatchKit DevTools" : "Open BatchKit DevTools", u = a.isOpen ? "Close BatchKit DevTools" : "Open BatchKit DevTools";
640
- return e !== r.e && ue(i, r.e = e), r.t = n(i, l, r.t), s !== r.a && Q(i, "title", r.a = s), u !== r.o && Q(i, "aria-label", r.o = u), r;
641
- }, {
642
- e: void 0,
643
- t: void 0,
644
- a: void 0,
645
- o: void 0
646
- }), i;
647
- })();
648
- };
649
- V(["click"]);
650
- var Ot = /* @__PURE__ */ S("<div><div><div><span style=color:#78716c>[=]</span>Devtools</div><button>Clear</button></div><div><div><div>Batchers</div></div><div><div><button>Timeline</button><button>Events</button><button>Stats</button><button>Trace</button></div><div>");
651
- const de = "650px", Et = "350px", Rt = "0.2s";
652
- function Nt(a) {
653
- const t = {
654
- position: "fixed",
655
- background: "#0c0a09",
656
- "border-color": "#44403c",
657
- "border-style": "solid",
658
- "border-width": "0",
659
- display: "flex",
660
- "flex-direction": "column",
661
- overflow: "hidden",
662
- "z-index": "99998",
663
- "font-family": "ui-monospace, monospace",
664
- color: "#d6d3d1",
665
- transition: `transform ${Rt} ease-out`,
666
- "box-shadow": "0 0 10px 0 rgba(0, 0, 0, 0.1)"
667
- };
668
- switch (a) {
669
- case "right":
670
- return {
671
- ...t,
672
- top: "0",
673
- right: "0",
674
- width: de,
675
- height: "100vh",
676
- "border-left-width": "1px",
677
- "box-shadow": "0 0 10px 0 rgba(0, 0, 0, 0.1)"
678
- };
679
- case "left":
680
- return {
681
- ...t,
682
- top: "0",
683
- left: "0",
684
- width: de,
685
- height: "100vh",
686
- "border-right-width": "1px",
687
- "box-shadow": "0 0 10px 0 rgba(0, 0, 0, 0.1)"
688
- };
689
- case "bottom":
690
- return {
691
- ...t,
692
- bottom: "0",
693
- left: "0",
694
- right: "0",
695
- width: "100%",
696
- height: Et,
697
- "border-top-width": "1px",
698
- "box-shadow": "0 0 10px 0 rgba(0, 0, 0, 0.1)"
699
- };
700
- }
701
- }
702
- function jt(a, t) {
703
- if (t) return "translate(0, 0)";
704
- switch (a) {
705
- case "right":
706
- return "translateX(100%)";
707
- case "left":
708
- return "translateX(-100%)";
709
- case "bottom":
710
- return "translateY(100%)";
711
- }
712
- }
713
- const Ft = {
714
- display: "flex",
715
- "align-items": "center",
716
- "justify-content": "space-between",
717
- padding: "8px 12px",
718
- background: "#1c1917",
719
- "border-bottom": "1px solid #44403c",
720
- "flex-shrink": "0",
721
- "user-select": "none"
722
- }, Kt = {
723
- "font-size": "11px",
724
- "font-weight": "500",
725
- color: "#a8a29e",
726
- display: "flex",
727
- "align-items": "center",
728
- gap: "8px",
729
- "text-transform": "uppercase",
730
- "letter-spacing": "0.5px"
731
- }, Lt = {
732
- padding: "4px 8px",
733
- border: "1px solid #44403c",
734
- background: "#1c1917",
735
- color: "#78716c",
736
- "font-size": "11px",
737
- "font-family": "ui-monospace, monospace",
738
- cursor: "pointer"
739
- }, Mt = {
740
- display: "flex",
741
- flex: "1",
742
- "min-height": "0"
743
- }, Ht = {
744
- width: "160px",
745
- "border-right": "1px solid #44403c",
746
- display: "flex",
747
- "flex-direction": "column",
748
- background: "#0c0a09",
749
- "flex-shrink": "0",
750
- "user-select": "none"
751
- }, Gt = {
752
- padding: "8px 12px",
753
- "font-size": "11px",
754
- "font-weight": "500",
755
- "text-transform": "uppercase",
756
- "letter-spacing": "0.5px",
757
- color: "#78716c",
758
- "border-bottom": "1px solid #292524"
759
- }, Ut = {
760
- flex: "1",
761
- display: "flex",
762
- "flex-direction": "column",
763
- "min-width": "0"
764
- }, Wt = {
765
- display: "flex",
766
- "border-bottom": "1px solid #44403c",
767
- background: "#1c1917",
768
- "flex-shrink": "0",
769
- "user-select": "none"
770
- }, M = {
771
- padding: "8px 12px",
772
- "font-size": "11px",
773
- "font-weight": "500",
774
- color: "#78716c",
775
- cursor: "pointer",
776
- "border-bottom": "1px solid transparent",
777
- "margin-bottom": "-1px",
778
- background: "transparent",
779
- border: "none",
780
- "font-family": "ui-monospace, monospace"
781
- }, U = {
782
- ...M,
783
- color: "#f5f5f4",
784
- "border-bottom": "1px solid #f5f5f4"
785
- }, qt = {
786
- flex: "1",
787
- overflow: "auto",
788
- padding: "12px",
789
- background: "#0c0a09"
790
- }, Pt = (a) => {
791
- const t = Ke(), [i, r] = Z("timeline"), e = () => a.position ?? "right";
792
- Oe(() => {
793
- a.defaultOpen && W().open();
794
- });
795
- const l = () => {
796
- W().toggle();
797
- }, s = () => {
798
- W().clear();
799
- }, u = () => t().selectedBatcher, v = () => t().batchers, g = () => t().events, $ = () => t().batches, m = () => {
800
- const o = u();
801
- return o ? v().get(o) ?? null : null;
802
- }, _ = () => {
803
- const o = u();
804
- return o ? g().filter((y) => y.batcherName === o) : g();
805
- }, d = () => {
806
- const o = u();
807
- return o ? Array.from($().values()).filter((y) => y.batcherName === o) : Array.from($().values());
808
- }, p = () => ({
809
- ...Nt(e()),
810
- transform: jt(e(), t().isOpen),
811
- ...a.panelStyle
812
- });
813
- return [w(Dt, {
814
- get isOpen() {
815
- return t().isOpen;
816
- },
817
- onClick: l,
818
- get style() {
819
- return a.buttonStyle;
820
- },
821
- get class() {
822
- return a.buttonClass;
823
- }
824
- }), (() => {
825
- var o = Ot(), y = o.firstChild, k = y.firstChild;
826
- k.firstChild;
827
- var x = k.nextSibling, h = y.nextSibling, C = h.firstChild, H = C.firstChild, F = C.nextSibling, I = F.firstChild, D = I.firstChild, T = D.nextSibling, K = T.nextSibling, L = K.nextSibling, c = I.nextSibling;
828
- return n(y, Ft), n(k, Kt), x.$$click = s, n(x, Lt), n(h, Mt), n(C, Ht), n(H, Gt), f(C, w(Ye, {
829
- get batchers() {
830
- return v();
831
- },
832
- get events() {
833
- return g();
834
- },
835
- get selectedBatcher() {
836
- return u();
837
- },
838
- onSelect: Le
839
- }), null), n(F, Ut), n(I, Wt), D.$$click = () => r("timeline"), T.$$click = () => r("events"), K.$$click = () => r("stats"), L.$$click = () => r("trace"), n(c, qt), f(c, (() => {
840
- var b = A(() => i() === "timeline");
841
- return () => b() && w(lt, {
842
- get batches() {
843
- return d();
844
- }
845
- });
846
- })(), null), f(c, (() => {
847
- var b = A(() => i() === "events");
848
- return () => b() && w(xt, {
849
- get events() {
850
- return _();
851
- }
852
- });
853
- })(), null), f(c, (() => {
854
- var b = A(() => i() === "stats");
855
- return () => b() && w(yt, {
856
- get events() {
857
- return _();
858
- },
859
- get batches() {
860
- return d();
861
- }
862
- });
863
- })(), null), f(c, (() => {
864
- var b = A(() => i() === "trace");
865
- return () => b() && w(Tt, {
866
- get batcher() {
867
- return m();
868
- }
869
- });
870
- })(), null), z((b) => {
871
- var G = a.panelClass, q = p(), P = i() === "timeline" ? U : M, X = i() === "events" ? U : M, Y = i() === "stats" ? U : M, J = i() === "trace" ? U : M;
872
- return G !== b.e && ue(o, b.e = G), b.t = n(o, q, b.t), b.a = n(D, P, b.a), b.o = n(T, X, b.o), b.i = n(K, Y, b.i), b.n = n(L, J, b.n), b;
873
- }, {
874
- e: void 0,
875
- t: void 0,
876
- a: void 0,
877
- o: void 0,
878
- i: void 0,
879
- n: void 0
880
- }), o;
881
- })()];
882
- };
883
- V(["click"]);
884
- function Qt(a, t) {
885
- if (typeof window > "u")
886
- return () => {
887
- };
888
- Fe();
889
- const i = {
890
- position: t == null ? void 0 : t.position,
891
- defaultOpen: t == null ? void 0 : t.defaultOpen,
892
- buttonStyle: t == null ? void 0 : t.buttonStyle,
893
- buttonClass: t == null ? void 0 : t.buttonClass,
894
- panelStyle: t == null ? void 0 : t.panelStyle,
895
- panelClass: t == null ? void 0 : t.panelClass
896
- };
897
- return Ie(() => Pt(i), a);
898
- }
899
- export {
900
- W as g,
901
- Fe as i,
902
- Qt as m,
903
- Ke as u
904
- };