@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,8 +1,11 @@
1
1
  <script setup lang="ts">
2
- import { ref, watch } from 'vue'
2
+ import { computed, defineComponent, h, onBeforeUnmount, ref, shallowRef, watch, type PropType, type VNode } from 'vue'
3
3
  import { AimdEditor } from '@airalogy/aimd-editor/vue'
4
+ import { createMermaidRenderer, renderToVue } from '@airalogy/aimd-renderer'
4
5
  import type { AimdRecorderMessages } from '../locales'
5
6
  import { getAimdRecorderScopeLabel } from '../locales'
7
+ import { createChainedElementRenderer, useCodeBlockRendering } from '../composables/useCodeBlockRendering'
8
+ import { createMonacoAutoHeight, type MonacoAutoHeightEditor } from '../composables/useMonacoAutoHeight'
6
9
 
7
10
  const props = withDefaults(defineProps<{
8
11
  modelValue?: unknown
@@ -10,10 +13,16 @@ const props = withDefaults(defineProps<{
10
13
  disabled?: boolean
11
14
  locale?: string
12
15
  messages: Pick<AimdRecorderMessages, 'scope'>
16
+ assignerControl?: VNode
17
+ assignerStatus?: VNode
18
+ assignerError?: string
13
19
  }>(), {
14
20
  modelValue: undefined,
15
21
  disabled: false,
16
22
  locale: undefined,
23
+ assignerControl: undefined,
24
+ assignerStatus: undefined,
25
+ assignerError: undefined,
17
26
  })
18
27
 
19
28
  const emit = defineEmits<{
@@ -33,10 +42,177 @@ function normalizeMarkdownModelValue(value: unknown): string {
33
42
  return String(value)
34
43
  }
35
44
 
45
+ function isZhLocale(locale?: string): boolean {
46
+ return locale?.toLowerCase().startsWith('zh') ?? false
47
+ }
48
+
49
+ type MermaidApi = {
50
+ initialize: (config: Record<string, unknown>) => void
51
+ render: (id: string, text: string) => Promise<{ svg: string }> | { svg: string }
52
+ }
53
+
54
+ let mermaidRenderId = 0
55
+
56
+ const AimdMarkdownMermaidBlock = defineComponent({
57
+ name: 'AimdMarkdownMermaidBlock',
58
+ props: {
59
+ code: { type: String, required: true },
60
+ },
61
+ setup(mermaidProps) {
62
+ const svg = ref('')
63
+ const failed = ref(false)
64
+ let renderRequestId = 0
65
+
66
+ async function renderMermaid() {
67
+ const code = mermaidProps.code.trim()
68
+ const requestId = ++renderRequestId
69
+ if (!code) {
70
+ svg.value = ''
71
+ failed.value = false
72
+ return
73
+ }
74
+
75
+ try {
76
+ const mermaidModule = await import('mermaid') as { default: MermaidApi }
77
+ const mermaid = mermaidModule.default
78
+ mermaid.initialize({
79
+ startOnLoad: false,
80
+ securityLevel: 'strict',
81
+ })
82
+ const result = await mermaid.render(`aimd-markdown-mermaid-${++mermaidRenderId}`, code)
83
+ if (requestId !== renderRequestId) {
84
+ return
85
+ }
86
+
87
+ svg.value = result.svg
88
+ failed.value = false
89
+ } catch {
90
+ if (requestId !== renderRequestId) {
91
+ return
92
+ }
93
+
94
+ svg.value = ''
95
+ failed.value = true
96
+ }
97
+ }
98
+
99
+ watch(() => mermaidProps.code, () => {
100
+ void renderMermaid()
101
+ }, { immediate: true })
102
+
103
+ return () => failed.value
104
+ ? h('pre', { class: 'aimd-markdown-field__mermaid-fallback' }, mermaidProps.code)
105
+ : h('div', {
106
+ class: 'aimd-markdown-field__mermaid',
107
+ innerHTML: svg.value,
108
+ })
109
+ },
110
+ })
111
+
112
+ const { preRenderer: codeBlockPreRenderer } = useCodeBlockRendering(() => {
113
+ void renderPreview()
114
+ })
115
+
36
116
  const fieldRootRef = ref<HTMLElement | null>(null)
37
117
  const draftValue = ref(normalizeMarkdownModelValue(props.modelValue))
118
+ const viewMode = ref<'preview' | 'source'>(draftValue.value.trim() ? 'preview' : 'source')
119
+ const markdownAutoHeight = createMonacoAutoHeight({
120
+ getInitialValue: () => draftValue.value,
121
+ getLayoutElement: () => fieldRootRef.value?.querySelector('.aimd-editor-container') as HTMLElement | null,
122
+ maxHeight: 560,
123
+ })
124
+ const markdownEditorHeight = markdownAutoHeight.editorHeight
125
+ const markdownFieldStyle = computed(() => ({
126
+ '--aimd-markdown-field-editor-height': `${markdownEditorHeight.value}px`,
127
+ }))
128
+ const previewNodes = shallowRef<VNode[]>([])
129
+ const previewRenderFailed = ref(false)
130
+ let previewRenderRequestId = 0
131
+ const RenderVNode = defineComponent({
132
+ name: 'RenderVNode',
133
+ props: {
134
+ vnode: { type: Object as PropType<VNode>, required: true },
135
+ },
136
+ setup(renderProps) {
137
+ return () => renderProps.vnode
138
+ },
139
+ })
140
+
141
+ const PreviewOutlet = defineComponent({
142
+ name: 'AimdMarkdownFieldPreviewOutlet',
143
+ props: {
144
+ nodes: {
145
+ type: Array as () => VNode[],
146
+ required: true,
147
+ },
148
+ },
149
+ setup(previewProps) {
150
+ return () => previewProps.nodes
151
+ },
152
+ })
153
+
154
+ const hasValue = computed(() => Boolean(draftValue.value.trim()))
155
+ const showPreview = computed(() => viewMode.value === 'preview')
156
+ const previewLabel = computed(() => (isZhLocale(props.locale) ? '预览' : 'Preview'))
157
+ const sourceLabel = computed(() => (isZhLocale(props.locale) ? '源码' : 'Source'))
158
+ const emptyPreviewLabel = computed(() => (isZhLocale(props.locale) ? '暂无内容' : 'No content'))
159
+ const previewToolbarLabel = computed(() => (isZhLocale(props.locale) ? 'Markdown 显示模式' : 'Markdown view mode'))
160
+ const markdownMonacoOptions = computed(() => ({
161
+ minimap: { enabled: false },
162
+ lineHeight: markdownAutoHeight.lineHeight,
163
+ padding: { top: 12, bottom: 12 },
164
+ scrollbar: { vertical: 'auto', horizontal: 'auto' },
165
+ }))
166
+
167
+ async function renderPreview() {
168
+ const currentContent = draftValue.value.trim()
169
+ const requestId = ++previewRenderRequestId
170
+
171
+ if (!currentContent) {
172
+ previewNodes.value = []
173
+ previewRenderFailed.value = false
174
+ return
175
+ }
176
+
177
+ try {
178
+ const rendered = await renderToVue(currentContent, {
179
+ locale: props.locale,
180
+ mode: 'preview',
181
+ elementRenderers: {
182
+ pre: createChainedElementRenderer(
183
+ createMermaidRenderer(AimdMarkdownMermaidBlock),
184
+ codeBlockPreRenderer,
185
+ ),
186
+ },
187
+ })
188
+
189
+ if (requestId !== previewRenderRequestId) {
190
+ return
191
+ }
192
+
193
+ previewNodes.value = rendered.nodes
194
+ previewRenderFailed.value = false
195
+ } catch {
196
+ if (requestId !== previewRenderRequestId) {
197
+ return
198
+ }
199
+
200
+ previewNodes.value = []
201
+ previewRenderFailed.value = true
202
+ }
203
+ }
204
+
205
+ function switchToPreview() {
206
+ viewMode.value = 'preview'
207
+ void renderPreview()
208
+ }
209
+
210
+ function switchToSource() {
211
+ viewMode.value = 'source'
212
+ }
38
213
 
39
214
  function emitDraftValue(markdown: string) {
215
+ markdownAutoHeight.syncEstimatedEditorHeight(markdown)
40
216
  if (markdown === draftValue.value) {
41
217
  return
42
218
  }
@@ -45,6 +221,14 @@ function emitDraftValue(markdown: string) {
45
221
  emit('update:modelValue', markdown)
46
222
  }
47
223
 
224
+ function handleMarkdownEditorReady(editor: { monaco?: MonacoAutoHeightEditor }) {
225
+ if (!editor.monaco) {
226
+ return
227
+ }
228
+
229
+ markdownAutoHeight.attachEditor(editor.monaco)
230
+ }
231
+
48
232
  function emitBlurIfLeavingField(event: FocusEvent) {
49
233
  const currentTarget = fieldRootRef.value
50
234
  const nextTarget = event.relatedTarget as Node | null
@@ -61,15 +245,36 @@ watch(() => props.modelValue, (value) => {
61
245
  return
62
246
  }
63
247
 
248
+ const hadValue = hasValue.value
64
249
  draftValue.value = nextValue
250
+ markdownAutoHeight.syncEstimatedEditorHeight(nextValue)
251
+ if (!hadValue && nextValue.trim()) {
252
+ viewMode.value = 'preview'
253
+ }
254
+ })
255
+
256
+ onBeforeUnmount(() => {
257
+ markdownAutoHeight.dispose()
65
258
  })
259
+
260
+ watch(
261
+ () => [draftValue.value, props.locale] as const,
262
+ () => {
263
+ void renderPreview()
264
+ },
265
+ { immediate: true },
266
+ )
66
267
  </script>
67
268
 
68
269
  <template>
69
270
  <div
70
271
  ref="fieldRootRef"
71
272
  class="aimd-rec-inline aimd-rec-inline--var-stacked aimd-rec-inline--var-markdown aimd-field-wrapper aimd-markdown-field"
72
- :class="{ 'aimd-markdown-field--disabled': disabled }"
273
+ :class="{
274
+ 'aimd-markdown-field--disabled': disabled,
275
+ 'aimd-markdown-field--has-assigner-control': assignerControl || assignerStatus,
276
+ }"
277
+ :style="markdownFieldStyle"
73
278
  @focusout="emitBlurIfLeavingField"
74
279
  >
75
280
  <span class="aimd-field aimd-field--no-style aimd-field__label">
@@ -77,10 +282,58 @@ watch(() => props.modelValue, (value) => {
77
282
  {{ getAimdRecorderScopeLabel('var', messages) }}
78
283
  </span>
79
284
  <span class="aimd-field__id">{{ varId }}</span>
285
+ <span class="aimd-markdown-field__header-actions">
286
+ <span class="aimd-markdown-field__view-switch" :aria-label="previewToolbarLabel">
287
+ <button
288
+ type="button"
289
+ class="aimd-markdown-field__view-btn"
290
+ :class="{ 'aimd-markdown-field__view-btn--active': showPreview }"
291
+ :aria-pressed="showPreview"
292
+ @click="switchToPreview"
293
+ >
294
+ {{ previewLabel }}
295
+ </button>
296
+ <button
297
+ type="button"
298
+ class="aimd-markdown-field__view-btn"
299
+ :class="{ 'aimd-markdown-field__view-btn--active': !showPreview }"
300
+ :aria-pressed="!showPreview"
301
+ @click="switchToSource"
302
+ >
303
+ {{ sourceLabel }}
304
+ </button>
305
+ </span>
306
+ <span v-if="assignerControl || assignerStatus" class="aimd-markdown-field__assigner-actions">
307
+ <span v-if="assignerControl" class="aimd-markdown-field__assigner-action">
308
+ <RenderVNode :vnode="assignerControl" />
309
+ </span>
310
+ <span v-if="assignerStatus" class="aimd-markdown-field__assigner-state">
311
+ <RenderVNode :vnode="assignerStatus" />
312
+ </span>
313
+ </span>
314
+ </span>
315
+ </span>
316
+
317
+ <span v-if="assignerError" class="aimd-rec-inline__assigner-error aimd-markdown-field__assigner-error">
318
+ {{ assignerError }}
80
319
  </span>
81
320
 
82
321
  <div class="aimd-markdown-field__editor-shell">
322
+ <div v-if="showPreview" class="aimd-markdown-field__preview-shell">
323
+ <div v-if="!hasValue" class="aimd-markdown-field__preview-empty">
324
+ {{ emptyPreviewLabel }}
325
+ </div>
326
+ <pre
327
+ v-else-if="previewRenderFailed"
328
+ class="aimd-markdown-field__preview-fallback"
329
+ >{{ draftValue }}</pre>
330
+ <div v-else class="aimd-markdown-field__preview">
331
+ <PreviewOutlet :nodes="previewNodes" />
332
+ </div>
333
+ </div>
334
+
83
335
  <AimdEditor
336
+ v-else
84
337
  class="aimd-markdown-field__editor"
85
338
  :model-value="draftValue"
86
339
  :locale="locale"
@@ -92,10 +345,11 @@ watch(() => props.modelValue, (value) => {
92
345
  :show-aimd-toolbar="true"
93
346
  :enable-block-handle="!disabled"
94
347
  :keep-inactive-editors-mounted="false"
95
- :min-height="360"
348
+ :min-height="markdownEditorHeight"
96
349
  :readonly="disabled"
97
- :monaco-options="{ minimap: { enabled: false } }"
350
+ :monaco-options="markdownMonacoOptions"
98
351
  @update:model-value="emitDraftValue"
352
+ @ready="handleMarkdownEditorReady"
99
353
  />
100
354
  </div>
101
355
  </div>
@@ -103,9 +357,89 @@ watch(() => props.modelValue, (value) => {
103
357
 
104
358
  <style scoped>
105
359
  .aimd-markdown-field {
106
- width: min(100%, 1040px);
360
+ width: 100%;
107
361
  min-width: 0;
108
362
  max-width: 100%;
363
+ box-sizing: border-box;
364
+ border-color: #d8e1ee;
365
+ background: #fff;
366
+ }
367
+
368
+ .aimd-markdown-field.aimd-rec-inline--var-stacked:focus-within {
369
+ border-color: #b8c7dc;
370
+ box-shadow: 0 0 0 1px rgba(100, 116, 139, 0.12);
371
+ }
372
+
373
+ .aimd-markdown-field .aimd-field__label {
374
+ display: flex;
375
+ align-items: center;
376
+ gap: 8px;
377
+ min-height: 36px;
378
+ border-radius: 8px 8px 0 0;
379
+ background: #f8fbff;
380
+ border-bottom: 1px solid #e2e8f0;
381
+ }
382
+
383
+ .aimd-markdown-field__header-actions {
384
+ display: inline-flex;
385
+ flex: 0 0 auto;
386
+ align-items: center;
387
+ gap: 8px;
388
+ margin-left: auto;
389
+ padding-right: 8px;
390
+ }
391
+
392
+ .aimd-markdown-field__view-switch {
393
+ display: inline-flex;
394
+ flex: 0 0 auto;
395
+ align-items: center;
396
+ }
397
+
398
+ .aimd-markdown-field__assigner-actions {
399
+ display: inline-flex;
400
+ align-items: center;
401
+ gap: 4px;
402
+ }
403
+
404
+ .aimd-markdown-field__assigner-action,
405
+ .aimd-markdown-field__assigner-state {
406
+ display: inline-flex;
407
+ align-items: center;
408
+ justify-content: center;
409
+ }
410
+
411
+ .aimd-markdown-field__assigner-action :deep(.aimd-rec-assigner-field__button) {
412
+ width: 30px;
413
+ min-width: 30px;
414
+ height: 26px;
415
+ min-height: 26px;
416
+ border: 0 none;
417
+ border-radius: 6px;
418
+ margin: 0;
419
+ background: #eaf4ff;
420
+ color: #1976d2;
421
+ box-shadow: none;
422
+ font-size: 16px;
423
+ }
424
+
425
+ .aimd-markdown-field__assigner-action :deep(.aimd-rec-assigner-field__button:hover:not(:disabled)) {
426
+ background: #dbeafe;
427
+ color: #1565c0;
428
+ }
429
+
430
+ .aimd-markdown-field__assigner-action :deep(.aimd-rec-assigner-field__spinner) {
431
+ border-color: rgba(25, 118, 210, 0.25);
432
+ border-top-color: #1976d2;
433
+ }
434
+
435
+ .aimd-markdown-field__assigner-state :deep(.aimd-rec-assigner-field__status) {
436
+ color: #94a3b8;
437
+ font-size: 16px;
438
+ }
439
+
440
+ .aimd-markdown-field__assigner-error {
441
+ margin: 0;
442
+ border-top: 1px solid #fecaca;
109
443
  }
110
444
 
111
445
  .aimd-markdown-field__editor-shell {
@@ -114,6 +448,208 @@ watch(() => props.modelValue, (value) => {
114
448
  background: #fff;
115
449
  }
116
450
 
451
+ .aimd-markdown-field__view-btn {
452
+ min-width: 46px;
453
+ min-height: 24px;
454
+ border: 1px solid #cbd5e1;
455
+ background: #fff;
456
+ color: #475569;
457
+ font-size: 12px;
458
+ font-weight: 600;
459
+ line-height: 1;
460
+ cursor: pointer;
461
+ transition: background-color 0.18s, border-color 0.18s, color 0.18s;
462
+ }
463
+
464
+ .aimd-markdown-field__view-btn:first-child {
465
+ border-radius: 5px 0 0 5px;
466
+ }
467
+
468
+ .aimd-markdown-field__view-btn:last-child {
469
+ margin-left: -1px;
470
+ border-radius: 0 5px 5px 0;
471
+ }
472
+
473
+ .aimd-markdown-field__view-btn:hover {
474
+ border-color: #9db1cc;
475
+ color: #1f4f8f;
476
+ }
477
+
478
+ .aimd-markdown-field__view-btn--active {
479
+ position: relative;
480
+ border-color: #2563eb;
481
+ background: #eff6ff;
482
+ color: #1d4ed8;
483
+ }
484
+
485
+ .aimd-markdown-field__preview-shell {
486
+ min-width: 0;
487
+ min-height: var(--aimd-markdown-field-editor-height);
488
+ padding: 14px 18px;
489
+ background: #fff;
490
+ color: #334155;
491
+ font-size: 15px;
492
+ line-height: 1.65;
493
+ }
494
+
495
+ .aimd-markdown-field__preview {
496
+ min-width: 0;
497
+ }
498
+
499
+ .aimd-markdown-field__preview-empty {
500
+ color: #94a3b8;
501
+ font-size: 13px;
502
+ }
503
+
504
+ .aimd-markdown-field__preview-fallback,
505
+ .aimd-markdown-field__mermaid-fallback {
506
+ margin: 0;
507
+ white-space: pre-wrap;
508
+ word-break: break-word;
509
+ font: inherit;
510
+ color: inherit;
511
+ }
512
+
513
+ .aimd-markdown-field__mermaid {
514
+ overflow-x: auto;
515
+ }
516
+
517
+ .aimd-markdown-field__mermaid :deep(svg) {
518
+ max-width: 100%;
519
+ height: auto;
520
+ }
521
+
522
+ .aimd-markdown-field__preview :deep(ul),
523
+ .aimd-markdown-field__preview :deep(ol) {
524
+ margin: 0.45em 0 0.75em;
525
+ padding-left: 1.6em;
526
+ }
527
+
528
+ .aimd-markdown-field__preview :deep(ul) {
529
+ list-style: disc outside;
530
+ }
531
+
532
+ .aimd-markdown-field__preview :deep(ol) {
533
+ list-style: decimal outside;
534
+ }
535
+
536
+ .aimd-markdown-field__preview :deep(li + li) {
537
+ margin-top: 0.25em;
538
+ }
539
+
540
+ .aimd-markdown-field__preview :deep(blockquote) {
541
+ margin: 0.8em 0;
542
+ padding: 0.25em 0 0.25em 0.9em;
543
+ border-left: 3px solid #cbd5e1;
544
+ color: #475569;
545
+ }
546
+
547
+ .aimd-markdown-field__preview :deep(:not(pre) > code) {
548
+ padding: 0.1em 0.32em;
549
+ border-radius: 4px;
550
+ background: #f1f5f9;
551
+ color: #0f172a;
552
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
553
+ font-size: 0.92em;
554
+ }
555
+
556
+ .aimd-markdown-field__preview :deep(pre) {
557
+ overflow-x: auto;
558
+ padding: 10px 12px;
559
+ border: 1px solid #e2e8f0;
560
+ border-radius: 6px;
561
+ background: #f8fafc;
562
+ }
563
+
564
+ .aimd-markdown-field__preview :deep(pre code) {
565
+ padding: 0;
566
+ background: transparent;
567
+ }
568
+
569
+ .aimd-markdown-field__preview :deep(.aimd-code-block) {
570
+ max-width: 100%;
571
+ overflow: hidden;
572
+ margin: 0.9em 0;
573
+ padding: 0;
574
+ border: 1px solid #d8e1ee;
575
+ border-radius: 8px;
576
+ background: #f8fafc;
577
+ color: #0f172a;
578
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
579
+ font-size: 13px;
580
+ line-height: 1.58;
581
+ white-space: normal;
582
+ }
583
+
584
+ .aimd-markdown-field__preview :deep(.aimd-code-block__code) {
585
+ display: block;
586
+ padding: 10px 0;
587
+ border-radius: 0;
588
+ background: transparent;
589
+ }
590
+
591
+ .aimd-markdown-field__preview :deep(.aimd-code-block__line) {
592
+ display: grid;
593
+ grid-template-columns: max-content minmax(0, 1fr);
594
+ column-gap: 12px;
595
+ padding-right: 12px;
596
+ }
597
+
598
+ .aimd-markdown-field__preview :deep(.aimd-code-block__line-number) {
599
+ min-width: 3ch;
600
+ padding-left: 12px;
601
+ color: #94a3b8;
602
+ text-align: right;
603
+ user-select: none;
604
+ }
605
+
606
+ .aimd-markdown-field__preview :deep(.aimd-code-block__line-code) {
607
+ min-width: 0;
608
+ white-space: pre-wrap;
609
+ overflow-wrap: anywhere;
610
+ }
611
+
612
+ .aimd-markdown-field__preview :deep(.aimd-code-block--wrap .aimd-code-block__line-code) {
613
+ padding-left: var(--aimd-code-wrap-indent, 0ch);
614
+ text-indent: calc(-1 * var(--aimd-code-wrap-indent, 0ch));
615
+ }
616
+
617
+ .aimd-markdown-field__preview :deep(table) {
618
+ width: 100%;
619
+ border-collapse: collapse;
620
+ margin: 0.8em 0;
621
+ font-size: 0.95em;
622
+ }
623
+
624
+ .aimd-markdown-field__preview :deep(th),
625
+ .aimd-markdown-field__preview :deep(td) {
626
+ padding: 7px 9px;
627
+ border: 1px solid #d8e1ee;
628
+ text-align: left;
629
+ vertical-align: top;
630
+ }
631
+
632
+ .aimd-markdown-field__preview :deep(th) {
633
+ background: #f8fbff;
634
+ font-weight: 650;
635
+ }
636
+
637
+ .aimd-markdown-field__preview :deep(p:first-child),
638
+ .aimd-markdown-field__preview :deep(ul:first-child),
639
+ .aimd-markdown-field__preview :deep(ol:first-child),
640
+ .aimd-markdown-field__preview :deep(blockquote:first-child),
641
+ .aimd-markdown-field__preview :deep(pre:first-child) {
642
+ margin-top: 0;
643
+ }
644
+
645
+ .aimd-markdown-field__preview :deep(p:last-child),
646
+ .aimd-markdown-field__preview :deep(ul:last-child),
647
+ .aimd-markdown-field__preview :deep(ol:last-child),
648
+ .aimd-markdown-field__preview :deep(blockquote:last-child),
649
+ .aimd-markdown-field__preview :deep(pre:last-child) {
650
+ margin-bottom: 0;
651
+ }
652
+
117
653
  .aimd-markdown-field__editor-shell :deep(.aimd-editor) {
118
654
  border: 0 none;
119
655
  border-radius: 0;
@@ -128,13 +664,13 @@ watch(() => props.modelValue, (value) => {
128
664
 
129
665
  .aimd-markdown-field__editor-shell :deep(.aimd-editor-panel) {
130
666
  min-width: 0;
667
+ min-height: var(--aimd-markdown-field-editor-height) !important;
131
668
  }
132
669
 
133
670
  .aimd-markdown-field__editor-shell :deep(.aimd-editor-source-mode),
134
671
  .aimd-markdown-field__editor-shell :deep(.aimd-editor-wysiwyg-mode) {
135
- height: auto !important;
136
- min-height: 360px;
137
- overflow-y: visible !important;
672
+ height: var(--aimd-markdown-field-editor-height) !important;
673
+ min-height: var(--aimd-markdown-field-editor-height);
138
674
  background: #fff;
139
675
  border-radius: 0 0 8px 8px;
140
676
  }
@@ -144,15 +680,16 @@ watch(() => props.modelValue, (value) => {
144
680
  }
145
681
 
146
682
  .aimd-markdown-field__editor-shell :deep(.aimd-editor-container) {
147
- min-height: 360px;
683
+ height: var(--aimd-markdown-field-editor-height);
684
+ min-height: var(--aimd-markdown-field-editor-height);
148
685
  }
149
686
 
150
687
  .aimd-markdown-field__editor-shell :deep(.milkdown) {
151
- min-height: 360px;
688
+ min-height: var(--aimd-markdown-field-editor-height);
152
689
  }
153
690
 
154
691
  .aimd-markdown-field__editor-shell :deep(.milkdown-editor-content) {
155
- min-height: 360px;
692
+ min-height: var(--aimd-markdown-field-editor-height);
156
693
  padding: 14px 16px 18px;
157
694
  box-sizing: border-box;
158
695
  }