@pie-players/pie-tool-line-reader 0.1.9 → 0.1.11
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/dist/tool-line-reader.js +1824 -2140
- package/package.json +4 -4
- package/tool-line-reader.svelte +12 -114
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-players/pie-tool-line-reader",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Reading guide overlay tool for PIE assessment player",
|
|
6
6
|
"repository": {
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"unpkg": "./dist/tool-line-reader.js",
|
|
42
42
|
"jsdelivr": "./dist/tool-line-reader.js",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@pie-players/pie-assessment-toolkit": "0.2.
|
|
45
|
-
"@pie-players/pie-context": "0.1.
|
|
46
|
-
"@pie-players/pie-players-shared": "0.2.
|
|
44
|
+
"@pie-players/pie-assessment-toolkit": "0.2.11",
|
|
45
|
+
"@pie-players/pie-context": "0.1.3",
|
|
46
|
+
"@pie-players/pie-players-shared": "0.2.7",
|
|
47
47
|
"daisyui": "^5.5.18"
|
|
48
48
|
},
|
|
49
49
|
"types": "./dist/index.d.ts",
|
package/tool-line-reader.svelte
CHANGED
|
@@ -19,8 +19,6 @@
|
|
|
19
19
|
AssessmentToolkitRuntimeContext,
|
|
20
20
|
IToolCoordinator,
|
|
21
21
|
} from '@pie-players/pie-assessment-toolkit';
|
|
22
|
-
import ToolSettingsButton from '@pie-players/pie-players-shared/components/ToolSettingsButton.svelte';
|
|
23
|
-
import ToolSettingsPanel from '@pie-players/pie-players-shared/components/ToolSettingsPanel.svelte';
|
|
24
22
|
import { onMount } from 'svelte';
|
|
25
23
|
|
|
26
24
|
// Props
|
|
@@ -35,7 +33,6 @@ import { onMount } from 'svelte';
|
|
|
35
33
|
const coordinator = $derived(
|
|
36
34
|
runtimeContext?.toolCoordinator as IToolCoordinator | undefined,
|
|
37
35
|
);
|
|
38
|
-
let settingsButtonEl = $state<HTMLButtonElement | undefined>();
|
|
39
36
|
let isDragging = $state(false);
|
|
40
37
|
let isResizing = $state(false);
|
|
41
38
|
let position = $state({
|
|
@@ -49,7 +46,6 @@ import { onMount } from 'svelte';
|
|
|
49
46
|
let currentColor = $state('#ffff00'); // Yellow
|
|
50
47
|
let currentOpacity = $state(0.3);
|
|
51
48
|
let maskingMode = $state<'highlight' | 'obscure'>('highlight');
|
|
52
|
-
let settingsOpen = $state(false);
|
|
53
49
|
|
|
54
50
|
// Track registration state
|
|
55
51
|
let registered = $state(false);
|
|
@@ -96,20 +92,6 @@ import { onMount } from 'svelte';
|
|
|
96
92
|
announce(`Mode changed to ${maskingMode === 'highlight' ? 'highlight' : 'masking'}`);
|
|
97
93
|
}
|
|
98
94
|
|
|
99
|
-
function toggleSettings() {
|
|
100
|
-
settingsOpen = !settingsOpen;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function closeSettings() {
|
|
104
|
-
settingsOpen = false;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function setColor(color: string) {
|
|
108
|
-
currentColor = color;
|
|
109
|
-
const colorName = colors.find(c => c.value === color)?.name || 'Unknown';
|
|
110
|
-
announce(`Color changed to ${colorName}`);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
95
|
// Pointer event handlers (better for web components)
|
|
114
96
|
function handlePointerDown(e: PointerEvent) {
|
|
115
97
|
const target = e.target as HTMLElement;
|
|
@@ -117,9 +99,6 @@ import { onMount } from 'svelte';
|
|
|
117
99
|
// Check if clicking the resize handle
|
|
118
100
|
if (target.closest('.resize-handle')) {
|
|
119
101
|
startResizing(e);
|
|
120
|
-
} else if (target.closest('.tool-settings-button') || target.closest('.tool-settings-panel')) {
|
|
121
|
-
// Don't start dragging when clicking settings
|
|
122
|
-
return;
|
|
123
102
|
} else {
|
|
124
103
|
startDragging(e);
|
|
125
104
|
}
|
|
@@ -339,13 +318,6 @@ import { onMount } from 'svelte';
|
|
|
339
318
|
aria-roledescription="Draggable and resizable reading guide overlay"
|
|
340
319
|
>
|
|
341
320
|
<div class="pie-tool-line-reader__container" style="background-color: {backgroundColor};">
|
|
342
|
-
<!-- Settings Button -->
|
|
343
|
-
<ToolSettingsButton
|
|
344
|
-
bind:buttonEl={settingsButtonEl}
|
|
345
|
-
onClick={toggleSettings}
|
|
346
|
-
ariaLabel="Line reader settings"
|
|
347
|
-
active={settingsOpen}
|
|
348
|
-
/>
|
|
349
321
|
</div>
|
|
350
322
|
|
|
351
323
|
<!-- Resize handle -->
|
|
@@ -357,87 +329,11 @@ import { onMount } from 'svelte';
|
|
|
357
329
|
aria-label="Resize handle - drag to adjust height"
|
|
358
330
|
>
|
|
359
331
|
<svg width="20" height="8" viewBox="0 0 20 8" aria-hidden="true">
|
|
360
|
-
<rect x="8" y="3" width="4" height="2" fill="#4CAF50" rx="1"/>
|
|
332
|
+
<rect x="8" y="3" width="4" height="2" fill="var(--pie-primary, #4CAF50)" rx="1"/>
|
|
361
333
|
</svg>
|
|
362
334
|
</div>
|
|
363
335
|
</div>
|
|
364
336
|
|
|
365
|
-
<!-- Settings Panel - Rendered outside pie-tool-line-reader to avoid height constraints -->
|
|
366
|
-
<ToolSettingsPanel
|
|
367
|
-
open={settingsOpen}
|
|
368
|
-
title="Line Reader Settings"
|
|
369
|
-
onClose={closeSettings}
|
|
370
|
-
anchorEl={settingsButtonEl}
|
|
371
|
-
>
|
|
372
|
-
<!-- Mode Selection - First, as it determines what other settings are relevant -->
|
|
373
|
-
<fieldset class="setting-group">
|
|
374
|
-
<legend>Mode</legend>
|
|
375
|
-
<label>
|
|
376
|
-
<input
|
|
377
|
-
type="radio"
|
|
378
|
-
name="mode"
|
|
379
|
-
value="highlight"
|
|
380
|
-
checked={maskingMode === 'highlight'}
|
|
381
|
-
onchange={() => { maskingMode = 'highlight'; announce('Mode changed to highlight'); }}
|
|
382
|
-
/>
|
|
383
|
-
<span>Highlight</span>
|
|
384
|
-
</label>
|
|
385
|
-
<label>
|
|
386
|
-
<input
|
|
387
|
-
type="radio"
|
|
388
|
-
name="mode"
|
|
389
|
-
value="obscure"
|
|
390
|
-
checked={maskingMode === 'obscure'}
|
|
391
|
-
onchange={() => { maskingMode = 'obscure'; announce('Mode changed to masking'); }}
|
|
392
|
-
/>
|
|
393
|
-
<span>Masking</span>
|
|
394
|
-
</label>
|
|
395
|
-
</fieldset>
|
|
396
|
-
|
|
397
|
-
<!-- Color Selection - Only shown in Highlight mode -->
|
|
398
|
-
{#if maskingMode === 'highlight'}
|
|
399
|
-
<fieldset class="setting-group">
|
|
400
|
-
<legend>Color</legend>
|
|
401
|
-
{#each colors as color}
|
|
402
|
-
<label>
|
|
403
|
-
<input
|
|
404
|
-
type="radio"
|
|
405
|
-
name="color"
|
|
406
|
-
value={color.value}
|
|
407
|
-
checked={currentColor === color.value}
|
|
408
|
-
onchange={() => setColor(color.value)}
|
|
409
|
-
/>
|
|
410
|
-
<div class="color-swatch" style="background-color: {color.value};"></div>
|
|
411
|
-
<span>{color.name}</span>
|
|
412
|
-
</label>
|
|
413
|
-
{/each}
|
|
414
|
-
</fieldset>
|
|
415
|
-
|
|
416
|
-
<!-- Opacity Slider - Only shown in Highlight mode -->
|
|
417
|
-
<div class="setting-group">
|
|
418
|
-
<div class="setting-label">
|
|
419
|
-
<span>Opacity</span>
|
|
420
|
-
<span class="setting-value" aria-live="polite">{Math.round(currentOpacity * 100)}%</span>
|
|
421
|
-
</div>
|
|
422
|
-
<input
|
|
423
|
-
type="range"
|
|
424
|
-
min="10"
|
|
425
|
-
max="90"
|
|
426
|
-
step="5"
|
|
427
|
-
value={currentOpacity * 100}
|
|
428
|
-
oninput={(e) => {
|
|
429
|
-
currentOpacity = Number(e.currentTarget.value) / 100;
|
|
430
|
-
announce(`Opacity ${Math.round(currentOpacity * 100)}%`);
|
|
431
|
-
}}
|
|
432
|
-
aria-label="Opacity"
|
|
433
|
-
aria-valuemin="10"
|
|
434
|
-
aria-valuemax="90"
|
|
435
|
-
aria-valuenow={Math.round(currentOpacity * 100)}
|
|
436
|
-
aria-valuetext="{Math.round(currentOpacity * 100)} percent"
|
|
437
|
-
/>
|
|
438
|
-
</div>
|
|
439
|
-
{/if}
|
|
440
|
-
</ToolSettingsPanel>
|
|
441
337
|
{/if}
|
|
442
338
|
|
|
443
339
|
<style>
|
|
@@ -454,7 +350,7 @@ import { onMount } from 'svelte';
|
|
|
454
350
|
}
|
|
455
351
|
|
|
456
352
|
.pie-tool-line-reader {
|
|
457
|
-
border: 2px solid
|
|
353
|
+
border: 2px solid color-mix(in srgb, var(--pie-primary, #4caf50) 80%, transparent);
|
|
458
354
|
cursor: move;
|
|
459
355
|
overflow: visible;
|
|
460
356
|
position: absolute;
|
|
@@ -465,12 +361,12 @@ import { onMount } from 'svelte';
|
|
|
465
361
|
}
|
|
466
362
|
|
|
467
363
|
.pie-tool-line-reader:focus {
|
|
468
|
-
outline: 3px solid #4A90E2;
|
|
364
|
+
outline: 3px solid var(--pie-button-focus-outline, var(--pie-primary, #4A90E2));
|
|
469
365
|
outline-offset: 2px;
|
|
470
366
|
}
|
|
471
367
|
|
|
472
368
|
.pie-tool-line-reader:focus-visible {
|
|
473
|
-
outline: 3px solid #4A90E2;
|
|
369
|
+
outline: 3px solid var(--pie-button-focus-outline, var(--pie-primary, #4A90E2));
|
|
474
370
|
outline-offset: 2px;
|
|
475
371
|
}
|
|
476
372
|
|
|
@@ -497,13 +393,13 @@ import { onMount } from 'svelte';
|
|
|
497
393
|
transform: translateX(-50%);
|
|
498
394
|
width: 40px;
|
|
499
395
|
height: 16px;
|
|
500
|
-
background-color:
|
|
396
|
+
background-color: color-mix(in srgb, var(--pie-background, #fff) 90%, transparent);
|
|
501
397
|
border-radius: 8px;
|
|
502
|
-
border: 2px solid #
|
|
398
|
+
border: 2px solid var(--pie-primary, #4caf50);
|
|
503
399
|
}
|
|
504
400
|
|
|
505
401
|
.pie-tool-line-reader__resize-handle:hover {
|
|
506
|
-
background-color:
|
|
402
|
+
background-color: color-mix(in srgb, var(--pie-primary, #4caf50) 20%, transparent);
|
|
507
403
|
}
|
|
508
404
|
|
|
509
405
|
.pie-tool-line-reader__resize-handle:active {
|
|
@@ -517,7 +413,7 @@ import { onMount } from 'svelte';
|
|
|
517
413
|
/* Masking overlays for obscure mode - 4 rectangles covering all areas except line reader window */
|
|
518
414
|
.pie-tool-line-reader__mask {
|
|
519
415
|
position: fixed;
|
|
520
|
-
background:
|
|
416
|
+
background: color-mix(in srgb, var(--pie-text, #000) 85%, transparent);
|
|
521
417
|
z-index: 999;
|
|
522
418
|
pointer-events: none;
|
|
523
419
|
}
|
|
@@ -548,8 +444,10 @@ import { onMount } from 'svelte';
|
|
|
548
444
|
|
|
549
445
|
/* In masking mode, change the window appearance */
|
|
550
446
|
.pie-tool-line-reader.pie-tool-line-reader--masking-mode {
|
|
551
|
-
border-color:
|
|
552
|
-
box-shadow:
|
|
447
|
+
border-color: var(--pie-primary, #4caf50);
|
|
448
|
+
box-shadow:
|
|
449
|
+
0 0 0 3px color-mix(in srgb, var(--pie-primary, #4caf50) 80%, transparent),
|
|
450
|
+
0 0 20px color-mix(in srgb, var(--pie-primary, #4caf50) 40%, transparent);
|
|
553
451
|
}
|
|
554
452
|
|
|
555
453
|
/* In masking mode, the window should be transparent to show content underneath */
|