@airalogy/aimd-recorder 1.20.0 → 1.22.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 (80) hide show
  1. package/README.md +5 -0
  2. package/README.zh-CN.md +5 -0
  3. package/dist/{AimdCodeField-BQUuM-EF.js → AimdCodeField-BN_0UQMx.js} +34 -32
  4. package/dist/{AimdDnaSequenceField-Cp0cgBYl.js → AimdDnaSequenceField-Bhj28fP8.js} +1 -1
  5. package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-DTdcoNs1.js → AimdEditor.vue_vue_type_style_index_0_lang-D7c01UqN.js} +1040 -976
  6. package/dist/{AimdMarkdownField-D4AEz_mB.js → AimdMarkdownField-GS15pv4z.js} +4 -4
  7. package/dist/{AimdMarkdownNoteField-CSGaShKi.js → AimdMarkdownNoteField-H9WP8tR6.js} +15 -15
  8. package/dist/aimd-recorder.css +1 -1
  9. package/dist/{arc-jL17V0L2.js → arc-B50G9-kH.js} +1 -1
  10. package/dist/{architectureDiagram-3BPJPVTR-CijadmFI.js → architectureDiagram-3BPJPVTR-D9mBEbpY.js} +2 -2
  11. package/dist/{blockDiagram-GPEHLZMM-BPqvb85_.js → blockDiagram-GPEHLZMM-Cs4swgto.js} +4 -4
  12. package/dist/{c4Diagram-AAUBKEIU-i4fqlMXu.js → c4Diagram-AAUBKEIU-C12HKS3r.js} +2 -2
  13. package/dist/{channel-DnnUQTdl.js → channel-D69VnjVz.js} +1 -1
  14. package/dist/{chunk-2J33WTMH-DKKEpdr1.js → chunk-2J33WTMH-oc-89G5c.js} +1 -1
  15. package/dist/{chunk-4BX2VUAB-WvuuiYYH.js → chunk-4BX2VUAB-BDJS9G3r.js} +1 -1
  16. package/dist/{chunk-55IACEB6-B_UkHTnd.js → chunk-55IACEB6-BPl3uHcA.js} +1 -1
  17. package/dist/{chunk-727SXJPM-CR6Pb04P.js → chunk-727SXJPM-pWe-vDGf.js} +5 -5
  18. package/dist/{chunk-AQP2D5EJ-B68Ie417.js → chunk-AQP2D5EJ-D-R5sIr1.js} +3 -3
  19. package/dist/{chunk-FMBD7UC4-CeCGT6rb.js → chunk-FMBD7UC4-bo6Qyom1.js} +1 -1
  20. package/dist/{chunk-ND2GUHAM-BYN-eC_q.js → chunk-ND2GUHAM-DQMvtYV7.js} +1 -1
  21. package/dist/{chunk-QZHKN3VN-BNSp120j.js → chunk-QZHKN3VN-DlCn3HON.js} +1 -1
  22. package/dist/{classDiagram-v2-Q7XG4LA2-Cgbn4w3f.js → classDiagram-4FO5ZUOK-DzUwWFwr.js} +2 -2
  23. package/dist/{classDiagram-4FO5ZUOK-Cgbn4w3f.js → classDiagram-v2-Q7XG4LA2-DzUwWFwr.js} +2 -2
  24. package/dist/components.js +3757 -2910
  25. package/dist/composables.js +84 -80
  26. package/dist/{cose-bilkent-S5V4N54A-TfrsQ2c3.js → cose-bilkent-S5V4N54A-BXLMzfpO.js} +1 -1
  27. package/dist/{dagre-BM42HDAG-BAyvB_JI.js → dagre-BM42HDAG-DHnofIh9.js} +3 -3
  28. package/dist/{diagram-2AECGRRQ-Bijq8bHO.js → diagram-2AECGRRQ-BqTTVPsm.js} +2 -2
  29. package/dist/{diagram-5GNKFQAL-B3ZuTuxm.js → diagram-5GNKFQAL-D5p1UVbw.js} +3 -3
  30. package/dist/{diagram-KO2AKTUF-DrqLeGCI.js → diagram-KO2AKTUF-Uuoz9cFn.js} +2 -2
  31. package/dist/{diagram-LMA3HP47-CCSQH8O0.js → diagram-LMA3HP47-W001U31X.js} +2 -2
  32. package/dist/{diagram-OG6HWLK6-DM5cUEjW.js → diagram-OG6HWLK6-DL516LDr.js} +3 -3
  33. package/dist/{erDiagram-TEJ5UH35-DQhmDdAF.js → erDiagram-TEJ5UH35-CCxgMb67.js} +4 -4
  34. package/dist/{flowDiagram-I6XJVG4X-DrqiPSHI.js → flowDiagram-I6XJVG4X-nXGdmC0O.js} +6 -6
  35. package/dist/{ganttDiagram-6RSMTGT7-DpX_Y2vA.js → ganttDiagram-6RSMTGT7-Bi9Ro7_Z.js} +2 -2
  36. package/dist/{gitGraphDiagram-PVQCEYII-3isOhIyZ.js → gitGraphDiagram-PVQCEYII-w1kNAy4E.js} +3 -3
  37. package/dist/{graph-C30SJlSk.js → graph-CpOkL_eZ.js} +1 -1
  38. package/dist/{index-Dtvv88SS.js → index-Dkrf2LJl.js} +51 -51
  39. package/dist/index.js +62 -58
  40. package/dist/{infoDiagram-5YYISTIA-Cr_MlPvz.js → infoDiagram-5YYISTIA-Bde_w9T1.js} +1 -1
  41. package/dist/{ishikawaDiagram-YF4QCWOH-DydyFn3h.js → ishikawaDiagram-YF4QCWOH-x5M1KR0l.js} +1 -1
  42. package/dist/{journeyDiagram-JHISSGLW-V_5MmeOu.js → journeyDiagram-JHISSGLW-CIDQP8Zm.js} +4 -4
  43. package/dist/{kanban-definition-UN3LZRKU-C_XXCuvp.js → kanban-definition-UN3LZRKU-CKgO7sG8.js} +2 -2
  44. package/dist/{layout-85j-z7Lr.js → layout-BZYprqYR.js} +2 -2
  45. package/dist/{linear-DMtodz-6.js → linear-ClSH2F_v.js} +1 -1
  46. package/dist/{mermaid.core-CkanUCyS.js → mermaid.core-CcRV6K2R.js} +34 -34
  47. package/dist/{mindmap-definition-RKZ34NQL-CyikmuF2.js → mindmap-definition-RKZ34NQL-s3h6uszV.js} +3 -3
  48. package/dist/{pieDiagram-4H26LBE5-CesqzEGg.js → pieDiagram-4H26LBE5-CgiazyWv.js} +3 -3
  49. package/dist/{quadrantDiagram-W4KKPZXB-BsPKPfNd.js → quadrantDiagram-W4KKPZXB-DCPVgHoW.js} +2 -2
  50. package/dist/record.js +19 -19
  51. package/dist/{requirementDiagram-4Y6WPE33-BwB1tQvi.js → requirementDiagram-4Y6WPE33-DE6F9oSB.js} +3 -3
  52. package/dist/{sankeyDiagram-5OEKKPKP-CfSNbWMY.js → sankeyDiagram-5OEKKPKP-DZZoFFr-.js} +1 -1
  53. package/dist/{sequenceDiagram-3UESZ5HK-DZZlUNys.js → sequenceDiagram-3UESZ5HK-DaYEOl60.js} +3 -3
  54. package/dist/{stateDiagram-AJRCARHV-DNJmz_op.js → stateDiagram-AJRCARHV-BmgpHJlH.js} +4 -4
  55. package/dist/{stateDiagram-v2-BHNVJYJU-DVfDNM6l.js → stateDiagram-v2-BHNVJYJU-D49CHQD6.js} +2 -2
  56. package/dist/{timeline-definition-PNZ67QCA-DEUCAg_N.js → timeline-definition-PNZ67QCA-DdVLoCkC.js} +2 -2
  57. package/dist/{useCodeBlockRendering-DF6zm7nf.js → useCodeBlockRendering-CCuoP52e.js} +1241 -1074
  58. package/dist/{vennDiagram-CIIHVFJN-DVDP__od.js → vennDiagram-CIIHVFJN-CCcMKcd7.js} +1 -1
  59. package/dist/{wardleyDiagram-YWT4CUSO-sEtxBd33.js → wardleyDiagram-YWT4CUSO-R4UGgGWY.js} +2 -2
  60. package/dist/{xychartDiagram-2RQKCTM6-DM8QeR5M.js → xychartDiagram-2RQKCTM6-DyFhCubk.js} +2 -2
  61. package/package.json +3 -3
  62. package/src/__tests__/record-search-render.test.ts +108 -0
  63. package/src/__tests__/recorder-assigner-control.test.ts +4 -1
  64. package/src/__tests__/var-field-render.test.ts +556 -43
  65. package/src/components/AimdCodeField.vue +11 -3
  66. package/src/components/AimdQuizRecorder.vue +3 -1
  67. package/src/components/AimdRecorder.vue +52 -1882
  68. package/src/components/AimdRecorderSearchToolbar.vue +258 -0
  69. package/src/components/AimdVarField.vue +589 -17
  70. package/src/components/AimdVarTableField.vue +12 -6
  71. package/src/components/index.ts +1 -0
  72. package/src/composables/__tests__/useVarHelpers.test.ts +214 -7
  73. package/src/composables/index.ts +6 -0
  74. package/src/composables/useFieldRendering.ts +28 -0
  75. package/src/composables/useRecordSearch.ts +299 -0
  76. package/src/composables/useVarHelpers.ts +285 -14
  77. package/src/locales.ts +96 -0
  78. package/src/styles/recorder-surface.css +2374 -0
  79. package/src/styles/recorder.css +1 -0
  80. package/src/types.ts +1 -1
@@ -12,6 +12,16 @@ import AimdVarField from '../components/AimdVarField.vue'
12
12
  import AimdVarTableField from '../components/AimdVarTableField.vue'
13
13
  import { createAimdRecorderMessages } from '../locales'
14
14
 
15
+ vi.mock('../components/AimdCodeField.vue', () => ({
16
+ __esModule: true,
17
+ default: {
18
+ name: 'AimdCodeField',
19
+ props: ['modelValue', 'language', 'disabled', 'compact'],
20
+ emits: ['update:modelValue', 'blur'],
21
+ template: '<textarea class="aimd-code-field-stub" :value="modelValue" :disabled="disabled" @input="$emit(\'update:modelValue\', $event.target.value)" @blur="$emit(\'blur\')" />',
22
+ },
23
+ }))
24
+
15
25
  const __filename = fileURLToPath(import.meta.url)
16
26
  const __dirname = dirname(__filename)
17
27
  const source = readFileSync(resolve(__dirname, '../components/AimdVarField.vue'), 'utf8')
@@ -22,6 +32,7 @@ const recorderSource = readFileSync(resolve(__dirname, '../components/AimdRecord
22
32
  const markdownNoteSource = readFileSync(resolve(__dirname, '../components/AimdMarkdownNoteField.vue'), 'utf8')
23
33
  const varHelpersSource = readFileSync(resolve(__dirname, '../composables/useVarHelpers.ts'), 'utf8')
24
34
  const recorderStyles = readFileSync(resolve(__dirname, '../styles/recorder.css'), 'utf8')
35
+ const recorderSurfaceStyles = readFileSync(resolve(__dirname, '../styles/recorder-surface.css'), 'utf8')
25
36
  const rendererStyles = readFileSync(resolve(__dirname, '../../../aimd-renderer/src/styles/renderer.css'), 'utf8')
26
37
 
27
38
  describe('AimdVarField render behavior', () => {
@@ -49,12 +60,16 @@ describe('AimdVarField render behavior', () => {
49
60
  expect(source).toMatch(/if \(inputKind === "code"\)/)
50
61
  expect(source).toMatch(/language: codeLanguage/)
51
62
  expect(source).toMatch(/"aimd-rec-inline--var-stacked--code"/)
63
+ expect(source).toMatch(/language: "json"/)
52
64
  })
53
65
 
54
- it('starts CodeStr and PyStr editors at a compact content-driven height', () => {
66
+ it('starts code editors at a content-driven height and supports compact density', () => {
55
67
  expect(codeFieldSource).toContain('createMonacoAutoHeight')
56
68
  expect(codeFieldSource).toMatch(/const editorHeight = codeAutoHeight\.editorHeight/)
57
69
  expect(codeFieldSource).toMatch(/codeAutoHeight\.attachEditor\(monacoEditor\)/)
70
+ expect(codeFieldSource).toContain('compact?: boolean')
71
+ expect(codeFieldSource).toContain("verticalPadding: props.compact ? 12 : 24")
72
+ expect(codeFieldSource).toContain("padding: props.compact ? { top: 6, bottom: 6 } : { top: 12, bottom: 12 }")
58
73
  expect(codeFieldSource).toContain('--aimd-code-field-editor-height')
59
74
  expect(codeFieldSource).not.toContain('min-height: 240px;')
60
75
  })
@@ -64,6 +79,7 @@ describe('AimdVarField render behavior', () => {
64
79
  expect(recorderSource).toContain('class="aimd-protocol-recorder__content aimd-renderer"')
65
80
  expect(markdownFieldSource).toContain('class="aimd-markdown-field__preview aimd-renderer"')
66
81
  expect(markdownNoteSource).toContain('class="aimd-markdown-note-field__preview aimd-renderer"')
82
+ expect(recorderStyles).toContain('@import "./recorder-surface.css";')
67
83
  expect(recorderStyles).toContain('.aimd-field--editable')
68
84
  expect(recorderStyles).toContain('.aimd-field--no-style')
69
85
  expect(recorderStyles).toContain('.aimd-field-wrapper--inline')
@@ -103,15 +119,15 @@ describe('AimdVarField render behavior', () => {
103
119
  })
104
120
 
105
121
  it('renders editable table cell values without inherited italic preview styling', () => {
106
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-table-cell-input\) \{[\s\S]*?font-style: normal;/)
122
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-table-cell-input \{[\s\S]*?font-style: normal;/)
107
123
  })
108
124
 
109
125
  it('keeps card-style table rows compact in dense recorder layouts', () => {
110
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-card-list\) \{[\s\S]*?gap: 8px;/)
111
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-card\) \{[\s\S]*?padding: 7px 10px 9px;/)
112
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-card__field\) \{[\s\S]*?padding-top: 6px;[\s\S]*?margin-top: 6px;/)
113
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-card__input\) \{[\s\S]*?height: 30px;/)
114
- expect(recorderSource).toContain('.aimd-rec-card .aimd-rec-inline-table__drag-handle')
126
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-card-list \{[\s\S]*?gap: 8px;/)
127
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-card \{[\s\S]*?padding: 7px 10px 9px;/)
128
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-card__field \{[\s\S]*?padding-top: 6px;[\s\S]*?margin-top: 6px;/)
129
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-card__input \{[\s\S]*?height: 30px;/)
130
+ expect(recorderSurfaceStyles).toContain('.aimd-rec-card .aimd-rec-inline-table__drag-handle')
115
131
  })
116
132
 
117
133
  it('shows visible row numbers for table and card var_table layouts', () => {
@@ -119,57 +135,67 @@ describe('AimdVarField render behavior', () => {
119
135
  expect(varTableSource).toContain('aimd-rec-inline-table__row-control')
120
136
  expect(varTableSource).toContain('aimd-rec-card__row-meta')
121
137
  expect(varTableSource).toContain('aimd-rec-inline-table__row-head-label')
122
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline-table__row-number\) \{[\s\S]*?font-variant-numeric: tabular-nums;/)
123
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline-table__row-number\) \{[\s\S]*?background: transparent;[\s\S]*?font-style: normal;/)
138
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-inline-table__row-number \{[\s\S]*?font-variant-numeric: tabular-nums;/)
139
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-inline-table__row-number \{[\s\S]*?background: transparent;[\s\S]*?font-style: normal;/)
124
140
  })
125
141
 
126
142
  it('clips plain stacked var controls so rounded corners render cleanly', () => {
127
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline--var-stacked\) \{[\s\S]*?overflow: hidden;/)
128
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline--var-stacked:has\(\.aimd-field__metadata-host\)\) \{[\s\S]*?overflow: visible;/)
129
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline--has-assigner-control\) \{[\s\S]*?overflow: hidden;/)
143
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-inline--var-stacked \{[\s\S]*?overflow: hidden;/)
144
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-inline--var-stacked:has\(\.aimd-field__metadata-host\) \{[\s\S]*?overflow: visible;/)
145
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-inline--has-assigner-control \{[\s\S]*?overflow: hidden;/)
130
146
  })
131
147
 
132
148
  it('lets stacked var fields widen before wrapping long metadata keys', () => {
133
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline--var-stacked\) \{[\s\S]*?width: max-content;/)
134
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline--var-stacked \.aimd-field--no-style\.aimd-field__label\) \{[\s\S]*?flex-wrap: nowrap;/)
135
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline--var-stacked \.aimd-field__scope\) \{[\s\S]*?flex: 0 0 auto;[\s\S]*?white-space: nowrap;/)
136
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline--var-stacked \.aimd-field__name\) \{[\s\S]*?flex: 0 0 auto;[\s\S]*?min-width: max-content;/)
137
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline--var-stacked \.aimd-field__key\) \{[\s\S]*?overflow: visible;[\s\S]*?white-space: nowrap;/)
149
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-inline--var-stacked \{[\s\S]*?width: max-content;/)
150
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-inline--var-stacked \.aimd-field--no-style\.aimd-field__label \{[\s\S]*?flex-wrap: nowrap;/)
151
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-inline--var-stacked \.aimd-field__scope \{[\s\S]*?flex: 0 0 auto;[\s\S]*?white-space: nowrap;/)
152
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-inline--var-stacked \.aimd-field__name \{[\s\S]*?flex: 0 0 auto;[\s\S]*?min-width: max-content;/)
153
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-inline--var-stacked \.aimd-field__key \{[\s\S]*?overflow: visible;[\s\S]*?white-space: nowrap;/)
154
+ })
155
+
156
+ it('keeps complex markdown tables scrollable without expanding the recorder', () => {
157
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content table:not\(\.aimd-rec-inline-table__table\):not\(\.aimd-scale__table\) \{[\s\S]*?display: block;[\s\S]*?max-width: 100%;[\s\S]*?overflow-x: auto;/)
158
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content table:not\(\.aimd-rec-inline-table__table\):not\(\.aimd-scale__table\) th:first-child,[\s\S]*?\.aimd-protocol-recorder__content table:not\(\.aimd-rec-inline-table__table\):not\(\.aimd-scale__table\) td:first-child \{[\s\S]*?position: sticky;[\s\S]*?left: 0;/)
159
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content table:not\(\.aimd-rec-inline-table__table\):not\(\.aimd-scale__table\) td:has\(\.aimd-rec-inline--var-stacked\) \{[\s\S]*?min-width: min\(360px, 80vw\);[\s\S]*?max-width: min\(680px, 80vw\);/)
160
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content table:not\(\.aimd-rec-inline-table__table\):not\(\.aimd-scale__table\) \.aimd-rec-inline--var-stacked \{[\s\S]*?width: max-content;[\s\S]*?max-width: min\(680px, 100%\);/)
161
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content table:not\(\.aimd-rec-inline-table__table\):not\(\.aimd-scale__table\) \.aimd-rec-inline--var-stacked \.aimd-field__title,[\s\S]*?\.aimd-protocol-recorder__content table:not\(\.aimd-rec-inline-table__table\):not\(\.aimd-scale__table\) \.aimd-rec-inline--var-stacked \.aimd-field__key \{[\s\S]*?overflow-wrap: break-word;[\s\S]*?white-space: normal;[\s\S]*?word-break: normal;/)
162
+ expect(source).toContain('class: "aimd-field__title", title: displayTitle')
163
+ expect(source).toContain('class: "aimd-field__key", title: id')
138
164
  })
139
165
 
140
166
  it('normalizes stacked var value typography across native control types', () => {
141
- expect(recorderSource).toContain('--rec-body-font-size: 14px;')
142
- expect(recorderSource).toContain('--rec-var-value-font-size: var(--rec-body-font-size);')
143
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content \{[\s\S]*?font-size: var\(--rec-body-font-size\);/)
167
+ expect(recorderSurfaceStyles).toContain('--rec-body-font-size: 14px;')
168
+ expect(recorderSurfaceStyles).toContain('--rec-var-value-font-size: var(--rec-body-font-size);')
169
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \{[\s\S]*?font-size: var\(--rec-body-font-size\);/)
144
170
  expect(source).toContain('aimd-rec-inline__value-control aimd-rec-inline__input aimd-rec-inline__input--stacked')
145
171
  expect(source).toContain('aimd-rec-inline__value-control aimd-rec-inline__textarea aimd-rec-inline__textarea--stacked')
146
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline--var-stacked \.aimd-rec-inline__value-control\) \{[\s\S]*?font: inherit;[\s\S]*?font-size: var\(--rec-var-value-font-size\);/)
147
- expect(recorderSource).toContain('.aimd-rec-inline__value-control::-webkit-datetime-edit')
172
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-inline--var-stacked \.aimd-rec-inline__value-control \{[\s\S]*?font: inherit;[\s\S]*?font-size: var\(--rec-var-value-font-size\);/)
173
+ expect(recorderSurfaceStyles).toContain('.aimd-rec-inline__value-control::-webkit-datetime-edit')
148
174
  })
149
175
 
150
176
  it('uses wrapped line-numbered code blocks in recorder markdown output', () => {
151
177
  expect(recorderSource).toContain('useCodeBlockRendering')
152
178
  expect(recorderSource).toMatch(/elementRenderers:\s*\{\s*pre: codeBlockPreRenderer/)
153
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-code-block\) \{[\s\S]*?overflow: hidden;/)
154
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-code-block__line\) \{[\s\S]*?grid-template-columns: max-content minmax\(0, 1fr\);/)
155
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-code-block__line-code\) \{[\s\S]*?white-space: pre-wrap;[\s\S]*?overflow-wrap: anywhere;/)
156
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-code-block--wrap \.aimd-code-block__line-code\) \{[\s\S]*?text-indent: calc\(-1 \* var\(--aimd-code-wrap-indent, 0ch\)\);/)
179
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-code-block \{[\s\S]*?overflow: hidden;/)
180
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-code-block__line \{[\s\S]*?grid-template-columns: max-content minmax\(0, 1fr\);/)
181
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-code-block__line-code \{[\s\S]*?white-space: pre-wrap;[\s\S]*?overflow-wrap: anywhere;/)
182
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-code-block--wrap \.aimd-code-block__line-code \{[\s\S]*?text-indent: calc\(-1 \* var\(--aimd-code-wrap-indent, 0ch\)\);/)
157
183
  })
158
184
 
159
185
  it('lets block recorder fields fill the available panel width', () => {
160
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline--var-markdown\) \{[\s\S]*?width: 100%;[\s\S]*?box-sizing: border-box;/)
161
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline--step\) \{[\s\S]*?width: 100%;[\s\S]*?box-sizing: border-box;/)
162
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline--check\) \{[\s\S]*?width: 100%;/)
163
- expect(recorderSource).not.toContain('width: min(100%, 1040px);')
186
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-inline--var-markdown \{[\s\S]*?width: 100%;[\s\S]*?box-sizing: border-box;/)
187
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-inline--step \{[\s\S]*?width: 100%;[\s\S]*?box-sizing: border-box;/)
188
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-inline--check \{[\s\S]*?width: 100%;/)
189
+ expect(recorderSurfaceStyles).not.toContain('width: min(100%, 1040px);')
164
190
  })
165
191
 
166
192
  it('keeps step body content inside the step card width', () => {
167
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-step-field__body\) \{[\s\S]*?width: 100%;[\s\S]*?max-width: 100%;[\s\S]*?overflow-wrap: anywhere;/)
168
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-step-field__body \.aimd-step-body\) \{[\s\S]*?width: 100%;[\s\S]*?min-width: 0;[\s\S]*?max-width: 100%;/)
169
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-step-field__body \.aimd-step-body > \*\) \{[\s\S]*?min-width: 0;[\s\S]*?max-width: 100%;[\s\S]*?overflow-wrap: anywhere;/)
170
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-step-field__body \.aimd-rec-inline--var-markdown\),\n\.aimd-protocol-recorder__content :deep\(\.aimd-step-field__body \.aimd-field--var-table\) \{[\s\S]*?width: 100%;[\s\S]*?max-width: 100%;/)
171
- expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-step-field__body \.aimd-field--var-table\) \{[\s\S]*?overflow-x: auto;/)
172
- expect(recorderSource).not.toContain('line-height: 1.72;')
193
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-step-field__body \{[\s\S]*?width: 100%;[\s\S]*?max-width: 100%;[\s\S]*?overflow-wrap: anywhere;/)
194
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-step-field__body \.aimd-step-body \{[\s\S]*?width: 100%;[\s\S]*?min-width: 0;[\s\S]*?max-width: 100%;/)
195
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-step-field__body \.aimd-step-body > \* \{[\s\S]*?min-width: 0;[\s\S]*?max-width: 100%;[\s\S]*?overflow-wrap: anywhere;/)
196
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-step-field__body \.aimd-rec-inline--var-markdown,[\s\S]*?\.aimd-protocol-recorder__content \.aimd-step-field__body \.aimd-field--var-table \{[\s\S]*?width: 100%;[\s\S]*?max-width: 100%;/)
197
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-step-field__body \.aimd-field--var-table \{[\s\S]*?overflow-x: auto;/)
198
+ expect(recorderSurfaceStyles).not.toContain('line-height: 1.72;')
173
199
  })
174
200
 
175
201
  it('renders file-like vars with a native file picker control', async () => {
@@ -261,13 +287,385 @@ describe('AimdVarField render behavior', () => {
261
287
  expect(wrapper.find('.aimd-rec-inline__header-assigner-action .assigner-test-button').exists()).toBe(true)
262
288
  expect(wrapper.find('.aimd-rec-inline__header-assigner-state .assigner-test-status').exists()).toBe(true)
263
289
  expect(wrapper.find('.aimd-rec-inline__control-row').exists()).toBe(false)
264
- expect(recorderSource).toContain('.aimd-rec-inline__header-assigner-actions')
290
+ expect(recorderSurfaceStyles).toContain('.aimd-rec-inline__header-assigner-actions')
265
291
  })
266
292
 
267
293
  it('places code assigner actions in the field header instead of a side prefix', () => {
268
- expect(source).toContain('["file", "code"].includes(inputKind)')
294
+ expect(source).toContain('["file", "code", "scalar-list"].includes(inputKind)')
269
295
  expect(source).toMatch(/if \(inputKind === "code"\) \{[\s\S]*?"aimd-rec-inline--var-stacked--code",[\s\S]*?\{ controlRow: false \}/)
270
- expect(recorderSource).toContain('["number", "date", "datetime", "time", "text", "textarea", "checkbox", "file", "code"].includes(inputKind)')
296
+ expect(recorderSource).toContain('["number", "date", "datetime", "time", "text", "textarea", "scalar-list", "checkbox", "boolean-select", "file", "code"].includes(inputKind)')
297
+ })
298
+
299
+ it('renders nullable boolean vars as tri-state select fields', async () => {
300
+ const wrapper = mount(AimdRecorder, {
301
+ props: {
302
+ content: 'Rash: {{var|reaction_rash: bool | None}}',
303
+ locale: 'en-US',
304
+ modelValue: { var: {}, step: {}, check: {}, quiz: {} },
305
+ },
306
+ })
307
+
308
+ await flushPromises()
309
+ await wrapper.vm.$nextTick()
310
+ await vi.dynamicImportSettled()
311
+ await wrapper.vm.$nextTick()
312
+
313
+ const select = wrapper.find<HTMLSelectElement>('select[data-rec-focus-key="var:reaction_rash"]')
314
+ expect(select.exists()).toBe(true)
315
+ expect(select.classes()).toContain('aimd-rec-inline__boolean-select')
316
+ expect(select.findAll('option').map(option => option.text())).toEqual(['Not set', 'True', 'False'])
317
+ expect(select.element.value).toBe('')
318
+
319
+ await select.setValue('true')
320
+ await flushPromises()
321
+
322
+ let updates = wrapper.emitted('update:modelValue') ?? []
323
+ let latest = updates[updates.length - 1]?.[0] as { var?: Record<string, unknown> } | undefined
324
+ expect(latest?.var?.reaction_rash).toBe(true)
325
+
326
+ await select.setValue('')
327
+ await flushPromises()
328
+
329
+ updates = wrapper.emitted('update:modelValue') ?? []
330
+ latest = updates[updates.length - 1]?.[0] as { var?: Record<string, unknown> } | undefined
331
+ expect(latest?.var?.reaction_rash).toBeNull()
332
+ })
333
+
334
+ it('renders scalar-list fields as full-row controls with horizontal items before wrapping', () => {
335
+ expect(source).toContain('{ controlRow: false, headerAction: modeToolbar }')
336
+ expect(source).toContain('context.measureText(line).width')
337
+ expect(source).toContain('syncScalarListTextInputLayout(el)')
338
+ expect(source).toContain('"--aimd-rec-scalar-list-input-width"')
339
+ expect(source).toContain('hasExplicitLineBreak(item)')
340
+ expect(source).toContain('isWideScalarListTextItem(item, itemPlaceholder)')
341
+ expect(source).toMatch(/isNumericScalarList\s*\?\s*h\("input"/)
342
+ expect(source).toContain('h("textarea"')
343
+ expect(source).toContain('syncAutoWrapTextareaHeight(control)')
344
+ expect(source).toContain('props.messages.scalarList.itemIndex(rowIndex + 1)')
345
+ expect(recorderSurfaceStyles).toContain('.aimd-rec-inline__header-extra-action')
346
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-inline--var-stacked--scalar-list \{[\s\S]*?display: flex;[\s\S]*?width: 100%;[\s\S]*?margin: 12px 0;/)
347
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-scalar-list__items \{[\s\S]*?flex-flow: row wrap;[\s\S]*?gap: 5px;/)
348
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-scalar-list__rows \{[\s\S]*?display: contents;/)
349
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-scalar-list__row \{[\s\S]*?display: inline-flex;[\s\S]*?align-items: stretch;[\s\S]*?gap: 0;[\s\S]*?width: fit-content;/)
350
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-scalar-list__row--has-drag\.aimd-rec-scalar-list__row--has-remove \{[\s\S]*?--aimd-rec-scalar-list-control-offset: 68px;/)
351
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-scalar-list__row--multiline \{[\s\S]*?flex: 1 1 100%;[\s\S]*?width: 100%;/)
352
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-scalar-list__input \{[\s\S]*?width: var\(--aimd-rec-scalar-list-input-width, calc\(8em \+ 16px\)\);[\s\S]*?max-width: min\(calc\(42em \+ 16px\), calc\(100% - var\(--aimd-rec-scalar-list-control-offset, 0px\)\)\);/)
353
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-scalar-list__input--text \{[\s\S]*?resize: none;[\s\S]*?overflow: hidden;[\s\S]*?white-space: pre-wrap;[\s\S]*?overflow-wrap: anywhere;/)
354
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-scalar-list__row--multiline \.aimd-rec-scalar-list__input--text \{[\s\S]*?flex: 1 1 auto;[\s\S]*?width: auto;/)
355
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-scalar-list__index \{[\s\S]*?min-width: 22px;[\s\S]*?min-height: 26px;[\s\S]*?font-size: 10px;[\s\S]*?font-variant-numeric: tabular-nums;/)
356
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-scalar-list__drag \{[\s\S]*?width: 20px;[\s\S]*?min-height: 26px;[\s\S]*?font-size: 12px;/)
357
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-scalar-list__remove \{[\s\S]*?width: 26px;[\s\S]*?min-height: 26px;[\s\S]*?font-size: 13px;/)
358
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-scalar-list__row--drop-target-before::before,[\s\S]*?\.aimd-protocol-recorder__content \.aimd-rec-scalar-list__row--drop-target-after::after \{[\s\S]*?animation: aimd-rec-scalar-list-insert-pulse/)
359
+ expect(recorderSurfaceStyles).toContain('@keyframes aimd-rec-scalar-list-insert-pulse')
360
+ expect(recorderSurfaceStyles).toMatch(/\.aimd-protocol-recorder__content \.aimd-rec-scalar-list__mode-button:first-child \{[\s\S]*?border-radius: 5px 0 0 5px;/)
361
+ expect(recorderSurfaceStyles).not.toContain('min-height: 72px;')
362
+ })
363
+
364
+ it('renders explicit multiline list string items as full-row controls', async () => {
365
+ const node: AimdVarNode = {
366
+ type: 'aimd',
367
+ fieldType: 'var',
368
+ scope: 'var',
369
+ id: 'sample_notes',
370
+ raw: '{{var|sample_notes}}',
371
+ definition: {
372
+ id: 'sample_notes',
373
+ type: 'list[str]',
374
+ },
375
+ }
376
+
377
+ const wrapper = mount(AimdVarField, {
378
+ props: {
379
+ node,
380
+ value: ['a\nb\nc'] as any,
381
+ disabled: false,
382
+ extraClasses: [],
383
+ messages: createAimdRecorderMessages('en-US'),
384
+ displayValue: '["a\\nb\\nc"]',
385
+ inputKind: 'scalar-list',
386
+ initialized: true,
387
+ },
388
+ })
389
+
390
+ const row = wrapper.find('.aimd-rec-scalar-list__row')
391
+ expect(row.classes()).toContain('aimd-rec-scalar-list__row--multiline')
392
+ expect(wrapper.find<HTMLTextAreaElement>('.aimd-rec-scalar-list__input').element.value).toBe('a\nb\nc')
393
+ })
394
+
395
+ it('renders long auto-wrapped list string items as full-row controls', async () => {
396
+ const node: AimdVarNode = {
397
+ type: 'aimd',
398
+ fieldType: 'var',
399
+ scope: 'var',
400
+ id: 'sample_notes',
401
+ raw: '{{var|sample_notes}}',
402
+ definition: {
403
+ id: 'sample_notes',
404
+ type: 'list[str]',
405
+ },
406
+ }
407
+ const longText = 'This is a long list item without explicit line breaks. It should occupy the full row once it exceeds the compact scalar-list width.'
408
+
409
+ const wrapper = mount(AimdVarField, {
410
+ props: {
411
+ node,
412
+ value: [longText] as any,
413
+ disabled: false,
414
+ extraClasses: [],
415
+ messages: createAimdRecorderMessages('en-US'),
416
+ displayValue: JSON.stringify([longText]),
417
+ inputKind: 'scalar-list',
418
+ initialized: true,
419
+ },
420
+ })
421
+
422
+ expect(wrapper.find('.aimd-rec-scalar-list__row').classes()).toContain('aimd-rec-scalar-list__row--multiline')
423
+ expect(wrapper.find<HTMLTextAreaElement>('.aimd-rec-scalar-list__input').element.value).toBe(longText)
424
+ })
425
+
426
+ it('renders list[str] vars as repeatable string inputs', async () => {
427
+ const node: AimdVarNode = {
428
+ type: 'aimd',
429
+ fieldType: 'var',
430
+ scope: 'var',
431
+ id: 'sample_tags',
432
+ raw: '{{var|sample_tags}}',
433
+ definition: {
434
+ id: 'sample_tags',
435
+ type: 'list[str]',
436
+ kwargs: {
437
+ title: 'Sample tags',
438
+ },
439
+ },
440
+ }
441
+
442
+ const wrapper = mount(AimdVarField, {
443
+ props: {
444
+ node,
445
+ value: ['alpha'] as any,
446
+ disabled: false,
447
+ extraClasses: [],
448
+ messages: createAimdRecorderMessages('en-US'),
449
+ displayValue: '["alpha"]',
450
+ inputKind: 'scalar-list',
451
+ initialized: true,
452
+ },
453
+ })
454
+
455
+ const getInputs = () => wrapper.findAll<HTMLInputElement>('.aimd-rec-scalar-list__input')
456
+ const getLatestChange = () => {
457
+ const changes = wrapper.emitted('change') ?? []
458
+ return changes[changes.length - 1]?.[0]
459
+ }
460
+ expect(getInputs()).toHaveLength(1)
461
+ expect(getInputs()[0].element.tagName).toBe('TEXTAREA')
462
+ expect(getInputs()[0].element.value).toBe('alpha')
463
+ expect(wrapper.findAll('.aimd-rec-scalar-list__index').map(index => index.text())).toEqual(['1'])
464
+ expect(wrapper.find('.aimd-rec-scalar-list__index').attributes('title')).toBe('Item 1')
465
+ expect(wrapper.find('.aimd-rec-scalar-list__add').text()).toBe('Add item')
466
+
467
+ await wrapper.find('.aimd-rec-scalar-list__add').trigger('click')
468
+ await wrapper.vm.$nextTick()
469
+ expect(getInputs()).toHaveLength(2)
470
+ expect(wrapper.findAll('.aimd-rec-scalar-list__index').map(index => index.text())).toEqual(['1', '2'])
471
+ expect(getLatestChange()).toMatchObject({
472
+ id: 'sample_tags',
473
+ value: ['alpha'],
474
+ type: 'list[str]',
475
+ inputKind: 'scalar-list',
476
+ })
477
+
478
+ await getInputs()[1].setValue('beta')
479
+ await wrapper.vm.$nextTick()
480
+ expect(getLatestChange()).toMatchObject({
481
+ value: ['alpha', 'beta'],
482
+ })
483
+
484
+ const dragButtons = wrapper.findAll('.aimd-rec-scalar-list__drag')
485
+ expect(dragButtons).toHaveLength(2)
486
+ await dragButtons[1].trigger('dragstart', {
487
+ dataTransfer: {
488
+ effectAllowed: '',
489
+ setData: vi.fn(),
490
+ },
491
+ })
492
+ await wrapper.findAll('.aimd-rec-scalar-list__row')[0].trigger('dragover')
493
+ expect(wrapper.findAll('.aimd-rec-scalar-list__row')[0].classes()).toContain('aimd-rec-scalar-list__row--drop-target-before')
494
+ await wrapper.findAll('.aimd-rec-scalar-list__row')[0].trigger('drop')
495
+ await wrapper.vm.$nextTick()
496
+ expect(getLatestChange()).toMatchObject({
497
+ value: ['beta', 'alpha'],
498
+ })
499
+
500
+ await wrapper.findAll('.aimd-rec-scalar-list__remove')[0].trigger('click')
501
+ await wrapper.vm.$nextTick()
502
+ expect(getLatestChange()).toMatchObject({
503
+ value: ['alpha'],
504
+ })
505
+ })
506
+
507
+ it('renders list[int] vars as repeatable number inputs', async () => {
508
+ const node: AimdVarNode = {
509
+ type: 'aimd',
510
+ fieldType: 'var',
511
+ scope: 'var',
512
+ id: 'counts',
513
+ raw: '{{var|counts}}',
514
+ definition: {
515
+ id: 'counts',
516
+ type: 'list[int]',
517
+ kwargs: {
518
+ title: 'Counts',
519
+ },
520
+ },
521
+ }
522
+
523
+ const wrapper = mount(AimdVarField, {
524
+ props: {
525
+ node,
526
+ value: [1] as any,
527
+ disabled: false,
528
+ extraClasses: [],
529
+ messages: createAimdRecorderMessages('en-US'),
530
+ displayValue: '[1]',
531
+ inputKind: 'scalar-list',
532
+ initialized: true,
533
+ },
534
+ })
535
+
536
+ const getInputs = () => wrapper.findAll<HTMLInputElement>('.aimd-rec-scalar-list__input')
537
+ const getLatestChange = () => {
538
+ const changes = wrapper.emitted('change') ?? []
539
+ return changes[changes.length - 1]?.[0]
540
+ }
541
+ expect(getInputs()).toHaveLength(1)
542
+ expect(getInputs()[0].attributes('type')).toBe('number')
543
+ expect(getInputs()[0].attributes('step')).toBe('1')
544
+ expect(getInputs()[0].element.value).toBe('1')
545
+
546
+ await wrapper.find('.aimd-rec-scalar-list__add').trigger('click')
547
+ await wrapper.vm.$nextTick()
548
+ await getInputs()[1].setValue('2')
549
+ await wrapper.vm.$nextTick()
550
+ expect(getLatestChange()).toMatchObject({
551
+ id: 'counts',
552
+ value: [1, 2],
553
+ type: 'list[int]',
554
+ inputKind: 'scalar-list',
555
+ })
556
+ })
557
+
558
+ it('edits scalar-list vars in JSON mode without emitting invalid JSON', async () => {
559
+ const node: AimdVarNode = {
560
+ type: 'aimd',
561
+ fieldType: 'var',
562
+ scope: 'var',
563
+ id: 'sample_tags',
564
+ raw: '{{var|sample_tags}}',
565
+ definition: {
566
+ id: 'sample_tags',
567
+ type: 'list[str]',
568
+ },
569
+ }
570
+
571
+ const wrapper = mount(AimdVarField, {
572
+ props: {
573
+ node,
574
+ value: ['alpha'] as any,
575
+ disabled: false,
576
+ extraClasses: [],
577
+ messages: createAimdRecorderMessages('en-US'),
578
+ displayValue: '["alpha"]',
579
+ inputKind: 'scalar-list',
580
+ initialized: true,
581
+ },
582
+ })
583
+
584
+ const modeButtons = wrapper.findAll('.aimd-rec-scalar-list__mode-button')
585
+ expect(modeButtons.map(button => button.text())).toEqual(['Items', 'JSON'])
586
+ expect(wrapper.find('.aimd-field__label .aimd-rec-scalar-list__toolbar').exists()).toBe(true)
587
+ expect(wrapper.find('.aimd-rec-inline__scalar-list > .aimd-rec-scalar-list__toolbar').exists()).toBe(false)
588
+
589
+ await modeButtons[1].trigger('click')
590
+ await wrapper.vm.$nextTick()
591
+ await vi.dynamicImportSettled()
592
+ await wrapper.vm.$nextTick()
593
+ const jsonEditor = wrapper.findComponent({ name: 'AimdCodeField' })
594
+ expect(jsonEditor.exists()).toBe(true)
595
+ expect(jsonEditor.props('modelValue')).toContain('"alpha"')
596
+ expect(jsonEditor.props('language')).toBe('json')
597
+ expect(jsonEditor.props('compact')).toBe(true)
598
+
599
+ await jsonEditor.vm.$emit('update:modelValue', '["aaa", "bbb"]')
600
+ await wrapper.vm.$nextTick()
601
+ const getLatestChange = () => {
602
+ const changes = wrapper.emitted('change') ?? []
603
+ return changes[changes.length - 1]?.[0]
604
+ }
605
+ expect(getLatestChange()).toMatchObject({
606
+ id: 'sample_tags',
607
+ value: ['aaa', 'bbb'],
608
+ type: 'list[str]',
609
+ inputKind: 'scalar-list',
610
+ })
611
+
612
+ const emittedCount = (wrapper.emitted('change') ?? []).length
613
+ await jsonEditor.vm.$emit('update:modelValue', '{"bad": true}')
614
+ await wrapper.vm.$nextTick()
615
+ expect(wrapper.find('.aimd-rec-scalar-list__json-error').text()).toBe('JSON value must be an array.')
616
+ expect((wrapper.emitted('change') ?? [])).toHaveLength(emittedCount)
617
+
618
+ await modeButtons[0].trigger('click')
619
+ await wrapper.vm.$nextTick()
620
+ expect(wrapper.findAll<HTMLInputElement>('.aimd-rec-scalar-list__input').map(input => input.element.value)).toEqual(['aaa', 'bbb'])
621
+ })
622
+
623
+ it('parses numeric scalar-list JSON according to the item type', async () => {
624
+ const node: AimdVarNode = {
625
+ type: 'aimd',
626
+ fieldType: 'var',
627
+ scope: 'var',
628
+ id: 'counts',
629
+ raw: '{{var|counts}}',
630
+ definition: {
631
+ id: 'counts',
632
+ type: 'list[int]',
633
+ },
634
+ }
635
+
636
+ const wrapper = mount(AimdVarField, {
637
+ props: {
638
+ node,
639
+ value: [] as any,
640
+ disabled: false,
641
+ extraClasses: [],
642
+ messages: createAimdRecorderMessages('en-US'),
643
+ displayValue: '[]',
644
+ inputKind: 'scalar-list',
645
+ initialized: true,
646
+ },
647
+ })
648
+
649
+ await wrapper.findAll('.aimd-rec-scalar-list__mode-button')[1].trigger('click')
650
+ await wrapper.vm.$nextTick()
651
+ await vi.dynamicImportSettled()
652
+ await wrapper.vm.$nextTick()
653
+ const jsonEditor = wrapper.findComponent({ name: 'AimdCodeField' })
654
+ await jsonEditor.vm.$emit('update:modelValue', '[1, 2]')
655
+ await wrapper.vm.$nextTick()
656
+ const getLatestChange = () => {
657
+ const changes = wrapper.emitted('change') ?? []
658
+ return changes[changes.length - 1]?.[0]
659
+ }
660
+ expect(getLatestChange()).toMatchObject({
661
+ value: [1, 2],
662
+ })
663
+
664
+ const emittedCount = (wrapper.emitted('change') ?? []).length
665
+ await jsonEditor.vm.$emit('update:modelValue', '[1.2]')
666
+ await wrapper.vm.$nextTick()
667
+ expect(wrapper.find('.aimd-rec-scalar-list__json-error').text()).toBe('JSON array items do not match this list type.')
668
+ expect((wrapper.emitted('change') ?? [])).toHaveLength(emittedCount)
271
669
  })
272
670
 
273
671
  it('shows file ids as user-facing file cards instead of raw ids', async () => {
@@ -346,7 +744,7 @@ describe('AimdVarField render behavior', () => {
346
744
  expect((wrapper.find('.aimd-rec-inline--var-stacked').element as HTMLElement).style.width).toBe('360px')
347
745
  expect(varHelpersSource).toContain('case "image":')
348
746
  expect(varHelpersSource).toContain('return 360')
349
- expect(recorderSource).toContain('.aimd-rec-inline__file-control[data-file-kind="image"] .aimd-rec-file-field__preview')
747
+ expect(recorderSurfaceStyles).toContain('.aimd-rec-inline__file-control[data-file-kind="image"] .aimd-rec-file-field__preview')
350
748
  })
351
749
 
352
750
  it('uses host-resolved file metadata for file cards', async () => {
@@ -480,7 +878,9 @@ describe('AimdVarField render behavior', () => {
480
878
  })
481
879
 
482
880
  expect(wrapper.find('.aimd-field__title').text()).toBe('Record date')
881
+ expect(wrapper.find('.aimd-field__title').attributes('title')).toBe('Record date')
483
882
  expect(wrapper.find('.aimd-field__key').text()).toBe('record_date')
883
+ expect(wrapper.find('.aimd-field__key').attributes('title')).toBe('record_date')
484
884
  expect(wrapper.find('.aimd-field__description').exists()).toBe(false)
485
885
  expect(wrapper.find('.aimd-field__metadata-popover').text()).toContain('ISO date')
486
886
  expect(wrapper.find('.aimd-field__metadata-examples-label').text()).toBe('e.g.')
@@ -616,7 +1016,7 @@ describe('AimdVarField render behavior', () => {
616
1016
  const select = wrapper.find('select[data-rec-focus-key="var:blood_type"]')
617
1017
  expect(select.exists()).toBe(true)
618
1018
  expect(select.findAll('option').map(option => option.text())).toEqual([
619
- '',
1019
+ 'Not set',
620
1020
  ...enumValues.map(value => String(value)),
621
1021
  ])
622
1022
 
@@ -624,8 +1024,64 @@ describe('AimdVarField render behavior', () => {
624
1024
  await flushPromises()
625
1025
 
626
1026
  const updates = wrapper.emitted('update:modelValue') ?? []
627
- const latest = updates[updates.length - 1]?.[0] as { var?: Record<string, unknown> } | undefined
1027
+ let latest = updates[updates.length - 1]?.[0] as { var?: Record<string, unknown> } | undefined
628
1028
  expect(latest?.var?.blood_type).toBe(enumValues[0])
1029
+
1030
+ const selectedSelect = wrapper.find('select[data-rec-focus-key="var:blood_type"]')
1031
+ expect(selectedSelect.findAll('option').map(option => option.text())).toEqual([
1032
+ 'Not set',
1033
+ ...enumValues.map(value => String(value)),
1034
+ ])
1035
+
1036
+ await selectedSelect.setValue('')
1037
+ await flushPromises()
1038
+
1039
+ const clearUpdates = wrapper.emitted('update:modelValue') ?? []
1040
+ latest = clearUpdates[clearUpdates.length - 1]?.[0] as { var?: Record<string, unknown> } | undefined
1041
+ expect(latest?.var?.blood_type).toBeNull()
1042
+ })
1043
+
1044
+ it('renders scalar list vars as repeatable inputs in AimdRecorder', async () => {
1045
+ const wrapper = mount(AimdRecorder, {
1046
+ props: {
1047
+ content: 'Tags: {{var|sample_tags: list[str], title = "Sample tags"}} Counts: {{var|counts: list[int], title = "Counts"}}',
1048
+ locale: 'en-US',
1049
+ modelValue: { var: {}, step: {}, check: {}, quiz: {} },
1050
+ },
1051
+ })
1052
+
1053
+ await flushPromises()
1054
+ await wrapper.vm.$nextTick()
1055
+ await vi.dynamicImportSettled()
1056
+ await wrapper.vm.$nextTick()
1057
+
1058
+ const getInputs = () => wrapper.findAll<HTMLInputElement>('.aimd-rec-scalar-list__input')
1059
+ expect(getInputs()).toHaveLength(2)
1060
+ expect(getInputs()[0].attributes('data-rec-focus-key')).toBe('var:sample_tags')
1061
+ expect(getInputs()[1].attributes('data-rec-focus-key')).toBe('var:counts')
1062
+ expect(getInputs()[1].attributes('type')).toBe('number')
1063
+
1064
+ expect(getInputs()[0].element.tagName).toBe('TEXTAREA')
1065
+
1066
+ await wrapper.find<HTMLTextAreaElement>('textarea[data-rec-focus-key="var:sample_tags"]').setValue('qc')
1067
+ await flushPromises()
1068
+
1069
+ await wrapper.findAll('.aimd-rec-scalar-list__add')[0].trigger('click')
1070
+ await wrapper.vm.$nextTick()
1071
+ await wrapper.find<HTMLTextAreaElement>('textarea[data-rec-focus-key="var:sample_tags:1"]').setValue('rna')
1072
+ await flushPromises()
1073
+
1074
+ await wrapper.find<HTMLInputElement>('input[data-rec-focus-key="var:counts"]').setValue('1')
1075
+ await flushPromises()
1076
+ await wrapper.findAll('.aimd-rec-scalar-list__add')[1].trigger('click')
1077
+ await wrapper.vm.$nextTick()
1078
+ await wrapper.find<HTMLInputElement>('input[data-rec-focus-key="var:counts:1"]').setValue('2')
1079
+ await flushPromises()
1080
+
1081
+ const updates = wrapper.emitted('update:modelValue') ?? []
1082
+ const latest = updates[updates.length - 1]?.[0] as { var?: Record<string, unknown> } | undefined
1083
+ expect(latest?.var?.sample_tags).toEqual(['qc', 'rna'])
1084
+ expect(latest?.var?.counts).toEqual([1, 2])
629
1085
  })
630
1086
 
631
1087
  it('renders AIMD var_table and column metadata', () => {
@@ -789,7 +1245,7 @@ describe('AimdVarField render behavior', () => {
789
1245
  expect(wrapper.find('.aimd-rec-inline-table__header-action .assigner-test-button').exists()).toBe(true)
790
1246
  expect(wrapper.find('.aimd-rec-inline-table__header-state .assigner-test-status').exists()).toBe(true)
791
1247
  expect(wrapper.find('.aimd-rec-inline-table__assigner-error').text()).toBe('Missing source data')
792
- expect(recorderSource).toContain('.aimd-rec-inline-table__header-actions')
1248
+ expect(recorderSurfaceStyles).toContain('.aimd-rec-inline-table__header-actions')
793
1249
  })
794
1250
 
795
1251
  it('does not use AIMD var_table titles as cell placeholders and honors explicit column placeholders', () => {
@@ -924,4 +1380,61 @@ describe('AimdVarField render behavior', () => {
924
1380
  value: 'include',
925
1381
  })
926
1382
  })
1383
+
1384
+ it('keeps nullable var_table enum cells clearable to null', async () => {
1385
+ vi.stubGlobal('ResizeObserver', class {
1386
+ observe() {}
1387
+ unobserve() {}
1388
+ disconnect() {}
1389
+ })
1390
+ vi.stubGlobal('requestAnimationFrame', (callback: FrameRequestCallback) => {
1391
+ callback(0)
1392
+ return 1
1393
+ })
1394
+ vi.stubGlobal('cancelAnimationFrame', () => {})
1395
+
1396
+ const node: AimdVarTableNode = {
1397
+ type: 'aimd',
1398
+ fieldType: 'var_table',
1399
+ scope: 'var_table',
1400
+ id: 'screening',
1401
+ raw: '{{var_table|screening}}',
1402
+ columns: ['decision'],
1403
+ definition: {
1404
+ id: 'screening',
1405
+ subvars: {
1406
+ decision: {
1407
+ id: 'decision',
1408
+ type: 'Literal["include", "exclude"] | None',
1409
+ enum: ['include', 'exclude'],
1410
+ },
1411
+ },
1412
+ },
1413
+ }
1414
+
1415
+ const wrapper = mount(AimdVarTableField, {
1416
+ props: {
1417
+ node,
1418
+ rows: [{ decision: 'include' }],
1419
+ columns: ['decision'],
1420
+ disabled: false,
1421
+ readonly: false,
1422
+ settlingRowKey: null,
1423
+ messages: createAimdRecorderMessages('en-US'),
1424
+ },
1425
+ })
1426
+
1427
+ const select = wrapper.find('select[data-rec-focus-key="var_table:screening:0:decision"]')
1428
+ expect(select.findAll('option').map(option => option.text())).toEqual(['Not set', 'include', 'exclude'])
1429
+
1430
+ await select.setValue('')
1431
+
1432
+ const cellUpdates = wrapper.emitted('cell-input') ?? []
1433
+ expect(cellUpdates[cellUpdates.length - 1]?.[0]).toMatchObject({
1434
+ tableName: 'screening',
1435
+ column: 'decision',
1436
+ rowIndex: 0,
1437
+ value: null,
1438
+ })
1439
+ })
927
1440
  })