@pie-players/pie-assessment-toolkit 0.2.0
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/README.md +520 -0
- package/dist/attempt/TestSession.d.ts +90 -0
- package/dist/attempt/TestSession.d.ts.map +1 -0
- package/dist/attempt/TestSession.js +174 -0
- package/dist/attempt/TestSession.js.map +1 -0
- package/dist/core/TypedEventBus.d.ts +48 -0
- package/dist/core/TypedEventBus.d.ts.map +1 -0
- package/dist/core/TypedEventBus.js +63 -0
- package/dist/core/TypedEventBus.js.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/item-loader.d.ts +45 -0
- package/dist/item-loader.d.ts.map +1 -0
- package/dist/item-loader.js +62 -0
- package/dist/item-loader.js.map +1 -0
- package/dist/player/AssessmentPlayer.d.ts +388 -0
- package/dist/player/AssessmentPlayer.d.ts.map +1 -0
- package/dist/player/AssessmentPlayer.js +965 -0
- package/dist/player/AssessmentPlayer.js.map +1 -0
- package/dist/player/index.d.ts +17 -0
- package/dist/player/index.d.ts.map +1 -0
- package/dist/player/index.js +15 -0
- package/dist/player/index.js.map +1 -0
- package/dist/player/navigation-types.d.ts +63 -0
- package/dist/player/navigation-types.d.ts.map +1 -0
- package/dist/player/navigation-types.js +7 -0
- package/dist/player/navigation-types.js.map +1 -0
- package/dist/player/qti-navigation.d.ts +29 -0
- package/dist/player/qti-navigation.d.ts.map +1 -0
- package/dist/player/qti-navigation.js +160 -0
- package/dist/player/qti-navigation.js.map +1 -0
- package/dist/reference-layout/index.d.ts +19 -0
- package/dist/reference-layout/index.d.ts.map +1 -0
- package/dist/reference-layout/index.js +20 -0
- package/dist/reference-layout/index.js.map +1 -0
- package/dist/services/AccessibilityCatalogResolver.d.ts +141 -0
- package/dist/services/AccessibilityCatalogResolver.d.ts.map +1 -0
- package/dist/services/AccessibilityCatalogResolver.js +249 -0
- package/dist/services/AccessibilityCatalogResolver.js.map +1 -0
- package/dist/services/AssessmentAuthoringService.d.ts +60 -0
- package/dist/services/AssessmentAuthoringService.d.ts.map +1 -0
- package/dist/services/AssessmentAuthoringService.js +183 -0
- package/dist/services/AssessmentAuthoringService.js.map +1 -0
- package/dist/services/ContextVariableStore.d.ts +114 -0
- package/dist/services/ContextVariableStore.d.ts.map +1 -0
- package/dist/services/ContextVariableStore.js +207 -0
- package/dist/services/ContextVariableStore.js.map +1 -0
- package/dist/services/ElementToolStateStore.d.ts +125 -0
- package/dist/services/ElementToolStateStore.d.ts.map +1 -0
- package/dist/services/ElementToolStateStore.js +200 -0
- package/dist/services/ElementToolStateStore.js.map +1 -0
- package/dist/services/HighlightCoordinator.d.ts +179 -0
- package/dist/services/HighlightCoordinator.d.ts.map +1 -0
- package/dist/services/HighlightCoordinator.js +446 -0
- package/dist/services/HighlightCoordinator.js.map +1 -0
- package/dist/services/I18nService.d.ts +121 -0
- package/dist/services/I18nService.d.ts.map +1 -0
- package/dist/services/I18nService.js +276 -0
- package/dist/services/I18nService.js.map +1 -0
- package/dist/services/PNPMapper.d.ts +71 -0
- package/dist/services/PNPMapper.d.ts.map +1 -0
- package/dist/services/PNPMapper.js +98 -0
- package/dist/services/PNPMapper.js.map +1 -0
- package/dist/services/PNPToolResolver.d.ts +127 -0
- package/dist/services/PNPToolResolver.d.ts.map +1 -0
- package/dist/services/PNPToolResolver.js +222 -0
- package/dist/services/PNPToolResolver.js.map +1 -0
- package/dist/services/SSMLExtractor.d.ts +61 -0
- package/dist/services/SSMLExtractor.d.ts.map +1 -0
- package/dist/services/SSMLExtractor.js +181 -0
- package/dist/services/SSMLExtractor.js.map +1 -0
- package/dist/services/TTSService.d.ts +162 -0
- package/dist/services/TTSService.d.ts.map +1 -0
- package/dist/services/TTSService.js +465 -0
- package/dist/services/TTSService.js.map +1 -0
- package/dist/services/ThemeProvider.d.ts +95 -0
- package/dist/services/ThemeProvider.d.ts.map +1 -0
- package/dist/services/ThemeProvider.js +299 -0
- package/dist/services/ThemeProvider.js.map +1 -0
- package/dist/services/ToolConfigResolver.d.ts +162 -0
- package/dist/services/ToolConfigResolver.d.ts.map +1 -0
- package/dist/services/ToolConfigResolver.js +230 -0
- package/dist/services/ToolConfigResolver.js.map +1 -0
- package/dist/services/ToolCoordinator.d.ts +137 -0
- package/dist/services/ToolCoordinator.d.ts.map +1 -0
- package/dist/services/ToolCoordinator.js +318 -0
- package/dist/services/ToolCoordinator.js.map +1 -0
- package/dist/services/ToolkitCoordinator.d.ts +188 -0
- package/dist/services/ToolkitCoordinator.d.ts.map +1 -0
- package/dist/services/ToolkitCoordinator.js +252 -0
- package/dist/services/ToolkitCoordinator.js.map +1 -0
- package/dist/services/interfaces.d.ts +391 -0
- package/dist/services/interfaces.d.ts.map +1 -0
- package/dist/services/interfaces.js +12 -0
- package/dist/services/interfaces.js.map +1 -0
- package/dist/services/tool-providers/DesmosToolProvider.d.ts +103 -0
- package/dist/services/tool-providers/DesmosToolProvider.d.ts.map +1 -0
- package/dist/services/tool-providers/DesmosToolProvider.js +127 -0
- package/dist/services/tool-providers/DesmosToolProvider.js.map +1 -0
- package/dist/services/tool-providers/IToolProvider.d.ts +137 -0
- package/dist/services/tool-providers/IToolProvider.d.ts.map +1 -0
- package/dist/services/tool-providers/IToolProvider.js +13 -0
- package/dist/services/tool-providers/IToolProvider.js.map +1 -0
- package/dist/services/tool-providers/TIToolProvider.d.ts +107 -0
- package/dist/services/tool-providers/TIToolProvider.d.ts.map +1 -0
- package/dist/services/tool-providers/TIToolProvider.js +123 -0
- package/dist/services/tool-providers/TIToolProvider.js.map +1 -0
- package/dist/services/tool-providers/TTSToolProvider.d.ts +143 -0
- package/dist/services/tool-providers/TTSToolProvider.d.ts.map +1 -0
- package/dist/services/tool-providers/TTSToolProvider.js +168 -0
- package/dist/services/tool-providers/TTSToolProvider.js.map +1 -0
- package/dist/services/tool-providers/ToolProviderRegistry.d.ts +165 -0
- package/dist/services/tool-providers/ToolProviderRegistry.d.ts.map +1 -0
- package/dist/services/tool-providers/ToolProviderRegistry.js +240 -0
- package/dist/services/tool-providers/ToolProviderRegistry.js.map +1 -0
- package/dist/services/tool-providers/index.d.ts +18 -0
- package/dist/services/tool-providers/index.d.ts.map +1 -0
- package/dist/services/tool-providers/index.js +15 -0
- package/dist/services/tool-providers/index.js.map +1 -0
- package/dist/services/tts/browser-provider.d.ts +24 -0
- package/dist/services/tts/browser-provider.d.ts.map +1 -0
- package/dist/services/tts/browser-provider.js +177 -0
- package/dist/services/tts/browser-provider.js.map +1 -0
- package/dist/services/tts/provider-interface.d.ts +131 -0
- package/dist/services/tts/provider-interface.d.ts.map +1 -0
- package/dist/services/tts/provider-interface.js +10 -0
- package/dist/services/tts/provider-interface.js.map +1 -0
- package/dist/tools/calculators/desmos-provider.d.ts +54 -0
- package/dist/tools/calculators/desmos-provider.d.ts.map +1 -0
- package/dist/tools/calculators/desmos-provider.js +384 -0
- package/dist/tools/calculators/desmos-provider.js.map +1 -0
- package/dist/tools/calculators/mathjs-provider.d.ts +50 -0
- package/dist/tools/calculators/mathjs-provider.d.ts.map +1 -0
- package/dist/tools/calculators/mathjs-provider.js +660 -0
- package/dist/tools/calculators/mathjs-provider.js.map +1 -0
- package/dist/tools/calculators/ti-provider.d.ts +122 -0
- package/dist/tools/calculators/ti-provider.d.ts.map +1 -0
- package/dist/tools/calculators/ti-provider.js +587 -0
- package/dist/tools/calculators/ti-provider.js.map +1 -0
- package/dist/tools/client.d.ts +17 -0
- package/dist/tools/client.d.ts.map +1 -0
- package/dist/tools/client.js +26 -0
- package/dist/tools/client.js.map +1 -0
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +10 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/library-loader.d.ts +63 -0
- package/dist/tools/library-loader.d.ts.map +1 -0
- package/dist/tools/library-loader.js +292 -0
- package/dist/tools/library-loader.js.map +1 -0
- package/dist/tools/response-discovery.d.ts +72 -0
- package/dist/tools/response-discovery.d.ts.map +1 -0
- package/dist/tools/response-discovery.js +183 -0
- package/dist/tools/response-discovery.js.map +1 -0
- package/dist/tools/tool-coordinator.d.ts +76 -0
- package/dist/tools/tool-coordinator.d.ts.map +1 -0
- package/dist/tools/tool-coordinator.js +197 -0
- package/dist/tools/tool-coordinator.js.map +1 -0
- package/dist/tools/types.d.ts +427 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +13 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/variant-resolver.d.ts +48 -0
- package/dist/tools/variant-resolver.d.ts.map +1 -0
- package/dist/tools/variant-resolver.js +214 -0
- package/dist/tools/variant-resolver.js.map +1 -0
- package/dist/types/events.d.ts +157 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +11 -0
- package/dist/types/events.js.map +1 -0
- package/dist/utils/logger.d.ts +7 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +11 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +71 -0
- package/src/README.md +626 -0
- package/src/components/QuestionToolBar.svelte +406 -0
- package/src/player/AssessmentLayout.svelte +68 -0
- package/src/player/README.md +154 -0
- package/src/reference-layout/README.md +135 -0
- package/src/reference-layout/ReferenceLayout.svelte +209 -0
- package/src/reference-layout/components/AssessmentContent.svelte +259 -0
- package/src/reference-layout/components/AssessmentFooter.svelte +89 -0
- package/src/reference-layout/components/AssessmentHeader.svelte +250 -0
- package/src/reference-layout/components/AssessmentNavigation.svelte +134 -0
- package/src/reference-layout/components/AssessmentToolsBar.svelte +176 -0
- package/src/reference-layout/components/ItemPanel.svelte +200 -0
- package/src/reference-layout/components/NotesPanel.svelte +179 -0
- package/src/reference-layout/components/PassagePanel.svelte +76 -0
- package/src/tools/README.md +616 -0
- package/src/tools/calculators/README.md +395 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ThemeProvider
|
|
3
|
+
*
|
|
4
|
+
* Applies consistent accessibility theming across items and tools.
|
|
5
|
+
* Uses CSS custom properties and classes for framework-agnostic theming.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - High contrast mode
|
|
9
|
+
* - Font size scaling (small, normal, large, xlarge)
|
|
10
|
+
* - Color customization (background, foreground, accent)
|
|
11
|
+
* - Consistent theming across shadow DOM boundaries
|
|
12
|
+
* - No framework dependencies
|
|
13
|
+
*
|
|
14
|
+
* Part of PIE Assessment Toolkit.
|
|
15
|
+
*/
|
|
16
|
+
import type { IThemeProvider } from "./interfaces";
|
|
17
|
+
/**
|
|
18
|
+
* Font size options
|
|
19
|
+
*/
|
|
20
|
+
export type FontSize = "small" | "normal" | "large" | "xlarge";
|
|
21
|
+
/**
|
|
22
|
+
* Theme configuration
|
|
23
|
+
*/
|
|
24
|
+
export interface ThemeConfig {
|
|
25
|
+
highContrast?: boolean;
|
|
26
|
+
fontSize?: FontSize;
|
|
27
|
+
backgroundColor?: string;
|
|
28
|
+
foregroundColor?: string;
|
|
29
|
+
accentColor?: string;
|
|
30
|
+
linkColor?: string;
|
|
31
|
+
errorColor?: string;
|
|
32
|
+
successColor?: string;
|
|
33
|
+
warningColor?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare class ThemeProvider implements IThemeProvider {
|
|
36
|
+
private currentTheme;
|
|
37
|
+
private styleElement;
|
|
38
|
+
private rootElement;
|
|
39
|
+
constructor(rootElement?: HTMLElement | null);
|
|
40
|
+
/**
|
|
41
|
+
* Initialize theme styles
|
|
42
|
+
*/
|
|
43
|
+
private initializeStyles;
|
|
44
|
+
/**
|
|
45
|
+
* Apply theme configuration
|
|
46
|
+
*
|
|
47
|
+
* @param config Partial theme configuration (merged with current theme)
|
|
48
|
+
*/
|
|
49
|
+
applyTheme(config: ThemeConfig): void;
|
|
50
|
+
/**
|
|
51
|
+
* Apply CSS custom properties to root element
|
|
52
|
+
*/
|
|
53
|
+
private applyCSSVariables;
|
|
54
|
+
/**
|
|
55
|
+
* Apply CSS classes to root element
|
|
56
|
+
*/
|
|
57
|
+
private applyCSSClasses;
|
|
58
|
+
/**
|
|
59
|
+
* Update global theme styles
|
|
60
|
+
*/
|
|
61
|
+
private updateGlobalStyles;
|
|
62
|
+
/**
|
|
63
|
+
* Set high contrast mode
|
|
64
|
+
*/
|
|
65
|
+
setHighContrast(enabled: boolean): void;
|
|
66
|
+
/**
|
|
67
|
+
* Set font size
|
|
68
|
+
*/
|
|
69
|
+
setFontSize(size: FontSize): void;
|
|
70
|
+
/**
|
|
71
|
+
* Set color scheme
|
|
72
|
+
*/
|
|
73
|
+
setColors(colors: {
|
|
74
|
+
backgroundColor?: string;
|
|
75
|
+
foregroundColor?: string;
|
|
76
|
+
accentColor?: string;
|
|
77
|
+
}): void;
|
|
78
|
+
/**
|
|
79
|
+
* Get current theme configuration
|
|
80
|
+
*/
|
|
81
|
+
getCurrentTheme(): Required<ThemeConfig>;
|
|
82
|
+
/**
|
|
83
|
+
* Reset to default theme
|
|
84
|
+
*/
|
|
85
|
+
reset(): void;
|
|
86
|
+
/**
|
|
87
|
+
* Adjust color opacity (helper)
|
|
88
|
+
*/
|
|
89
|
+
private adjustOpacity;
|
|
90
|
+
/**
|
|
91
|
+
* Cleanup - remove theme styles
|
|
92
|
+
*/
|
|
93
|
+
destroy(): void;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=ThemeProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/services/ThemeProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,YAAY,CA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
* ThemeProvider
|
|
3
|
+
*
|
|
4
|
+
* Applies consistent accessibility theming across items and tools.
|
|
5
|
+
* Uses CSS custom properties and classes for framework-agnostic theming.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - High contrast mode
|
|
9
|
+
* - Font size scaling (small, normal, large, xlarge)
|
|
10
|
+
* - Color customization (background, foreground, accent)
|
|
11
|
+
* - Consistent theming across shadow DOM boundaries
|
|
12
|
+
* - No framework dependencies
|
|
13
|
+
*
|
|
14
|
+
* Part of PIE Assessment Toolkit.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Font size scale (in rem units)
|
|
18
|
+
*/
|
|
19
|
+
const FONT_SIZE_SCALE = {
|
|
20
|
+
small: 0.875, // 14px at 16px base
|
|
21
|
+
normal: 1.0, // 16px at 16px base
|
|
22
|
+
large: 1.25, // 20px at 16px base
|
|
23
|
+
xlarge: 1.5, // 24px at 16px base
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Default theme values
|
|
27
|
+
*/
|
|
28
|
+
const DEFAULT_THEME = {
|
|
29
|
+
highContrast: false,
|
|
30
|
+
fontSize: "normal",
|
|
31
|
+
backgroundColor: "#ffffff",
|
|
32
|
+
foregroundColor: "#333333",
|
|
33
|
+
accentColor: "#007bff",
|
|
34
|
+
linkColor: "#007bff",
|
|
35
|
+
errorColor: "#dc3545",
|
|
36
|
+
successColor: "#28a745",
|
|
37
|
+
warningColor: "#ffc107",
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* High contrast theme overrides
|
|
41
|
+
*/
|
|
42
|
+
const HIGH_CONTRAST_THEME = {
|
|
43
|
+
backgroundColor: "#000000",
|
|
44
|
+
foregroundColor: "#ffffff",
|
|
45
|
+
accentColor: "#ffff00",
|
|
46
|
+
linkColor: "#00ffff",
|
|
47
|
+
errorColor: "#ff0000",
|
|
48
|
+
successColor: "#00ff00",
|
|
49
|
+
warningColor: "#ffff00",
|
|
50
|
+
};
|
|
51
|
+
export class ThemeProvider {
|
|
52
|
+
currentTheme = { ...DEFAULT_THEME };
|
|
53
|
+
styleElement = null;
|
|
54
|
+
rootElement;
|
|
55
|
+
constructor(rootElement = typeof document !== "undefined"
|
|
56
|
+
? document.documentElement
|
|
57
|
+
: null) {
|
|
58
|
+
this.rootElement = rootElement;
|
|
59
|
+
// SSR guard
|
|
60
|
+
if (typeof document === "undefined") {
|
|
61
|
+
console.warn("ThemeProvider: document not available (SSR context)");
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
this.initializeStyles();
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Initialize theme styles
|
|
68
|
+
*/
|
|
69
|
+
initializeStyles() {
|
|
70
|
+
if (!this.rootElement)
|
|
71
|
+
return;
|
|
72
|
+
// Create style element if it doesn't exist
|
|
73
|
+
this.styleElement = document.getElementById("pie-theme-styles");
|
|
74
|
+
if (!this.styleElement) {
|
|
75
|
+
this.styleElement = document.createElement("style");
|
|
76
|
+
this.styleElement.id = "pie-theme-styles";
|
|
77
|
+
document.head.appendChild(this.styleElement);
|
|
78
|
+
}
|
|
79
|
+
// Apply default theme
|
|
80
|
+
this.applyTheme({});
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Apply theme configuration
|
|
84
|
+
*
|
|
85
|
+
* @param config Partial theme configuration (merged with current theme)
|
|
86
|
+
*/
|
|
87
|
+
applyTheme(config) {
|
|
88
|
+
if (!this.rootElement)
|
|
89
|
+
return;
|
|
90
|
+
// Merge with current theme
|
|
91
|
+
const newTheme = {
|
|
92
|
+
...this.currentTheme,
|
|
93
|
+
...config,
|
|
94
|
+
};
|
|
95
|
+
// Apply high contrast overrides if enabled
|
|
96
|
+
if (newTheme.highContrast) {
|
|
97
|
+
Object.assign(newTheme, HIGH_CONTRAST_THEME);
|
|
98
|
+
}
|
|
99
|
+
this.currentTheme = newTheme;
|
|
100
|
+
// Apply CSS custom properties
|
|
101
|
+
this.applyCSSVariables();
|
|
102
|
+
// Apply CSS classes
|
|
103
|
+
this.applyCSSClasses();
|
|
104
|
+
// Update global styles
|
|
105
|
+
this.updateGlobalStyles();
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Apply CSS custom properties to root element
|
|
109
|
+
*/
|
|
110
|
+
applyCSSVariables() {
|
|
111
|
+
if (!this.rootElement)
|
|
112
|
+
return;
|
|
113
|
+
const { fontSize, backgroundColor, foregroundColor, accentColor, linkColor, errorColor, successColor, warningColor, } = this.currentTheme;
|
|
114
|
+
// Font sizing
|
|
115
|
+
this.rootElement.style.setProperty("--pie-font-size-scale", String(FONT_SIZE_SCALE[fontSize]));
|
|
116
|
+
this.rootElement.style.setProperty("--pie-font-size-base", "1rem");
|
|
117
|
+
// Colors
|
|
118
|
+
this.rootElement.style.setProperty("--pie-bg-color", backgroundColor);
|
|
119
|
+
this.rootElement.style.setProperty("--pie-fg-color", foregroundColor);
|
|
120
|
+
this.rootElement.style.setProperty("--pie-accent-color", accentColor);
|
|
121
|
+
this.rootElement.style.setProperty("--pie-link-color", linkColor);
|
|
122
|
+
this.rootElement.style.setProperty("--pie-error-color", errorColor);
|
|
123
|
+
this.rootElement.style.setProperty("--pie-success-color", successColor);
|
|
124
|
+
this.rootElement.style.setProperty("--pie-warning-color", warningColor);
|
|
125
|
+
// Derived colors (with transparency)
|
|
126
|
+
this.rootElement.style.setProperty("--pie-bg-color-secondary", this.adjustOpacity(backgroundColor, 0.95));
|
|
127
|
+
this.rootElement.style.setProperty("--pie-border-color", this.adjustOpacity(foregroundColor, 0.2));
|
|
128
|
+
this.rootElement.style.setProperty("--pie-hover-color", this.adjustOpacity(accentColor, 0.1));
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Apply CSS classes to root element
|
|
132
|
+
*/
|
|
133
|
+
applyCSSClasses() {
|
|
134
|
+
if (!this.rootElement)
|
|
135
|
+
return;
|
|
136
|
+
const { highContrast, fontSize } = this.currentTheme;
|
|
137
|
+
// High contrast class
|
|
138
|
+
this.rootElement.classList.toggle("pie-high-contrast", highContrast);
|
|
139
|
+
// Font size classes
|
|
140
|
+
this.rootElement.classList.remove("pie-font-small", "pie-font-normal", "pie-font-large", "pie-font-xlarge");
|
|
141
|
+
this.rootElement.classList.add(`pie-font-${fontSize}`);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Update global theme styles
|
|
145
|
+
*/
|
|
146
|
+
updateGlobalStyles() {
|
|
147
|
+
if (!this.styleElement)
|
|
148
|
+
return;
|
|
149
|
+
const { fontSize } = this.currentTheme;
|
|
150
|
+
const scale = FONT_SIZE_SCALE[fontSize];
|
|
151
|
+
this.styleElement.textContent = `
|
|
152
|
+
/* PIE Assessment Toolkit - Theme Styles */
|
|
153
|
+
|
|
154
|
+
/* Font scaling */
|
|
155
|
+
.pie-themed,
|
|
156
|
+
.pie-themed * {
|
|
157
|
+
font-size: calc(var(--pie-font-size-base) * var(--pie-font-size-scale, 1));
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* Color theming */
|
|
161
|
+
.pie-themed {
|
|
162
|
+
background-color: var(--pie-bg-color);
|
|
163
|
+
color: var(--pie-fg-color);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.pie-themed a {
|
|
167
|
+
color: var(--pie-link-color);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.pie-themed a:hover {
|
|
171
|
+
opacity: 0.8;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/* High contrast mode */
|
|
175
|
+
.pie-high-contrast .pie-themed {
|
|
176
|
+
border: 2px solid var(--pie-fg-color);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.pie-high-contrast .pie-themed a {
|
|
180
|
+
text-decoration: underline;
|
|
181
|
+
font-weight: bold;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.pie-high-contrast .pie-themed button {
|
|
185
|
+
border: 2px solid var(--pie-fg-color);
|
|
186
|
+
background-color: var(--pie-bg-color);
|
|
187
|
+
color: var(--pie-fg-color);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.pie-high-contrast .pie-themed button:hover {
|
|
191
|
+
background-color: var(--pie-fg-color);
|
|
192
|
+
color: var(--pie-bg-color);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* Error/Success/Warning states */
|
|
196
|
+
.pie-themed .pie-error {
|
|
197
|
+
color: var(--pie-error-color);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.pie-themed .pie-success {
|
|
201
|
+
color: var(--pie-success-color);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.pie-themed .pie-warning {
|
|
205
|
+
color: var(--pie-warning-color);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* Focus indicators (accessibility) */
|
|
209
|
+
.pie-themed *:focus-visible {
|
|
210
|
+
outline: 3px solid var(--pie-accent-color);
|
|
211
|
+
outline-offset: 2px;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.pie-high-contrast *:focus-visible {
|
|
215
|
+
outline-width: 4px;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/* Responsive font scaling */
|
|
219
|
+
@media (max-width: 768px) {
|
|
220
|
+
.pie-themed,
|
|
221
|
+
.pie-themed * {
|
|
222
|
+
font-size: calc(var(--pie-font-size-base) * var(--pie-font-size-scale, 1) * 0.9);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
`;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Set high contrast mode
|
|
229
|
+
*/
|
|
230
|
+
setHighContrast(enabled) {
|
|
231
|
+
this.applyTheme({ highContrast: enabled });
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Set font size
|
|
235
|
+
*/
|
|
236
|
+
setFontSize(size) {
|
|
237
|
+
this.applyTheme({ fontSize: size });
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Set color scheme
|
|
241
|
+
*/
|
|
242
|
+
setColors(colors) {
|
|
243
|
+
this.applyTheme(colors);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Get current theme configuration
|
|
247
|
+
*/
|
|
248
|
+
getCurrentTheme() {
|
|
249
|
+
return { ...this.currentTheme };
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Reset to default theme
|
|
253
|
+
*/
|
|
254
|
+
reset() {
|
|
255
|
+
this.currentTheme = { ...DEFAULT_THEME };
|
|
256
|
+
this.applyTheme({});
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Adjust color opacity (helper)
|
|
260
|
+
*/
|
|
261
|
+
adjustOpacity(color, opacity) {
|
|
262
|
+
// Simple hex to rgba conversion
|
|
263
|
+
if (color.startsWith("#")) {
|
|
264
|
+
const r = parseInt(color.slice(1, 3), 16);
|
|
265
|
+
const g = parseInt(color.slice(3, 5), 16);
|
|
266
|
+
const b = parseInt(color.slice(5, 7), 16);
|
|
267
|
+
return `rgba(${r}, ${g}, ${b}, ${opacity})`;
|
|
268
|
+
}
|
|
269
|
+
// If already rgba/rgb, just return as-is (simplified)
|
|
270
|
+
return color;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Cleanup - remove theme styles
|
|
274
|
+
*/
|
|
275
|
+
destroy() {
|
|
276
|
+
if (this.styleElement) {
|
|
277
|
+
this.styleElement.remove();
|
|
278
|
+
this.styleElement = null;
|
|
279
|
+
}
|
|
280
|
+
if (!this.rootElement)
|
|
281
|
+
return;
|
|
282
|
+
// Remove CSS classes
|
|
283
|
+
this.rootElement.classList.remove("pie-high-contrast", "pie-font-small", "pie-font-normal", "pie-font-large", "pie-font-xlarge");
|
|
284
|
+
// Remove CSS custom properties
|
|
285
|
+
this.rootElement.style.removeProperty("--pie-font-size-scale");
|
|
286
|
+
this.rootElement.style.removeProperty("--pie-font-size-base");
|
|
287
|
+
this.rootElement.style.removeProperty("--pie-bg-color");
|
|
288
|
+
this.rootElement.style.removeProperty("--pie-fg-color");
|
|
289
|
+
this.rootElement.style.removeProperty("--pie-accent-color");
|
|
290
|
+
this.rootElement.style.removeProperty("--pie-link-color");
|
|
291
|
+
this.rootElement.style.removeProperty("--pie-error-color");
|
|
292
|
+
this.rootElement.style.removeProperty("--pie-success-color");
|
|
293
|
+
this.rootElement.style.removeProperty("--pie-warning-color");
|
|
294
|
+
this.rootElement.style.removeProperty("--pie-bg-color-secondary");
|
|
295
|
+
this.rootElement.style.removeProperty("--pie-border-color");
|
|
296
|
+
this.rootElement.style.removeProperty("--pie-hover-color");
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
//# sourceMappingURL=ThemeProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","sourceRoot":"","sources":["../../src/services/ThemeProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAwBH;;GAEG;AACH,MAAM,eAAe,GAA6B;IACjD,KAAK,EAAE,KAAK,EAAE,oBAAoB;IAClC,MAAM,EAAE,GAAG,EAAE,oBAAoB;IACjC,KAAK,EAAE,IAAI,EAAE,oBAAoB;IACjC,MAAM,EAAE,GAAG,EAAE,oBAAoB;CACjC,CAAC;AAEF;;GAEG;AACH,MAAM,aAAa,GAA0B;IAC5C,YAAY,EAAE,KAAK;IACnB,QAAQ,EAAE,QAAQ;IAClB,eAAe,EAAE,SAAS;IAC1B,eAAe,EAAE,SAAS;IAC1B,WAAW,EAAE,SAAS;IACtB,SAAS,EAAE,SAAS;IACpB,UAAU,EAAE,SAAS;IACrB,YAAY,EAAE,SAAS;IACvB,YAAY,EAAE,SAAS;CACvB,CAAC;AAEF;;GAEG;AACH,MAAM,mBAAmB,GAAyB;IACjD,eAAe,EAAE,SAAS;IAC1B,eAAe,EAAE,SAAS;IAC1B,WAAW,EAAE,SAAS;IACtB,SAAS,EAAE,SAAS;IACpB,UAAU,EAAE,SAAS;IACrB,YAAY,EAAE,SAAS;IACvB,YAAY,EAAE,SAAS;CAC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,CAAC;QAC5D,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;IAC5D,CAAC;CACD"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToolConfigResolver
|
|
3
|
+
*
|
|
4
|
+
* Implements 3-tier hierarchy for tool configuration:
|
|
5
|
+
* Item requirements > Roster allowances > Student accommodations
|
|
6
|
+
*
|
|
7
|
+
* Ensures IEP/504 compliance by properly handling accommodation requirements
|
|
8
|
+
* while respecting item-level and test-level restrictions.
|
|
9
|
+
*
|
|
10
|
+
* Features:
|
|
11
|
+
* - 3-tier configuration hierarchy
|
|
12
|
+
* - IEP/504 accommodation support
|
|
13
|
+
* - Item-specific tool requirements
|
|
14
|
+
* - Test-level tool restrictions
|
|
15
|
+
* - Type-safe configuration
|
|
16
|
+
*
|
|
17
|
+
* Part of PIE Assessment Toolkit.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Tool allowance: "0" = blocked, "1" = allowed
|
|
21
|
+
*/
|
|
22
|
+
export type ToolAllowance = "0" | "1";
|
|
23
|
+
/**
|
|
24
|
+
* Item-level tool configuration (most specific)
|
|
25
|
+
*/
|
|
26
|
+
export interface ItemToolConfig {
|
|
27
|
+
[toolId: string]: {
|
|
28
|
+
type?: string;
|
|
29
|
+
required?: boolean;
|
|
30
|
+
settings?: any;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Roster/Test-level tool allowances (assessment-wide rules)
|
|
35
|
+
*/
|
|
36
|
+
export interface RosterToolConfig {
|
|
37
|
+
[toolId: string]: ToolAllowance;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Student accommodation profile (least specific)
|
|
41
|
+
*/
|
|
42
|
+
export interface StudentAccommodations {
|
|
43
|
+
accommodations: string[];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Resolved tool configuration
|
|
47
|
+
*/
|
|
48
|
+
export interface ResolvedToolConfig {
|
|
49
|
+
enabled: boolean;
|
|
50
|
+
type?: string;
|
|
51
|
+
required?: boolean;
|
|
52
|
+
settings?: any;
|
|
53
|
+
source: "item" | "roster" | "student" | "default";
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Full configuration input
|
|
57
|
+
*/
|
|
58
|
+
export interface ToolConfigInput {
|
|
59
|
+
itemConfig?: ItemToolConfig;
|
|
60
|
+
rosterConfig?: RosterToolConfig;
|
|
61
|
+
studentProfile?: StudentAccommodations;
|
|
62
|
+
}
|
|
63
|
+
export declare class ToolConfigResolver {
|
|
64
|
+
/**
|
|
65
|
+
* Resolve configuration for a specific tool
|
|
66
|
+
*
|
|
67
|
+
* Hierarchy (highest to lowest priority):
|
|
68
|
+
* 1. Item level: Item requires scientific calculator → must provide
|
|
69
|
+
* 2. Roster level: Test blocks dictionary → blocked regardless of accommodation
|
|
70
|
+
* 3. Student level: IEP requires TTS → enabled unless blocked above
|
|
71
|
+
*
|
|
72
|
+
* @param toolId Tool identifier
|
|
73
|
+
* @param itemConfig Item-level tool configuration
|
|
74
|
+
* @param rosterConfig Roster-level tool allowances
|
|
75
|
+
* @param studentProfile Student accommodation profile
|
|
76
|
+
* @returns Resolved configuration or null if tool not available
|
|
77
|
+
*/
|
|
78
|
+
resolveTool(toolId: string, itemConfig?: ItemToolConfig, rosterConfig?: RosterToolConfig, studentProfile?: StudentAccommodations): ResolvedToolConfig | null;
|
|
79
|
+
/**
|
|
80
|
+
* Resolve all tools from configuration
|
|
81
|
+
*
|
|
82
|
+
* @param input Configuration input
|
|
83
|
+
* @returns Map of tool ID to resolved configuration
|
|
84
|
+
*/
|
|
85
|
+
resolveAll(input: ToolConfigInput): Map<string, ResolvedToolConfig>;
|
|
86
|
+
/**
|
|
87
|
+
* Check if a tool is enabled
|
|
88
|
+
*
|
|
89
|
+
* @param toolId Tool identifier
|
|
90
|
+
* @param input Configuration input
|
|
91
|
+
* @returns true if tool is enabled
|
|
92
|
+
*/
|
|
93
|
+
isToolEnabled(toolId: string, input: ToolConfigInput): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Check if a tool is required
|
|
96
|
+
*
|
|
97
|
+
* @param toolId Tool identifier
|
|
98
|
+
* @param input Configuration input
|
|
99
|
+
* @returns true if tool is required
|
|
100
|
+
*/
|
|
101
|
+
isToolRequired(toolId: string, input: ToolConfigInput): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Get tool type (e.g., 'scientific' for calculator)
|
|
104
|
+
*
|
|
105
|
+
* @param toolId Tool identifier
|
|
106
|
+
* @param input Configuration input
|
|
107
|
+
* @returns Tool type or null
|
|
108
|
+
*/
|
|
109
|
+
getToolType(toolId: string, input: ToolConfigInput): string | null;
|
|
110
|
+
/**
|
|
111
|
+
* Get tool settings
|
|
112
|
+
*
|
|
113
|
+
* @param toolId Tool identifier
|
|
114
|
+
* @param input Configuration input
|
|
115
|
+
* @returns Tool settings or null
|
|
116
|
+
*/
|
|
117
|
+
getToolSettings(toolId: string, input: ToolConfigInput): any | null;
|
|
118
|
+
/**
|
|
119
|
+
* Get list of all enabled tools
|
|
120
|
+
*
|
|
121
|
+
* @param input Configuration input
|
|
122
|
+
* @returns Array of enabled tool IDs
|
|
123
|
+
*/
|
|
124
|
+
getEnabledTools(input: ToolConfigInput): string[];
|
|
125
|
+
/**
|
|
126
|
+
* Get list of required tools
|
|
127
|
+
*
|
|
128
|
+
* @param input Configuration input
|
|
129
|
+
* @returns Array of required tool IDs
|
|
130
|
+
*/
|
|
131
|
+
getRequiredTools(input: ToolConfigInput): string[];
|
|
132
|
+
/**
|
|
133
|
+
* Validate that all required tools are available
|
|
134
|
+
*
|
|
135
|
+
* @param availableTools Set of available tool IDs
|
|
136
|
+
* @param input Configuration input
|
|
137
|
+
* @returns Object with validation result
|
|
138
|
+
*/
|
|
139
|
+
validate(availableTools: Set<string>, input: ToolConfigInput): {
|
|
140
|
+
valid: boolean;
|
|
141
|
+
missingTools: string[];
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Merge multiple roster configurations (for complex assessments)
|
|
145
|
+
*
|
|
146
|
+
* More restrictive settings win (blocked > allowed).
|
|
147
|
+
*
|
|
148
|
+
* @param configs Array of roster configurations
|
|
149
|
+
* @returns Merged configuration
|
|
150
|
+
*/
|
|
151
|
+
mergeRosterConfigs(...configs: RosterToolConfig[]): RosterToolConfig;
|
|
152
|
+
/**
|
|
153
|
+
* Merge multiple student accommodation profiles
|
|
154
|
+
*
|
|
155
|
+
* Union of all accommodations.
|
|
156
|
+
*
|
|
157
|
+
* @param profiles Array of student profiles
|
|
158
|
+
* @returns Merged profile
|
|
159
|
+
*/
|
|
160
|
+
mergeStudentProfiles(...profiles: StudentAccommodations[]): StudentAccommodations;
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=ToolConfigResolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolConfigResolver.d.ts","sourceRoot":"","sources":["../../src/services/ToolConfigResolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,GAAG,GAAG,GAAG,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,CAAC,MAAM,EAAE,MAAM,GAAG;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,QAAQ,CAAC,EAAE,GAAG,CAAC;KACf,CAAC;CACF;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC,cAAc,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC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