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