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