@airalogy/aimd-recorder 1.16.0 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/README.md +11 -10
  2. package/README.zh-CN.md +11 -10
  3. package/dist/AimdCodeField-BQUuM-EF.js +182 -0
  4. package/dist/{AimdDnaSequenceField-CPyMqIVh.js → AimdDnaSequenceField-KZU2Zj3E.js} +2 -2
  5. package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-lyHIpch9.js → AimdEditor.vue_vue_type_style_index_0_lang-CzfYPp5r.js} +3924 -3831
  6. package/dist/AimdMarkdownField-t2d8uOeU.js +254 -0
  7. package/dist/AimdMarkdownNoteField-_h1oZSwH.js +259 -0
  8. package/dist/{_commonjsHelpers-CZXJ37nu.js → _commonjsHelpers-B5RozER-.js} +2 -2
  9. package/dist/aimd-recorder.css +1 -1
  10. package/dist/arc-DS_ocYoe.js +83 -0
  11. package/dist/architectureDiagram-3BPJPVTR-Dq2W8_tb.js +4692 -0
  12. package/dist/blockDiagram-GPEHLZMM-B4hnSAF_.js +2425 -0
  13. package/dist/c4Diagram-AAUBKEIU-CbffqNLY.js +1577 -0
  14. package/dist/channel-CtXnYrAk.js +5 -0
  15. package/dist/chunk-2J33WTMH-CROScrt5.js +19 -0
  16. package/dist/chunk-4BX2VUAB-DTmsQu5_.js +8 -0
  17. package/dist/chunk-55IACEB6-B5wDJzeX.js +8 -0
  18. package/dist/chunk-727SXJPM-CfyltY6o.js +1528 -0
  19. package/dist/chunk-AQP2D5EJ-B8274EYy.js +1387 -0
  20. package/dist/chunk-FMBD7UC4-CT_FK-SH.js +19 -0
  21. package/dist/chunk-ND2GUHAM-g9GulPi-.js +68 -0
  22. package/dist/chunk-QZHKN3VN-Di5HEktz.js +15 -0
  23. package/dist/classDiagram-4FO5ZUOK-BVUr246k.js +16 -0
  24. package/dist/classDiagram-v2-Q7XG4LA2-BVUr246k.js +16 -0
  25. package/dist/components.js +3365 -2216
  26. package/dist/composables.js +92 -68
  27. package/dist/cose-bilkent-S5V4N54A-GJ4IOO6v.js +2609 -0
  28. package/dist/cytoscape.esm-r59gEWFs.js +18710 -0
  29. package/dist/dagre-BM42HDAG-oL7Br44o.js +445 -0
  30. package/dist/defaultLocale-BgPVtth8.js +171 -0
  31. package/dist/diagram-2AECGRRQ-DtoCG_N4.js +217 -0
  32. package/dist/diagram-5GNKFQAL-f8QNdS7L.js +123 -0
  33. package/dist/diagram-KO2AKTUF-CsJOW_AX.js +461 -0
  34. package/dist/diagram-LMA3HP47-xmEKNZ7y.js +142 -0
  35. package/dist/diagram-OG6HWLK6-unpC7vo8.js +528 -0
  36. package/dist/erDiagram-TEJ5UH35-BGzFnCJD.js +899 -0
  37. package/dist/flowDiagram-I6XJVG4X-LBFhDnOs.js +1628 -0
  38. package/dist/ganttDiagram-6RSMTGT7-CFBc-jPD.js +2707 -0
  39. package/dist/gitGraphDiagram-PVQCEYII-BLduh-Rb.js +815 -0
  40. package/dist/graph-DdlKE625.js +1510 -0
  41. package/dist/index.js +104 -80
  42. package/dist/infoDiagram-5YYISTIA-CLQQI6zM.js +24 -0
  43. package/dist/init-DjUOC4st.js +16 -0
  44. package/dist/ishikawaDiagram-YF4QCWOH-CStdYBmW.js +621 -0
  45. package/dist/journeyDiagram-JHISSGLW-B6mRTzoE.js +834 -0
  46. package/dist/kanban-definition-UN3LZRKU-C-vnN5v4.js +724 -0
  47. package/dist/katex-DNob3HGn.js +11690 -0
  48. package/dist/layout-DDt0fz-M.js +1703 -0
  49. package/dist/linear-C-IAFdOt.js +259 -0
  50. package/dist/mermaid.core-CuZ3nINf.js +15940 -0
  51. package/dist/mindmap-definition-RKZ34NQL-TSZ1Vb3z.js +827 -0
  52. package/dist/ordinal-B6-f3MAq.js +61 -0
  53. package/dist/pieDiagram-4H26LBE5-DYok-1-k.js +163 -0
  54. package/dist/quadrantDiagram-W4KKPZXB-Cg856sbH.js +1024 -0
  55. package/dist/requirementDiagram-4Y6WPE33-BN9fGdlJ.js +882 -0
  56. package/dist/sankeyDiagram-5OEKKPKP-CDqTgonY.js +847 -0
  57. package/dist/sequenceDiagram-3UESZ5HK-Chjrc0-W.js +2891 -0
  58. package/dist/stateDiagram-AJRCARHV-DRyLHrdr.js +263 -0
  59. package/dist/stateDiagram-v2-BHNVJYJU-CZTIDHid.js +16 -0
  60. package/dist/timeline-definition-PNZ67QCA-Bc3D9AAG.js +1055 -0
  61. package/dist/{useFieldRendering-Dh6Kib_0.js → useCodeBlockRendering-qA6gj4vz.js} +3041 -2255
  62. package/dist/useMonacoAutoHeight-D4T-El3J.js +66 -0
  63. package/dist/vennDiagram-CIIHVFJN-CYAul48m.js +1557 -0
  64. package/dist/wardley-L42UT6IY-D7b2ujEZ.js +22512 -0
  65. package/dist/wardleyDiagram-YWT4CUSO-B7Tg0MG9.js +675 -0
  66. package/dist/xychartDiagram-2RQKCTM6-xWYVEqth.js +1342 -0
  67. package/package.json +8 -7
  68. package/src/__tests__/assigner-runner-dependent-data.test.ts +32 -0
  69. package/src/__tests__/markdown-field.test.ts +150 -1
  70. package/src/__tests__/markdown-note-field.test.ts +86 -3
  71. package/src/__tests__/quiz-recorder.test.ts +47 -0
  72. package/src/__tests__/recorder-assigner-control.test.ts +844 -0
  73. package/src/__tests__/recorder-check-field.test.ts +103 -0
  74. package/src/__tests__/recorder-editor.test.ts +17 -0
  75. package/src/__tests__/recorder-markdown-assigner-integration.test.ts +49 -0
  76. package/src/__tests__/step-field.test.ts +87 -4
  77. package/src/__tests__/type-plugins.test.ts +1 -0
  78. package/src/__tests__/var-field-render.test.ts +741 -1
  79. package/src/components/AimdCodeField.vue +24 -5
  80. package/src/components/AimdMarkdownField.vue +548 -11
  81. package/src/components/AimdMarkdownNoteField.vue +241 -30
  82. package/src/components/AimdQuizOptionFollowups.vue +121 -0
  83. package/src/components/AimdQuizRecorder.vue +79 -148
  84. package/src/components/AimdRecorder.vue +1620 -98
  85. package/src/components/AimdRecorderEditor.vue +276 -8
  86. package/src/components/AimdRecorderWysiwygFieldHost.vue +6 -0
  87. package/src/components/AimdRecorderWysiwygSurface.vue +32 -0
  88. package/src/components/AimdStepCheckField.vue +205 -51
  89. package/src/components/AimdVarField.vue +694 -25
  90. package/src/components/AimdVarTableField.vue +283 -110
  91. package/src/components/icons/AimdAssignerCalculatorIcon.vue +18 -0
  92. package/src/components/icons/AimdAssignerCloudStatusIcon.vue +22 -0
  93. package/src/components/recorderMilkdownPlugin.ts +14 -0
  94. package/src/composables/__tests__/useRecordState.test.ts +114 -0
  95. package/src/composables/__tests__/useVarHelpers.test.ts +133 -0
  96. package/src/composables/index.ts +27 -1
  97. package/src/composables/useAssignerRunner.ts +376 -0
  98. package/src/composables/useCodeBlockRendering.ts +51 -0
  99. package/src/composables/useFieldRendering.ts +32 -4
  100. package/src/composables/useMonacoAutoHeight.ts +127 -0
  101. package/src/composables/useRecordState.ts +40 -14
  102. package/src/composables/useVarHelpers.ts +377 -9
  103. package/src/index.ts +13 -0
  104. package/src/locales.ts +47 -2
  105. package/src/styles/aimd.css +171 -6
  106. package/src/type-plugins.ts +7 -0
  107. package/src/types.ts +93 -2
  108. package/dist/AimdCodeField-DC3DPvgc.js +0 -172
  109. package/dist/AimdMarkdownField-CX71bOdX.js +0 -67
  110. package/dist/AimdMarkdownNoteField--ssNIQfG.js +0 -186
@@ -16,6 +16,7 @@ import {
16
16
  getAimdRecorderQuizTypeLabel,
17
17
  getAimdRecorderScopeLabel,
18
18
  } from "../locales"
19
+ import AimdQuizOptionFollowups from "./AimdQuizOptionFollowups.vue"
19
20
 
20
21
  interface StemTextSegment {
21
22
  type: "text"
@@ -28,8 +29,8 @@ interface StemBlankSegment {
28
29
  }
29
30
 
30
31
  type StemSegment = StemTextSegment | StemBlankSegment
31
- type ChoiceFollowupPrimitive = string | number | boolean
32
- type ChoiceFollowupAnswerMap = Record<string, Record<string, ChoiceFollowupPrimitive>>
32
+ type OptionFollowupPrimitive = string | number | boolean
33
+ type OptionFollowupAnswerMap = Record<string, Record<string, OptionFollowupPrimitive>>
33
34
 
34
35
  const props = withDefaults(defineProps<{
35
36
  quiz: AimdQuizField
@@ -95,8 +96,8 @@ const stemSegments = computed<StemSegment[]>(() => {
95
96
  : [{ type: "text", value: stem }]
96
97
  })
97
98
 
98
- const hasChoiceFollowups = computed(() => (
99
- props.quiz.type === "choice"
99
+ const hasOptionFollowups = computed(() => (
100
+ (props.quiz.type === "choice" || props.quiz.type === "true_false")
100
101
  && Array.isArray(props.quiz.options)
101
102
  && props.quiz.options.some(option => Array.isArray(option.followups) && option.followups.length > 0)
102
103
  ))
@@ -108,8 +109,8 @@ function asObjectRecord(value: unknown): Record<string, unknown> | null {
108
109
  return value as Record<string, unknown>
109
110
  }
110
111
 
111
- function getChoiceSelectedValue(): unknown {
112
- if (!hasChoiceFollowups.value) {
112
+ function getOptionSelectedValue(): unknown {
113
+ if (!hasOptionFollowups.value) {
113
114
  return props.modelValue
114
115
  }
115
116
  const recordValue = asObjectRecord(props.modelValue)
@@ -120,6 +121,9 @@ function getChoiceSelectedValue(): unknown {
120
121
  }
121
122
 
122
123
  function getSelectedChoiceKeys(value: unknown): string[] {
124
+ if (typeof value === "boolean") {
125
+ return [String(value)]
126
+ }
123
127
  if (typeof value === "string") {
124
128
  return value ? [value] : []
125
129
  }
@@ -129,19 +133,19 @@ function getSelectedChoiceKeys(value: unknown): string[] {
129
133
  return []
130
134
  }
131
135
 
132
- function asChoiceFollowupAnswerMap(value: unknown): ChoiceFollowupAnswerMap {
136
+ function asOptionFollowupAnswerMap(value: unknown): OptionFollowupAnswerMap {
133
137
  const source = asObjectRecord(value)
134
138
  if (!source) {
135
139
  return {}
136
140
  }
137
141
 
138
- const normalized: ChoiceFollowupAnswerMap = {}
142
+ const normalized: OptionFollowupAnswerMap = {}
139
143
  for (const [optionKey, rawFields] of Object.entries(source)) {
140
144
  const fieldSource = asObjectRecord(rawFields)
141
145
  if (!fieldSource) {
142
146
  continue
143
147
  }
144
- const fields: Record<string, ChoiceFollowupPrimitive> = {}
148
+ const fields: Record<string, OptionFollowupPrimitive> = {}
145
149
  for (const [fieldKey, fieldValue] of Object.entries(fieldSource)) {
146
150
  if (
147
151
  typeof fieldValue === "string"
@@ -158,16 +162,16 @@ function asChoiceFollowupAnswerMap(value: unknown): ChoiceFollowupAnswerMap {
158
162
  return normalized
159
163
  }
160
164
 
161
- function getChoiceFollowupsMap(): ChoiceFollowupAnswerMap {
162
- if (!hasChoiceFollowups.value) {
165
+ function getOptionFollowupsMap(): OptionFollowupAnswerMap {
166
+ if (!hasOptionFollowups.value) {
163
167
  return {}
164
168
  }
165
- return asChoiceFollowupAnswerMap(asObjectRecord(props.modelValue)?.followups)
169
+ return asOptionFollowupAnswerMap(asObjectRecord(props.modelValue)?.followups)
166
170
  }
167
171
 
168
- function getChoiceOptionFollowupDefaults(optionKey: string): Record<string, ChoiceFollowupPrimitive> {
172
+ function getOptionFollowupDefaults(optionKey: string): Record<string, OptionFollowupPrimitive> {
169
173
  const option = props.quiz.options?.find(item => item.key === optionKey)
170
- const defaults: Record<string, ChoiceFollowupPrimitive> = {}
174
+ const defaults: Record<string, OptionFollowupPrimitive> = {}
171
175
  for (const followup of option?.followups || []) {
172
176
  if (followup.default !== undefined) {
173
177
  defaults[followup.key] = followup.default
@@ -176,16 +180,16 @@ function getChoiceOptionFollowupDefaults(optionKey: string): Record<string, Choi
176
180
  return defaults
177
181
  }
178
182
 
179
- function buildStructuredChoiceAnswer(
183
+ function buildStructuredOptionAnswer(
180
184
  selected: unknown,
181
- followups: ChoiceFollowupAnswerMap = getChoiceFollowupsMap(),
185
+ followups: OptionFollowupAnswerMap = getOptionFollowupsMap(),
182
186
  ): Record<string, unknown> {
183
187
  const selectedKeys = getSelectedChoiceKeys(selected)
184
- const nextFollowups: ChoiceFollowupAnswerMap = {}
188
+ const nextFollowups: OptionFollowupAnswerMap = {}
185
189
 
186
190
  for (const selectedKey of selectedKeys) {
187
191
  const values = {
188
- ...getChoiceOptionFollowupDefaults(selectedKey),
192
+ ...getOptionFollowupDefaults(selectedKey),
189
193
  ...(followups[selectedKey] || {}),
190
194
  }
191
195
  if (Object.keys(values).length > 0) {
@@ -199,9 +203,9 @@ function buildStructuredChoiceAnswer(
199
203
  }
200
204
  }
201
205
 
202
- function emitChoiceSelectedValue(value: string | string[]): void {
203
- if (hasChoiceFollowups.value) {
204
- emit("update:modelValue", buildStructuredChoiceAnswer(value))
206
+ function emitOptionSelectedValue(value: string | string[] | boolean): void {
207
+ if (hasOptionFollowups.value) {
208
+ emit("update:modelValue", buildStructuredOptionAnswer(value))
205
209
  return
206
210
  }
207
211
  emit("update:modelValue", value)
@@ -209,16 +213,16 @@ function emitChoiceSelectedValue(value: string | string[]): void {
209
213
 
210
214
  const singleChoiceValue = computed<string>({
211
215
  get() {
212
- const selected = getChoiceSelectedValue()
216
+ const selected = getOptionSelectedValue()
213
217
  return typeof selected === "string" ? selected : ""
214
218
  },
215
219
  set(value) {
216
- emitChoiceSelectedValue(value)
220
+ emitOptionSelectedValue(value)
217
221
  },
218
222
  })
219
223
 
220
224
  const multipleChoiceValue = computed<string[]>(() => {
221
- const selected = getChoiceSelectedValue()
225
+ const selected = getOptionSelectedValue()
222
226
  if (!Array.isArray(selected)) {
223
227
  return []
224
228
  }
@@ -239,9 +243,14 @@ const selectedChoiceKeys = computed<string[]>(() => {
239
243
 
240
244
  const trueFalseValue = computed<boolean | null>({
241
245
  get() {
242
- return typeof props.modelValue === "boolean" ? props.modelValue : null
246
+ const selected = getOptionSelectedValue()
247
+ return typeof selected === "boolean" ? selected : null
243
248
  },
244
249
  set(value) {
250
+ if (hasOptionFollowups.value && typeof value === "boolean") {
251
+ emit("update:modelValue", buildStructuredOptionAnswer(value))
252
+ return
253
+ }
245
254
  emit("update:modelValue", value)
246
255
  },
247
256
  })
@@ -261,7 +270,7 @@ const resolvedTrueFalseOptions = computed<NonNullable<AimdQuizField["options"]>>
261
270
 
262
271
  const selectedQuizOptionKeys = computed<string[]>(() => {
263
272
  if (props.quiz.type === "true_false") {
264
- return typeof props.modelValue === "boolean" ? [String(props.modelValue)] : []
273
+ return typeof trueFalseValue.value === "boolean" ? [String(trueFalseValue.value)] : []
265
274
  }
266
275
  return selectedChoiceKeys.value
267
276
  })
@@ -275,35 +284,23 @@ function toggleMultipleChoice(key: string, checked: boolean): void {
275
284
  const next = checked
276
285
  ? [...new Set([...current, key])]
277
286
  : current.filter(item => item !== key)
278
- emitChoiceSelectedValue(next)
287
+ emitOptionSelectedValue(next)
279
288
  }
280
289
 
281
- function shouldShowChoiceFollowups(option: NonNullable<AimdQuizField["options"]>[number]): boolean {
290
+ function shouldShowOptionFollowups(option: NonNullable<AimdQuizField["options"]>[number]): boolean {
282
291
  return Array.isArray(option.followups)
283
292
  && option.followups.length > 0
284
- && selectedChoiceKeys.value.includes(option.key)
285
- }
286
-
287
- function getFollowupLabel(followup: AimdQuizFollowupField): string {
288
- return followup.title || followup.key
289
- }
290
-
291
- function getFollowupTextValue(optionKey: string, followup: AimdQuizFollowupField): string {
292
- const value = getChoiceFollowupsMap()[optionKey]?.[followup.key]
293
- if (typeof value === "string" || typeof value === "number") {
294
- return String(value)
295
- }
296
- return ""
293
+ && selectedQuizOptionKeys.value.includes(option.key)
297
294
  }
298
295
 
299
- function getFollowupBooleanValue(optionKey: string, followup: AimdQuizFollowupField): boolean {
300
- return getChoiceFollowupsMap()[optionKey]?.[followup.key] === true
296
+ function getOptionFollowupValues(optionKey: string): Record<string, OptionFollowupPrimitive> {
297
+ return getOptionFollowupsMap()[optionKey] || {}
301
298
  }
302
299
 
303
300
  function normalizeFollowupInputValue(
304
301
  followup: AimdQuizFollowupField,
305
302
  value: string | boolean,
306
- ): ChoiceFollowupPrimitive | undefined {
303
+ ): OptionFollowupPrimitive | undefined {
307
304
  if (followup.type === "bool") {
308
305
  return Boolean(value)
309
306
  }
@@ -332,12 +329,12 @@ function normalizeFollowupInputValue(
332
329
  return parsed
333
330
  }
334
331
 
335
- function setChoiceFollowupValue(
332
+ function setOptionFollowupValue(
336
333
  optionKey: string,
337
334
  followup: AimdQuizFollowupField,
338
335
  value: string | boolean,
339
336
  ): void {
340
- const nextFollowups = getChoiceFollowupsMap()
337
+ const nextFollowups = getOptionFollowupsMap()
341
338
  const optionFollowups = { ...(nextFollowups[optionKey] || {}) }
342
339
  const normalizedValue = normalizeFollowupInputValue(followup, value)
343
340
  if (normalizedValue === undefined) {
@@ -354,7 +351,7 @@ function setChoiceFollowupValue(
354
351
  delete nextFollowups[optionKey]
355
352
  }
356
353
 
357
- emit("update:modelValue", buildStructuredChoiceAnswer(getChoiceSelectedValue(), nextFollowups))
354
+ emit("update:modelValue", buildStructuredOptionAnswer(getOptionSelectedValue(), nextFollowups))
358
355
  }
359
356
 
360
357
  function asBlankValueMap(value: unknown): Record<string, string> {
@@ -607,6 +604,17 @@ function shouldShowChoiceOptionExplanation(optionKey: string, explanation?: stri
607
604
  </span>
608
605
  </span>
609
606
  </label>
607
+ <AimdQuizOptionFollowups
608
+ v-if="shouldShowOptionFollowups(option)"
609
+ :quiz-id="quiz.id"
610
+ :option-key="option.key"
611
+ input-scope="true_false"
612
+ :followups="option.followups || []"
613
+ :values="getOptionFollowupValues(option.key)"
614
+ :readonly="readonly"
615
+ :focus-key-prefix="focusKeyPrefix"
616
+ @update="(followup, value) => setOptionFollowupValue(option.key, followup, value)"
617
+ />
610
618
  </div>
611
619
  </div>
612
620
 
@@ -632,35 +640,17 @@ function shouldShowChoiceOptionExplanation(optionKey: string, explanation?: stri
632
640
  </span>
633
641
  </span>
634
642
  </label>
635
- <div v-if="shouldShowChoiceFollowups(option)" class="aimd-quiz-recorder__followups">
636
- <label
637
- v-for="followup in option.followups"
638
- :key="`${quiz.id}-single-${option.key}-followup-${followup.key}`"
639
- class="aimd-quiz-recorder__followup"
640
- >
641
- <span class="aimd-quiz-recorder__followup-label">{{ getFollowupLabel(followup) }}</span>
642
- <input
643
- v-if="followup.type === 'bool'"
644
- type="checkbox"
645
- class="aimd-quiz-recorder__followup-checkbox"
646
- :data-rec-focus-key="`${focusKeyPrefix || `quiz:${quiz.id}`}:single:${option.key}:followup:${followup.key}`"
647
- :checked="getFollowupBooleanValue(option.key, followup)"
648
- :disabled="readonly"
649
- @change="setChoiceFollowupValue(option.key, followup, ($event.target as HTMLInputElement).checked)"
650
- />
651
- <input
652
- v-else
653
- :type="followup.type === 'str' ? 'text' : 'number'"
654
- :step="followup.type === 'int' ? '1' : undefined"
655
- class="aimd-quiz-recorder__followup-input"
656
- :data-rec-focus-key="`${focusKeyPrefix || `quiz:${quiz.id}`}:single:${option.key}:followup:${followup.key}`"
657
- :value="getFollowupTextValue(option.key, followup)"
658
- :readonly="readonly"
659
- @input="setChoiceFollowupValue(option.key, followup, ($event.target as HTMLInputElement).value)"
660
- />
661
- <span v-if="followup.unit" class="aimd-quiz-recorder__followup-unit">{{ followup.unit }}</span>
662
- </label>
663
- </div>
643
+ <AimdQuizOptionFollowups
644
+ v-if="shouldShowOptionFollowups(option)"
645
+ :quiz-id="quiz.id"
646
+ :option-key="option.key"
647
+ input-scope="single"
648
+ :followups="option.followups || []"
649
+ :values="getOptionFollowupValues(option.key)"
650
+ :readonly="readonly"
651
+ :focus-key-prefix="focusKeyPrefix"
652
+ @update="(followup, value) => setOptionFollowupValue(option.key, followup, value)"
653
+ />
664
654
  </div>
665
655
  </div>
666
656
 
@@ -685,35 +675,17 @@ function shouldShowChoiceOptionExplanation(optionKey: string, explanation?: stri
685
675
  </span>
686
676
  </span>
687
677
  </label>
688
- <div v-if="shouldShowChoiceFollowups(option)" class="aimd-quiz-recorder__followups">
689
- <label
690
- v-for="followup in option.followups"
691
- :key="`${quiz.id}-multiple-${option.key}-followup-${followup.key}`"
692
- class="aimd-quiz-recorder__followup"
693
- >
694
- <span class="aimd-quiz-recorder__followup-label">{{ getFollowupLabel(followup) }}</span>
695
- <input
696
- v-if="followup.type === 'bool'"
697
- type="checkbox"
698
- class="aimd-quiz-recorder__followup-checkbox"
699
- :data-rec-focus-key="`${focusKeyPrefix || `quiz:${quiz.id}`}:multiple:${option.key}:followup:${followup.key}`"
700
- :checked="getFollowupBooleanValue(option.key, followup)"
701
- :disabled="readonly"
702
- @change="setChoiceFollowupValue(option.key, followup, ($event.target as HTMLInputElement).checked)"
703
- />
704
- <input
705
- v-else
706
- :type="followup.type === 'str' ? 'text' : 'number'"
707
- :step="followup.type === 'int' ? '1' : undefined"
708
- class="aimd-quiz-recorder__followup-input"
709
- :data-rec-focus-key="`${focusKeyPrefix || `quiz:${quiz.id}`}:multiple:${option.key}:followup:${followup.key}`"
710
- :value="getFollowupTextValue(option.key, followup)"
711
- :readonly="readonly"
712
- @input="setChoiceFollowupValue(option.key, followup, ($event.target as HTMLInputElement).value)"
713
- />
714
- <span v-if="followup.unit" class="aimd-quiz-recorder__followup-unit">{{ followup.unit }}</span>
715
- </label>
716
- </div>
678
+ <AimdQuizOptionFollowups
679
+ v-if="shouldShowOptionFollowups(option)"
680
+ :quiz-id="quiz.id"
681
+ :option-key="option.key"
682
+ input-scope="multiple"
683
+ :followups="option.followups || []"
684
+ :values="getOptionFollowupValues(option.key)"
685
+ :readonly="readonly"
686
+ :focus-key-prefix="focusKeyPrefix"
687
+ @update="(followup, value) => setOptionFollowupValue(option.key, followup, value)"
688
+ />
717
689
  </div>
718
690
  </div>
719
691
 
@@ -923,48 +895,8 @@ function shouldShowChoiceOptionExplanation(optionKey: string, explanation?: stri
923
895
  accent-color: #4181fd;
924
896
  }
925
897
 
926
- .aimd-quiz-recorder__followups {
927
- display: flex;
928
- flex-direction: column;
929
- gap: 6px;
930
- margin-left: 22px;
931
- padding: 8px 10px;
932
- border-left: 2px solid #dbeafe;
933
- background: #f8fbff;
934
- }
935
-
936
- .aimd-quiz-recorder__followup {
937
- display: grid;
938
- grid-template-columns: minmax(92px, max-content) minmax(120px, 1fr) auto;
939
- gap: 6px;
940
- align-items: center;
941
- font-size: 13px;
942
- }
943
-
944
- .aimd-quiz-recorder__followup-label {
945
- color: #344054;
946
- font-weight: 500;
947
- }
948
-
949
- .aimd-quiz-recorder__followup-input {
950
- min-width: 0;
951
- width: 100%;
952
- }
953
-
954
- .aimd-quiz-recorder__followup-checkbox {
955
- justify-self: start;
956
- width: 16px;
957
- height: 16px;
958
- accent-color: #4181fd;
959
- }
960
-
961
- .aimd-quiz-recorder__followup-unit {
962
- color: #667085;
963
- }
964
-
965
898
  .aimd-quiz-recorder__open-input,
966
- .aimd-quiz-recorder__blank-input,
967
- .aimd-quiz-recorder__followup-input {
899
+ .aimd-quiz-recorder__blank-input {
968
900
  border: 1px solid #d0d7de;
969
901
  border-radius: 6px;
970
902
  padding: 6px 8px;
@@ -989,8 +921,7 @@ function shouldShowChoiceOptionExplanation(optionKey: string, explanation?: stri
989
921
  }
990
922
 
991
923
  .aimd-quiz-recorder__open-input:focus,
992
- .aimd-quiz-recorder__blank-input:focus,
993
- .aimd-quiz-recorder__followup-input:focus {
924
+ .aimd-quiz-recorder__blank-input:focus {
994
925
  border-color: #4181fd;
995
926
  box-shadow: 0 0 0 2px rgba(65, 129, 253, 0.1);
996
927
  }