@scayle/storefront-devtools 0.2.0-alpha.3 → 0.2.0-alpha.5

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.
Files changed (59) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +152 -110
  3. package/dist/_chunks/{coalesce-cmmfn4qq.mjs → coalesce-MEMOF7Fy.mjs} +43 -64
  4. package/dist/index.mjs +7 -14
  5. package/dist/inertia/client/index.mjs +139 -169
  6. package/dist/inertia/core/capture.d.ts.map +1 -1
  7. package/dist/inertia/core/correlator.d.ts +9 -0
  8. package/dist/inertia/core/correlator.d.ts.map +1 -1
  9. package/dist/inertia/core/diff.d.ts.map +1 -1
  10. package/dist/inertia/core/feature-info.d.ts +9 -5
  11. package/dist/inertia/core/feature-info.d.ts.map +1 -1
  12. package/dist/inertia/core/features.d.ts.map +1 -1
  13. package/dist/inertia/core/history-capture.d.ts.map +1 -1
  14. package/dist/inertia/core/interceptors.d.ts.map +1 -1
  15. package/dist/inertia/core/markdown.d.ts.map +1 -1
  16. package/dist/inertia/core/store.d.ts.map +1 -1
  17. package/dist/inertia/core/types.d.ts +0 -1
  18. package/dist/inertia/core/types.d.ts.map +1 -1
  19. package/dist/orpc/client/index.mjs +106 -104
  20. package/dist/orpc/core/capture.d.ts.map +1 -1
  21. package/dist/shared/redact.d.ts +4 -2
  22. package/dist/shared/redact.d.ts.map +1 -1
  23. package/dist/shared/safe-clone.d.ts +2 -1
  24. package/dist/shared/safe-clone.d.ts.map +1 -1
  25. package/dist/ui/assets/App-25PW_NzC.css +1 -0
  26. package/dist/ui/assets/App-BHsYAu8T.js +4 -0
  27. package/dist/ui/assets/{App-jiQKInbo.css → App-BqkxhJv0.css} +1 -1
  28. package/dist/ui/assets/App-CQ-b0jtB.js +5 -0
  29. package/dist/ui/assets/{App-zNpBvDc9.js → App-DAtQapox.js} +1 -1
  30. package/dist/ui/assets/clipboard-Df0gl3GP.js +1 -0
  31. package/dist/ui/assets/{clipboard-BnEeWyfh.css → clipboard-sKCUppVL.css} +1 -1
  32. package/dist/ui/assets/css-lJZLS6R3.js +1 -0
  33. package/dist/ui/assets/html-WzJrCOnD.js +1 -0
  34. package/dist/ui/assets/javascript-CpIGwZ_Y.js +1 -0
  35. package/dist/ui/assets/json-C3WlssX3.js +1 -0
  36. package/dist/ui/assets/panel-channel-BUrhmfqu.js +2 -0
  37. package/dist/ui/assets/panels-8x4hQPoN.css +1 -0
  38. package/dist/ui/assets/panels-C4yKz6cQ.js +2 -0
  39. package/dist/ui/assets/preload-helper-DLPYjEaE.js +2 -0
  40. package/dist/ui/assets/typescript-Bb1J8qyy.js +1 -0
  41. package/dist/ui/assets/vue-CEnfmNPK.js +155 -0
  42. package/dist/ui/panels/index.html +3 -3
  43. package/dist/ui/vue/index.html +2 -2
  44. package/dist/vue-devtools/client/index.mjs +9 -56
  45. package/package.json +17 -16
  46. package/dist/ui/assets/App-BlEKD1MK.js +0 -4
  47. package/dist/ui/assets/App-C5-JscO0.css +0 -1
  48. package/dist/ui/assets/App-VElUrn9P.js +0 -5
  49. package/dist/ui/assets/clipboard-n-T06WI3.js +0 -1
  50. package/dist/ui/assets/css-CaJ9TzKE.js +0 -1
  51. package/dist/ui/assets/html-BHDw6EPc.js +0 -1
  52. package/dist/ui/assets/javascript-Yelw-5ZN.js +0 -1
  53. package/dist/ui/assets/json-CaljABEy.js +0 -1
  54. package/dist/ui/assets/panel-channel-DjMENemf.js +0 -2
  55. package/dist/ui/assets/panels-B4LTsmli.css +0 -1
  56. package/dist/ui/assets/panels-DBGVGkaL.js +0 -2
  57. package/dist/ui/assets/preload-helper-J6bGWMBq.js +0 -2
  58. package/dist/ui/assets/typescript-Utq2Cl8c.js +0 -1
  59. package/dist/ui/assets/vue-BAMMushd.js +0 -155
@@ -1,5 +1,5 @@
1
- import { a as e, c as t, i as n, n as r, o as i, s as a, t as o } from "../../_chunks/coalesce-cmmfn4qq.mjs";
2
- //#region src/inertia/core/features.ts
1
+ import { a as e, c as t, i as n, n as r, o as i, s as a, t as o } from "../../_chunks/coalesce-MEMOF7Fy.mjs";
2
+ // src/inertia/core/features.ts
3
3
  function s(e) {
4
4
  return typeof e == "object" && !!e && Object.keys(e).length > 0;
5
5
  }
@@ -7,59 +7,35 @@ function c(e) {
7
7
  let t = [], n = null;
8
8
  return s(e.deferredProps) ? n = e.deferredProps : s(e.initialDeferredProps) && (n = e.initialDeferredProps), n && t.push({
9
9
  type: "deferred",
10
- label: "DEFERRED",
11
10
  details: { groups: n }
12
11
  }), e.mergeProps?.length && t.push({
13
12
  type: "merge",
14
- label: "MERGE",
15
13
  details: { props: e.mergeProps }
16
14
  }), e.prependProps?.length && t.push({
17
15
  type: "prepend",
18
- label: "PREPEND",
19
16
  details: { props: e.prependProps }
20
17
  }), e.deepMergeProps?.length && t.push({
21
18
  type: "deep-merge",
22
- label: "DEEP MERGE",
23
19
  details: { props: e.deepMergeProps }
24
20
  }), s(e.scrollProps) && t.push({
25
21
  type: "scroll",
26
- label: "SCROLL",
27
22
  details: { props: e.scrollProps }
28
23
  }), s(e.onceProps) && t.push({
29
24
  type: "once",
30
- label: "ONCE",
31
25
  details: { props: e.onceProps }
32
- }), e.encryptHistory && t.push({
33
- type: "encrypted",
34
- label: "ENCRYPTED"
35
- }), e.clearHistory && t.push({
36
- type: "clear-history",
37
- label: "CLEAR HISTORY"
38
- }), s(e.flash) && t.push({
26
+ }), e.encryptHistory && t.push({ type: "encrypted" }), e.clearHistory && t.push({ type: "clear-history" }), s(e.flash) && t.push({
39
27
  type: "flash",
40
- label: "FLASH",
41
28
  details: { flash: e.flash }
42
29
  }), s(e.rememberedState) && t.push({
43
30
  type: "remember",
44
- label: "REMEMBER",
45
31
  details: { keys: Object.keys(e.rememberedState) }
46
32
  }), t;
47
33
  }
48
34
  function l(e, t) {
49
35
  let n = [];
50
- return e.type === "partial" && n.push({
51
- type: "partial",
52
- label: "PARTIAL"
53
- }), n.push(...c(t)), e.type === "prefetch" && n.push({
54
- type: "prefetch",
55
- label: "PREFETCH"
56
- }), !e.events.some((e) => e.name === "inertia:start") && e.startedAt > 0 && e.type !== "client" && n.push({
57
- type: "cached",
58
- label: "CACHED"
59
- }), n;
36
+ return e.type === "partial" && n.push({ type: "partial" }), n.push(...c(t)), e.type === "prefetch" && n.push({ type: "prefetch" }), !e.events.some((e) => e.name === "inertia:start") && e.startedAt > 0 && e.type !== "client" && n.push({ type: "cached" }), n;
60
37
  }
61
- //#endregion
62
- //#region src/inertia/core/url.ts
38
+ // src/inertia/core/url.ts
63
39
  function u(e) {
64
40
  try {
65
41
  let t = new URL(e, "http://localhost");
@@ -68,8 +44,7 @@ function u(e) {
68
44
  return e;
69
45
  }
70
46
  }
71
- //#endregion
72
- //#region src/inertia/core/diagnostics.ts
47
+ // src/inertia/core/diagnostics.ts
73
48
  function d(e) {
74
49
  return e.type === "redirect" && e.status === 409 ? {
75
50
  id: "version-mismatch",
@@ -156,9 +131,8 @@ function v(e) {
156
131
  }
157
132
  return t;
158
133
  }
159
- //#endregion
160
- //#region src/inertia/core/correlator.ts
161
- var y = 10, b = 2e3, x = class {
134
+ // src/inertia/core/correlator.ts
135
+ var y = 10, b = 2e3, x = 100, S = class {
162
136
  nextVisitId = 1;
163
137
  records = /* @__PURE__ */ new Map();
164
138
  sortedRecords = [];
@@ -284,12 +258,12 @@ var y = 10, b = 2e3, x = class {
284
258
  return this.pendingPrefetch = null, this.createPrefetchRecord(n, t.event, e, t.timestamp);
285
259
  }
286
260
  let r = this.resolveByFingerprint(e) ?? this.resolveByActiveId();
287
- return r && r.events.push(e), r;
261
+ return r && this.pushEvent(r, e), r;
288
262
  }
289
263
  handleFinish(e, t, n) {
290
264
  let r = this.resolveByFingerprint(e) ?? this.resolveByActiveId();
291
265
  if (!r) return null;
292
- r.events.push(e), r.finishedAt = n, r.duration = n - r.startedAt;
266
+ this.pushEvent(r, e), r.finishedAt = n, r.duration = n - r.startedAt;
293
267
  let i = this.extractVisit(t);
294
268
  if (i && (r.completed = !!i.completed, r.cancelled = !!i.cancelled, r.interrupted = !!i.interrupted), r.network || this.drainPendingNetwork(r), r.type === "deferred" && (!r.page && this.lastPage && (r.page = this.lastPage, r.features = l(r, this.lastPage)), !r.previousPage && r.parentVisitId)) {
295
269
  let e = this.records.get(r.parentVisitId);
@@ -299,12 +273,12 @@ var y = 10, b = 2e3, x = class {
299
273
  }
300
274
  handleCancel(e) {
301
275
  let t = this.resolveByFingerprint(e) ?? this.resolveByActiveId();
302
- return t ? (t.events.push(e), t.cancelled = !0, t) : null;
276
+ return t ? (this.pushEvent(t, e), t.cancelled = !0, t) : null;
303
277
  }
304
278
  handleNavigate(e, t) {
305
279
  let n = t.page;
306
280
  n && (this.lastPage = n);
307
- let r = this.resolveByActiveId();
281
+ let r = this.resolveByActiveId(t);
308
282
  if (!r && n) {
309
283
  let t = this.nextVisitId++;
310
284
  r = {
@@ -325,12 +299,12 @@ var y = 10, b = 2e3, x = class {
325
299
  }, this.insertRecord(r), this.activeVisitId = t;
326
300
  for (let e of this.records.values()) e.type === "deferred" && e.parentVisitId === void 0 && (e.parentVisitId = t, e.previousPage = n);
327
301
  }
328
- return r ? (r.events.push(e), n && (r.page = n, r.features = l(r, n)), r.finishedAt || (r.finishedAt = e.timestamp, r.duration = e.timestamp - r.startedAt, r.completed = !0), r.diagnostics = v(r), r) : null;
302
+ return r ? (this.pushEvent(r, e), n && (r.page = n, r.features = l(r, n)), r.finishedAt || (r.finishedAt = e.timestamp, r.duration = e.timestamp - r.startedAt, r.completed = !0), r.diagnostics = v(r), r) : null;
329
303
  }
330
304
  handleBeforeUpdate(e, t) {
331
305
  let n = this.resolveByActiveId();
332
306
  if (!n) return null;
333
- n.events.push(e);
307
+ this.pushEvent(n, e);
334
308
  let r = t.page;
335
309
  if (r) {
336
310
  if (this.lastPage) for (let e of this.records.values()) e.type === "deferred" && !e.page && (e.previousPage = this.lastPage);
@@ -339,9 +313,9 @@ var y = 10, b = 2e3, x = class {
339
313
  return n;
340
314
  }
341
315
  handleGenericEvent(e, t) {
342
- let n = this.resolveByFingerprint(e) ?? this.resolveByActiveId();
316
+ let n = this.resolveByFingerprint(e) ?? this.resolveByActiveId(t);
343
317
  if (!n) return null;
344
- if (n.events.push(e), e.name === "inertia:error") n.error = t.errors;
318
+ if (this.pushEvent(n, e), e.name === "inertia:error") n.error = t.errors;
345
319
  else if (e.name === "inertia:httpException") {
346
320
  let e = t.response;
347
321
  if (e && (n.status = e.status, n.status === 409)) {
@@ -362,10 +336,7 @@ var y = 10, b = 2e3, x = class {
362
336
  except: e.except?.length ? e.except : void 0,
363
337
  startedAt: r,
364
338
  events: [t, n],
365
- features: [{
366
- type: "prefetch",
367
- label: "PREFETCH"
368
- }],
339
+ features: [{ type: "prefetch" }],
369
340
  diagnostics: [],
370
341
  cancelled: !1,
371
342
  interrupted: !1,
@@ -400,9 +371,20 @@ var y = 10, b = 2e3, x = class {
400
371
  }
401
372
  return this.records.get(r[0]) ?? null;
402
373
  }
403
- resolveByActiveId() {
374
+ resolveByActiveId(e) {
375
+ let t = e?.visitId;
376
+ if (typeof t == "string") {
377
+ let e = this.recordByInertiaVisitId.get(t);
378
+ if (e) return e;
379
+ }
404
380
  return this.activeVisitId === null ? null : this.records.get(this.activeVisitId) ?? null;
405
381
  }
382
+ pushEvent(e, t) {
383
+ if (e.events.push(t), e.events.length > x) {
384
+ let t = e.events.findIndex((e) => e.name === "inertia:progress");
385
+ t !== -1 && e.events.splice(t, 1);
386
+ }
387
+ }
406
388
  insertRecord(e) {
407
389
  this.records.set(e.visitId, e);
408
390
  let t = this.sortedRecords.length - 1;
@@ -435,7 +417,7 @@ var y = 10, b = 2e3, x = class {
435
417
  "interrupted",
436
418
  "prefetch"
437
419
  ]), n = {};
438
- for (let [r, i] of Object.entries(e)) t.has(r) || i !== !1 && i != null && (Array.isArray(i) && i.length === 0 || (typeof i != "object" || !i || Array.isArray(i) || Object.keys(i).length !== 0) && (n[r] = i));
420
+ for (let [r, i] of Object.entries(e)) t.has(r) || i !== !1 && i != null && (Array.isArray(i) && i.length === 0 || (typeof i != "object" || Array.isArray(i) || Object.keys(i).length !== 0) && (n[r] = i));
439
421
  return Object.keys(n).length > 0 ? n : void 0;
440
422
  }
441
423
  classifyVisitType(e) {
@@ -454,8 +436,8 @@ var y = 10, b = 2e3, x = class {
454
436
  findNestingParentVisitId(e) {
455
437
  return this.sortedRecords.findLast((t) => (e === void 0 || t.url === e) && t.type !== "deferred" && t.type !== "prefetch")?.visitId;
456
438
  }
457
- }, S = t("inertia-devtools-session");
458
- function C(e) {
439
+ }, C = t("inertia-devtools-session");
440
+ function w(e) {
459
441
  return {
460
442
  visitId: e.visitId,
461
443
  type: e.type,
@@ -464,21 +446,20 @@ function C(e) {
464
446
  status: e.status
465
447
  };
466
448
  }
467
- function w(e) {
468
- S.save({
449
+ function T(e) {
450
+ C.save({
469
451
  savedAt: Date.now(),
470
- requests: e.map(C)
452
+ requests: e.map(w)
471
453
  });
472
454
  }
473
- function T() {
474
- return S.load();
475
- }
476
455
  function E() {
477
- S.clear();
456
+ return C.load();
457
+ }
458
+ function D() {
459
+ C.clear();
478
460
  }
479
- //#endregion
480
- //#region src/inertia/core/store.ts
481
- var D = class {
461
+ // src/inertia/core/store.ts
462
+ var O = { redactKey: n }, k = class {
482
463
  correlator;
483
464
  subscribers = /* @__PURE__ */ new Set();
484
465
  nextEventId = 1;
@@ -487,7 +468,7 @@ var D = class {
487
468
  previousSession = null;
488
469
  saveTimer;
489
470
  constructor() {
490
- this.correlator = new x(), this.previousSession = T();
471
+ this.correlator = new S(), this.previousSession = E();
491
472
  }
492
473
  get requests() {
493
474
  return this.correlator.getRequests().slice();
@@ -521,25 +502,30 @@ var D = class {
521
502
  }
522
503
  captureEvent(e, t) {
523
504
  if (this._paused || !(t instanceof CustomEvent)) return;
524
- let n = a(t.detail), r = {
505
+ let n = a(t.detail, O), r = t.detail?.errors;
506
+ e === "inertia:error" && r !== void 0 && (n.errors = i(r));
507
+ let o = {
525
508
  id: this.nextEventId++,
526
509
  name: e,
527
510
  timestamp: performance.now(),
528
511
  detail: n
529
512
  };
530
- this.correlator.processEvent(r), this.notify();
513
+ this.correlator.processEvent(o), this.notify();
531
514
  }
532
515
  captureNetworkTiming(e) {
533
516
  this._paused || (this.correlator.linkNetworkTiming(e), this.notify());
534
517
  }
535
- captureInterceptedRequest(e, t) {
536
- this._paused || (this.correlator.attachRequestHeaders(e, t), this.notify());
518
+ captureInterceptedRequest(t, n) {
519
+ this._paused || (this.correlator.attachRequestHeaders(t, e(n)), this.notify());
537
520
  }
538
- captureInterceptedResponse(e, t) {
539
- this._paused || (this.correlator.attachResponseData(e, t), this.notify());
521
+ captureInterceptedResponse(t, n) {
522
+ this._paused || (this.correlator.attachResponseData(t, {
523
+ headers: e(n.headers),
524
+ props: n.props ? i(n.props, O) : void 0
525
+ }), this.notify());
540
526
  }
541
527
  captureClientVisit(e, t, n) {
542
- this._paused || (this.correlator.processClientVisit(e, t, n), this.notify());
528
+ this._paused || (this.correlator.processClientVisit(e, i(t, O), n), this.notify());
543
529
  }
544
530
  subscribe(e) {
545
531
  return this.subscribers.add(e), () => {
@@ -550,7 +536,7 @@ var D = class {
550
536
  this._paused = e, this.notify();
551
537
  }
552
538
  clear() {
553
- this.correlator.clear(), this.nextEventId = 1, E(), this.previousSession = null, this.notify();
539
+ this.correlator.clear(), this.nextEventId = 1, D(), this.previousSession = null, this.notify();
554
540
  }
555
541
  notify() {
556
542
  this.tick++;
@@ -560,9 +546,9 @@ var D = class {
560
546
  } catch (e) {
561
547
  console.warn("[storefront-devtools] Subscriber error:", e);
562
548
  }
563
- clearTimeout(this.saveTimer), this.saveTimer = setTimeout(() => w(this.requests), 1e3);
549
+ clearTimeout(this.saveTimer), this.saveTimer = setTimeout(() => T(this.requests), 1e3);
564
550
  }
565
- }, O = [
551
+ }, A = [
566
552
  "inertia:before",
567
553
  "inertia:start",
568
554
  "inertia:progress",
@@ -578,11 +564,10 @@ var D = class {
578
564
  "inertia:prefetching",
579
565
  "inertia:prefetched"
580
566
  ];
581
- //#endregion
582
- //#region src/inertia/core/capture.ts
583
- function k(e) {
567
+ // src/inertia/core/capture.ts
568
+ function j(e) {
584
569
  let t = [];
585
- for (let n of O) {
570
+ for (let n of A) {
586
571
  let r = (t) => {
587
572
  try {
588
573
  e.captureEvent(n, t);
@@ -596,15 +581,14 @@ function k(e) {
596
581
  t.forEach((e) => e());
597
582
  };
598
583
  }
599
- //#endregion
600
- //#region src/inertia/core/diff.ts
601
- function A(e) {
584
+ // src/inertia/core/diff.ts
585
+ function M(e) {
602
586
  return typeof e == "object" && !!e && !Array.isArray(e);
603
587
  }
604
- function j(e, t) {
605
- return M(e, t, /* @__PURE__ */ new WeakSet());
588
+ function N(e, t) {
589
+ return P(e, t, /* @__PURE__ */ new WeakSet());
606
590
  }
607
- function M(e, t, n) {
591
+ function P(e, t, n) {
608
592
  if (e === t) return !0;
609
593
  if (e === null || t === null || typeof e != typeof t) return !1;
610
594
  if (typeof e == "object") {
@@ -612,19 +596,18 @@ function M(e, t, n) {
612
596
  n.add(e), n.add(t);
613
597
  }
614
598
  try {
615
- if (Array.isArray(e) && Array.isArray(t)) return e.length === t.length && e.every((e, r) => M(e, t[r], n));
616
- if (A(e) && A(t)) {
599
+ if (Array.isArray(e) && Array.isArray(t)) return e.length === t.length && e.every((e, r) => P(e, t[r], n));
600
+ if (M(e) && M(t)) {
617
601
  let r = Object.keys(e), i = Object.keys(t);
618
- return r.length === i.length && r.every((r) => M(e[r], t[r], n));
602
+ return r.length === i.length && r.every((r) => P(e[r], t[r], n));
619
603
  }
620
604
  return !1;
621
605
  } finally {
622
606
  typeof e == "object" && (n.delete(e), n.delete(t));
623
607
  }
624
608
  }
625
- //#endregion
626
- //#region src/inertia/core/history-capture.ts
627
- function N(e) {
609
+ // src/inertia/core/history-capture.ts
610
+ function F(e) {
628
611
  if (typeof e != "object" || !e) return null;
629
612
  let t = e;
630
613
  if (!("page" in t)) return null;
@@ -633,63 +616,59 @@ function N(e) {
633
616
  let n = t.page;
634
617
  return typeof n.component != "string" || typeof n.props != "object" ? null : t.page;
635
618
  }
636
- function P(e, t) {
637
- return e.url !== t.url || e.component !== t.component || !j(e.props, t.props) || !j(e.flash, t.flash);
619
+ function I(e, t) {
620
+ return e.url !== t.url || e.component !== t.component || !N(e.props, t.props) || !N(e.flash, t.flash);
638
621
  }
639
- function F(e) {
622
+ function L(e) {
640
623
  if (typeof window > "u") return () => {};
641
- let t = history.pushState.bind(history), n = history.replaceState.bind(history), r = 0, i = (e) => {
642
- e.detail?.visit?.prefetch || r++;
643
- }, a = (e) => {
624
+ let t = history.pushState.bind(history), r = history.replaceState.bind(history), a = /* @__PURE__ */ new Set(), o = (e) => {
625
+ let t = e.detail?.visit;
626
+ if (t?.prefetch || typeof t?.id != "string") return;
627
+ let { id: n } = t;
628
+ a.add(n), queueMicrotask(() => {
629
+ e.defaultPrevented && a.delete(n);
630
+ });
631
+ }, s = (e) => {
644
632
  let t = e.detail?.visit;
645
- t && (t.cancelled || t.interrupted) && r > 0 && r--;
633
+ t?.prefetch || typeof t?.id != "string" || a.delete(t.id);
646
634
  };
647
- document.addEventListener("inertia:before", i), document.addEventListener("inertia:finish", a);
648
- function o(t, n, r) {
635
+ document.addEventListener("inertia:before", o), document.addEventListener("inertia:finish", s);
636
+ function c(t, n, r) {
649
637
  try {
650
638
  e.captureClientVisit(t === "pushState" ? "push" : "replace", n, r);
651
639
  } catch (e) {
652
640
  console.error("[storefront-devtools] Error in history capture", e);
653
641
  }
654
642
  }
655
- function s(t, n) {
643
+ function l(t, n) {
644
+ let r = a.size > 0;
656
645
  setTimeout(() => {
657
- let r = e.currentPage;
658
- r && P(n, r) && o(t, r, n);
646
+ let i = e.currentPage;
647
+ i && I(n, i) && (r || c(t, i, n));
659
648
  }, 0);
660
649
  }
661
- function c(t, n) {
662
- let i = N(n);
663
- if (!i) return;
664
- let a = e.currentPage;
665
- if (a) {
666
- if (i === "encrypted") {
667
- if (r > 0) {
668
- r--;
669
- return;
670
- }
671
- s(t, a);
672
- } else {
673
- if (r > 0) {
674
- r--;
675
- return;
676
- }
677
- if (!P(a, i)) return;
678
- o(t, i, a);
679
- }
650
+ function u(t, r) {
651
+ let o = F(r);
652
+ if (!o) return;
653
+ let s = e.currentPage;
654
+ if (!s) return;
655
+ if (o === "encrypted") {
656
+ l(t, s);
657
+ return;
680
658
  }
659
+ let u = i(o, { redactKey: n });
660
+ I(s, u) && (a.size > 0 || c(t, u, s));
681
661
  }
682
662
  return history.pushState = function(e, n, r) {
683
- t(e, n, r), c("pushState", e);
684
- }, history.replaceState = function(e, t, r) {
685
- n(e, t, r), c("replaceState", e);
663
+ t(e, n, r), u("pushState", e);
664
+ }, history.replaceState = function(e, t, n) {
665
+ r(e, t, n), u("replaceState", e);
686
666
  }, () => {
687
- history.pushState = t, history.replaceState = n, document.removeEventListener("inertia:before", i), document.removeEventListener("inertia:finish", a);
667
+ history.pushState = t, history.replaceState = r, document.removeEventListener("inertia:before", o), document.removeEventListener("inertia:finish", s);
688
668
  };
689
669
  }
690
- //#endregion
691
- //#region src/inertia/core/network.ts
692
- function I(e, t) {
670
+ // src/inertia/core/network.ts
671
+ function R(e, t) {
693
672
  if (typeof PerformanceObserver > "u") return () => {};
694
673
  let n = new PerformanceObserver((n) => {
695
674
  for (let r of n.getEntries()) {
@@ -712,15 +691,14 @@ function I(e, t) {
712
691
  buffered: !1
713
692
  }), () => n.disconnect();
714
693
  }
715
- //#endregion
716
- //#region src/inertia/core/interceptors.ts
717
- function L(e) {
694
+ // src/inertia/core/interceptors.ts
695
+ function z(e) {
718
696
  if (!e) return {};
719
697
  let t = {};
720
698
  for (let [n, r] of Object.entries(e)) t[n.toLowerCase()] = String(r);
721
699
  return t;
722
700
  }
723
- function R(e) {
701
+ function B(e) {
724
702
  let t = typeof e == "string" ? (() => {
725
703
  try {
726
704
  return JSON.parse(e);
@@ -730,52 +708,46 @@ function R(e) {
730
708
  })() : e;
731
709
  if (typeof t == "object" && t && "props" in t && typeof t.props == "object" && t.props !== null) return t.props;
732
710
  }
733
- var z = 100, B = 1e4;
734
- function V(t, r) {
735
- let a = t.onVisitRequest((t, n) => {
711
+ var V = 100, H = 1e4;
712
+ function U(e, t) {
713
+ let n = e.onVisitRequest((e, n) => {
736
714
  try {
737
- let i = L(n.headers);
738
- r.captureInterceptedRequest(t.id, e(i));
715
+ let r = z(n.headers);
716
+ t.captureInterceptedRequest(e.id, r);
739
717
  } catch (e) {
740
718
  console.error("[storefront-devtools] Error capturing intercepted request", e);
741
719
  }
742
720
  return n;
743
- }), o = t.onVisitResponse((t, a) => {
721
+ }), r = e.onVisitResponse((e, n) => {
744
722
  try {
745
- let o = L(a.headers), s = R(a.data);
746
- r.captureInterceptedResponse(t.id, {
747
- headers: e(o),
748
- props: s ? i(s, { redactKey: n }) : void 0
723
+ let r = z(n.headers);
724
+ t.captureInterceptedResponse(e.id, {
725
+ headers: r,
726
+ props: B(n.data)
749
727
  });
750
728
  } catch (e) {
751
729
  console.error("[storefront-devtools] Error capturing intercepted response", e);
752
730
  }
753
- return a;
731
+ return n;
754
732
  });
755
733
  return () => {
756
- a(), o();
734
+ n(), r();
757
735
  };
758
736
  }
759
- function H(e) {
737
+ function W(e) {
760
738
  if (typeof window > "u") return () => {};
761
- if (window.__inertia_interceptors__) return V(window.__inertia_interceptors__, e);
739
+ if (window.__inertia_interceptors__) return U(window.__inertia_interceptors__, e);
762
740
  let t, n = Date.now(), r = setInterval(() => {
763
- if (window.__inertia_interceptors__) {
764
- clearInterval(r), t = V(window.__inertia_interceptors__, e);
765
- return;
766
- }
767
- Date.now() - n > B && clearInterval(r);
768
- }, z);
741
+ window.__inertia_interceptors__ ? (clearInterval(r), t = U(window.__inertia_interceptors__, e)) : Date.now() - n > H && clearInterval(r);
742
+ }, V);
769
743
  return () => {
770
744
  clearInterval(r), t?.();
771
745
  };
772
746
  }
773
- //#endregion
774
- //#region src/inertia/channel.ts
775
- var U = "storefront-devtools:inertia", W = "storefront-devtools:storefront";
776
- //#endregion
777
- //#region src/inertia/client/publish.ts
778
- function G(e) {
747
+ // src/inertia/channel.ts
748
+ var G = "storefront-devtools:inertia", K = "storefront-devtools:storefront";
749
+ // src/inertia/client/publish.ts
750
+ function q(e) {
779
751
  let { requests: t, currentPage: n, evictedCount: r, paused: i } = e.getState();
780
752
  return {
781
753
  requests: t,
@@ -785,12 +757,12 @@ function G(e) {
785
757
  previousSession: e.previousSessionRequests
786
758
  };
787
759
  }
788
- function K(e, t = {}) {
760
+ function J(e, t = {}) {
789
761
  let n = r({
790
762
  ...t,
791
- name: U,
763
+ name: G,
792
764
  functions: {
793
- getState: { handler: () => G(e) },
765
+ getState: { handler: () => q(e) },
794
766
  clear: {
795
767
  type: "action",
796
768
  handler: () => e.clear()
@@ -803,29 +775,27 @@ function K(e, t = {}) {
803
775
  events: {}
804
776
  }), i = () => ({ currentPage: e.currentPage }), a = r({
805
777
  ...t,
806
- name: W,
778
+ name: K,
807
779
  functions: { getState: { handler: i } },
808
780
  events: {}
809
781
  });
810
782
  n.events.on("panel:connected", () => {
811
- n.emit("state", G(e));
783
+ n.emit("state", q(e));
812
784
  }), a.events.on("panel:connected", () => {
813
785
  a.emit("state", i());
814
786
  });
815
787
  let s = e.currentPage;
816
788
  return e.subscribe(o(() => {
817
- n.emit("state", G(e)), e.currentPage !== s && (s = e.currentPage, a.emit("state", i()));
789
+ n.emit("state", q(e)), e.currentPage !== s && (s = e.currentPage, a.emit("state", i()));
818
790
  }, 16)), {
819
791
  inertia: n,
820
792
  storefront: a
821
793
  };
822
794
  }
823
- //#endregion
824
- //#region src/inertia/client/index.ts
825
- var q = Symbol.for("@scayle/storefront-devtools/inertia"), J = globalThis;
826
- if (typeof window < "u" && typeof document < "u" && !J[q]) {
827
- J[q] = !0;
828
- let e = new D();
829
- k(e), F(e), I((t) => e.isInertiaRequestUrl(t), (t) => e.captureNetworkTiming(t)), H(e), K(e);
795
+ // src/inertia/client/index.ts
796
+ var Y = Symbol.for("@scayle/storefront-devtools/inertia"), X = globalThis;
797
+ if (typeof window < "u" && typeof document < "u" && !X[Y]) {
798
+ X[Y] = !0;
799
+ let e = new k();
800
+ j(e), L(e), R((t) => e.isInertiaRequestUrl(t), (t) => e.captureNetworkTiming(t)), W(e), J(e);
830
801
  }
831
- //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../../src/inertia/core/capture.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,CAkB/D"}
1
+ {"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../../src/inertia/core/capture.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,CAkB/D"}
@@ -70,7 +70,16 @@ export declare class Correlator {
70
70
  private pushFingerprint;
71
71
  private removeFromFingerprintMap;
72
72
  private resolveByFingerprint;
73
+ /**
74
+ * Finds the record an event belongs to when the event carries no `visit`.
75
+ *
76
+ * `inertia:navigate`, `inertia:success`, and `inertia:error` carry the id of
77
+ * the visit that produced them, which stays correct when visits overlap.
78
+ * Without it (`beforeUpdate`, `progress`, `flash`), the most recently
79
+ * started visit is the best available guess.
80
+ */
73
81
  private resolveByActiveId;
82
+ private pushEvent;
74
83
  private insertRecord;
75
84
  private evictOldest;
76
85
  private removeFromInertiaVisitIdMap;
@@ -1 +1 @@
1
- {"version":3,"file":"correlator.d.ts","sourceRoot":"","sources":["../../../src/inertia/core/correlator.ts"],"names":[],"mappings":"AAAA,OAAO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G,SAAS,EAC3C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC1C,QAAQ,EAAE,CA6CZ;AA0DD;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAEzD"}
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../src/inertia/core/diff.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,8DAA8D;AAC9D,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAA;AAE/E,mFAAmF;AACnF,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,QAAQ,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAA;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC3C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC1C,QAAQ,EAAE,CA6CZ;AAuDD;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAEzD"}
@@ -1,14 +1,18 @@
1
- /** Human description and documentation link for an Inertia feature badge. */
1
+ import { ActiveFeature } from './types';
2
+ /** Badge label, description and documentation link for an Inertia feature. */
2
3
  export interface FeatureInfo {
4
+ /** Display label for the feature badge. */
5
+ label: string;
3
6
  description: string;
4
7
  docsUrl: string;
5
8
  }
9
+ export declare const FEATURE_INFO: Record<ActiveFeature['type'], FeatureInfo>;
6
10
  /**
7
- * Looks up the description and documentation link for an Inertia feature type.
11
+ * Retrieves the badge label, description and documentation link for an Inertia feature type.
8
12
  * Used by the feature badges and the markdown exporter.
9
13
  *
10
- * @param type - The `ActiveFeature['type']` value, for example `partial`.
11
- * @returns The matching {@link FeatureInfo}, or `undefined` for unknown types.
14
+ * @param type - The feature type, for example `partial`.
15
+ * @returns The matching {@link FeatureInfo}.
12
16
  */
13
- export declare function getFeatureInfo(type: string): FeatureInfo | undefined;
17
+ export declare function getFeatureInfo(type: ActiveFeature['type']): FeatureInfo;
14
18
  //# sourceMappingURL=feature-info.d.ts.map