@airalogy/aimd-recorder 1.17.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.
- package/README.md +42 -10
- package/README.zh-CN.md +42 -10
- package/dist/AimdCodeField-BQUuM-EF.js +182 -0
- package/dist/{AimdDnaSequenceField-D6ZgCDpp.js → AimdDnaSequenceField-TBKunqU_.js} +2 -2
- package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-B5Tq4zPV.js → AimdEditor.vue_vue_type_style_index_0_lang-tdh0dJNa.js} +3922 -3829
- package/dist/AimdMarkdownField-DmNX2g4j.js +254 -0
- package/dist/AimdMarkdownNoteField-B5ruzmwS.js +259 -0
- package/dist/{_commonjsHelpers-CZXJ37nu.js → _commonjsHelpers-B5RozER-.js} +2 -2
- package/dist/aimd-recorder.css +1 -1
- package/dist/arc-B-vsgEXF.js +83 -0
- package/dist/architectureDiagram-3BPJPVTR-BwPNOtNH.js +4692 -0
- package/dist/blockDiagram-GPEHLZMM-CMUI4kKc.js +2425 -0
- package/dist/c4Diagram-AAUBKEIU-Cpmfsy_s.js +1577 -0
- package/dist/channel-DlMAXHQK.js +5 -0
- package/dist/chunk-2J33WTMH-DP9BS2ux.js +19 -0
- package/dist/chunk-4BX2VUAB-ncsOeLMb.js +8 -0
- package/dist/chunk-55IACEB6-C7wHk4B7.js +8 -0
- package/dist/chunk-727SXJPM-Caa5aVUO.js +1528 -0
- package/dist/chunk-AQP2D5EJ-CL8egKqD.js +1387 -0
- package/dist/chunk-FMBD7UC4-heVR6BSA.js +19 -0
- package/dist/chunk-ND2GUHAM-BYH-wC2J.js +68 -0
- package/dist/chunk-QZHKN3VN-Bx2K7vkq.js +15 -0
- package/dist/classDiagram-4FO5ZUOK-BLLfLYy0.js +16 -0
- package/dist/classDiagram-v2-Q7XG4LA2-BLLfLYy0.js +16 -0
- package/dist/components.js +3776 -2247
- package/dist/composables.js +96 -70
- package/dist/cose-bilkent-S5V4N54A-E1YmM_xr.js +2609 -0
- package/dist/cytoscape.esm-r59gEWFs.js +18710 -0
- package/dist/dagre-BM42HDAG-BsXpQirH.js +445 -0
- package/dist/defaultLocale-BgPVtth8.js +171 -0
- package/dist/diagram-2AECGRRQ-CamqbWlY.js +217 -0
- package/dist/diagram-5GNKFQAL-DZyRFcOC.js +123 -0
- package/dist/diagram-KO2AKTUF-CmkGcy7R.js +461 -0
- package/dist/diagram-LMA3HP47-IdDwQPZ-.js +142 -0
- package/dist/diagram-OG6HWLK6-t0LBcUIU.js +528 -0
- package/dist/erDiagram-TEJ5UH35-DJBY2iZG.js +899 -0
- package/dist/flowDiagram-I6XJVG4X-DE4MzPPk.js +1628 -0
- package/dist/ganttDiagram-6RSMTGT7-CmAc35Yw.js +2707 -0
- package/dist/gitGraphDiagram-PVQCEYII-DDQZ5flw.js +815 -0
- package/dist/graph-BsJ8-1Pq.js +1510 -0
- package/dist/index.js +110 -83
- package/dist/infoDiagram-5YYISTIA-DSZjFR5g.js +24 -0
- package/dist/init-DjUOC4st.js +16 -0
- package/dist/ishikawaDiagram-YF4QCWOH-DCO9dx2L.js +621 -0
- package/dist/journeyDiagram-JHISSGLW-b-PpuBqg.js +834 -0
- package/dist/kanban-definition-UN3LZRKU-BjclDuJZ.js +724 -0
- package/dist/katex-DNob3HGn.js +11690 -0
- package/dist/layout-D4wqKu72.js +1703 -0
- package/dist/linear-Voc3BJib.js +259 -0
- package/dist/mermaid.core-Dt_VbeGP.js +15940 -0
- package/dist/mindmap-definition-RKZ34NQL-B3vrXRVY.js +827 -0
- package/dist/ordinal-B6-f3MAq.js +61 -0
- package/dist/pieDiagram-4H26LBE5-DFpWxSxk.js +163 -0
- package/dist/quadrantDiagram-W4KKPZXB-BYHcrGoB.js +1024 -0
- package/dist/record.js +1199 -0
- package/dist/requirementDiagram-4Y6WPE33-C-FgWrRz.js +882 -0
- package/dist/sankeyDiagram-5OEKKPKP-IwN0Evji.js +847 -0
- package/dist/sequenceDiagram-3UESZ5HK-_OnqhBO2.js +2891 -0
- package/dist/stateDiagram-AJRCARHV-BRLv0Zcw.js +263 -0
- package/dist/stateDiagram-v2-BHNVJYJU-BofX0AdS.js +16 -0
- package/dist/timeline-definition-PNZ67QCA-C-DpPLpw.js +1055 -0
- package/dist/{useFieldRendering-xLajJhyA.js → useCodeBlockRendering-DoTZaJTW.js} +1528 -1725
- package/dist/useMonacoAutoHeight-D4T-El3J.js +66 -0
- package/dist/vennDiagram-CIIHVFJN-zTHQR9Oq.js +1557 -0
- package/dist/wardley-L42UT6IY-D7b2ujEZ.js +22512 -0
- package/dist/wardleyDiagram-YWT4CUSO-au5koizO.js +675 -0
- package/dist/xychartDiagram-2RQKCTM6-BNf12P8z.js +1342 -0
- package/package.json +13 -8
- package/src/__tests__/assigner-graph.test.ts +82 -0
- package/src/__tests__/assigner-runner-dependent-data.test.ts +32 -0
- package/src/__tests__/markdown-field.test.ts +150 -1
- package/src/__tests__/markdown-note-field.test.ts +86 -3
- package/src/__tests__/recorder-assigner-control.test.ts +993 -0
- package/src/__tests__/recorder-editor.test.ts +17 -0
- package/src/__tests__/recorder-markdown-assigner-integration.test.ts +49 -0
- package/src/__tests__/step-field.test.ts +47 -1
- package/src/__tests__/type-plugins.test.ts +1 -0
- package/src/__tests__/var-field-render.test.ts +806 -1
- package/src/components/AimdAssignerGraph.vue +816 -0
- package/src/components/AimdCodeField.vue +24 -5
- package/src/components/AimdMarkdownField.vue +556 -11
- package/src/components/AimdMarkdownNoteField.vue +241 -30
- package/src/components/AimdRecorder.vue +1619 -99
- package/src/components/AimdRecorderEditor.vue +276 -8
- package/src/components/AimdRecorderWysiwygFieldHost.vue +6 -0
- package/src/components/AimdRecorderWysiwygSurface.vue +32 -0
- package/src/components/AimdStepCheckField.vue +82 -18
- package/src/components/AimdVarField.vue +694 -25
- package/src/components/AimdVarTableField.vue +325 -138
- package/src/components/icons/AimdAssignerCalculatorIcon.vue +18 -0
- package/src/components/icons/AimdAssignerCloudStatusIcon.vue +22 -0
- package/src/components/index.ts +9 -1
- package/src/components/recorderMilkdownPlugin.ts +14 -0
- package/src/composables/__tests__/useRecordState.test.ts +86 -0
- package/src/composables/__tests__/useVarHelpers.test.ts +175 -0
- package/src/composables/index.ts +28 -1
- package/src/composables/useAssignerRunner.ts +376 -0
- package/src/composables/useCodeBlockRendering.ts +51 -0
- package/src/composables/useFieldRendering.ts +32 -4
- package/src/composables/useMonacoAutoHeight.ts +127 -0
- package/src/composables/useRecordState.ts +22 -3
- package/src/composables/useVarHelpers.ts +237 -32
- package/src/index.ts +20 -1
- package/src/locales.ts +45 -0
- package/src/record/index.ts +120 -0
- package/src/styles/aimd.css +216 -1
- package/src/type-plugins.ts +7 -0
- package/src/type-utils.ts +1 -3
- package/src/types.ts +130 -2
- package/dist/AimdCodeField-DC3DPvgc.js +0 -172
- package/dist/AimdMarkdownField-BJ20QtO8.js +0 -67
- package/dist/AimdMarkdownNoteField-DwAQhoyk.js +0 -186
|
@@ -7,8 +7,27 @@
|
|
|
7
7
|
|
|
8
8
|
import { resolveAimdTypePlugin } from '../type-plugins'
|
|
9
9
|
import { isAimdCodeEditorType } from '../code-types'
|
|
10
|
-
import {
|
|
11
|
-
|
|
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'
|
|
23
|
+
import type {
|
|
24
|
+
AimdFieldMeta,
|
|
25
|
+
AimdSelectedFileValue,
|
|
26
|
+
AimdTypePlugin,
|
|
27
|
+
AimdTypePluginParseContext,
|
|
28
|
+
AimdTypePluginValueContext,
|
|
29
|
+
AimdVarInputKind,
|
|
30
|
+
} from '../types'
|
|
12
31
|
|
|
13
32
|
// ---------------------------------------------------------------------------
|
|
14
33
|
// Types
|
|
@@ -19,6 +38,8 @@ export type VarInputKind = AimdVarInputKind
|
|
|
19
38
|
export interface VarInputKindOptions {
|
|
20
39
|
inputType?: string
|
|
21
40
|
codeLanguage?: string
|
|
41
|
+
kwargs?: Record<string, unknown>
|
|
42
|
+
fieldMeta?: AimdFieldMeta
|
|
22
43
|
typePlugin?: AimdTypePlugin
|
|
23
44
|
typePlugins?: AimdTypePlugin[]
|
|
24
45
|
}
|
|
@@ -26,9 +47,10 @@ export interface VarInputKindOptions {
|
|
|
26
47
|
export interface VarInputValueOptions extends VarInputKindOptions {
|
|
27
48
|
type?: string
|
|
28
49
|
nodeFieldKey?: string
|
|
29
|
-
fieldMeta?: Record<string, unknown>
|
|
30
50
|
}
|
|
31
51
|
|
|
52
|
+
export type AimdVarEnumOption = NonNullable<AimdFieldMeta["enumOptions"]>[number]
|
|
53
|
+
|
|
32
54
|
export interface AimdNumericFieldConstraints {
|
|
33
55
|
gt?: number
|
|
34
56
|
ge?: number
|
|
@@ -43,6 +65,85 @@ export interface NumericInputAttributes {
|
|
|
43
65
|
step?: number
|
|
44
66
|
}
|
|
45
67
|
|
|
68
|
+
export type FileInputDisplayKind = AimdAssetKind
|
|
69
|
+
export type FileInputConfig = AimdFileInputConfig
|
|
70
|
+
|
|
71
|
+
export function getFileInputConfig(
|
|
72
|
+
type: string | undefined,
|
|
73
|
+
kwargs?: Record<string, unknown>,
|
|
74
|
+
fieldMeta?: AimdFieldMeta,
|
|
75
|
+
): FileInputConfig {
|
|
76
|
+
return getAimdFileInputConfig(type, kwargs, fieldMeta)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function isFileLikeVarType(
|
|
80
|
+
type: string | undefined,
|
|
81
|
+
kwargs?: Record<string, unknown>,
|
|
82
|
+
fieldMeta?: AimdFieldMeta,
|
|
83
|
+
): boolean {
|
|
84
|
+
return isAimdFileLikeType(type, kwargs, fieldMeta)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function createSelectedFileValue(file: File): AimdSelectedFileValue {
|
|
88
|
+
return {
|
|
89
|
+
format: "airalogy_selected_file_v1",
|
|
90
|
+
name: file.name,
|
|
91
|
+
type: file.type,
|
|
92
|
+
size: file.size,
|
|
93
|
+
lastModified: file.lastModified,
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function isAiralogyFileId(value: unknown): value is string {
|
|
98
|
+
return isAimdAiralogyFileId(value)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function getFileValueId(value: unknown): string | undefined {
|
|
102
|
+
return getAimdFileValueId(value)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function getFileDisplayName(value: unknown): string {
|
|
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
|
+
})
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function getVarEnumSelectValue(options: AimdVarEnumOption[], value: unknown): string {
|
|
124
|
+
const normalized = unwrapStructuredValue(value)
|
|
125
|
+
const exactIndex = options.findIndex(option => Object.is(option.value, normalized))
|
|
126
|
+
if (exactIndex >= 0) {
|
|
127
|
+
return String(exactIndex)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (normalized !== undefined && normalized !== null) {
|
|
131
|
+
const stringIndex = options.findIndex(option => String(option.value) === String(normalized))
|
|
132
|
+
if (stringIndex >= 0) {
|
|
133
|
+
return String(stringIndex)
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return ""
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function getVarEnumValueFromSelectValue(options: AimdVarEnumOption[], selectValue: string): unknown {
|
|
141
|
+
const index = Number.parseInt(selectValue, 10)
|
|
142
|
+
return Number.isInteger(index) && index >= 0 && index < options.length
|
|
143
|
+
? options[index].value
|
|
144
|
+
: ""
|
|
145
|
+
}
|
|
146
|
+
|
|
46
147
|
function resolveOverrideInputKind(inputType: string | undefined, codeLanguage: string | undefined): VarInputKind | undefined {
|
|
47
148
|
if (isAimdCodeEditorType(undefined, { inputType, codeLanguage })) {
|
|
48
149
|
return 'code'
|
|
@@ -82,8 +183,8 @@ function resolveOverrideInputKind(inputType: string | undefined, codeLanguage: s
|
|
|
82
183
|
return 'dna'
|
|
83
184
|
}
|
|
84
185
|
|
|
85
|
-
if (normalized
|
|
86
|
-
return '
|
|
186
|
+
if (isKnownAimdFileTypeName(normalized)) {
|
|
187
|
+
return 'file'
|
|
87
188
|
}
|
|
88
189
|
|
|
89
190
|
if (normalized === 'text' || normalized === 'string') {
|
|
@@ -106,6 +207,22 @@ export function isNumericVarType(type: string | undefined): boolean {
|
|
|
106
207
|
return normalized === "float" || normalized === "int" || normalized === "integer" || normalized === "number"
|
|
107
208
|
}
|
|
108
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
|
+
|
|
109
226
|
export function getVarInputKind(type: string | undefined, options: VarInputKindOptions = {}): VarInputKind {
|
|
110
227
|
const override = resolveOverrideInputKind(options.inputType, options.codeLanguage)
|
|
111
228
|
if (override) {
|
|
@@ -147,6 +264,14 @@ export function getVarInputKind(type: string | undefined, options: VarInputKindO
|
|
|
147
264
|
return "textarea"
|
|
148
265
|
}
|
|
149
266
|
|
|
267
|
+
if (isStructuredVarType(type)) {
|
|
268
|
+
return "textarea"
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if (isFileLikeVarType(type, options.kwargs, options.fieldMeta)) {
|
|
272
|
+
return "file"
|
|
273
|
+
}
|
|
274
|
+
|
|
150
275
|
if (isAimdCodeEditorType(type, { codeLanguage: options.codeLanguage })) {
|
|
151
276
|
return 'code'
|
|
152
277
|
}
|
|
@@ -154,6 +279,20 @@ export function getVarInputKind(type: string | undefined, options: VarInputKindO
|
|
|
154
279
|
return "text"
|
|
155
280
|
}
|
|
156
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
|
+
|
|
157
296
|
function toFiniteNumber(value: unknown): number | undefined {
|
|
158
297
|
if (typeof value === "number") {
|
|
159
298
|
return Number.isFinite(value) ? value : undefined
|
|
@@ -253,31 +392,11 @@ export function getNumericConstraintViolation(
|
|
|
253
392
|
// ---------------------------------------------------------------------------
|
|
254
393
|
|
|
255
394
|
export function unwrapStructuredValue(value: unknown): unknown {
|
|
256
|
-
|
|
257
|
-
return (value as { value: unknown }).value
|
|
258
|
-
}
|
|
259
|
-
return value
|
|
395
|
+
return unwrapAimdStructuredValue(value)
|
|
260
396
|
}
|
|
261
397
|
|
|
262
398
|
export function toBooleanValue(value: unknown): boolean {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
if (typeof normalized === "boolean") {
|
|
266
|
-
return normalized
|
|
267
|
-
}
|
|
268
|
-
if (typeof normalized === "number") {
|
|
269
|
-
return normalized !== 0
|
|
270
|
-
}
|
|
271
|
-
if (typeof normalized === "string") {
|
|
272
|
-
const text = normalized.trim().toLowerCase()
|
|
273
|
-
if (text === "" || text === "false" || text === "0" || text === "no" || text === "off") {
|
|
274
|
-
return false
|
|
275
|
-
}
|
|
276
|
-
if (text === "true" || text === "1" || text === "yes" || text === "on") {
|
|
277
|
-
return true
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
return Boolean(normalized)
|
|
399
|
+
return toAimdBooleanValue(value)
|
|
281
400
|
}
|
|
282
401
|
|
|
283
402
|
export function toDateValue(value: unknown): Date | null {
|
|
@@ -433,6 +552,14 @@ export function getVarInputDisplayValue(
|
|
|
433
552
|
return typeof normalized === "string" ? normalized : JSON.stringify(normalized)
|
|
434
553
|
}
|
|
435
554
|
|
|
555
|
+
if (kind === "file") {
|
|
556
|
+
return getFileDisplayName(normalized)
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
if (isStructuredVarType(options.type)) {
|
|
560
|
+
return stringifyStructuredInputValue(normalized)
|
|
561
|
+
}
|
|
562
|
+
|
|
436
563
|
if (typeof normalized === "string") {
|
|
437
564
|
return normalized
|
|
438
565
|
}
|
|
@@ -481,6 +608,18 @@ export function parseVarInputValue(
|
|
|
481
608
|
return Number.isNaN(parsed) ? rawValue : parsed
|
|
482
609
|
}
|
|
483
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
|
+
|
|
484
623
|
return rawValue
|
|
485
624
|
}
|
|
486
625
|
|
|
@@ -493,6 +632,7 @@ function getVarControlMinWidth(inputKind: VarInputKind): number {
|
|
|
493
632
|
case "textarea":
|
|
494
633
|
case "dna":
|
|
495
634
|
case "code":
|
|
635
|
+
case "file":
|
|
496
636
|
return 160
|
|
497
637
|
default:
|
|
498
638
|
return 0
|
|
@@ -507,11 +647,28 @@ function getVarControlExtraWidth(inputKind: VarInputKind): number {
|
|
|
507
647
|
return 32
|
|
508
648
|
case "time":
|
|
509
649
|
return 28
|
|
650
|
+
case "file":
|
|
651
|
+
return 24
|
|
510
652
|
default:
|
|
511
653
|
return 4
|
|
512
654
|
}
|
|
513
655
|
}
|
|
514
656
|
|
|
657
|
+
function getFileControlMinWidth(input: HTMLElement | null): number {
|
|
658
|
+
if (!input?.classList.contains("aimd-rec-inline__file-control")) {
|
|
659
|
+
return 0
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
switch (input.dataset.fileKind) {
|
|
663
|
+
case "image":
|
|
664
|
+
return 360
|
|
665
|
+
case "csv":
|
|
666
|
+
return 280
|
|
667
|
+
default:
|
|
668
|
+
return 220
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
|
|
515
672
|
export function calculateVarStackWidth(name: string, inputKind: VarInputKind): string {
|
|
516
673
|
const labelChars = Math.max(name.length + 7, 10)
|
|
517
674
|
const approximateCharWidth = 8
|
|
@@ -576,9 +733,43 @@ function measureLabelTokenWidth(token: HTMLElement): number {
|
|
|
576
733
|
return textWidth + horizontal
|
|
577
734
|
}
|
|
578
735
|
|
|
736
|
+
function getElementHorizontalSpace(element: HTMLElement): number {
|
|
737
|
+
if (typeof window === "undefined") {
|
|
738
|
+
return 0
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
const computed = window.getComputedStyle(element)
|
|
742
|
+
return parsePx(computed.paddingLeft)
|
|
743
|
+
+ parsePx(computed.paddingRight)
|
|
744
|
+
+ parsePx(computed.borderLeftWidth)
|
|
745
|
+
+ parsePx(computed.borderRightWidth)
|
|
746
|
+
+ parsePx(computed.marginLeft)
|
|
747
|
+
+ parsePx(computed.marginRight)
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
function measureFieldNameWidth(name: HTMLElement): number {
|
|
751
|
+
const title = name.querySelector(".aimd-field__title") as HTMLElement | null
|
|
752
|
+
const key = name.querySelector(".aimd-field__key") as HTMLElement | null
|
|
753
|
+
const visibleTokenWidth = Math.max(
|
|
754
|
+
title ? measureLabelTokenWidth(title) : 0,
|
|
755
|
+
key ? measureLabelTokenWidth(key) : 0,
|
|
756
|
+
)
|
|
757
|
+
|
|
758
|
+
if (visibleTokenWidth > 0) {
|
|
759
|
+
return visibleTokenWidth + getElementHorizontalSpace(name)
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
return measureLabelTokenWidth(name)
|
|
763
|
+
}
|
|
764
|
+
|
|
579
765
|
export function measureVarLabelWidth(wrapper: HTMLElement): number {
|
|
580
766
|
const scope = wrapper.querySelector(".aimd-field__scope--var") as HTMLElement | null
|
|
767
|
+
const name = wrapper.querySelector(".aimd-field__name") as HTMLElement | null
|
|
581
768
|
const id = wrapper.querySelector(".aimd-field__id") as HTMLElement | null
|
|
769
|
+
if (scope && name) {
|
|
770
|
+
return measureLabelTokenWidth(scope) + measureFieldNameWidth(name) + 4
|
|
771
|
+
}
|
|
772
|
+
|
|
582
773
|
if (scope && id) {
|
|
583
774
|
return measureLabelTokenWidth(scope) + measureLabelTokenWidth(id) + 4
|
|
584
775
|
}
|
|
@@ -587,7 +778,7 @@ export function measureVarLabelWidth(wrapper: HTMLElement): number {
|
|
|
587
778
|
return fallbackLabel ? fallbackLabel.scrollWidth + 2 : 0
|
|
588
779
|
}
|
|
589
780
|
|
|
590
|
-
export function measureSingleLineControlWidth(input:
|
|
781
|
+
export function measureSingleLineControlWidth(input: HTMLElement): number {
|
|
591
782
|
if (typeof window === "undefined") {
|
|
592
783
|
return input.scrollWidth
|
|
593
784
|
}
|
|
@@ -604,12 +795,22 @@ export function measureSingleLineControlWidth(input: HTMLInputElement | HTMLText
|
|
|
604
795
|
const fontStyle = computed.fontStyle || "normal"
|
|
605
796
|
ctx.font = `${fontStyle} ${fontWeight} ${fontSize} ${fontFamily}`
|
|
606
797
|
|
|
607
|
-
const text =
|
|
798
|
+
const text = "value" in input
|
|
799
|
+
? ((input as HTMLInputElement | HTMLTextAreaElement).value || (input as HTMLInputElement | HTMLTextAreaElement).placeholder || "")
|
|
800
|
+
: ((input.textContent || "").trim())
|
|
608
801
|
const textWidth = ctx.measureText(text).width
|
|
609
802
|
const padding = parsePx(computed.paddingLeft) + parsePx(computed.paddingRight)
|
|
610
803
|
return textWidth + padding + 2
|
|
611
804
|
}
|
|
612
805
|
|
|
806
|
+
function measureOptionalControlSlotWidth(wrapper: HTMLElement, selector: string, fallbackWidth: number): number {
|
|
807
|
+
const element = wrapper.querySelector(selector) as HTMLElement | null
|
|
808
|
+
if (!element) {
|
|
809
|
+
return 0
|
|
810
|
+
}
|
|
811
|
+
return element.offsetWidth || fallbackWidth
|
|
812
|
+
}
|
|
813
|
+
|
|
613
814
|
// ---------------------------------------------------------------------------
|
|
614
815
|
// Textarea auto-height
|
|
615
816
|
// ---------------------------------------------------------------------------
|
|
@@ -644,14 +845,18 @@ export function applyVarStackWidth(target: HTMLElement, inputKind: VarInputKind)
|
|
|
644
845
|
|
|
645
846
|
const labelWidth = measureVarLabelWidth(wrapper)
|
|
646
847
|
|
|
647
|
-
const minWidthPx = getVarControlMinWidth(inputKind)
|
|
648
848
|
let controlWidth = 0
|
|
649
|
-
const input = wrapper.querySelector(".aimd-rec-inline__input--stacked, .aimd-rec-inline__textarea--stacked-text") as
|
|
650
|
-
|
|
849
|
+
const input = wrapper.querySelector(".aimd-rec-inline__input--stacked, .aimd-rec-inline__textarea--stacked-text, .aimd-rec-inline__file-control") as HTMLElement | null
|
|
850
|
+
const minWidthPx = Math.max(getVarControlMinWidth(inputKind), getFileControlMinWidth(input))
|
|
651
851
|
if (input) {
|
|
652
852
|
controlWidth = measureSingleLineControlWidth(input) + getVarControlExtraWidth(inputKind)
|
|
653
853
|
}
|
|
654
854
|
|
|
855
|
+
if (wrapper.querySelector(".aimd-rec-inline__control-row")) {
|
|
856
|
+
controlWidth += measureOptionalControlSlotWidth(wrapper, ".aimd-rec-inline__assigner-prefix", 36)
|
|
857
|
+
+ measureOptionalControlSlotWidth(wrapper, ".aimd-rec-inline__assigner-status", 30)
|
|
858
|
+
}
|
|
859
|
+
|
|
655
860
|
const measuredWidth = Math.max(minWidthPx, labelWidth, controlWidth)
|
|
656
861
|
wrapper.style.width = `${Math.ceil(measuredWidth)}px`
|
|
657
862
|
wrapper.style.maxWidth = "100%"
|
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.
|
|
@@ -23,6 +23,25 @@ export {
|
|
|
23
23
|
} from './locales'
|
|
24
24
|
export type {
|
|
25
25
|
AimdProtocolRecordData,
|
|
26
|
+
AimdAssignerDefinition,
|
|
27
|
+
AimdAssignerGraphData,
|
|
28
|
+
AimdAssignerGraphEdge,
|
|
29
|
+
AimdAssignerGraphLabels,
|
|
30
|
+
AimdAssignerGraphNode,
|
|
31
|
+
AimdAssignerGraphNodeType,
|
|
32
|
+
AimdAssignerMap,
|
|
33
|
+
AimdAssignerNodeSchemaInfo,
|
|
34
|
+
AimdAssignerRunner,
|
|
35
|
+
AimdAssignerRunnerRequest,
|
|
36
|
+
AimdServerAssignerMap,
|
|
37
|
+
AimdServerAssignerRunner,
|
|
38
|
+
AimdServerAssignerRunnerRequest,
|
|
39
|
+
AimdFileUploadContext,
|
|
40
|
+
AimdFileUploadHandler,
|
|
41
|
+
AimdFileResolveContext,
|
|
42
|
+
AimdFileInfoResolver,
|
|
43
|
+
AimdResolvedFileInfo,
|
|
44
|
+
AimdSelectedFileValue,
|
|
26
45
|
AimdTypePlugin,
|
|
27
46
|
AimdTypePluginInitContext,
|
|
28
47
|
AimdTypePluginParseContext,
|
package/src/locales.ts
CHANGED
|
@@ -80,6 +80,21 @@ export interface AimdRecorderMessages {
|
|
|
80
80
|
deleteRow: string
|
|
81
81
|
addRow: string
|
|
82
82
|
}
|
|
83
|
+
assigner: {
|
|
84
|
+
run: string
|
|
85
|
+
running: string
|
|
86
|
+
cancel: string
|
|
87
|
+
}
|
|
88
|
+
file: {
|
|
89
|
+
choose: string
|
|
90
|
+
selected: string
|
|
91
|
+
clear: string
|
|
92
|
+
open: string
|
|
93
|
+
download: string
|
|
94
|
+
preview: string
|
|
95
|
+
replace: string
|
|
96
|
+
uploadFailed: string
|
|
97
|
+
}
|
|
83
98
|
dna: {
|
|
84
99
|
editMode: string
|
|
85
100
|
interactiveMode: string
|
|
@@ -249,6 +264,21 @@ const EN_US_MESSAGES: AimdRecorderMessages = {
|
|
|
249
264
|
deleteRow: "Delete",
|
|
250
265
|
addRow: "Add row",
|
|
251
266
|
},
|
|
267
|
+
assigner: {
|
|
268
|
+
run: "Run Assigner",
|
|
269
|
+
running: "Running",
|
|
270
|
+
cancel: "Cancel",
|
|
271
|
+
},
|
|
272
|
+
file: {
|
|
273
|
+
choose: "Choose file",
|
|
274
|
+
selected: "Selected file",
|
|
275
|
+
clear: "Clear file",
|
|
276
|
+
open: "Open file",
|
|
277
|
+
download: "Download",
|
|
278
|
+
preview: "Preview",
|
|
279
|
+
replace: "Replace file",
|
|
280
|
+
uploadFailed: "File upload failed.",
|
|
281
|
+
},
|
|
252
282
|
dna: {
|
|
253
283
|
editMode: "Edit mode",
|
|
254
284
|
interactiveMode: "Interactive",
|
|
@@ -391,6 +421,21 @@ const ZH_CN_MESSAGES: AimdRecorderMessages = {
|
|
|
391
421
|
deleteRow: "删除",
|
|
392
422
|
addRow: "添加行",
|
|
393
423
|
},
|
|
424
|
+
assigner: {
|
|
425
|
+
run: "运行赋值器",
|
|
426
|
+
running: "运行中",
|
|
427
|
+
cancel: "取消",
|
|
428
|
+
},
|
|
429
|
+
file: {
|
|
430
|
+
choose: "选择文件",
|
|
431
|
+
selected: "已选择文件",
|
|
432
|
+
clear: "清除文件",
|
|
433
|
+
open: "打开文件",
|
|
434
|
+
download: "下载",
|
|
435
|
+
preview: "预览",
|
|
436
|
+
replace: "替换文件",
|
|
437
|
+
uploadFailed: "文件上传失败。",
|
|
438
|
+
},
|
|
394
439
|
dna: {
|
|
395
440
|
editMode: "编辑模式",
|
|
396
441
|
interactiveMode: "交互式",
|
|
@@ -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'
|