@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
@@ -1,4 +1,4 @@
1
- import { aU as Gt, s as Wt, g as Kt, t as Ht, q as Yt, a as Xt, b as Zt, _ as w, F as wt, L as Jt, d as ot, al as Qt, ac as $t, ad as te, ae as ee, e as ne, A as se, H as ie, I as oe } from "./mermaid.core-CuZ3nINf.js";
1
+ import { aU as Gt, s as Wt, g as Kt, t as Ht, q as Yt, a as Xt, b as Zt, _ as w, F as wt, L as Jt, d as ot, al as Qt, ac as $t, ad as te, ae as ee, e as ne, A as se, H as ie, I as oe } from "./mermaid.core-Dt_VbeGP.js";
2
2
  const kt = (t, n) => Gt(t, "a", -n), _t = 1e-10;
3
3
  function st(t, n) {
4
4
  const s = ae(t), e = s.filter((c) => re(c, t));
@@ -1,5 +1,5 @@
1
- import { s as Mt, g as Nt, t as Lt, q as zt, a as Tt, b as At, _ as u, a1 as Xt, F as Et, H as J, l as Q, L as Yt, e as It, A as Ft, c as V } from "./mermaid.core-CuZ3nINf.js";
2
- import { p as Bt } from "./chunk-4BX2VUAB-DTmsQu5_.js";
1
+ import { s as Mt, g as Nt, t as Lt, q as zt, a as Tt, b as At, _ as u, a1 as Xt, F as Et, H as J, l as Q, L as Yt, e as It, A as Ft, c as V } from "./mermaid.core-Dt_VbeGP.js";
2
+ import { p as Bt } from "./chunk-4BX2VUAB-ncsOeLMb.js";
3
3
  import { p as Rt } from "./wardley-L42UT6IY-D7b2ujEZ.js";
4
4
  var G = /* @__PURE__ */ u((o, r) => {
5
5
  const e = o <= 1 ? o * 100 : o;
@@ -1,7 +1,7 @@
1
- import { s as gi, g as xi, t as Xt, q as di, a as fi, b as pi, _ as a, l as Yt, L as mi, e as yi, A as bi, F as _t, i as Ai, H as Nt, I as wi, a1 as Ci, am as Si, a9 as Wt } from "./mermaid.core-CuZ3nINf.js";
1
+ import { s as gi, g as xi, t as Xt, q as di, a as fi, b as pi, _ as a, l as Yt, L as mi, e as yi, A as bi, F as _t, i as Ai, H as Nt, I as wi, a1 as Ci, am as Si, a9 as Wt } from "./mermaid.core-Dt_VbeGP.js";
2
2
  import { i as _i } from "./init-DjUOC4st.js";
3
3
  import { o as ki } from "./ordinal-B6-f3MAq.js";
4
- import { l as zt } from "./linear-C-IAFdOt.js";
4
+ import { l as zt } from "./linear-Voc3BJib.js";
5
5
  function Ri(e, t, i) {
6
6
  e = +e, t = +t, i = (n = arguments.length) < 2 ? (t = e, e = 0, 1) : n < 3 ? 1 : +i;
7
7
  for (var s = -1, n = Math.max(0, Math.ceil((t - e) / i)) | 0, o = new Array(n); ++s < n; )
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@airalogy/aimd-recorder",
3
3
  "type": "module",
4
- "version": "1.18.0",
4
+ "version": "1.19.1",
5
5
  "description": "AIMD (Airalogy Markdown) recorder Vue components and UI",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -33,6 +33,10 @@
33
33
  "types": "./src/composables/index.ts",
34
34
  "import": "./src/composables/index.ts"
35
35
  },
36
+ "./record": {
37
+ "types": "./src/record/index.ts",
38
+ "import": "./src/record/index.ts"
39
+ },
36
40
  "./styles": {
37
41
  "import": "./src/styles/aimd.css",
38
42
  "default": "./src/styles/aimd.css"
@@ -59,8 +63,8 @@
59
63
  "react": "^19.2.4",
60
64
  "react-dom": "^19.2.4",
61
65
  "seqviz": "^3.10.18",
62
- "@airalogy/aimd-renderer": "^2.6.0",
63
- "@airalogy/aimd-core": "^2.8.0",
66
+ "@airalogy/aimd-core": "^2.10.0",
67
+ "@airalogy/aimd-renderer": "^2.8.0",
64
68
  "@airalogy/aimd-editor": "^1.9.0"
65
69
  },
66
70
  "devDependencies": {
@@ -0,0 +1,82 @@
1
+ import { mount } from '@vue/test-utils'
2
+ import { describe, expect, it } from 'vitest'
3
+ import { nextTick } from 'vue'
4
+ import AimdAssignerGraph from '../components/AimdAssignerGraph.vue'
5
+ import type { AimdAssignerGraphData } from '../types'
6
+
7
+ const assignerGraph: AimdAssignerGraphData = {
8
+ nodes: [
9
+ { name: 'seconds', type: 'dependent_field' },
10
+ { name: 'calculate_duration', type: 'assigner' },
11
+ { name: 'duration', type: 'assigned_field' },
12
+ ],
13
+ edges: [
14
+ ['seconds', 'calculate_duration'],
15
+ ['calculate_duration', 'duration'],
16
+ ],
17
+ }
18
+
19
+ describe('AimdAssignerGraph', () => {
20
+ it('renders assigner graph nodes, edges, and legend labels', () => {
21
+ const wrapper = mount(AimdAssignerGraph, {
22
+ props: {
23
+ assignerGraph,
24
+ },
25
+ })
26
+
27
+ expect(wrapper.findAll('.aimd-assigner-graph__node')).toHaveLength(3)
28
+ expect(wrapper.findAll('.aimd-assigner-graph__edge')).toHaveLength(2)
29
+ expect(wrapper.text()).toContain('Dependent field')
30
+ expect(wrapper.text()).toContain('Assigner')
31
+ expect(wrapper.text()).toContain('Assigned field')
32
+ expect(wrapper.text()).toContain('calculate_duration')
33
+ })
34
+
35
+ it('toggles between field names and schema titles', async () => {
36
+ const wrapper = mount(AimdAssignerGraph, {
37
+ props: {
38
+ assignerGraph,
39
+ nodeSchemaMap: {
40
+ duration: {
41
+ title: 'Duration',
42
+ },
43
+ },
44
+ },
45
+ })
46
+
47
+ expect(wrapper.text()).toContain('duration')
48
+ expect(wrapper.text()).not.toContain('Duration')
49
+
50
+ await wrapper.find('.aimd-assigner-graph__mode-btn').trigger('click')
51
+ await nextTick()
52
+
53
+ expect(wrapper.text()).toContain('Duration')
54
+ })
55
+
56
+ it('highlights connected nodes and emits node clicks', async () => {
57
+ const wrapper = mount(AimdAssignerGraph, {
58
+ props: {
59
+ assignerGraph,
60
+ },
61
+ })
62
+
63
+ await wrapper.find('[aria-label="calculate_duration"]').trigger('click')
64
+ await nextTick()
65
+
66
+ expect(wrapper.emitted('nodeClick')?.[0]?.[0]).toBe('calculate_duration')
67
+ expect(wrapper.emitted('nodeClick')?.[0]?.[1]).toBe('assigner')
68
+ expect(wrapper.findAll('.aimd-assigner-graph__node--highlighted')).toHaveLength(3)
69
+ expect(wrapper.findAll('.aimd-assigner-graph__edge--highlighted')).toHaveLength(2)
70
+ })
71
+
72
+ it('renders an empty state without graph data', () => {
73
+ const wrapper = mount(AimdAssignerGraph, {
74
+ props: {
75
+ assignerGraph: null,
76
+ },
77
+ })
78
+
79
+ expect(wrapper.text()).toContain('No assigner graph available')
80
+ expect(wrapper.find('.aimd-assigner-graph__svg').exists()).toBe(false)
81
+ })
82
+ })
@@ -225,6 +225,67 @@ describe('AimdRecorder assigner controls', () => {
225
225
  expect(latestRecord?.var?.ic50).toBe(42)
226
226
  })
227
227
 
228
+ it('keeps assigner controls visible after a list var receives assigned data', async () => {
229
+ currentVarNode = {
230
+ ...varNode,
231
+ id: 'image_ids',
232
+ name: 'image_ids',
233
+ label: 'image_ids',
234
+ raw: '{{var|image_ids: list[str]}}',
235
+ definition: {
236
+ id: 'image_ids',
237
+ name: 'image_ids',
238
+ type: 'list[str]',
239
+ },
240
+ }
241
+ currentFields = {
242
+ ...fields,
243
+ var: ['image_ids'],
244
+ var_definitions: [{ id: 'image_ids', name: 'image_ids', type: 'list[str]' }],
245
+ }
246
+ const runServerAssigner = vi.fn(async (_request: AimdAssignerRunnerRequest) => ({
247
+ data: {
248
+ assigned_fields: {
249
+ image_ids: ['airalogy.id.file.image-a.png', 'airalogy.id.file.image-b.png'],
250
+ },
251
+ },
252
+ }))
253
+
254
+ const wrapper = mount(AimdRecorder, {
255
+ props: {
256
+ content: '{{var|image_ids: list[str]}}',
257
+ locale: 'en-US',
258
+ modelValue: { var: {}, step: {}, check: {}, quiz: {} },
259
+ serverAssigners: {
260
+ image_ids: {
261
+ mode: 'manual',
262
+ dependent_fields: ['aimd_content'],
263
+ },
264
+ },
265
+ runServerAssigner,
266
+ },
267
+ })
268
+
269
+ await flushPromises()
270
+ await nextTick()
271
+
272
+ const button = wrapper.find('.aimd-rec-assigner-field__button')
273
+ expect(button.exists()).toBe(true)
274
+
275
+ await button.trigger('click')
276
+ await flushPromises()
277
+ await nextTick()
278
+ await flushPromises()
279
+ await nextTick()
280
+
281
+ expect(runServerAssigner).toHaveBeenCalledTimes(1)
282
+ const updates = wrapper.emitted('update:modelValue') ?? []
283
+ const latestRecord = updates[updates.length - 1]?.[0] as { var?: Record<string, unknown> } | undefined
284
+ expect(latestRecord?.var?.image_ids).toEqual(['airalogy.id.file.image-a.png', 'airalogy.id.file.image-b.png'])
285
+ expect(wrapper.find('.aimd-rec-assigner-field__button').exists()).toBe(true)
286
+ expect((wrapper.find('textarea.aimd-rec-inline__textarea').element as HTMLTextAreaElement).value).toContain('"airalogy.id.file.image-a.png"')
287
+ })
288
+
228
289
  it('runs auto host assigners when dependent fields become available', async () => {
229
290
  const runServerAssigner = vi.fn(async (_request: AimdAssignerRunnerRequest) => ({
230
291
  data: {
@@ -342,7 +403,7 @@ describe('AimdRecorder assigner controls', () => {
342
403
  },
343
404
  serverAssigners: {
344
405
  final_conv_pct: sharedAssigner,
345
- k_obs: sharedAssigner,
406
+ k_obs: { ...sharedAssigner },
346
407
  },
347
408
  runServerAssigner,
348
409
  },
@@ -365,6 +426,94 @@ describe('AimdRecorder assigner controls', () => {
365
426
  expect(wrapper.findAll('.aimd-rec-assigner-field__status--done')).toHaveLength(2)
366
427
  })
367
428
 
429
+ it('shows running state on every field in a shared server assigner batch', async () => {
430
+ const finalConvNode = {
431
+ ...varNode,
432
+ id: 'final_conv_pct',
433
+ name: 'final_conv_pct',
434
+ label: 'final_conv_pct',
435
+ raw: '{{var|final_conv_pct: float}}',
436
+ definition: {
437
+ name: 'final_conv_pct',
438
+ type: 'float',
439
+ },
440
+ }
441
+ const rateNode = {
442
+ ...varNode,
443
+ id: 'k_obs',
444
+ name: 'k_obs',
445
+ label: 'k_obs',
446
+ raw: '{{var|k_obs: float}}',
447
+ definition: {
448
+ name: 'k_obs',
449
+ type: 'float',
450
+ },
451
+ }
452
+ currentVarNodes = [finalConvNode, rateNode]
453
+ currentFields = {
454
+ ...fields,
455
+ var: ['final_conv_pct', 'k_obs'],
456
+ var_definitions: [
457
+ { name: 'final_conv_pct', type: 'float' },
458
+ { name: 'k_obs', type: 'float' },
459
+ ],
460
+ }
461
+ const sharedAssigner = {
462
+ mode: 'manual',
463
+ dependent_fields: ['kinetics_file'],
464
+ }
465
+ let resolveRun: (value: unknown) => void = () => {}
466
+ const runServerAssigner = vi.fn((_request: AimdAssignerRunnerRequest) => new Promise((resolve) => {
467
+ resolveRun = resolve
468
+ }))
469
+
470
+ const wrapper = mount(AimdRecorder, {
471
+ props: {
472
+ content: '{{var|final_conv_pct: float}}{{var|k_obs: float}}',
473
+ locale: 'en-US',
474
+ modelValue: {
475
+ var: {
476
+ kinetics_file: 'airalogy.id.file.csv',
477
+ },
478
+ step: {},
479
+ check: {},
480
+ quiz: {},
481
+ },
482
+ serverAssigners: {
483
+ final_conv_pct: sharedAssigner,
484
+ k_obs: { ...sharedAssigner },
485
+ },
486
+ runServerAssigner,
487
+ },
488
+ })
489
+
490
+ await flushPromises()
491
+ await nextTick()
492
+
493
+ const buttons = wrapper.findAll('.aimd-rec-assigner-field__button')
494
+ expect(buttons).toHaveLength(2)
495
+ await buttons[0].trigger('click')
496
+ await flushPromises()
497
+ await nextTick()
498
+
499
+ expect(runServerAssigner).toHaveBeenCalledTimes(1)
500
+ expect(wrapper.findAll('.aimd-rec-assigner-field__spinner')).toHaveLength(2)
501
+ expect(wrapper.findAll('.aimd-rec-assigner-field__status--loading')).toHaveLength(2)
502
+
503
+ resolveRun({
504
+ data: {
505
+ assigned_fields: {
506
+ final_conv_pct: 96.5,
507
+ k_obs: 0.125,
508
+ },
509
+ },
510
+ })
511
+ await flushPromises()
512
+ await nextTick()
513
+
514
+ expect(wrapper.findAll('.aimd-rec-assigner-field__status--done')).toHaveLength(2)
515
+ })
516
+
368
517
  it('mounts shared server assigner controls on every declared assigned field', async () => {
369
518
  const finalConvNode = {
370
519
  ...varNode,
@@ -7,6 +7,7 @@ const __filename = fileURLToPath(import.meta.url)
7
7
  const __dirname = dirname(__filename)
8
8
  const source = readFileSync(resolve(__dirname, '../components/AimdRecorderEditor.vue'), 'utf8')
9
9
  const wysiwygSurfaceSource = readFileSync(resolve(__dirname, '../components/AimdRecorderWysiwygSurface.vue'), 'utf8')
10
+ const wysiwygFieldHostSource = readFileSync(resolve(__dirname, '../components/AimdRecorderWysiwygFieldHost.vue'), 'utf8')
10
11
  const recorderMilkdownSource = readFileSync(resolve(__dirname, '../components/recorderMilkdownPlugin.ts'), 'utf8')
11
12
  const componentExports = readFileSync(resolve(__dirname, '../components/index.ts'), 'utf8')
12
13
  const rootExports = readFileSync(resolve(__dirname, '../index.ts'), 'utf8')
@@ -63,7 +64,7 @@ describe('AimdRecorderEditor', () => {
63
64
  expect(source).toMatch(/type WorkbenchSideTab = 'recorder' \| 'structure' \| 'record' \| 'detached'/)
64
65
  expect(source).toMatch(/const activeSideTab = ref<WorkbenchSideTab>\('recorder'\)/)
65
66
  expect(source).toMatch(/const sideTabs = computed\(\(\) =>/)
66
- expect(source).toMatch(/const sidePanelBodyStyle = computed\(\(\) => \(\{/)
67
+ expect(source).toMatch(/const sidePanelBodyStyle = computed\(\(\) => \(/)
67
68
  expect(source).toMatch(/aimd-recorder-workbench__side-tabs/)
68
69
  expect(source).toMatch(/aimd-recorder-workbench__side-tab--active/)
69
70
  expect(source).toMatch(/aimd-recorder-workbench__panel-body--recorder \{[\s\S]*overflow: auto;/)
@@ -88,19 +89,51 @@ describe('AimdRecorderEditor', () => {
88
89
 
89
90
  it('can fit both columns to the remaining viewport height while still exposing a fixed-height opt-out', () => {
90
91
  expect(source).toMatch(/fitViewport\?: boolean/)
92
+ expect(source).toMatch(/fillParent\?: boolean/)
91
93
  expect(source).toMatch(/viewportOffset\?: number/)
92
94
  expect(source).toMatch(/fitViewport: true/)
95
+ expect(source).toMatch(/fillParent: false/)
93
96
  expect(source).toMatch(/viewportOffset: 24/)
97
+ expect(source).toMatch(/if \(props\.fillParent\) \{[\s\S]*viewportWorkbenchMainHeight\.value = null[\s\S]*return/)
98
+ expect(source).toMatch(/minHeight: editorProps\.minHeight \?\? \(props\.fillParent \? 0 : viewportEditorMinHeight\.value\)/)
99
+ expect(source).toMatch(/const sidePanelBodyStyle = computed\(\(\) => \([\s\S]*props\.fillParent \? \{\} : \{ height: `\$\{viewportSideBodyHeight\.value\}px` \}[\s\S]*\)\)/)
100
+ expect(source).toMatch(/const visualEditorMinHeight = computed\(\(\) => \([\s\S]*props\.fillParent \? 0 : viewportVisualEditorMinHeight\.value[\s\S]*\)\)/)
101
+ expect(source).toMatch(/'aimd-recorder-workbench--fill-parent': fillParent/)
102
+ expect(source).toMatch(/aimd-recorder-workbench--fill-parent \{[\s\S]*height: 100%;[\s\S]*overflow: hidden;/)
103
+ expect(source).toMatch(/aimd-recorder-workbench--fill-parent \.aimd-recorder-workbench__main \{[\s\S]*flex: 1 1 0;[\s\S]*height: 100%;/)
104
+ expect(source).toMatch(/aimd-recorder-workbench--fill-parent \.aimd-recorder-workbench__panel-body \{[\s\S]*flex: 1 1 0;[\s\S]*height: auto !important;/)
105
+ expect(source).toMatch(/aimd-recorder-workbench--fill-parent \.aimd-recorder-workbench__panel-body--editor :deep\(\.aimd-editor-panel > div\) \{[\s\S]*height: 100%;[\s\S]*min-height: 0;/)
94
106
  expect(source).toMatch(/function getViewportHeight\(\)/)
95
107
  expect(source).toMatch(/return window\.visualViewport\?\.height \?\? window\.innerHeight/)
96
108
  expect(source).toMatch(/function updateViewportPanelHeights\(/)
97
109
  expect(source).toMatch(/const viewportVisualEditorMinHeight = ref/)
110
+ expect(source).toMatch(/const viewportWorkbenchMainHeight = ref<number \| null>\(null\)/)
98
111
  expect(source).toMatch(/const recorderToolbarHeight = getElementHeight\(recorderToolbarRef\.value\)/)
99
112
  expect(source).toMatch(/const visualEditorToolbarHeight = getElementHeight\(sidePanelBodyRef\.value\?\.querySelector\('\.aimd-editor-toolbar'\)\)/)
113
+ expect(source).toMatch(/--aimd-recorder-workbench-main-height/)
114
+ expect(source).toMatch(/height: var\(--aimd-recorder-workbench-main-height, auto\);/)
115
+ expect(source).toMatch(/aimd-recorder-workbench__panel \{[\s\S]*display: flex;[\s\S]*min-height: 0;/)
100
116
  expect(source).toMatch(/workbenchRef\.value\?\.getBoundingClientRect\(\)\.top/)
101
117
  expect(source).toMatch(/window\.addEventListener\('resize', scheduleViewportPanelHeights/)
102
118
  })
103
119
 
120
+ it('passes quiz grading display state through the combined editor and visual recorder surface', () => {
121
+ expect(source).toMatch(/quizGrades\?: Record<string, AimdQuizGradeResult \| null \| undefined>/)
122
+ expect(source).toMatch(/submitted\?: boolean/)
123
+ expect(source).toMatch(/choiceOptionExplanationMode\?: AimdChoiceOptionExplanationMode/)
124
+ expect(source).toMatch(/scaleGradeDisplayMode\?: AimdScaleGradeDisplayMode/)
125
+ expect(source).toMatch(/:quiz-grades="quizGrades"/)
126
+ expect(source).toMatch(/:submitted="submitted"/)
127
+ expect(source).toMatch(/:choice-option-explanation-mode="choiceOptionExplanationMode"/)
128
+ expect(source).toMatch(/:scale-grade-display-mode="scaleGradeDisplayMode"/)
129
+ expect(wysiwygSurfaceSource).toMatch(/quizGrades\?: Record<string, AimdQuizGradeResult \| null \| undefined>/)
130
+ expect(wysiwygSurfaceSource).toMatch(/surfaceState\.quizGrades = props\.quizGrades/)
131
+ expect(recorderMilkdownSource).toMatch(/quizGrades\?: Record<string, AimdQuizGradeResult \| null \| undefined>/)
132
+ expect(recorderMilkdownSource).toMatch(/choiceOptionExplanationMode: AimdChoiceOptionExplanationMode/)
133
+ expect(wysiwygFieldHostSource).toMatch(/:quiz-grades="surfaceState\.quizGrades"/)
134
+ expect(wysiwygFieldHostSource).toMatch(/:choice-option-explanation-mode="surfaceState\.choiceOptionExplanationMode"/)
135
+ })
136
+
104
137
  it('supports recorder-side visual editing so field controls can be changed around live recorder widgets', () => {
105
138
  expect(source).toMatch(/visualEditMode/)
106
139
  expect(source).toMatch(/import AimdRecorderWysiwygSurface from '\.\/AimdRecorderWysiwygSurface\.vue'/)
@@ -8,6 +8,9 @@ function createSurfaceState(): RecorderMilkdownSurfaceState {
8
8
  return {
9
9
  record: createEmptyProtocolRecordData(),
10
10
  readonly: false,
11
+ submitted: false,
12
+ choiceOptionExplanationMode: 'hidden',
13
+ scaleGradeDisplayMode: 'hidden',
11
14
  stepDetailDisplay: 'auto',
12
15
  onUpdateRecord: () => {},
13
16
  }
@@ -15,6 +15,7 @@ const __filename = fileURLToPath(import.meta.url)
15
15
  const __dirname = dirname(__filename)
16
16
  const source = readFileSync(resolve(__dirname, '../components/AimdVarField.vue'), 'utf8')
17
17
  const codeFieldSource = readFileSync(resolve(__dirname, '../components/AimdCodeField.vue'), 'utf8')
18
+ const varTableSource = readFileSync(resolve(__dirname, '../components/AimdVarTableField.vue'), 'utf8')
18
19
  const recorderSource = readFileSync(resolve(__dirname, '../components/AimdRecorder.vue'), 'utf8')
19
20
  const varHelpersSource = readFileSync(resolve(__dirname, '../composables/useVarHelpers.ts'), 'utf8')
20
21
  const styles = readFileSync(resolve(__dirname, '../styles/aimd.css'), 'utf8')
@@ -60,10 +61,49 @@ describe('AimdVarField render behavior', () => {
60
61
  expect(styles).toContain('.aimd-field--var-table .aimd-field__table-preview th:has(.aimd-field__metadata-host:hover)')
61
62
  })
62
63
 
64
+ it('keeps figure images and captions visually attached without card elevation', () => {
65
+ expect(styles).toMatch(/\.aimd-figure \{[\s\S]*?width: fit-content;/)
66
+ expect(styles).toMatch(/\.aimd-figure \{[\s\S]*?overflow: hidden;/)
67
+ expect(styles).not.toContain('box-shadow: 0 10px 28px')
68
+ expect(styles).toMatch(/\.aimd-figure__caption \{[\s\S]*?border-top: 1px solid #d8e2ef;/)
69
+ expect(styles).toMatch(/\.aimd-figure__legend \{[\s\S]*?margin: 4px 0 0;/)
70
+ })
71
+
72
+ it('uses selectable citation popovers instead of pseudo-element tooltips', () => {
73
+ expect(styles).toContain('.aimd-cite__popover')
74
+ expect(styles).not.toContain('.aimd-cite__ref::after')
75
+ expect(styles).toMatch(/\.aimd-cite__popover \{[\s\S]*?pointer-events: none;/)
76
+ expect(styles).toMatch(/\.aimd-cite__popover \{[\s\S]*?user-select: text;/)
77
+ expect(styles).toMatch(/\.aimd-cite__popover::before \{[\s\S]*?height: 10px;/)
78
+ expect(styles).toMatch(/\.aimd-cite__ref:hover \.aimd-cite__popover,[\s\S]*?pointer-events: auto;/)
79
+ })
80
+
81
+ it('marks internal references as focusable route-safe targets', () => {
82
+ expect(styles).toMatch(/\.aimd-ref\[data-aimd-ref-target\] \{[\s\S]*?cursor: pointer;/)
83
+ expect(styles).toMatch(/\.aimd-ref\[data-aimd-ref-target\]:focus-visible \{[\s\S]*?outline: 2px solid rgba\(25, 118, 210, 0\.36\);/)
84
+ })
85
+
63
86
  it('renders editable table cell values without inherited italic preview styling', () => {
64
87
  expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-table-cell-input\) \{[\s\S]*?font-style: normal;/)
65
88
  })
66
89
 
90
+ it('keeps card-style table rows compact in dense recorder layouts', () => {
91
+ expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-card-list\) \{[\s\S]*?gap: 8px;/)
92
+ expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-card\) \{[\s\S]*?padding: 7px 10px 9px;/)
93
+ expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-card__field\) \{[\s\S]*?padding-top: 6px;[\s\S]*?margin-top: 6px;/)
94
+ expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-card__input\) \{[\s\S]*?height: 30px;/)
95
+ expect(recorderSource).toContain('.aimd-rec-card .aimd-rec-inline-table__drag-handle')
96
+ })
97
+
98
+ it('shows visible row numbers for table and card var_table layouts', () => {
99
+ expect(varTableSource).toContain('function renderRowNumber')
100
+ expect(varTableSource).toContain('aimd-rec-inline-table__row-control')
101
+ expect(varTableSource).toContain('aimd-rec-card__row-meta')
102
+ expect(varTableSource).toContain('aimd-rec-inline-table__row-head-label')
103
+ expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline-table__row-number\) \{[\s\S]*?font-variant-numeric: tabular-nums;/)
104
+ expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline-table__row-number\) \{[\s\S]*?background: transparent;[\s\S]*?font-style: normal;/)
105
+ })
106
+
67
107
  it('clips plain stacked var controls so rounded corners render cleanly', () => {
68
108
  expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline--var-stacked\) \{[\s\S]*?overflow: hidden;/)
69
109
  expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline--var-stacked:has\(\.aimd-field__metadata-host\)\) \{[\s\S]*?overflow: visible;/)
@@ -585,6 +625,53 @@ describe('AimdVarField render behavior', () => {
585
625
  expect((wrapper.find('input').element as HTMLInputElement).placeholder).toBe('S-001')
586
626
  })
587
627
 
628
+ it('renders table row numbers without adding data columns', () => {
629
+ vi.stubGlobal('ResizeObserver', class {
630
+ observe() {}
631
+ unobserve() {}
632
+ disconnect() {}
633
+ })
634
+ vi.stubGlobal('requestAnimationFrame', (callback: FrameRequestCallback) => {
635
+ callback(0)
636
+ return 1
637
+ })
638
+ vi.stubGlobal('cancelAnimationFrame', () => {})
639
+
640
+ const node: AimdVarTableNode = {
641
+ type: 'aimd',
642
+ fieldType: 'var_table',
643
+ scope: 'var_table',
644
+ id: 'samples',
645
+ raw: '{{var_table|samples}}',
646
+ columns: ['sample_id'],
647
+ definition: {
648
+ id: 'samples',
649
+ subvars: {
650
+ sample_id: {
651
+ id: 'sample_id',
652
+ type: 'str',
653
+ },
654
+ },
655
+ },
656
+ }
657
+
658
+ const wrapper = mount(AimdVarTableField, {
659
+ props: {
660
+ node,
661
+ rows: [{ sample_id: 'A' }, { sample_id: 'B' }],
662
+ columns: ['sample_id'],
663
+ disabled: false,
664
+ readonly: false,
665
+ settlingRowKey: null,
666
+ messages: createAimdRecorderMessages('en-US'),
667
+ },
668
+ })
669
+
670
+ expect(wrapper.find('.aimd-rec-inline-table__row-head-label').text()).toBe('#')
671
+ expect(wrapper.findAll('.aimd-rec-inline-table__row-number').map(number => number.text())).toEqual(['1', '2'])
672
+ expect(wrapper.findAll('.aimd-rec-inline-table__value-cell')).toHaveLength(2)
673
+ })
674
+
588
675
  it('places table assigner actions in the table header', () => {
589
676
  vi.stubGlobal('ResizeObserver', class {
590
677
  observe() {}