@airalogy/aimd-recorder 1.20.0 → 1.22.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 (80) hide show
  1. package/README.md +5 -0
  2. package/README.zh-CN.md +5 -0
  3. package/dist/{AimdCodeField-BQUuM-EF.js → AimdCodeField-BN_0UQMx.js} +34 -32
  4. package/dist/{AimdDnaSequenceField-Cp0cgBYl.js → AimdDnaSequenceField-Bhj28fP8.js} +1 -1
  5. package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-DTdcoNs1.js → AimdEditor.vue_vue_type_style_index_0_lang-D7c01UqN.js} +1040 -976
  6. package/dist/{AimdMarkdownField-D4AEz_mB.js → AimdMarkdownField-GS15pv4z.js} +4 -4
  7. package/dist/{AimdMarkdownNoteField-CSGaShKi.js → AimdMarkdownNoteField-H9WP8tR6.js} +15 -15
  8. package/dist/aimd-recorder.css +1 -1
  9. package/dist/{arc-jL17V0L2.js → arc-B50G9-kH.js} +1 -1
  10. package/dist/{architectureDiagram-3BPJPVTR-CijadmFI.js → architectureDiagram-3BPJPVTR-D9mBEbpY.js} +2 -2
  11. package/dist/{blockDiagram-GPEHLZMM-BPqvb85_.js → blockDiagram-GPEHLZMM-Cs4swgto.js} +4 -4
  12. package/dist/{c4Diagram-AAUBKEIU-i4fqlMXu.js → c4Diagram-AAUBKEIU-C12HKS3r.js} +2 -2
  13. package/dist/{channel-DnnUQTdl.js → channel-D69VnjVz.js} +1 -1
  14. package/dist/{chunk-2J33WTMH-DKKEpdr1.js → chunk-2J33WTMH-oc-89G5c.js} +1 -1
  15. package/dist/{chunk-4BX2VUAB-WvuuiYYH.js → chunk-4BX2VUAB-BDJS9G3r.js} +1 -1
  16. package/dist/{chunk-55IACEB6-B_UkHTnd.js → chunk-55IACEB6-BPl3uHcA.js} +1 -1
  17. package/dist/{chunk-727SXJPM-CR6Pb04P.js → chunk-727SXJPM-pWe-vDGf.js} +5 -5
  18. package/dist/{chunk-AQP2D5EJ-B68Ie417.js → chunk-AQP2D5EJ-D-R5sIr1.js} +3 -3
  19. package/dist/{chunk-FMBD7UC4-CeCGT6rb.js → chunk-FMBD7UC4-bo6Qyom1.js} +1 -1
  20. package/dist/{chunk-ND2GUHAM-BYN-eC_q.js → chunk-ND2GUHAM-DQMvtYV7.js} +1 -1
  21. package/dist/{chunk-QZHKN3VN-BNSp120j.js → chunk-QZHKN3VN-DlCn3HON.js} +1 -1
  22. package/dist/{classDiagram-v2-Q7XG4LA2-Cgbn4w3f.js → classDiagram-4FO5ZUOK-DzUwWFwr.js} +2 -2
  23. package/dist/{classDiagram-4FO5ZUOK-Cgbn4w3f.js → classDiagram-v2-Q7XG4LA2-DzUwWFwr.js} +2 -2
  24. package/dist/components.js +3757 -2910
  25. package/dist/composables.js +84 -80
  26. package/dist/{cose-bilkent-S5V4N54A-TfrsQ2c3.js → cose-bilkent-S5V4N54A-BXLMzfpO.js} +1 -1
  27. package/dist/{dagre-BM42HDAG-BAyvB_JI.js → dagre-BM42HDAG-DHnofIh9.js} +3 -3
  28. package/dist/{diagram-2AECGRRQ-Bijq8bHO.js → diagram-2AECGRRQ-BqTTVPsm.js} +2 -2
  29. package/dist/{diagram-5GNKFQAL-B3ZuTuxm.js → diagram-5GNKFQAL-D5p1UVbw.js} +3 -3
  30. package/dist/{diagram-KO2AKTUF-DrqLeGCI.js → diagram-KO2AKTUF-Uuoz9cFn.js} +2 -2
  31. package/dist/{diagram-LMA3HP47-CCSQH8O0.js → diagram-LMA3HP47-W001U31X.js} +2 -2
  32. package/dist/{diagram-OG6HWLK6-DM5cUEjW.js → diagram-OG6HWLK6-DL516LDr.js} +3 -3
  33. package/dist/{erDiagram-TEJ5UH35-DQhmDdAF.js → erDiagram-TEJ5UH35-CCxgMb67.js} +4 -4
  34. package/dist/{flowDiagram-I6XJVG4X-DrqiPSHI.js → flowDiagram-I6XJVG4X-nXGdmC0O.js} +6 -6
  35. package/dist/{ganttDiagram-6RSMTGT7-DpX_Y2vA.js → ganttDiagram-6RSMTGT7-Bi9Ro7_Z.js} +2 -2
  36. package/dist/{gitGraphDiagram-PVQCEYII-3isOhIyZ.js → gitGraphDiagram-PVQCEYII-w1kNAy4E.js} +3 -3
  37. package/dist/{graph-C30SJlSk.js → graph-CpOkL_eZ.js} +1 -1
  38. package/dist/{index-Dtvv88SS.js → index-Dkrf2LJl.js} +51 -51
  39. package/dist/index.js +62 -58
  40. package/dist/{infoDiagram-5YYISTIA-Cr_MlPvz.js → infoDiagram-5YYISTIA-Bde_w9T1.js} +1 -1
  41. package/dist/{ishikawaDiagram-YF4QCWOH-DydyFn3h.js → ishikawaDiagram-YF4QCWOH-x5M1KR0l.js} +1 -1
  42. package/dist/{journeyDiagram-JHISSGLW-V_5MmeOu.js → journeyDiagram-JHISSGLW-CIDQP8Zm.js} +4 -4
  43. package/dist/{kanban-definition-UN3LZRKU-C_XXCuvp.js → kanban-definition-UN3LZRKU-CKgO7sG8.js} +2 -2
  44. package/dist/{layout-85j-z7Lr.js → layout-BZYprqYR.js} +2 -2
  45. package/dist/{linear-DMtodz-6.js → linear-ClSH2F_v.js} +1 -1
  46. package/dist/{mermaid.core-CkanUCyS.js → mermaid.core-CcRV6K2R.js} +34 -34
  47. package/dist/{mindmap-definition-RKZ34NQL-CyikmuF2.js → mindmap-definition-RKZ34NQL-s3h6uszV.js} +3 -3
  48. package/dist/{pieDiagram-4H26LBE5-CesqzEGg.js → pieDiagram-4H26LBE5-CgiazyWv.js} +3 -3
  49. package/dist/{quadrantDiagram-W4KKPZXB-BsPKPfNd.js → quadrantDiagram-W4KKPZXB-DCPVgHoW.js} +2 -2
  50. package/dist/record.js +19 -19
  51. package/dist/{requirementDiagram-4Y6WPE33-BwB1tQvi.js → requirementDiagram-4Y6WPE33-DE6F9oSB.js} +3 -3
  52. package/dist/{sankeyDiagram-5OEKKPKP-CfSNbWMY.js → sankeyDiagram-5OEKKPKP-DZZoFFr-.js} +1 -1
  53. package/dist/{sequenceDiagram-3UESZ5HK-DZZlUNys.js → sequenceDiagram-3UESZ5HK-DaYEOl60.js} +3 -3
  54. package/dist/{stateDiagram-AJRCARHV-DNJmz_op.js → stateDiagram-AJRCARHV-BmgpHJlH.js} +4 -4
  55. package/dist/{stateDiagram-v2-BHNVJYJU-DVfDNM6l.js → stateDiagram-v2-BHNVJYJU-D49CHQD6.js} +2 -2
  56. package/dist/{timeline-definition-PNZ67QCA-DEUCAg_N.js → timeline-definition-PNZ67QCA-DdVLoCkC.js} +2 -2
  57. package/dist/{useCodeBlockRendering-DF6zm7nf.js → useCodeBlockRendering-CCuoP52e.js} +1241 -1074
  58. package/dist/{vennDiagram-CIIHVFJN-DVDP__od.js → vennDiagram-CIIHVFJN-CCcMKcd7.js} +1 -1
  59. package/dist/{wardleyDiagram-YWT4CUSO-sEtxBd33.js → wardleyDiagram-YWT4CUSO-R4UGgGWY.js} +2 -2
  60. package/dist/{xychartDiagram-2RQKCTM6-DM8QeR5M.js → xychartDiagram-2RQKCTM6-DyFhCubk.js} +2 -2
  61. package/package.json +3 -3
  62. package/src/__tests__/record-search-render.test.ts +108 -0
  63. package/src/__tests__/recorder-assigner-control.test.ts +4 -1
  64. package/src/__tests__/var-field-render.test.ts +556 -43
  65. package/src/components/AimdCodeField.vue +11 -3
  66. package/src/components/AimdQuizRecorder.vue +3 -1
  67. package/src/components/AimdRecorder.vue +52 -1882
  68. package/src/components/AimdRecorderSearchToolbar.vue +258 -0
  69. package/src/components/AimdVarField.vue +589 -17
  70. package/src/components/AimdVarTableField.vue +12 -6
  71. package/src/components/index.ts +1 -0
  72. package/src/composables/__tests__/useVarHelpers.test.ts +214 -7
  73. package/src/composables/index.ts +6 -0
  74. package/src/composables/useFieldRendering.ts +28 -0
  75. package/src/composables/useRecordSearch.ts +299 -0
  76. package/src/composables/useVarHelpers.ts +285 -14
  77. package/src/locales.ts +96 -0
  78. package/src/styles/recorder-surface.css +2374 -0
  79. package/src/styles/recorder.css +1 -0
  80. package/src/types.ts +1 -1
@@ -67,6 +67,8 @@ export interface NumericInputAttributes {
67
67
 
68
68
  export type FileInputDisplayKind = AimdAssetKind
69
69
  export type FileInputConfig = AimdFileInputConfig
70
+ export type ScalarListItemType = "string" | "int" | "float"
71
+ export type ScalarListInputItem = string | number
70
72
 
71
73
  export function getFileInputConfig(
72
74
  type: string | undefined,
@@ -137,11 +139,15 @@ export function getVarEnumSelectValue(options: AimdVarEnumOption[], value: unkno
137
139
  return ""
138
140
  }
139
141
 
140
- export function getVarEnumValueFromSelectValue(options: AimdVarEnumOption[], selectValue: string): unknown {
142
+ export function getVarEnumValueFromSelectValue(
143
+ options: AimdVarEnumOption[],
144
+ selectValue: string,
145
+ emptyValue: unknown = "",
146
+ ): unknown {
141
147
  const index = Number.parseInt(selectValue, 10)
142
148
  return Number.isInteger(index) && index >= 0 && index < options.length
143
149
  ? options[index].value
144
- : ""
150
+ : emptyValue
145
151
  }
146
152
 
147
153
  function resolveOverrideInputKind(inputType: string | undefined, codeLanguage: string | undefined): VarInputKind | undefined {
@@ -179,6 +185,10 @@ function resolveOverrideInputKind(inputType: string | undefined, codeLanguage: s
179
185
  return 'textarea'
180
186
  }
181
187
 
188
+ if (normalized === 'scalarlist' || normalized === 'stringlist' || normalized === 'strlist') {
189
+ return 'scalar-list'
190
+ }
191
+
182
192
  if (normalized === 'dna') {
183
193
  return 'dna'
184
194
  }
@@ -202,14 +212,147 @@ export function normalizeVarTypeName(type: string | undefined): string {
202
212
  return normalizeAimdTypeName(type)
203
213
  }
204
214
 
215
+ function splitTopLevelTypeUnion(annotation: string): string[] {
216
+ const parts: string[] = []
217
+ let depth = 0
218
+ let quote: string | null = null
219
+ let current = ""
220
+
221
+ for (let index = 0; index < annotation.length; index += 1) {
222
+ const char = annotation[index]
223
+ const previous = annotation[index - 1]
224
+
225
+ if (quote) {
226
+ current += char
227
+ if (char === quote && previous !== "\\") {
228
+ quote = null
229
+ }
230
+ continue
231
+ }
232
+
233
+ if (char === "\"" || char === "'") {
234
+ quote = char
235
+ current += char
236
+ continue
237
+ }
238
+
239
+ if (char === "[" || char === "(" || char === "{") {
240
+ depth += 1
241
+ current += char
242
+ continue
243
+ }
244
+
245
+ if (char === "]" || char === ")" || char === "}") {
246
+ depth = Math.max(0, depth - 1)
247
+ current += char
248
+ continue
249
+ }
250
+
251
+ if (char === "|" && depth === 0) {
252
+ parts.push(current.trim())
253
+ current = ""
254
+ continue
255
+ }
256
+
257
+ current += char
258
+ }
259
+
260
+ if (current.trim()) {
261
+ parts.push(current.trim())
262
+ }
263
+
264
+ return parts.length > 0 ? parts : [annotation.trim()]
265
+ }
266
+
267
+ function canonicalizeTypeExpression(type: string | undefined): string {
268
+ return typeof type === "string" ? type.trim().replace(/\s+/g, "").toLowerCase() : ""
269
+ }
270
+
271
+ function unwrapOptionalTypeAnnotation(type: string | undefined): string {
272
+ let raw = typeof type === "string" ? type.trim() : ""
273
+
274
+ for (let index = 0; index < 4; index += 1) {
275
+ const compact = canonicalizeTypeExpression(raw)
276
+ const optionalMatch = compact.match(/^(?:typing\.)?optional\[(.*)\]$/)
277
+ if (optionalMatch) {
278
+ raw = optionalMatch[1]
279
+ continue
280
+ }
281
+
282
+ const unionParts = splitTopLevelTypeUnion(raw)
283
+ if (unionParts.length > 1) {
284
+ const valueParts = unionParts.filter(part => {
285
+ const normalized = canonicalizeTypeExpression(part)
286
+ return normalized !== "none" && normalized !== "null" && normalized !== "undefined"
287
+ })
288
+ if (valueParts.length === 1) {
289
+ raw = valueParts[0]
290
+ continue
291
+ }
292
+ }
293
+
294
+ break
295
+ }
296
+
297
+ return raw
298
+ }
299
+
300
+ export function isNullableVarType(type: string | undefined): boolean {
301
+ const raw = typeof type === "string" ? type.trim() : ""
302
+ if (!raw) {
303
+ return false
304
+ }
305
+
306
+ const compact = canonicalizeTypeExpression(raw)
307
+ if (/^(?:typing\.)?optional\[.*\]$/.test(compact)) {
308
+ return true
309
+ }
310
+
311
+ const unionParts = splitTopLevelTypeUnion(raw)
312
+ return unionParts.length > 1 && unionParts.some(part => {
313
+ const normalized = canonicalizeTypeExpression(part)
314
+ return normalized === "none" || normalized === "null" || normalized === "undefined"
315
+ })
316
+ }
317
+
205
318
  export function isNumericVarType(type: string | undefined): boolean {
206
- const normalized = normalizeVarTypeName(type)
319
+ const normalized = normalizeVarTypeName(unwrapOptionalTypeAnnotation(type))
207
320
  return normalized === "float" || normalized === "int" || normalized === "integer" || normalized === "number"
208
321
  }
209
322
 
323
+ function getScalarListItemTypeFromExpression(type: string | undefined): ScalarListItemType | undefined {
324
+ const normalized = canonicalizeTypeExpression(type).replace(/^typing\./, "")
325
+ if (normalized === "str" || normalized === "string" || normalized === "builtins.str") {
326
+ return "string"
327
+ }
328
+ if (normalized === "int" || normalized === "integer" || normalized === "builtins.int") {
329
+ return "int"
330
+ }
331
+ if (normalized === "float" || normalized === "number" || normalized === "builtins.float") {
332
+ return "float"
333
+ }
334
+ return undefined
335
+ }
336
+
337
+ export function getScalarListItemType(type: string | undefined): ScalarListItemType | undefined {
338
+ const compact = canonicalizeTypeExpression(unwrapOptionalTypeAnnotation(type)).replace(/^typing\./, "")
339
+
340
+ if (compact.endsWith("[]")) {
341
+ return getScalarListItemTypeFromExpression(compact.slice(0, -2))
342
+ }
343
+
344
+ const listMatch = compact.match(/^(?:list|array)\[(.*)\]$/)
345
+ return listMatch ? getScalarListItemTypeFromExpression(listMatch[1]) : undefined
346
+ }
347
+
348
+ export function isScalarListVarType(type: string | undefined): boolean {
349
+ return getScalarListItemType(type) !== undefined
350
+ }
351
+
210
352
  export function isStructuredVarType(type: string | undefined): boolean {
211
- const raw = typeof type === "string" ? type.trim().toLowerCase() : ""
212
- const normalized = normalizeVarTypeName(type)
353
+ const unwrappedType = unwrapOptionalTypeAnnotation(type)
354
+ const raw = canonicalizeTypeExpression(unwrappedType).replace(/^typing\./, "")
355
+ const normalized = normalizeVarTypeName(unwrappedType)
213
356
  return normalized === "json"
214
357
  || normalized === "list"
215
358
  || raw.startsWith("list[")
@@ -234,14 +377,19 @@ export function getVarInputKind(type: string | undefined, options: VarInputKindO
234
377
  return typePlugin.inputKind
235
378
  }
236
379
 
237
- const normalized = normalizeVarTypeName(type)
380
+ if (isScalarListVarType(type)) {
381
+ return "scalar-list"
382
+ }
383
+
384
+ const unwrappedType = unwrapOptionalTypeAnnotation(type)
385
+ const normalized = normalizeVarTypeName(unwrappedType)
238
386
 
239
387
  if (normalized === "float" || normalized === "int" || normalized === "integer" || normalized === "number") {
240
388
  return "number"
241
389
  }
242
390
 
243
391
  if (normalized === "bool" || normalized === "boolean" || normalized === "checkbox") {
244
- return "checkbox"
392
+ return isNullableVarType(type) ? "boolean-select" : "checkbox"
245
393
  }
246
394
 
247
395
  if (normalized === "date") {
@@ -268,11 +416,11 @@ export function getVarInputKind(type: string | undefined, options: VarInputKindO
268
416
  return "textarea"
269
417
  }
270
418
 
271
- if (isFileLikeVarType(type, options.kwargs, options.fieldMeta)) {
419
+ if (isFileLikeVarType(unwrappedType, options.kwargs, options.fieldMeta)) {
272
420
  return "file"
273
421
  }
274
422
 
275
- if (isAimdCodeEditorType(type, { codeLanguage: options.codeLanguage })) {
423
+ if (isAimdCodeEditorType(unwrappedType, { codeLanguage: options.codeLanguage })) {
276
424
  return 'code'
277
425
  }
278
426
 
@@ -293,6 +441,61 @@ function stringifyStructuredInputValue(value: unknown): string {
293
441
  }
294
442
  }
295
443
 
444
+ function normalizeScalarListNumberItem(text: string, itemType: ScalarListItemType): ScalarListInputItem {
445
+ const parsed = Number(text)
446
+ if (!Number.isFinite(parsed)) {
447
+ return text
448
+ }
449
+ if (itemType === "int" && !Number.isInteger(parsed)) {
450
+ return text
451
+ }
452
+ return parsed
453
+ }
454
+
455
+ export function normalizeScalarListInputItems(
456
+ items: unknown[],
457
+ itemType: ScalarListItemType = "string",
458
+ ): ScalarListInputItem[] {
459
+ return items
460
+ .map(item => item === null || typeof item === "undefined" ? "" : String(item).trim())
461
+ .filter(item => item.length > 0)
462
+ .map(item => itemType === "string" ? item : normalizeScalarListNumberItem(item, itemType))
463
+ }
464
+
465
+ export function getScalarListInputItems(value: unknown): string[] {
466
+ const normalized = unwrapStructuredValue(value)
467
+
468
+ if (Array.isArray(normalized)) {
469
+ return normalized.map(item => item === null || typeof item === "undefined" ? "" : String(item))
470
+ }
471
+
472
+ if (typeof normalized === "string") {
473
+ const text = normalized.trim()
474
+ if (!text) {
475
+ return []
476
+ }
477
+ if (text.startsWith("[")) {
478
+ try {
479
+ const parsed = JSON.parse(text)
480
+ if (Array.isArray(parsed)) {
481
+ return parsed.map(item => item === null || typeof item === "undefined" ? "" : String(item))
482
+ }
483
+ } catch {
484
+ // Fall through to plain text handling.
485
+ }
486
+ }
487
+ return text.includes("\n")
488
+ ? text.split(/\r?\n/)
489
+ : [normalized]
490
+ }
491
+
492
+ if (normalized === null || typeof normalized === "undefined") {
493
+ return []
494
+ }
495
+
496
+ return [String(normalized)]
497
+ }
498
+
296
499
  function toFiniteNumber(value: unknown): number | undefined {
297
500
  if (typeof value === "number") {
298
501
  return Number.isFinite(value) ? value : undefined
@@ -548,6 +751,22 @@ export function getVarInputDisplayValue(
548
751
  return typeof normalized === "number" ? normalized : (typeof normalized === "string" ? normalized : "")
549
752
  }
550
753
 
754
+ if (kind === "boolean-select") {
755
+ if (typeof normalized === "boolean") {
756
+ return normalized ? "true" : "false"
757
+ }
758
+ if (typeof normalized === "string") {
759
+ const text = normalized.trim().toLowerCase()
760
+ if (["true", "1", "yes", "on"].includes(text)) {
761
+ return "true"
762
+ }
763
+ if (["false", "0", "no", "off"].includes(text)) {
764
+ return "false"
765
+ }
766
+ }
767
+ return ""
768
+ }
769
+
551
770
  if (kind === "dna") {
552
771
  return typeof normalized === "string" ? normalized : JSON.stringify(normalized)
553
772
  }
@@ -556,6 +775,13 @@ export function getVarInputDisplayValue(
556
775
  return getFileDisplayName(normalized)
557
776
  }
558
777
 
778
+ if (kind === "scalar-list") {
779
+ return JSON.stringify(normalizeScalarListInputItems(
780
+ getScalarListInputItems(normalized),
781
+ getScalarListItemType(options.type) ?? "string",
782
+ ))
783
+ }
784
+
559
785
  if (isStructuredVarType(options.type)) {
560
786
  return stringifyStructuredInputValue(normalized)
561
787
  }
@@ -591,7 +817,12 @@ export function parseVarInputValue(
591
817
  return typePlugin.parseInputValue(context)
592
818
  }
593
819
 
594
- const normalizedType = normalizeVarTypeName(type)
820
+ const nullableType = isNullableVarType(type)
821
+ const normalizedType = normalizeVarTypeName(unwrapOptionalTypeAnnotation(type))
822
+
823
+ if ((kind === "date" || kind === "datetime" || kind === "time") && nullableType && rawValue.trim() === "") {
824
+ return null
825
+ }
595
826
 
596
827
  if (kind === "datetime") {
597
828
  return normalizeDateTimeValueWithTimezone(rawValue)
@@ -600,7 +831,7 @@ export function parseVarInputValue(
600
831
  if (kind === "number") {
601
832
  const text = rawValue.trim()
602
833
  if (!text) {
603
- return ""
834
+ return nullableType ? null : ""
604
835
  }
605
836
  const parsed = normalizedType === "int" || normalizedType === "integer"
606
837
  ? Number.parseInt(text, 10)
@@ -608,10 +839,31 @@ export function parseVarInputValue(
608
839
  return Number.isNaN(parsed) ? rawValue : parsed
609
840
  }
610
841
 
842
+ if (kind === "scalar-list") {
843
+ return normalizeScalarListInputItems(
844
+ getScalarListInputItems(rawValue),
845
+ getScalarListItemType(type) ?? "string",
846
+ )
847
+ }
848
+
849
+ if (kind === "boolean-select") {
850
+ const text = rawValue.trim().toLowerCase()
851
+ if (!text) {
852
+ return null
853
+ }
854
+ if (text === "true") {
855
+ return true
856
+ }
857
+ if (text === "false") {
858
+ return false
859
+ }
860
+ return rawValue
861
+ }
862
+
611
863
  if (isStructuredVarType(type)) {
612
864
  const text = rawValue.trim()
613
865
  if (!text) {
614
- return ""
866
+ return nullableType ? null : ""
615
867
  }
616
868
  try {
617
869
  return JSON.parse(text)
@@ -620,6 +872,10 @@ export function parseVarInputValue(
620
872
  }
621
873
  }
622
874
 
875
+ if (nullableType && rawValue.trim() === "") {
876
+ return null
877
+ }
878
+
623
879
  return rawValue
624
880
  }
625
881
 
@@ -633,7 +889,8 @@ function getVarControlMinWidth(inputKind: VarInputKind): number {
633
889
  case "dna":
634
890
  case "code":
635
891
  case "file":
636
- return 160
892
+ case "scalar-list":
893
+ return inputKind === "scalar-list" ? 220 : 160
637
894
  default:
638
895
  return 0
639
896
  }
@@ -649,6 +906,8 @@ function getVarControlExtraWidth(inputKind: VarInputKind): number {
649
906
  return 28
650
907
  case "file":
651
908
  return 24
909
+ case "scalar-list":
910
+ return 16
652
911
  default:
653
912
  return 4
654
913
  }
@@ -843,10 +1102,22 @@ export function applyVarStackWidth(target: HTMLElement, inputKind: VarInputKind)
843
1102
  return
844
1103
  }
845
1104
 
1105
+ if (inputKind === "scalar-list") {
1106
+ wrapper.style.width = "100%"
1107
+ wrapper.style.maxWidth = "100%"
1108
+ return
1109
+ }
1110
+
1111
+ if (wrapper.closest("table:not(.aimd-rec-inline-table__table):not(.aimd-scale__table)")) {
1112
+ wrapper.style.width = "max-content"
1113
+ wrapper.style.maxWidth = "min(680px, 100%)"
1114
+ return
1115
+ }
1116
+
846
1117
  const labelWidth = measureVarLabelWidth(wrapper)
847
1118
 
848
1119
  let controlWidth = 0
849
- const input = wrapper.querySelector(".aimd-rec-inline__input--stacked, .aimd-rec-inline__textarea--stacked-text, .aimd-rec-inline__file-control") as HTMLElement | null
1120
+ const input = wrapper.querySelector(".aimd-rec-inline__input--stacked, .aimd-rec-inline__textarea--stacked-text, .aimd-rec-inline__file-control, .aimd-rec-inline__scalar-list") as HTMLElement | null
850
1121
  const minWidthPx = Math.max(getVarControlMinWidth(inputKind), getFileControlMinWidth(input))
851
1122
  if (input) {
852
1123
  controlWidth = measureSingleLineControlWidth(input) + getVarControlExtraWidth(inputKind)
package/src/locales.ts CHANGED
@@ -95,6 +95,35 @@ export interface AimdRecorderMessages {
95
95
  replace: string
96
96
  uploadFailed: string
97
97
  }
98
+ scalarList: {
99
+ itemsMode: string
100
+ jsonMode: string
101
+ itemPlaceholder: string
102
+ itemIndex: (index: number) => string
103
+ addItem: string
104
+ removeItem: string
105
+ dragItem: string
106
+ jsonInvalidSyntax: string
107
+ jsonInvalidArray: string
108
+ jsonInvalidItem: string
109
+ }
110
+ boolean: {
111
+ unset: string
112
+ true: string
113
+ false: string
114
+ }
115
+ search: {
116
+ label: string
117
+ fieldLabel: string
118
+ placeholder: string
119
+ allFields: string
120
+ previous: string
121
+ next: string
122
+ clear: string
123
+ collapse: string
124
+ noMatches: string
125
+ matchCount: (current: number, total: number) => string
126
+ }
98
127
  dna: {
99
128
  editMode: string
100
129
  interactiveMode: string
@@ -167,6 +196,7 @@ export interface AimdRecorderMessages {
167
196
  segmentOutOfBounds: (end: number, length: number) => string
168
197
  }
169
198
  common: {
199
+ emptyValue?: string
170
200
  emptyContent: string
171
201
  }
172
202
  }
@@ -279,6 +309,35 @@ const EN_US_MESSAGES: AimdRecorderMessages = {
279
309
  replace: "Replace file",
280
310
  uploadFailed: "File upload failed.",
281
311
  },
312
+ scalarList: {
313
+ itemsMode: "Items",
314
+ jsonMode: "JSON",
315
+ itemPlaceholder: "List item",
316
+ itemIndex: index => `Item ${index}`,
317
+ addItem: "Add item",
318
+ removeItem: "Remove item",
319
+ dragItem: "Drag to reorder",
320
+ jsonInvalidSyntax: "Invalid JSON.",
321
+ jsonInvalidArray: "JSON value must be an array.",
322
+ jsonInvalidItem: "JSON array items do not match this list type.",
323
+ },
324
+ boolean: {
325
+ unset: "Not set",
326
+ true: "True",
327
+ false: "False",
328
+ },
329
+ search: {
330
+ label: "Search record",
331
+ fieldLabel: "Search field",
332
+ placeholder: "Search this record",
333
+ allFields: "All fields",
334
+ previous: "Previous match",
335
+ next: "Next match",
336
+ clear: "Clear search",
337
+ collapse: "Hide",
338
+ noMatches: "No matches",
339
+ matchCount: (current, total) => `${current} / ${total}`,
340
+ },
282
341
  dna: {
283
342
  editMode: "Edit mode",
284
343
  interactiveMode: "Interactive",
@@ -351,6 +410,7 @@ const EN_US_MESSAGES: AimdRecorderMessages = {
351
410
  segmentOutOfBounds: (end, length) => `Segment end ${end} exceeds sequence length ${length}.`,
352
411
  },
353
412
  common: {
413
+ emptyValue: "Not set",
354
414
  emptyContent: "No renderable protocol content.",
355
415
  },
356
416
  }
@@ -436,6 +496,35 @@ const ZH_CN_MESSAGES: AimdRecorderMessages = {
436
496
  replace: "替换文件",
437
497
  uploadFailed: "文件上传失败。",
438
498
  },
499
+ scalarList: {
500
+ itemsMode: "逐项",
501
+ jsonMode: "JSON",
502
+ itemPlaceholder: "列表项",
503
+ itemIndex: index => `第 ${index} 项`,
504
+ addItem: "添加项",
505
+ removeItem: "删除项",
506
+ dragItem: "拖拽排序",
507
+ jsonInvalidSyntax: "JSON 格式无效。",
508
+ jsonInvalidArray: "JSON 值必须是数组。",
509
+ jsonInvalidItem: "JSON 数组项与当前列表类型不匹配。",
510
+ },
511
+ boolean: {
512
+ unset: "未填写",
513
+ true: "是",
514
+ false: "否",
515
+ },
516
+ search: {
517
+ label: "搜索记录",
518
+ fieldLabel: "搜索字段",
519
+ placeholder: "搜索当前记录",
520
+ allFields: "全部字段",
521
+ previous: "上一个匹配",
522
+ next: "下一个匹配",
523
+ clear: "清除搜索",
524
+ collapse: "收起",
525
+ noMatches: "无匹配",
526
+ matchCount: (current, total) => `${current} / ${total}`,
527
+ },
439
528
  dna: {
440
529
  editMode: "编辑模式",
441
530
  interactiveMode: "交互式",
@@ -508,6 +597,7 @@ const ZH_CN_MESSAGES: AimdRecorderMessages = {
508
597
  segmentOutOfBounds: (end, length) => `片段终点 ${end} 超出了序列长度 ${length}。`,
509
598
  },
510
599
  common: {
600
+ emptyValue: "未填写",
511
601
  emptyContent: "没有可渲染的协议内容。",
512
602
  },
513
603
  }
@@ -598,6 +688,12 @@ export function getAimdRecorderScopeLabel(
598
688
  }
599
689
  }
600
690
 
691
+ export function getAimdRecorderEmptyValueLabel(
692
+ messages: Pick<AimdRecorderMessages, "common" | "boolean">,
693
+ ): string {
694
+ return messages.common.emptyValue ?? messages.boolean.unset
695
+ }
696
+
601
697
  export function getAimdRecorderQuizTypeLabel(
602
698
  quizType: string | undefined,
603
699
  messages: Pick<AimdRecorderMessages, "quiz">,