@airalogy/aimd-recorder 1.28.0 → 1.29.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 (71) hide show
  1. package/README.md +4 -0
  2. package/README.zh-CN.md +4 -0
  3. package/dist/{AimdDnaSequenceField-DblYTIq0.js → AimdDnaSequenceField-CC07idJ1.js} +1 -1
  4. package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-4uL-qHII.js → AimdEditor.vue_vue_type_style_index_0_lang-C9xOPWUf.js} +5 -1
  5. package/dist/{AimdEntityRefField-bRM3TRyz.js → AimdEntityRefField-Bc55EWW7.js} +1 -1
  6. package/dist/{AimdEntityRefField.vue_vue_type_script_setup_true_lang-BM5paTdk.js → AimdEntityRefField.vue_vue_type_script_setup_true_lang-B539YY-u.js} +1 -1
  7. package/dist/{AimdMarkdownField-qaWjbybB.js → AimdMarkdownField-DaYdXrEN.js} +3 -3
  8. package/dist/{AimdMarkdownNoteField-B8vZnU6s.js → AimdMarkdownNoteField-DE2eyIeG.js} +2 -2
  9. package/dist/{AimdResourceRefField-Bq2ASMTK.js → AimdResourceRefField-Dv1EfosL.js} +2 -2
  10. package/dist/aimd-recorder.css +1 -1
  11. package/dist/{arc-00d15h7D.js → arc-COg5ULhj.js} +1 -1
  12. package/dist/{architectureDiagram-3BPJPVTR-DKYLI713.js → architectureDiagram-3BPJPVTR-Cl6dfzfF.js} +2 -2
  13. package/dist/{blockDiagram-GPEHLZMM-dNWlyXPI.js → blockDiagram-GPEHLZMM-BACKnDKc.js} +4 -4
  14. package/dist/{c4Diagram-AAUBKEIU-CAqsYcIl.js → c4Diagram-AAUBKEIU-zq3HwKb_.js} +2 -2
  15. package/dist/{channel-4oJLrZcY.js → channel-BJlkYmQY.js} +1 -1
  16. package/dist/{chunk-2J33WTMH-DzoFraaP.js → chunk-2J33WTMH-B7oyQtnK.js} +1 -1
  17. package/dist/{chunk-4BX2VUAB-DXRnEJXi.js → chunk-4BX2VUAB-DVmdXl0Z.js} +1 -1
  18. package/dist/{chunk-55IACEB6-BfMMJ2bK.js → chunk-55IACEB6-C6G6r1Hs.js} +1 -1
  19. package/dist/{chunk-727SXJPM-BLnYDYYi.js → chunk-727SXJPM-DRauMxlM.js} +5 -5
  20. package/dist/{chunk-AQP2D5EJ-gckWU-r5.js → chunk-AQP2D5EJ-CFOFED2g.js} +3 -3
  21. package/dist/{chunk-FMBD7UC4-CQ5X8W3n.js → chunk-FMBD7UC4-D6pbxcrd.js} +1 -1
  22. package/dist/{chunk-ND2GUHAM-EKUg1pFy.js → chunk-ND2GUHAM-CTRvR7V6.js} +1 -1
  23. package/dist/{chunk-QZHKN3VN-C7rc4zcu.js → chunk-QZHKN3VN-JYLI2Fou.js} +1 -1
  24. package/dist/{classDiagram-v2-Q7XG4LA2-EfTWUW7K.js → classDiagram-4FO5ZUOK-CvWmPFSb.js} +2 -2
  25. package/dist/{classDiagram-4FO5ZUOK-EfTWUW7K.js → classDiagram-v2-Q7XG4LA2-CvWmPFSb.js} +2 -2
  26. package/dist/components.js +3577 -3505
  27. package/dist/composables.js +2 -2
  28. package/dist/{cose-bilkent-S5V4N54A-7OZaecIh.js → cose-bilkent-S5V4N54A-g5sJsJsO.js} +1 -1
  29. package/dist/{dagre-BM42HDAG-DTPFiUIQ.js → dagre-BM42HDAG-CgURX0XQ.js} +3 -3
  30. package/dist/{diagram-2AECGRRQ-BqkCMrTN.js → diagram-2AECGRRQ-DkDoyjIE.js} +2 -2
  31. package/dist/{diagram-5GNKFQAL-bzujL8bv.js → diagram-5GNKFQAL-CjmQeZ1p.js} +3 -3
  32. package/dist/{diagram-KO2AKTUF-zAvqbjMt.js → diagram-KO2AKTUF-xkwe4Z-T.js} +2 -2
  33. package/dist/{diagram-LMA3HP47-7i7fJxdU.js → diagram-LMA3HP47-B4XAB0Ul.js} +2 -2
  34. package/dist/{diagram-OG6HWLK6-GC2rMiZ5.js → diagram-OG6HWLK6-DIDrCkjk.js} +3 -3
  35. package/dist/{erDiagram-TEJ5UH35-D2U3IvMI.js → erDiagram-TEJ5UH35-HCGS4huB.js} +4 -4
  36. package/dist/{example-record-DJYZw-ON.js → example-record-6TUyxByY.js} +2 -2
  37. package/dist/{flowDiagram-I6XJVG4X-nieM9Hg0.js → flowDiagram-I6XJVG4X-DCR0zjVf.js} +6 -6
  38. package/dist/{ganttDiagram-6RSMTGT7-zNrnW3u3.js → ganttDiagram-6RSMTGT7-D0cqiqhS.js} +2 -2
  39. package/dist/{gitGraphDiagram-PVQCEYII-DA9UoINV.js → gitGraphDiagram-PVQCEYII-CjEJrOfY.js} +3 -3
  40. package/dist/{graph-CyckuBF1.js → graph-vXOGPp0B.js} +1 -1
  41. package/dist/index.js +5 -5
  42. package/dist/{infoDiagram-5YYISTIA-DUgRU8-y.js → infoDiagram-5YYISTIA-Cwa9CA9R.js} +1 -1
  43. package/dist/{ishikawaDiagram-YF4QCWOH-BaruYTNe.js → ishikawaDiagram-YF4QCWOH-Dtm2EQRM.js} +1 -1
  44. package/dist/{journeyDiagram-JHISSGLW-BHlST22D.js → journeyDiagram-JHISSGLW-Cwsyan_q.js} +4 -4
  45. package/dist/{kanban-definition-UN3LZRKU-BW6pDr5N.js → kanban-definition-UN3LZRKU-Cocu6oQX.js} +2 -2
  46. package/dist/{layout-DhpqmwBF.js → layout-BQZ5CVhn.js} +2 -2
  47. package/dist/{linear-BmZyP-ga.js → linear-Dl1Cl9MO.js} +1 -1
  48. package/dist/{mermaid.core-SBTvkVkQ.js → mermaid.core-CcTsVOub.js} +34 -34
  49. package/dist/{mindmap-definition-RKZ34NQL-C7mDnX8X.js → mindmap-definition-RKZ34NQL-CJD4ZSsv.js} +3 -3
  50. package/dist/{pieDiagram-4H26LBE5-Dax4XYix.js → pieDiagram-4H26LBE5-miM6t9w3.js} +3 -3
  51. package/dist/{quadrantDiagram-W4KKPZXB-tx0eF1c_.js → quadrantDiagram-W4KKPZXB-BbjEmdfP.js} +2 -2
  52. package/dist/record.js +3 -3
  53. package/dist/{requirementDiagram-4Y6WPE33-DoEeWHvY.js → requirementDiagram-4Y6WPE33-Btxs6bPP.js} +3 -3
  54. package/dist/{sankeyDiagram-5OEKKPKP-qUrDMgFF.js → sankeyDiagram-5OEKKPKP-BFlv9Za2.js} +1 -1
  55. package/dist/{sequenceDiagram-3UESZ5HK-DQy8q3qc.js → sequenceDiagram-3UESZ5HK-CzsCwM84.js} +3 -3
  56. package/dist/{stateDiagram-AJRCARHV-Ctcg2io0.js → stateDiagram-AJRCARHV-Cr-X25OO.js} +4 -4
  57. package/dist/{stateDiagram-v2-BHNVJYJU-B0bKxEaj.js → stateDiagram-v2-BHNVJYJU-BU8pS5zo.js} +2 -2
  58. package/dist/{timeline-definition-PNZ67QCA-BRvAr_Ti.js → timeline-definition-PNZ67QCA-CCxtC3I1.js} +2 -2
  59. package/dist/{useFieldRendering-FDuKoylb.js → useFieldRendering-fRL0kBSG.js} +1 -1
  60. package/dist/{useVarHelpers-CnOgtKri.js → useVarHelpers-CC6Jk-Vu.js} +1 -1
  61. package/dist/{validation-CK747BvO.js → validation-qjnL_HTT.js} +1 -1
  62. package/dist/{vennDiagram-CIIHVFJN-Co_TdJKN.js → vennDiagram-CIIHVFJN-DoQdCEMx.js} +1 -1
  63. package/dist/{wardleyDiagram-YWT4CUSO-BFW0djMX.js → wardleyDiagram-YWT4CUSO-3t148oYZ.js} +2 -2
  64. package/dist/{xychartDiagram-2RQKCTM6-DgT1Tjy1.js → xychartDiagram-2RQKCTM6-DCni6kCQ.js} +2 -2
  65. package/package.json +1 -1
  66. package/src/__tests__/field-panel.test.ts +65 -0
  67. package/src/components/AimdRecorder.vue +97 -13
  68. package/src/components/AimdVarField.vue +21 -5
  69. package/src/composables/useFieldPresentation.ts +2 -2
  70. package/src/locales.ts +6 -0
  71. package/src/styles/recorder-compact.css +17 -0
@@ -1,5 +1,5 @@
1
- import { s as a, b as t, a as r, S as s } from "./chunk-AQP2D5EJ-gckWU-r5.js";
2
- import { _ as i } from "./mermaid.core-SBTvkVkQ.js";
1
+ import { s as a, b as t, a as r, S as s } from "./chunk-AQP2D5EJ-CFOFED2g.js";
2
+ import { _ as i } from "./mermaid.core-CcTsVOub.js";
3
3
  var _ = {
4
4
  parser: r,
5
5
  get db() {
@@ -1,5 +1,5 @@
1
- import { _ as o, F as gt, ac as Rt, ad as Ct, ae as Wt, c as pt, l as E, L as Pt, a4 as Bt, af as ft, d as X, E as Vt, ag as Ft, A as zt } from "./mermaid.core-SBTvkVkQ.js";
2
- import { d as ot } from "./arc-00d15h7D.js";
1
+ import { _ as o, F as gt, ac as Rt, ad as Ct, ae as Wt, c as pt, l as E, L as Pt, a4 as Bt, af as ft, d as X, E as Vt, ag as Ft, A as zt } from "./mermaid.core-CcTsVOub.js";
2
+ import { d as ot } from "./arc-COg5ULhj.js";
3
3
  var tt = (function() {
4
4
  var e = /* @__PURE__ */ o(function(k, s, d, l) {
5
5
  for (d = d || {}, l = k.length; l--; d[k[l]] = s) ;
@@ -1,5 +1,5 @@
1
1
  import { reactive as z } from "vue";
2
- import { f as B, b6 as re, a2 as ne, T as oe, b7 as ie, b8 as se, b9 as ae, ba as ce, m as le, a5 as ue, bb as fe, bc as de, a6 as D, Z as L, bd as $, a0 as me, C as pe, B as ge, ag as ye, I as H, q as be, ai as we, H as he, b2 as Ae } from "./useVarHelpers-CnOgtKri.js";
2
+ import { f as B, b6 as re, a2 as ne, T as oe, b7 as ie, b8 as se, b9 as ae, ba as ce, m as le, a5 as ue, bb as fe, bc as de, a6 as D, Z as L, bd as $, a0 as me, C as pe, B as ge, ag as ye, I as H, q as be, ai as we, H as he, b2 as Ae } from "./useVarHelpers-CC6Jk-Vu.js";
3
3
  function x(e) {
4
4
  return typeof e == "string" && e.trim() ? e.trim() : void 0;
5
5
  }
@@ -6164,7 +6164,7 @@ function xu(e, t) {
6164
6164
  `)}
6165
6165
  `;
6166
6166
  }
6167
- const io = sr(() => import("./AimdDnaSequenceField-DblYTIq0.js")), ro = sr(() => import("./AimdMarkdownField-qaWjbybB.js")), no = Ma.map((e) => ({
6167
+ const io = sr(() => import("./AimdDnaSequenceField-CC07idJ1.js")), ro = sr(() => import("./AimdMarkdownField-DaYdXrEN.js")), no = Ma.map((e) => ({
6168
6168
  type: e,
6169
6169
  inputKind: "code"
6170
6170
  }));
@@ -1,4 +1,4 @@
1
- import { bd as Dt, bi as ba, ba as wa, z as Sa, b3 as Pa } from "./useVarHelpers-CnOgtKri.js";
1
+ import { bd as Dt, bi as ba, ba as wa, z as Sa, b3 as Pa } from "./useVarHelpers-CC6Jk-Vu.js";
2
2
  import { g as Bn } from "./_commonjsHelpers-ByX85dGu.js";
3
3
  var Ve = { exports: {} }, Qt = {}, ge = {}, we = {}, Xt = {}, xt = {}, er = {}, pr;
4
4
  function zt() {
@@ -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-SBTvkVkQ.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-CcTsVOub.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-SBTvkVkQ.js";
2
- import { p as Bt } from "./chunk-4BX2VUAB-DXRnEJXi.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-CcTsVOub.js";
2
+ import { p as Bt } from "./chunk-4BX2VUAB-DVmdXl0Z.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-SBTvkVkQ.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-CcTsVOub.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-BmZyP-ga.js";
4
+ import { l as zt } from "./linear-Dl1Cl9MO.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.28.0",
4
+ "version": "1.29.1",
5
5
  "description": "AIMD (Airalogy Markdown) recorder Vue components and UI",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -0,0 +1,65 @@
1
+ import { flushPromises, mount } from '@vue/test-utils'
2
+ import { describe, expect, it, vi } from 'vitest'
3
+ import AimdRecorder from '../components/AimdRecorder.vue'
4
+
5
+ describe('standalone field panel', () => {
6
+ const content = [
7
+ 'Example: `{{var|ignored}}`',
8
+ '{{step|start, title="Prepare"}} {{var|sample: str, title="Label", placeholder="S-01"}}',
9
+ '{{var|photo: FileIdJPG | None = None, title="Label photo"}}',
10
+ '{{check|inspect, title="Inspect label"}} {{check|legacy}}',
11
+ ].join('\n\n')
12
+ it('finishes a pointer activation before an adjacent required-field error changes the layout', async () => {
13
+ const panel = mount(AimdRecorder, { props: {
14
+ content: '{{var|location: str}} {{var|photo: FileIdJPG | None = None}}',
15
+ layout: 'field-panel', validationTriggers: ['blur'],
16
+ } })
17
+ try {
18
+ await flushPromises()
19
+ const target = panel.get('[data-panel-field="var:photo"] button')
20
+ const location = panel.get('[data-rec-focus-key="var:location"]')
21
+ await target.trigger('pointerdown', { button: 0 })
22
+ await location.trigger('blur')
23
+ await flushPromises()
24
+ expect(panel.find('[role=alert]').exists()).toBe(false)
25
+ window.dispatchEvent(new MouseEvent('click'))
26
+ await vi.waitFor(() => expect(panel.find('[role=alert]').exists()).toBe(true))
27
+ } finally {
28
+ panel.unmount()
29
+ }
30
+ })
31
+
32
+ it('uses unique titled fields, keeps authored hints, and navigates by stable keys', async () => {
33
+ const panel = mount(AimdRecorder, { props: { content, layout: 'field-panel', locale: 'en-US' } })
34
+ await flushPromises()
35
+ expect(panel.findAll('[data-panel-field]').map(f => f.attributes('data-panel-field'))).toEqual(['var:sample', 'var:photo'])
36
+ expect(panel.get('[data-rec-focus-key="var:sample"]').attributes('placeholder')).toBe('S-01')
37
+ expect(panel.get('[data-panel-field="var:photo"]').text()).toContain('Optional')
38
+ expect(panel.findAll('.aimd-panel-outline button').map(b => b.text())).toEqual(['Prepare', 'Inspect label', 'legacy'])
39
+ await panel.get('.aimd-panel-outline button').trigger('click')
40
+ expect(panel.emitted('navigate-field')).toEqual([['step:start']])
41
+ await panel.setProps({ panelVariables: ['extra', 'photo', 'photo'], fieldMeta: { 'var:extra': {title:'Additional field'} } })
42
+ await flushPromises()
43
+ expect(panel.findAll('[data-panel-field]').map(f => f.attributes('aria-label'))).toEqual(['Additional field', 'Label photo'])
44
+ })
45
+
46
+ it('shows upload progress, preserves a failed value and emits the confirmed reference on retry', async () => {
47
+ let reject!: (error: Error) => void
48
+ const uploadFile = vi.fn().mockImplementationOnce(() => new Promise((_, fail) => { reject = fail })).mockResolvedValue('airalogy.id.file.test.jpg')
49
+ const panel = mount(AimdRecorder, { props: { content, layout: 'field-panel', uploadFile, locale: 'zh-CN' } })
50
+ await flushPromises()
51
+ expect(panel.get('.aimd-panel-upload button').text()).toContain('JPG')
52
+ const input = panel.get('input[type=file]')
53
+ const file = new File(['photo'], 'label.jpg', {type:'image/jpeg'})
54
+ Object.defineProperty(input.element, 'files', { value: [file] })
55
+ await input.trigger('change')
56
+ expect(panel.get('[role=status]').text()).toBe('上传中…')
57
+ expect(panel.emitted('field-change')).toBeUndefined()
58
+ reject(new Error('offline'))
59
+ await flushPromises()
60
+ expect(panel.find('.aimd-rec-file-field__error').exists()).toBe(true)
61
+ await input.trigger('change')
62
+ await flushPromises()
63
+ expect(panel.emitted('field-change')?.[0]?.[0]).toMatchObject({ fieldKey:'photo', value:'airalogy.id.file.test.jpg' })
64
+ })
65
+ })
@@ -145,6 +145,10 @@ const props = withDefaults(defineProps<{
145
145
  searchDefaultExpanded?: boolean
146
146
  /** Compact hides field metadata while preserving controls, validation and accessible names. */
147
147
  fieldDisplay?: 'compact' | 'detailed'
148
+ /** A standalone form projection of this protocol, using the same record and adapters. */
149
+ layout?: 'protocol' | 'field-panel'
150
+ /** Optional explicit field order, including variables declared only in the host schema. */
151
+ panelVariables?: string[]
148
152
 
149
153
  // ── Extension props ──────────────────────────────────────────────────────
150
154
 
@@ -256,6 +260,7 @@ const props = withDefaults(defineProps<{
256
260
  showSearch: true,
257
261
  searchDefaultExpanded: false,
258
262
  fieldDisplay: 'detailed',
263
+ layout: 'protocol',
259
264
  fieldMeta: undefined,
260
265
  serverAssigners: undefined,
261
266
  assigners: undefined,
@@ -286,6 +291,7 @@ const emit = defineEmits<{
286
291
  (e: "fields-change", fields: ExtractedAimdFields): void
287
292
  /** Parse / render error */
288
293
  (e: "error", message: string): void
294
+ (e: "navigate-field", fieldKey: string): void
289
295
  /** Local record validation completed. */
290
296
  (e: "validation", result: AimdRecorderValidationResult): void
291
297
 
@@ -332,7 +338,8 @@ const autoServerAssignerSignatures = new Map<string, string>()
332
338
  let autoServerAssignerScheduled = false
333
339
 
334
340
  const resolvedLocale = computed(() => resolveAimdRecorderLocale(props.locale))
335
- provide(fieldDisplayKey, computed(() => props.fieldDisplay))
341
+ const inPanel = computed(() => props.layout === "field-panel")
342
+ provide(fieldDisplayKey, computed(() => inPanel.value ? "panel" : props.fieldDisplay))
336
343
  const resolvedMessages = computed(() => createAimdRecorderMessages(resolvedLocale.value, props.messages))
337
344
  const resolvedTypePlugins = computed(() => createAimdTypePlugins(props.typePlugins))
338
345
  const resolvedServerAssigners = computed(() => props.serverAssigners ?? props.assigners)
@@ -872,8 +879,45 @@ async function validateField(
872
879
  return result
873
880
  }
874
881
 
882
+ // A blur error can move the next control between pointerdown and click.
883
+ let panelGesture: AbortController | undefined
884
+ let panelValidationTimer: ReturnType<typeof setTimeout> | undefined
885
+ const pendingPanelBlurs = new Set<string>()
886
+
887
+ function endPanelGesture() {
888
+ panelGesture?.abort()
889
+ panelGesture = undefined
890
+ clearTimeout(panelValidationTimer)
891
+ for (const key of pendingPanelBlurs) void validateField(key, { trigger: "blur" })
892
+ pendingPanelBlurs.clear()
893
+ }
894
+
895
+ function beginPanelGesture(event: PointerEvent) {
896
+ if (!inPanel.value || event.button !== 0) return
897
+ endPanelGesture()
898
+ const view = (event.currentTarget as HTMLElement).ownerDocument.defaultView
899
+ if (!view) return
900
+ panelGesture = new AbortController()
901
+ const options = { capture: true, signal: panelGesture.signal }
902
+ const afterClick = () => {
903
+ clearTimeout(panelValidationTimer)
904
+ panelValidationTimer = setTimeout(endPanelGesture, 0)
905
+ }
906
+ view.addEventListener("click", afterClick, options)
907
+ // Some gestures finish outside the panel and never dispatch a click.
908
+ view.addEventListener("pointerup", () => {
909
+ panelValidationTimer = setTimeout(endPanelGesture, 350)
910
+ }, options)
911
+ view.addEventListener("pointercancel", endPanelGesture, options)
912
+ view.addEventListener("blur", endPanelGesture, { signal: panelGesture.signal })
913
+ }
914
+
875
915
  function triggerFieldValidation(trigger: Exclude<AimdRecorderValidationTrigger, "submit">, fieldKey: string) {
876
916
  if (!props.validationTriggers.includes(trigger)) return
917
+ if (trigger === "blur" && panelGesture) {
918
+ pendingPanelBlurs.add(fieldKey)
919
+ return
920
+ }
877
921
  void validateField(fieldKey, { trigger })
878
922
  }
879
923
 
@@ -1841,12 +1885,42 @@ function renderInlineQuiz(node: AimdQuizNode): VNode {
1841
1885
  // Rebuild pipeline
1842
1886
  // ---------------------------------------------------------------------------
1843
1887
 
1888
+ function buildPanelFields(nodes: Map<string, AimdVarNode>): VNode[] {
1889
+ const vars = props.panelVariables ?? [...nodes.keys()]
1890
+ return [...new Set(vars)].map(id => {
1891
+ const node: AimdVarNode = nodes.get(id) ?? { type: "aimd", fieldType: "var", scope: "var", id, raw: "" }
1892
+ const key = `var:${id}`
1893
+ const title = effectiveFieldMeta.value[key]?.title || String(node.definition?.kwargs?.title || id)
1894
+ const required = requiredFieldKeys.value.has(key)
1895
+ return h("div", { key, class: "aimd-panel-field", role: "group", "aria-label": title, "data-panel-field": key }, [
1896
+ h("div", { class: "aimd-panel-label" }, [
1897
+ title, h("small", required ? resolvedMessages.value.common.required : resolvedMessages.value.common.optional),
1898
+ ]),
1899
+ renderInlineVar(node),
1900
+ ])
1901
+ })
1902
+ }
1903
+
1904
+ const panelOutline = computed(() => {
1905
+ const fields = extractedFields.value
1906
+ const steps = new Map(fields.step_hierarchy?.map(field => [field.id, field.title]))
1907
+ const checks = new Map(fields.check_definitions?.map(field => [field.id, field.title]))
1908
+ return [
1909
+ ...fields.var_table.map(field => ({ key: `var_table:${field.id}`, title: field.title || field.id })),
1910
+ ...fields.step.map(id => ({ key: `step:${id}`, title: steps.get(id) || id })),
1911
+ ...fields.check.map(id => ({ key: `check:${id}`, title: checks.get(id) || id })),
1912
+ ...fields.quiz.map(field => ({ key: `quiz:${field.id}`, title: field.title || field.id })),
1913
+ ]
1914
+ })
1915
+
1844
1916
  async function rebuildInlineNodes(
1845
1917
  expectedRequestId?: number,
1846
1918
  focusSnapshot?: FocusSnapshot | null,
1847
1919
  expectedInlineRequestId?: number,
1848
1920
  ) {
1849
1921
  recordInitializedDuringRender = false
1922
+ const panelNodes = new Map<string, AimdVarNode>()
1923
+ const panel = inPanel.value
1850
1924
  const rendered = await renderToVue(props.content || "", {
1851
1925
  locale: resolvedLocale.value,
1852
1926
  groupStepBodies: true,
@@ -1863,11 +1937,15 @@ async function rebuildInlineNodes(
1863
1937
  pre: codeBlockPreRenderer,
1864
1938
  },
1865
1939
  aimdRenderers: {
1866
- var: node => renderInlineVar(node as AimdVarNode),
1867
- var_table: node => renderInlineVarTable(node as AimdVarTableNode),
1868
- step: (node, _ctx, children) => renderInlineStep(node as AimdStepNode, children),
1869
- check: (node, _ctx, children) => renderInlineCheck(node as AimdCheckNode, children),
1870
- quiz: node => renderInlineQuiz(node as AimdQuizNode),
1940
+ var: node => {
1941
+ if (!panel) return renderInlineVar(node as AimdVarNode)
1942
+ if (!panelNodes.has(node.id)) panelNodes.set(node.id, node as AimdVarNode)
1943
+ return h("span")
1944
+ },
1945
+ var_table: node => panel ? h("span") : renderInlineVarTable(node as AimdVarTableNode),
1946
+ step: (node, _ctx, children) => panel ? h("span") : renderInlineStep(node as AimdStepNode, children),
1947
+ check: (node, _ctx, children) => panel ? h("span") : renderInlineCheck(node as AimdCheckNode, children),
1948
+ quiz: node => panel ? h("span") : renderInlineQuiz(node as AimdQuizNode),
1871
1949
  },
1872
1950
  })
1873
1951
 
@@ -1878,7 +1956,7 @@ async function rebuildInlineNodes(
1878
1956
  return
1879
1957
  }
1880
1958
 
1881
- inlineNodes.value = rendered.nodes
1959
+ inlineNodes.value = panel ? buildPanelFields(panelNodes) : rendered.nodes
1882
1960
  await nextTick()
1883
1961
  restoreFocusSnapshot(contentRoot.value, focusSnapshot ?? null)
1884
1962
 
@@ -2042,7 +2120,7 @@ watch(
2042
2120
  )
2043
2121
 
2044
2122
  watch(
2045
- () => props.fieldDisplay,
2123
+ () => [props.fieldDisplay, props.layout, props.panelVariables],
2046
2124
  () => {
2047
2125
  // Input events keep native controls current without rebuilding every keystroke.
2048
2126
  // Refresh their VNode props before switching the presentation of those controls.
@@ -2058,6 +2136,8 @@ watch(
2058
2136
  )
2059
2137
 
2060
2138
  onBeforeUnmount(() => {
2139
+ pendingPanelBlurs.clear()
2140
+ endPanelGesture()
2061
2141
  collectorRuntime.stopAll({ resetPermissions: true })
2062
2142
  for (const controller of serverAssignerAbortControllers.values()) {
2063
2143
  controller.abort()
@@ -2073,6 +2153,7 @@ defineExpose({
2073
2153
  validateField,
2074
2154
  clearValidation,
2075
2155
  focusFirstInvalidField,
2156
+ focusField: focusInvalidField,
2076
2157
  runClientAssigner: clientAssignerRunner.triggerClientAssigner,
2077
2158
  runManualClientAssigners: clientAssignerRunner.triggerManualClientAssigners,
2078
2159
  startCollector: collectorRuntime.start,
@@ -2081,12 +2162,12 @@ defineExpose({
2081
2162
  </script>
2082
2163
 
2083
2164
  <template>
2084
- <div class="aimd-protocol-recorder" :class="{ 'aimd-protocol-recorder--compact': fieldDisplay === 'compact' }">
2165
+ <div class="aimd-protocol-recorder" :class="{ 'aimd-protocol-recorder--compact': inPanel || fieldDisplay === 'compact', 'aimd-recorder-panel': inPanel }">
2085
2166
  <div v-if="renderError" class="aimd-protocol-recorder__error">{{ renderError }}</div>
2086
2167
 
2087
2168
  <template v-else>
2088
2169
  <AimdRecorderSearchToolbar
2089
- v-if="showRecordSearchToolbar"
2170
+ v-if="!inPanel && showRecordSearchToolbar"
2090
2171
  v-model:field-key="recordSearch.fieldKey.value"
2091
2172
  v-model:query="recordSearch.query.value"
2092
2173
  :field-refs="recordSearch.fieldRefs.value"
@@ -2101,7 +2182,7 @@ defineExpose({
2101
2182
  @previous="recordSearch.focusPreviousMatch"
2102
2183
  />
2103
2184
 
2104
- <div v-if="showProtocolTimingSummary" class="aimd-protocol-recorder__timing">
2185
+ <div v-if="!inPanel && showProtocolTimingSummary" class="aimd-protocol-recorder__timing">
2105
2186
  <span
2106
2187
  v-if="protocolEstimatedDurationMs > 0"
2107
2188
  class="aimd-protocol-recorder__timing-pill aimd-protocol-recorder__timing-pill--estimate"
@@ -2116,11 +2197,14 @@ defineExpose({
2116
2197
  </span>
2117
2198
  </div>
2118
2199
 
2119
- <div v-if="inlineNodes.length" ref="contentRoot" class="aimd-protocol-recorder__content aimd-renderer">
2200
+ <div v-if="inlineNodes.length" ref="contentRoot" class="aimd-protocol-recorder__content aimd-renderer" @pointerdown.capture="beginPanelGesture">
2120
2201
  <InlineNodesOutlet :nodes="inlineNodes" />
2121
2202
  </div>
2122
2203
 
2123
- <div v-else class="aimd-protocol-recorder__empty">{{ resolvedMessages.common.emptyContent }}</div>
2204
+ <div v-else-if="!inPanel || !panelOutline.length" class="aimd-protocol-recorder__empty">{{ resolvedMessages.common.emptyContent }}</div>
2205
+ <div v-if="inPanel && panelOutline.length" class="aimd-panel-outline">
2206
+ <button v-for="entry in panelOutline" :key="entry.key" type="button" @click="emit('navigate-field', entry.key)">{{ entry.title }}</button>
2207
+ </div>
2124
2208
  </template>
2125
2209
  </div>
2126
2210
  </template>
@@ -521,6 +521,7 @@ export default defineComponent({
521
521
  const checkboxValue = ref(toBooleanValue(props.value))
522
522
  watch(() => props.value, value => { checkboxValue.value = toBooleanValue(value) })
523
523
  const fileUploadError = ref("")
524
+ const uploading = ref(false)
524
525
  const csvPreview = ref<CsvPreviewState | null>(null)
525
526
  const resolvedFileInfo = ref<FileDisplayInfo | null>(null)
526
527
  const lastSelectedFileInfo = ref<FileDisplayInfo | null>(null)
@@ -713,11 +714,12 @@ export default defineComponent({
713
714
  const input = event.target as HTMLInputElement
714
715
  const file = input.files?.[0]
715
716
  input.value = ""
716
- if (!file) {
717
+ if (!file || uploading.value) {
717
718
  return
718
719
  }
719
720
 
720
721
  fileUploadError.value = ""
722
+ uploading.value = true
721
723
  const fileConfig = getFileInputConfig(type, node.definition?.kwargs, meta)
722
724
  try {
723
725
  const uploadedValue = props.uploadFile
@@ -747,6 +749,8 @@ export default defineComponent({
747
749
  })
748
750
  } catch {
749
751
  fileUploadError.value = props.messages.file.uploadFailed
752
+ } finally {
753
+ uploading.value = false
750
754
  }
751
755
  }
752
756
 
@@ -773,7 +777,7 @@ export default defineComponent({
773
777
  const optional = props.markOptional && !props.required
774
778
  ? h('span', { class: 'aimd-field__optional-marker' }, props.messages.common.optional)
775
779
  : null
776
- if (fieldDisplay.value === 'compact') {
780
+ if (fieldDisplay.value !== 'detailed') {
777
781
  const actions = renderHeaderAssignerActions(headerAction)
778
782
  return actions || optional ? h('span', { class: 'aimd-rec-inline__compact-actions' }, [optional, actions]) : null
779
783
  }
@@ -930,7 +934,7 @@ export default defineComponent({
930
934
  },
931
935
  onBlur: onVarBlur,
932
936
  }),
933
- fieldDisplay.value === 'compact'
937
+ fieldDisplay.value !== 'detailed'
934
938
  ? h('span', { class: 'aimd-rec-inline__boolean-state' }, checkboxValue.value ? props.messages.boolean.true : props.messages.boolean.false)
935
939
  : null,
936
940
  ]),
@@ -1055,6 +1059,11 @@ export default defineComponent({
1055
1059
  const displayInfo = resolvedFileInfo.value
1056
1060
  const fileName = displayInfo?.name || getFileDisplayName(props.value)
1057
1061
  const hasFileValue = Boolean(fileId || fileName)
1062
+ const panel = fieldDisplay.value === "panel"
1063
+ const chooseLabel = fileConfig.kind === "image" ? props.messages.file.uploadPhoto : props.messages.file.choose
1064
+ const extensions = fileConfig.accept?.split(",").map(part => part.trim()).filter(part => part.startsWith("."))
1065
+ const formats = extensions?.map(ext => ext.slice(1).toUpperCase()).join(" / ")
1066
+ const panelLabel = formats ? `${chooseLabel} (${formats})` : chooseLabel
1058
1067
  const displayName = fileName || (hasFileValue ? props.messages.file.selected : placeholder || props.messages.file.choose)
1059
1068
  const resolvedUrl = displayInfo?.url || (fileId && props.resolveFile
1060
1069
  ? props.resolveFile(fileId)
@@ -1068,7 +1077,7 @@ export default defineComponent({
1068
1077
  "aria-label": accessibleLabel,
1069
1078
  type: "file",
1070
1079
  accept: fileConfig.accept,
1071
- disabled,
1080
+ disabled: disabled || uploading.value,
1072
1081
  onChange: onFileChange,
1073
1082
  onBlur: onVarBlur,
1074
1083
  })
@@ -1204,7 +1213,13 @@ export default defineComponent({
1204
1213
  ])
1205
1214
  : null,
1206
1215
  ])
1207
- : h("label", {
1216
+ : panel ? h("span", { class: "aimd-panel-upload" }, [
1217
+ fileInput,
1218
+ h("button", {
1219
+ type: "button", disabled: disabled || uploading.value,
1220
+ onClick: (event: MouseEvent) => (event.currentTarget as HTMLElement).parentElement?.querySelector("input")?.click(),
1221
+ }, panelLabel),
1222
+ ]) : h("label", {
1208
1223
  class: [
1209
1224
  "aimd-rec-file-field__trigger",
1210
1225
  disabled ? "aimd-rec-file-field__trigger--disabled" : undefined,
@@ -1215,6 +1230,7 @@ export default defineComponent({
1215
1230
  fileBadge,
1216
1231
  fileTitle,
1217
1232
  ]),
1233
+ uploading.value ? h("span", { role: "status" }, props.messages.file.uploading) : null,
1218
1234
  fileUploadError.value
1219
1235
  ? h("span", { class: "aimd-rec-file-field__error" }, fileUploadError.value)
1220
1236
  : null,
@@ -1,7 +1,7 @@
1
1
  import { inject, ref, type InjectionKey, type Ref } from 'vue'
2
2
 
3
- export const fieldDisplayKey: InjectionKey<Readonly<Ref<'compact' | 'detailed'>>> = Symbol('aimd-field-display')
3
+ export const fieldDisplayKey: InjectionKey<Readonly<Ref<'compact' | 'detailed' | 'panel'>>> = Symbol('aimd-field-display')
4
4
 
5
5
  export function useFieldPresentation() {
6
- return inject(fieldDisplayKey, ref<'compact' | 'detailed'>('detailed'))
6
+ return inject(fieldDisplayKey, ref<'compact' | 'detailed' | 'panel'>('detailed'))
7
7
  }
package/src/locales.ts CHANGED
@@ -88,6 +88,8 @@ export interface AimdRecorderMessages {
88
88
  }
89
89
  file: {
90
90
  choose: string
91
+ uploadPhoto: string
92
+ uploading: string
91
93
  selected: string
92
94
  clear: string
93
95
  open: string
@@ -364,6 +366,8 @@ const EN_US_MESSAGES: AimdRecorderMessages = {
364
366
  },
365
367
  file: {
366
368
  choose: "Choose file",
369
+ uploadPhoto: "Upload photo",
370
+ uploading: "Uploading…",
367
371
  selected: "Selected file",
368
372
  clear: "Clear file",
369
373
  open: "Open file",
@@ -609,6 +613,8 @@ const ZH_CN_MESSAGES: AimdRecorderMessages = {
609
613
  },
610
614
  file: {
611
615
  choose: "选择文件",
616
+ uploadPhoto: "上传照片",
617
+ uploading: "上传中…",
612
618
  selected: "已选择文件",
613
619
  clear: "清除文件",
614
620
  open: "打开文件",
@@ -43,3 +43,20 @@
43
43
  background: #f8fafb;
44
44
  border-bottom-color: #e4e9ef;
45
45
  }
46
+
47
+ .aimd-recorder-panel .aimd-panel-field { min-width: 0; margin-bottom: 0.875rem; }
48
+ .aimd-panel-label { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline; margin-bottom: 0.25rem; overflow-wrap: anywhere; }
49
+ .aimd-panel-label small { font-size: 0.8em; color: var(--aimd-text-muted, #586577); }
50
+ .aimd-recorder-panel .aimd-panel-field .aimd-rec-inline--var-stacked:not(.aimd-rec-inline--var-stacked--checkbox) {
51
+ min-width: 100%; margin-inline: 0; box-sizing: border-box;
52
+ }
53
+ .aimd-recorder-panel .aimd-panel-upload { display: inline-flex; }
54
+ .aimd-panel-upload button, .aimd-panel-outline button {
55
+ font: inherit; color: inherit; cursor: pointer; padding: 0.4em 0.7em; background: transparent;
56
+ border: 1px solid var(--aimd-border-color, #bdc7d2); border-radius: 5px; text-align: start;
57
+ }
58
+ .aimd-panel-upload button:disabled { opacity: 0.6; cursor: default; }
59
+ .aimd-panel-outline { display: grid; gap: 0.25rem; }
60
+ .aimd-panel-outline button { border: 0; justify-self: start; overflow-wrap: anywhere; max-width: 100%; }
61
+ .aimd-panel-outline button:hover { text-decoration: underline; }
62
+ .aimd-recorder-panel .aimd-rec-file-field__preview img { max-height: 120px; object-fit: contain; }