@pie-players/pie-assessment-toolkit 0.3.73 → 0.3.75

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.
Files changed (274) hide show
  1. package/README.md +469 -318
  2. package/dist/attempt/AssessmentSession.d.ts +1 -5
  3. package/dist/attempt/AssessmentSession.js +0 -29
  4. package/dist/attempt/TestSession.d.ts +1 -20
  5. package/dist/attempt/TestSession.js +8 -99
  6. package/dist/components/ItemScope.custom-element.d.ts +1 -0
  7. package/dist/components/ItemScope.custom-element.js +1 -0
  8. package/dist/components/ItemToolBar.custom-element.d.ts +1 -0
  9. package/dist/components/ItemToolBar.custom-element.js +1 -1
  10. package/dist/components/PieAssessmentToolkit.custom-element.d.ts +1 -0
  11. package/dist/components/PieAssessmentToolkit.custom-element.js +13 -13
  12. package/dist/components/SectionToolBar.custom-element.d.ts +1 -0
  13. package/dist/components/SectionToolBar.custom-element.js +1 -1
  14. package/dist/components/chunks/ItemToolBar-7tt7v2xp.js +4 -0
  15. package/dist/components/chunks/ItemToolBar-97hx60z4.js +2 -0
  16. package/dist/components/chunks/ItemToolBar-bxwyhr5p.js +2 -0
  17. package/dist/components/chunks/ItemToolBar-jx38w99s.js +2 -0
  18. package/dist/components/chunks/ItemToolBar-rd2bb4p6.js +40 -0
  19. package/dist/components/chunks/ItemToolBar-vdkyn9f3.js +2 -0
  20. package/dist/components/chunks/sre-engine-jd8cc08x.js +1 -0
  21. package/dist/components/item-scope-element.d.ts +2 -0
  22. package/dist/components/item-scope-element.js +2 -0
  23. package/dist/context/assessment-toolkit-context.d.ts +32 -6
  24. package/dist/index.d.ts +23 -48
  25. package/dist/index.js +12 -37
  26. package/dist/policy/core/PolicySource.d.ts +1 -1
  27. package/dist/policy/core/ToolPolicyEngine.d.ts +85 -34
  28. package/dist/policy/core/ToolPolicyEngine.js +148 -46
  29. package/dist/policy/core/compose-decision.d.ts +28 -7
  30. package/dist/policy/core/compose-decision.js +75 -54
  31. package/dist/policy/core/decision-types.d.ts +65 -34
  32. package/dist/policy/core/feature-decision.d.ts +16 -9
  33. package/dist/policy/core/feature-decision.js +14 -8
  34. package/dist/policy/core/pnp-policy-inputs.d.ts +24 -33
  35. package/dist/policy/core/pnp-policy-inputs.js +28 -56
  36. package/dist/policy/core/provenance.d.ts +9 -4
  37. package/dist/policy/core/provenance.js +1 -1
  38. package/dist/policy/engine.d.ts +7 -23
  39. package/dist/policy/engine.js +5 -20
  40. package/dist/policy/sources/PnpPolicySource.d.ts +44 -61
  41. package/dist/policy/sources/PnpPolicySource.js +117 -118
  42. package/dist/runtime/SectionControllerBinding.d.ts +279 -0
  43. package/dist/runtime/SectionControllerBinding.js +450 -0
  44. package/dist/runtime/SectionRuntimeEngine.d.ts +26 -289
  45. package/dist/runtime/SectionRuntimeEngine.js +30 -372
  46. package/dist/runtime/adapter/SectionEngineAdapter.d.ts +19 -80
  47. package/dist/runtime/adapter/SectionEngineAdapter.js +19 -92
  48. package/dist/runtime/adapter/dom-event-bridge.d.ts +15 -30
  49. package/dist/runtime/adapter/dom-event-bridge.js +17 -44
  50. package/dist/runtime/adapter/subscriber-fanout.d.ts +1 -2
  51. package/dist/runtime/adapter/subscriber-fanout.js +1 -2
  52. package/dist/runtime/catalog-context.d.ts +19 -0
  53. package/dist/runtime/catalog-context.js +28 -0
  54. package/dist/runtime/composition-emit-scheduler.d.ts +9 -15
  55. package/dist/runtime/composition-emit-scheduler.js +9 -15
  56. package/dist/runtime/content-language.d.ts +32 -0
  57. package/dist/runtime/content-language.js +46 -0
  58. package/dist/runtime/content-region.d.ts +17 -0
  59. package/dist/runtime/content-region.js +29 -0
  60. package/dist/runtime/content-registration.d.ts +13 -0
  61. package/dist/runtime/content-registration.js +25 -0
  62. package/dist/runtime/core/SectionEngineCore.d.ts +2 -2
  63. package/dist/runtime/core/SectionEngineCore.js +2 -2
  64. package/dist/runtime/core/cohort.d.ts +1 -1
  65. package/dist/runtime/core/cohort.js +1 -1
  66. package/dist/runtime/core/engine-input.d.ts +18 -30
  67. package/dist/runtime/core/engine-input.js +11 -12
  68. package/dist/runtime/core/engine-output.d.ts +16 -40
  69. package/dist/runtime/core/engine-output.js +9 -21
  70. package/dist/runtime/core/engine-readiness.d.ts +5 -37
  71. package/dist/runtime/core/engine-readiness.js +8 -41
  72. package/dist/runtime/core/engine-resolver.d.ts +46 -74
  73. package/dist/runtime/core/engine-resolver.js +18 -43
  74. package/dist/runtime/core/engine-state.d.ts +28 -36
  75. package/dist/runtime/core/engine-state.js +18 -21
  76. package/dist/runtime/core/engine-transition.d.ts +14 -19
  77. package/dist/runtime/core/engine-transition.js +71 -51
  78. package/dist/runtime/engine.d.ts +16 -19
  79. package/dist/runtime/engine.js +12 -19
  80. package/dist/runtime/page-warnings.d.ts +13 -0
  81. package/dist/runtime/page-warnings.js +22 -0
  82. package/dist/runtime/policy-input-forwarding.d.ts +25 -0
  83. package/dist/runtime/policy-input-forwarding.js +25 -0
  84. package/dist/runtime/registration-events.d.ts +14 -0
  85. package/dist/runtime/runtime-event-claim.d.ts +8 -0
  86. package/dist/runtime/runtime-event-claim.js +15 -0
  87. package/dist/runtime/shell-event-bridge.d.ts +45 -0
  88. package/dist/runtime/shell-event-bridge.js +127 -0
  89. package/dist/runtime/shell-registration.d.ts +73 -0
  90. package/dist/runtime/shell-registration.js +95 -0
  91. package/dist/runtime/shell-scope.d.ts +68 -0
  92. package/dist/runtime/shell-scope.js +188 -0
  93. package/dist/runtime/tool-host-contract.d.ts +28 -10
  94. package/dist/runtime/tool-host-contract.js +31 -10
  95. package/dist/runtime/unclaimed-registration-watch.d.ts +7 -0
  96. package/dist/runtime/unclaimed-registration-watch.js +23 -0
  97. package/dist/services/ElementToolStateStore.d.ts +14 -10
  98. package/dist/services/ElementToolStateStore.js +37 -13
  99. package/dist/services/HighlightCoordinator.d.ts +22 -28
  100. package/dist/services/HighlightCoordinator.js +431 -327
  101. package/dist/services/RangeSerializer.d.ts +10 -1
  102. package/dist/services/RangeSerializer.js +87 -14
  103. package/dist/services/TTSService.d.ts +130 -69
  104. package/dist/services/TTSService.js +713 -570
  105. package/dist/services/ToolCoordinator.d.ts +43 -66
  106. package/dist/services/ToolCoordinator.js +164 -208
  107. package/dist/services/ToolRegistry.d.ts +78 -54
  108. package/dist/services/ToolRegistry.js +107 -105
  109. package/dist/services/ToolkitCoordinator.d.ts +261 -175
  110. package/dist/services/ToolkitCoordinator.js +667 -433
  111. package/dist/services/audio-handoff.d.ts +6 -7
  112. package/dist/services/audio-handoff.js +20 -14
  113. package/dist/services/catalog-owner.d.ts +11 -1
  114. package/dist/services/catalog-owner.js +25 -0
  115. package/dist/services/create-tools-config.d.ts +2 -2
  116. package/dist/services/framework-error-bus.d.ts +3 -6
  117. package/dist/services/framework-error-bus.js +3 -6
  118. package/dist/services/framework-error.d.ts +30 -8
  119. package/dist/services/framework-error.js +9 -7
  120. package/dist/services/interfaces.d.ts +158 -129
  121. package/dist/services/section-controller-types.d.ts +15 -0
  122. package/dist/services/section-session-assignment.d.ts +21 -0
  123. package/dist/services/section-session-assignment.js +82 -0
  124. package/dist/services/spoken-audio-cards.d.ts +0 -2
  125. package/dist/services/spoken-audio-cards.js +1 -3
  126. package/dist/services/tool-config-defaults.d.ts +3 -3
  127. package/dist/services/tool-config-defaults.js +3 -3
  128. package/dist/services/tool-config-validation.d.ts +14 -4
  129. package/dist/services/tool-config-validation.js +63 -71
  130. package/dist/services/tool-context.d.ts +0 -8
  131. package/dist/services/tool-context.js +29 -25
  132. package/dist/services/tool-icons.d.ts +4 -3
  133. package/dist/services/tool-icons.js +4 -3
  134. package/dist/services/tool-instance-id.d.ts +0 -1
  135. package/dist/services/tool-instance-id.js +0 -6
  136. package/dist/services/tool-providers/TTSToolProvider.d.ts +41 -80
  137. package/dist/services/tool-providers/TTSToolProvider.js +81 -40
  138. package/dist/services/tool-providers/ToolProviderApi.d.ts +10 -4
  139. package/dist/services/tool-providers/ToolProviderRegistry.d.ts +32 -28
  140. package/dist/services/tool-providers/ToolProviderRegistry.js +121 -107
  141. package/dist/services/tool-providers/index.d.ts +0 -9
  142. package/dist/services/tool-providers/index.js +2 -4
  143. package/dist/services/tool-request.d.ts +27 -12
  144. package/dist/services/tool-request.js +24 -14
  145. package/dist/services/toolbar-decided-tools.d.ts +15 -0
  146. package/dist/services/toolbar-decided-tools.js +28 -0
  147. package/dist/services/tools-config-normalizer.d.ts +37 -23
  148. package/dist/services/tools-config-normalizer.js +2 -10
  149. package/dist/services/tts/browser-provider.d.ts +38 -2
  150. package/dist/services/tts/browser-provider.js +276 -140
  151. package/dist/services/tts/catalog-span-alignment.d.ts +2 -17
  152. package/dist/services/tts/catalog-span-alignment.js +17 -142
  153. package/dist/services/tts/flat-tree.d.ts +71 -0
  154. package/dist/services/tts/flat-tree.js +269 -0
  155. package/dist/services/tts/generated-speech/assemble-plan.d.ts +3 -1
  156. package/dist/services/tts/generated-speech/assemble-plan.js +3 -1
  157. package/dist/services/tts/generated-speech/dom/build-dom-plan.d.ts +2 -0
  158. package/dist/services/tts/generated-speech/dom/build-dom-plan.js +1 -1
  159. package/dist/services/tts/generated-speech/math-speech-cache.d.ts +3 -1
  160. package/dist/services/tts/generated-speech/math-speech-cache.js +5 -1
  161. package/dist/services/tts/generated-speech/types.d.ts +0 -12
  162. package/dist/services/tts/highlight-pipeline/boundary-normalizer.js +12 -62
  163. package/dist/services/tts/highlight-pipeline/create-highlight-plan.js +38 -5
  164. package/dist/services/tts/highlight-pipeline/normalize-speech-chunks.js +3 -6
  165. package/dist/services/tts/highlight-pipeline/prose-boundary-resolver.js +6 -4
  166. package/dist/services/tts/highlight-pipeline/readable-region.js +3 -2
  167. package/dist/services/tts/highlight-pipeline/types.d.ts +5 -0
  168. package/dist/services/tts/highlight-pipeline/visible-map-range.d.ts +12 -0
  169. package/dist/services/tts/highlight-pipeline/visible-map-range.js +73 -7
  170. package/dist/services/tts/math-alignment/index.d.ts +0 -5
  171. package/dist/services/tts/math-alignment/index.js +5 -25
  172. package/dist/services/tts/math-alignment/speech-tokenizer.d.ts +9 -1
  173. package/dist/services/tts/math-alignment/speech-tokenizer.js +38 -36
  174. package/dist/services/tts/math-alignment/types.d.ts +4 -2
  175. package/dist/services/tts/math-aware-text-processing.d.ts +5 -1
  176. package/dist/services/tts/math-aware-text-processing.js +74 -18
  177. package/dist/services/tts/math-control-names.d.ts +21 -0
  178. package/dist/services/tts/math-control-names.js +142 -0
  179. package/dist/services/tts/math-speech.d.ts +16 -1
  180. package/dist/services/tts/math-speech.js +55 -19
  181. package/dist/services/tts/provider-options.d.ts +41 -0
  182. package/dist/services/tts/provider-options.js +1 -0
  183. package/dist/services/tts/sre-engine.d.ts +7 -0
  184. package/dist/services/tts/sre-engine.js +11 -0
  185. package/dist/services/tts/sre-locales.d.ts +14 -0
  186. package/dist/services/tts/sre-locales.js +57 -0
  187. package/dist/services/tts/ssml/spoken-text.d.ts +2 -26
  188. package/dist/services/tts/ssml/spoken-text.js +29 -0
  189. package/dist/services/tts/start-failure.d.ts +11 -0
  190. package/dist/services/tts/start-failure.js +19 -0
  191. package/dist/services/tts/text-processing.d.ts +9 -1
  192. package/dist/services/tts/text-processing.js +46 -34
  193. package/dist/services/tts/text-segmentation.d.ts +7 -0
  194. package/dist/services/tts/text-segmentation.js +47 -0
  195. package/dist/services/tts-runtime-config.d.ts +44 -18
  196. package/dist/services/tts-runtime-config.js +22 -93
  197. package/dist/tools/content-capability-resolution.d.ts +7 -9
  198. package/dist/tools/content-capability-resolution.js +8 -45
  199. package/dist/tools/registration.d.ts +58 -0
  200. package/dist/tools/registration.js +54 -0
  201. package/dist/tools/registrations/toolbar-registration-helpers.js +2 -2
  202. package/dist/tools/tool-surface-host.d.ts +6 -10
  203. package/dist/tools/tool-surface-host.js +44 -42
  204. package/dist/tools/tool-tag-map.d.ts +5 -15
  205. package/dist/tools/tool-tag-map.js +6 -20
  206. package/dist/utils/structural-equality.d.ts +11 -0
  207. package/dist/utils/structural-equality.js +47 -0
  208. package/package.json +24 -59
  209. package/dist/attempt/adapters/activity-to-test-attempt-session.d.ts +0 -49
  210. package/dist/attempt/adapters/activity-to-test-attempt-session.js +0 -138
  211. package/dist/components/chunks/ItemToolBar-byq80z42.js +0 -40
  212. package/dist/components/chunks/ItemToolBar-d36g3aw4.js +0 -49
  213. package/dist/context/runtime-context-consumer.d.ts +0 -13
  214. package/dist/context/runtime-context-consumer.js +0 -51
  215. package/dist/item-loader.d.ts +0 -44
  216. package/dist/item-loader.js +0 -61
  217. package/dist/policy/core/engine-context.d.ts +0 -29
  218. package/dist/policy/core/engine-context.js +0 -27
  219. package/dist/policy/core/policy-source-tag.d.ts +0 -31
  220. package/dist/policy/core/policy-source-tag.js +0 -28
  221. package/dist/policy/internal.d.ts +0 -25
  222. package/dist/policy/internal.js +0 -25
  223. package/dist/runtime/adapter/coordinator-bridge.d.ts +0 -92
  224. package/dist/runtime/adapter/coordinator-bridge.js +0 -126
  225. package/dist/runtime/adapter/framework-error-bridge.d.ts +0 -36
  226. package/dist/runtime/adapter/framework-error-bridge.js +0 -46
  227. package/dist/runtime/adapter/instrumentation-bridge.d.ts +0 -31
  228. package/dist/runtime/adapter/instrumentation-bridge.js +0 -38
  229. package/dist/runtime/core/engine-stage-derivation.d.ts +0 -18
  230. package/dist/runtime/core/engine-stage-derivation.js +0 -29
  231. package/dist/runtime/engine-context.d.ts +0 -39
  232. package/dist/runtime/engine-context.js +0 -31
  233. package/dist/runtime/internal.d.ts +0 -43
  234. package/dist/runtime/internal.js +0 -45
  235. package/dist/runtime/section-runtime-engine-host-context.d.ts +0 -80
  236. package/dist/runtime/section-runtime-engine-host-context.js +0 -95
  237. package/dist/runtime/stage-emit-gate.d.ts +0 -92
  238. package/dist/runtime/stage-emit-gate.js +0 -82
  239. package/dist/services/I18nService.d.ts +0 -47
  240. package/dist/services/I18nService.js +0 -84
  241. package/dist/services/ThemeProvider.d.ts +0 -95
  242. package/dist/services/ThemeProvider.js +0 -334
  243. package/dist/services/ToolConfigResolver.d.ts +0 -161
  244. package/dist/services/ToolConfigResolver.js +0 -229
  245. package/dist/services/catalog-media.d.ts +0 -56
  246. package/dist/services/catalog-media.js +0 -190
  247. package/dist/services/createDefaultToolRegistry.d.ts +0 -53
  248. package/dist/services/createDefaultToolRegistry.js +0 -45
  249. package/dist/services/defaultPersonalNeedsProfile.d.ts +0 -21
  250. package/dist/services/defaultPersonalNeedsProfile.js +0 -26
  251. package/dist/services/pnp-standard-features.d.ts +0 -238
  252. package/dist/services/pnp-standard-features.js +0 -338
  253. package/dist/services/tool-providers/CortexToolProvider.d.ts +0 -13
  254. package/dist/services/tool-providers/CortexToolProvider.js +0 -32
  255. package/dist/services/tool-providers/DesmosToolProvider.d.ts +0 -14
  256. package/dist/services/tool-providers/DesmosToolProvider.js +0 -32
  257. package/dist/services/tool-providers/GeoGebraToolProvider.d.ts +0 -16
  258. package/dist/services/tool-providers/GeoGebraToolProvider.js +0 -32
  259. package/dist/services/tool-providers/LazyCalculatorToolProvider.d.ts +0 -35
  260. package/dist/services/tool-providers/LazyCalculatorToolProvider.js +0 -95
  261. package/dist/services/tts/visual-line-ranges.d.ts +0 -18
  262. package/dist/services/tts/visual-line-ranges.js +0 -226
  263. package/dist/tools/client.d.ts +0 -12
  264. package/dist/tools/client.js +0 -14
  265. package/dist/tools/index.d.ts +0 -8
  266. package/dist/tools/index.js +0 -10
  267. package/dist/tools/internal.d.ts +0 -43
  268. package/dist/tools/internal.js +0 -41
  269. package/dist/tools/response-discovery.d.ts +0 -61
  270. package/dist/tools/response-discovery.js +0 -113
  271. package/dist/tools/types.d.ts +0 -337
  272. package/dist/tools/types.js +0 -12
  273. package/dist/tools/variant-resolver.d.ts +0 -41
  274. package/dist/tools/variant-resolver.js +0 -207
@@ -1,334 +0,0 @@
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
- /**
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: "#000000",
33
- accentColor: "#3f51b5",
34
- linkColor: "#146eb3",
35
- errorColor: "#ff9800",
36
- successColor: "#4caf50",
37
- warningColor: "#d32f2f",
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
- styleContainer = null;
56
- constructor(rootElement = typeof document !== "undefined"
57
- ? document.documentElement
58
- : null) {
59
- this.rootElement = rootElement;
60
- // SSR guard
61
- if (typeof document === "undefined") {
62
- console.warn("ThemeProvider: document not available (SSR context)");
63
- return;
64
- }
65
- this.initializeStyles();
66
- }
67
- /**
68
- * Initialize theme styles
69
- */
70
- initializeStyles() {
71
- if (!this.rootElement)
72
- return;
73
- const rootNode = this.rootElement.getRootNode();
74
- if (rootNode instanceof ShadowRoot) {
75
- this.styleContainer = rootNode;
76
- this.styleElement = rootNode.querySelector('style[data-pie-theme-styles="true"]');
77
- }
78
- else {
79
- this.styleContainer = document.head;
80
- this.styleElement = document.getElementById("pie-theme-styles");
81
- }
82
- if (!this.styleElement) {
83
- this.styleElement = document.createElement("style");
84
- if (this.styleContainer instanceof ShadowRoot) {
85
- this.styleElement.setAttribute("data-pie-theme-styles", "true");
86
- this.styleContainer.appendChild(this.styleElement);
87
- }
88
- else {
89
- this.styleElement.id = "pie-theme-styles";
90
- document.head.appendChild(this.styleElement);
91
- }
92
- }
93
- // Apply default theme
94
- this.applyTheme({});
95
- }
96
- /**
97
- * Apply theme configuration
98
- *
99
- * @param config Partial theme configuration (merged with current theme)
100
- */
101
- applyTheme(config) {
102
- if (!this.rootElement)
103
- return;
104
- // Merge with current theme
105
- const newTheme = {
106
- ...this.currentTheme,
107
- ...config,
108
- };
109
- // Apply high contrast overrides if enabled
110
- if (newTheme.highContrast) {
111
- Object.assign(newTheme, HIGH_CONTRAST_THEME);
112
- }
113
- this.currentTheme = newTheme;
114
- // Apply CSS custom properties
115
- this.applyCSSVariables();
116
- // Apply CSS classes
117
- this.applyCSSClasses();
118
- // Update global styles
119
- this.updateGlobalStyles();
120
- }
121
- /**
122
- * Apply CSS custom properties to root element
123
- */
124
- applyCSSVariables() {
125
- if (!this.rootElement)
126
- return;
127
- const { fontSize, backgroundColor, foregroundColor, accentColor, linkColor, errorColor, successColor, warningColor, } = this.currentTheme;
128
- // Font sizing
129
- this.rootElement.style.setProperty("--pie-font-scale", String(FONT_SIZE_SCALE[fontSize]));
130
- // Canonical PIE variables
131
- this.rootElement.style.setProperty("--pie-background", backgroundColor);
132
- this.rootElement.style.setProperty("--pie-text", foregroundColor);
133
- this.rootElement.style.setProperty("--pie-primary", accentColor);
134
- this.rootElement.style.setProperty("--pie-tertiary", linkColor);
135
- this.rootElement.style.setProperty("--pie-incorrect", errorColor);
136
- this.rootElement.style.setProperty("--pie-correct", successColor);
137
- this.rootElement.style.setProperty("--pie-missing", warningColor);
138
- // Derived surface tokens
139
- this.rootElement.style.setProperty("--pie-background-dark", this.adjustOpacity(backgroundColor, 0.95));
140
- this.rootElement.style.setProperty("--pie-secondary-background", this.adjustOpacity(backgroundColor, 0.92));
141
- this.rootElement.style.setProperty("--pie-border", this.adjustOpacity(foregroundColor, 0.25));
142
- this.rootElement.style.setProperty("--pie-border-light", this.adjustOpacity(foregroundColor, 0.16));
143
- this.rootElement.style.setProperty("--pie-border-dark", this.adjustOpacity(foregroundColor, 0.4));
144
- this.rootElement.style.setProperty("--pie-focus-checked", this.adjustOpacity(accentColor, 0.18));
145
- this.rootElement.style.setProperty("--pie-focus-checked-border", accentColor);
146
- // Button tokens used by toolkit controls
147
- this.rootElement.style.setProperty("--pie-button-bg", backgroundColor);
148
- this.rootElement.style.setProperty("--pie-button-border", this.adjustOpacity(foregroundColor, 0.2));
149
- this.rootElement.style.setProperty("--pie-button-color", foregroundColor);
150
- this.rootElement.style.setProperty("--pie-button-hover-bg", this.adjustOpacity(accentColor, 0.1));
151
- this.rootElement.style.setProperty("--pie-button-hover-border", this.adjustOpacity(accentColor, 0.5));
152
- this.rootElement.style.setProperty("--pie-button-hover-color", foregroundColor);
153
- this.rootElement.style.setProperty("--pie-button-active-bg", this.adjustOpacity(accentColor, 0.16));
154
- this.rootElement.style.setProperty("--pie-button-focus-outline", accentColor);
155
- }
156
- /**
157
- * Apply CSS classes to root element
158
- */
159
- applyCSSClasses() {
160
- if (!this.rootElement)
161
- return;
162
- const { highContrast, fontSize } = this.currentTheme;
163
- // High contrast class
164
- this.rootElement.classList.toggle("pie-high-contrast", highContrast);
165
- // Font size classes
166
- this.rootElement.classList.remove("pie-font-small", "pie-font-normal", "pie-font-large", "pie-font-xlarge");
167
- this.rootElement.classList.add(`pie-font-${fontSize}`);
168
- }
169
- /**
170
- * Update global theme styles
171
- */
172
- updateGlobalStyles() {
173
- if (!this.styleElement)
174
- return;
175
- this.styleElement.textContent = `
176
- /* PIE Assessment Toolkit - Theme Styles */
177
-
178
- /* Font scaling */
179
- .pie-themed,
180
- .pie-themed * {
181
- font-size: calc(1rem * var(--pie-font-scale, 1));
182
- }
183
-
184
- /* Color theming */
185
- .pie-themed {
186
- background-color: var(--pie-background);
187
- color: var(--pie-text);
188
- }
189
-
190
- .pie-themed a {
191
- color: var(--pie-tertiary);
192
- }
193
-
194
- .pie-themed a:hover {
195
- opacity: 0.8;
196
- }
197
-
198
- /* High contrast mode */
199
- .pie-high-contrast .pie-themed {
200
- border: 2px solid var(--pie-text);
201
- }
202
-
203
- .pie-high-contrast .pie-themed a {
204
- text-decoration: underline;
205
- font-weight: bold;
206
- }
207
-
208
- .pie-high-contrast .pie-themed button {
209
- border: 2px solid var(--pie-text);
210
- background-color: var(--pie-background);
211
- color: var(--pie-text);
212
- }
213
-
214
- .pie-high-contrast .pie-themed button:hover {
215
- background-color: var(--pie-text);
216
- color: var(--pie-background);
217
- }
218
-
219
- /* Error/Success/Warning states */
220
- .pie-themed .pie-error {
221
- color: var(--pie-incorrect);
222
- }
223
-
224
- .pie-themed .pie-success {
225
- color: var(--pie-correct);
226
- }
227
-
228
- .pie-themed .pie-warning {
229
- color: var(--pie-missing);
230
- }
231
-
232
- /* Focus indicators (accessibility) */
233
- .pie-themed *:focus-visible {
234
- outline: 3px solid var(--pie-focus-checked-border);
235
- outline-offset: 2px;
236
- }
237
-
238
- .pie-high-contrast *:focus-visible {
239
- outline-width: 4px;
240
- }
241
-
242
- /* Responsive font scaling */
243
- @media (max-width: 768px) {
244
- .pie-themed,
245
- .pie-themed * {
246
- font-size: calc(1rem * var(--pie-font-scale, 1) * 0.9);
247
- }
248
- }
249
- `;
250
- }
251
- /**
252
- * Set high contrast mode
253
- */
254
- setHighContrast(enabled) {
255
- this.applyTheme({ highContrast: enabled });
256
- }
257
- /**
258
- * Set font size
259
- */
260
- setFontSize(size) {
261
- this.applyTheme({ fontSize: size });
262
- }
263
- /**
264
- * Set color scheme
265
- */
266
- setColors(colors) {
267
- this.applyTheme(colors);
268
- }
269
- /**
270
- * Get current theme configuration
271
- */
272
- getCurrentTheme() {
273
- return { ...this.currentTheme };
274
- }
275
- /**
276
- * Reset to default theme
277
- */
278
- reset() {
279
- this.currentTheme = { ...DEFAULT_THEME };
280
- this.applyTheme({});
281
- }
282
- /**
283
- * Adjust color opacity (helper)
284
- */
285
- adjustOpacity(color, opacity) {
286
- // Simple hex to rgba conversion
287
- if (color.startsWith("#")) {
288
- const r = parseInt(color.slice(1, 3), 16);
289
- const g = parseInt(color.slice(3, 5), 16);
290
- const b = parseInt(color.slice(5, 7), 16);
291
- return `rgba(${r}, ${g}, ${b}, ${opacity})`;
292
- }
293
- // If already rgba/rgb, just return as-is (simplified)
294
- return color;
295
- }
296
- /**
297
- * Cleanup - remove theme styles
298
- */
299
- destroy() {
300
- if (this.styleElement) {
301
- this.styleElement.remove();
302
- this.styleElement = null;
303
- }
304
- this.styleContainer = null;
305
- if (!this.rootElement)
306
- return;
307
- // Remove CSS classes
308
- this.rootElement.classList.remove("pie-high-contrast", "pie-font-small", "pie-font-normal", "pie-font-large", "pie-font-xlarge");
309
- // Remove CSS custom properties
310
- this.rootElement.style.removeProperty("--pie-font-scale");
311
- this.rootElement.style.removeProperty("--pie-background");
312
- this.rootElement.style.removeProperty("--pie-text");
313
- this.rootElement.style.removeProperty("--pie-primary");
314
- this.rootElement.style.removeProperty("--pie-tertiary");
315
- this.rootElement.style.removeProperty("--pie-incorrect");
316
- this.rootElement.style.removeProperty("--pie-correct");
317
- this.rootElement.style.removeProperty("--pie-missing");
318
- this.rootElement.style.removeProperty("--pie-background-dark");
319
- this.rootElement.style.removeProperty("--pie-secondary-background");
320
- this.rootElement.style.removeProperty("--pie-border");
321
- this.rootElement.style.removeProperty("--pie-border-light");
322
- this.rootElement.style.removeProperty("--pie-border-dark");
323
- this.rootElement.style.removeProperty("--pie-focus-checked");
324
- this.rootElement.style.removeProperty("--pie-focus-checked-border");
325
- this.rootElement.style.removeProperty("--pie-button-bg");
326
- this.rootElement.style.removeProperty("--pie-button-border");
327
- this.rootElement.style.removeProperty("--pie-button-color");
328
- this.rootElement.style.removeProperty("--pie-button-hover-bg");
329
- this.rootElement.style.removeProperty("--pie-button-hover-border");
330
- this.rootElement.style.removeProperty("--pie-button-hover-color");
331
- this.rootElement.style.removeProperty("--pie-button-active-bg");
332
- this.rootElement.style.removeProperty("--pie-button-focus-outline");
333
- }
334
- }
@@ -1,161 +0,0 @@
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 a tool → 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
- }