@airalogy/aimd-recorder 1.18.0 → 1.19.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 (81) hide show
  1. package/README.md +44 -0
  2. package/README.zh-CN.md +44 -0
  3. package/dist/{AimdDnaSequenceField-KZU2Zj3E.js → AimdDnaSequenceField-TBKunqU_.js} +1 -1
  4. package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-CzfYPp5r.js → AimdEditor.vue_vue_type_style_index_0_lang-tdh0dJNa.js} +1 -1
  5. package/dist/{AimdMarkdownField-t2d8uOeU.js → AimdMarkdownField-DmNX2g4j.js} +19 -19
  6. package/dist/{AimdMarkdownNoteField-_h1oZSwH.js → AimdMarkdownNoteField-B5ruzmwS.js} +19 -19
  7. package/dist/aimd-recorder.css +1 -1
  8. package/dist/{arc-DS_ocYoe.js → arc-B-vsgEXF.js} +1 -1
  9. package/dist/{architectureDiagram-3BPJPVTR-Dq2W8_tb.js → architectureDiagram-3BPJPVTR-BwPNOtNH.js} +2 -2
  10. package/dist/{blockDiagram-GPEHLZMM-B4hnSAF_.js → blockDiagram-GPEHLZMM-CMUI4kKc.js} +4 -4
  11. package/dist/{c4Diagram-AAUBKEIU-CbffqNLY.js → c4Diagram-AAUBKEIU-Cpmfsy_s.js} +2 -2
  12. package/dist/{channel-CtXnYrAk.js → channel-DlMAXHQK.js} +1 -1
  13. package/dist/{chunk-2J33WTMH-CROScrt5.js → chunk-2J33WTMH-DP9BS2ux.js} +1 -1
  14. package/dist/{chunk-4BX2VUAB-DTmsQu5_.js → chunk-4BX2VUAB-ncsOeLMb.js} +1 -1
  15. package/dist/{chunk-55IACEB6-B5wDJzeX.js → chunk-55IACEB6-C7wHk4B7.js} +1 -1
  16. package/dist/{chunk-727SXJPM-CfyltY6o.js → chunk-727SXJPM-Caa5aVUO.js} +5 -5
  17. package/dist/{chunk-AQP2D5EJ-B8274EYy.js → chunk-AQP2D5EJ-CL8egKqD.js} +3 -3
  18. package/dist/{chunk-FMBD7UC4-CT_FK-SH.js → chunk-FMBD7UC4-heVR6BSA.js} +1 -1
  19. package/dist/{chunk-ND2GUHAM-g9GulPi-.js → chunk-ND2GUHAM-BYH-wC2J.js} +1 -1
  20. package/dist/{chunk-QZHKN3VN-Di5HEktz.js → chunk-QZHKN3VN-Bx2K7vkq.js} +1 -1
  21. package/dist/{classDiagram-v2-Q7XG4LA2-BVUr246k.js → classDiagram-4FO5ZUOK-BLLfLYy0.js} +2 -2
  22. package/dist/{classDiagram-4FO5ZUOK-BVUr246k.js → classDiagram-v2-Q7XG4LA2-BLLfLYy0.js} +2 -2
  23. package/dist/components.js +2821 -2320
  24. package/dist/composables.js +95 -93
  25. package/dist/{cose-bilkent-S5V4N54A-GJ4IOO6v.js → cose-bilkent-S5V4N54A-E1YmM_xr.js} +1 -1
  26. package/dist/{dagre-BM42HDAG-oL7Br44o.js → dagre-BM42HDAG-BsXpQirH.js} +3 -3
  27. package/dist/{diagram-2AECGRRQ-DtoCG_N4.js → diagram-2AECGRRQ-CamqbWlY.js} +2 -2
  28. package/dist/{diagram-5GNKFQAL-f8QNdS7L.js → diagram-5GNKFQAL-DZyRFcOC.js} +3 -3
  29. package/dist/{diagram-KO2AKTUF-CsJOW_AX.js → diagram-KO2AKTUF-CmkGcy7R.js} +2 -2
  30. package/dist/{diagram-LMA3HP47-xmEKNZ7y.js → diagram-LMA3HP47-IdDwQPZ-.js} +2 -2
  31. package/dist/{diagram-OG6HWLK6-unpC7vo8.js → diagram-OG6HWLK6-t0LBcUIU.js} +3 -3
  32. package/dist/{erDiagram-TEJ5UH35-BGzFnCJD.js → erDiagram-TEJ5UH35-DJBY2iZG.js} +4 -4
  33. package/dist/{flowDiagram-I6XJVG4X-LBFhDnOs.js → flowDiagram-I6XJVG4X-DE4MzPPk.js} +6 -6
  34. package/dist/{ganttDiagram-6RSMTGT7-CFBc-jPD.js → ganttDiagram-6RSMTGT7-CmAc35Yw.js} +2 -2
  35. package/dist/{gitGraphDiagram-PVQCEYII-BLduh-Rb.js → gitGraphDiagram-PVQCEYII-DDQZ5flw.js} +3 -3
  36. package/dist/{graph-DdlKE625.js → graph-BsJ8-1Pq.js} +1 -1
  37. package/dist/index.js +112 -109
  38. package/dist/{infoDiagram-5YYISTIA-CLQQI6zM.js → infoDiagram-5YYISTIA-DSZjFR5g.js} +1 -1
  39. package/dist/{ishikawaDiagram-YF4QCWOH-CStdYBmW.js → ishikawaDiagram-YF4QCWOH-DCO9dx2L.js} +1 -1
  40. package/dist/{journeyDiagram-JHISSGLW-B6mRTzoE.js → journeyDiagram-JHISSGLW-b-PpuBqg.js} +4 -4
  41. package/dist/{kanban-definition-UN3LZRKU-C-vnN5v4.js → kanban-definition-UN3LZRKU-BjclDuJZ.js} +2 -2
  42. package/dist/{layout-DDt0fz-M.js → layout-D4wqKu72.js} +2 -2
  43. package/dist/{linear-C-IAFdOt.js → linear-Voc3BJib.js} +1 -1
  44. package/dist/{mermaid.core-CuZ3nINf.js → mermaid.core-Dt_VbeGP.js} +34 -34
  45. package/dist/{mindmap-definition-RKZ34NQL-TSZ1Vb3z.js → mindmap-definition-RKZ34NQL-B3vrXRVY.js} +3 -3
  46. package/dist/{pieDiagram-4H26LBE5-DYok-1-k.js → pieDiagram-4H26LBE5-DFpWxSxk.js} +3 -3
  47. package/dist/{quadrantDiagram-W4KKPZXB-Cg856sbH.js → quadrantDiagram-W4KKPZXB-BYHcrGoB.js} +2 -2
  48. package/dist/record.js +1199 -0
  49. package/dist/{requirementDiagram-4Y6WPE33-BN9fGdlJ.js → requirementDiagram-4Y6WPE33-C-FgWrRz.js} +3 -3
  50. package/dist/{sankeyDiagram-5OEKKPKP-CDqTgonY.js → sankeyDiagram-5OEKKPKP-IwN0Evji.js} +1 -1
  51. package/dist/{sequenceDiagram-3UESZ5HK-Chjrc0-W.js → sequenceDiagram-3UESZ5HK-_OnqhBO2.js} +3 -3
  52. package/dist/{stateDiagram-AJRCARHV-DRyLHrdr.js → stateDiagram-AJRCARHV-BRLv0Zcw.js} +4 -4
  53. package/dist/{stateDiagram-v2-BHNVJYJU-CZTIDHid.js → stateDiagram-v2-BHNVJYJU-BofX0AdS.js} +2 -2
  54. package/dist/{timeline-definition-PNZ67QCA-Bc3D9AAG.js → timeline-definition-PNZ67QCA-C-DpPLpw.js} +2 -2
  55. package/dist/{useCodeBlockRendering-qA6gj4vz.js → useCodeBlockRendering-DoTZaJTW.js} +2170 -3148
  56. package/dist/{vennDiagram-CIIHVFJN-CYAul48m.js → vennDiagram-CIIHVFJN-zTHQR9Oq.js} +1 -1
  57. package/dist/{wardleyDiagram-YWT4CUSO-B7Tg0MG9.js → wardleyDiagram-YWT4CUSO-au5koizO.js} +2 -2
  58. package/dist/{xychartDiagram-2RQKCTM6-xWYVEqth.js → xychartDiagram-2RQKCTM6-BNf12P8z.js} +2 -2
  59. package/package.json +7 -3
  60. package/src/__tests__/assigner-graph.test.ts +82 -0
  61. package/src/__tests__/recorder-assigner-control.test.ts +150 -1
  62. package/src/__tests__/recorder-editor.test.ts +34 -1
  63. package/src/__tests__/recorder-wysiwyg-field-host.test.ts +3 -0
  64. package/src/__tests__/var-field-render.test.ts +87 -0
  65. package/src/components/AimdAssignerGraph.vue +816 -0
  66. package/src/components/AimdMarkdownField.vue +8 -0
  67. package/src/components/AimdRecorder.vue +137 -42
  68. package/src/components/AimdRecorderEditor.vue +116 -10
  69. package/src/components/AimdRecorderWysiwygFieldHost.vue +4 -0
  70. package/src/components/AimdRecorderWysiwygSurface.vue +19 -1
  71. package/src/components/AimdVarTableField.vue +42 -28
  72. package/src/components/index.ts +9 -1
  73. package/src/components/recorderMilkdownPlugin.ts +7 -1
  74. package/src/composables/__tests__/useVarHelpers.test.ts +42 -0
  75. package/src/composables/index.ts +1 -0
  76. package/src/composables/useVarHelpers.ts +87 -250
  77. package/src/index.ts +7 -1
  78. package/src/record/index.ts +120 -0
  79. package/src/styles/aimd.css +230 -3
  80. package/src/type-utils.ts +1 -3
  81. package/src/types.ts +37 -0
@@ -12,12 +12,13 @@ import {
12
12
  useEditorContent,
13
13
  } from '@airalogy/aimd-editor/vue'
14
14
  import type { AimdVarTypePresetOption } from '@airalogy/aimd-editor/vue'
15
- import type { ExtractedAimdFields } from '@airalogy/aimd-core/types'
15
+ import type { AimdQuizGradeResult, ExtractedAimdFields } from '@airalogy/aimd-core/types'
16
16
  import type { AimdComponentRenderer } from '@airalogy/aimd-renderer'
17
17
  import type { AimdRecorderMessagesInput } from '../locales'
18
18
  import type {
19
19
  AimdAssignerMap,
20
20
  AimdAssignerRunner,
21
+ AimdChoiceOptionExplanationMode,
21
22
  AimdServerAssignerMap,
22
23
  AimdServerAssignerRunner,
23
24
  AimdFileInfoResolver,
@@ -26,6 +27,7 @@ import type {
26
27
  AimdFieldState,
27
28
  AimdProtocolRecordData,
28
29
  AimdRecorderFieldAdapters,
30
+ AimdScaleGradeDisplayMode,
29
31
  AimdStepDetailDisplay,
30
32
  AimdTypePlugin,
31
33
  FieldEventPayload,
@@ -57,6 +59,10 @@ const props = withDefaults(defineProps<{
57
59
  currentUserName?: string
58
60
  now?: Date | string | number
59
61
  messages?: AimdRecorderMessagesInput
62
+ quizGrades?: Record<string, AimdQuizGradeResult | null | undefined>
63
+ submitted?: boolean
64
+ choiceOptionExplanationMode?: AimdChoiceOptionExplanationMode
65
+ scaleGradeDisplayMode?: AimdScaleGradeDisplayMode
60
66
  stepDetailDisplay?: AimdStepDetailDisplay
61
67
  fieldMeta?: Record<string, AimdFieldMeta>
62
68
  serverAssigners?: AimdServerAssignerMap
@@ -82,6 +88,10 @@ const props = withDefaults(defineProps<{
82
88
  currentUserName: undefined,
83
89
  now: undefined,
84
90
  messages: undefined,
91
+ quizGrades: undefined,
92
+ submitted: false,
93
+ choiceOptionExplanationMode: 'hidden',
94
+ scaleGradeDisplayMode: 'hidden',
85
95
  stepDetailDisplay: 'auto',
86
96
  fieldMeta: undefined,
87
97
  serverAssigners: undefined,
@@ -184,6 +194,10 @@ const surfaceState = reactive<RecorderMilkdownSurfaceState>({
184
194
  now: props.now,
185
195
  locale: props.locale,
186
196
  messages: props.messages,
197
+ quizGrades: props.quizGrades,
198
+ submitted: props.submitted,
199
+ choiceOptionExplanationMode: props.choiceOptionExplanationMode,
200
+ scaleGradeDisplayMode: props.scaleGradeDisplayMode,
187
201
  stepDetailDisplay: props.stepDetailDisplay,
188
202
  fieldMeta: props.fieldMeta,
189
203
  serverAssigners: props.serverAssigners,
@@ -214,6 +228,10 @@ watchEffect(() => {
214
228
  surfaceState.now = props.now
215
229
  surfaceState.locale = props.locale
216
230
  surfaceState.messages = props.messages
231
+ surfaceState.quizGrades = props.quizGrades
232
+ surfaceState.submitted = props.submitted
233
+ surfaceState.choiceOptionExplanationMode = props.choiceOptionExplanationMode
234
+ surfaceState.scaleGradeDisplayMode = props.scaleGradeDisplayMode
217
235
  surfaceState.stepDetailDisplay = props.stepDetailDisplay
218
236
  surfaceState.fieldMeta = props.fieldMeta
219
237
  surfaceState.serverAssigners = props.serverAssigners
@@ -33,6 +33,12 @@ function renderTrashIcon(): VNode {
33
33
  ])
34
34
  }
35
35
 
36
+ function renderRowNumber(rowIndex: number): VNode {
37
+ return h("span", {
38
+ class: "aimd-rec-inline-table__row-number",
39
+ }, String(rowIndex + 1))
40
+ }
41
+
36
42
  function estimateDisplayWidth(value: unknown): number {
37
43
  const text = String(value ?? "")
38
44
  let width = 0
@@ -193,7 +199,7 @@ export default defineComponent({
193
199
  function estimateTableWidthPx(columns: string[], rows: Record<string, string>[], getDisplayLabel: (column: string) => string): number {
194
200
  const CHARACTER_PX = 8.2
195
201
  const CELL_HORIZONTAL_PADDING_PX = 24
196
- const dragColumnPx = 44
202
+ const dragColumnPx = 58
197
203
  const actionColumnPx = 64
198
204
 
199
205
  const contentColumnsPx = columns.reduce((total, column) => {
@@ -440,19 +446,22 @@ export default defineComponent({
440
446
  onDrop: (event: DragEvent) => emit("drag-drop", { tableName, rowIndex, columns, event }),
441
447
  }, [
442
448
  h("div", { class: "aimd-rec-card__toolbar" }, [
443
- h("span", {
444
- class: [
445
- "aimd-rec-inline-table__drag-handle",
446
- props.readonly ? "aimd-rec-inline-table__drag-handle--disabled" : "",
447
- ],
448
- title: props.readonly ? messages.table.dragDisabled : messages.table.dragReorder,
449
- draggable: !props.readonly,
450
- onDragstart: (event: DragEvent) => emit("drag-start", { tableName, rowIndex, event }),
451
- onDragend: () => emit("drag-end"),
452
- }, Array.from({ length: 6 }, (_, dotIndex) => h("span", {
453
- key: `${rowKey}-card-drag-dot-${dotIndex}`,
454
- class: "aimd-rec-inline-table__drag-dot",
455
- }))),
449
+ h("span", { class: "aimd-rec-card__row-meta" }, [
450
+ renderRowNumber(rowIndex),
451
+ h("span", {
452
+ class: [
453
+ "aimd-rec-inline-table__drag-handle",
454
+ props.readonly ? "aimd-rec-inline-table__drag-handle--disabled" : "",
455
+ ],
456
+ title: props.readonly ? messages.table.dragDisabled : messages.table.dragReorder,
457
+ draggable: !props.readonly,
458
+ onDragstart: (event: DragEvent) => emit("drag-start", { tableName, rowIndex, event }),
459
+ onDragend: () => emit("drag-end"),
460
+ }, Array.from({ length: 6 }, (_, dotIndex) => h("span", {
461
+ key: `${rowKey}-card-drag-dot-${dotIndex}`,
462
+ class: "aimd-rec-inline-table__drag-dot",
463
+ }))),
464
+ ]),
456
465
  h("button", {
457
466
  type: "button",
458
467
  class: "aimd-rec-inline-table__icon-btn aimd-rec-inline-table__icon-btn--visible",
@@ -576,7 +585,9 @@ export default defineComponent({
576
585
  ]),
577
586
  h("thead", [
578
587
  h("tr", [
579
- h("th", { class: "aimd-rec-inline-table__drag-head" }, ""),
588
+ h("th", { class: "aimd-rec-inline-table__drag-head" }, [
589
+ h("span", { class: "aimd-rec-inline-table__row-head-label" }, "#"),
590
+ ]),
580
591
  ...columns.map(column => h("th", {
581
592
  class: [
582
593
  "aimd-rec-inline-table__column-head",
@@ -604,19 +615,22 @@ export default defineComponent({
604
615
  onDrop: (event: DragEvent) => emit("drag-drop", { tableName, rowIndex, columns, event }),
605
616
  }, [
606
617
  h("td", { class: "aimd-rec-inline-table__drag-cell" }, [
607
- h("span", {
608
- class: [
609
- "aimd-rec-inline-table__drag-handle",
610
- props.readonly ? "aimd-rec-inline-table__drag-handle--disabled" : "",
611
- ],
612
- title: props.readonly ? messages.table.dragDisabled : messages.table.dragReorder,
613
- draggable: !props.readonly,
614
- onDragstart: (event: DragEvent) => emit("drag-start", { tableName, rowIndex, event }),
615
- onDragend: () => emit("drag-end"),
616
- }, Array.from({ length: 6 }, (_, dotIndex) => h("span", {
617
- key: `${rowKey}-drag-dot-${dotIndex}`,
618
- class: "aimd-rec-inline-table__drag-dot",
619
- }))),
618
+ h("span", { class: "aimd-rec-inline-table__row-control" }, [
619
+ renderRowNumber(rowIndex),
620
+ h("span", {
621
+ class: [
622
+ "aimd-rec-inline-table__drag-handle",
623
+ props.readonly ? "aimd-rec-inline-table__drag-handle--disabled" : "",
624
+ ],
625
+ title: props.readonly ? messages.table.dragDisabled : messages.table.dragReorder,
626
+ draggable: !props.readonly,
627
+ onDragstart: (event: DragEvent) => emit("drag-start", { tableName, rowIndex, event }),
628
+ onDragend: () => emit("drag-end"),
629
+ }, Array.from({ length: 6 }, (_, dotIndex) => h("span", {
630
+ key: `${rowKey}-drag-dot-${dotIndex}`,
631
+ class: "aimd-rec-inline-table__drag-dot",
632
+ }))),
633
+ ]),
620
634
  ]),
621
635
  ...columns.map(column => h("td", {
622
636
  key: `${tableName}-${rowIndex}-${column}`,
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  import { defineAsyncComponent } from "vue"
9
+ import AimdAssignerGraph from "./AimdAssignerGraph.vue"
9
10
  import AimdRecorder from "./AimdRecorder.vue"
10
11
  import AimdRecorderEditor from "./AimdRecorderEditor.vue"
11
12
  import AimdQuizRecorder from "./AimdQuizRecorder.vue"
@@ -13,7 +14,14 @@ import AimdQuizRecorder from "./AimdQuizRecorder.vue"
13
14
  const AimdDnaSequenceField = defineAsyncComponent(() => import("./AimdDnaSequenceField.vue"))
14
15
  const AimdMarkdownField = defineAsyncComponent(() => import("./AimdMarkdownField.vue"))
15
16
 
16
- export { AimdRecorder, AimdRecorderEditor, AimdQuizRecorder, AimdDnaSequenceField, AimdMarkdownField }
17
+ export {
18
+ AimdAssignerGraph,
19
+ AimdRecorder,
20
+ AimdRecorderEditor,
21
+ AimdQuizRecorder,
22
+ AimdDnaSequenceField,
23
+ AimdMarkdownField,
24
+ }
17
25
 
18
26
  /**
19
27
  * @deprecated Use `AimdRecorder` instead.
@@ -7,7 +7,7 @@ import type { EditorView, NodeView } from '@milkdown/kit/prose/view'
7
7
  import { NodeSelection } from '@milkdown/kit/prose/state'
8
8
  import { hardbreakAttr, hardbreakSchema } from '@milkdown/kit/preset/commonmark'
9
9
  import { $node, $prose, $remark, $view } from '@milkdown/kit/utils'
10
- import type { ExtractedAimdFields } from '@airalogy/aimd-core/types'
10
+ import type { AimdQuizGradeResult, ExtractedAimdFields } from '@airalogy/aimd-core/types'
11
11
  import {
12
12
  aimdFieldInputRule,
13
13
  aimdFieldNode,
@@ -18,6 +18,7 @@ import type { AimdRecorderMessagesInput } from '../locales'
18
18
  import type {
19
19
  AimdAssignerMap,
20
20
  AimdAssignerRunner,
21
+ AimdChoiceOptionExplanationMode,
21
22
  AimdServerAssignerMap,
22
23
  AimdServerAssignerRunner,
23
24
  AimdFileInfoResolver,
@@ -26,6 +27,7 @@ import type {
26
27
  AimdFieldState,
27
28
  AimdProtocolRecordData,
28
29
  AimdRecorderFieldAdapters,
30
+ AimdScaleGradeDisplayMode,
29
31
  AimdStepDetailDisplay,
30
32
  AimdTypePlugin,
31
33
  FieldEventPayload,
@@ -48,6 +50,10 @@ export interface RecorderMilkdownSurfaceState {
48
50
  now?: Date | string | number
49
51
  locale?: string
50
52
  messages?: AimdRecorderMessagesInput
53
+ quizGrades?: Record<string, AimdQuizGradeResult | null | undefined>
54
+ submitted: boolean
55
+ choiceOptionExplanationMode: AimdChoiceOptionExplanationMode
56
+ scaleGradeDisplayMode: AimdScaleGradeDisplayMode
51
57
  stepDetailDisplay: AimdStepDetailDisplay
52
58
  fieldMeta?: Record<string, AimdFieldMeta>
53
59
  serverAssigners?: AimdServerAssignerMap
@@ -3,6 +3,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest'
3
3
  import {
4
4
  normalizeVarTypeName,
5
5
  getVarInputKind,
6
+ isStructuredVarType,
6
7
  unwrapStructuredValue,
7
8
  toBooleanValue,
8
9
  toDateValue,
@@ -100,6 +101,14 @@ describe('getVarInputKind', () => {
100
101
  expect(getVarInputKind('airalogymarkdown')).toBe('textarea')
101
102
  })
102
103
 
104
+ it('returns "textarea" for structured list and object types', () => {
105
+ expect(getVarInputKind('list')).toBe('textarea')
106
+ expect(getVarInputKind('list[str]')).toBe('textarea')
107
+ expect(getVarInputKind('dict[str, int]')).toBe('textarea')
108
+ expect(getVarInputKind('json')).toBe('textarea')
109
+ expect(getVarInputKind('Listener')).toBe('text')
110
+ })
111
+
103
112
  it('returns "code" for built-in CodeStr aliases', () => {
104
113
  expect(getVarInputKind('PyStr')).toBe('code')
105
114
  expect(getVarInputKind('JsStr')).toBe('code')
@@ -143,6 +152,16 @@ describe('file-like var helpers', () => {
143
152
  accept: '.png,image/png',
144
153
  badge: 'IMG',
145
154
  })
155
+ expect(getFileInputConfig('FileIdMOV')).toMatchObject({
156
+ kind: 'video',
157
+ accept: '.mov,video/quicktime',
158
+ badge: 'VID',
159
+ })
160
+ expect(getFileInputConfig('FileIdWAV')).toMatchObject({
161
+ kind: 'audio',
162
+ accept: '.wav,audio/wav',
163
+ badge: 'AUD',
164
+ })
146
165
  expect(getFileInputConfig('str', undefined, { inputType: 'image' })).toMatchObject({
147
166
  kind: 'image',
148
167
  accept: 'image/*',
@@ -430,6 +449,11 @@ describe('getVarInputDisplayValue', () => {
430
449
  it('stringifies non-string for dna kind', () => {
431
450
  expect(getVarInputDisplayValue({ seq: 'ATCG' }, 'dna')).toBe(JSON.stringify({ seq: 'ATCG' }))
432
451
  })
452
+
453
+ it('pretty-prints structured list and object values', () => {
454
+ expect(getVarInputDisplayValue(['a', 'b'], 'textarea', { type: 'list[str]' })).toBe(JSON.stringify(['a', 'b'], null, 2))
455
+ expect(getVarInputDisplayValue({ a: 1 }, 'textarea', { type: 'dict[str, int]' })).toBe(JSON.stringify({ a: 1 }, null, 2))
456
+ })
433
457
  })
434
458
 
435
459
  // ---------------------------------------------------------------------------
@@ -461,6 +485,24 @@ describe('parseVarInputValue', () => {
461
485
  const result = parseVarInputValue('2024-06-15T10:30', undefined, 'datetime')
462
486
  expect(typeof result).toBe('string')
463
487
  })
488
+
489
+ it('parses JSON input for structured list types', () => {
490
+ expect(parseVarInputValue('["a", "b"]', 'list[str]', 'textarea')).toEqual(['a', 'b'])
491
+ expect(parseVarInputValue('not json', 'list[str]', 'textarea')).toBe('not json')
492
+ })
493
+ })
494
+
495
+ // ---------------------------------------------------------------------------
496
+ // isStructuredVarType
497
+ // ---------------------------------------------------------------------------
498
+
499
+ describe('isStructuredVarType', () => {
500
+ it('detects explicit structured types without matching unrelated names', () => {
501
+ expect(isStructuredVarType('list[str]')).toBe(true)
502
+ expect(isStructuredVarType('dict[str, int]')).toBe(true)
503
+ expect(isStructuredVarType('object')).toBe(true)
504
+ expect(isStructuredVarType('Listener')).toBe(false)
505
+ })
464
506
  })
465
507
 
466
508
  // ---------------------------------------------------------------------------
@@ -44,6 +44,7 @@ export {
44
44
  export {
45
45
  normalizeVarTypeName,
46
46
  getVarInputKind,
47
+ isStructuredVarType,
47
48
  unwrapStructuredValue,
48
49
  toBooleanValue,
49
50
  toDateValue,