@pie-players/pie-tool-theme 0.3.3 → 0.3.5
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/index-CGEKDUBQ.js +228 -0
- package/dist/index-DF-Dk87f.js +192 -0
- package/dist/tool-color-scheme.js +2419 -1819
- package/package.json +10 -14
- package/tool-color-scheme.svelte +24 -147
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-players/pie-tool-theme",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Theme tool for PIE assessment player - provides accessible themes and color schemes",
|
|
6
6
|
"repository": {
|
|
@@ -36,18 +36,14 @@
|
|
|
36
36
|
"index.ts",
|
|
37
37
|
"package.json"
|
|
38
38
|
],
|
|
39
|
-
"peerDependencies": {
|
|
40
|
-
"svelte": "^5.51.0"
|
|
41
|
-
},
|
|
42
39
|
"license": "MIT",
|
|
43
40
|
"unpkg": "./dist/tool-color-scheme.js",
|
|
44
41
|
"jsdelivr": "./dist/tool-color-scheme.js",
|
|
45
42
|
"dependencies": {
|
|
46
|
-
"@pie-players/pie-assessment-toolkit": "0.3.
|
|
47
|
-
"@pie-players/pie-context": "0.3.
|
|
48
|
-
"@pie-players/pie-players-shared": "0.3.
|
|
49
|
-
"@pie-players/pie-theme": "0.3.
|
|
50
|
-
"daisyui": "^5.5.18"
|
|
43
|
+
"@pie-players/pie-assessment-toolkit": "0.3.5",
|
|
44
|
+
"@pie-players/pie-context": "0.3.5",
|
|
45
|
+
"@pie-players/pie-players-shared": "0.3.5",
|
|
46
|
+
"@pie-players/pie-theme": "0.3.5"
|
|
51
47
|
},
|
|
52
48
|
"types": "./dist/index.d.ts",
|
|
53
49
|
"scripts": {
|
|
@@ -58,11 +54,11 @@
|
|
|
58
54
|
},
|
|
59
55
|
"devDependencies": {
|
|
60
56
|
"@biomejs/biome": "^2.3.10",
|
|
61
|
-
"@sveltejs/vite-plugin-svelte": "^6.
|
|
62
|
-
"svelte": "^5.
|
|
63
|
-
"typescript": "^5.
|
|
64
|
-
"vite": "^7.
|
|
65
|
-
"vite-plugin-dts": "^4.5.
|
|
57
|
+
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
58
|
+
"svelte": "^5.53.7",
|
|
59
|
+
"typescript": "^5.9.3",
|
|
60
|
+
"vite": "^7.3.1",
|
|
61
|
+
"vite-plugin-dts": "^4.5.4"
|
|
66
62
|
},
|
|
67
63
|
"homepage": "https://github.com/pie-framework/pie-players/tree/master/packages/tool-color-scheme#readme",
|
|
68
64
|
"bugs": {
|
package/tool-color-scheme.svelte
CHANGED
|
@@ -80,79 +80,11 @@
|
|
|
80
80
|
description: string;
|
|
81
81
|
preview: ToolSchemePreview;
|
|
82
82
|
};
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
description: 'Standard PIE colors',
|
|
89
|
-
preview: {
|
|
90
|
-
bg: '#ffffff',
|
|
91
|
-
text: '#000000',
|
|
92
|
-
primary: '#3f51b5'
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
id: 'black-on-white',
|
|
97
|
-
name: 'Black on White',
|
|
98
|
-
description: 'High contrast for readability',
|
|
99
|
-
preview: {
|
|
100
|
-
bg: '#ffffff',
|
|
101
|
-
text: '#000000',
|
|
102
|
-
primary: '#0000cc'
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
id: 'white-on-black',
|
|
107
|
-
name: 'White on Black',
|
|
108
|
-
description: 'Inverse high contrast',
|
|
109
|
-
preview: {
|
|
110
|
-
bg: '#000000',
|
|
111
|
-
text: '#ffffff',
|
|
112
|
-
primary: '#ffff00'
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
id: 'rose-on-green',
|
|
117
|
-
name: 'Rose on Green',
|
|
118
|
-
description: 'Color blind friendly (protanopia/deuteranopia)',
|
|
119
|
-
preview: {
|
|
120
|
-
bg: '#ccffcc',
|
|
121
|
-
text: '#3d0022',
|
|
122
|
-
primary: '#660044'
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
id: 'yellow-on-blue',
|
|
127
|
-
name: 'Yellow on Blue',
|
|
128
|
-
description: 'Strong contrast scheme',
|
|
129
|
-
preview: {
|
|
130
|
-
bg: '#000066',
|
|
131
|
-
text: '#ffff00',
|
|
132
|
-
primary: '#ffff66'
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
id: 'black-on-rose',
|
|
137
|
-
name: 'Black on Rose',
|
|
138
|
-
description: 'Warm tinted background',
|
|
139
|
-
preview: {
|
|
140
|
-
bg: '#ffccdd',
|
|
141
|
-
text: '#000000',
|
|
142
|
-
primary: '#880044'
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
id: 'light-gray-on-dark-gray',
|
|
147
|
-
name: 'Light Gray on Dark Gray',
|
|
148
|
-
description: 'Reduced brightness for light sensitivity',
|
|
149
|
-
preview: {
|
|
150
|
-
bg: '#333333',
|
|
151
|
-
text: '#e0e0e0',
|
|
152
|
-
primary: '#aaaaaa'
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
];
|
|
83
|
+
const FALLBACK_PREVIEW: ToolSchemePreview = {
|
|
84
|
+
bg: '#ffffff',
|
|
85
|
+
text: '#000000',
|
|
86
|
+
primary: '#3f51b5'
|
|
87
|
+
};
|
|
156
88
|
|
|
157
89
|
function previewFromVariables(
|
|
158
90
|
variables: Record<string, string> | undefined,
|
|
@@ -189,7 +121,7 @@
|
|
|
189
121
|
typeof value.variables === 'object' && value.variables
|
|
190
122
|
? (value.variables as Record<string, string>)
|
|
191
123
|
: undefined,
|
|
192
|
-
|
|
124
|
+
FALLBACK_PREVIEW
|
|
193
125
|
);
|
|
194
126
|
return { id, name, description, preview };
|
|
195
127
|
}
|
|
@@ -218,19 +150,12 @@
|
|
|
218
150
|
|
|
219
151
|
function resolveThemeSchemes(): ToolColorSchemeOption[] {
|
|
220
152
|
const themeSchemes = listPieColorSchemes();
|
|
221
|
-
const fallbackById = new Map(DEFAULT_COLOR_SCHEMES.map((scheme) => [scheme.id, scheme]));
|
|
222
153
|
return themeSchemes.map((scheme: PieColorSchemeDefinition) => {
|
|
223
|
-
|
|
154
|
+
return {
|
|
224
155
|
id: scheme.id,
|
|
225
156
|
name: scheme.name || scheme.id,
|
|
226
157
|
description: scheme.description || '',
|
|
227
|
-
preview:
|
|
228
|
-
};
|
|
229
|
-
return {
|
|
230
|
-
id: scheme.id,
|
|
231
|
-
name: scheme.name || fallback.name,
|
|
232
|
-
description: scheme.description || fallback.description || '',
|
|
233
|
-
preview: scheme.preview || previewFromVariables(scheme.variables, fallback.preview)
|
|
158
|
+
preview: scheme.preview || previewFromVariables(scheme.variables, FALLBACK_PREVIEW)
|
|
234
159
|
};
|
|
235
160
|
});
|
|
236
161
|
}
|
|
@@ -246,7 +171,7 @@
|
|
|
246
171
|
if (parsedFromAttribute.length > 0) return parsedFromAttribute;
|
|
247
172
|
const themeSchemes = resolveThemeSchemes();
|
|
248
173
|
if (themeSchemes.length > 0) return themeSchemes;
|
|
249
|
-
return
|
|
174
|
+
return [{ id: 'default', name: 'Default', description: '', preview: FALLBACK_PREVIEW }];
|
|
250
175
|
});
|
|
251
176
|
|
|
252
177
|
// Current color scheme
|
|
@@ -296,7 +221,7 @@
|
|
|
296
221
|
let currentSchemeObj = $derived(
|
|
297
222
|
availableSchemes.find(s => s.id === currentScheme) ||
|
|
298
223
|
availableSchemes[0] ||
|
|
299
|
-
|
|
224
|
+
{ id: 'default', name: 'Default', description: '', preview: FALLBACK_PREVIEW }
|
|
300
225
|
);
|
|
301
226
|
|
|
302
227
|
$effect(() => {
|
|
@@ -305,20 +230,12 @@
|
|
|
305
230
|
}
|
|
306
231
|
});
|
|
307
232
|
|
|
308
|
-
function handleClose() {
|
|
309
|
-
dropdownOpen = false;
|
|
310
|
-
coordinator?.hideTool(toolId);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
233
|
// Handle escape key
|
|
314
234
|
function handleKeyDown(e: KeyboardEvent) {
|
|
315
235
|
if (e.key === 'Escape') {
|
|
316
236
|
if (dropdownOpen) {
|
|
317
237
|
// Close dropdown first
|
|
318
238
|
dropdownOpen = false;
|
|
319
|
-
} else {
|
|
320
|
-
// Close the entire tool
|
|
321
|
-
handleClose();
|
|
322
239
|
}
|
|
323
240
|
} else if (dropdownOpen && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) {
|
|
324
241
|
// Handle arrow key navigation in dropdown
|
|
@@ -399,19 +316,14 @@
|
|
|
399
316
|
</script>
|
|
400
317
|
|
|
401
318
|
{#if visible}
|
|
402
|
-
<div
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
>
|
|
411
|
-
×
|
|
412
|
-
</button>
|
|
413
|
-
</div>
|
|
414
|
-
|
|
319
|
+
<div
|
|
320
|
+
bind:this={containerEl}
|
|
321
|
+
class="pie-tool-color-scheme"
|
|
322
|
+
role="dialog"
|
|
323
|
+
tabindex="-1"
|
|
324
|
+
aria-label="Theme selector"
|
|
325
|
+
onkeydown={handleKeyDown}
|
|
326
|
+
>
|
|
415
327
|
<div class="pie-tool-color-scheme__content">
|
|
416
328
|
<p class="pie-tool-color-scheme__description">
|
|
417
329
|
Select a theme to improve readability and reduce eye strain.
|
|
@@ -478,57 +390,23 @@
|
|
|
478
390
|
|
|
479
391
|
<style>
|
|
480
392
|
.pie-tool-color-scheme {
|
|
481
|
-
position:
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
width: 90%;
|
|
486
|
-
max-width: 32rem;
|
|
393
|
+
position: relative;
|
|
394
|
+
width: 100%;
|
|
395
|
+
height: 100%;
|
|
396
|
+
min-height: 0;
|
|
487
397
|
background-color: var(--pie-background, white);
|
|
488
|
-
border: 2px solid var(--pie-border, #ccc);
|
|
489
|
-
border-radius: 0.5rem;
|
|
490
|
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
491
398
|
display: flex;
|
|
492
399
|
flex-direction: column;
|
|
493
400
|
}
|
|
494
401
|
|
|
495
|
-
.pie-tool-color-scheme__header {
|
|
496
|
-
display: flex;
|
|
497
|
-
justify-content: space-between;
|
|
498
|
-
align-items: center;
|
|
499
|
-
padding: 1rem;
|
|
500
|
-
border-bottom: 2px solid var(--pie-border, #ccc);
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
.pie-tool-color-scheme__title {
|
|
504
|
-
font-size: 1.25rem;
|
|
505
|
-
font-weight: 700;
|
|
506
|
-
color: var(--pie-text, black);
|
|
507
|
-
margin: 0;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
.pie-tool-color-scheme__close {
|
|
511
|
-
width: 2rem;
|
|
512
|
-
height: 2rem;
|
|
513
|
-
border: none;
|
|
514
|
-
background: transparent;
|
|
515
|
-
color: var(--pie-text, black);
|
|
516
|
-
font-size: 1.5rem;
|
|
517
|
-
line-height: 1;
|
|
518
|
-
cursor: pointer;
|
|
519
|
-
border-radius: 0.25rem;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
.pie-tool-color-scheme__close:hover {
|
|
523
|
-
background-color: var(--pie-secondary-background, #f0f0f0);
|
|
524
|
-
}
|
|
525
|
-
|
|
526
402
|
.pie-tool-color-scheme__content {
|
|
527
403
|
padding: 1rem;
|
|
528
404
|
position: relative;
|
|
529
405
|
display: flex;
|
|
530
406
|
flex-direction: column;
|
|
531
407
|
gap: 1rem;
|
|
408
|
+
min-height: 0;
|
|
409
|
+
overflow: auto;
|
|
532
410
|
}
|
|
533
411
|
|
|
534
412
|
.pie-tool-color-scheme__description {
|
|
@@ -674,7 +552,6 @@
|
|
|
674
552
|
}
|
|
675
553
|
|
|
676
554
|
/* Keyboard focus styling */
|
|
677
|
-
.pie-tool-color-scheme__close:focus-visible,
|
|
678
555
|
.pie-tool-color-scheme__dropdown-trigger:focus-visible,
|
|
679
556
|
.pie-tool-color-scheme__option:focus-visible {
|
|
680
557
|
outline: 2px solid var(--pie-primary, #3f51b5);
|