@airalogy/aimd-recorder 1.18.0 → 1.19.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 (75) hide show
  1. package/README.md +31 -0
  2. package/README.zh-CN.md +31 -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 +2937 -2471
  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__/var-field-render.test.ts +65 -0
  63. package/src/components/AimdAssignerGraph.vue +816 -0
  64. package/src/components/AimdMarkdownField.vue +8 -0
  65. package/src/components/AimdRecorder.vue +136 -42
  66. package/src/components/AimdVarTableField.vue +42 -28
  67. package/src/components/index.ts +9 -1
  68. package/src/composables/__tests__/useVarHelpers.test.ts +42 -0
  69. package/src/composables/index.ts +1 -0
  70. package/src/composables/useVarHelpers.ts +87 -250
  71. package/src/index.ts +7 -1
  72. package/src/record/index.ts +120 -0
  73. package/src/styles/aimd.css +65 -0
  74. package/src/type-utils.ts +1 -3
  75. 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.0",
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.9.0",
67
+ "@airalogy/aimd-renderer": "^2.7.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,
@@ -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')
@@ -64,6 +65,23 @@ describe('AimdVarField render behavior', () => {
64
65
  expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-table-cell-input\) \{[\s\S]*?font-style: normal;/)
65
66
  })
66
67
 
68
+ it('keeps card-style table rows compact in dense recorder layouts', () => {
69
+ expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-card-list\) \{[\s\S]*?gap: 8px;/)
70
+ expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-card\) \{[\s\S]*?padding: 7px 10px 9px;/)
71
+ expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-card__field\) \{[\s\S]*?padding-top: 6px;[\s\S]*?margin-top: 6px;/)
72
+ expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-card__input\) \{[\s\S]*?height: 30px;/)
73
+ expect(recorderSource).toContain('.aimd-rec-card .aimd-rec-inline-table__drag-handle')
74
+ })
75
+
76
+ it('shows visible row numbers for table and card var_table layouts', () => {
77
+ expect(varTableSource).toContain('function renderRowNumber')
78
+ expect(varTableSource).toContain('aimd-rec-inline-table__row-control')
79
+ expect(varTableSource).toContain('aimd-rec-card__row-meta')
80
+ expect(varTableSource).toContain('aimd-rec-inline-table__row-head-label')
81
+ expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline-table__row-number\) \{[\s\S]*?font-variant-numeric: tabular-nums;/)
82
+ expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline-table__row-number\) \{[\s\S]*?background: transparent;[\s\S]*?font-style: normal;/)
83
+ })
84
+
67
85
  it('clips plain stacked var controls so rounded corners render cleanly', () => {
68
86
  expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline--var-stacked\) \{[\s\S]*?overflow: hidden;/)
69
87
  expect(recorderSource).toMatch(/\.aimd-protocol-recorder__content :deep\(\.aimd-rec-inline--var-stacked:has\(\.aimd-field__metadata-host\)\) \{[\s\S]*?overflow: visible;/)
@@ -585,6 +603,53 @@ describe('AimdVarField render behavior', () => {
585
603
  expect((wrapper.find('input').element as HTMLInputElement).placeholder).toBe('S-001')
586
604
  })
587
605
 
606
+ it('renders table row numbers without adding data columns', () => {
607
+ vi.stubGlobal('ResizeObserver', class {
608
+ observe() {}
609
+ unobserve() {}
610
+ disconnect() {}
611
+ })
612
+ vi.stubGlobal('requestAnimationFrame', (callback: FrameRequestCallback) => {
613
+ callback(0)
614
+ return 1
615
+ })
616
+ vi.stubGlobal('cancelAnimationFrame', () => {})
617
+
618
+ const node: AimdVarTableNode = {
619
+ type: 'aimd',
620
+ fieldType: 'var_table',
621
+ scope: 'var_table',
622
+ id: 'samples',
623
+ raw: '{{var_table|samples}}',
624
+ columns: ['sample_id'],
625
+ definition: {
626
+ id: 'samples',
627
+ subvars: {
628
+ sample_id: {
629
+ id: 'sample_id',
630
+ type: 'str',
631
+ },
632
+ },
633
+ },
634
+ }
635
+
636
+ const wrapper = mount(AimdVarTableField, {
637
+ props: {
638
+ node,
639
+ rows: [{ sample_id: 'A' }, { sample_id: 'B' }],
640
+ columns: ['sample_id'],
641
+ disabled: false,
642
+ readonly: false,
643
+ settlingRowKey: null,
644
+ messages: createAimdRecorderMessages('en-US'),
645
+ },
646
+ })
647
+
648
+ expect(wrapper.find('.aimd-rec-inline-table__row-head-label').text()).toBe('#')
649
+ expect(wrapper.findAll('.aimd-rec-inline-table__row-number').map(number => number.text())).toEqual(['1', '2'])
650
+ expect(wrapper.findAll('.aimd-rec-inline-table__value-cell')).toHaveLength(2)
651
+ })
652
+
588
653
  it('places table assigner actions in the table header', () => {
589
654
  vi.stubGlobal('ResizeObserver', class {
590
655
  observe() {}