@pie-qti/assessment-player 0.1.10 → 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.
Files changed (86) hide show
  1. package/README.md +22 -82
  2. package/dist/core/AssessmentPlayer.d.ts +0 -1
  3. package/dist/core/AssessmentPlayer.js +1 -0
  4. package/dist/core/AssessmentPlayer.js.map +1 -0
  5. package/dist/core/AssessmentSessionCoordinator.d.ts +0 -1
  6. package/dist/core/AssessmentSessionCoordinator.js +1 -0
  7. package/dist/core/AssessmentSessionCoordinator.js.map +1 -0
  8. package/dist/core/ItemSessionController.d.ts +0 -1
  9. package/dist/core/ItemSessionController.js +1 -0
  10. package/dist/core/ItemSessionController.js.map +1 -0
  11. package/dist/core/NavigationManager.d.ts +0 -1
  12. package/dist/core/NavigationManager.js +1 -0
  13. package/dist/core/NavigationManager.js.map +1 -0
  14. package/dist/core/StatePersistenceManager.d.ts +0 -1
  15. package/dist/core/StatePersistenceManager.js +1 -0
  16. package/dist/core/StatePersistenceManager.js.map +1 -0
  17. package/dist/core/TimeManager.d.ts +0 -1
  18. package/dist/core/TimeManager.js +1 -0
  19. package/dist/core/TimeManager.js.map +1 -0
  20. package/dist/core/index.d.ts +0 -1
  21. package/dist/core/index.js +1 -0
  22. package/dist/core/index.js.map +1 -0
  23. package/dist/index.d.ts +0 -1
  24. package/dist/index.js +1 -3
  25. package/dist/index.js.map +1 -0
  26. package/dist/integration/ReferenceBackendAdapter.d.ts +0 -1
  27. package/dist/integration/ReferenceBackendAdapter.js +1 -0
  28. package/dist/integration/ReferenceBackendAdapter.js.map +1 -0
  29. package/dist/integration/api-contract.d.ts +0 -1
  30. package/dist/integration/api-contract.js +1 -0
  31. package/dist/integration/api-contract.js.map +1 -0
  32. package/dist/integration/assessment-item-scorer.d.ts +0 -1
  33. package/dist/integration/assessment-item-scorer.js +1 -0
  34. package/dist/integration/assessment-item-scorer.js.map +1 -0
  35. package/dist/integration/index.d.ts +0 -1
  36. package/dist/integration/index.js +1 -0
  37. package/dist/integration/index.js.map +1 -0
  38. package/dist/types/index.d.ts +0 -1
  39. package/dist/types/index.js +1 -0
  40. package/dist/types/index.js.map +1 -0
  41. package/dist/utils/PerformanceMonitor.d.ts +0 -1
  42. package/dist/utils/PerformanceMonitor.js +1 -0
  43. package/dist/utils/PerformanceMonitor.js.map +1 -0
  44. package/package.json +8 -37
  45. package/dist/core/AssessmentPlayer.d.ts.map +0 -1
  46. package/dist/core/AssessmentSessionCoordinator.d.ts.map +0 -1
  47. package/dist/core/ItemSessionController.d.ts.map +0 -1
  48. package/dist/core/NavigationManager.d.ts.map +0 -1
  49. package/dist/core/StatePersistenceManager.d.ts.map +0 -1
  50. package/dist/core/TimeManager.d.ts.map +0 -1
  51. package/dist/core/index.d.ts.map +0 -1
  52. package/dist/index.d.ts.map +0 -1
  53. package/dist/integration/ReferenceBackendAdapter.d.ts.map +0 -1
  54. package/dist/integration/api-contract.d.ts.map +0 -1
  55. package/dist/integration/assessment-item-scorer.d.ts.map +0 -1
  56. package/dist/integration/index.d.ts.map +0 -1
  57. package/dist/types/index.d.ts.map +0 -1
  58. package/dist/utils/PerformanceMonitor.d.ts.map +0 -1
  59. package/src/ambient.d.ts +0 -55
  60. package/src/components/AccessibilityAnnouncer.svelte +0 -113
  61. package/src/components/AssessmentHeader.svelte +0 -76
  62. package/src/components/AssessmentShell.svelte +0 -468
  63. package/src/components/AssessmentTimer.svelte +0 -251
  64. package/src/components/ItemRenderer.svelte +0 -156
  65. package/src/components/ItemSessionInfo.svelte +0 -241
  66. package/src/components/NavigationBar.svelte +0 -146
  67. package/src/components/RubricDisplay.svelte +0 -185
  68. package/src/components/SectionMenu.svelte +0 -273
  69. package/src/components/SplitPaneResizer.svelte +0 -288
  70. package/src/components/TestFeedback.svelte +0 -147
  71. package/src/components/index.ts +0 -19
  72. package/src/core/AssessmentPlayer.ts +0 -952
  73. package/src/core/AssessmentSessionCoordinator.ts +0 -274
  74. package/src/core/ItemSessionController.ts +0 -287
  75. package/src/core/NavigationManager.ts +0 -126
  76. package/src/core/StatePersistenceManager.ts +0 -344
  77. package/src/core/TimeManager.ts +0 -306
  78. package/src/core/index.ts +0 -15
  79. package/src/index.ts +0 -13
  80. package/src/integration/ReferenceBackendAdapter.ts +0 -1382
  81. package/src/integration/api-contract.ts +0 -480
  82. package/src/integration/assessment-item-scorer.ts +0 -58
  83. package/src/integration/index.ts +0 -77
  84. package/src/svelte-shims.d.ts +0 -7
  85. package/src/types/index.ts +0 -59
  86. package/src/utils/PerformanceMonitor.ts +0 -222
@@ -1,113 +0,0 @@
1
- <script lang="ts">
2
- import { onDestroy } from 'svelte';
3
-
4
- /**
5
- * Accessibility Announcer Component
6
- *
7
- * Provides ARIA live region for announcing dynamic content changes
8
- * to screen reader users, particularly for state restoration.
9
- *
10
- * Usage:
11
- * ```svelte
12
- * <AccessibilityAnnouncer bind:this={announcer} />
13
- *
14
- * // Later announce something
15
- * announcer.announce('Session restored from previous attempt');
16
- * ```
17
- */
18
-
19
- interface Props {
20
- /** Priority level for announcements */
21
- priority?: 'polite' | 'assertive';
22
- }
23
-
24
- const { priority = 'polite' }: Props = $props();
25
-
26
- let announcement = $state('');
27
- let currentPriority = $state<'polite' | 'assertive'>('polite');
28
- let announceTimeout: ReturnType<typeof setTimeout> | null = null;
29
-
30
- $effect(() => {
31
- if (!announcement) {
32
- currentPriority = priority;
33
- }
34
- });
35
-
36
- // Clean up timeout on destroy to prevent memory leaks
37
- onDestroy(() => {
38
- if (announceTimeout) {
39
- clearTimeout(announceTimeout);
40
- announceTimeout = null;
41
- }
42
- });
43
-
44
- /**
45
- * Announce a message to screen readers
46
- *
47
- * @param message - Text to announce
48
- * @param clearAfter - Milliseconds to wait before clearing (default: 1000)
49
- * @param nextPriority - Announcement priority for this message
50
- */
51
- export function announce(message: string, clearAfter = 1000, nextPriority: 'polite' | 'assertive' = priority): void {
52
- // Clear any existing announcement timeout
53
- if (announceTimeout) {
54
- clearTimeout(announceTimeout);
55
- announceTimeout = null;
56
- }
57
-
58
- // Set the new announcement
59
- currentPriority = nextPriority;
60
- announcement = message;
61
-
62
- // Clear after delay to allow screen readers to announce
63
- // and prepare for next announcement
64
- announceTimeout = setTimeout(() => {
65
- announcement = '';
66
- currentPriority = priority;
67
- announceTimeout = null;
68
- }, clearAfter);
69
- }
70
-
71
- /**
72
- * Clear the current announcement immediately
73
- */
74
- export function clear(): void {
75
- if (announceTimeout) {
76
- clearTimeout(announceTimeout);
77
- announceTimeout = null;
78
- }
79
- announcement = '';
80
- currentPriority = priority;
81
- }
82
- </script>
83
-
84
- <!--
85
- ARIA live region for screen reader announcements
86
- - visually-hidden: Hide from sighted users but available to screen readers
87
- - aria-live: Announce changes to this region
88
- - aria-atomic: Read entire region content when it changes
89
- - role="status": Indicates this is a status message
90
- -->
91
- <div
92
- class="sr-only"
93
- role="status"
94
- aria-live={currentPriority}
95
- aria-atomic="true"
96
- >
97
- {announcement}
98
- </div>
99
-
100
- <style>
101
- /* Screen reader only - visually hidden but accessible */
102
- .sr-only {
103
- position: absolute;
104
- width: 1px;
105
- height: 1px;
106
- padding: 0;
107
- margin: -1px;
108
- overflow: hidden;
109
- clip: rect(0, 0, 0, 0);
110
- white-space: nowrap;
111
- border-width: 0;
112
- }
113
- </style>
@@ -1,76 +0,0 @@
1
- <script lang="ts">
2
- import SectionMenu from './SectionMenu.svelte';
3
-
4
- interface Section {
5
- id: string;
6
- title?: string;
7
- index: number;
8
- }
9
-
10
- interface Props {
11
- /** Assessment title */
12
- title: string;
13
- /** Available sections */
14
- sections?: Section[];
15
- /** Current section index */
16
- currentSectionIndex?: number;
17
- /** Whether to show section menu */
18
- showSections?: boolean;
19
- /** Whether section navigation is allowed */
20
- allowSectionNavigation?: boolean;
21
- /** Section selection callback */
22
- onSectionSelect?: (sectionIndex: number) => void;
23
- }
24
-
25
- const {
26
- title,
27
- sections = [],
28
- currentSectionIndex,
29
- showSections = true,
30
- allowSectionNavigation = true,
31
- onSectionSelect
32
- }: Props = $props();
33
- </script>
34
-
35
- <div class="assessment-header">
36
- <div class="assessment-title">
37
- <h2 class="text-2xl font-bold">{title}</h2>
38
- </div>
39
-
40
- {#if showSections && sections.length > 1}
41
- <SectionMenu
42
- {sections}
43
- {currentSectionIndex}
44
- {onSectionSelect}
45
- disabled={!allowSectionNavigation}
46
- />
47
- {/if}
48
- </div>
49
-
50
- <style>
51
- .assessment-header {
52
- display: flex;
53
- justify-content: space-between;
54
- align-items: center;
55
- padding: 1.5rem;
56
- border-bottom: 1px solid var(--color-base-300);
57
- background: var(--color-base-100);
58
- position: sticky;
59
- top: 0;
60
- z-index: 10;
61
- }
62
-
63
- .assessment-title {
64
- flex: 1;
65
- }
66
-
67
- @media (max-width: 768px) {
68
- .assessment-header {
69
- padding: 1rem;
70
- }
71
-
72
- .assessment-title :global(h2) {
73
- font-size: 1.25rem;
74
- }
75
- }
76
- </style>
@@ -1,468 +0,0 @@
1
- <script lang="ts">
2
- import { onMount, tick, getContext } from 'svelte';
3
- import type { SvelteI18nProvider } from '@pie-qti/i18n';
4
- import type { BackendAssessmentPlayerConfig } from '../core/AssessmentPlayer.js';
5
- import { AssessmentPlayer } from '../core/AssessmentPlayer.js';
6
- import type { BackendAdapter, InitSessionRequest } from '../integration/api-contract.js';
7
- import type { AssessmentResults, NavigationState } from '../types/index.js';
8
- import AccessibilityAnnouncer from './AccessibilityAnnouncer.svelte';
9
- import AssessmentHeader from './AssessmentHeader.svelte';
10
- import ItemRenderer from './ItemRenderer.svelte';
11
- import NavigationBar from './NavigationBar.svelte';
12
- import RubricDisplay from './RubricDisplay.svelte';
13
- import SplitPaneResizer from './SplitPaneResizer.svelte';
14
- import TestFeedback from './TestFeedback.svelte';
15
-
16
- interface Props {
17
- backend: BackendAdapter;
18
- initSession: InitSessionRequest;
19
- config?: Partial<BackendAssessmentPlayerConfig>;
20
- /**
21
- * Called after a successful submit (with results).
22
- * Note: `config.onComplete` is invoked by `AssessmentPlayer.submit()` already.
23
- */
24
- onSubmit?: (results: AssessmentResults) => void;
25
- /** Math typesetting function (KaTeX, MathJax, etc.) */
26
- typeset?: (root: HTMLElement) => void | Promise<void>;
27
- }
28
-
29
- const { backend, initSession, config = {}, onSubmit, typeset }: Props = $props();
30
-
31
- // Get i18n from context (set by +layout.svelte)
32
- const contextI18nWrapper = getContext<{ value: SvelteI18nProvider | null } | undefined>('i18n');
33
- const contextI18n = $derived(contextI18nWrapper?.value);
34
-
35
- let player = $state<AssessmentPlayer | null>(null);
36
- const i18n = $derived(player?.getI18nProvider() ?? contextI18n);
37
- let navState = $state<NavigationState>({
38
- currentIndex: -1,
39
- totalItems: 0,
40
- canNext: false,
41
- canPrevious: false,
42
- isLoading: false,
43
- currentSection: undefined,
44
- totalSections: undefined,
45
- });
46
- let currentItem = $state<any>(null);
47
- let currentRubricBlocks = $state<any[]>([]);
48
- let currentResponses = $state<Record<string, unknown>>({});
49
- let sections = $state<any[]>([]);
50
- let error = $state<string | null>(null);
51
- let navError = $state<string | null>(null);
52
- let itemPaneEl = $state<HTMLDivElement | null>(null);
53
- let rootEl = $state<HTMLElement | null>(null);
54
- let testFeedback = $state<Array<{ identifier: string; content: string; access: string }>>([]);
55
- let isComplete = $state(false);
56
- let initTimeout: ReturnType<typeof setTimeout> | null = null;
57
- let hasFirstItem = $state(false);
58
- let announcer = $state<AccessibilityAnnouncer | null>(null);
59
-
60
- const passageBlocks = $derived(currentRubricBlocks.filter((b) => b?.use === 'passage'));
61
- const nonPassageRubricBlocks = $derived(currentRubricBlocks.filter((b) => b?.use !== 'passage'));
62
- const hasPassage = $derived(passageBlocks.length > 0);
63
-
64
- // Initialize player
65
- onMount(() => {
66
- // Never allow infinite "Loading assessment..." state
67
- initTimeout = setTimeout(() => {
68
- if (!hasFirstItem && !error) {
69
- error = contextI18n?.t('assessment.loadingError') ?? 'assessment.loadingError';
70
- announcer?.announce(error, 3000, 'assertive');
71
- }
72
- }, 10000);
73
-
74
- const playerConfig: BackendAssessmentPlayerConfig = {
75
- backend,
76
- initSession,
77
- showSections: config.showSections !== false,
78
- allowSectionNavigation: config.allowSectionNavigation !== false,
79
- showProgress: config.showProgress !== false,
80
- i18nProvider: contextI18n, // Pass i18n from context
81
- ...config,
82
- };
83
-
84
- (async () => {
85
- player = await AssessmentPlayer.create(playerConfig);
86
-
87
- // Get sections
88
- sections = player.getAllSections();
89
-
90
- // Set up event listeners
91
- player.onItemChange(async () => {
92
- updateState();
93
- navError = null;
94
- hasFirstItem = true;
95
- if (initTimeout) {
96
- clearTimeout(initTimeout);
97
- initTimeout = null;
98
- }
99
- await tick();
100
- itemPaneEl?.scrollTo({ top: 0, behavior: 'auto' });
101
- });
102
-
103
- player.onSectionChange(() => {
104
- updateState();
105
- });
106
-
107
- player.onResponseChange((responses) => {
108
- currentResponses = responses;
109
- });
110
-
111
- // If backend did not restore a current item, start at index 0.
112
- if (player.getNavigationState().currentIndex < 0) {
113
- await player.navigateTo(0);
114
- } else {
115
- updateState();
116
- hasFirstItem = true;
117
- if (initTimeout) {
118
- clearTimeout(initTimeout);
119
- initTimeout = null;
120
- }
121
- }
122
- })().catch((err) => {
123
- console.error('Failed to initialize assessment player:', err);
124
- error = err instanceof Error ? err.message : (contextI18n?.t('assessment.loadingError') ?? 'assessment.loadingError');
125
- announcer?.announce(error, 3000, 'assertive');
126
- });
127
-
128
- return () => {
129
- if (initTimeout) {
130
- clearTimeout(initTimeout);
131
- initTimeout = null;
132
- }
133
- if (player) {
134
- player.destroy();
135
- }
136
- };
137
- });
138
-
139
- function updateState() {
140
- if (!player) return;
141
-
142
- navState = player.getNavigationState();
143
- currentItem = player.getCurrentItem();
144
- currentRubricBlocks = player.getCurrentRubricBlocks();
145
- currentResponses = player.getResponses();
146
- }
147
-
148
- async function handlePrevious() {
149
- if (!player) return;
150
- try {
151
- navError = null;
152
- await player.previous();
153
- await manageFocusAfterNavigation();
154
- announceCurrentQuestion();
155
- } catch (err) {
156
- console.error('Previous navigation failed:', err);
157
- const message = err instanceof Error ? err.message : (i18n?.t('assessment.errors.navigationFailed') ?? 'assessment.errors.navigationFailed');
158
- navError = message;
159
- }
160
- }
161
-
162
- async function handleNext() {
163
- if (!player) return;
164
- try {
165
- navError = null;
166
- await player.next();
167
- await manageFocusAfterNavigation();
168
- announceCurrentQuestion();
169
- } catch (err) {
170
- console.error('Next navigation failed:', err);
171
- const message = err instanceof Error ? err.message : (i18n?.t('assessment.errors.navigationFailed') ?? 'assessment.errors.navigationFailed');
172
- navError = message;
173
- }
174
- }
175
-
176
- /**
177
- * Announce current question to screen readers
178
- */
179
- function announceCurrentQuestion() {
180
- if (!player) return;
181
- const state = player.getNavigationState();
182
- const msg = i18n?.t('assessment.questionAnnouncement', {
183
- current: state.currentIndex + 1,
184
- total: state.totalItems
185
- }) ?? `assessment.questionAnnouncement (${state.currentIndex + 1}/${state.totalItems})`;
186
- announcer?.announce(msg, 1500);
187
- }
188
-
189
- async function handleSectionSelect(sectionIndex: number) {
190
- if (!player || !sections[sectionIndex]) return;
191
-
192
- const section = sections[sectionIndex];
193
- await player.navigateToSection(section.id);
194
- await manageFocusAfterNavigation();
195
- }
196
-
197
- /**
198
- * Manage focus after navigation to improve accessibility.
199
- * Moves focus to the content area so screen reader users are aware of the content change.
200
- */
201
- async function manageFocusAfterNavigation() {
202
- await tick(); // Wait for DOM updates
203
-
204
- // Try to focus on the item pane (for split pane layout)
205
- if (itemPaneEl) {
206
- itemPaneEl.focus();
207
- return;
208
- }
209
-
210
- // Otherwise focus on the content area
211
- const contentEl = document.querySelector('.assessment-content') as HTMLElement;
212
- if (contentEl) {
213
- contentEl.focus();
214
- }
215
- }
216
-
217
- async function handleSubmit() {
218
- if (!player) return;
219
-
220
- try {
221
- const results = await player.submit();
222
- console.log('Assessment results:', results);
223
-
224
- // Get test feedback based on outcomes
225
- testFeedback = player.getVisibleFeedback();
226
- isComplete = true;
227
-
228
- onSubmit?.(results);
229
-
230
- // Could also emit a custom event here
231
- // Or show results modal
232
- } catch (err) {
233
- console.error('Failed to submit assessment:', err);
234
- const message = err instanceof Error ? err.message : (i18n?.t('assessment.errors.submitFailed') ?? 'assessment.errors.submitFailed');
235
- error = message;
236
- announcer?.announce(message, 3000, 'assertive');
237
- }
238
- }
239
-
240
- function handleResponseChange(responseId: string, value: unknown) {
241
- if (!player) return;
242
- if (currentItem?.identifier) {
243
- player.updateResponseForItem(currentItem.identifier, responseId, value);
244
- } else {
245
- player.updateResponse(responseId, value);
246
- }
247
- }
248
-
249
- /**
250
- * Imperative API (useful for embedding in host frameworks / custom elements)
251
- */
252
- export async function next() {
253
- return player?.next();
254
- }
255
-
256
- export async function previous() {
257
- return player?.previous();
258
- }
259
-
260
- export async function navigateTo(index: number) {
261
- return player?.navigateTo(index);
262
- }
263
-
264
- export async function navigateToSection(sectionIdentifier: string) {
265
- return player?.navigateToSection(sectionIdentifier);
266
- }
267
-
268
- export async function submit() {
269
- return player?.submit();
270
- }
271
-
272
- export function getResponses() {
273
- return player?.getResponses();
274
- }
275
-
276
- export function getState() {
277
- return player?.getState();
278
- }
279
-
280
- export function restoreState(state: any) {
281
- return player?.restoreState(state);
282
- }
283
- </script>
284
-
285
- <!-- Accessibility announcer for screen readers -->
286
- <AccessibilityAnnouncer bind:this={announcer} />
287
-
288
- {#if error}
289
- <div class="assessment-error">
290
- <div class="alert alert-error" role="alert" aria-live="assertive">
291
- <svg
292
- xmlns="http://www.w3.org/2000/svg"
293
- class="stroke-current shrink-0 h-6 w-6"
294
- fill="none"
295
- viewBox="0 0 24 24"
296
- >
297
- <path
298
- stroke-linecap="round"
299
- stroke-linejoin="round"
300
- stroke-width="2"
301
- d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"
302
- />
303
- </svg>
304
- <span>{error}</span>
305
- </div>
306
- </div>
307
- {:else if !player || navState.currentIndex < 0}
308
- <div class="assessment-loading">
309
- <div class="flex items-center justify-center p-8" role="status" aria-live="polite">
310
- <span class="loading loading-spinner loading-lg"></span>
311
- <span class="ml-4">{contextI18n?.t('assessment.loading') ?? 'assessment.loading'}</span>
312
- </div>
313
- </div>
314
- {:else}
315
- <div bind:this={rootEl} class="assessment-shell" role="region" aria-label="Assessment player">
316
- <!-- Header with title and section menu -->
317
- <AssessmentHeader
318
- title={initSession.assessmentId || (i18n?.t('assessment.title') ?? 'Assessment')}
319
- {sections}
320
- currentSectionIndex={navState.currentSection?.index}
321
- showSections={config.showSections}
322
- allowSectionNavigation={config.allowSectionNavigation}
323
- onSectionSelect={handleSectionSelect}
324
- />
325
-
326
- <!-- Test Feedback (shown after completion) -->
327
- {#if isComplete && testFeedback.length > 0}
328
- <TestFeedback feedback={testFeedback} />
329
- {/if}
330
-
331
- {#if navError}
332
- <div class="assessment-nav-error">
333
- <div class="alert alert-warning" role="alert" aria-live="assertive">
334
- <svg
335
- xmlns="http://www.w3.org/2000/svg"
336
- class="stroke-current shrink-0 h-6 w-6"
337
- fill="none"
338
- viewBox="0 0 24 24"
339
- >
340
- <path
341
- stroke-linecap="round"
342
- stroke-linejoin="round"
343
- stroke-width="2"
344
- d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
345
- />
346
- </svg>
347
- <span>{navError}</span>
348
- </div>
349
- </div>
350
- {/if}
351
-
352
- <!-- Main content area -->
353
- <div
354
- class:has-passage={hasPassage}
355
- class="assessment-content"
356
- tabindex="-1"
357
- role="region"
358
- aria-label={i18n?.t('accessibility.itemBody') ?? 'Question content'}
359
- >
360
- {#if hasPassage}
361
- <SplitPaneResizer
362
- leftContent={passageBlocks}
363
- {typeset}
364
- storageKey="pie-qti22-assessment-player.splitLeftPct"
365
- onRightPaneReady={(el) => itemPaneEl = el}
366
- >
367
- {#if nonPassageRubricBlocks.length > 0}
368
- <RubricDisplay blocks={nonPassageRubricBlocks} {typeset} />
369
- {/if}
370
-
371
- {#if currentItem}
372
- <ItemRenderer
373
- itemRef={currentItem}
374
- responses={currentResponses}
375
- role={config.role || 'candidate'}
376
- extendedTextEditor={config.extendedTextEditor || 'tiptap'}
377
- onResponseChange={handleResponseChange}
378
- {typeset}
379
- {i18n}
380
- security={config.security}
381
- pnp={config.pnp}
382
- />
383
- {/if}
384
- </SplitPaneResizer>
385
- {:else}
386
- <!-- Rubric blocks (passages, instructions) -->
387
- {#if currentRubricBlocks.length > 0}
388
- <RubricDisplay blocks={currentRubricBlocks} {typeset} />
389
- {/if}
390
-
391
- <!-- Current item -->
392
- {#if currentItem}
393
- <ItemRenderer
394
- itemRef={currentItem}
395
- responses={currentResponses}
396
- role={config.role || 'candidate'}
397
- onResponseChange={handleResponseChange}
398
- {typeset}
399
- {i18n}
400
- security={config.security}
401
- pnp={config.pnp}
402
- />
403
- {/if}
404
- {/if}
405
- </div>
406
-
407
- <!-- Navigation bar -->
408
- {#if i18n}
409
- <NavigationBar
410
- navState={navState}
411
- {i18n}
412
- onPrevious={handlePrevious}
413
- onNext={handleNext}
414
- onSubmit={handleSubmit}
415
- showProgress={config.showProgress !== false}
416
- />
417
- {/if}
418
- </div>
419
- {/if}
420
-
421
- <style>
422
- .assessment-shell {
423
- display: flex;
424
- flex-direction: column;
425
- height: 100vh;
426
- overflow: hidden;
427
- background: var(--color-base-100);
428
- }
429
-
430
- .assessment-content {
431
- flex: 1;
432
- padding: 2rem;
433
- max-width: 1200px;
434
- margin: 0 auto;
435
- width: 100%;
436
- overflow: auto;
437
- }
438
-
439
- .assessment-content:focus {
440
- outline: 2px solid var(--color-primary);
441
- outline-offset: -2px;
442
- }
443
-
444
- .assessment-content.has-passage {
445
- padding: 0;
446
- max-width: none;
447
- overflow: hidden;
448
- }
449
-
450
- .assessment-error,
451
- .assessment-loading {
452
- padding: 2rem;
453
- }
454
-
455
- .assessment-nav-error {
456
- padding: 1rem 2rem 0;
457
- }
458
-
459
- @media (max-width: 768px) {
460
- .assessment-content {
461
- padding: 1rem;
462
- }
463
-
464
- .assessment-content.has-passage {
465
- padding: 0;
466
- }
467
- }
468
- </style>