@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.
Files changed (110) hide show
  1. package/README.md +11 -10
  2. package/README.zh-CN.md +11 -10
  3. package/dist/AimdCodeField-BQUuM-EF.js +182 -0
  4. package/dist/{AimdDnaSequenceField-CPyMqIVh.js → AimdDnaSequenceField-KZU2Zj3E.js} +2 -2
  5. package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-lyHIpch9.js → AimdEditor.vue_vue_type_style_index_0_lang-CzfYPp5r.js} +3924 -3831
  6. package/dist/AimdMarkdownField-t2d8uOeU.js +254 -0
  7. package/dist/AimdMarkdownNoteField-_h1oZSwH.js +259 -0
  8. package/dist/{_commonjsHelpers-CZXJ37nu.js → _commonjsHelpers-B5RozER-.js} +2 -2
  9. package/dist/aimd-recorder.css +1 -1
  10. package/dist/arc-DS_ocYoe.js +83 -0
  11. package/dist/architectureDiagram-3BPJPVTR-Dq2W8_tb.js +4692 -0
  12. package/dist/blockDiagram-GPEHLZMM-B4hnSAF_.js +2425 -0
  13. package/dist/c4Diagram-AAUBKEIU-CbffqNLY.js +1577 -0
  14. package/dist/channel-CtXnYrAk.js +5 -0
  15. package/dist/chunk-2J33WTMH-CROScrt5.js +19 -0
  16. package/dist/chunk-4BX2VUAB-DTmsQu5_.js +8 -0
  17. package/dist/chunk-55IACEB6-B5wDJzeX.js +8 -0
  18. package/dist/chunk-727SXJPM-CfyltY6o.js +1528 -0
  19. package/dist/chunk-AQP2D5EJ-B8274EYy.js +1387 -0
  20. package/dist/chunk-FMBD7UC4-CT_FK-SH.js +19 -0
  21. package/dist/chunk-ND2GUHAM-g9GulPi-.js +68 -0
  22. package/dist/chunk-QZHKN3VN-Di5HEktz.js +15 -0
  23. package/dist/classDiagram-4FO5ZUOK-BVUr246k.js +16 -0
  24. package/dist/classDiagram-v2-Q7XG4LA2-BVUr246k.js +16 -0
  25. package/dist/components.js +3365 -2216
  26. package/dist/composables.js +92 -68
  27. package/dist/cose-bilkent-S5V4N54A-GJ4IOO6v.js +2609 -0
  28. package/dist/cytoscape.esm-r59gEWFs.js +18710 -0
  29. package/dist/dagre-BM42HDAG-oL7Br44o.js +445 -0
  30. package/dist/defaultLocale-BgPVtth8.js +171 -0
  31. package/dist/diagram-2AECGRRQ-DtoCG_N4.js +217 -0
  32. package/dist/diagram-5GNKFQAL-f8QNdS7L.js +123 -0
  33. package/dist/diagram-KO2AKTUF-CsJOW_AX.js +461 -0
  34. package/dist/diagram-LMA3HP47-xmEKNZ7y.js +142 -0
  35. package/dist/diagram-OG6HWLK6-unpC7vo8.js +528 -0
  36. package/dist/erDiagram-TEJ5UH35-BGzFnCJD.js +899 -0
  37. package/dist/flowDiagram-I6XJVG4X-LBFhDnOs.js +1628 -0
  38. package/dist/ganttDiagram-6RSMTGT7-CFBc-jPD.js +2707 -0
  39. package/dist/gitGraphDiagram-PVQCEYII-BLduh-Rb.js +815 -0
  40. package/dist/graph-DdlKE625.js +1510 -0
  41. package/dist/index.js +104 -80
  42. package/dist/infoDiagram-5YYISTIA-CLQQI6zM.js +24 -0
  43. package/dist/init-DjUOC4st.js +16 -0
  44. package/dist/ishikawaDiagram-YF4QCWOH-CStdYBmW.js +621 -0
  45. package/dist/journeyDiagram-JHISSGLW-B6mRTzoE.js +834 -0
  46. package/dist/kanban-definition-UN3LZRKU-C-vnN5v4.js +724 -0
  47. package/dist/katex-DNob3HGn.js +11690 -0
  48. package/dist/layout-DDt0fz-M.js +1703 -0
  49. package/dist/linear-C-IAFdOt.js +259 -0
  50. package/dist/mermaid.core-CuZ3nINf.js +15940 -0
  51. package/dist/mindmap-definition-RKZ34NQL-TSZ1Vb3z.js +827 -0
  52. package/dist/ordinal-B6-f3MAq.js +61 -0
  53. package/dist/pieDiagram-4H26LBE5-DYok-1-k.js +163 -0
  54. package/dist/quadrantDiagram-W4KKPZXB-Cg856sbH.js +1024 -0
  55. package/dist/requirementDiagram-4Y6WPE33-BN9fGdlJ.js +882 -0
  56. package/dist/sankeyDiagram-5OEKKPKP-CDqTgonY.js +847 -0
  57. package/dist/sequenceDiagram-3UESZ5HK-Chjrc0-W.js +2891 -0
  58. package/dist/stateDiagram-AJRCARHV-DRyLHrdr.js +263 -0
  59. package/dist/stateDiagram-v2-BHNVJYJU-CZTIDHid.js +16 -0
  60. package/dist/timeline-definition-PNZ67QCA-Bc3D9AAG.js +1055 -0
  61. package/dist/{useFieldRendering-Dh6Kib_0.js → useCodeBlockRendering-qA6gj4vz.js} +3041 -2255
  62. package/dist/useMonacoAutoHeight-D4T-El3J.js +66 -0
  63. package/dist/vennDiagram-CIIHVFJN-CYAul48m.js +1557 -0
  64. package/dist/wardley-L42UT6IY-D7b2ujEZ.js +22512 -0
  65. package/dist/wardleyDiagram-YWT4CUSO-B7Tg0MG9.js +675 -0
  66. package/dist/xychartDiagram-2RQKCTM6-xWYVEqth.js +1342 -0
  67. package/package.json +8 -7
  68. package/src/__tests__/assigner-runner-dependent-data.test.ts +32 -0
  69. package/src/__tests__/markdown-field.test.ts +150 -1
  70. package/src/__tests__/markdown-note-field.test.ts +86 -3
  71. package/src/__tests__/quiz-recorder.test.ts +47 -0
  72. package/src/__tests__/recorder-assigner-control.test.ts +844 -0
  73. package/src/__tests__/recorder-check-field.test.ts +103 -0
  74. package/src/__tests__/recorder-editor.test.ts +17 -0
  75. package/src/__tests__/recorder-markdown-assigner-integration.test.ts +49 -0
  76. package/src/__tests__/step-field.test.ts +87 -4
  77. package/src/__tests__/type-plugins.test.ts +1 -0
  78. package/src/__tests__/var-field-render.test.ts +741 -1
  79. package/src/components/AimdCodeField.vue +24 -5
  80. package/src/components/AimdMarkdownField.vue +548 -11
  81. package/src/components/AimdMarkdownNoteField.vue +241 -30
  82. package/src/components/AimdQuizOptionFollowups.vue +121 -0
  83. package/src/components/AimdQuizRecorder.vue +79 -148
  84. package/src/components/AimdRecorder.vue +1620 -98
  85. package/src/components/AimdRecorderEditor.vue +276 -8
  86. package/src/components/AimdRecorderWysiwygFieldHost.vue +6 -0
  87. package/src/components/AimdRecorderWysiwygSurface.vue +32 -0
  88. package/src/components/AimdStepCheckField.vue +205 -51
  89. package/src/components/AimdVarField.vue +694 -25
  90. package/src/components/AimdVarTableField.vue +283 -110
  91. package/src/components/icons/AimdAssignerCalculatorIcon.vue +18 -0
  92. package/src/components/icons/AimdAssignerCloudStatusIcon.vue +22 -0
  93. package/src/components/recorderMilkdownPlugin.ts +14 -0
  94. package/src/composables/__tests__/useRecordState.test.ts +114 -0
  95. package/src/composables/__tests__/useVarHelpers.test.ts +133 -0
  96. package/src/composables/index.ts +27 -1
  97. package/src/composables/useAssignerRunner.ts +376 -0
  98. package/src/composables/useCodeBlockRendering.ts +51 -0
  99. package/src/composables/useFieldRendering.ts +32 -4
  100. package/src/composables/useMonacoAutoHeight.ts +127 -0
  101. package/src/composables/useRecordState.ts +40 -14
  102. package/src/composables/useVarHelpers.ts +377 -9
  103. package/src/index.ts +13 -0
  104. package/src/locales.ts +47 -2
  105. package/src/styles/aimd.css +171 -6
  106. package/src/type-plugins.ts +7 -0
  107. package/src/types.ts +93 -2
  108. package/dist/AimdCodeField-DC3DPvgc.js +0 -172
  109. package/dist/AimdMarkdownField-CX71bOdX.js +0 -67
  110. 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: 240px;
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
- min-height: 240px;
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: 240px;
227
+ min-height: var(--aimd-code-field-editor-height);
209
228
  padding: 12px 14px;
210
229
  border: 0 none;
211
230
  resize: vertical;