@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
@@ -7,7 +7,19 @@
7
7
 
8
8
  import { resolveAimdTypePlugin } from '../type-plugins'
9
9
  import { isAimdCodeEditorType } from '../code-types'
10
- import { normalizeAimdTypeName } from '../type-utils'
10
+ import {
11
+ getAimdFileDisplayName,
12
+ getAimdFileInputConfig,
13
+ getAimdFileValueId,
14
+ isAimdAiralogyFileId,
15
+ isAimdFileLikeType,
16
+ isKnownAimdFileTypeName,
17
+ normalizeAimdTypeName,
18
+ toAimdBooleanValue,
19
+ unwrapAimdStructuredValue,
20
+ type AimdAssetKind,
21
+ type AimdFileInputConfig,
22
+ } from '@airalogy/aimd-core/utils'
11
23
  import type {
12
24
  AimdFieldMeta,
13
25
  AimdSelectedFileValue,
@@ -53,191 +65,15 @@ export interface NumericInputAttributes {
53
65
  step?: number
54
66
  }
55
67
 
56
- export type FileInputDisplayKind = "file" | "csv" | "image" | "audio" | "video" | "document" | "text"
57
-
58
- export interface FileInputConfig {
59
- kind: FileInputDisplayKind
60
- accept?: string
61
- badge: string
62
- }
63
-
64
- const FILE_CONFIG_BY_NORMALIZED_TYPE: Record<string, FileInputConfig> = {
65
- file: { kind: "file", badge: "FILE" },
66
- upload: { kind: "file", badge: "FILE" },
67
- csv: { kind: "csv", accept: ".csv,text/csv", badge: "CSV" },
68
- fileidcsv: { kind: "csv", accept: ".csv,text/csv", badge: "CSV" },
69
- image: { kind: "image", accept: "image/*", badge: "IMG" },
70
- fileidpng: { kind: "image", accept: ".png,image/png", badge: "IMG" },
71
- fileidjpg: { kind: "image", accept: ".jpg,.jpeg,image/jpeg", badge: "IMG" },
72
- fileidjpeg: { kind: "image", accept: ".jpg,.jpeg,image/jpeg", badge: "IMG" },
73
- fileidsvg: { kind: "image", accept: ".svg,image/svg+xml", badge: "IMG" },
74
- fileidwebp: { kind: "image", accept: ".webp,image/webp", badge: "IMG" },
75
- fileidtiff: { kind: "image", accept: ".tif,.tiff,image/tiff", badge: "IMG" },
76
- audio: { kind: "audio", accept: "audio/*", badge: "AUD" },
77
- fileidmp3: { kind: "audio", accept: ".mp3,audio/mpeg", badge: "AUD" },
78
- video: { kind: "video", accept: "video/*", badge: "VID" },
79
- fileidmp4: { kind: "video", accept: ".mp4,video/mp4", badge: "VID" },
80
- fileidaimd: { kind: "text", accept: ".aimd,text/plain", badge: "AIMD" },
81
- fileidmd: { kind: "text", accept: ".md,text/markdown,text/plain", badge: "MD" },
82
- fileidtxt: { kind: "text", accept: ".txt,text/plain", badge: "TXT" },
83
- fileidjson: { kind: "text", accept: ".json,application/json", badge: "JSON" },
84
- fileiddocx: { kind: "document", accept: ".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document", badge: "DOC" },
85
- fileidxlsx: { kind: "document", accept: ".xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", badge: "XLS" },
86
- fileidpptx: { kind: "document", accept: ".pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation", badge: "PPT" },
87
- fileidpdf: { kind: "document", accept: ".pdf,application/pdf", badge: "PDF" },
88
- }
89
-
90
- const FILE_KIND_BY_EXTENSION: Record<string, FileInputDisplayKind> = {
91
- csv: "csv",
92
- png: "image",
93
- jpg: "image",
94
- jpeg: "image",
95
- svg: "image",
96
- webp: "image",
97
- tif: "image",
98
- tiff: "image",
99
- mp3: "audio",
100
- wav: "audio",
101
- m4a: "audio",
102
- mp4: "video",
103
- mov: "video",
104
- webm: "video",
105
- aimd: "text",
106
- md: "text",
107
- txt: "text",
108
- json: "text",
109
- pdf: "document",
110
- docx: "document",
111
- xlsx: "document",
112
- pptx: "document",
113
- }
114
-
115
- const FILE_BADGE_BY_KIND: Record<FileInputDisplayKind, string> = {
116
- file: "FILE",
117
- csv: "CSV",
118
- image: "IMG",
119
- audio: "AUD",
120
- video: "VID",
121
- document: "DOC",
122
- text: "TXT",
123
- }
124
-
125
- const MIME_BY_EXTENSION: Record<string, string> = {
126
- csv: "text/csv",
127
- png: "image/png",
128
- jpg: "image/jpeg",
129
- jpeg: "image/jpeg",
130
- svg: "image/svg+xml",
131
- webp: "image/webp",
132
- tif: "image/tiff",
133
- tiff: "image/tiff",
134
- mp3: "audio/mpeg",
135
- wav: "audio/wav",
136
- m4a: "audio/mp4",
137
- mp4: "video/mp4",
138
- webm: "video/webm",
139
- md: "text/markdown",
140
- txt: "text/plain",
141
- aimd: "text/plain",
142
- json: "application/json",
143
- pdf: "application/pdf",
144
- docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
145
- xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
146
- pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
147
- }
148
-
149
- const AIRALOGY_FILE_ID_RE = /^airalogy\.id\.file\.[A-Za-z0-9_-]+$/i
150
-
151
- function getStringFromRecord(record: Record<string, unknown> | undefined, keys: string[]): string | undefined {
152
- if (!record) {
153
- return undefined
154
- }
155
- for (const key of keys) {
156
- const value = record[key]
157
- if (typeof value === "string" && value.trim()) {
158
- return value.trim()
159
- }
160
- }
161
- return undefined
162
- }
163
-
164
- function normalizeFileExtension(value: unknown): string | undefined {
165
- if (typeof value !== "string") {
166
- return undefined
167
- }
168
- const trimmed = value.trim().toLowerCase()
169
- if (!trimmed || trimmed === "*") {
170
- return undefined
171
- }
172
- return trimmed.replace(/^\./, "")
173
- }
174
-
175
- function getConfiguredFileExtension(kwargs?: Record<string, unknown>, fieldMeta?: AimdFieldMeta): string | undefined {
176
- const metaExtension = normalizeFileExtension((fieldMeta as { fileExtension?: unknown } | undefined)?.fileExtension)
177
- if (metaExtension) {
178
- return metaExtension
179
- }
180
- return normalizeFileExtension(kwargs?.file_extension)
181
- ?? normalizeFileExtension(kwargs?.fileExtension)
182
- ?? normalizeFileExtension(kwargs?.extension)
183
- }
184
-
185
- function acceptFromExtension(extension: string): string {
186
- const ext = extension.replace(/^\./, "").toLowerCase()
187
- const mime = MIME_BY_EXTENSION[ext]
188
- return mime ? `.${ext},${mime}` : `.${ext}`
189
- }
190
-
191
- function fileKindFromExtension(extension: string | undefined): FileInputDisplayKind {
192
- if (!extension) {
193
- return "file"
194
- }
195
- return FILE_KIND_BY_EXTENSION[extension] ?? "file"
196
- }
197
-
198
- function isKnownFileTypeName(normalized: string | undefined): boolean {
199
- if (!normalized) {
200
- return false
201
- }
202
- return Boolean(FILE_CONFIG_BY_NORMALIZED_TYPE[normalized])
203
- || normalized.startsWith("fileid")
204
- }
68
+ export type FileInputDisplayKind = AimdAssetKind
69
+ export type FileInputConfig = AimdFileInputConfig
205
70
 
206
71
  export function getFileInputConfig(
207
72
  type: string | undefined,
208
73
  kwargs?: Record<string, unknown>,
209
74
  fieldMeta?: AimdFieldMeta,
210
75
  ): FileInputConfig {
211
- const normalizedInputType = normalizeAimdTypeName(fieldMeta?.inputType)
212
- const normalized = isKnownFileTypeName(normalizedInputType)
213
- ? normalizedInputType
214
- : normalizeVarTypeName(type)
215
- const configuredExtension = getConfiguredFileExtension(kwargs, fieldMeta)
216
- const configuredAccept = normalizeMetaString(fieldMeta?.accept)
217
- ?? getStringFromRecord(kwargs, ["accept", "file_accept", "fileAccept"])
218
- const base = FILE_CONFIG_BY_NORMALIZED_TYPE[normalized]
219
-
220
- if (configuredExtension) {
221
- const kind = fileKindFromExtension(configuredExtension)
222
- return {
223
- kind,
224
- accept: configuredAccept ?? acceptFromExtension(configuredExtension),
225
- badge: base?.badge ?? FILE_BADGE_BY_KIND[kind],
226
- }
227
- }
228
-
229
- if (base) {
230
- return {
231
- ...base,
232
- accept: configuredAccept ?? base.accept,
233
- }
234
- }
235
-
236
- return {
237
- kind: "file",
238
- accept: configuredAccept,
239
- badge: FILE_BADGE_BY_KIND.file,
240
- }
76
+ return getAimdFileInputConfig(type, kwargs, fieldMeta)
241
77
  }
242
78
 
243
79
  export function isFileLikeVarType(
@@ -245,12 +81,7 @@ export function isFileLikeVarType(
245
81
  kwargs?: Record<string, unknown>,
246
82
  fieldMeta?: AimdFieldMeta,
247
83
  ): boolean {
248
- const normalized = normalizeVarTypeName(type)
249
- const normalizedInputType = normalizeAimdTypeName(fieldMeta?.inputType)
250
- return isKnownFileTypeName(normalized)
251
- || isKnownFileTypeName(normalizedInputType)
252
- || Boolean(getConfiguredFileExtension(kwargs, fieldMeta))
253
- || Boolean(normalizeMetaString(fieldMeta?.accept))
84
+ return isAimdFileLikeType(type, kwargs, fieldMeta)
254
85
  }
255
86
 
256
87
  export function createSelectedFileValue(file: File): AimdSelectedFileValue {
@@ -264,53 +95,29 @@ export function createSelectedFileValue(file: File): AimdSelectedFileValue {
264
95
  }
265
96
 
266
97
  export function isAiralogyFileId(value: unknown): value is string {
267
- return typeof value === "string" && AIRALOGY_FILE_ID_RE.test(value)
98
+ return isAimdAiralogyFileId(value)
268
99
  }
269
100
 
270
101
  export function getFileValueId(value: unknown): string | undefined {
271
- const normalized = unwrapStructuredValue(value)
272
- if (typeof normalized === "string") {
273
- return normalized.trim() || undefined
274
- }
275
- if (!normalized || typeof normalized !== "object" || Array.isArray(normalized)) {
276
- return undefined
277
- }
278
- return getStringFromRecord(normalized as Record<string, unknown>, [
279
- "id",
280
- "file_id",
281
- "fileId",
282
- "src",
283
- ])
102
+ return getAimdFileValueId(value)
284
103
  }
285
104
 
286
105
  export function getFileDisplayName(value: unknown): string {
287
- const normalized = unwrapStructuredValue(value)
288
- if (typeof normalized === "string") {
289
- if (isAiralogyFileId(normalized)) {
290
- return ""
291
- }
292
- return normalized
293
- }
294
- if (!normalized || typeof normalized !== "object" || Array.isArray(normalized)) {
295
- return ""
296
- }
297
- const record = normalized as Record<string, unknown>
298
- return getStringFromRecord(record, [
299
- "name",
300
- "fileName",
301
- "file_name",
302
- "filename",
303
- "originalName",
304
- "original_name",
305
- "id",
306
- "file_id",
307
- "src",
308
- "url",
309
- ]) ?? ""
310
- }
311
-
312
- function normalizeMetaString(value: unknown): string | undefined {
313
- return typeof value === "string" && value.trim() ? value.trim() : undefined
106
+ return getAimdFileDisplayName(value, undefined, {
107
+ hideAiralogyFileIds: true,
108
+ keys: [
109
+ "name",
110
+ "fileName",
111
+ "file_name",
112
+ "filename",
113
+ "originalName",
114
+ "original_name",
115
+ "id",
116
+ "file_id",
117
+ "src",
118
+ "url",
119
+ ],
120
+ })
314
121
  }
315
122
 
316
123
  export function getVarEnumSelectValue(options: AimdVarEnumOption[], value: unknown): string {
@@ -376,7 +183,7 @@ function resolveOverrideInputKind(inputType: string | undefined, codeLanguage: s
376
183
  return 'dna'
377
184
  }
378
185
 
379
- if (isKnownFileTypeName(normalized)) {
186
+ if (isKnownAimdFileTypeName(normalized)) {
380
187
  return 'file'
381
188
  }
382
189
 
@@ -400,6 +207,22 @@ export function isNumericVarType(type: string | undefined): boolean {
400
207
  return normalized === "float" || normalized === "int" || normalized === "integer" || normalized === "number"
401
208
  }
402
209
 
210
+ export function isStructuredVarType(type: string | undefined): boolean {
211
+ const raw = typeof type === "string" ? type.trim().toLowerCase() : ""
212
+ const normalized = normalizeVarTypeName(type)
213
+ return normalized === "json"
214
+ || normalized === "list"
215
+ || raw.startsWith("list[")
216
+ || normalized === "array"
217
+ || raw.startsWith("array[")
218
+ || normalized === "dict"
219
+ || raw.startsWith("dict[")
220
+ || normalized === "map"
221
+ || raw.startsWith("map[")
222
+ || normalized === "object"
223
+ || normalized === "record"
224
+ }
225
+
403
226
  export function getVarInputKind(type: string | undefined, options: VarInputKindOptions = {}): VarInputKind {
404
227
  const override = resolveOverrideInputKind(options.inputType, options.codeLanguage)
405
228
  if (override) {
@@ -441,6 +264,10 @@ export function getVarInputKind(type: string | undefined, options: VarInputKindO
441
264
  return "textarea"
442
265
  }
443
266
 
267
+ if (isStructuredVarType(type)) {
268
+ return "textarea"
269
+ }
270
+
444
271
  if (isFileLikeVarType(type, options.kwargs, options.fieldMeta)) {
445
272
  return "file"
446
273
  }
@@ -452,6 +279,20 @@ export function getVarInputKind(type: string | undefined, options: VarInputKindO
452
279
  return "text"
453
280
  }
454
281
 
282
+ function stringifyStructuredInputValue(value: unknown): string {
283
+ if (typeof value === "string") {
284
+ return value
285
+ }
286
+ if (value === null || typeof value === "undefined") {
287
+ return ""
288
+ }
289
+ try {
290
+ return JSON.stringify(value, null, 2)
291
+ } catch {
292
+ return String(value)
293
+ }
294
+ }
295
+
455
296
  function toFiniteNumber(value: unknown): number | undefined {
456
297
  if (typeof value === "number") {
457
298
  return Number.isFinite(value) ? value : undefined
@@ -551,31 +392,11 @@ export function getNumericConstraintViolation(
551
392
  // ---------------------------------------------------------------------------
552
393
 
553
394
  export function unwrapStructuredValue(value: unknown): unknown {
554
- if (value && typeof value === "object" && !Array.isArray(value) && "value" in value) {
555
- return (value as { value: unknown }).value
556
- }
557
- return value
395
+ return unwrapAimdStructuredValue(value)
558
396
  }
559
397
 
560
398
  export function toBooleanValue(value: unknown): boolean {
561
- const normalized = unwrapStructuredValue(value)
562
-
563
- if (typeof normalized === "boolean") {
564
- return normalized
565
- }
566
- if (typeof normalized === "number") {
567
- return normalized !== 0
568
- }
569
- if (typeof normalized === "string") {
570
- const text = normalized.trim().toLowerCase()
571
- if (text === "" || text === "false" || text === "0" || text === "no" || text === "off") {
572
- return false
573
- }
574
- if (text === "true" || text === "1" || text === "yes" || text === "on") {
575
- return true
576
- }
577
- }
578
- return Boolean(normalized)
399
+ return toAimdBooleanValue(value)
579
400
  }
580
401
 
581
402
  export function toDateValue(value: unknown): Date | null {
@@ -735,6 +556,10 @@ export function getVarInputDisplayValue(
735
556
  return getFileDisplayName(normalized)
736
557
  }
737
558
 
559
+ if (isStructuredVarType(options.type)) {
560
+ return stringifyStructuredInputValue(normalized)
561
+ }
562
+
738
563
  if (typeof normalized === "string") {
739
564
  return normalized
740
565
  }
@@ -783,6 +608,18 @@ export function parseVarInputValue(
783
608
  return Number.isNaN(parsed) ? rawValue : parsed
784
609
  }
785
610
 
611
+ if (isStructuredVarType(type)) {
612
+ const text = rawValue.trim()
613
+ if (!text) {
614
+ return ""
615
+ }
616
+ try {
617
+ return JSON.parse(text)
618
+ } catch {
619
+ return rawValue
620
+ }
621
+ }
622
+
786
623
  return rawValue
787
624
  }
788
625
 
package/src/index.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  import './styles/aimd.css'
11
11
  import { AimdProtocolRecorder as DeprecatedAimdProtocolRecorder } from './components'
12
12
 
13
- export { AimdRecorder, AimdRecorderEditor, AimdQuizRecorder } from './components'
13
+ export { AimdAssignerGraph, AimdRecorder, AimdRecorderEditor, AimdQuizRecorder } from './components'
14
14
  export { AimdDnaSequenceField, AimdMarkdownField } from './components'
15
15
  /**
16
16
  * @deprecated Use `AimdRecorder` instead.
@@ -24,7 +24,13 @@ export {
24
24
  export type {
25
25
  AimdProtocolRecordData,
26
26
  AimdAssignerDefinition,
27
+ AimdAssignerGraphData,
28
+ AimdAssignerGraphEdge,
29
+ AimdAssignerGraphLabels,
30
+ AimdAssignerGraphNode,
31
+ AimdAssignerGraphNodeType,
27
32
  AimdAssignerMap,
33
+ AimdAssignerNodeSchemaInfo,
28
34
  AimdAssignerRunner,
29
35
  AimdAssignerRunnerRequest,
30
36
  AimdServerAssignerMap,
@@ -0,0 +1,120 @@
1
+ export type {
2
+ AimdCheckRecordItem,
3
+ AimdDnaSequenceAnnotation,
4
+ AimdDnaSequenceQualifier,
5
+ AimdDnaSequenceSegment,
6
+ AimdDnaSequenceValue,
7
+ AimdProtocolRecordData,
8
+ AimdStepRecordItem,
9
+ AimdStepOrCheckRecordItem,
10
+ } from '../types'
11
+ export { createEmptyProtocolRecordData } from '../types'
12
+
13
+ export {
14
+ applyIncomingRecord,
15
+ applyNormalizedRecord,
16
+ applyPastedVarTableGrid,
17
+ cloneRecordData,
18
+ createEmptyVarTableRow,
19
+ ensureDefaultsFromFields,
20
+ getQuizDefaultValue,
21
+ getRecordDataSignature,
22
+ normalizeCheckFields,
23
+ normalizeCheckLike,
24
+ normalizeIncomingRecord,
25
+ normalizeQuizFields,
26
+ normalizeStepFields,
27
+ normalizeStepLike,
28
+ normalizeVarTableFields,
29
+ normalizeVarTableRows,
30
+ parsePastedVarTableText,
31
+ replaceSection,
32
+ type ApplyVarTablePasteResult,
33
+ type VarTablePastedCell,
34
+ } from '../composables/useRecordState'
35
+
36
+ export {
37
+ createEmptyCheckRecordItem,
38
+ createEmptyStepRecordItem,
39
+ formatStepDuration,
40
+ getProtocolEstimatedDurationMs,
41
+ getProtocolRecordedDurationMs,
42
+ getStepElapsedMs,
43
+ getStepRemainingMs,
44
+ hasRecordedStepDuration,
45
+ isStepTimerRunning,
46
+ isStepTimerWarning,
47
+ normalizeStepTimerState,
48
+ pauseStepTimer,
49
+ resetStepTimer,
50
+ resolveStepTimerMode,
51
+ setStepChecked,
52
+ startStepTimer,
53
+ } from '../composables/useStepTimers'
54
+
55
+ export {
56
+ AIMD_DNA_SEQUENCE_FORMAT,
57
+ calculateDnaSequenceGcPercent,
58
+ collectInvalidDnaSequenceCharacters,
59
+ createEmptyDnaSequenceAnnotation,
60
+ createEmptyDnaSequenceQualifier,
61
+ createEmptyDnaSequenceSegment,
62
+ getDnaSequenceSegmentIssue,
63
+ getNextDnaSequenceAnnotationId,
64
+ normalizeDnaSequenceAnnotation,
65
+ normalizeDnaSequenceName,
66
+ normalizeDnaSequenceQualifier,
67
+ normalizeDnaSequenceSegment,
68
+ normalizeDnaSequenceText,
69
+ normalizeDnaSequenceValue,
70
+ serializeDnaSequenceToGenBank,
71
+ } from '../composables/useDnaSequence'
72
+
73
+ export {
74
+ AIMD_AIRALOGY_FILE_ID_RE,
75
+ AIMD_FILE_BADGE_BY_KIND,
76
+ AIMD_FILE_ID_VALUE_KEYS,
77
+ AIMD_FILE_INPUT_CONFIG_BY_TYPE,
78
+ AIMD_FILE_KIND_BY_EXTENSION,
79
+ AIMD_FILE_REFERENCE_VALUE_KEYS,
80
+ AIMD_MIME_BY_EXTENSION,
81
+ AIMD_RECORD_DATA_SCOPES,
82
+ getAimdAcceptFromExtension,
83
+ getAimdAssetMediaSource,
84
+ getAimdConfiguredFileExtension,
85
+ getAimdDisplayValue,
86
+ getAimdFileDisplayName,
87
+ getAimdFileExtension,
88
+ getAimdFileExtensionFromTypeName,
89
+ getAimdFileInputConfig,
90
+ getAimdFileKindFromExtension,
91
+ getAimdFileKindFromMimeType,
92
+ getAimdFileKindFromType,
93
+ getAimdFileValueId,
94
+ getAimdStringFromRecord,
95
+ inferAimdAssetKind,
96
+ isAimdAiralogyFileId,
97
+ isAimdBooleanType,
98
+ isAimdCodeType,
99
+ isAimdDnaType,
100
+ isAimdEmbeddableAssetUrl,
101
+ isAimdFileLikeType,
102
+ isAimdMarkdownType,
103
+ isAimdPlainRecord,
104
+ isKnownAimdFileTypeName,
105
+ normalizeAimdFileExtension,
106
+ normalizeAimdOptionalTypeName,
107
+ normalizeAimdRecordDataValue,
108
+ normalizeAimdString,
109
+ normalizeAimdTypeName,
110
+ resolveAimdRecordData,
111
+ stringifyAimdDisplayValue,
112
+ toAimdBooleanValue,
113
+ unwrapAimdStructuredValue,
114
+ type AimdAssetKind,
115
+ type AimdAssetLike,
116
+ type AimdFileInputConfig,
117
+ type AimdFileInputMetadata,
118
+ type AimdRecordDataScope,
119
+ type AimdRecordDataValue,
120
+ } from '@airalogy/aimd-core/utils'
@@ -175,6 +175,71 @@
175
175
  transform: translateY(0);
176
176
  }
177
177
 
178
+ .aimd-critic {
179
+ border-radius: 4px;
180
+ padding: 0 0.14em;
181
+ box-decoration-break: clone;
182
+ -webkit-box-decoration-break: clone;
183
+ }
184
+
185
+ .aimd-critic--addition {
186
+ background: rgba(22, 163, 74, 0.13);
187
+ color: #166534;
188
+ text-decoration: none;
189
+ }
190
+
191
+ .aimd-critic--deletion {
192
+ background: rgba(220, 38, 38, 0.1);
193
+ color: #991b1b;
194
+ text-decoration-line: line-through;
195
+ text-decoration-thickness: 0.08em;
196
+ }
197
+
198
+ .aimd-critic--highlight {
199
+ background: rgba(250, 204, 21, 0.36);
200
+ color: inherit;
201
+ }
202
+
203
+ .aimd-critic--substitution {
204
+ background: rgba(99, 102, 241, 0.08);
205
+ }
206
+
207
+ .aimd-critic--substitution .aimd-critic {
208
+ margin-inline: 0.04em;
209
+ }
210
+
211
+ .aimd-critic__replacement-arrow {
212
+ color: #64748b;
213
+ font-size: 0.86em;
214
+ font-weight: 600;
215
+ }
216
+
217
+ .aimd-critic--comment {
218
+ display: inline-flex;
219
+ align-items: baseline;
220
+ gap: 0.34em;
221
+ padding: 0.03em 0.44em;
222
+ border: 1px solid rgba(37, 99, 235, 0.22);
223
+ border-radius: 999px;
224
+ background: rgba(37, 99, 235, 0.09);
225
+ color: #1e3a8a;
226
+ font-size: 0.92em;
227
+ line-height: 1.5;
228
+ vertical-align: baseline;
229
+ }
230
+
231
+ .aimd-critic__comment-label {
232
+ color: #2563eb;
233
+ font-size: 0.78em;
234
+ font-weight: 700;
235
+ letter-spacing: 0.02em;
236
+ text-transform: uppercase;
237
+ }
238
+
239
+ .aimd-critic__comment-body {
240
+ color: inherit;
241
+ }
242
+
178
243
  .aimd-field--var .aimd-field__type {
179
244
  font-size: 12px;
180
245
  color: #7b1fa2;
package/src/type-utils.ts CHANGED
@@ -1,3 +1 @@
1
- export function normalizeAimdTypeName(type: string | undefined): string {
2
- return (type || 'str').trim().toLowerCase().replace(/[\s_-]/g, '')
3
- }
1
+ export { normalizeAimdTypeName } from '@airalogy/aimd-core/utils'
package/src/types.ts CHANGED
@@ -163,6 +163,43 @@ export interface AimdAssignerDefinition {
163
163
  [key: string]: unknown
164
164
  }
165
165
 
166
+ export type AimdAssignerGraphNodeType = "dependent_field" | "assigner" | "assigned_field"
167
+
168
+ export interface AimdAssignerGraphNode {
169
+ name: string
170
+ type: AimdAssignerGraphNodeType
171
+ }
172
+
173
+ export type AimdAssignerGraphEdge = [string, string]
174
+
175
+ export interface AimdAssignerGraphData {
176
+ nodes: AimdAssignerGraphNode[]
177
+ edges: AimdAssignerGraphEdge[]
178
+ }
179
+
180
+ export interface AimdAssignerNodeSchemaInfo {
181
+ title?: string
182
+ type?: string
183
+ format?: string
184
+ description?: string
185
+ }
186
+
187
+ export interface AimdAssignerGraphLabels {
188
+ zoomIn: string
189
+ zoomOut: string
190
+ fitView: string
191
+ fullscreen: string
192
+ close: string
193
+ showTitle: string
194
+ showName: string
195
+ dependentField: string
196
+ assigner: string
197
+ assignedField: string
198
+ empty: string
199
+ loading: string
200
+ fullscreenTitle: string
201
+ }
202
+
166
203
  export interface AimdServerAssignerRunnerRequest {
167
204
  section: Exclude<AimdRecorderFieldType, "quiz">
168
205
  fieldKey: string