@pie-players/pie-section-player-tools-event-debugger 0.3.11 → 0.3.13
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/EventPanel.svelte +121 -227
- package/dist/section-player-tools-event-debugger.js +1680 -1514
- package/package.json +3 -3
package/EventPanel.svelte
CHANGED
|
@@ -13,15 +13,12 @@
|
|
|
13
13
|
|
|
14
14
|
<script lang="ts">
|
|
15
15
|
import "@pie-players/pie-theme/components.css";
|
|
16
|
-
import
|
|
17
|
-
import PanelWindowControls from "@pie-players/pie-section-player-tools-shared/PanelWindowControls.svelte";
|
|
16
|
+
import SharedFloatingPanel from "@pie-players/pie-section-player-tools-shared/SharedFloatingPanel.svelte";
|
|
18
17
|
import {
|
|
19
|
-
computePanelSizeFromViewport,
|
|
20
|
-
createFloatingPanelPointerController,
|
|
21
18
|
getSectionControllerFromCoordinator,
|
|
22
19
|
isMatchingSectionControllerLifecycleEvent,
|
|
23
20
|
} from "@pie-players/pie-section-player-tools-shared";
|
|
24
|
-
import { createEventDispatcher, onDestroy,
|
|
21
|
+
import { createEventDispatcher, onDestroy, untrack } from "svelte";
|
|
25
22
|
|
|
26
23
|
type ControllerEvent = {
|
|
27
24
|
type?: string;
|
|
@@ -101,11 +98,6 @@
|
|
|
101
98
|
sectionId?: string;
|
|
102
99
|
attemptId?: string;
|
|
103
100
|
} = $props();
|
|
104
|
-
let panelX = $state(380);
|
|
105
|
-
let panelY = $state(100);
|
|
106
|
-
let panelWidth = $state(500);
|
|
107
|
-
let panelHeight = $state(620);
|
|
108
|
-
let isMinimized = $state(false);
|
|
109
101
|
let isPaused = $state(false);
|
|
110
102
|
let selectedLevel = $state<EventLevel>("item");
|
|
111
103
|
let selectedRecordId = $state<number | null>(null);
|
|
@@ -357,28 +349,6 @@
|
|
|
357
349
|
});
|
|
358
350
|
}
|
|
359
351
|
|
|
360
|
-
const pointerController = createFloatingPanelPointerController({
|
|
361
|
-
getState: () => ({
|
|
362
|
-
x: panelX,
|
|
363
|
-
y: panelY,
|
|
364
|
-
width: panelWidth,
|
|
365
|
-
height: panelHeight,
|
|
366
|
-
}),
|
|
367
|
-
setState: (next: {
|
|
368
|
-
x: number;
|
|
369
|
-
y: number;
|
|
370
|
-
width: number;
|
|
371
|
-
height: number;
|
|
372
|
-
}) => {
|
|
373
|
-
panelX = next.x;
|
|
374
|
-
panelY = next.y;
|
|
375
|
-
panelWidth = next.width;
|
|
376
|
-
panelHeight = next.height;
|
|
377
|
-
},
|
|
378
|
-
minWidth: 340,
|
|
379
|
-
minHeight: 260,
|
|
380
|
-
});
|
|
381
|
-
|
|
382
352
|
function clearRecords() {
|
|
383
353
|
records = [];
|
|
384
354
|
selectedRecordId = null;
|
|
@@ -407,28 +377,6 @@
|
|
|
407
377
|
() => visibleRecords.find((record) => record.id === selectedRecordId) || visibleRecords[0] || null,
|
|
408
378
|
);
|
|
409
379
|
|
|
410
|
-
onMount(() => {
|
|
411
|
-
const initial = computePanelSizeFromViewport(
|
|
412
|
-
{ width: window.innerWidth, height: window.innerHeight },
|
|
413
|
-
{
|
|
414
|
-
widthRatio: 0.34,
|
|
415
|
-
heightRatio: 0.74,
|
|
416
|
-
minWidth: 380,
|
|
417
|
-
maxWidth: 720,
|
|
418
|
-
minHeight: 360,
|
|
419
|
-
maxHeight: 860,
|
|
420
|
-
alignX: "right",
|
|
421
|
-
alignY: "center",
|
|
422
|
-
paddingX: 16,
|
|
423
|
-
paddingY: 16,
|
|
424
|
-
},
|
|
425
|
-
);
|
|
426
|
-
panelX = initial.x;
|
|
427
|
-
panelY = initial.y;
|
|
428
|
-
panelWidth = initial.width;
|
|
429
|
-
panelHeight = initial.height;
|
|
430
|
-
});
|
|
431
|
-
|
|
432
380
|
$effect(() => {
|
|
433
381
|
void toolkitCoordinator;
|
|
434
382
|
void sectionId;
|
|
@@ -469,24 +417,33 @@
|
|
|
469
417
|
});
|
|
470
418
|
|
|
471
419
|
onDestroy(() => {
|
|
472
|
-
pointerController.stop();
|
|
473
420
|
detachControllerSubscription();
|
|
474
421
|
detachLifecycleSubscription();
|
|
475
422
|
});
|
|
476
423
|
</script>
|
|
477
424
|
|
|
478
|
-
<
|
|
479
|
-
|
|
480
|
-
|
|
425
|
+
<SharedFloatingPanel
|
|
426
|
+
title="Controller Events"
|
|
427
|
+
ariaLabel="Drag event debugger panel"
|
|
428
|
+
minWidth={360}
|
|
429
|
+
minHeight={280}
|
|
430
|
+
initialSizing={{
|
|
431
|
+
widthRatio: 0.34,
|
|
432
|
+
heightRatio: 0.74,
|
|
433
|
+
minWidth: 380,
|
|
434
|
+
maxWidth: 720,
|
|
435
|
+
minHeight: 360,
|
|
436
|
+
maxHeight: 860,
|
|
437
|
+
alignX: "right",
|
|
438
|
+
alignY: "center",
|
|
439
|
+
paddingX: 16,
|
|
440
|
+
paddingY: 16,
|
|
441
|
+
}}
|
|
442
|
+
className="pie-section-player-tools-event-debugger"
|
|
443
|
+
bodyClass="pie-section-player-tools-event-debugger__content-shell"
|
|
444
|
+
onClose={() => dispatch("close")}
|
|
481
445
|
>
|
|
482
|
-
<
|
|
483
|
-
class="pie-section-player-tools-event-debugger__header"
|
|
484
|
-
onmousedown={(event: MouseEvent) => pointerController.startDrag(event)}
|
|
485
|
-
role="button"
|
|
486
|
-
tabindex="0"
|
|
487
|
-
aria-label="Drag event debugger panel"
|
|
488
|
-
>
|
|
489
|
-
<div class="pie-section-player-tools-event-debugger__header-title">
|
|
446
|
+
<svelte:fragment slot="icon">
|
|
490
447
|
<svg
|
|
491
448
|
xmlns="http://www.w3.org/2000/svg"
|
|
492
449
|
class="pie-section-player-tools-event-debugger__icon-sm"
|
|
@@ -496,183 +453,120 @@
|
|
|
496
453
|
>
|
|
497
454
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 10h8M8 14h5m-7 7h12a2 2 0 002-2V5a2 2 0 00-2-2H6a2 2 0 00-2 2v14a2 2 0 002 2z" />
|
|
498
455
|
</svg>
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
456
|
+
</svelte:fragment>
|
|
457
|
+
|
|
458
|
+
<div class="pie-section-player-tools-event-debugger__toolbar">
|
|
459
|
+
<div
|
|
460
|
+
class="pie-section-player-tools-event-debugger__toggle-group"
|
|
461
|
+
role="group"
|
|
462
|
+
aria-label="Event level filter"
|
|
463
|
+
>
|
|
464
|
+
<button
|
|
465
|
+
class="pie-section-player-tools-event-debugger__toggle-button"
|
|
466
|
+
class:pie-section-player-tools-event-debugger__toggle-button--active={selectedLevel ===
|
|
467
|
+
"item"}
|
|
468
|
+
onclick={() => (selectedLevel = "item")}
|
|
469
|
+
aria-pressed={selectedLevel === "item"}
|
|
470
|
+
>
|
|
471
|
+
item
|
|
472
|
+
</button>
|
|
473
|
+
<button
|
|
474
|
+
class="pie-section-player-tools-event-debugger__toggle-button"
|
|
475
|
+
class:pie-section-player-tools-event-debugger__toggle-button--active={selectedLevel ===
|
|
476
|
+
"section"}
|
|
477
|
+
onclick={() => (selectedLevel = "section")}
|
|
478
|
+
aria-pressed={selectedLevel === "section"}
|
|
479
|
+
>
|
|
480
|
+
section
|
|
481
|
+
</button>
|
|
507
482
|
</div>
|
|
483
|
+
<button class="pie-section-player-tools-event-debugger__button" onclick={() => (isPaused = !isPaused)}>
|
|
484
|
+
{isPaused ? "resume" : "pause"}
|
|
485
|
+
</button>
|
|
486
|
+
<button class="pie-section-player-tools-event-debugger__button" onclick={clearRecords}>
|
|
487
|
+
clear
|
|
488
|
+
</button>
|
|
489
|
+
{#if !controllerAvailable}
|
|
490
|
+
<span class="pie-section-player-tools-event-debugger__status">
|
|
491
|
+
controller unavailable
|
|
492
|
+
</span>
|
|
493
|
+
{/if}
|
|
508
494
|
</div>
|
|
509
495
|
|
|
510
|
-
|
|
511
|
-
<div class="pie-section-player-tools-event-
|
|
512
|
-
|
|
513
|
-
<div
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
<button
|
|
519
|
-
class="pie-section-player-tools-event-debugger__toggle-button"
|
|
520
|
-
class:pie-section-player-tools-event-debugger__toggle-button--active={selectedLevel ===
|
|
521
|
-
"item"}
|
|
522
|
-
onclick={() => (selectedLevel = "item")}
|
|
523
|
-
aria-pressed={selectedLevel === "item"}
|
|
524
|
-
>
|
|
525
|
-
item
|
|
526
|
-
</button>
|
|
496
|
+
<div class="pie-section-player-tools-event-debugger__grid">
|
|
497
|
+
<div class="pie-section-player-tools-event-debugger__list">
|
|
498
|
+
{#if visibleRecords.length === 0}
|
|
499
|
+
<div class="pie-section-player-tools-event-debugger__empty">
|
|
500
|
+
No matching events yet. Interact with an item to capture controller events.
|
|
501
|
+
</div>
|
|
502
|
+
{:else}
|
|
503
|
+
{#each visibleRecords as record (record.id)}
|
|
527
504
|
<button
|
|
528
|
-
class="pie-section-player-tools-event-
|
|
529
|
-
class:pie-section-player-tools-event-
|
|
530
|
-
|
|
531
|
-
onclick={() => (
|
|
532
|
-
aria-pressed={selectedLevel === "section"}
|
|
505
|
+
class="pie-section-player-tools-event-debugger__row"
|
|
506
|
+
class:pie-section-player-tools-event-debugger__row--active={selectedRecord?.id ===
|
|
507
|
+
record.id}
|
|
508
|
+
onclick={() => (selectedRecordId = record.id)}
|
|
533
509
|
>
|
|
534
|
-
section
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
</button>
|
|
540
|
-
<button class="pie-section-player-tools-event-debugger__button" onclick={clearRecords}>
|
|
541
|
-
clear
|
|
542
|
-
</button>
|
|
543
|
-
{#if !controllerAvailable}
|
|
544
|
-
<span class="pie-section-player-tools-event-debugger__status">
|
|
545
|
-
controller unavailable
|
|
546
|
-
</span>
|
|
547
|
-
{/if}
|
|
548
|
-
</div>
|
|
549
|
-
|
|
550
|
-
<div class="pie-section-player-tools-event-debugger__grid">
|
|
551
|
-
<div class="pie-section-player-tools-event-debugger__list">
|
|
552
|
-
{#if visibleRecords.length === 0}
|
|
553
|
-
<div class="pie-section-player-tools-event-debugger__empty">
|
|
554
|
-
No matching events yet. Interact with an item to capture controller events.
|
|
555
|
-
</div>
|
|
556
|
-
{:else}
|
|
557
|
-
{#each visibleRecords as record (record.id)}
|
|
558
|
-
<button
|
|
559
|
-
class="pie-section-player-tools-event-debugger__row"
|
|
560
|
-
class:pie-section-player-tools-event-debugger__row--active={selectedRecord?.id ===
|
|
561
|
-
record.id}
|
|
562
|
-
onclick={() => (selectedRecordId = record.id)}
|
|
563
|
-
>
|
|
564
|
-
<div class="pie-section-player-tools-event-debugger__row-top">
|
|
565
|
-
<span class="pie-section-player-tools-event-debugger__event-type">{record.type}</span>
|
|
566
|
-
<span class="pie-section-player-tools-event-debugger__event-time">
|
|
567
|
-
{formatTimestamp(record.timestamp)}
|
|
568
|
-
</span>
|
|
569
|
-
</div>
|
|
570
|
-
<div class="pie-section-player-tools-event-debugger__row-meta">
|
|
571
|
-
{#if record.itemId}
|
|
572
|
-
<span>item: {record.itemId}</span>
|
|
573
|
-
{/if}
|
|
574
|
-
{#if record.intent}
|
|
575
|
-
<span>intent: {record.intent}</span>
|
|
576
|
-
{/if}
|
|
577
|
-
{#if (semanticCounts.get(record.semanticFingerprint) || 0) > record.duplicateCount}
|
|
578
|
-
<span>
|
|
579
|
-
semantic repeats: {semanticCounts.get(record.semanticFingerprint)}
|
|
580
|
-
</span>
|
|
581
|
-
{/if}
|
|
582
|
-
{#if record.duplicateCount > 1}
|
|
583
|
-
<span>dupes: {record.duplicateCount}</span>
|
|
584
|
-
{/if}
|
|
585
|
-
</div>
|
|
586
|
-
</button>
|
|
587
|
-
{/each}
|
|
588
|
-
{/if}
|
|
589
|
-
</div>
|
|
590
|
-
<div class="pie-section-player-tools-event-debugger__detail">
|
|
591
|
-
{#if selectedRecord}
|
|
592
|
-
<div class="pie-section-player-tools-event-debugger__detail-meta">
|
|
593
|
-
<div><strong>Type:</strong> {selectedRecord.type}</div>
|
|
594
|
-
<div><strong>Target:</strong> {selectedRecord.targetTag || "unknown"}</div>
|
|
595
|
-
<div><strong>Item:</strong> {selectedRecord.itemId || "n/a"}</div>
|
|
596
|
-
<div><strong>Canonical:</strong> {selectedRecord.canonicalItemId || "n/a"}</div>
|
|
597
|
-
<div><strong>Intent:</strong> {selectedRecord.intent || "n/a"}</div>
|
|
598
|
-
<div><strong>Duplicates:</strong> {selectedRecord.duplicateCount}</div>
|
|
599
|
-
<div>
|
|
600
|
-
<strong>Semantic Repeats:</strong>
|
|
601
|
-
{semanticCounts.get(selectedRecord.semanticFingerprint) || selectedRecord.duplicateCount}
|
|
602
|
-
</div>
|
|
510
|
+
<div class="pie-section-player-tools-event-debugger__row-top">
|
|
511
|
+
<span class="pie-section-player-tools-event-debugger__event-type">{record.type}</span>
|
|
512
|
+
<span class="pie-section-player-tools-event-debugger__event-time">
|
|
513
|
+
{formatTimestamp(record.timestamp)}
|
|
514
|
+
</span>
|
|
603
515
|
</div>
|
|
604
|
-
<
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
516
|
+
<div class="pie-section-player-tools-event-debugger__row-meta">
|
|
517
|
+
{#if record.itemId}
|
|
518
|
+
<span>item: {record.itemId}</span>
|
|
519
|
+
{/if}
|
|
520
|
+
{#if record.intent}
|
|
521
|
+
<span>intent: {record.intent}</span>
|
|
522
|
+
{/if}
|
|
523
|
+
{#if (semanticCounts.get(record.semanticFingerprint) || 0) > record.duplicateCount}
|
|
524
|
+
<span>
|
|
525
|
+
semantic repeats: {semanticCounts.get(record.semanticFingerprint)}
|
|
526
|
+
</span>
|
|
527
|
+
{/if}
|
|
528
|
+
{#if record.duplicateCount > 1}
|
|
529
|
+
<span>dupes: {record.duplicateCount}</span>
|
|
530
|
+
{/if}
|
|
612
531
|
</div>
|
|
613
|
-
|
|
532
|
+
</button>
|
|
533
|
+
{/each}
|
|
534
|
+
{/if}
|
|
535
|
+
</div>
|
|
536
|
+
<div class="pie-section-player-tools-event-debugger__detail">
|
|
537
|
+
{#if selectedRecord}
|
|
538
|
+
<div class="pie-section-player-tools-event-debugger__detail-meta">
|
|
539
|
+
<div><strong>Type:</strong> {selectedRecord.type}</div>
|
|
540
|
+
<div><strong>Target:</strong> {selectedRecord.targetTag || "unknown"}</div>
|
|
541
|
+
<div><strong>Item:</strong> {selectedRecord.itemId || "n/a"}</div>
|
|
542
|
+
<div><strong>Canonical:</strong> {selectedRecord.canonicalItemId || "n/a"}</div>
|
|
543
|
+
<div><strong>Intent:</strong> {selectedRecord.intent || "n/a"}</div>
|
|
544
|
+
<div><strong>Duplicates:</strong> {selectedRecord.duplicateCount}</div>
|
|
545
|
+
<div>
|
|
546
|
+
<strong>Semantic Repeats:</strong>
|
|
547
|
+
{semanticCounts.get(selectedRecord.semanticFingerprint) || selectedRecord.duplicateCount}
|
|
548
|
+
</div>
|
|
549
|
+
</div>
|
|
550
|
+
<pre class="pie-section-player-tools-event-debugger__pre">{JSON.stringify(
|
|
551
|
+
selectedRecord.payload,
|
|
552
|
+
null,
|
|
553
|
+
2,
|
|
554
|
+
)}</pre>
|
|
555
|
+
{:else}
|
|
556
|
+
<div class="pie-section-player-tools-event-debugger__empty">
|
|
557
|
+
Select an event to inspect payload details.
|
|
614
558
|
</div>
|
|
615
|
-
|
|
559
|
+
{/if}
|
|
616
560
|
</div>
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
{#if !isMinimized}
|
|
620
|
-
<PanelResizeHandle onPointerDown={(event: MouseEvent) => pointerController.startResize(event)} />
|
|
621
|
-
{/if}
|
|
622
|
-
</div>
|
|
561
|
+
</div>
|
|
562
|
+
</SharedFloatingPanel>
|
|
623
563
|
|
|
624
564
|
<style>
|
|
625
|
-
.pie-section-player-tools-event-debugger {
|
|
626
|
-
position: fixed;
|
|
627
|
-
z-index: 9999;
|
|
628
|
-
background: var(--color-base-100, #fff);
|
|
629
|
-
color: var(--color-base-content, #1f2937);
|
|
630
|
-
border: 2px solid var(--color-base-300, #d1d5db);
|
|
631
|
-
border-radius: 8px;
|
|
632
|
-
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
|
|
633
|
-
overflow: hidden;
|
|
634
|
-
font-family: var(--pie-font-family, Inter, system-ui, sans-serif);
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
.pie-section-player-tools-event-debugger__header {
|
|
638
|
-
padding: 8px 16px;
|
|
639
|
-
display: flex;
|
|
640
|
-
align-items: center;
|
|
641
|
-
justify-content: space-between;
|
|
642
|
-
background: var(--color-base-200, #f3f4f6);
|
|
643
|
-
cursor: move;
|
|
644
|
-
user-select: none;
|
|
645
|
-
border-bottom: 1px solid var(--color-base-300, #d1d5db);
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
.pie-section-player-tools-event-debugger__header-title {
|
|
649
|
-
display: flex;
|
|
650
|
-
align-items: center;
|
|
651
|
-
gap: 8px;
|
|
652
|
-
}
|
|
653
|
-
|
|
654
565
|
.pie-section-player-tools-event-debugger__icon-sm {
|
|
655
566
|
width: 1rem;
|
|
656
567
|
height: 1rem;
|
|
657
568
|
}
|
|
658
569
|
|
|
659
|
-
.pie-section-player-tools-event-debugger__title {
|
|
660
|
-
margin: 0;
|
|
661
|
-
font-size: 0.95rem;
|
|
662
|
-
font-weight: 700;
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
.pie-section-player-tools-event-debugger__header-actions {
|
|
666
|
-
display: flex;
|
|
667
|
-
gap: 4px;
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
.pie-section-player-tools-event-debugger__content-shell {
|
|
671
|
-
display: flex;
|
|
672
|
-
flex-direction: column;
|
|
673
|
-
min-height: 0;
|
|
674
|
-
}
|
|
675
|
-
|
|
676
570
|
.pie-section-player-tools-event-debugger__toolbar {
|
|
677
571
|
display: flex;
|
|
678
572
|
align-items: center;
|