@pie-qti/assessment-player 0.1.10 → 0.1.12
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 +22 -82
- package/dist/core/AssessmentPlayer.d.ts +0 -1
- package/dist/core/AssessmentPlayer.js +1 -0
- package/dist/core/AssessmentPlayer.js.map +1 -0
- package/dist/core/AssessmentSessionCoordinator.d.ts +0 -1
- package/dist/core/AssessmentSessionCoordinator.js +1 -0
- package/dist/core/AssessmentSessionCoordinator.js.map +1 -0
- package/dist/core/ItemSessionController.d.ts +0 -1
- package/dist/core/ItemSessionController.js +1 -0
- package/dist/core/ItemSessionController.js.map +1 -0
- package/dist/core/NavigationManager.d.ts +0 -1
- package/dist/core/NavigationManager.js +1 -0
- package/dist/core/NavigationManager.js.map +1 -0
- package/dist/core/StatePersistenceManager.d.ts +0 -1
- package/dist/core/StatePersistenceManager.js +1 -0
- package/dist/core/StatePersistenceManager.js.map +1 -0
- package/dist/core/TimeManager.d.ts +0 -1
- package/dist/core/TimeManager.js +1 -0
- package/dist/core/TimeManager.js.map +1 -0
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -0
- package/dist/integration/ReferenceBackendAdapter.d.ts +0 -1
- package/dist/integration/ReferenceBackendAdapter.js +1 -0
- package/dist/integration/ReferenceBackendAdapter.js.map +1 -0
- package/dist/integration/api-contract.d.ts +0 -1
- package/dist/integration/api-contract.js +1 -0
- package/dist/integration/api-contract.js.map +1 -0
- package/dist/integration/assessment-item-scorer.d.ts +0 -1
- package/dist/integration/assessment-item-scorer.js +1 -0
- package/dist/integration/assessment-item-scorer.js.map +1 -0
- package/dist/integration/index.d.ts +0 -1
- package/dist/integration/index.js +1 -0
- package/dist/integration/index.js.map +1 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/PerformanceMonitor.d.ts +0 -1
- package/dist/utils/PerformanceMonitor.js +1 -0
- package/dist/utils/PerformanceMonitor.js.map +1 -0
- package/package.json +8 -37
- package/dist/core/AssessmentPlayer.d.ts.map +0 -1
- package/dist/core/AssessmentSessionCoordinator.d.ts.map +0 -1
- package/dist/core/ItemSessionController.d.ts.map +0 -1
- package/dist/core/NavigationManager.d.ts.map +0 -1
- package/dist/core/StatePersistenceManager.d.ts.map +0 -1
- package/dist/core/TimeManager.d.ts.map +0 -1
- package/dist/core/index.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/integration/ReferenceBackendAdapter.d.ts.map +0 -1
- package/dist/integration/api-contract.d.ts.map +0 -1
- package/dist/integration/assessment-item-scorer.d.ts.map +0 -1
- package/dist/integration/index.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/utils/PerformanceMonitor.d.ts.map +0 -1
- package/src/ambient.d.ts +0 -55
- package/src/components/AccessibilityAnnouncer.svelte +0 -113
- package/src/components/AssessmentHeader.svelte +0 -76
- package/src/components/AssessmentShell.svelte +0 -468
- package/src/components/AssessmentTimer.svelte +0 -251
- package/src/components/ItemRenderer.svelte +0 -156
- package/src/components/ItemSessionInfo.svelte +0 -241
- package/src/components/NavigationBar.svelte +0 -146
- package/src/components/RubricDisplay.svelte +0 -185
- package/src/components/SectionMenu.svelte +0 -273
- package/src/components/SplitPaneResizer.svelte +0 -288
- package/src/components/TestFeedback.svelte +0 -147
- package/src/components/index.ts +0 -19
- package/src/core/AssessmentPlayer.ts +0 -952
- package/src/core/AssessmentSessionCoordinator.ts +0 -274
- package/src/core/ItemSessionController.ts +0 -287
- package/src/core/NavigationManager.ts +0 -126
- package/src/core/StatePersistenceManager.ts +0 -344
- package/src/core/TimeManager.ts +0 -306
- package/src/core/index.ts +0 -15
- package/src/index.ts +0 -13
- package/src/integration/ReferenceBackendAdapter.ts +0 -1382
- package/src/integration/api-contract.ts +0 -480
- package/src/integration/assessment-item-scorer.ts +0 -58
- package/src/integration/index.ts +0 -77
- package/src/svelte-shims.d.ts +0 -7
- package/src/types/index.ts +0 -59
- package/src/utils/PerformanceMonitor.ts +0 -222
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { NavigationState } from '../types/index.js';
|
|
3
|
-
import type { SvelteI18nProvider } from '@pie-qti/i18n';
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
navState: NavigationState;
|
|
7
|
-
i18n?: SvelteI18nProvider;
|
|
8
|
-
onPrevious?: () => void;
|
|
9
|
-
onNext?: () => void;
|
|
10
|
-
onSubmit?: () => void;
|
|
11
|
-
showProgress?: boolean;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const { navState, i18n, onPrevious, onNext, onSubmit, showProgress = true }: Props = $props();
|
|
15
|
-
|
|
16
|
-
const progressPercentage = $derived(
|
|
17
|
-
navState.totalItems > 0 ? ((navState.currentIndex + 1) / navState.totalItems) * 100 : 0,
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
// Simplified translations - no manual subscriptions needed
|
|
21
|
-
// Locale changes trigger page refresh, so reactivity is not required
|
|
22
|
-
const translations = $derived({
|
|
23
|
-
question: i18n?.t('assessment.question', { current: navState.currentIndex + 1, total: navState.totalItems })
|
|
24
|
-
?? `Question ${navState.currentIndex + 1} of ${navState.totalItems}`,
|
|
25
|
-
section: navState.currentSection
|
|
26
|
-
? (navState.currentSection.title ?? (i18n?.t('assessment.section', { current: navState.currentSection.index + 1, total: 0 })
|
|
27
|
-
?? `Section ${navState.currentSection.index + 1}`))
|
|
28
|
-
: null,
|
|
29
|
-
previous: i18n?.t('common.previous') ?? 'Previous',
|
|
30
|
-
next: i18n?.t('common.next') ?? 'Next',
|
|
31
|
-
submit: i18n?.t('assessment.navigation.submit') ?? 'Submit',
|
|
32
|
-
progress: `${i18n?.t('assessment.navigation.progress', { percent: Math.round(progressPercentage) }) ?? `Progress: ${Math.round(progressPercentage)}%`}: ${i18n?.t('assessment.question', { current: navState.currentIndex + 1, total: navState.totalItems }) ?? `Question ${navState.currentIndex + 1} of ${navState.totalItems}`}`,
|
|
33
|
-
});
|
|
34
|
-
</script>
|
|
35
|
-
|
|
36
|
-
<div class="navigation-bar">
|
|
37
|
-
<!-- Progress indicator -->
|
|
38
|
-
{#if showProgress}
|
|
39
|
-
<div class="progress-section">
|
|
40
|
-
<div class="progress-label text-sm">
|
|
41
|
-
{translations.question}
|
|
42
|
-
{#if translations.section}
|
|
43
|
-
<span class="text-base-content/60">
|
|
44
|
-
({translations.section})
|
|
45
|
-
</span>
|
|
46
|
-
{/if}
|
|
47
|
-
</div>
|
|
48
|
-
<progress
|
|
49
|
-
class="progress progress-primary w-full"
|
|
50
|
-
value={progressPercentage}
|
|
51
|
-
max="100"
|
|
52
|
-
aria-label={translations.progress}
|
|
53
|
-
></progress>
|
|
54
|
-
</div>
|
|
55
|
-
{/if}
|
|
56
|
-
|
|
57
|
-
<!-- Navigation buttons -->
|
|
58
|
-
<div class="navigation-buttons">
|
|
59
|
-
<button
|
|
60
|
-
class="btn btn-outline"
|
|
61
|
-
data-testid="assessment-prev"
|
|
62
|
-
onclick={() => onPrevious?.()}
|
|
63
|
-
disabled={!navState.canPrevious || navState.isLoading}
|
|
64
|
-
>
|
|
65
|
-
<svg
|
|
66
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
67
|
-
class="h-5 w-5"
|
|
68
|
-
fill="none"
|
|
69
|
-
viewBox="0 0 24 24"
|
|
70
|
-
stroke="currentColor"
|
|
71
|
-
>
|
|
72
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" />
|
|
73
|
-
</svg>
|
|
74
|
-
{translations.previous}
|
|
75
|
-
</button>
|
|
76
|
-
|
|
77
|
-
<div class="flex-1"></div>
|
|
78
|
-
|
|
79
|
-
{#if navState.currentIndex === navState.totalItems - 1}
|
|
80
|
-
<!-- Submit button on last item -->
|
|
81
|
-
<button class="btn btn-primary" data-testid="assessment-submit" onclick={() => onSubmit?.()} disabled={navState.isLoading}>
|
|
82
|
-
{translations.submit}
|
|
83
|
-
</button>
|
|
84
|
-
{:else}
|
|
85
|
-
<!-- Next button -->
|
|
86
|
-
<button
|
|
87
|
-
class="btn btn-primary"
|
|
88
|
-
data-testid="assessment-next"
|
|
89
|
-
onclick={() => onNext?.()}
|
|
90
|
-
disabled={!navState.canNext || navState.isLoading}
|
|
91
|
-
>
|
|
92
|
-
{translations.next}
|
|
93
|
-
<svg
|
|
94
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
95
|
-
class="h-5 w-5"
|
|
96
|
-
fill="none"
|
|
97
|
-
viewBox="0 0 24 24"
|
|
98
|
-
stroke="currentColor"
|
|
99
|
-
>
|
|
100
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
|
|
101
|
-
</svg>
|
|
102
|
-
</button>
|
|
103
|
-
{/if}
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
|
|
107
|
-
<style>
|
|
108
|
-
.navigation-bar {
|
|
109
|
-
display: flex;
|
|
110
|
-
flex-direction: column;
|
|
111
|
-
gap: 1rem;
|
|
112
|
-
padding: 1rem;
|
|
113
|
-
border-top: 1px solid var(--color-base-300);
|
|
114
|
-
background: var(--color-base-100);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.progress-section {
|
|
118
|
-
display: flex;
|
|
119
|
-
flex-direction: column;
|
|
120
|
-
gap: 0.5rem;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.progress-label {
|
|
124
|
-
font-weight: 500;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.navigation-buttons {
|
|
128
|
-
display: flex;
|
|
129
|
-
gap: 0.5rem;
|
|
130
|
-
align-items: center;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
@media (max-width: 640px) {
|
|
134
|
-
.navigation-buttons {
|
|
135
|
-
flex-direction: column;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.navigation-buttons button {
|
|
139
|
-
width: 100%;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.flex-1 {
|
|
143
|
-
display: none;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
</style>
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { typesetAction } from '@pie-qti/default-components/shared';
|
|
3
|
-
import type { I18nProvider } from '@pie-qti/i18n';
|
|
4
|
-
import type { AssessmentRubricBlock } from '../integration/api-contract.js';
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
blocks: AssessmentRubricBlock[];
|
|
8
|
-
collapsed?: boolean;
|
|
9
|
-
i18n?: I18nProvider;
|
|
10
|
-
/** Math typesetting function (KaTeX, MathJax, etc.) */
|
|
11
|
-
typeset?: (root: HTMLElement) => void | Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const { blocks, collapsed = false, i18n, typeset }: Props = $props();
|
|
15
|
-
|
|
16
|
-
let isCollapsed = $state(false);
|
|
17
|
-
|
|
18
|
-
$effect(() => {
|
|
19
|
-
isCollapsed = collapsed;
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
function toggleCollapse() {
|
|
23
|
-
isCollapsed = !isCollapsed;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Filter blocks by view type (for student/candidate view)
|
|
27
|
-
const visibleBlocks = $derived(blocks.filter((block) => block.view.includes('candidate')));
|
|
28
|
-
|
|
29
|
-
// Group blocks by use type
|
|
30
|
-
const passages = $derived(visibleBlocks.filter((block) => block.use === 'passage'));
|
|
31
|
-
const instructions = $derived(visibleBlocks.filter((block) => block.use === 'instructions'));
|
|
32
|
-
const rubrics = $derived(visibleBlocks.filter((block) => !block.use || block.use === 'rubric'));
|
|
33
|
-
</script>
|
|
34
|
-
|
|
35
|
-
{#if visibleBlocks.length > 0}
|
|
36
|
-
<div class="rubric-container">
|
|
37
|
-
<!-- Passages (typically reading comprehension) -->
|
|
38
|
-
{#if passages.length > 0}
|
|
39
|
-
<div class="passage-section">
|
|
40
|
-
{#each passages as passage}
|
|
41
|
-
<div class="passage">
|
|
42
|
-
<div class="passage-header">
|
|
43
|
-
<h4 class="font-semibold text-base">{i18n?.t('assessment.readingPassage') ?? 'Reading Passage'}</h4>
|
|
44
|
-
<button
|
|
45
|
-
class="btn btn-ghost btn-sm"
|
|
46
|
-
onclick={() => toggleCollapse?.()}
|
|
47
|
-
aria-label={isCollapsed ? (i18n?.t('assessment.expandPassage') ?? 'Expand passage') : (i18n?.t('assessment.collapsePassage') ?? 'Collapse passage')}
|
|
48
|
-
>
|
|
49
|
-
{#if isCollapsed}
|
|
50
|
-
<svg
|
|
51
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
52
|
-
class="h-5 w-5"
|
|
53
|
-
fill="none"
|
|
54
|
-
viewBox="0 0 24 24"
|
|
55
|
-
stroke="currentColor"
|
|
56
|
-
>
|
|
57
|
-
<path
|
|
58
|
-
stroke-linecap="round"
|
|
59
|
-
stroke-linejoin="round"
|
|
60
|
-
stroke-width="2"
|
|
61
|
-
d="M19 9l-7 7-7-7"
|
|
62
|
-
/>
|
|
63
|
-
</svg>
|
|
64
|
-
{:else}
|
|
65
|
-
<svg
|
|
66
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
67
|
-
class="h-5 w-5"
|
|
68
|
-
fill="none"
|
|
69
|
-
viewBox="0 0 24 24"
|
|
70
|
-
stroke="currentColor"
|
|
71
|
-
>
|
|
72
|
-
<path
|
|
73
|
-
stroke-linecap="round"
|
|
74
|
-
stroke-linejoin="round"
|
|
75
|
-
stroke-width="2"
|
|
76
|
-
d="M5 15l7-7 7 7"
|
|
77
|
-
/>
|
|
78
|
-
</svg>
|
|
79
|
-
{/if}
|
|
80
|
-
</button>
|
|
81
|
-
</div>
|
|
82
|
-
|
|
83
|
-
{#if !isCollapsed}
|
|
84
|
-
<div
|
|
85
|
-
use:typesetAction={{ typeset }}
|
|
86
|
-
class="passage-content prose max-w-none"
|
|
87
|
-
>
|
|
88
|
-
{@html passage.content}
|
|
89
|
-
</div>
|
|
90
|
-
{/if}
|
|
91
|
-
</div>
|
|
92
|
-
{/each}
|
|
93
|
-
</div>
|
|
94
|
-
{/if}
|
|
95
|
-
|
|
96
|
-
<!-- Instructions -->
|
|
97
|
-
{#if instructions.length > 0}
|
|
98
|
-
<div class="instructions-section">
|
|
99
|
-
{#each instructions as instruction}
|
|
100
|
-
<div class="alert alert-info">
|
|
101
|
-
<svg
|
|
102
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
103
|
-
fill="none"
|
|
104
|
-
viewBox="0 0 24 24"
|
|
105
|
-
class="stroke-current shrink-0 w-6 h-6"
|
|
106
|
-
>
|
|
107
|
-
<path
|
|
108
|
-
stroke-linecap="round"
|
|
109
|
-
stroke-linejoin="round"
|
|
110
|
-
stroke-width="2"
|
|
111
|
-
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
112
|
-
></path>
|
|
113
|
-
</svg>
|
|
114
|
-
<div use:typesetAction={{ typeset }}>
|
|
115
|
-
{@html instruction.content}
|
|
116
|
-
</div>
|
|
117
|
-
</div>
|
|
118
|
-
{/each}
|
|
119
|
-
</div>
|
|
120
|
-
{/if}
|
|
121
|
-
|
|
122
|
-
<!-- Other rubric blocks -->
|
|
123
|
-
{#if rubrics.length > 0}
|
|
124
|
-
<div class="rubric-section">
|
|
125
|
-
{#each rubrics as rubric}
|
|
126
|
-
<div use:typesetAction={{ typeset }} class="rubric-block">
|
|
127
|
-
{@html rubric.content}
|
|
128
|
-
</div>
|
|
129
|
-
{/each}
|
|
130
|
-
</div>
|
|
131
|
-
{/if}
|
|
132
|
-
</div>
|
|
133
|
-
{/if}
|
|
134
|
-
|
|
135
|
-
<style>
|
|
136
|
-
.rubric-container {
|
|
137
|
-
margin-bottom: 2rem;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.passage-section {
|
|
141
|
-
margin-bottom: 1.5rem;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.passage {
|
|
145
|
-
border: 1px solid var(--color-base-300);
|
|
146
|
-
border-radius: 0.5rem;
|
|
147
|
-
padding: 1rem;
|
|
148
|
-
background: var(--color-base-200);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.passage-header {
|
|
152
|
-
display: flex;
|
|
153
|
-
justify-content: space-between;
|
|
154
|
-
align-items: center;
|
|
155
|
-
margin-bottom: 0.5rem;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
.passage-content {
|
|
159
|
-
padding: 1rem 0;
|
|
160
|
-
line-height: 1.6;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
.instructions-section {
|
|
164
|
-
margin-bottom: 1.5rem;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.rubric-section {
|
|
168
|
-
margin-bottom: 1.5rem;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
.rubric-block {
|
|
172
|
-
padding: 1rem;
|
|
173
|
-
background: var(--color-base-200);
|
|
174
|
-
border-radius: 0.5rem;
|
|
175
|
-
margin-bottom: 1rem;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
:global(.passage-content p) {
|
|
179
|
-
margin-bottom: 1rem;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
:global(.passage-content p:last-child) {
|
|
183
|
-
margin-bottom: 0;
|
|
184
|
-
}
|
|
185
|
-
</style>
|
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { tick } from 'svelte';
|
|
3
|
-
import type { I18nProvider } from '@pie-qti/i18n';
|
|
4
|
-
|
|
5
|
-
interface Section {
|
|
6
|
-
id: string;
|
|
7
|
-
title?: string;
|
|
8
|
-
index: number;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface Props {
|
|
12
|
-
sections: Section[];
|
|
13
|
-
currentSectionIndex?: number;
|
|
14
|
-
i18n?: I18nProvider;
|
|
15
|
-
onSectionSelect?: (sectionIndex: number) => void;
|
|
16
|
-
disabled?: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const { sections, currentSectionIndex, i18n, onSectionSelect, disabled = false }: Props = $props();
|
|
20
|
-
|
|
21
|
-
let isOpen = $state(false);
|
|
22
|
-
let toggleButton = $state<HTMLButtonElement | null>(null);
|
|
23
|
-
let dropdownContent = $state<HTMLDivElement | null>(null);
|
|
24
|
-
const menuId = 'assessment-section-menu';
|
|
25
|
-
|
|
26
|
-
async function openMenu() {
|
|
27
|
-
if (disabled) return;
|
|
28
|
-
isOpen = true;
|
|
29
|
-
await tick();
|
|
30
|
-
const active = dropdownContent?.querySelector<HTMLButtonElement>('.section-item.active');
|
|
31
|
-
const first = dropdownContent?.querySelector<HTMLButtonElement>('.section-item:not(:disabled)');
|
|
32
|
-
(active ?? first)?.focus();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function closeMenu({ restoreFocus = true } = {}) {
|
|
36
|
-
isOpen = false;
|
|
37
|
-
if (restoreFocus) {
|
|
38
|
-
toggleButton?.focus();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function toggleMenu() {
|
|
43
|
-
if (isOpen) {
|
|
44
|
-
closeMenu();
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
void openMenu();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function handleMenuKeydown(event: KeyboardEvent) {
|
|
51
|
-
if (event.key === 'Escape') {
|
|
52
|
-
event.preventDefault();
|
|
53
|
-
closeMenu();
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function handleToggleKeydown(event: KeyboardEvent) {
|
|
58
|
-
if (event.key === 'ArrowDown') {
|
|
59
|
-
event.preventDefault();
|
|
60
|
-
void openMenu();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function handleBackdropClick() {
|
|
65
|
-
closeMenu();
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function selectSection(sectionIndex: number) {
|
|
69
|
-
if (disabled) return;
|
|
70
|
-
if (onSectionSelect) {
|
|
71
|
-
onSectionSelect(sectionIndex);
|
|
72
|
-
}
|
|
73
|
-
closeMenu();
|
|
74
|
-
}
|
|
75
|
-
</script>
|
|
76
|
-
|
|
77
|
-
{#if sections.length > 1}
|
|
78
|
-
<div class="section-menu">
|
|
79
|
-
<button
|
|
80
|
-
bind:this={toggleButton}
|
|
81
|
-
class="btn btn-outline btn-sm"
|
|
82
|
-
type="button"
|
|
83
|
-
aria-expanded={isOpen}
|
|
84
|
-
aria-controls={menuId}
|
|
85
|
-
onclick={() => toggleMenu?.()}
|
|
86
|
-
onkeydown={handleToggleKeydown}
|
|
87
|
-
disabled={disabled}
|
|
88
|
-
>
|
|
89
|
-
<svg
|
|
90
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
91
|
-
class="h-5 w-5"
|
|
92
|
-
fill="none"
|
|
93
|
-
viewBox="0 0 24 24"
|
|
94
|
-
stroke="currentColor"
|
|
95
|
-
>
|
|
96
|
-
<path
|
|
97
|
-
stroke-linecap="round"
|
|
98
|
-
stroke-linejoin="round"
|
|
99
|
-
stroke-width="2"
|
|
100
|
-
d="M4 6h16M4 12h16M4 18h16"
|
|
101
|
-
/>
|
|
102
|
-
</svg>
|
|
103
|
-
{i18n?.t('assessment.sections.title') ?? 'Sections'}
|
|
104
|
-
</button>
|
|
105
|
-
|
|
106
|
-
{#if isOpen}
|
|
107
|
-
<div class="section-dropdown">
|
|
108
|
-
<div
|
|
109
|
-
bind:this={dropdownContent}
|
|
110
|
-
id={menuId}
|
|
111
|
-
class="section-dropdown-content"
|
|
112
|
-
role="menu"
|
|
113
|
-
tabindex="-1"
|
|
114
|
-
aria-label={i18n?.t('assessment.sections.title') ?? 'Sections'}
|
|
115
|
-
onkeydown={handleMenuKeydown}
|
|
116
|
-
>
|
|
117
|
-
<div class="section-list">
|
|
118
|
-
{#each sections as section}
|
|
119
|
-
<button
|
|
120
|
-
class="section-item"
|
|
121
|
-
class:active={currentSectionIndex === section.index}
|
|
122
|
-
type="button"
|
|
123
|
-
role="menuitemradio"
|
|
124
|
-
aria-checked={currentSectionIndex === section.index}
|
|
125
|
-
onclick={() => selectSection(section.index)}
|
|
126
|
-
disabled={disabled}
|
|
127
|
-
>
|
|
128
|
-
<div class="section-icon">
|
|
129
|
-
{#if currentSectionIndex === section.index}
|
|
130
|
-
<svg
|
|
131
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
132
|
-
class="h-5 w-5"
|
|
133
|
-
viewBox="0 0 20 20"
|
|
134
|
-
fill="currentColor"
|
|
135
|
-
>
|
|
136
|
-
<path
|
|
137
|
-
fill-rule="evenodd"
|
|
138
|
-
d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
|
|
139
|
-
clip-rule="evenodd"
|
|
140
|
-
/>
|
|
141
|
-
</svg>
|
|
142
|
-
{:else}
|
|
143
|
-
<svg
|
|
144
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
145
|
-
class="h-5 w-5"
|
|
146
|
-
fill="none"
|
|
147
|
-
viewBox="0 0 24 24"
|
|
148
|
-
stroke="currentColor"
|
|
149
|
-
>
|
|
150
|
-
<path
|
|
151
|
-
stroke-linecap="round"
|
|
152
|
-
stroke-linejoin="round"
|
|
153
|
-
stroke-width="2"
|
|
154
|
-
d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
|
|
155
|
-
/>
|
|
156
|
-
</svg>
|
|
157
|
-
{/if}
|
|
158
|
-
</div>
|
|
159
|
-
<div class="section-info">
|
|
160
|
-
<div class="section-title">
|
|
161
|
-
{section.title || (i18n?.t('assessment.sectionDefault', { number: section.index + 1 }) ?? `Section ${section.index + 1}`)}
|
|
162
|
-
</div>
|
|
163
|
-
</div>
|
|
164
|
-
</button>
|
|
165
|
-
{/each}
|
|
166
|
-
</div>
|
|
167
|
-
</div>
|
|
168
|
-
<button
|
|
169
|
-
class="section-backdrop"
|
|
170
|
-
type="button"
|
|
171
|
-
onclick={handleBackdropClick}
|
|
172
|
-
aria-label={i18n?.t('assessment.closeMenu') ?? 'Close menu'}
|
|
173
|
-
></button>
|
|
174
|
-
</div>
|
|
175
|
-
{/if}
|
|
176
|
-
</div>
|
|
177
|
-
{/if}
|
|
178
|
-
|
|
179
|
-
<style>
|
|
180
|
-
.section-menu {
|
|
181
|
-
position: relative;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.section-dropdown {
|
|
185
|
-
position: fixed;
|
|
186
|
-
inset: 0;
|
|
187
|
-
z-index: 50;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.section-backdrop {
|
|
191
|
-
position: absolute;
|
|
192
|
-
inset: 0;
|
|
193
|
-
background: transparent;
|
|
194
|
-
border: none;
|
|
195
|
-
cursor: default;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.section-dropdown-content {
|
|
199
|
-
position: absolute;
|
|
200
|
-
top: 4rem;
|
|
201
|
-
right: 1rem;
|
|
202
|
-
width: 20rem;
|
|
203
|
-
max-height: 24rem;
|
|
204
|
-
overflow-y: auto;
|
|
205
|
-
background: var(--color-base-100);
|
|
206
|
-
border: 1px solid var(--color-base-300);
|
|
207
|
-
border-radius: 0.5rem;
|
|
208
|
-
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
|
|
209
|
-
z-index: 51;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
.section-list {
|
|
213
|
-
padding: 0.5rem;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.section-item {
|
|
217
|
-
display: flex;
|
|
218
|
-
align-items: center;
|
|
219
|
-
gap: 0.75rem;
|
|
220
|
-
width: 100%;
|
|
221
|
-
padding: 0.75rem;
|
|
222
|
-
border: none;
|
|
223
|
-
background: transparent;
|
|
224
|
-
border-radius: 0.375rem;
|
|
225
|
-
cursor: pointer;
|
|
226
|
-
transition: background-color 0.2s;
|
|
227
|
-
text-align: left;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.section-item:hover:not(:disabled) {
|
|
231
|
-
background: var(--color-base-200);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
.section-item.active {
|
|
235
|
-
background: color-mix(in oklab, var(--color-primary) 12%, transparent);
|
|
236
|
-
color: var(--color-primary);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
.section-item:disabled {
|
|
240
|
-
opacity: 0.5;
|
|
241
|
-
cursor: not-allowed;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
.section-icon {
|
|
245
|
-
flex-shrink: 0;
|
|
246
|
-
color: color-mix(in oklab, var(--color-base-content) 60%, transparent);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
.section-item.active .section-icon {
|
|
250
|
-
color: var(--color-primary);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.section-info {
|
|
254
|
-
flex: 1;
|
|
255
|
-
min-width: 0;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
.section-title {
|
|
259
|
-
font-weight: 500;
|
|
260
|
-
overflow: hidden;
|
|
261
|
-
text-overflow: ellipsis;
|
|
262
|
-
white-space: nowrap;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
@media (max-width: 640px) {
|
|
266
|
-
.section-dropdown-content {
|
|
267
|
-
right: 0;
|
|
268
|
-
left: 0;
|
|
269
|
-
width: auto;
|
|
270
|
-
margin: 0 1rem;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
</style>
|