@airalogy/aimd-recorder 1.25.1 → 1.26.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 (98) hide show
  1. package/README.md +16 -0
  2. package/README.zh-CN.md +16 -0
  3. package/dist/{AimdDnaSequenceField-WZF4SAj2.js → AimdDnaSequenceField-CKfd3-_9.js} +1 -1
  4. package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-COQDWC8R.js → AimdEditor.vue_vue_type_style_index_0_lang-C1XlvrNT.js} +8311 -7173
  5. package/dist/{AimdEntityRefField-CWVj0vPF.js → AimdEntityRefField-CX67car3.js} +1 -1
  6. package/dist/{AimdEntityRefField.vue_vue_type_script_setup_true_lang-CaKfY8iu.js → AimdEntityRefField.vue_vue_type_script_setup_true_lang-JISqbfKY.js} +1 -1
  7. package/dist/{AimdMarkdownField-BeDCefoQ.js → AimdMarkdownField-BuRsjOB5.js} +9 -9
  8. package/dist/{AimdMarkdownNoteField-BKrlgUYP.js → AimdMarkdownNoteField-NRA9ut3_.js} +6 -6
  9. package/dist/{AimdResourceRefField-DUlNcU3q.js → AimdResourceRefField-B71MVFFK.js} +2 -2
  10. package/dist/aimd-recorder.css +1 -1
  11. package/dist/{arc-DYnxKzGE.js → arc-2NNDEUZL.js} +1 -1
  12. package/dist/{architectureDiagram-3BPJPVTR-CjOI8IqA.js → architectureDiagram-3BPJPVTR-BGU_a_9z.js} +2 -2
  13. package/dist/{blockDiagram-GPEHLZMM-B8xNjZYk.js → blockDiagram-GPEHLZMM-ChLqLSJn.js} +4 -4
  14. package/dist/{c4Diagram-AAUBKEIU-TpIYY3Qn.js → c4Diagram-AAUBKEIU-BXt823OA.js} +2 -2
  15. package/dist/{channel-BYLaVK3q.js → channel-D1EuKFn5.js} +1 -1
  16. package/dist/{chunk-2J33WTMH-YwB0nZYk.js → chunk-2J33WTMH-XJPmqQtr.js} +1 -1
  17. package/dist/{chunk-4BX2VUAB-6QDBanOQ.js → chunk-4BX2VUAB-CbV5jCeG.js} +1 -1
  18. package/dist/{chunk-55IACEB6-7rwKJBSZ.js → chunk-55IACEB6-C8gv1Mc0.js} +1 -1
  19. package/dist/{chunk-727SXJPM-Ba_FZJwp.js → chunk-727SXJPM-Bs2EpCWN.js} +5 -5
  20. package/dist/{chunk-AQP2D5EJ-reuQpvqF.js → chunk-AQP2D5EJ-CngahRo6.js} +3 -3
  21. package/dist/{chunk-FMBD7UC4-D35dlx01.js → chunk-FMBD7UC4-DPBfEP1E.js} +1 -1
  22. package/dist/{chunk-ND2GUHAM-D7604ZCl.js → chunk-ND2GUHAM-BlEzeiST.js} +1 -1
  23. package/dist/{chunk-QZHKN3VN-CKYkktao.js → chunk-QZHKN3VN-DGOFj8Bc.js} +1 -1
  24. package/dist/{classDiagram-v2-Q7XG4LA2-BNKRYoAB.js → classDiagram-4FO5ZUOK-BUQqoFF9.js} +2 -2
  25. package/dist/{classDiagram-4FO5ZUOK-BNKRYoAB.js → classDiagram-v2-Q7XG4LA2-BUQqoFF9.js} +2 -2
  26. package/dist/components.js +3885 -3650
  27. package/dist/composables.js +3 -3
  28. package/dist/{cose-bilkent-S5V4N54A-Dq12egzW.js → cose-bilkent-S5V4N54A-Qxs9suxa.js} +1 -1
  29. package/dist/{dagre-BM42HDAG-CRwAbNsB.js → dagre-BM42HDAG-CqV8IXIy.js} +3 -3
  30. package/dist/{diagram-2AECGRRQ--WYmW1Cd.js → diagram-2AECGRRQ-D0mYOaE1.js} +2 -2
  31. package/dist/{diagram-5GNKFQAL-C7KgsBJW.js → diagram-5GNKFQAL-Dvjcs9SL.js} +3 -3
  32. package/dist/{diagram-KO2AKTUF-B_6YtDZt.js → diagram-KO2AKTUF-rSovr72L.js} +2 -2
  33. package/dist/{diagram-LMA3HP47-DARH_IPq.js → diagram-LMA3HP47-CirCeq88.js} +2 -2
  34. package/dist/{diagram-OG6HWLK6-CRdh6xnM.js → diagram-OG6HWLK6-rk46c1hT.js} +3 -3
  35. package/dist/{erDiagram-TEJ5UH35-CoC8CHnh.js → erDiagram-TEJ5UH35--_m5yDSV.js} +4 -4
  36. package/dist/{flowDiagram-I6XJVG4X-BvOa5j4A.js → flowDiagram-I6XJVG4X-DU-TlDfY.js} +6 -6
  37. package/dist/{ganttDiagram-6RSMTGT7-CVXhLTr6.js → ganttDiagram-6RSMTGT7-CrMwQSQi.js} +2 -2
  38. package/dist/{gitGraphDiagram-PVQCEYII-DFhjJRYR.js → gitGraphDiagram-PVQCEYII-Q-bwtX2H.js} +3 -3
  39. package/dist/{graph-DEn_dxZa.js → graph-CvyYQarK.js} +58 -58
  40. package/dist/index.js +124 -123
  41. package/dist/{infoDiagram-5YYISTIA-uEUHa5YE.js → infoDiagram-5YYISTIA-BejjAcMI.js} +1 -1
  42. package/dist/{ishikawaDiagram-YF4QCWOH-BqGYvdVJ.js → ishikawaDiagram-YF4QCWOH-CbRBA5Ak.js} +1 -1
  43. package/dist/{journeyDiagram-JHISSGLW-BkKJZduM.js → journeyDiagram-JHISSGLW-D_6-qOB8.js} +4 -4
  44. package/dist/{kanban-definition-UN3LZRKU-CEsZIhW3.js → kanban-definition-UN3LZRKU-DyGjEqu5.js} +2 -2
  45. package/dist/{layout-Dk4utAZD.js → layout-Z5g42JDg.js} +93 -93
  46. package/dist/{linear-pw3I09nb.js → linear-DSunMwcT.js} +1 -1
  47. package/dist/{mermaid.core-iJ2XgYy9.js → mermaid.core-B-O2uDZ3.js} +34 -34
  48. package/dist/{mindmap-definition-RKZ34NQL-ChQ5---t.js → mindmap-definition-RKZ34NQL-CC_NhwV9.js} +3 -3
  49. package/dist/{pieDiagram-4H26LBE5-DRIV2FNb.js → pieDiagram-4H26LBE5-CHlBAazu.js} +3 -3
  50. package/dist/{quadrantDiagram-W4KKPZXB-C57biOpe.js → quadrantDiagram-W4KKPZXB-BM6pMzVZ.js} +2 -2
  51. package/dist/record.js +2 -2
  52. package/dist/{requirementDiagram-4Y6WPE33-KjKJuN09.js → requirementDiagram-4Y6WPE33-CNkZDYpb.js} +3 -3
  53. package/dist/{sankeyDiagram-5OEKKPKP-BFubJDRS.js → sankeyDiagram-5OEKKPKP-Cq6DjItn.js} +1 -1
  54. package/dist/{sequenceDiagram-3UESZ5HK-B7vg6NfP.js → sequenceDiagram-3UESZ5HK-BIzn9dmF.js} +3 -3
  55. package/dist/{stateDiagram-AJRCARHV-BRs_mbra.js → stateDiagram-AJRCARHV-DbSpH-v9.js} +4 -4
  56. package/dist/{stateDiagram-v2-BHNVJYJU-4w8m6dxi.js → stateDiagram-v2-BHNVJYJU-Cnv8BTgy.js} +2 -2
  57. package/dist/{timeline-definition-PNZ67QCA-vrEAExRb.js → timeline-definition-PNZ67QCA-Bhs5_-8Z.js} +2 -2
  58. package/dist/useCodeBlockRendering-IjoDTQ64.js +35 -0
  59. package/dist/{useFieldRendering-B3Vm2XT8.js → useFieldRendering-r1bAnHjk.js} +239 -240
  60. package/dist/useVarHelpers-xrbf4f60.js +7008 -0
  61. package/dist/{validation-IAiGnEKX.js → validation-ZmPcMCY0.js} +991 -989
  62. package/dist/{vennDiagram-CIIHVFJN-CFtQv4Ta.js → vennDiagram-CIIHVFJN-DJSLUotN.js} +1 -1
  63. package/dist/{wardleyDiagram-YWT4CUSO-BxzaCMou.js → wardleyDiagram-YWT4CUSO-Bk66hVLg.js} +2 -2
  64. package/dist/{xychartDiagram-2RQKCTM6-DhTuG8MO.js → xychartDiagram-2RQKCTM6-Bss5MLVp.js} +2 -2
  65. package/package.json +4 -4
  66. package/src/__tests__/check-field-render.test.ts +65 -0
  67. package/src/__tests__/compact-field-types.test.ts +181 -0
  68. package/src/__tests__/compact-fields.test.ts +31 -0
  69. package/src/__tests__/multi-select-field.test.ts +54 -0
  70. package/src/__tests__/quoted-check-wysiwyg.test.ts +56 -0
  71. package/src/__tests__/recorder-field-authoring.test.ts +92 -0
  72. package/src/__tests__/recorder-wysiwyg-field-host.test.ts +115 -1
  73. package/src/__tests__/step-field.test.ts +54 -1
  74. package/src/components/AimdMultiSelectField.vue +56 -0
  75. package/src/components/AimdRecorder.vue +21 -4
  76. package/src/components/AimdRecorderEditor.vue +4 -0
  77. package/src/components/AimdRecorderWysiwygFieldHost.vue +8 -0
  78. package/src/components/AimdRecorderWysiwygSurface.vue +220 -8
  79. package/src/components/AimdStepCheckField.vue +36 -7
  80. package/src/components/AimdVarField.vue +48 -4
  81. package/src/components/AimdVarTableField.vue +3 -0
  82. package/src/components/index.ts +2 -0
  83. package/src/components/recorderMilkdownPlugin.ts +36 -6
  84. package/src/composables/__tests__/useVarHelpers.test.ts +15 -0
  85. package/src/composables/__tests__/workbenchFieldEditing.test.ts +10 -0
  86. package/src/composables/useFieldPresentation.ts +7 -0
  87. package/src/composables/useFieldRendering.ts +1 -0
  88. package/src/composables/useVarHelpers.ts +20 -101
  89. package/src/composables/workbenchFieldEditing.ts +5 -7
  90. package/src/index.ts +1 -0
  91. package/src/record/validation.ts +6 -0
  92. package/src/styles/recorder-compact.css +45 -0
  93. package/src/styles/recorder-surface.css +14 -5
  94. package/src/styles/recorder.css +4 -0
  95. package/src/type-utils.ts +5 -1
  96. package/src/types.ts +1 -1
  97. package/dist/useCodeBlockRendering-D2viVPtA.js +0 -3158
  98. package/dist/useVarHelpers-DzhBBFdk.js +0 -3525
@@ -1,8 +1,14 @@
1
- import { mount } from '@vue/test-utils'
1
+ import { flushPromises, mount } from '@vue/test-utils'
2
+ import { reactive } from 'vue'
2
3
  import { describe, expect, it, vi } from 'vitest'
3
4
  import AimdRecorderWysiwygFieldHost from '../components/AimdRecorderWysiwygFieldHost.vue'
4
5
  import { createEmptyProtocolRecordData } from '../types'
5
6
  import type { RecorderMilkdownSurfaceState } from '../components/recorderMilkdownPlugin'
7
+ import { createEmptyStepRecordItem } from '../composables/useStepTimers'
8
+
9
+ vi.mock('@airalogy/aimd-editor/vue', () => ({
10
+ AimdEditor: { props: ['modelValue'], template: '<textarea :value="modelValue" />' },
11
+ }))
6
12
 
7
13
  function createSurfaceState(): RecorderMilkdownSurfaceState {
8
14
  return {
@@ -19,6 +25,114 @@ function createSurfaceState(): RecorderMilkdownSurfaceState {
19
25
  }
20
26
 
21
27
  describe('AimdRecorderWysiwygFieldHost', () => {
28
+ it('updates a checkpoint title without resetting checked state, notes or other fields', async () => {
29
+ const state = reactive(createSurfaceState())
30
+ state.fieldDisplay = 'compact'
31
+ state.record.check.safety_ready = { checked: true, annotation: 'Retain note' }
32
+ state.record.var.existing = 'keep'
33
+ state.onUpdateRecord = vi.fn(value => { state.record = value })
34
+ const wrapper = mount(AimdRecorderWysiwygFieldHost, { props: { surfaceState: state, rawContent: '{{check|safety_ready, title="Safety check"}}', displayMode: 'inline' } })
35
+ await vi.waitFor(() => expect(wrapper.find('.aimd-check-field__title').text()).toBe('Safety check'))
36
+ expect(wrapper.find('.aimd-check-field__key').exists()).toBe(false)
37
+ await wrapper.setProps({ rawContent: '{{check|safety_ready, title="Review PPE"}}' })
38
+ await vi.waitFor(() => expect(wrapper.get('.aimd-check-field__title').text()).toBe('Review PPE'))
39
+ expect(state.record.check.safety_ready).toEqual({ checked: true, annotation: 'Retain note' })
40
+ await wrapper.get('[data-rec-focus-key="check:safety_ready:checked"]').setValue(false)
41
+ await flushPromises()
42
+ expect(state.record.check.safety_ready).toMatchObject({ checked: false, annotation: 'Retain note' })
43
+ expect(state.record.var.existing).toBe('keep')
44
+ wrapper.unmount()
45
+ })
46
+
47
+ it('renders a checkpoint badge once without creating a phantom body', async () => {
48
+ const state = reactive(createSurfaceState())
49
+ state.locale = 'zh-CN'
50
+ state.record.var.existing = 'keep'
51
+ state.onUpdateRecord = vi.fn(value => { state.record = value })
52
+ const rawContent = '{{check|safety_ready}}'
53
+ const wrapper = mount(AimdRecorderWysiwygFieldHost, {
54
+ props: { surfaceState: state, rawContent, displayMode: 'inline' },
55
+ })
56
+ await vi.waitFor(() => expect(wrapper.find('[data-rec-focus-key="check:safety_ready:checked"]').exists()).toBe(true))
57
+ expect(wrapper.findAll('.aimd-rec-inline--check .aimd-field__scope').map(node => node.text())).toEqual(['检查点'])
58
+ expect(wrapper.find('.aimd-check-field__body').exists()).toBe(false)
59
+ expect(wrapper.get('.aimd-check-field__key').text()).toBe('safety_ready')
60
+ await wrapper.get('[data-rec-focus-key="check:safety_ready:checked"]').setValue(true)
61
+ await flushPromises()
62
+ expect(state.record.check.safety_ready.checked).toBe(true)
63
+ expect(state.record.var.existing).toBe('keep')
64
+ expect(wrapper.props('rawContent')).toBe(rawContent)
65
+ wrapper.unmount()
66
+ })
67
+
68
+ it('uses document step numbering and preserves filled data when changing a title', async () => {
69
+ const state = reactive(createSurfaceState())
70
+ state.protocolContext = '{{step|prepare}}\n\n{{step|mix, title="Mix"}}\n\n{{step|verify, 2}}'
71
+ state.record.step.mix = { ...createEmptyStepRecordItem(), checked: true, annotation: 'Retain note', elapsed_ms: 5000 }
72
+ state.fieldDisplay = 'compact'
73
+ state.onUpdateRecord = vi.fn(value => { state.record = value })
74
+ const wrapper = mount(AimdRecorderWysiwygFieldHost, {
75
+ props: { surfaceState: state, rawContent: '{{step|mix, title="Mix", check=True}}', displayMode: 'block' },
76
+ })
77
+ await vi.waitFor(() => expect(wrapper.find('.aimd-step-field__title').text()).toBe('Mix'))
78
+ expect(wrapper.get('.aimd-rec-inline__step-num').text()).toBe('2')
79
+ expect(wrapper.find('.aimd-step-field__id').exists()).toBe(false)
80
+ await wrapper.setProps({ rawContent: '{{step|mix, title="Mix gently", check=True}}' })
81
+ await vi.waitFor(() => expect(wrapper.get('.aimd-step-field__title').text()).toBe('Mix gently'))
82
+ expect(state.record.step.mix).toMatchObject({ checked: true, annotation: 'Retain note', elapsed_ms: 5000 })
83
+ expect((wrapper.get('[data-rec-focus-key="step:mix:checked"]').element as HTMLInputElement).checked).toBe(true)
84
+ await wrapper.setProps({ rawContent: '{{step|verify, 2, title="Verify"}}' })
85
+ await vi.waitFor(() => expect(wrapper.get('.aimd-rec-inline__step-num').text()).toBe('2.1'))
86
+ wrapper.unmount()
87
+ })
88
+ it('renders a standalone step header without a phantom body and preserves checkbox updates', async () => {
89
+ const state = reactive(createSurfaceState())
90
+ state.record.var.existing = 'keep'
91
+ state.onUpdateRecord = vi.fn(value => { state.record = value })
92
+ const rawContent = '{{step|prepare, check=True}}'
93
+ const wrapper = mount(AimdRecorderWysiwygFieldHost, {
94
+ props: { surfaceState: state, rawContent, displayMode: 'block' },
95
+ })
96
+ await vi.waitFor(() => expect(wrapper.find('[data-rec-focus-key="step:prepare:checked"]').exists()).toBe(true))
97
+ expect(wrapper.find('.aimd-step-field__body').exists()).toBe(false)
98
+ expect(wrapper.find('.aimd-step-field__main-actions .aimd-step-field__toggle--annotation').exists()).toBe(true)
99
+ await wrapper.get('[data-rec-focus-key="step:prepare:checked"]').setValue(true)
100
+ await flushPromises()
101
+ expect(state.record.step.prepare.checked).toBe(true)
102
+ expect(state.record.var.existing).toBe('keep')
103
+ expect(wrapper.props('rawContent')).toBe(rawContent)
104
+ wrapper.unmount()
105
+ })
106
+
107
+ it('fills real typed Record values in compact mode without changing the field definition', async () => {
108
+ const state = reactive(createSurfaceState())
109
+ state.locale = 'en-US'
110
+ state.fieldDisplay = 'compact'
111
+ state.record.var.other = 'keep me'
112
+ state.onUpdateRecord = vi.fn(value => { state.record = value })
113
+ const rawContent = '{{var|field_1: float, title="Temperature", ge=0}}'
114
+ const wrapper = mount(AimdRecorderWysiwygFieldHost, {
115
+ props: { surfaceState: state, rawContent, displayMode: 'inline' },
116
+ })
117
+ await vi.waitFor(() => expect(wrapper.find('[data-rec-focus-key="var:field_1"]').exists()).toBe(true))
118
+ expect(wrapper.find('.aimd-field__label').exists()).toBe(false)
119
+ expect(wrapper.find('.aimd-recorder-search-toolbar').exists()).toBe(false)
120
+ const input = wrapper.get('[data-rec-focus-key="var:field_1"]')
121
+ expect(input.attributes('aria-label')).toBe('Temperature')
122
+ await input.setValue('37.5')
123
+ await flushPromises()
124
+ expect(state.record.var).toMatchObject({ field_1: 37.5, other: 'keep me' })
125
+ expect(wrapper.props('rawContent')).toBe(rawContent)
126
+ state.fieldDisplay = 'detailed'
127
+ await flushPromises()
128
+ expect(wrapper.get('.aimd-field__key').text()).toBe('field_1')
129
+ await vi.waitFor(() => expect((wrapper.get('[data-rec-focus-key="var:field_1"]').element as HTMLInputElement).value).toBe('37.5'))
130
+ state.readonly = true
131
+ await flushPromises()
132
+ expect(wrapper.get('[data-rec-focus-key="var:field_1"]').attributes('disabled')).toBeDefined()
133
+ wrapper.unmount()
134
+ })
135
+
22
136
  it('renders inline var fields with the real recorder input UI instead of AIMD chips', async () => {
23
137
  const wrapper = mount(AimdRecorderWysiwygFieldHost, {
24
138
  props: {
@@ -1,11 +1,13 @@
1
1
  import { flushPromises, mount } from '@vue/test-utils'
2
- import { h, nextTick, reactive } from 'vue'
2
+ import { Fragment, createCommentVNode, createTextVNode, h, nextTick, reactive } from 'vue'
3
3
  import { afterEach, describe, expect, it, vi } from 'vitest'
4
4
  import type { AimdCheckNode, AimdStepNode } from '@airalogy/aimd-core/types'
5
5
 
6
6
  import { createAimdRecorderMessages } from '../locales'
7
7
  import { AimdCheckField, AimdStepField } from '../components/AimdStepCheckField.vue'
8
8
  import { createEmptyStepRecordItem, startStepTimer } from '../composables/useStepTimers'
9
+ import { fieldDisplayKey } from '../composables/useFieldPresentation'
10
+ import { ref } from 'vue'
9
11
 
10
12
  vi.mock('@airalogy/aimd-editor/vue', async () => {
11
13
  const { defineComponent, h } = await import('vue')
@@ -51,6 +53,29 @@ async function flushStepFieldAsync() {
51
53
  }
52
54
 
53
55
  describe('AimdStepField', () => {
56
+ it('renders titles separately from IDs and hides only metadata in compact mode', async () => {
57
+ const display = ref<'compact' | 'detailed'>('detailed')
58
+ const state = reactive({ ...createEmptyStepRecordItem(), checked: true, annotation: 'Kept note' })
59
+ const wrapper = mount(AimdStepField, {
60
+ props: { ...createBaseProps({ title: 'Prepare sample', check: true }), state },
61
+ global: { provide: { [fieldDisplayKey as symbol]: display } },
62
+ })
63
+ expect(wrapper.get('.aimd-step-field__title').text()).toBe('Prepare sample')
64
+ expect(wrapper.get('.aimd-step-field__id').text()).toBe('prepare')
65
+ expect(wrapper.get('input[type="checkbox"]').attributes('aria-label')).toBe('step 1: Prepare sample')
66
+ display.value = 'compact'
67
+ await nextTick()
68
+ expect(wrapper.find('.aimd-step-field__id').exists()).toBe(false)
69
+ expect(wrapper.get('.aimd-step-field__title').text()).toBe('Prepare sample')
70
+ await wrapper.setProps({ node: { ...createBaseProps().node, title: 'Mix sample', check: true } })
71
+ expect((wrapper.get('input[type="checkbox"]').element as HTMLInputElement).checked).toBe(true)
72
+ expect(state.annotation).toBe('Kept note')
73
+ expect(wrapper.emitted('check-change')).toBeUndefined()
74
+ await wrapper.setProps({ node: createBaseProps().node })
75
+ expect(wrapper.find('.aimd-step-field__title').exists()).toBe(false)
76
+ expect(wrapper.get('.aimd-rec-inline__step-num').text()).toBe('1')
77
+ wrapper.unmount()
78
+ })
54
79
  afterEach(() => {
55
80
  vi.useRealTimers()
56
81
  })
@@ -111,6 +136,34 @@ describe('AimdStepField', () => {
111
136
  expect(wrapper.find('input[type="checkbox"]').exists()).toBe(true)
112
137
  })
113
138
 
139
+ it('keeps notes beside timer controls when the rendered body only contains empty paragraphs', () => {
140
+ const wrapper = mount(AimdStepField, {
141
+ props: {
142
+ ...createBaseProps(), state: createEmptyStepRecordItem(),
143
+ bodyNodes: [h('p'), h('p', [createTextVNode(' '), createCommentVNode('empty')]), h(Fragment, [h('p')])],
144
+ },
145
+ })
146
+ expect(wrapper.find('.aimd-step-field__body').exists()).toBe(false)
147
+ expect(wrapper.find('.aimd-step-field__body-actions').exists()).toBe(false)
148
+ expect(wrapper.find('.aimd-step-field__main-actions .aimd-step-field__toggle--annotation').exists()).toBe(true)
149
+ expect(wrapper.find('.aimd-step-field__main-actions .aimd-step-field__toggle--timer').exists()).toBe(true)
150
+ wrapper.unmount()
151
+ })
152
+
153
+ it('preserves real body content, including images and interactive fields without text', () => {
154
+ const wrapper = mount(AimdStepField, {
155
+ props: {
156
+ ...createBaseProps(), state: createEmptyStepRecordItem(),
157
+ bodyNodes: [h('p', 'Instructions'), h('p', [h('img', { src: 'test.png', alt: 'Equipment' })]), h('p', [h('input')])],
158
+ },
159
+ })
160
+ expect(wrapper.get('.aimd-step-field__body').text()).toContain('Instructions')
161
+ expect(wrapper.find('.aimd-step-field__body img').exists()).toBe(true)
162
+ expect(wrapper.find('.aimd-step-field__body input').exists()).toBe(true)
163
+ expect(wrapper.find('.aimd-step-field__body-action').exists()).toBe(true)
164
+ wrapper.unmount()
165
+ })
166
+
114
167
  it('shows the annotation detail when a note already exists in auto mode', async () => {
115
168
  const state = reactive({
116
169
  ...createEmptyStepRecordItem(),
@@ -0,0 +1,56 @@
1
+ <script setup lang="ts">
2
+ import { ref, watch } from 'vue'
3
+
4
+ const props = defineProps<{
5
+ modelValue: unknown
6
+ options: unknown[]
7
+ label: string
8
+ fieldId: string
9
+ disabled: boolean
10
+ nullable: boolean
11
+ emptyLabel: string
12
+ }>()
13
+ const emit = defineEmits<{
14
+ (e: 'update:modelValue', value: unknown[] | null): void
15
+ (e: 'blur'): void
16
+ }>()
17
+ const selected = ref<unknown[]>([])
18
+ const isUnset = ref(false)
19
+ watch(() => props.modelValue, value => {
20
+ selected.value = Array.isArray(value) ? [...value] : []
21
+ isUnset.value = value === null || value === undefined
22
+ }, { immediate: true })
23
+
24
+ function update(value: unknown, checked: boolean) {
25
+ // Preserve existing order and imported values until the user explicitly removes them.
26
+ selected.value = checked
27
+ ? [...selected.value.filter(item => !Object.is(item, value)), value]
28
+ : selected.value.filter(item => !Object.is(item, value))
29
+ isUnset.value = false
30
+ emit('update:modelValue', [...selected.value])
31
+ }
32
+ function reset() {
33
+ selected.value = []
34
+ isUnset.value = true
35
+ emit('update:modelValue', null)
36
+ }
37
+ </script>
38
+
39
+ <template>
40
+ <span class="aimd-rec-multi-select" role="group" :aria-label="label">
41
+ <label v-for="(option, index) in options" :key="index" class="aimd-rec-multi-select__option">
42
+ <input type="checkbox" :data-rec-focus-key="index === 0 ? `var:${fieldId}` : `var:${fieldId}:${index}`" :checked="selected.some(value => Object.is(value, option))" :disabled="disabled" @change="update(option, ($event.target as HTMLInputElement).checked)" @blur="emit('blur')">
43
+ <span>{{ option === null ? emptyLabel : String(option) }}</span>
44
+ </label>
45
+ <button v-if="nullable" type="button" class="aimd-rec-multi-select__unset" :disabled="disabled || isUnset" @click="reset" @blur="emit('blur')">{{ emptyLabel }}</button>
46
+ </span>
47
+ </template>
48
+
49
+ <style scoped>
50
+ .aimd-rec-multi-select { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; min-width: 0; max-width: 100%; box-sizing: border-box; min-height: 32px; padding: 6px 10px; }
51
+ .aimd-rec-multi-select__option { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; max-width: 100%; cursor: pointer; }
52
+ .aimd-rec-multi-select__option input { flex: 0 0 auto; width: 16px; height: 16px; margin: 0; accent-color: #1769d2; }
53
+ .aimd-rec-multi-select__option span { min-width: 0; overflow-wrap: anywhere; }
54
+ .aimd-rec-multi-select__unset { border: 0; padding: 2px 4px; background: transparent; color: #1769d2; font: inherit; cursor: pointer; }
55
+ .aimd-rec-multi-select__unset:disabled { color: #6b7280; cursor: default; }
56
+ </style>
@@ -1,5 +1,6 @@
1
1
  <script setup lang="ts">
2
- import { computed, defineComponent, h, nextTick, onBeforeUnmount, reactive, ref, watch, type PropType, type VNode, type VNodeChild } from "vue"
2
+ import { computed, defineComponent, h, nextTick, onBeforeUnmount, provide, reactive, ref, watch, type PropType, type VNode, type VNodeChild } from "vue"
3
+ import { fieldDisplayKey } from "../composables/useFieldPresentation"
3
4
  import type {
4
5
  AimdCheckNode,
5
6
  AimdClientAssignerField,
@@ -142,6 +143,8 @@ const props = withDefaults(defineProps<{
142
143
  showSearch?: boolean
143
144
  /** Expands the built-in record search toolbar by default. */
144
145
  searchDefaultExpanded?: boolean
146
+ /** Compact hides field metadata while preserving controls, validation and accessible names. */
147
+ fieldDisplay?: 'compact' | 'detailed'
145
148
 
146
149
  // ── Extension props ──────────────────────────────────────────────────────
147
150
 
@@ -252,6 +255,7 @@ const props = withDefaults(defineProps<{
252
255
  stepDetailDisplay: "auto",
253
256
  showSearch: true,
254
257
  searchDefaultExpanded: false,
258
+ fieldDisplay: 'detailed',
255
259
  fieldMeta: undefined,
256
260
  serverAssigners: undefined,
257
261
  assigners: undefined,
@@ -328,6 +332,7 @@ const autoServerAssignerSignatures = new Map<string, string>()
328
332
  let autoServerAssignerScheduled = false
329
333
 
330
334
  const resolvedLocale = computed(() => resolveAimdRecorderLocale(props.locale))
335
+ provide(fieldDisplayKey, computed(() => props.fieldDisplay))
331
336
  const resolvedMessages = computed(() => createAimdRecorderMessages(resolvedLocale.value, props.messages))
332
337
  const resolvedTypePlugins = computed(() => createAimdTypePlugins(props.typePlugins))
333
338
  const resolvedServerAssigners = computed(() => props.serverAssigners ?? props.assigners)
@@ -1618,7 +1623,7 @@ function isDefaultCheckControlNode(node: unknown): boolean {
1618
1623
  && classNames.includes("aimd-checkbox")
1619
1624
  ) || (
1620
1625
  vnode.type === "span"
1621
- && classNames.includes("aimd-field__label")
1626
+ && (classNames.includes("aimd-field__label") || classNames.includes("aimd-field__scope"))
1622
1627
  )
1623
1628
  }
1624
1629
 
@@ -1649,6 +1654,8 @@ function normalizeCheckBodyNodes(bodyNodes: VNodeChild[] = []): VNodeChild[] {
1649
1654
  return bodyNodes
1650
1655
  }
1651
1656
 
1657
+ const contextStepNumbers = ref<Record<string, string | undefined>>({})
1658
+
1652
1659
  function renderInlineStep(node: AimdStepNode, bodyNodes: VNodeChild[] = []): VNode {
1653
1660
  const id = node.id
1654
1661
  const fieldKey = `step:${id}`
@@ -1666,7 +1673,7 @@ function renderInlineStep(node: AimdStepNode, bodyNodes: VNodeChild[] = []): VNo
1666
1673
  const normalizedBodyNodes = normalizeStepBodyNodes(bodyNodes)
1667
1674
 
1668
1675
  const vnode = h(AimdStepField, {
1669
- node,
1676
+ node: { ...node, step: contextStepNumbers.value[id] ?? node.step },
1670
1677
  state,
1671
1678
  bodyNodes: normalizedBodyNodes,
1672
1679
  disabled,
@@ -1878,6 +1885,7 @@ async function parseAndBuild() {
1878
1885
  const contextFields = props.protocolContext
1879
1886
  ? parseAndExtract(props.protocolContext)
1880
1887
  : undefined
1888
+ contextStepNumbers.value = Object.fromEntries((contextFields?.step_hierarchy ?? []).map(step => [step.id, step.step]))
1881
1889
  collectorValidationContext.value = contextFields
1882
1890
  ? {
1883
1891
  connectors: contextFields.connectors,
@@ -2024,6 +2032,15 @@ watch(
2024
2032
  },
2025
2033
  )
2026
2034
 
2035
+ watch(
2036
+ () => props.fieldDisplay,
2037
+ () => {
2038
+ // Input events keep native controls current without rebuilding every keystroke.
2039
+ // Refresh their VNode props before switching the presentation of those controls.
2040
+ scheduleInlineRebuild()
2041
+ },
2042
+ )
2043
+
2027
2044
  watch(
2028
2045
  () => props.submitted,
2029
2046
  () => {
@@ -2055,7 +2072,7 @@ defineExpose({
2055
2072
  </script>
2056
2073
 
2057
2074
  <template>
2058
- <div class="aimd-protocol-recorder">
2075
+ <div class="aimd-protocol-recorder" :class="{ 'aimd-protocol-recorder--compact': fieldDisplay === 'compact' }">
2059
2076
  <div v-if="renderError" class="aimd-protocol-recorder__error">{{ renderError }}</div>
2060
2077
 
2061
2078
  <template v-else>
@@ -64,6 +64,7 @@ const props = withDefaults(defineProps<{
64
64
  modelValue?: Partial<AimdProtocolRecordData>
65
65
  locale?: string
66
66
  readonly?: boolean
67
+ fieldDisplay?: 'compact' | 'detailed'
67
68
  currentUserName?: string
68
69
  now?: Date | string | number
69
70
  messages?: AimdRecorderMessagesInput
@@ -121,6 +122,7 @@ const props = withDefaults(defineProps<{
121
122
  modelValue: undefined,
122
123
  locale: undefined,
123
124
  readonly: false,
125
+ fieldDisplay: 'detailed',
124
126
  currentUserName: undefined,
125
127
  now: undefined,
126
128
  messages: undefined,
@@ -1483,6 +1485,7 @@ defineExpose({
1483
1485
  :choice-option-explanation-mode="choiceOptionExplanationMode"
1484
1486
  :scale-grade-display-mode="scaleGradeDisplayMode"
1485
1487
  :step-detail-display="stepDetailDisplay"
1488
+ :field-display="fieldDisplay"
1486
1489
  :field-meta="fieldMeta"
1487
1490
  :server-assigners="serverAssigners"
1488
1491
  :assigners="assigners"
@@ -1536,6 +1539,7 @@ defineExpose({
1536
1539
  :choice-option-explanation-mode="choiceOptionExplanationMode"
1537
1540
  :scale-grade-display-mode="scaleGradeDisplayMode"
1538
1541
  :step-detail-display="stepDetailDisplay"
1542
+ :field-display="fieldDisplay"
1539
1543
  :field-meta="fieldMeta"
1540
1544
  :server-assigners="serverAssigners"
1541
1545
  :assigners="assigners"
@@ -26,6 +26,8 @@ const renderedContent = computed(() => (
26
26
  :content="renderedContent"
27
27
  :model-value="surfaceState.record"
28
28
  :readonly="surfaceState.readonly"
29
+ :field-display="surfaceState.fieldDisplay"
30
+ :show-search="false"
29
31
  :current-user-name="surfaceState.currentUserName"
30
32
  :now="surfaceState.now"
31
33
  :locale="surfaceState.locale"
@@ -104,11 +106,17 @@ const renderedContent = computed(() => (
104
106
  display: none;
105
107
  }
106
108
 
109
+ .aimd-recorder-wysiwyg-field-host--inline :deep(.aimd-protocol-recorder__content > p) {
110
+ margin: 0;
111
+ }
112
+
107
113
  .aimd-recorder-wysiwyg-field-host :deep(.aimd-recorder-wysiwyg-field-host__anchor) {
108
114
  display: none;
109
115
  }
110
116
 
111
117
  .aimd-recorder-wysiwyg-field-host--inline :deep(.aimd-protocol-recorder) {
112
118
  width: auto;
119
+ min-width: 0;
120
+ max-width: 100%;
113
121
  }
114
122
  </style>