@airalogy/aimd-recorder 1.14.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.
- package/README.md +240 -0
- package/README.zh-CN.md +224 -0
- package/dist/AimdCodeField-DC3DPvgc.js +172 -0
- package/dist/AimdDnaSequenceField-__jdnFS9.js +59466 -0
- package/dist/AimdEditor.vue_vue_type_style_index_0_lang-Bq79rKNw.js +28370 -0
- package/dist/AimdMarkdownField-98ImHGbc.js +66 -0
- package/dist/AimdMarkdownNoteField-CuUJZkgT.js +185 -0
- package/dist/_.contribution-IP0cDNhs.js +38 -0
- package/dist/_commonjsHelpers-CZXJ37nu.js +40 -0
- package/dist/abap-Bs8kvjsq.js +1398 -0
- package/dist/aimd-recorder.css +1 -0
- package/dist/apex-Dspwrl5m.js +326 -0
- package/dist/assets/css.worker-Dmf38jDD.js +79 -0
- package/dist/assets/editor.worker-CpuX8TSY.js +12 -0
- package/dist/assets/html.worker-DotaEs7v.js +456 -0
- package/dist/assets/json.worker-B4VHhH6h.js +44 -0
- package/dist/assets/ts.worker-sl17zBDo.js +51316 -0
- package/dist/azcli-k1BiOau1.js +68 -0
- package/dist/bat-BIP72KWc.js +100 -0
- package/dist/bicep-VhQeYhS3.js +102 -0
- package/dist/cameligo-DnuAXtHg.js +174 -0
- package/dist/clojure-BAuDPsal.js +761 -0
- package/dist/coffee-BV06qSnj.js +232 -0
- package/dist/components.js +3595 -0
- package/dist/composables.js +72 -0
- package/dist/cpp-Cz8Jeyrf.js +389 -0
- package/dist/csharp-F6hhlXFb.js +326 -0
- package/dist/csp-KzlEHCyI.js +53 -0
- package/dist/css-e4FKntZ3.js +187 -0
- package/dist/cssMode-uz9U6SUU.js +1571 -0
- package/dist/cypher-CpvDGKRr.js +263 -0
- package/dist/dart-DdHeFWR0.js +281 -0
- package/dist/dockerfile-aoNXDcio.js +130 -0
- package/dist/ecl-C4Q0DYuA.js +456 -0
- package/dist/editor.api-CgD9w0gG.js +77091 -0
- package/dist/editor.main-Du02abDl.js +33783 -0
- package/dist/elixir-C9X42b0T.js +569 -0
- package/dist/flow9-Bff42pfB.js +142 -0
- package/dist/freemarker2-DFLX4iQ-.js +989 -0
- package/dist/fsharp-C6vPAsHG.js +217 -0
- package/dist/go-DEr8zx9f.js +218 -0
- package/dist/graphql-BiNBBRFh.js +151 -0
- package/dist/handlebars-aiZbIuWY.js +419 -0
- package/dist/hcl-2T9lKuFg.js +183 -0
- package/dist/html-phzTMObN.js +308 -0
- package/dist/htmlMode-BF7wMi3N.js +1581 -0
- package/dist/index.js +89 -0
- package/dist/ini-CZGtssYM.js +71 -0
- package/dist/ini.contribution-DyWtiacL.js +8 -0
- package/dist/java-B260NeH3.js +232 -0
- package/dist/javascript-BKKOItMi.js +70 -0
- package/dist/jsonMode-CDYK4B5l.js +1996 -0
- package/dist/julia-kuNLM9c5.js +511 -0
- package/dist/kotlin-Bz6kAefA.js +253 -0
- package/dist/less-AZUtS89I.js +162 -0
- package/dist/lexon-BcmgnyRb.js +157 -0
- package/dist/liquid-B2eRz5SA.js +240 -0
- package/dist/lua-Dz1RbATg.js +162 -0
- package/dist/m3-CIMooLFn.js +210 -0
- package/dist/markdown-C1BsCK9P.js +229 -0
- package/dist/markdown.contribution-DYYk6zUU.js +7 -0
- package/dist/mdx-BfV1HDRG.js +165 -0
- package/dist/mips-BovsnfLQ.js +198 -0
- package/dist/monaco.contribution-C-bQhUTI.js +114 -0
- package/dist/monaco.contribution-CCVvl3Jx.js +72 -0
- package/dist/monaco.contribution-Col-f0XR.js +164 -0
- package/dist/monaco.contribution-b5xkgQ-s.js +112 -0
- package/dist/msdax-CiRB2ZB-.js +375 -0
- package/dist/mysql-BwdpPE19.js +878 -0
- package/dist/objective-c-D4nfHfso.js +183 -0
- package/dist/pascal--j5-PYtz.js +251 -0
- package/dist/pascaligo-C7TcJxNL.js +164 -0
- package/dist/perl-BzEWqUb5.js +626 -0
- package/dist/pgsql-B_KZ0mGX.js +851 -0
- package/dist/php-A19QHzQV.js +500 -0
- package/dist/pla-COeKY1hA.js +137 -0
- package/dist/postiats-BfMp7zJL.js +907 -0
- package/dist/powerquery-B0TS_5Gb.js +890 -0
- package/dist/powershell-5jSbKdYB.js +239 -0
- package/dist/protobuf-YgnOutn3.js +420 -0
- package/dist/pug-DLej6kn5.js +402 -0
- package/dist/python-CQrZx9mR.js +301 -0
- package/dist/python.contribution-CcKs2Ktm.js +8 -0
- package/dist/qsharp-AhjqtSHB.js +301 -0
- package/dist/r-D-F4P80w.js +243 -0
- package/dist/razor-DWmpHMcx.js +550 -0
- package/dist/redis-hwwIlMnV.js +302 -0
- package/dist/redshift-Bcm_kjEG.js +809 -0
- package/dist/restructuredtext-CrdzfPP-.js +174 -0
- package/dist/ruby-QC2UNm1s.js +511 -0
- package/dist/rust-5aqiQ3L5.js +343 -0
- package/dist/sb-B1g1ZfLJ.js +115 -0
- package/dist/scala-C2U4R5Gb.js +370 -0
- package/dist/scheme-DeFRbslr.js +108 -0
- package/dist/scss-RSTCiCmI.js +262 -0
- package/dist/shell-BpF-iNu8.js +221 -0
- package/dist/shell.contribution-B80NZ3iO.js +7 -0
- package/dist/solidity-C00r2mbQ.js +1367 -0
- package/dist/sophia-DVW5ZKDB.js +199 -0
- package/dist/sparql-B0nmpxeX.js +201 -0
- package/dist/sql-CJwKPERn.js +853 -0
- package/dist/sql.contribution-DQy36aE5.js +7 -0
- package/dist/st-DPlKG5DT.js +416 -0
- package/dist/swift-YZBAbVHV.js +309 -0
- package/dist/systemverilog-CDQSaH63.js +576 -0
- package/dist/tcl-Dlu8sp6Q.js +232 -0
- package/dist/tsMode-Bh-v12OL.js +887 -0
- package/dist/twig-C5TO7-kw.js +392 -0
- package/dist/typescript-c7y6IZVP.js +343 -0
- package/dist/typespec-BsmjDEu7.js +117 -0
- package/dist/useFieldRendering-BIqeE3qo.js +6083 -0
- package/dist/vb-ChHvIDrk.js +372 -0
- package/dist/wgsl-XEp1ju8c.js +439 -0
- package/dist/xml-MAEprTnF.js +95 -0
- package/dist/xml.contribution-XMOaon8i.js +27 -0
- package/dist/yaml-C1p8rXG7.js +206 -0
- package/dist/yaml.contribution-DRRVhJmJ.js +8 -0
- package/package.json +88 -0
- package/src/__tests__/client-assigner.test.ts +341 -0
- package/src/__tests__/code-types.test.ts +30 -0
- package/src/__tests__/markdown-field.test.ts +34 -0
- package/src/__tests__/markdown-note-field.test.ts +135 -0
- package/src/__tests__/quiz-recorder.test.ts +195 -0
- package/src/__tests__/recorder-editor-content-sync.test.ts +172 -0
- package/src/__tests__/recorder-editor.test.ts +143 -0
- package/src/__tests__/recorder-render.test.ts +57 -0
- package/src/__tests__/recorder-wysiwyg-field-host.test.ts +33 -0
- package/src/__tests__/step-field.test.ts +270 -0
- package/src/__tests__/type-plugins.test.ts +59 -0
- package/src/__tests__/var-field-render.test.ts +26 -0
- package/src/client-assigner.ts +269 -0
- package/src/code-types.ts +94 -0
- package/src/components/AimdCodeField.vue +228 -0
- package/src/components/AimdDnaSequenceField.vue +983 -0
- package/src/components/AimdMarkdownField.vue +168 -0
- package/src/components/AimdMarkdownNoteField.vue +457 -0
- package/src/components/AimdQuizRecorder.vue +792 -0
- package/src/components/AimdRecorder.vue +1959 -0
- package/src/components/AimdRecorderEditor.vue +2281 -0
- package/src/components/AimdRecorderWysiwygFieldHost.vue +93 -0
- package/src/components/AimdRecorderWysiwygSurface.vue +487 -0
- package/src/components/AimdSeqVizViewer.vue +122 -0
- package/src/components/AimdStepCheckField.vue +453 -0
- package/src/components/AimdVarField.vue +213 -0
- package/src/components/AimdVarTableField.vue +516 -0
- package/src/components/DnaAnnotationEditor.vue +477 -0
- package/src/components/DnaSequenceEditor.vue +44 -0
- package/src/components/DnaSequenceToolbar.vue +98 -0
- package/src/components/DnaSequenceViewer.vue +162 -0
- package/src/components/index.ts +21 -0
- package/src/components/recorderMilkdownPlugin.ts +632 -0
- package/src/composables/__tests__/useDnaSequence.test.ts +467 -0
- package/src/composables/__tests__/useFieldAdapters.test.ts +115 -0
- package/src/composables/__tests__/useFocusManagement.test.ts +66 -0
- package/src/composables/__tests__/useRecordState.test.ts +586 -0
- package/src/composables/__tests__/useStepTimers.test.ts +64 -0
- package/src/composables/__tests__/useVarHelpers.test.ts +424 -0
- package/src/composables/__tests__/workbenchFieldEditing.test.ts +97 -0
- package/src/composables/index.ts +94 -0
- package/src/composables/useClientAssignerRunner.ts +74 -0
- package/src/composables/useDnaSequence.ts +400 -0
- package/src/composables/useDnaSequenceField.ts +316 -0
- package/src/composables/useFieldAdapters.ts +61 -0
- package/src/composables/useFieldRendering.ts +269 -0
- package/src/composables/useFocusManagement.ts +144 -0
- package/src/composables/useRecordState.ts +429 -0
- package/src/composables/useStepTimers.ts +243 -0
- package/src/composables/useVarHelpers.ts +545 -0
- package/src/composables/useVarTableDragDrop.ts +236 -0
- package/src/composables/workbenchFieldEditing.ts +705 -0
- package/src/css.d.ts +9 -0
- package/src/index.ts +65 -0
- package/src/locales.ts +559 -0
- package/src/monaco-code.ts +75 -0
- package/src/styles/aimd.css +994 -0
- package/src/type-plugins.ts +132 -0
- package/src/type-utils.ts +3 -0
- package/src/types.ts +191 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { defineAsyncComponent, h } from 'vue'
|
|
2
|
+
import { BUILT_IN_CODE_STR_TYPES } from './code-types'
|
|
3
|
+
import { normalizeDnaSequenceValue } from './composables/useDnaSequence'
|
|
4
|
+
import { normalizeAimdTypeName } from './type-utils'
|
|
5
|
+
import type { AimdTypePlugin } from './types'
|
|
6
|
+
|
|
7
|
+
const AimdDnaSequenceField = defineAsyncComponent(() => import('./components/AimdDnaSequenceField.vue'))
|
|
8
|
+
const AimdMarkdownField = defineAsyncComponent(() => import('./components/AimdMarkdownField.vue'))
|
|
9
|
+
const BUILT_IN_CODE_STR_TYPE_PLUGINS: AimdTypePlugin[] = BUILT_IN_CODE_STR_TYPES.map(type => ({
|
|
10
|
+
type,
|
|
11
|
+
inputKind: 'code' as const,
|
|
12
|
+
}))
|
|
13
|
+
|
|
14
|
+
function pad2(value: number): string {
|
|
15
|
+
return String(value).padStart(2, '0')
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function formatTimezoneOffset(date: Date): string {
|
|
19
|
+
const totalMinutes = -date.getTimezoneOffset()
|
|
20
|
+
const sign = totalMinutes >= 0 ? '+' : '-'
|
|
21
|
+
const absMinutes = Math.abs(totalMinutes)
|
|
22
|
+
const hours = Math.floor(absMinutes / 60)
|
|
23
|
+
const minutes = absMinutes % 60
|
|
24
|
+
return `${sign}${pad2(hours)}:${pad2(minutes)}`
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function formatDateTimeWithTimezone(date: Date): string {
|
|
28
|
+
const year = date.getFullYear()
|
|
29
|
+
const month = pad2(date.getMonth() + 1)
|
|
30
|
+
const day = pad2(date.getDate())
|
|
31
|
+
const hour = pad2(date.getHours())
|
|
32
|
+
const minute = pad2(date.getMinutes())
|
|
33
|
+
return `${year}-${month}-${day}T${hour}:${minute}${formatTimezoneOffset(date)}`
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function resolveNowDate(now: Date | string | number | undefined): Date {
|
|
37
|
+
if (now instanceof Date) {
|
|
38
|
+
return Number.isNaN(now.getTime()) ? new Date() : now
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (typeof now === 'string' || typeof now === 'number') {
|
|
42
|
+
const parsed = new Date(now)
|
|
43
|
+
if (!Number.isNaN(parsed.getTime())) {
|
|
44
|
+
return parsed
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return new Date()
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const BUILT_IN_AIMD_TYPE_PLUGINS: AimdTypePlugin[] = [
|
|
52
|
+
...BUILT_IN_CODE_STR_TYPE_PLUGINS,
|
|
53
|
+
{
|
|
54
|
+
type: 'CurrentTime',
|
|
55
|
+
inputKind: 'datetime',
|
|
56
|
+
getInitialValue: ({ now }) => formatDateTimeWithTimezone(resolveNowDate(now)),
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type: 'UserName',
|
|
60
|
+
getInitialValue: ({ currentUserName }) => currentUserName ?? '',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: 'AiralogyMarkdown',
|
|
64
|
+
inputKind: 'textarea',
|
|
65
|
+
renderField: ({
|
|
66
|
+
node,
|
|
67
|
+
value,
|
|
68
|
+
disabled,
|
|
69
|
+
locale,
|
|
70
|
+
messages,
|
|
71
|
+
extraClasses,
|
|
72
|
+
emitChange,
|
|
73
|
+
emitBlur,
|
|
74
|
+
}) => h(AimdMarkdownField, {
|
|
75
|
+
class: extraClasses,
|
|
76
|
+
varId: node.id,
|
|
77
|
+
modelValue: value,
|
|
78
|
+
disabled,
|
|
79
|
+
locale,
|
|
80
|
+
messages,
|
|
81
|
+
'onUpdate:modelValue': (nextValue: string) => emitChange(nextValue),
|
|
82
|
+
onBlur: emitBlur,
|
|
83
|
+
}),
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
type: 'DNASequence',
|
|
87
|
+
inputKind: 'dna',
|
|
88
|
+
getInitialValue: () => normalizeDnaSequenceValue(undefined),
|
|
89
|
+
normalizeValue: ({ value }) => normalizeDnaSequenceValue(value),
|
|
90
|
+
renderField: ({
|
|
91
|
+
node,
|
|
92
|
+
value,
|
|
93
|
+
disabled,
|
|
94
|
+
placeholder,
|
|
95
|
+
messages,
|
|
96
|
+
extraClasses,
|
|
97
|
+
emitChange,
|
|
98
|
+
emitBlur,
|
|
99
|
+
}) => h(AimdDnaSequenceField, {
|
|
100
|
+
class: extraClasses,
|
|
101
|
+
varId: node.id,
|
|
102
|
+
modelValue: value,
|
|
103
|
+
disabled,
|
|
104
|
+
placeholder,
|
|
105
|
+
messages,
|
|
106
|
+
'onUpdate:modelValue': (nextValue: unknown) => emitChange(nextValue),
|
|
107
|
+
onBlur: emitBlur,
|
|
108
|
+
}),
|
|
109
|
+
},
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
export function resolveAimdTypePlugin(
|
|
113
|
+
type: string | undefined,
|
|
114
|
+
typePlugins: AimdTypePlugin[] | undefined,
|
|
115
|
+
): AimdTypePlugin | undefined {
|
|
116
|
+
if (!typePlugins?.length) {
|
|
117
|
+
return undefined
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const normalizedType = normalizeAimdTypeName(type)
|
|
121
|
+
return typePlugins.find((plugin) => {
|
|
122
|
+
if (normalizeAimdTypeName(plugin.type) === normalizedType) {
|
|
123
|
+
return true
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return (plugin.aliases ?? []).some(alias => normalizeAimdTypeName(alias) === normalizedType)
|
|
127
|
+
})
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function createAimdTypePlugins(typePlugins?: AimdTypePlugin[]): AimdTypePlugin[] {
|
|
131
|
+
return [...(typePlugins ?? []), ...BUILT_IN_AIMD_TYPE_PLUGINS]
|
|
132
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import type { VNode } from "vue"
|
|
2
|
+
import type {
|
|
3
|
+
AimdCheckNode,
|
|
4
|
+
AimdQuizNode,
|
|
5
|
+
AimdStepNode,
|
|
6
|
+
AimdVarNode,
|
|
7
|
+
AimdVarTableNode,
|
|
8
|
+
} from "@airalogy/aimd-core/types"
|
|
9
|
+
import type { AimdRecorderMessages } from "./locales"
|
|
10
|
+
|
|
11
|
+
export interface AimdStepOrCheckRecordItem {
|
|
12
|
+
checked: boolean
|
|
13
|
+
annotation: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface AimdCheckRecordItem extends AimdStepOrCheckRecordItem {}
|
|
17
|
+
|
|
18
|
+
export interface AimdStepRecordItem extends AimdStepOrCheckRecordItem {
|
|
19
|
+
elapsed_ms: number
|
|
20
|
+
timer_started_at_ms: number | null
|
|
21
|
+
started_at_ms: number | null
|
|
22
|
+
ended_at_ms: number | null
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface AimdDnaSequenceSegment {
|
|
26
|
+
start: number
|
|
27
|
+
end: number
|
|
28
|
+
partial_start?: boolean
|
|
29
|
+
partial_end?: boolean
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface AimdDnaSequenceQualifier {
|
|
33
|
+
key: string
|
|
34
|
+
value: string
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface AimdDnaSequenceAnnotation {
|
|
38
|
+
id: string
|
|
39
|
+
name: string
|
|
40
|
+
type: string
|
|
41
|
+
strand: 1 | -1
|
|
42
|
+
color?: string
|
|
43
|
+
segments: AimdDnaSequenceSegment[]
|
|
44
|
+
qualifiers: AimdDnaSequenceQualifier[]
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface AimdDnaSequenceValue {
|
|
48
|
+
format: "airalogy_dna_v1"
|
|
49
|
+
name: string
|
|
50
|
+
sequence: string
|
|
51
|
+
topology: "linear" | "circular"
|
|
52
|
+
annotations: AimdDnaSequenceAnnotation[]
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface AimdProtocolRecordData {
|
|
56
|
+
var: Record<string, unknown>
|
|
57
|
+
step: Record<string, AimdStepRecordItem>
|
|
58
|
+
check: Record<string, AimdCheckRecordItem>
|
|
59
|
+
quiz: Record<string, unknown>
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export type AimdVarInputKind = "text" | "number" | "checkbox" | "textarea" | "date" | "datetime" | "time" | "dna" | "code"
|
|
63
|
+
export type AimdStepDetailDisplay = "auto" | "always"
|
|
64
|
+
export type AimdChoiceOptionExplanationMode = "hidden" | "selected" | "submitted" | "graded"
|
|
65
|
+
export type AimdScaleGradeDisplayMode = "hidden" | "completed" | "submitted" | "graded"
|
|
66
|
+
|
|
67
|
+
export function createEmptyProtocolRecordData(): AimdProtocolRecordData {
|
|
68
|
+
return {
|
|
69
|
+
var: {},
|
|
70
|
+
step: {},
|
|
71
|
+
check: {},
|
|
72
|
+
quiz: {},
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// ---------------------------------------------------------------------------
|
|
77
|
+
// Extension types — used by host apps to customise AimdRecorder behaviour
|
|
78
|
+
// ---------------------------------------------------------------------------
|
|
79
|
+
|
|
80
|
+
/** Field metadata — app passes via prop to describe extra field info */
|
|
81
|
+
export interface AimdFieldMeta {
|
|
82
|
+
inputType?: string // override built-in input kind or a host-defined custom type mapping
|
|
83
|
+
codeLanguage?: string // Monaco language id for code-like fields (e.g. "python", "json")
|
|
84
|
+
required?: boolean
|
|
85
|
+
pattern?: string // regex validation
|
|
86
|
+
enumOptions?: Array<{ label: string; value: unknown }>
|
|
87
|
+
disabled?: boolean
|
|
88
|
+
placeholder?: string
|
|
89
|
+
assigner?: { mode: 'manual' | 'auto_first' | 'auto_force' }
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Field runtime state — app updates dynamically via prop */
|
|
93
|
+
export interface AimdFieldState {
|
|
94
|
+
loading?: boolean // assigner loading
|
|
95
|
+
error?: string // assigner error
|
|
96
|
+
validationError?: string // validation error message
|
|
97
|
+
disabled?: boolean // dynamic disable
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Field event payload */
|
|
101
|
+
export interface FieldEventPayload {
|
|
102
|
+
section: 'var' | 'step' | 'check' | 'quiz' | 'var_table'
|
|
103
|
+
fieldKey: string
|
|
104
|
+
value?: unknown
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Table event payload */
|
|
108
|
+
export interface TableEventPayload {
|
|
109
|
+
tableName: string
|
|
110
|
+
rowIndex?: number
|
|
111
|
+
columns: string[]
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export type AimdRecorderFieldType = "var" | "var_table" | "step" | "check" | "quiz"
|
|
115
|
+
|
|
116
|
+
export interface AimdRecorderFieldNodeMap {
|
|
117
|
+
var: AimdVarNode
|
|
118
|
+
var_table: AimdVarTableNode
|
|
119
|
+
step: AimdStepNode
|
|
120
|
+
check: AimdCheckNode
|
|
121
|
+
quiz: AimdQuizNode
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export type AimdRecorderFieldNode = AimdRecorderFieldNodeMap[keyof AimdRecorderFieldNodeMap]
|
|
125
|
+
|
|
126
|
+
export interface AimdTypePluginInitContext {
|
|
127
|
+
type: string
|
|
128
|
+
normalizedType: string
|
|
129
|
+
fieldKey: string
|
|
130
|
+
node: AimdVarNode
|
|
131
|
+
fieldMeta?: AimdFieldMeta
|
|
132
|
+
currentUserName?: string
|
|
133
|
+
now?: Date | string | number
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface AimdTypePluginValueContext extends AimdTypePluginInitContext {
|
|
137
|
+
value: unknown
|
|
138
|
+
inputKind: AimdVarInputKind
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface AimdTypePluginParseContext extends AimdTypePluginInitContext {
|
|
142
|
+
rawValue: string
|
|
143
|
+
inputKind: AimdVarInputKind
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface AimdTypePluginRenderContext extends AimdTypePluginValueContext {
|
|
147
|
+
readonly: boolean
|
|
148
|
+
disabled: boolean
|
|
149
|
+
locale: string
|
|
150
|
+
messages: AimdRecorderMessages
|
|
151
|
+
record: AimdProtocolRecordData
|
|
152
|
+
displayValue: string | number
|
|
153
|
+
extraClasses: string[]
|
|
154
|
+
placeholder?: string
|
|
155
|
+
fieldState?: AimdFieldState
|
|
156
|
+
emitChange: (value: unknown) => void
|
|
157
|
+
emitBlur: () => void
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface AimdTypePlugin {
|
|
161
|
+
type: string
|
|
162
|
+
aliases?: string[]
|
|
163
|
+
inputKind?: AimdVarInputKind
|
|
164
|
+
getInitialValue?: (context: AimdTypePluginInitContext) => unknown
|
|
165
|
+
normalizeValue?: (context: AimdTypePluginValueContext) => unknown
|
|
166
|
+
getDisplayValue?: (context: AimdTypePluginValueContext) => string | number
|
|
167
|
+
parseInputValue?: (context: AimdTypePluginParseContext) => unknown
|
|
168
|
+
renderField?: (context: AimdTypePluginRenderContext) => VNode | null | undefined
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface AimdRecorderFieldAdapterContext<TFieldType extends AimdRecorderFieldType = AimdRecorderFieldType> {
|
|
172
|
+
fieldType: TFieldType
|
|
173
|
+
fieldKey: string
|
|
174
|
+
node: AimdRecorderFieldNodeMap[TFieldType]
|
|
175
|
+
value: unknown
|
|
176
|
+
defaultVNode: VNode
|
|
177
|
+
readonly: boolean
|
|
178
|
+
locale: string
|
|
179
|
+
messages: AimdRecorderMessages
|
|
180
|
+
record: AimdProtocolRecordData
|
|
181
|
+
fieldMeta?: Record<string, AimdFieldMeta>
|
|
182
|
+
fieldState?: Record<string, AimdFieldState>
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export type AimdRecorderFieldAdapter<TFieldType extends AimdRecorderFieldType = AimdRecorderFieldType> = (
|
|
186
|
+
context: AimdRecorderFieldAdapterContext<TFieldType>,
|
|
187
|
+
) => VNode | null | undefined
|
|
188
|
+
|
|
189
|
+
export type AimdRecorderFieldAdapters = Partial<{
|
|
190
|
+
[K in AimdRecorderFieldType]: AimdRecorderFieldAdapter<K>
|
|
191
|
+
}>
|