@airalogy/aimd-recorder 1.16.0 → 1.18.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 +11 -10
- package/README.zh-CN.md +11 -10
- package/dist/AimdCodeField-BQUuM-EF.js +182 -0
- package/dist/{AimdDnaSequenceField-CPyMqIVh.js → AimdDnaSequenceField-KZU2Zj3E.js} +2 -2
- package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-lyHIpch9.js → AimdEditor.vue_vue_type_style_index_0_lang-CzfYPp5r.js} +3924 -3831
- package/dist/AimdMarkdownField-t2d8uOeU.js +254 -0
- package/dist/AimdMarkdownNoteField-_h1oZSwH.js +259 -0
- package/dist/{_commonjsHelpers-CZXJ37nu.js → _commonjsHelpers-B5RozER-.js} +2 -2
- package/dist/aimd-recorder.css +1 -1
- package/dist/arc-DS_ocYoe.js +83 -0
- package/dist/architectureDiagram-3BPJPVTR-Dq2W8_tb.js +4692 -0
- package/dist/blockDiagram-GPEHLZMM-B4hnSAF_.js +2425 -0
- package/dist/c4Diagram-AAUBKEIU-CbffqNLY.js +1577 -0
- package/dist/channel-CtXnYrAk.js +5 -0
- package/dist/chunk-2J33WTMH-CROScrt5.js +19 -0
- package/dist/chunk-4BX2VUAB-DTmsQu5_.js +8 -0
- package/dist/chunk-55IACEB6-B5wDJzeX.js +8 -0
- package/dist/chunk-727SXJPM-CfyltY6o.js +1528 -0
- package/dist/chunk-AQP2D5EJ-B8274EYy.js +1387 -0
- package/dist/chunk-FMBD7UC4-CT_FK-SH.js +19 -0
- package/dist/chunk-ND2GUHAM-g9GulPi-.js +68 -0
- package/dist/chunk-QZHKN3VN-Di5HEktz.js +15 -0
- package/dist/classDiagram-4FO5ZUOK-BVUr246k.js +16 -0
- package/dist/classDiagram-v2-Q7XG4LA2-BVUr246k.js +16 -0
- package/dist/components.js +3365 -2216
- package/dist/composables.js +92 -68
- package/dist/cose-bilkent-S5V4N54A-GJ4IOO6v.js +2609 -0
- package/dist/cytoscape.esm-r59gEWFs.js +18710 -0
- package/dist/dagre-BM42HDAG-oL7Br44o.js +445 -0
- package/dist/defaultLocale-BgPVtth8.js +171 -0
- package/dist/diagram-2AECGRRQ-DtoCG_N4.js +217 -0
- package/dist/diagram-5GNKFQAL-f8QNdS7L.js +123 -0
- package/dist/diagram-KO2AKTUF-CsJOW_AX.js +461 -0
- package/dist/diagram-LMA3HP47-xmEKNZ7y.js +142 -0
- package/dist/diagram-OG6HWLK6-unpC7vo8.js +528 -0
- package/dist/erDiagram-TEJ5UH35-BGzFnCJD.js +899 -0
- package/dist/flowDiagram-I6XJVG4X-LBFhDnOs.js +1628 -0
- package/dist/ganttDiagram-6RSMTGT7-CFBc-jPD.js +2707 -0
- package/dist/gitGraphDiagram-PVQCEYII-BLduh-Rb.js +815 -0
- package/dist/graph-DdlKE625.js +1510 -0
- package/dist/index.js +104 -80
- package/dist/infoDiagram-5YYISTIA-CLQQI6zM.js +24 -0
- package/dist/init-DjUOC4st.js +16 -0
- package/dist/ishikawaDiagram-YF4QCWOH-CStdYBmW.js +621 -0
- package/dist/journeyDiagram-JHISSGLW-B6mRTzoE.js +834 -0
- package/dist/kanban-definition-UN3LZRKU-C-vnN5v4.js +724 -0
- package/dist/katex-DNob3HGn.js +11690 -0
- package/dist/layout-DDt0fz-M.js +1703 -0
- package/dist/linear-C-IAFdOt.js +259 -0
- package/dist/mermaid.core-CuZ3nINf.js +15940 -0
- package/dist/mindmap-definition-RKZ34NQL-TSZ1Vb3z.js +827 -0
- package/dist/ordinal-B6-f3MAq.js +61 -0
- package/dist/pieDiagram-4H26LBE5-DYok-1-k.js +163 -0
- package/dist/quadrantDiagram-W4KKPZXB-Cg856sbH.js +1024 -0
- package/dist/requirementDiagram-4Y6WPE33-BN9fGdlJ.js +882 -0
- package/dist/sankeyDiagram-5OEKKPKP-CDqTgonY.js +847 -0
- package/dist/sequenceDiagram-3UESZ5HK-Chjrc0-W.js +2891 -0
- package/dist/stateDiagram-AJRCARHV-DRyLHrdr.js +263 -0
- package/dist/stateDiagram-v2-BHNVJYJU-CZTIDHid.js +16 -0
- package/dist/timeline-definition-PNZ67QCA-Bc3D9AAG.js +1055 -0
- package/dist/{useFieldRendering-Dh6Kib_0.js → useCodeBlockRendering-qA6gj4vz.js} +3041 -2255
- package/dist/useMonacoAutoHeight-D4T-El3J.js +66 -0
- package/dist/vennDiagram-CIIHVFJN-CYAul48m.js +1557 -0
- package/dist/wardley-L42UT6IY-D7b2ujEZ.js +22512 -0
- package/dist/wardleyDiagram-YWT4CUSO-B7Tg0MG9.js +675 -0
- package/dist/xychartDiagram-2RQKCTM6-xWYVEqth.js +1342 -0
- package/package.json +8 -7
- 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__/quiz-recorder.test.ts +47 -0
- package/src/__tests__/recorder-assigner-control.test.ts +844 -0
- package/src/__tests__/recorder-check-field.test.ts +103 -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 +87 -4
- package/src/__tests__/type-plugins.test.ts +1 -0
- package/src/__tests__/var-field-render.test.ts +741 -1
- package/src/components/AimdCodeField.vue +24 -5
- package/src/components/AimdMarkdownField.vue +548 -11
- package/src/components/AimdMarkdownNoteField.vue +241 -30
- package/src/components/AimdQuizOptionFollowups.vue +121 -0
- package/src/components/AimdQuizRecorder.vue +79 -148
- package/src/components/AimdRecorder.vue +1620 -98
- 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 +205 -51
- package/src/components/AimdVarField.vue +694 -25
- package/src/components/AimdVarTableField.vue +283 -110
- package/src/components/icons/AimdAssignerCalculatorIcon.vue +18 -0
- package/src/components/icons/AimdAssignerCloudStatusIcon.vue +22 -0
- package/src/components/recorderMilkdownPlugin.ts +14 -0
- package/src/composables/__tests__/useRecordState.test.ts +114 -0
- package/src/composables/__tests__/useVarHelpers.test.ts +133 -0
- package/src/composables/index.ts +27 -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 +40 -14
- package/src/composables/useVarHelpers.ts +377 -9
- package/src/index.ts +13 -0
- package/src/locales.ts +47 -2
- package/src/styles/aimd.css +171 -6
- package/src/type-plugins.ts +7 -0
- package/src/types.ts +93 -2
- package/dist/AimdCodeField-DC3DPvgc.js +0 -172
- package/dist/AimdMarkdownField-CX71bOdX.js +0 -67
- package/dist/AimdMarkdownNoteField--ssNIQfG.js +0 -186
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
|
2
|
+
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
|
3
3
|
import { ensureMonacoEnvironment, ensureMonacoLanguageContribution } from '../monaco-code'
|
|
4
|
+
import { createMonacoAutoHeight } from '../composables/useMonacoAutoHeight'
|
|
4
5
|
|
|
5
6
|
const props = withDefaults(defineProps<{
|
|
6
7
|
modelValue?: string | number
|
|
@@ -20,6 +21,15 @@ const editorContainer = ref<HTMLElement | null>(null)
|
|
|
20
21
|
const loading = ref(true)
|
|
21
22
|
const loadError = ref<string | null>(null)
|
|
22
23
|
const draftValue = ref(normalizeCodeFieldValue(props.modelValue))
|
|
24
|
+
const codeAutoHeight = createMonacoAutoHeight({
|
|
25
|
+
getInitialValue: () => draftValue.value,
|
|
26
|
+
getLayoutElement: () => editorContainer.value,
|
|
27
|
+
maxHeight: 520,
|
|
28
|
+
})
|
|
29
|
+
const editorHeight = codeAutoHeight.editorHeight
|
|
30
|
+
const editorStyle = computed(() => ({
|
|
31
|
+
'--aimd-code-field-editor-height': `${editorHeight.value}px`,
|
|
32
|
+
}))
|
|
23
33
|
|
|
24
34
|
let monacoModule: typeof import('monaco-editor') | null = null
|
|
25
35
|
let monacoEditor: import('monaco-editor').editor.IStandaloneCodeEditor | null = null
|
|
@@ -39,6 +49,7 @@ function normalizeCodeFieldValue(value: string | number | undefined): string {
|
|
|
39
49
|
}
|
|
40
50
|
|
|
41
51
|
function emitDraftValue(nextValue: string) {
|
|
52
|
+
codeAutoHeight.syncEstimatedEditorHeight(nextValue)
|
|
42
53
|
if (nextValue === draftValue.value) {
|
|
43
54
|
return
|
|
44
55
|
}
|
|
@@ -78,8 +89,10 @@ async function createEditor() {
|
|
|
78
89
|
automaticLayout: true,
|
|
79
90
|
lineNumbers: 'on',
|
|
80
91
|
wordWrap: 'on',
|
|
92
|
+
lineHeight: codeAutoHeight.lineHeight,
|
|
81
93
|
tabSize: 2,
|
|
82
94
|
padding: { top: 12, bottom: 12 },
|
|
95
|
+
scrollbar: { vertical: 'auto', horizontal: 'auto' },
|
|
83
96
|
readOnly: props.disabled,
|
|
84
97
|
})
|
|
85
98
|
|
|
@@ -96,6 +109,8 @@ async function createEditor() {
|
|
|
96
109
|
monacoEditor.onDidBlurEditorWidget(() => {
|
|
97
110
|
emit('blur')
|
|
98
111
|
})
|
|
112
|
+
|
|
113
|
+
codeAutoHeight.attachEditor(monacoEditor)
|
|
99
114
|
} catch (error) {
|
|
100
115
|
loadError.value = error instanceof Error ? error.message : 'Failed to load Monaco editor.'
|
|
101
116
|
} finally {
|
|
@@ -105,6 +120,7 @@ async function createEditor() {
|
|
|
105
120
|
|
|
106
121
|
function syncEditorValue(nextValue: string) {
|
|
107
122
|
draftValue.value = nextValue
|
|
123
|
+
codeAutoHeight.syncEstimatedEditorHeight(nextValue)
|
|
108
124
|
|
|
109
125
|
if (!monacoEditor || nextValue === monacoEditor.getValue()) {
|
|
110
126
|
return
|
|
@@ -113,6 +129,7 @@ function syncEditorValue(nextValue: string) {
|
|
|
113
129
|
isSyncing = true
|
|
114
130
|
monacoEditor.setValue(nextValue)
|
|
115
131
|
isSyncing = false
|
|
132
|
+
void nextTick(codeAutoHeight.syncMeasuredEditorHeight)
|
|
116
133
|
}
|
|
117
134
|
|
|
118
135
|
function onFallbackInput(event: Event) {
|
|
@@ -124,6 +141,7 @@ onMounted(() => {
|
|
|
124
141
|
})
|
|
125
142
|
|
|
126
143
|
onBeforeUnmount(() => {
|
|
144
|
+
codeAutoHeight.dispose()
|
|
127
145
|
monacoEditor?.dispose()
|
|
128
146
|
monacoModel?.dispose()
|
|
129
147
|
})
|
|
@@ -146,7 +164,7 @@ watch(() => props.language, async (language) => {
|
|
|
146
164
|
</script>
|
|
147
165
|
|
|
148
166
|
<template>
|
|
149
|
-
<div class="aimd-code-field" :class="{ 'aimd-code-field--disabled': disabled }">
|
|
167
|
+
<div class="aimd-code-field" :class="{ 'aimd-code-field--disabled': disabled }" :style="editorStyle">
|
|
150
168
|
<div v-if="loadError" class="aimd-code-field__fallback-shell">
|
|
151
169
|
<textarea
|
|
152
170
|
class="aimd-code-field__fallback"
|
|
@@ -178,7 +196,7 @@ watch(() => props.language, async (language) => {
|
|
|
178
196
|
.aimd-code-field__fallback-shell {
|
|
179
197
|
display: flex;
|
|
180
198
|
width: 100%;
|
|
181
|
-
min-height:
|
|
199
|
+
min-height: var(--aimd-code-field-editor-height);
|
|
182
200
|
align-items: stretch;
|
|
183
201
|
}
|
|
184
202
|
|
|
@@ -195,7 +213,8 @@ watch(() => props.language, async (language) => {
|
|
|
195
213
|
|
|
196
214
|
.aimd-code-field__editor {
|
|
197
215
|
width: 100%;
|
|
198
|
-
|
|
216
|
+
height: var(--aimd-code-field-editor-height);
|
|
217
|
+
min-height: var(--aimd-code-field-editor-height);
|
|
199
218
|
}
|
|
200
219
|
|
|
201
220
|
.aimd-code-field__editor :deep(.monaco-editor),
|
|
@@ -205,7 +224,7 @@ watch(() => props.language, async (language) => {
|
|
|
205
224
|
|
|
206
225
|
.aimd-code-field__fallback {
|
|
207
226
|
width: 100%;
|
|
208
|
-
min-height:
|
|
227
|
+
min-height: var(--aimd-code-field-editor-height);
|
|
209
228
|
padding: 12px 14px;
|
|
210
229
|
border: 0 none;
|
|
211
230
|
resize: vertical;
|