@pie-players/pie-section-player-tools-session-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/SectionSessionPanel.svelte +60 -174
- package/dist/section-player-tools-session-debugger.js +1647 -1489
- package/package.json +3 -3
|
@@ -12,17 +12,12 @@
|
|
|
12
12
|
|
|
13
13
|
<script lang="ts">
|
|
14
14
|
import '@pie-players/pie-theme/components.css';
|
|
15
|
-
import
|
|
16
|
-
import PanelWindowControls from '@pie-players/pie-section-player-tools-shared/PanelWindowControls.svelte';
|
|
15
|
+
import SharedFloatingPanel from '@pie-players/pie-section-player-tools-shared/SharedFloatingPanel.svelte';
|
|
17
16
|
import {
|
|
18
|
-
claimNextFloatingPanelZIndex,
|
|
19
|
-
computePanelSizeFromViewport,
|
|
20
|
-
createFloatingPanelPointerController,
|
|
21
17
|
getSectionControllerFromCoordinator,
|
|
22
18
|
isMatchingSectionControllerLifecycleEvent
|
|
23
19
|
} from '@pie-players/pie-section-player-tools-shared';
|
|
24
20
|
import { createEventDispatcher } from 'svelte';
|
|
25
|
-
import { onMount } from 'svelte';
|
|
26
21
|
const dispatch = createEventDispatcher<{ close: undefined }>();
|
|
27
22
|
|
|
28
23
|
|
|
@@ -91,13 +86,6 @@
|
|
|
91
86
|
attemptId?: string;
|
|
92
87
|
} = $props();
|
|
93
88
|
|
|
94
|
-
let isSessionMinimized = $state(false);
|
|
95
|
-
let sessionWindowX = $state(24);
|
|
96
|
-
let sessionWindowY = $state(100);
|
|
97
|
-
let sessionWindowWidth = $state(220);
|
|
98
|
-
let sessionWindowHeight = $state(600);
|
|
99
|
-
let sessionPanelZIndex = $state(claimNextFloatingPanelZIndex());
|
|
100
|
-
|
|
101
89
|
let sessionPanelSnapshot = $state<SessionPanelSnapshot>({
|
|
102
90
|
currentItemIndex: null,
|
|
103
91
|
currentItemId: null,
|
|
@@ -286,69 +274,30 @@
|
|
|
286
274
|
};
|
|
287
275
|
});
|
|
288
276
|
|
|
289
|
-
onMount(() => {
|
|
290
|
-
const initial = computePanelSizeFromViewport(
|
|
291
|
-
{ width: window.innerWidth, height: window.innerHeight },
|
|
292
|
-
{
|
|
293
|
-
widthRatio: 0.29,
|
|
294
|
-
heightRatio: 0.72,
|
|
295
|
-
minWidth: 280,
|
|
296
|
-
maxWidth: 560,
|
|
297
|
-
minHeight: 360,
|
|
298
|
-
maxHeight: 860,
|
|
299
|
-
alignX: 'left',
|
|
300
|
-
alignY: 'center',
|
|
301
|
-
paddingX: 16,
|
|
302
|
-
paddingY: 16
|
|
303
|
-
}
|
|
304
|
-
);
|
|
305
|
-
sessionWindowX = initial.x;
|
|
306
|
-
sessionWindowY = initial.y;
|
|
307
|
-
sessionWindowWidth = initial.width;
|
|
308
|
-
sessionWindowHeight = initial.height;
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
function bringSessionPanelToFront(): void {
|
|
312
|
-
sessionPanelZIndex = claimNextFloatingPanelZIndex();
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
const pointerController = createFloatingPanelPointerController({
|
|
316
|
-
getState: () => ({
|
|
317
|
-
x: sessionWindowX,
|
|
318
|
-
y: sessionWindowY,
|
|
319
|
-
width: sessionWindowWidth,
|
|
320
|
-
height: sessionWindowHeight
|
|
321
|
-
}),
|
|
322
|
-
setState: (next) => {
|
|
323
|
-
sessionWindowX = next.x;
|
|
324
|
-
sessionWindowY = next.y;
|
|
325
|
-
sessionWindowWidth = next.width;
|
|
326
|
-
sessionWindowHeight = next.height;
|
|
327
|
-
},
|
|
328
|
-
minWidth: 300,
|
|
329
|
-
minHeight: 200,
|
|
330
|
-
onFocus: bringSessionPanelToFront
|
|
331
|
-
});
|
|
332
|
-
|
|
333
|
-
$effect(() => {
|
|
334
|
-
return () => {
|
|
335
|
-
pointerController.stop();
|
|
336
|
-
};
|
|
337
|
-
});
|
|
338
277
|
</script>
|
|
339
278
|
|
|
340
|
-
<
|
|
341
|
-
|
|
342
|
-
|
|
279
|
+
<SharedFloatingPanel
|
|
280
|
+
title="Session Data"
|
|
281
|
+
ariaLabel="Drag session panel"
|
|
282
|
+
minWidth={340}
|
|
283
|
+
minHeight={260}
|
|
284
|
+
initialSizing={{
|
|
285
|
+
widthRatio: 0.29,
|
|
286
|
+
heightRatio: 0.72,
|
|
287
|
+
minWidth: 280,
|
|
288
|
+
maxWidth: 560,
|
|
289
|
+
minHeight: 360,
|
|
290
|
+
maxHeight: 860,
|
|
291
|
+
alignX: 'left',
|
|
292
|
+
alignY: 'center',
|
|
293
|
+
paddingX: 16,
|
|
294
|
+
paddingY: 16
|
|
295
|
+
}}
|
|
296
|
+
className="pie-section-player-tools-session-debugger"
|
|
297
|
+
bodyClass="pie-section-player-tools-session-debugger__content-shell"
|
|
298
|
+
onClose={() => dispatch('close')}
|
|
343
299
|
>
|
|
344
|
-
<
|
|
345
|
-
class="pie-section-player-tools-session-debugger__header"
|
|
346
|
-
onmousedown={(event: MouseEvent) => pointerController.startDrag(event)}
|
|
347
|
-
role="button"
|
|
348
|
-
tabindex="0"
|
|
349
|
-
aria-label="Drag session panel"
|
|
350
|
-
>
|
|
351
|
-
<div class="pie-section-player-tools-session-debugger__header-title">
|
|
300
|
+
<svelte:fragment slot="icon">
|
|
352
301
|
<svg
|
|
353
302
|
xmlns="http://www.w3.org/2000/svg"
|
|
354
303
|
class="pie-section-player-tools-session-debugger__icon-sm"
|
|
@@ -358,116 +307,53 @@
|
|
|
358
307
|
>
|
|
359
308
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
|
|
360
309
|
</svg>
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
onToggle={() => (isSessionMinimized = !isSessionMinimized)}
|
|
367
|
-
onClose={() => dispatch('close')}
|
|
368
|
-
/>
|
|
310
|
+
</svelte:fragment>
|
|
311
|
+
|
|
312
|
+
<div class="pie-section-player-tools-session-debugger__content">
|
|
313
|
+
<div class="pie-section-player-tools-session-debugger__section-intro">
|
|
314
|
+
<div class="pie-section-player-tools-session-debugger__heading">PIE Session Data (Persistent)</div>
|
|
369
315
|
</div>
|
|
370
|
-
</div>
|
|
371
316
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
317
|
+
{#if !controllerAvailable}
|
|
318
|
+
<div class="pie-section-player-tools-session-debugger__alert pie-section-player-tools-session-debugger__alert--warning">
|
|
319
|
+
<svg
|
|
320
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
321
|
+
class="pie-section-player-tools-session-debugger__icon-md"
|
|
322
|
+
fill="none"
|
|
323
|
+
viewBox="0 0 24 24"
|
|
324
|
+
>
|
|
325
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01M5.07 19h13.86c1.54 0 2.5-1.67 1.73-3L13.73 4c-.77-1.33-2.69-1.33-3.46 0L3.34 16c-.77 1.33.19 3 1.73 3z" />
|
|
326
|
+
</svg>
|
|
327
|
+
<span class="pie-section-player-tools-session-debugger__text-xs">Section controller not available for this section yet.</span>
|
|
328
|
+
</div>
|
|
329
|
+
{:else}
|
|
330
|
+
{#if Object.keys(sessionPanelSnapshot.itemSessions || {}).length === 0}
|
|
331
|
+
<div class="pie-section-player-tools-session-debugger__alert pie-section-player-tools-session-debugger__alert--info">
|
|
332
|
+
<svg
|
|
333
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
334
|
+
class="pie-section-player-tools-session-debugger__icon-md"
|
|
335
|
+
fill="none"
|
|
336
|
+
viewBox="0 0 24 24"
|
|
337
|
+
>
|
|
338
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
|
339
|
+
</svg>
|
|
340
|
+
<span class="pie-section-player-tools-session-debugger__text-xs">No section session data yet. Interact with the questions to see updates.</span>
|
|
377
341
|
</div>
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
fill="none"
|
|
385
|
-
viewBox="0 0 24 24"
|
|
386
|
-
>
|
|
387
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01M5.07 19h13.86c1.54 0 2.5-1.67 1.73-3L13.73 4c-.77-1.33-2.69-1.33-3.46 0L3.34 16c-.77 1.33.19 3 1.73 3z" />
|
|
388
|
-
</svg>
|
|
389
|
-
<span class="pie-section-player-tools-session-debugger__text-xs">Section controller not available for this section yet.</span>
|
|
390
|
-
</div>
|
|
391
|
-
{:else}
|
|
392
|
-
{#if Object.keys(sessionPanelSnapshot.itemSessions || {}).length === 0}
|
|
393
|
-
<div class="pie-section-player-tools-session-debugger__alert pie-section-player-tools-session-debugger__alert--info">
|
|
394
|
-
<svg
|
|
395
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
396
|
-
class="pie-section-player-tools-session-debugger__icon-md"
|
|
397
|
-
fill="none"
|
|
398
|
-
viewBox="0 0 24 24"
|
|
399
|
-
>
|
|
400
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
|
401
|
-
</svg>
|
|
402
|
-
<span class="pie-section-player-tools-session-debugger__text-xs">No section session data yet. Interact with the questions to see updates.</span>
|
|
403
|
-
</div>
|
|
404
|
-
{/if}
|
|
405
|
-
<div class="pie-section-player-tools-session-debugger__card">
|
|
406
|
-
<div class="pie-section-player-tools-session-debugger__card-title">
|
|
407
|
-
Item Sessions Snapshot
|
|
408
|
-
</div>
|
|
409
|
-
<pre class="pie-section-player-tools-session-debugger__card-pre">{JSON.stringify(sessionPanelSnapshot, null, 2)}</pre>
|
|
410
|
-
</div>
|
|
411
|
-
{/if}
|
|
342
|
+
{/if}
|
|
343
|
+
<div class="pie-section-player-tools-session-debugger__card">
|
|
344
|
+
<div class="pie-section-player-tools-session-debugger__card-title">
|
|
345
|
+
Item Sessions Snapshot
|
|
346
|
+
</div>
|
|
347
|
+
<pre class="pie-section-player-tools-session-debugger__card-pre">{JSON.stringify(sessionPanelSnapshot, null, 2)}</pre>
|
|
412
348
|
</div>
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
{#if !isSessionMinimized}
|
|
417
|
-
<PanelResizeHandle onPointerDown={(event: MouseEvent) => pointerController.startResize(event)} />
|
|
418
|
-
{/if}
|
|
419
|
-
</div>
|
|
349
|
+
{/if}
|
|
350
|
+
</div>
|
|
351
|
+
</SharedFloatingPanel>
|
|
420
352
|
|
|
421
353
|
<style>
|
|
422
|
-
.pie-section-player-tools-session-debugger {
|
|
423
|
-
position: fixed;
|
|
424
|
-
z-index: 9999;
|
|
425
|
-
background: var(--color-base-100, #fff);
|
|
426
|
-
color: var(--color-base-content, #1f2937);
|
|
427
|
-
border: 2px solid var(--color-base-300, #d1d5db);
|
|
428
|
-
border-radius: 8px;
|
|
429
|
-
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
|
|
430
|
-
overflow: hidden;
|
|
431
|
-
font-family: var(--pie-font-family, Inter, system-ui, sans-serif);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
.pie-section-player-tools-session-debugger__header {
|
|
435
|
-
padding: 8px 16px;
|
|
436
|
-
display: flex;
|
|
437
|
-
align-items: center;
|
|
438
|
-
justify-content: space-between;
|
|
439
|
-
background: var(--color-base-200, #f3f4f6);
|
|
440
|
-
cursor: move;
|
|
441
|
-
user-select: none;
|
|
442
|
-
border-bottom: 1px solid var(--color-base-300, #d1d5db);
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
.pie-section-player-tools-session-debugger__header-title {
|
|
446
|
-
display: flex;
|
|
447
|
-
align-items: center;
|
|
448
|
-
gap: 8px;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
354
|
.pie-section-player-tools-session-debugger__icon-sm {
|
|
452
355
|
width: 1rem;
|
|
453
356
|
height: 1rem;
|
|
454
357
|
}
|
|
455
358
|
|
|
456
|
-
.pie-section-player-tools-session-debugger__title {
|
|
457
|
-
margin: 0;
|
|
458
|
-
font-size: 0.95rem;
|
|
459
|
-
font-weight: 700;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
.pie-section-player-tools-session-debugger__header-actions {
|
|
463
|
-
display: flex;
|
|
464
|
-
gap: 4px;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
.pie-section-player-tools-session-debugger__content-shell {
|
|
468
|
-
display: flex;
|
|
469
|
-
flex-direction: column;
|
|
470
|
-
min-height: 0;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
359
|
</style>
|