@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
@@ -2,9 +2,15 @@
2
2
  import { computed, defineComponent, h, nextTick, onBeforeUnmount, ref, shallowRef, watch, type VNode } from 'vue'
3
3
  import { AimdEditor } from '@airalogy/aimd-editor/vue'
4
4
  import { renderToVue } from '@airalogy/aimd-renderer'
5
+ import { useCodeBlockRendering } from '../composables/useCodeBlockRendering'
6
+ import { createMonacoAutoHeight, type MonacoAutoHeightEditor } from '../composables/useMonacoAutoHeight'
5
7
 
6
8
  type AimdEditorExpose = {
7
- getMonacoEditor?: () => { focus?: () => void } | null
9
+ getMonacoEditor?: () => NoteMonacoEditor | null
10
+ }
11
+
12
+ type NoteMonacoEditor = MonacoAutoHeightEditor & {
13
+ focus?: () => void
8
14
  }
9
15
 
10
16
  const props = withDefaults(defineProps<{
@@ -16,7 +22,6 @@ const props = withDefaults(defineProps<{
16
22
  modelValue: undefined,
17
23
  disabled: false,
18
24
  locale: undefined,
19
- minHeight: 220,
20
25
  })
21
26
 
22
27
  const emit = defineEmits<{
@@ -44,19 +49,43 @@ function isZhLocale(locale?: string): boolean {
44
49
  const fieldRootRef = ref<HTMLElement | null>(null)
45
50
  const editorRef = ref<AimdEditorExpose | null>(null)
46
51
  const draftValue = ref(normalizeMarkdownModelValue(props.modelValue))
52
+ const noteAutoHeight = createMonacoAutoHeight({
53
+ getInitialValue: () => draftValue.value,
54
+ getLayoutElement: () => fieldRootRef.value?.querySelector('.aimd-editor-container') as HTMLElement | null,
55
+ minHeight: props.minHeight,
56
+ maxHeight: 420,
57
+ })
58
+ const noteEditorHeight = noteAutoHeight.editorHeight
59
+ const noteFieldStyle = computed(() => ({
60
+ '--aimd-markdown-note-editor-height': `${noteEditorHeight.value}px`,
61
+ }))
47
62
  const editing = ref(false)
48
63
  const previewNodes = shallowRef<VNode[]>([])
49
64
  const previewRenderFailed = ref(false)
50
65
  let previewRenderRequestId = 0
51
66
  let focusOutCheckTimer: ReturnType<typeof setTimeout> | null = null
67
+ let modeSwitchFocusGuardTimer: ReturnType<typeof setTimeout> | null = null
68
+ let modeSwitchFocusGuardActive = false
69
+ let pendingEditorFocus = false
70
+ const { preRenderer: codeBlockPreRenderer } = useCodeBlockRendering(() => {
71
+ void renderPreview()
72
+ })
52
73
 
53
74
  const hasValue = computed(() => Boolean(draftValue.value.trim()))
54
75
  const showPreview = computed(() => hasValue.value && !editing.value)
55
76
  const showEditor = computed(() => !props.disabled && (!hasValue.value || editing.value))
56
77
  const showEmptyState = computed(() => !showPreview.value && !showEditor.value)
57
- const editLabel = computed(() => (isZhLocale(props.locale) ? '编辑备注' : 'Edit note'))
58
78
  const closeLabel = computed(() => (isZhLocale(props.locale) ? '关闭备注' : 'Close note'))
59
79
  const emptyLabel = computed(() => (isZhLocale(props.locale) ? '暂无备注' : 'No notes'))
80
+ const previewLabel = computed(() => (isZhLocale(props.locale) ? '预览' : 'Preview'))
81
+ const sourceLabel = computed(() => (isZhLocale(props.locale) ? '源码' : 'Source'))
82
+ const viewSwitchLabel = computed(() => (isZhLocale(props.locale) ? '备注显示模式' : 'Note view mode'))
83
+ const noteMonacoOptions = computed(() => ({
84
+ minimap: { enabled: false },
85
+ lineHeight: noteAutoHeight.lineHeight,
86
+ padding: { top: 12, bottom: 12 },
87
+ scrollbar: { vertical: 'auto', horizontal: 'auto' },
88
+ }))
60
89
 
61
90
  const PreviewOutlet = defineComponent({
62
91
  name: 'AimdMarkdownNotePreviewOutlet',
@@ -83,6 +112,7 @@ function syncEditingState() {
83
112
  }
84
113
 
85
114
  function emitDraftValue(markdown: string) {
115
+ noteAutoHeight.syncEstimatedEditorHeight(markdown)
86
116
  if (markdown === draftValue.value) {
87
117
  return
88
118
  }
@@ -104,6 +134,9 @@ async function renderPreview() {
104
134
  try {
105
135
  const rendered = await renderToVue(currentContent, {
106
136
  locale: props.locale,
137
+ elementRenderers: {
138
+ pre: codeBlockPreRenderer,
139
+ },
107
140
  })
108
141
 
109
142
  if (requestId !== previewRenderRequestId) {
@@ -127,12 +160,23 @@ async function beginEditing() {
127
160
  return
128
161
  }
129
162
 
163
+ guardModeSwitchFocus()
130
164
  editing.value = true
131
- await nextTick()
132
- editorRef.value?.getMonacoEditor?.()?.focus?.()
165
+ await focusEditorAfterMount()
166
+ }
167
+
168
+ function switchToPreview() {
169
+ if (!hasValue.value) {
170
+ return
171
+ }
172
+
173
+ guardModeSwitchFocus()
174
+ editing.value = false
175
+ void renderPreview()
133
176
  }
134
177
 
135
178
  function closeEditor() {
179
+ clearModeSwitchFocusGuard()
136
180
  clearPendingFocusOutCheck()
137
181
  editing.value = false
138
182
  emit('close')
@@ -171,6 +215,50 @@ function clearPendingFocusOutCheck() {
171
215
  }
172
216
  }
173
217
 
218
+ function clearModeSwitchFocusGuard() {
219
+ if (modeSwitchFocusGuardTimer) {
220
+ clearTimeout(modeSwitchFocusGuardTimer)
221
+ modeSwitchFocusGuardTimer = null
222
+ }
223
+ modeSwitchFocusGuardActive = false
224
+ }
225
+
226
+ function guardModeSwitchFocus() {
227
+ clearModeSwitchFocusGuard()
228
+ modeSwitchFocusGuardActive = true
229
+ modeSwitchFocusGuardTimer = setTimeout(() => {
230
+ modeSwitchFocusGuardTimer = null
231
+ modeSwitchFocusGuardActive = false
232
+ }, 80)
233
+ }
234
+
235
+ function focusCurrentEditor(): boolean {
236
+ const editor = editorRef.value?.getMonacoEditor?.()
237
+ if (!editor?.focus) {
238
+ pendingEditorFocus = true
239
+ return false
240
+ }
241
+
242
+ pendingEditorFocus = false
243
+ editor.focus()
244
+ return true
245
+ }
246
+
247
+ async function focusEditorAfterMount() {
248
+ await nextTick()
249
+ focusCurrentEditor()
250
+ }
251
+
252
+ function handleEditorReady(editor: { monaco?: NoteMonacoEditor }) {
253
+ if (editor.monaco) {
254
+ noteAutoHeight.attachEditor(editor.monaco)
255
+ }
256
+
257
+ if (pendingEditorFocus) {
258
+ focusCurrentEditor()
259
+ }
260
+ }
261
+
174
262
  function handleFocusIn() {
175
263
  clearPendingFocusOutCheck()
176
264
  }
@@ -182,6 +270,10 @@ function emitBlurIfLeavingField(event: FocusEvent) {
182
270
  return
183
271
  }
184
272
 
273
+ if (modeSwitchFocusGuardActive) {
274
+ return
275
+ }
276
+
185
277
  clearPendingFocusOutCheck()
186
278
  focusOutCheckTimer = setTimeout(() => {
187
279
  focusOutCheckTimer = null
@@ -205,6 +297,7 @@ watch(() => props.modelValue, (value) => {
205
297
  }
206
298
 
207
299
  draftValue.value = nextValue
300
+ noteAutoHeight.syncEstimatedEditorHeight(nextValue)
208
301
  })
209
302
 
210
303
  watch(
@@ -220,8 +313,16 @@ watch(() => props.disabled, () => {
220
313
  syncEditingState()
221
314
  })
222
315
 
316
+ watch(showEditor, (visible) => {
317
+ if (visible && !props.disabled) {
318
+ void focusEditorAfterMount()
319
+ }
320
+ }, { immediate: true })
321
+
223
322
  onBeforeUnmount(() => {
224
323
  clearPendingFocusOutCheck()
324
+ clearModeSwitchFocusGuard()
325
+ noteAutoHeight.dispose()
225
326
  })
226
327
  </script>
227
328
 
@@ -229,6 +330,7 @@ onBeforeUnmount(() => {
229
330
  <div
230
331
  ref="fieldRootRef"
231
332
  class="aimd-markdown-note-field"
333
+ :style="noteFieldStyle"
232
334
  :class="{
233
335
  'aimd-markdown-note-field--disabled': disabled,
234
336
  'aimd-markdown-note-field--preview': showPreview,
@@ -240,13 +342,23 @@ onBeforeUnmount(() => {
240
342
  >
241
343
  <div v-if="showPreview" class="aimd-markdown-note-field__preview-shell">
242
344
  <div v-if="!disabled" class="aimd-markdown-note-field__preview-actions">
243
- <button
244
- type="button"
245
- class="aimd-markdown-note-field__preview-edit"
246
- @click="beginEditing"
247
- >
248
- {{ editLabel }}
249
- </button>
345
+ <span class="aimd-markdown-note-field__view-switch" role="group" :aria-label="viewSwitchLabel">
346
+ <button
347
+ type="button"
348
+ class="aimd-markdown-note-field__view-btn aimd-markdown-note-field__view-btn--active"
349
+ aria-pressed="true"
350
+ >
351
+ {{ previewLabel }}
352
+ </button>
353
+ <button
354
+ type="button"
355
+ class="aimd-markdown-note-field__view-btn aimd-markdown-note-field__view-btn--source"
356
+ aria-pressed="false"
357
+ @click="beginEditing"
358
+ >
359
+ {{ sourceLabel }}
360
+ </button>
361
+ </span>
250
362
  </div>
251
363
  <div
252
364
  class="aimd-markdown-note-field__preview"
@@ -266,6 +378,24 @@ onBeforeUnmount(() => {
266
378
 
267
379
  <div v-else-if="showEditor" class="aimd-markdown-note-field__editor-shell">
268
380
  <div class="aimd-markdown-note-field__editor-actions">
381
+ <span class="aimd-markdown-note-field__view-switch" role="group" :aria-label="viewSwitchLabel">
382
+ <button
383
+ type="button"
384
+ class="aimd-markdown-note-field__view-btn aimd-markdown-note-field__view-btn--preview"
385
+ :disabled="!hasValue"
386
+ aria-pressed="false"
387
+ @click="switchToPreview"
388
+ >
389
+ {{ previewLabel }}
390
+ </button>
391
+ <button
392
+ type="button"
393
+ class="aimd-markdown-note-field__view-btn aimd-markdown-note-field__view-btn--active"
394
+ aria-pressed="true"
395
+ >
396
+ {{ sourceLabel }}
397
+ </button>
398
+ </span>
269
399
  <button
270
400
  type="button"
271
401
  class="aimd-markdown-note-field__editor-close"
@@ -287,10 +417,11 @@ onBeforeUnmount(() => {
287
417
  :show-aimd-toolbar="true"
288
418
  :enable-block-handle="!disabled"
289
419
  :keep-inactive-editors-mounted="false"
290
- :min-height="minHeight"
420
+ :min-height="noteEditorHeight"
291
421
  :readonly="disabled"
292
- :monaco-options="{ minimap: { enabled: false } }"
422
+ :monaco-options="noteMonacoOptions"
293
423
  @update:model-value="emitDraftValue"
424
+ @ready="handleEditorReady"
294
425
  />
295
426
  </div>
296
427
 
@@ -322,38 +453,62 @@ onBeforeUnmount(() => {
322
453
 
323
454
  .aimd-markdown-note-field__preview-actions {
324
455
  display: flex;
456
+ align-items: center;
325
457
  justify-content: flex-end;
458
+ gap: 8px;
459
+ padding: 8px 8px 0;
460
+ }
461
+
462
+ .aimd-markdown-note-field__editor-shell {
463
+ min-width: 0;
464
+ }
465
+
466
+ .aimd-markdown-note-field__editor-actions {
467
+ display: flex;
468
+ align-items: center;
469
+ justify-content: space-between;
470
+ gap: 8px;
326
471
  padding: 8px 8px 0;
472
+ background: #fff;
327
473
  }
328
474
 
329
- .aimd-markdown-note-field__preview-edit {
475
+ .aimd-markdown-note-field__view-switch {
476
+ display: inline-flex;
477
+ min-height: 26px;
478
+ align-items: center;
479
+ overflow: hidden;
330
480
  border: 1px solid #d1d9e6;
331
481
  border-radius: 999px;
332
- min-height: 26px;
482
+ background: #f8fbff;
483
+ }
484
+
485
+ .aimd-markdown-note-field__view-btn {
486
+ min-height: 24px;
333
487
  padding: 0 10px;
334
- background: #fff;
335
- color: #475569;
488
+ border: 0 none;
489
+ border-radius: 999px;
490
+ background: transparent;
491
+ color: #64748b;
336
492
  font-size: 12px;
337
493
  font-weight: 600;
338
494
  cursor: pointer;
339
- transition: border-color 0.2s, background-color 0.2s, color 0.2s;
340
495
  }
341
496
 
342
- .aimd-markdown-note-field__preview-edit:hover {
343
- border-color: #9db1cc;
344
- background: #f7faff;
345
- color: #1f4f8f;
497
+ .aimd-markdown-note-field__view-btn:hover:not(:disabled):not(.aimd-markdown-note-field__view-btn--active) {
498
+ background: #eef5ff;
499
+ color: #334155;
346
500
  }
347
501
 
348
- .aimd-markdown-note-field__editor-shell {
349
- min-width: 0;
502
+ .aimd-markdown-note-field__view-btn--active {
503
+ background: #ffffff;
504
+ color: #1f4f8f;
505
+ box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
506
+ cursor: default;
350
507
  }
351
508
 
352
- .aimd-markdown-note-field__editor-actions {
353
- display: flex;
354
- justify-content: flex-end;
355
- padding: 8px 8px 0;
356
- background: #fff;
509
+ .aimd-markdown-note-field__view-btn:disabled {
510
+ cursor: not-allowed;
511
+ opacity: 0.48;
357
512
  }
358
513
 
359
514
  .aimd-markdown-note-field__editor-close {
@@ -403,6 +558,54 @@ onBeforeUnmount(() => {
403
558
  color: inherit;
404
559
  }
405
560
 
561
+ .aimd-markdown-note-field__preview :deep(.aimd-code-block) {
562
+ max-width: 100%;
563
+ overflow: hidden;
564
+ margin: 0.8em 0;
565
+ padding: 0;
566
+ border: 1px solid #d8e1ee;
567
+ border-radius: 8px;
568
+ background: #f8fafc;
569
+ color: #0f172a;
570
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
571
+ font-size: 13px;
572
+ line-height: 1.58;
573
+ white-space: normal;
574
+ }
575
+
576
+ .aimd-markdown-note-field__preview :deep(.aimd-code-block__code) {
577
+ display: block;
578
+ padding: 10px 0;
579
+ border-radius: 0;
580
+ background: transparent;
581
+ }
582
+
583
+ .aimd-markdown-note-field__preview :deep(.aimd-code-block__line) {
584
+ display: grid;
585
+ grid-template-columns: max-content minmax(0, 1fr);
586
+ column-gap: 12px;
587
+ padding-right: 12px;
588
+ }
589
+
590
+ .aimd-markdown-note-field__preview :deep(.aimd-code-block__line-number) {
591
+ min-width: 3ch;
592
+ padding-left: 12px;
593
+ color: #94a3b8;
594
+ text-align: right;
595
+ user-select: none;
596
+ }
597
+
598
+ .aimd-markdown-note-field__preview :deep(.aimd-code-block__line-code) {
599
+ min-width: 0;
600
+ white-space: pre-wrap;
601
+ overflow-wrap: anywhere;
602
+ }
603
+
604
+ .aimd-markdown-note-field__preview :deep(.aimd-code-block--wrap .aimd-code-block__line-code) {
605
+ padding-left: var(--aimd-code-wrap-indent, 0ch);
606
+ text-indent: calc(-1 * var(--aimd-code-wrap-indent, 0ch));
607
+ }
608
+
406
609
  .aimd-markdown-note-field__empty {
407
610
  padding: 12px 14px;
408
611
  color: #94a3b8;
@@ -423,12 +626,20 @@ onBeforeUnmount(() => {
423
626
 
424
627
  .aimd-markdown-note-field :deep(.aimd-editor-panel) {
425
628
  min-width: 0;
629
+ min-height: var(--aimd-markdown-note-editor-height) !important;
426
630
  }
427
631
 
428
632
  .aimd-markdown-note-field :deep(.aimd-editor-source-mode) {
633
+ height: var(--aimd-markdown-note-editor-height) !important;
634
+ min-height: var(--aimd-markdown-note-editor-height);
429
635
  background: #fff;
430
636
  }
431
637
 
638
+ .aimd-markdown-note-field :deep(.aimd-editor-container) {
639
+ height: var(--aimd-markdown-note-editor-height);
640
+ min-height: var(--aimd-markdown-note-editor-height);
641
+ }
642
+
432
643
  .aimd-markdown-note-field :deep(.aimd-editor-wysiwyg-mode) {
433
644
  height: auto !important;
434
645
  overflow-y: visible !important;
@@ -0,0 +1,121 @@
1
+ <script setup lang="ts">
2
+ import type { AimdQuizFollowupField } from "@airalogy/aimd-core/types"
3
+
4
+ type FollowupPrimitive = string | number | boolean
5
+ type FollowupInputScope = "true_false" | "single" | "multiple"
6
+
7
+ const props = defineProps<{
8
+ quizId: string
9
+ optionKey: string
10
+ inputScope: FollowupInputScope
11
+ followups: AimdQuizFollowupField[]
12
+ values: Record<string, FollowupPrimitive>
13
+ readonly?: boolean
14
+ focusKeyPrefix?: string
15
+ }>()
16
+
17
+ const emit = defineEmits<{
18
+ (e: "update", followup: AimdQuizFollowupField, value: string | boolean): void
19
+ }>()
20
+
21
+ function getFollowupLabel(followup: AimdQuizFollowupField): string {
22
+ return followup.title || followup.key
23
+ }
24
+
25
+ function getFollowupTextValue(followup: AimdQuizFollowupField): string {
26
+ const value = props.values[followup.key]
27
+ if (typeof value === "string" || typeof value === "number") {
28
+ return String(value)
29
+ }
30
+ return ""
31
+ }
32
+
33
+ function getFollowupBooleanValue(followup: AimdQuizFollowupField): boolean {
34
+ return props.values[followup.key] === true
35
+ }
36
+ </script>
37
+
38
+ <template>
39
+ <div class="aimd-quiz-recorder__followups">
40
+ <label
41
+ v-for="followup in followups"
42
+ :key="`${quizId}-${inputScope}-${optionKey}-followup-${followup.key}`"
43
+ class="aimd-quiz-recorder__followup"
44
+ >
45
+ <span class="aimd-quiz-recorder__followup-label">{{ getFollowupLabel(followup) }}</span>
46
+ <input
47
+ v-if="followup.type === 'bool'"
48
+ type="checkbox"
49
+ class="aimd-quiz-recorder__followup-checkbox"
50
+ :data-rec-focus-key="`${focusKeyPrefix || `quiz:${quizId}`}:${inputScope}:${optionKey}:followup:${followup.key}`"
51
+ :checked="getFollowupBooleanValue(followup)"
52
+ :disabled="readonly"
53
+ @change="emit('update', followup, ($event.target as HTMLInputElement).checked)"
54
+ />
55
+ <input
56
+ v-else
57
+ :type="followup.type === 'str' ? 'text' : 'number'"
58
+ :step="followup.type === 'int' ? '1' : undefined"
59
+ class="aimd-quiz-recorder__followup-input"
60
+ :data-rec-focus-key="`${focusKeyPrefix || `quiz:${quizId}`}:${inputScope}:${optionKey}:followup:${followup.key}`"
61
+ :value="getFollowupTextValue(followup)"
62
+ :readonly="readonly"
63
+ @input="emit('update', followup, ($event.target as HTMLInputElement).value)"
64
+ />
65
+ <span v-if="followup.unit" class="aimd-quiz-recorder__followup-unit">{{ followup.unit }}</span>
66
+ </label>
67
+ </div>
68
+ </template>
69
+
70
+ <style scoped>
71
+ .aimd-quiz-recorder__followups {
72
+ display: flex;
73
+ flex-direction: column;
74
+ gap: 6px;
75
+ margin-left: 22px;
76
+ padding: 8px 10px;
77
+ border-left: 2px solid #dbeafe;
78
+ background: #f8fbff;
79
+ }
80
+
81
+ .aimd-quiz-recorder__followup {
82
+ display: grid;
83
+ grid-template-columns: minmax(92px, max-content) minmax(120px, 1fr) auto;
84
+ gap: 6px;
85
+ align-items: center;
86
+ font-size: 13px;
87
+ }
88
+
89
+ .aimd-quiz-recorder__followup-label {
90
+ color: #344054;
91
+ font-weight: 500;
92
+ }
93
+
94
+ .aimd-quiz-recorder__followup-input {
95
+ min-width: 0;
96
+ width: 100%;
97
+ border: 1px solid #d0d7de;
98
+ border-radius: 6px;
99
+ padding: 6px 8px;
100
+ font-size: 14px;
101
+ line-height: 1.4;
102
+ outline: none;
103
+ transition: border-color 0.2s, box-shadow 0.2s;
104
+ }
105
+
106
+ .aimd-quiz-recorder__followup-input:focus {
107
+ border-color: #4181fd;
108
+ box-shadow: 0 0 0 2px rgba(65, 129, 253, 0.1);
109
+ }
110
+
111
+ .aimd-quiz-recorder__followup-checkbox {
112
+ justify-self: start;
113
+ width: 16px;
114
+ height: 16px;
115
+ accent-color: #4181fd;
116
+ }
117
+
118
+ .aimd-quiz-recorder__followup-unit {
119
+ color: #667085;
120
+ }
121
+ </style>