@airalogy/aimd-recorder 1.14.1

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 (178) hide show
  1. package/README.md +240 -0
  2. package/README.zh-CN.md +224 -0
  3. package/dist/AimdCodeField-DC3DPvgc.js +172 -0
  4. package/dist/AimdDnaSequenceField-__jdnFS9.js +59466 -0
  5. package/dist/AimdEditor.vue_vue_type_style_index_0_lang-Bq79rKNw.js +28370 -0
  6. package/dist/AimdMarkdownField-98ImHGbc.js +66 -0
  7. package/dist/AimdMarkdownNoteField-CuUJZkgT.js +185 -0
  8. package/dist/_.contribution-IP0cDNhs.js +38 -0
  9. package/dist/_commonjsHelpers-CZXJ37nu.js +40 -0
  10. package/dist/abap-Bs8kvjsq.js +1398 -0
  11. package/dist/aimd-recorder.css +1 -0
  12. package/dist/apex-Dspwrl5m.js +326 -0
  13. package/dist/assets/css.worker-Dmf38jDD.js +79 -0
  14. package/dist/assets/editor.worker-CpuX8TSY.js +12 -0
  15. package/dist/assets/html.worker-DotaEs7v.js +456 -0
  16. package/dist/assets/json.worker-B4VHhH6h.js +44 -0
  17. package/dist/assets/ts.worker-sl17zBDo.js +51316 -0
  18. package/dist/azcli-k1BiOau1.js +68 -0
  19. package/dist/bat-BIP72KWc.js +100 -0
  20. package/dist/bicep-VhQeYhS3.js +102 -0
  21. package/dist/cameligo-DnuAXtHg.js +174 -0
  22. package/dist/clojure-BAuDPsal.js +761 -0
  23. package/dist/coffee-BV06qSnj.js +232 -0
  24. package/dist/components.js +3595 -0
  25. package/dist/composables.js +72 -0
  26. package/dist/cpp-Cz8Jeyrf.js +389 -0
  27. package/dist/csharp-F6hhlXFb.js +326 -0
  28. package/dist/csp-KzlEHCyI.js +53 -0
  29. package/dist/css-e4FKntZ3.js +187 -0
  30. package/dist/cssMode-uz9U6SUU.js +1571 -0
  31. package/dist/cypher-CpvDGKRr.js +263 -0
  32. package/dist/dart-DdHeFWR0.js +281 -0
  33. package/dist/dockerfile-aoNXDcio.js +130 -0
  34. package/dist/ecl-C4Q0DYuA.js +456 -0
  35. package/dist/editor.api-CgD9w0gG.js +77091 -0
  36. package/dist/editor.main-Du02abDl.js +33783 -0
  37. package/dist/elixir-C9X42b0T.js +569 -0
  38. package/dist/flow9-Bff42pfB.js +142 -0
  39. package/dist/freemarker2-DFLX4iQ-.js +989 -0
  40. package/dist/fsharp-C6vPAsHG.js +217 -0
  41. package/dist/go-DEr8zx9f.js +218 -0
  42. package/dist/graphql-BiNBBRFh.js +151 -0
  43. package/dist/handlebars-aiZbIuWY.js +419 -0
  44. package/dist/hcl-2T9lKuFg.js +183 -0
  45. package/dist/html-phzTMObN.js +308 -0
  46. package/dist/htmlMode-BF7wMi3N.js +1581 -0
  47. package/dist/index.js +89 -0
  48. package/dist/ini-CZGtssYM.js +71 -0
  49. package/dist/ini.contribution-DyWtiacL.js +8 -0
  50. package/dist/java-B260NeH3.js +232 -0
  51. package/dist/javascript-BKKOItMi.js +70 -0
  52. package/dist/jsonMode-CDYK4B5l.js +1996 -0
  53. package/dist/julia-kuNLM9c5.js +511 -0
  54. package/dist/kotlin-Bz6kAefA.js +253 -0
  55. package/dist/less-AZUtS89I.js +162 -0
  56. package/dist/lexon-BcmgnyRb.js +157 -0
  57. package/dist/liquid-B2eRz5SA.js +240 -0
  58. package/dist/lua-Dz1RbATg.js +162 -0
  59. package/dist/m3-CIMooLFn.js +210 -0
  60. package/dist/markdown-C1BsCK9P.js +229 -0
  61. package/dist/markdown.contribution-DYYk6zUU.js +7 -0
  62. package/dist/mdx-BfV1HDRG.js +165 -0
  63. package/dist/mips-BovsnfLQ.js +198 -0
  64. package/dist/monaco.contribution-C-bQhUTI.js +114 -0
  65. package/dist/monaco.contribution-CCVvl3Jx.js +72 -0
  66. package/dist/monaco.contribution-Col-f0XR.js +164 -0
  67. package/dist/monaco.contribution-b5xkgQ-s.js +112 -0
  68. package/dist/msdax-CiRB2ZB-.js +375 -0
  69. package/dist/mysql-BwdpPE19.js +878 -0
  70. package/dist/objective-c-D4nfHfso.js +183 -0
  71. package/dist/pascal--j5-PYtz.js +251 -0
  72. package/dist/pascaligo-C7TcJxNL.js +164 -0
  73. package/dist/perl-BzEWqUb5.js +626 -0
  74. package/dist/pgsql-B_KZ0mGX.js +851 -0
  75. package/dist/php-A19QHzQV.js +500 -0
  76. package/dist/pla-COeKY1hA.js +137 -0
  77. package/dist/postiats-BfMp7zJL.js +907 -0
  78. package/dist/powerquery-B0TS_5Gb.js +890 -0
  79. package/dist/powershell-5jSbKdYB.js +239 -0
  80. package/dist/protobuf-YgnOutn3.js +420 -0
  81. package/dist/pug-DLej6kn5.js +402 -0
  82. package/dist/python-CQrZx9mR.js +301 -0
  83. package/dist/python.contribution-CcKs2Ktm.js +8 -0
  84. package/dist/qsharp-AhjqtSHB.js +301 -0
  85. package/dist/r-D-F4P80w.js +243 -0
  86. package/dist/razor-DWmpHMcx.js +550 -0
  87. package/dist/redis-hwwIlMnV.js +302 -0
  88. package/dist/redshift-Bcm_kjEG.js +809 -0
  89. package/dist/restructuredtext-CrdzfPP-.js +174 -0
  90. package/dist/ruby-QC2UNm1s.js +511 -0
  91. package/dist/rust-5aqiQ3L5.js +343 -0
  92. package/dist/sb-B1g1ZfLJ.js +115 -0
  93. package/dist/scala-C2U4R5Gb.js +370 -0
  94. package/dist/scheme-DeFRbslr.js +108 -0
  95. package/dist/scss-RSTCiCmI.js +262 -0
  96. package/dist/shell-BpF-iNu8.js +221 -0
  97. package/dist/shell.contribution-B80NZ3iO.js +7 -0
  98. package/dist/solidity-C00r2mbQ.js +1367 -0
  99. package/dist/sophia-DVW5ZKDB.js +199 -0
  100. package/dist/sparql-B0nmpxeX.js +201 -0
  101. package/dist/sql-CJwKPERn.js +853 -0
  102. package/dist/sql.contribution-DQy36aE5.js +7 -0
  103. package/dist/st-DPlKG5DT.js +416 -0
  104. package/dist/swift-YZBAbVHV.js +309 -0
  105. package/dist/systemverilog-CDQSaH63.js +576 -0
  106. package/dist/tcl-Dlu8sp6Q.js +232 -0
  107. package/dist/tsMode-Bh-v12OL.js +887 -0
  108. package/dist/twig-C5TO7-kw.js +392 -0
  109. package/dist/typescript-c7y6IZVP.js +343 -0
  110. package/dist/typespec-BsmjDEu7.js +117 -0
  111. package/dist/useFieldRendering-BIqeE3qo.js +6083 -0
  112. package/dist/vb-ChHvIDrk.js +372 -0
  113. package/dist/wgsl-XEp1ju8c.js +439 -0
  114. package/dist/xml-MAEprTnF.js +95 -0
  115. package/dist/xml.contribution-XMOaon8i.js +27 -0
  116. package/dist/yaml-C1p8rXG7.js +206 -0
  117. package/dist/yaml.contribution-DRRVhJmJ.js +8 -0
  118. package/package.json +88 -0
  119. package/src/__tests__/client-assigner.test.ts +341 -0
  120. package/src/__tests__/code-types.test.ts +30 -0
  121. package/src/__tests__/markdown-field.test.ts +34 -0
  122. package/src/__tests__/markdown-note-field.test.ts +135 -0
  123. package/src/__tests__/quiz-recorder.test.ts +195 -0
  124. package/src/__tests__/recorder-editor-content-sync.test.ts +172 -0
  125. package/src/__tests__/recorder-editor.test.ts +143 -0
  126. package/src/__tests__/recorder-render.test.ts +57 -0
  127. package/src/__tests__/recorder-wysiwyg-field-host.test.ts +33 -0
  128. package/src/__tests__/step-field.test.ts +270 -0
  129. package/src/__tests__/type-plugins.test.ts +59 -0
  130. package/src/__tests__/var-field-render.test.ts +26 -0
  131. package/src/client-assigner.ts +269 -0
  132. package/src/code-types.ts +94 -0
  133. package/src/components/AimdCodeField.vue +228 -0
  134. package/src/components/AimdDnaSequenceField.vue +983 -0
  135. package/src/components/AimdMarkdownField.vue +168 -0
  136. package/src/components/AimdMarkdownNoteField.vue +457 -0
  137. package/src/components/AimdQuizRecorder.vue +792 -0
  138. package/src/components/AimdRecorder.vue +1959 -0
  139. package/src/components/AimdRecorderEditor.vue +2281 -0
  140. package/src/components/AimdRecorderWysiwygFieldHost.vue +93 -0
  141. package/src/components/AimdRecorderWysiwygSurface.vue +487 -0
  142. package/src/components/AimdSeqVizViewer.vue +122 -0
  143. package/src/components/AimdStepCheckField.vue +453 -0
  144. package/src/components/AimdVarField.vue +213 -0
  145. package/src/components/AimdVarTableField.vue +516 -0
  146. package/src/components/DnaAnnotationEditor.vue +477 -0
  147. package/src/components/DnaSequenceEditor.vue +44 -0
  148. package/src/components/DnaSequenceToolbar.vue +98 -0
  149. package/src/components/DnaSequenceViewer.vue +162 -0
  150. package/src/components/index.ts +21 -0
  151. package/src/components/recorderMilkdownPlugin.ts +632 -0
  152. package/src/composables/__tests__/useDnaSequence.test.ts +467 -0
  153. package/src/composables/__tests__/useFieldAdapters.test.ts +115 -0
  154. package/src/composables/__tests__/useFocusManagement.test.ts +66 -0
  155. package/src/composables/__tests__/useRecordState.test.ts +586 -0
  156. package/src/composables/__tests__/useStepTimers.test.ts +64 -0
  157. package/src/composables/__tests__/useVarHelpers.test.ts +424 -0
  158. package/src/composables/__tests__/workbenchFieldEditing.test.ts +97 -0
  159. package/src/composables/index.ts +94 -0
  160. package/src/composables/useClientAssignerRunner.ts +74 -0
  161. package/src/composables/useDnaSequence.ts +400 -0
  162. package/src/composables/useDnaSequenceField.ts +316 -0
  163. package/src/composables/useFieldAdapters.ts +61 -0
  164. package/src/composables/useFieldRendering.ts +269 -0
  165. package/src/composables/useFocusManagement.ts +144 -0
  166. package/src/composables/useRecordState.ts +429 -0
  167. package/src/composables/useStepTimers.ts +243 -0
  168. package/src/composables/useVarHelpers.ts +545 -0
  169. package/src/composables/useVarTableDragDrop.ts +236 -0
  170. package/src/composables/workbenchFieldEditing.ts +705 -0
  171. package/src/css.d.ts +9 -0
  172. package/src/index.ts +65 -0
  173. package/src/locales.ts +559 -0
  174. package/src/monaco-code.ts +75 -0
  175. package/src/styles/aimd.css +994 -0
  176. package/src/type-plugins.ts +132 -0
  177. package/src/type-utils.ts +3 -0
  178. package/src/types.ts +191 -0
@@ -0,0 +1,792 @@
1
+ <script setup lang="ts">
2
+ import { computed } from "vue"
3
+ import {
4
+ gradeScaleQuizLocally,
5
+ isScaleQuizAnswerComplete,
6
+ } from "@airalogy/aimd-core"
7
+ import {
8
+ type AimdQuizField,
9
+ type AimdQuizGradeResult,
10
+ } from "@airalogy/aimd-core/types"
11
+ import type { AimdRecorderMessagesInput } from "../locales"
12
+ import type { AimdChoiceOptionExplanationMode, AimdScaleGradeDisplayMode } from "../types"
13
+ import {
14
+ createAimdRecorderMessages,
15
+ getAimdRecorderQuizTypeLabel,
16
+ getAimdRecorderScopeLabel,
17
+ } from "../locales"
18
+
19
+ interface StemTextSegment {
20
+ type: "text"
21
+ value: string
22
+ }
23
+
24
+ interface StemBlankSegment {
25
+ type: "blank"
26
+ key: string
27
+ }
28
+
29
+ type StemSegment = StemTextSegment | StemBlankSegment
30
+
31
+ const props = withDefaults(defineProps<{
32
+ quiz: AimdQuizField
33
+ modelValue: unknown
34
+ grade?: AimdQuizGradeResult | null
35
+ submitted?: boolean
36
+ readonly?: boolean
37
+ focusKeyPrefix?: string
38
+ locale?: string
39
+ messages?: AimdRecorderMessagesInput
40
+ choiceOptionExplanationMode?: AimdChoiceOptionExplanationMode
41
+ scaleGradeDisplayMode?: AimdScaleGradeDisplayMode
42
+ }>(), {
43
+ grade: null,
44
+ submitted: false,
45
+ readonly: false,
46
+ focusKeyPrefix: undefined,
47
+ locale: undefined,
48
+ messages: undefined,
49
+ choiceOptionExplanationMode: "hidden",
50
+ scaleGradeDisplayMode: "hidden",
51
+ })
52
+
53
+ const emit = defineEmits<{
54
+ (e: "update:modelValue", value: unknown): void
55
+ }>()
56
+
57
+ const BLANK_PLACEHOLDER_PATTERN = /\[\[([^\[\]\s]+)\]\]/g
58
+
59
+ const stemSegments = computed<StemSegment[]>(() => {
60
+ const stem = props.quiz.stem || ""
61
+ if (props.quiz.type !== "blank") {
62
+ return [{ type: "text", value: stem }]
63
+ }
64
+
65
+ const segments: StemSegment[] = []
66
+ let lastIndex = 0
67
+
68
+ for (const match of stem.matchAll(BLANK_PLACEHOLDER_PATTERN)) {
69
+ const start = match.index ?? 0
70
+ if (start > lastIndex) {
71
+ segments.push({
72
+ type: "text",
73
+ value: stem.slice(lastIndex, start),
74
+ })
75
+ }
76
+ segments.push({
77
+ type: "blank",
78
+ key: match[1],
79
+ })
80
+ lastIndex = start + match[0].length
81
+ }
82
+
83
+ if (lastIndex < stem.length) {
84
+ segments.push({
85
+ type: "text",
86
+ value: stem.slice(lastIndex),
87
+ })
88
+ }
89
+
90
+ return segments.length > 0
91
+ ? segments
92
+ : [{ type: "text", value: stem }]
93
+ })
94
+
95
+ const singleChoiceValue = computed<string>({
96
+ get() {
97
+ return typeof props.modelValue === "string" ? props.modelValue : ""
98
+ },
99
+ set(value) {
100
+ emit("update:modelValue", value)
101
+ },
102
+ })
103
+
104
+ const multipleChoiceValue = computed<string[]>(() => {
105
+ if (!Array.isArray(props.modelValue)) {
106
+ return []
107
+ }
108
+ return props.modelValue.filter((item): item is string => typeof item === "string")
109
+ })
110
+
111
+ const selectedChoiceKeys = computed<string[]>(() => {
112
+ if (props.quiz.type !== "choice") {
113
+ return []
114
+ }
115
+
116
+ if (props.quiz.mode === "single") {
117
+ return singleChoiceValue.value ? [singleChoiceValue.value] : []
118
+ }
119
+
120
+ return multipleChoiceValue.value
121
+ })
122
+
123
+ function isMultipleChecked(key: string): boolean {
124
+ return multipleChoiceValue.value.includes(key)
125
+ }
126
+
127
+ function toggleMultipleChoice(key: string, checked: boolean): void {
128
+ const current = multipleChoiceValue.value
129
+ const next = checked
130
+ ? [...new Set([...current, key])]
131
+ : current.filter(item => item !== key)
132
+ emit("update:modelValue", next)
133
+ }
134
+
135
+ function asBlankValueMap(value: unknown): Record<string, string> {
136
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
137
+ return {}
138
+ }
139
+
140
+ const result: Record<string, string> = {}
141
+ for (const [key, item] of Object.entries(value)) {
142
+ if (typeof item === "string") {
143
+ result[key] = item
144
+ }
145
+ }
146
+ return result
147
+ }
148
+
149
+ function getBlankValue(key: string): string {
150
+ return asBlankValueMap(props.modelValue)[key] || ""
151
+ }
152
+
153
+ function setBlankValue(key: string, value: string): void {
154
+ const next = {
155
+ ...asBlankValueMap(props.modelValue),
156
+ [key]: value,
157
+ }
158
+ emit("update:modelValue", next)
159
+ }
160
+
161
+ function asScaleValueMap(value: unknown): Record<string, string> {
162
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
163
+ return {}
164
+ }
165
+
166
+ const result: Record<string, string> = {}
167
+ for (const [key, item] of Object.entries(value)) {
168
+ if (typeof item === "string") {
169
+ result[key] = item
170
+ }
171
+ }
172
+ return result
173
+ }
174
+
175
+ function getScaleItemValue(key: string): string {
176
+ return asScaleValueMap(props.modelValue)[key] || ""
177
+ }
178
+
179
+ function setScaleItemValue(key: string, value: string): void {
180
+ const next = {
181
+ ...asScaleValueMap(props.modelValue),
182
+ [key]: value,
183
+ }
184
+ emit("update:modelValue", next)
185
+ }
186
+
187
+ const openValue = computed<string>({
188
+ get() {
189
+ return typeof props.modelValue === "string" ? props.modelValue : ""
190
+ },
191
+ set(value) {
192
+ emit("update:modelValue", value)
193
+ },
194
+ })
195
+
196
+ function formatScaleOptionLabel(option: NonNullable<AimdQuizField["options"]>[number]): string {
197
+ if (typeof option.points === "number" && Number.isFinite(option.points)) {
198
+ return `${option.text} (${option.points})`
199
+ }
200
+ return option.text
201
+ }
202
+
203
+ const resolvedMessages = computed(() => createAimdRecorderMessages(props.locale, props.messages))
204
+ const quizTypeLabel = computed(() => getAimdRecorderQuizTypeLabel(props.quiz.type, resolvedMessages.value, props.quiz.mode))
205
+ const resolvedScaleItems = computed(() => (
206
+ props.quiz.type === "scale" && Array.isArray(props.quiz.items) ? props.quiz.items : []
207
+ ))
208
+ const resolvedScaleOptions = computed(() => (
209
+ props.quiz.type === "scale" && Array.isArray(props.quiz.options) ? props.quiz.options : []
210
+ ))
211
+ const isScaleComplete = computed(() => (
212
+ props.quiz.type === "scale" && isScaleQuizAnswerComplete(props.quiz, props.modelValue)
213
+ ))
214
+ const localScaleGrade = computed<AimdQuizGradeResult | null>(() => {
215
+ if (props.quiz.type !== "scale" || !isScaleComplete.value) {
216
+ return null
217
+ }
218
+ return gradeScaleQuizLocally(props.quiz, props.modelValue)
219
+ })
220
+ const effectiveGrade = computed<AimdQuizGradeResult | null>(() => {
221
+ if (props.grade) {
222
+ return props.grade
223
+ }
224
+
225
+ if (props.quiz.type !== "scale") {
226
+ return null
227
+ }
228
+
229
+ switch (props.scaleGradeDisplayMode) {
230
+ case "completed":
231
+ return localScaleGrade.value
232
+ case "submitted":
233
+ return props.submitted ? localScaleGrade.value : null
234
+ default:
235
+ return null
236
+ }
237
+ })
238
+ const gradeStatusTone = computed(() => {
239
+ const status = effectiveGrade.value?.status
240
+ switch (status) {
241
+ case "correct":
242
+ return "correct"
243
+ case "incorrect":
244
+ return "incorrect"
245
+ case "partial":
246
+ return "partial"
247
+ case "scored":
248
+ return "scored"
249
+ case "needs_review":
250
+ return "needs-review"
251
+ case "error":
252
+ return "error"
253
+ default:
254
+ return "ungraded"
255
+ }
256
+ })
257
+ const gradeStatusLabel = computed(() => {
258
+ const status = effectiveGrade.value?.status
259
+ if (!status) {
260
+ return ""
261
+ }
262
+
263
+ switch (status) {
264
+ case "correct":
265
+ return resolvedMessages.value.quiz.status.correct
266
+ case "incorrect":
267
+ return resolvedMessages.value.quiz.status.incorrect
268
+ case "partial":
269
+ return resolvedMessages.value.quiz.status.partial
270
+ case "scored":
271
+ return resolvedMessages.value.quiz.status.scored
272
+ case "needs_review":
273
+ return resolvedMessages.value.quiz.status.needsReview
274
+ case "error":
275
+ return resolvedMessages.value.quiz.status.error
276
+ default:
277
+ return resolvedMessages.value.quiz.status.ungraded
278
+ }
279
+ })
280
+ const blankGradeResults = computed(() => Array.isArray(effectiveGrade.value?.blank_results) ? effectiveGrade.value.blank_results : [])
281
+ const rubricGradeResults = computed(() => Array.isArray(effectiveGrade.value?.rubric_results) ? effectiveGrade.value.rubric_results : [])
282
+ const hasResolvedGrade = computed(() => Boolean(effectiveGrade.value && effectiveGrade.value.status !== "ungraded"))
283
+ const showGradePanel = computed(() => {
284
+ if (!effectiveGrade.value) {
285
+ return false
286
+ }
287
+
288
+ if (
289
+ effectiveGrade.value.status === "ungraded"
290
+ && !effectiveGrade.value.feedback
291
+ && !effectiveGrade.value.review_required
292
+ && !effectiveGrade.value.band
293
+ && blankGradeResults.value.length === 0
294
+ && rubricGradeResults.value.length === 0
295
+ ) {
296
+ return false
297
+ }
298
+
299
+ return true
300
+ })
301
+
302
+ function shouldShowChoiceOptionExplanation(optionKey: string, explanation?: string): boolean {
303
+ if (!explanation?.trim()) {
304
+ return false
305
+ }
306
+
307
+ if (!selectedChoiceKeys.value.includes(optionKey)) {
308
+ return false
309
+ }
310
+
311
+ if (props.choiceOptionExplanationMode === "selected") {
312
+ return true
313
+ }
314
+
315
+ if (props.choiceOptionExplanationMode === "submitted") {
316
+ return props.submitted
317
+ }
318
+
319
+ if (props.choiceOptionExplanationMode === "graded") {
320
+ return hasResolvedGrade.value
321
+ }
322
+
323
+ return false
324
+ }
325
+ </script>
326
+
327
+ <template>
328
+ <div class="aimd-quiz-recorder aimd-field aimd-field--quiz">
329
+ <div class="aimd-quiz__meta">
330
+ <span class="aimd-field__scope">{{ getAimdRecorderScopeLabel('quiz', resolvedMessages) }}</span>
331
+ <span class="aimd-field__name">{{ quiz.id }}</span>
332
+ <span class="aimd-field__type">({{ quizTypeLabel }})</span>
333
+ <span v-if="typeof quiz.score === 'number'" class="aimd-quiz__score">{{ resolvedMessages.quiz.score(quiz.score) }}</span>
334
+ </div>
335
+
336
+ <div v-if="quiz.title" class="aimd-quiz__title">
337
+ {{ quiz.title }}
338
+ </div>
339
+
340
+ <div class="aimd-quiz__stem">
341
+ <template v-for="(segment, index) in stemSegments" :key="`${quiz.id}-stem-${index}`">
342
+ <template v-if="segment.type === 'text'">
343
+ <span class="aimd-quiz-recorder__stem-text">{{ segment.value }}</span>
344
+ </template>
345
+ <template v-else>
346
+ <input
347
+ class="aimd-quiz-recorder__blank-input"
348
+ type="text"
349
+ :data-rec-focus-key="`${focusKeyPrefix || `quiz:${quiz.id}`}:blank:${segment.key}`"
350
+ :placeholder="segment.key"
351
+ :readonly="readonly"
352
+ :value="getBlankValue(segment.key)"
353
+ @input="setBlankValue(segment.key, ($event.target as HTMLInputElement).value)"
354
+ />
355
+ </template>
356
+ </template>
357
+ </div>
358
+
359
+ <div v-if="quiz.description" class="aimd-quiz__description">
360
+ {{ quiz.description }}
361
+ </div>
362
+
363
+ <div v-if="quiz.type === 'choice' && quiz.mode === 'single' && quiz.options?.length" class="aimd-quiz-recorder__options">
364
+ <label v-for="option in quiz.options" :key="`${quiz.id}-single-${option.key}`" class="aimd-quiz-recorder__option">
365
+ <input
366
+ v-model="singleChoiceValue"
367
+ type="radio"
368
+ class="aimd-quiz-recorder__choice-input"
369
+ :data-rec-focus-key="`${focusKeyPrefix || `quiz:${quiz.id}`}:single:${option.key}`"
370
+ :name="`${quiz.id}-single`"
371
+ :value="option.key"
372
+ :disabled="readonly"
373
+ />
374
+ <span class="aimd-quiz-recorder__option-content">
375
+ <span class="aimd-quiz-recorder__option-label">{{ option.key }}. {{ option.text }}</span>
376
+ <span
377
+ v-if="shouldShowChoiceOptionExplanation(option.key, option.explanation)"
378
+ class="aimd-quiz-recorder__option-explanation"
379
+ >
380
+ {{ option.explanation }}
381
+ </span>
382
+ </span>
383
+ </label>
384
+ </div>
385
+
386
+ <div v-if="quiz.type === 'choice' && quiz.mode === 'multiple' && quiz.options?.length" class="aimd-quiz-recorder__options">
387
+ <label v-for="option in quiz.options" :key="`${quiz.id}-multiple-${option.key}`" class="aimd-quiz-recorder__option">
388
+ <input
389
+ type="checkbox"
390
+ class="aimd-quiz-recorder__choice-input"
391
+ :data-rec-focus-key="`${focusKeyPrefix || `quiz:${quiz.id}`}:multiple:${option.key}`"
392
+ :disabled="readonly"
393
+ :checked="isMultipleChecked(option.key)"
394
+ @change="toggleMultipleChoice(option.key, ($event.target as HTMLInputElement).checked)"
395
+ />
396
+ <span class="aimd-quiz-recorder__option-content">
397
+ <span class="aimd-quiz-recorder__option-label">{{ option.key }}. {{ option.text }}</span>
398
+ <span
399
+ v-if="shouldShowChoiceOptionExplanation(option.key, option.explanation)"
400
+ class="aimd-quiz-recorder__option-explanation"
401
+ >
402
+ {{ option.explanation }}
403
+ </span>
404
+ </span>
405
+ </label>
406
+ </div>
407
+
408
+ <textarea
409
+ v-if="quiz.type === 'open'"
410
+ v-model="openValue"
411
+ class="aimd-quiz-recorder__open-input"
412
+ :data-rec-focus-key="`${focusKeyPrefix || `quiz:${quiz.id}`}:open`"
413
+ :placeholder="resolvedMessages.quiz.openPlaceholder"
414
+ rows="4"
415
+ :readonly="readonly"
416
+ />
417
+
418
+ <div
419
+ v-if="quiz.type === 'scale' && resolvedScaleItems.length && resolvedScaleOptions.length && quiz.display === 'list'"
420
+ class="aimd-scale"
421
+ >
422
+ <div
423
+ v-for="item in resolvedScaleItems"
424
+ :key="`${quiz.id}-scale-list-${item.key}`"
425
+ class="aimd-scale__list-item"
426
+ >
427
+ <div class="aimd-scale__item-stem">
428
+ {{ item.stem }}
429
+ </div>
430
+ <div class="aimd-scale__item-options">
431
+ <label
432
+ v-for="option in resolvedScaleOptions"
433
+ :key="`${quiz.id}-scale-list-${item.key}-${option.key}`"
434
+ class="aimd-scale__option"
435
+ >
436
+ <input
437
+ type="radio"
438
+ class="aimd-quiz-recorder__choice-input"
439
+ :data-rec-focus-key="`${focusKeyPrefix || `quiz:${quiz.id}`}:scale:${item.key}:${option.key}`"
440
+ :name="`${quiz.id}-scale-${item.key}`"
441
+ :value="option.key"
442
+ :checked="getScaleItemValue(item.key) === option.key"
443
+ :disabled="readonly"
444
+ @change="setScaleItemValue(item.key, option.key)"
445
+ />
446
+ <span>{{ formatScaleOptionLabel(option) }}</span>
447
+ </label>
448
+ </div>
449
+ </div>
450
+ </div>
451
+
452
+ <div
453
+ v-if="quiz.type === 'scale' && resolvedScaleItems.length && resolvedScaleOptions.length && quiz.display !== 'list'"
454
+ class="aimd-scale"
455
+ >
456
+ <table class="aimd-scale__table">
457
+ <thead>
458
+ <tr>
459
+ <th class="aimd-scale__item-header">Item</th>
460
+ <th v-for="option in resolvedScaleOptions" :key="`${quiz.id}-scale-head-${option.key}`">
461
+ {{ formatScaleOptionLabel(option) }}
462
+ </th>
463
+ </tr>
464
+ </thead>
465
+ <tbody>
466
+ <tr v-for="item in resolvedScaleItems" :key="`${quiz.id}-scale-row-${item.key}`">
467
+ <th class="aimd-scale__item-stem" scope="row">
468
+ {{ item.stem }}
469
+ </th>
470
+ <td v-for="option in resolvedScaleOptions" :key="`${quiz.id}-scale-cell-${item.key}-${option.key}`" class="aimd-scale__cell">
471
+ <label class="aimd-scale__cell-label">
472
+ <input
473
+ type="radio"
474
+ class="aimd-quiz-recorder__choice-input"
475
+ :data-rec-focus-key="`${focusKeyPrefix || `quiz:${quiz.id}`}:scale:${item.key}:${option.key}`"
476
+ :name="`${quiz.id}-scale-${item.key}`"
477
+ :value="option.key"
478
+ :checked="getScaleItemValue(item.key) === option.key"
479
+ :disabled="readonly"
480
+ @change="setScaleItemValue(item.key, option.key)"
481
+ />
482
+ </label>
483
+ </td>
484
+ </tr>
485
+ </tbody>
486
+ </table>
487
+ </div>
488
+
489
+ <div v-if="effectiveGrade && showGradePanel" :class="['aimd-quiz__grade-panel', `aimd-quiz__grade-panel--${gradeStatusTone}`]">
490
+ <div class="aimd-quiz__grade-meta">
491
+ <span :class="['aimd-quiz__grade-status', `aimd-quiz__grade-status--${gradeStatusTone}`]">{{ gradeStatusLabel }}</span>
492
+ <span :class="['aimd-quiz__grade-score', `aimd-quiz__grade-score--${gradeStatusTone}`]">
493
+ {{ resolvedMessages.quiz.gradedScore(effectiveGrade.earned_score, effectiveGrade.max_score) }}
494
+ </span>
495
+ </div>
496
+
497
+ <div v-if="effectiveGrade.band" class="aimd-quiz__grade-band">
498
+ <strong>{{ resolvedMessages.quiz.classification }}:</strong> {{ effectiveGrade.band.label }}
499
+ </div>
500
+
501
+ <div v-if="effectiveGrade.band?.interpretation" class="aimd-quiz__grade-band">
502
+ <strong>{{ resolvedMessages.quiz.interpretation }}:</strong> {{ effectiveGrade.band.interpretation }}
503
+ </div>
504
+
505
+ <div v-if="effectiveGrade.review_required" class="aimd-quiz__grade-review">
506
+ {{ resolvedMessages.quiz.reviewRequired }}
507
+ </div>
508
+
509
+ <div v-if="effectiveGrade.feedback" class="aimd-quiz__grade-feedback">
510
+ <strong>{{ resolvedMessages.quiz.feedback }}:</strong> {{ effectiveGrade.feedback }}
511
+ </div>
512
+
513
+ <ul v-if="blankGradeResults.length" class="aimd-quiz__grade-list">
514
+ <li v-for="item in blankGradeResults" :key="`${quiz.id}-grade-blank-${item.key}`">
515
+ {{ item.key }} · {{ resolvedMessages.quiz.gradedScore(item.earned_score, item.max_score) }}
516
+ </li>
517
+ </ul>
518
+
519
+ <ul v-if="rubricGradeResults.length" class="aimd-quiz__grade-list">
520
+ <li v-for="item in rubricGradeResults" :key="`${quiz.id}-grade-rubric-${item.id}`">
521
+ {{ item.id }} · {{ resolvedMessages.quiz.gradedScore(item.earned_score, item.max_score) }}
522
+ </li>
523
+ </ul>
524
+ </div>
525
+ </div>
526
+ </template>
527
+
528
+ <style scoped>
529
+ .aimd-quiz-recorder {
530
+ display: flex;
531
+ flex-direction: column;
532
+ align-items: stretch;
533
+ gap: 8px;
534
+ text-align: left;
535
+ }
536
+
537
+ .aimd-quiz__meta,
538
+ .aimd-quiz__stem {
539
+ text-align: left;
540
+ }
541
+
542
+ .aimd-quiz__meta {
543
+ gap: 4px;
544
+ justify-content: flex-start;
545
+ }
546
+
547
+ .aimd-quiz-recorder__stem-text {
548
+ white-space: pre-wrap;
549
+ }
550
+
551
+ .aimd-quiz__title {
552
+ font-size: 16px;
553
+ font-weight: 700;
554
+ color: #3b2f2f;
555
+ }
556
+
557
+ .aimd-quiz__stem {
558
+ margin-top: 0;
559
+ line-height: 1.45;
560
+ }
561
+
562
+ .aimd-quiz__description {
563
+ font-size: 13px;
564
+ line-height: 1.45;
565
+ color: #6d4c41;
566
+ white-space: pre-wrap;
567
+ }
568
+
569
+ .aimd-quiz-recorder__options {
570
+ display: flex;
571
+ flex-direction: column;
572
+ gap: 4px;
573
+ margin-top: 0;
574
+ }
575
+
576
+ .aimd-quiz-recorder__option {
577
+ display: flex;
578
+ align-items: flex-start;
579
+ justify-content: flex-start;
580
+ gap: 6px;
581
+ cursor: pointer;
582
+ text-align: left;
583
+ }
584
+
585
+ .aimd-quiz-recorder__option-content {
586
+ display: flex;
587
+ flex-direction: column;
588
+ gap: 4px;
589
+ }
590
+
591
+ .aimd-quiz-recorder__option-label {
592
+ text-align: left;
593
+ }
594
+
595
+ .aimd-quiz-recorder__option-explanation {
596
+ color: #667085;
597
+ font-size: 12px;
598
+ line-height: 1.45;
599
+ white-space: pre-wrap;
600
+ }
601
+
602
+ .aimd-quiz-recorder__choice-input {
603
+ width: 16px;
604
+ height: 16px;
605
+ accent-color: #4181fd;
606
+ }
607
+
608
+ .aimd-quiz-recorder__open-input,
609
+ .aimd-quiz-recorder__blank-input {
610
+ border: 1px solid #d0d7de;
611
+ border-radius: 6px;
612
+ padding: 6px 8px;
613
+ font-size: 14px;
614
+ line-height: 1.4;
615
+ outline: none;
616
+ transition: border-color 0.2s, box-shadow 0.2s;
617
+ }
618
+
619
+ .aimd-quiz-recorder__open-input {
620
+ width: 100%;
621
+ resize: vertical;
622
+ text-align: left;
623
+ }
624
+
625
+ .aimd-quiz-recorder__blank-input {
626
+ display: inline-flex;
627
+ min-width: 84px;
628
+ margin: 0 2px;
629
+ text-align: left;
630
+ vertical-align: baseline;
631
+ }
632
+
633
+ .aimd-quiz-recorder__open-input:focus,
634
+ .aimd-quiz-recorder__blank-input:focus {
635
+ border-color: #4181fd;
636
+ box-shadow: 0 0 0 2px rgba(65, 129, 253, 0.1);
637
+ }
638
+
639
+ .aimd-scale {
640
+ display: flex;
641
+ flex-direction: column;
642
+ gap: 10px;
643
+ }
644
+
645
+ .aimd-scale__table {
646
+ width: 100%;
647
+ border-collapse: collapse;
648
+ table-layout: fixed;
649
+ }
650
+
651
+ .aimd-scale__table th,
652
+ .aimd-scale__table td {
653
+ border: 1px solid #f1d8a7;
654
+ padding: 8px 10px;
655
+ text-align: center;
656
+ vertical-align: middle;
657
+ }
658
+
659
+ .aimd-scale__table thead th {
660
+ background: #fff4d6;
661
+ font-size: 12px;
662
+ font-weight: 600;
663
+ }
664
+
665
+ .aimd-scale__item-header,
666
+ .aimd-scale__item-stem {
667
+ text-align: left;
668
+ }
669
+
670
+ .aimd-scale__item-stem {
671
+ width: 34%;
672
+ font-weight: 500;
673
+ line-height: 1.4;
674
+ }
675
+
676
+ .aimd-scale__cell-label,
677
+ .aimd-scale__option {
678
+ display: inline-flex;
679
+ align-items: center;
680
+ justify-content: center;
681
+ gap: 6px;
682
+ }
683
+
684
+ .aimd-scale__list-item {
685
+ display: flex;
686
+ flex-direction: column;
687
+ gap: 8px;
688
+ padding: 10px 12px;
689
+ border: 1px solid #f1d8a7;
690
+ border-radius: 8px;
691
+ background: #fffdf7;
692
+ }
693
+
694
+ .aimd-scale__item-options {
695
+ display: flex;
696
+ flex-wrap: wrap;
697
+ gap: 8px 14px;
698
+ }
699
+
700
+ .aimd-scale__option {
701
+ justify-content: flex-start;
702
+ }
703
+
704
+ .aimd-quiz__grade-panel {
705
+ --aimd-quiz-grade-accent: #667085;
706
+ --aimd-quiz-grade-border: #d0d5dd;
707
+ --aimd-quiz-grade-bg: #f8fafc;
708
+ margin-top: 4px;
709
+ padding: 10px 12px;
710
+ border: 1px solid var(--aimd-quiz-grade-border);
711
+ border-left: 4px solid var(--aimd-quiz-grade-accent);
712
+ border-radius: 8px;
713
+ background: var(--aimd-quiz-grade-bg);
714
+ display: flex;
715
+ flex-direction: column;
716
+ gap: 6px;
717
+ font-size: 13px;
718
+ }
719
+
720
+ .aimd-quiz__grade-panel--correct {
721
+ --aimd-quiz-grade-accent: #15803d;
722
+ --aimd-quiz-grade-border: #bbf7d0;
723
+ --aimd-quiz-grade-bg: #f0fdf4;
724
+ }
725
+
726
+ .aimd-quiz__grade-panel--incorrect {
727
+ --aimd-quiz-grade-accent: #b42318;
728
+ --aimd-quiz-grade-border: #fecaca;
729
+ --aimd-quiz-grade-bg: #fef3f2;
730
+ }
731
+
732
+ .aimd-quiz__grade-panel--partial {
733
+ --aimd-quiz-grade-accent: #b54708;
734
+ --aimd-quiz-grade-border: #fed7aa;
735
+ --aimd-quiz-grade-bg: #fffaeb;
736
+ }
737
+
738
+ .aimd-quiz__grade-panel--scored {
739
+ --aimd-quiz-grade-accent: #175cd3;
740
+ --aimd-quiz-grade-border: #bfd4fe;
741
+ --aimd-quiz-grade-bg: #f5f8ff;
742
+ }
743
+
744
+ .aimd-quiz__grade-panel--needs-review {
745
+ --aimd-quiz-grade-accent: #175cd3;
746
+ --aimd-quiz-grade-border: #bfdbfe;
747
+ --aimd-quiz-grade-bg: #eff8ff;
748
+ }
749
+
750
+ .aimd-quiz__grade-panel--error {
751
+ --aimd-quiz-grade-accent: #b42318;
752
+ --aimd-quiz-grade-border: #fda4af;
753
+ --aimd-quiz-grade-bg: #fff1f2;
754
+ }
755
+
756
+ .aimd-quiz__grade-panel--ungraded {
757
+ --aimd-quiz-grade-accent: #667085;
758
+ --aimd-quiz-grade-border: #d0d5dd;
759
+ --aimd-quiz-grade-bg: #f8fafc;
760
+ }
761
+
762
+ .aimd-quiz__grade-meta {
763
+ display: flex;
764
+ flex-wrap: wrap;
765
+ gap: 8px;
766
+ align-items: center;
767
+ }
768
+
769
+ .aimd-quiz__grade-status {
770
+ display: inline-flex;
771
+ align-items: center;
772
+ padding: 2px 8px;
773
+ border-radius: 999px;
774
+ color: var(--aimd-quiz-grade-accent);
775
+ background: color-mix(in srgb, var(--aimd-quiz-grade-accent) 12%, white);
776
+ font-weight: 600;
777
+ }
778
+
779
+ .aimd-quiz__grade-score {
780
+ color: var(--aimd-quiz-grade-accent);
781
+ font-weight: 600;
782
+ }
783
+
784
+ .aimd-quiz__grade-band {
785
+ color: #344054;
786
+ }
787
+
788
+ .aimd-quiz__grade-list {
789
+ margin: 0;
790
+ padding-left: 18px;
791
+ }
792
+ </style>