@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.
Files changed (112) hide show
  1. package/README.md +42 -10
  2. package/README.zh-CN.md +42 -10
  3. package/dist/AimdCodeField-BQUuM-EF.js +182 -0
  4. package/dist/{AimdDnaSequenceField-D6ZgCDpp.js → AimdDnaSequenceField-TBKunqU_.js} +2 -2
  5. package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-B5Tq4zPV.js → AimdEditor.vue_vue_type_style_index_0_lang-tdh0dJNa.js} +3922 -3829
  6. package/dist/AimdMarkdownField-DmNX2g4j.js +254 -0
  7. package/dist/AimdMarkdownNoteField-B5ruzmwS.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-B-vsgEXF.js +83 -0
  11. package/dist/architectureDiagram-3BPJPVTR-BwPNOtNH.js +4692 -0
  12. package/dist/blockDiagram-GPEHLZMM-CMUI4kKc.js +2425 -0
  13. package/dist/c4Diagram-AAUBKEIU-Cpmfsy_s.js +1577 -0
  14. package/dist/channel-DlMAXHQK.js +5 -0
  15. package/dist/chunk-2J33WTMH-DP9BS2ux.js +19 -0
  16. package/dist/chunk-4BX2VUAB-ncsOeLMb.js +8 -0
  17. package/dist/chunk-55IACEB6-C7wHk4B7.js +8 -0
  18. package/dist/chunk-727SXJPM-Caa5aVUO.js +1528 -0
  19. package/dist/chunk-AQP2D5EJ-CL8egKqD.js +1387 -0
  20. package/dist/chunk-FMBD7UC4-heVR6BSA.js +19 -0
  21. package/dist/chunk-ND2GUHAM-BYH-wC2J.js +68 -0
  22. package/dist/chunk-QZHKN3VN-Bx2K7vkq.js +15 -0
  23. package/dist/classDiagram-4FO5ZUOK-BLLfLYy0.js +16 -0
  24. package/dist/classDiagram-v2-Q7XG4LA2-BLLfLYy0.js +16 -0
  25. package/dist/components.js +3776 -2247
  26. package/dist/composables.js +96 -70
  27. package/dist/cose-bilkent-S5V4N54A-E1YmM_xr.js +2609 -0
  28. package/dist/cytoscape.esm-r59gEWFs.js +18710 -0
  29. package/dist/dagre-BM42HDAG-BsXpQirH.js +445 -0
  30. package/dist/defaultLocale-BgPVtth8.js +171 -0
  31. package/dist/diagram-2AECGRRQ-CamqbWlY.js +217 -0
  32. package/dist/diagram-5GNKFQAL-DZyRFcOC.js +123 -0
  33. package/dist/diagram-KO2AKTUF-CmkGcy7R.js +461 -0
  34. package/dist/diagram-LMA3HP47-IdDwQPZ-.js +142 -0
  35. package/dist/diagram-OG6HWLK6-t0LBcUIU.js +528 -0
  36. package/dist/erDiagram-TEJ5UH35-DJBY2iZG.js +899 -0
  37. package/dist/flowDiagram-I6XJVG4X-DE4MzPPk.js +1628 -0
  38. package/dist/ganttDiagram-6RSMTGT7-CmAc35Yw.js +2707 -0
  39. package/dist/gitGraphDiagram-PVQCEYII-DDQZ5flw.js +815 -0
  40. package/dist/graph-BsJ8-1Pq.js +1510 -0
  41. package/dist/index.js +110 -83
  42. package/dist/infoDiagram-5YYISTIA-DSZjFR5g.js +24 -0
  43. package/dist/init-DjUOC4st.js +16 -0
  44. package/dist/ishikawaDiagram-YF4QCWOH-DCO9dx2L.js +621 -0
  45. package/dist/journeyDiagram-JHISSGLW-b-PpuBqg.js +834 -0
  46. package/dist/kanban-definition-UN3LZRKU-BjclDuJZ.js +724 -0
  47. package/dist/katex-DNob3HGn.js +11690 -0
  48. package/dist/layout-D4wqKu72.js +1703 -0
  49. package/dist/linear-Voc3BJib.js +259 -0
  50. package/dist/mermaid.core-Dt_VbeGP.js +15940 -0
  51. package/dist/mindmap-definition-RKZ34NQL-B3vrXRVY.js +827 -0
  52. package/dist/ordinal-B6-f3MAq.js +61 -0
  53. package/dist/pieDiagram-4H26LBE5-DFpWxSxk.js +163 -0
  54. package/dist/quadrantDiagram-W4KKPZXB-BYHcrGoB.js +1024 -0
  55. package/dist/record.js +1199 -0
  56. package/dist/requirementDiagram-4Y6WPE33-C-FgWrRz.js +882 -0
  57. package/dist/sankeyDiagram-5OEKKPKP-IwN0Evji.js +847 -0
  58. package/dist/sequenceDiagram-3UESZ5HK-_OnqhBO2.js +2891 -0
  59. package/dist/stateDiagram-AJRCARHV-BRLv0Zcw.js +263 -0
  60. package/dist/stateDiagram-v2-BHNVJYJU-BofX0AdS.js +16 -0
  61. package/dist/timeline-definition-PNZ67QCA-C-DpPLpw.js +1055 -0
  62. package/dist/{useFieldRendering-xLajJhyA.js → useCodeBlockRendering-DoTZaJTW.js} +1528 -1725
  63. package/dist/useMonacoAutoHeight-D4T-El3J.js +66 -0
  64. package/dist/vennDiagram-CIIHVFJN-zTHQR9Oq.js +1557 -0
  65. package/dist/wardley-L42UT6IY-D7b2ujEZ.js +22512 -0
  66. package/dist/wardleyDiagram-YWT4CUSO-au5koizO.js +675 -0
  67. package/dist/xychartDiagram-2RQKCTM6-BNf12P8z.js +1342 -0
  68. package/package.json +13 -8
  69. package/src/__tests__/assigner-graph.test.ts +82 -0
  70. package/src/__tests__/assigner-runner-dependent-data.test.ts +32 -0
  71. package/src/__tests__/markdown-field.test.ts +150 -1
  72. package/src/__tests__/markdown-note-field.test.ts +86 -3
  73. package/src/__tests__/recorder-assigner-control.test.ts +993 -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 +47 -1
  77. package/src/__tests__/type-plugins.test.ts +1 -0
  78. package/src/__tests__/var-field-render.test.ts +806 -1
  79. package/src/components/AimdAssignerGraph.vue +816 -0
  80. package/src/components/AimdCodeField.vue +24 -5
  81. package/src/components/AimdMarkdownField.vue +556 -11
  82. package/src/components/AimdMarkdownNoteField.vue +241 -30
  83. package/src/components/AimdRecorder.vue +1619 -99
  84. package/src/components/AimdRecorderEditor.vue +276 -8
  85. package/src/components/AimdRecorderWysiwygFieldHost.vue +6 -0
  86. package/src/components/AimdRecorderWysiwygSurface.vue +32 -0
  87. package/src/components/AimdStepCheckField.vue +82 -18
  88. package/src/components/AimdVarField.vue +694 -25
  89. package/src/components/AimdVarTableField.vue +325 -138
  90. package/src/components/icons/AimdAssignerCalculatorIcon.vue +18 -0
  91. package/src/components/icons/AimdAssignerCloudStatusIcon.vue +22 -0
  92. package/src/components/index.ts +9 -1
  93. package/src/components/recorderMilkdownPlugin.ts +14 -0
  94. package/src/composables/__tests__/useRecordState.test.ts +86 -0
  95. package/src/composables/__tests__/useVarHelpers.test.ts +175 -0
  96. package/src/composables/index.ts +28 -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 +22 -3
  102. package/src/composables/useVarHelpers.ts +237 -32
  103. package/src/index.ts +20 -1
  104. package/src/locales.ts +45 -0
  105. package/src/record/index.ts +120 -0
  106. package/src/styles/aimd.css +216 -1
  107. package/src/type-plugins.ts +7 -0
  108. package/src/type-utils.ts +1 -3
  109. package/src/types.ts +130 -2
  110. package/dist/AimdCodeField-DC3DPvgc.js +0 -172
  111. package/dist/AimdMarkdownField-BJ20QtO8.js +0 -67
  112. package/dist/AimdMarkdownNoteField-DwAQhoyk.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
+ }
65
254
  })
255
+
256
+ onBeforeUnmount(() => {
257
+ markdownAutoHeight.dispose()
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,97 @@ 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-state :deep(.aimd-rec-assigner-field__status--done) {
441
+ color: #16a34a;
442
+ }
443
+
444
+ .aimd-markdown-field__assigner-state :deep(.aimd-rec-assigner-field__status--error) {
445
+ color: #dc2626;
446
+ }
447
+
448
+ .aimd-markdown-field__assigner-error {
449
+ margin: 0;
450
+ border-top: 1px solid #fecaca;
109
451
  }
110
452
 
111
453
  .aimd-markdown-field__editor-shell {
@@ -114,6 +456,208 @@ watch(() => props.modelValue, (value) => {
114
456
  background: #fff;
115
457
  }
116
458
 
459
+ .aimd-markdown-field__view-btn {
460
+ min-width: 46px;
461
+ min-height: 24px;
462
+ border: 1px solid #cbd5e1;
463
+ background: #fff;
464
+ color: #475569;
465
+ font-size: 12px;
466
+ font-weight: 600;
467
+ line-height: 1;
468
+ cursor: pointer;
469
+ transition: background-color 0.18s, border-color 0.18s, color 0.18s;
470
+ }
471
+
472
+ .aimd-markdown-field__view-btn:first-child {
473
+ border-radius: 5px 0 0 5px;
474
+ }
475
+
476
+ .aimd-markdown-field__view-btn:last-child {
477
+ margin-left: -1px;
478
+ border-radius: 0 5px 5px 0;
479
+ }
480
+
481
+ .aimd-markdown-field__view-btn:hover {
482
+ border-color: #9db1cc;
483
+ color: #1f4f8f;
484
+ }
485
+
486
+ .aimd-markdown-field__view-btn--active {
487
+ position: relative;
488
+ border-color: #2563eb;
489
+ background: #eff6ff;
490
+ color: #1d4ed8;
491
+ }
492
+
493
+ .aimd-markdown-field__preview-shell {
494
+ min-width: 0;
495
+ min-height: var(--aimd-markdown-field-editor-height);
496
+ padding: 14px 18px;
497
+ background: #fff;
498
+ color: #334155;
499
+ font-size: 15px;
500
+ line-height: 1.65;
501
+ }
502
+
503
+ .aimd-markdown-field__preview {
504
+ min-width: 0;
505
+ }
506
+
507
+ .aimd-markdown-field__preview-empty {
508
+ color: #94a3b8;
509
+ font-size: 13px;
510
+ }
511
+
512
+ .aimd-markdown-field__preview-fallback,
513
+ .aimd-markdown-field__mermaid-fallback {
514
+ margin: 0;
515
+ white-space: pre-wrap;
516
+ word-break: break-word;
517
+ font: inherit;
518
+ color: inherit;
519
+ }
520
+
521
+ .aimd-markdown-field__mermaid {
522
+ overflow-x: auto;
523
+ }
524
+
525
+ .aimd-markdown-field__mermaid :deep(svg) {
526
+ max-width: 100%;
527
+ height: auto;
528
+ }
529
+
530
+ .aimd-markdown-field__preview :deep(ul),
531
+ .aimd-markdown-field__preview :deep(ol) {
532
+ margin: 0.45em 0 0.75em;
533
+ padding-left: 1.6em;
534
+ }
535
+
536
+ .aimd-markdown-field__preview :deep(ul) {
537
+ list-style: disc outside;
538
+ }
539
+
540
+ .aimd-markdown-field__preview :deep(ol) {
541
+ list-style: decimal outside;
542
+ }
543
+
544
+ .aimd-markdown-field__preview :deep(li + li) {
545
+ margin-top: 0.25em;
546
+ }
547
+
548
+ .aimd-markdown-field__preview :deep(blockquote) {
549
+ margin: 0.8em 0;
550
+ padding: 0.25em 0 0.25em 0.9em;
551
+ border-left: 3px solid #cbd5e1;
552
+ color: #475569;
553
+ }
554
+
555
+ .aimd-markdown-field__preview :deep(:not(pre) > code) {
556
+ padding: 0.1em 0.32em;
557
+ border-radius: 4px;
558
+ background: #f1f5f9;
559
+ color: #0f172a;
560
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
561
+ font-size: 0.92em;
562
+ }
563
+
564
+ .aimd-markdown-field__preview :deep(pre) {
565
+ overflow-x: auto;
566
+ padding: 10px 12px;
567
+ border: 1px solid #e2e8f0;
568
+ border-radius: 6px;
569
+ background: #f8fafc;
570
+ }
571
+
572
+ .aimd-markdown-field__preview :deep(pre code) {
573
+ padding: 0;
574
+ background: transparent;
575
+ }
576
+
577
+ .aimd-markdown-field__preview :deep(.aimd-code-block) {
578
+ max-width: 100%;
579
+ overflow: hidden;
580
+ margin: 0.9em 0;
581
+ padding: 0;
582
+ border: 1px solid #d8e1ee;
583
+ border-radius: 8px;
584
+ background: #f8fafc;
585
+ color: #0f172a;
586
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
587
+ font-size: 13px;
588
+ line-height: 1.58;
589
+ white-space: normal;
590
+ }
591
+
592
+ .aimd-markdown-field__preview :deep(.aimd-code-block__code) {
593
+ display: block;
594
+ padding: 10px 0;
595
+ border-radius: 0;
596
+ background: transparent;
597
+ }
598
+
599
+ .aimd-markdown-field__preview :deep(.aimd-code-block__line) {
600
+ display: grid;
601
+ grid-template-columns: max-content minmax(0, 1fr);
602
+ column-gap: 12px;
603
+ padding-right: 12px;
604
+ }
605
+
606
+ .aimd-markdown-field__preview :deep(.aimd-code-block__line-number) {
607
+ min-width: 3ch;
608
+ padding-left: 12px;
609
+ color: #94a3b8;
610
+ text-align: right;
611
+ user-select: none;
612
+ }
613
+
614
+ .aimd-markdown-field__preview :deep(.aimd-code-block__line-code) {
615
+ min-width: 0;
616
+ white-space: pre-wrap;
617
+ overflow-wrap: anywhere;
618
+ }
619
+
620
+ .aimd-markdown-field__preview :deep(.aimd-code-block--wrap .aimd-code-block__line-code) {
621
+ padding-left: var(--aimd-code-wrap-indent, 0ch);
622
+ text-indent: calc(-1 * var(--aimd-code-wrap-indent, 0ch));
623
+ }
624
+
625
+ .aimd-markdown-field__preview :deep(table) {
626
+ width: 100%;
627
+ border-collapse: collapse;
628
+ margin: 0.8em 0;
629
+ font-size: 0.95em;
630
+ }
631
+
632
+ .aimd-markdown-field__preview :deep(th),
633
+ .aimd-markdown-field__preview :deep(td) {
634
+ padding: 7px 9px;
635
+ border: 1px solid #d8e1ee;
636
+ text-align: left;
637
+ vertical-align: top;
638
+ }
639
+
640
+ .aimd-markdown-field__preview :deep(th) {
641
+ background: #f8fbff;
642
+ font-weight: 650;
643
+ }
644
+
645
+ .aimd-markdown-field__preview :deep(p:first-child),
646
+ .aimd-markdown-field__preview :deep(ul:first-child),
647
+ .aimd-markdown-field__preview :deep(ol:first-child),
648
+ .aimd-markdown-field__preview :deep(blockquote:first-child),
649
+ .aimd-markdown-field__preview :deep(pre:first-child) {
650
+ margin-top: 0;
651
+ }
652
+
653
+ .aimd-markdown-field__preview :deep(p:last-child),
654
+ .aimd-markdown-field__preview :deep(ul:last-child),
655
+ .aimd-markdown-field__preview :deep(ol:last-child),
656
+ .aimd-markdown-field__preview :deep(blockquote:last-child),
657
+ .aimd-markdown-field__preview :deep(pre:last-child) {
658
+ margin-bottom: 0;
659
+ }
660
+
117
661
  .aimd-markdown-field__editor-shell :deep(.aimd-editor) {
118
662
  border: 0 none;
119
663
  border-radius: 0;
@@ -128,13 +672,13 @@ watch(() => props.modelValue, (value) => {
128
672
 
129
673
  .aimd-markdown-field__editor-shell :deep(.aimd-editor-panel) {
130
674
  min-width: 0;
675
+ min-height: var(--aimd-markdown-field-editor-height) !important;
131
676
  }
132
677
 
133
678
  .aimd-markdown-field__editor-shell :deep(.aimd-editor-source-mode),
134
679
  .aimd-markdown-field__editor-shell :deep(.aimd-editor-wysiwyg-mode) {
135
- height: auto !important;
136
- min-height: 360px;
137
- overflow-y: visible !important;
680
+ height: var(--aimd-markdown-field-editor-height) !important;
681
+ min-height: var(--aimd-markdown-field-editor-height);
138
682
  background: #fff;
139
683
  border-radius: 0 0 8px 8px;
140
684
  }
@@ -144,15 +688,16 @@ watch(() => props.modelValue, (value) => {
144
688
  }
145
689
 
146
690
  .aimd-markdown-field__editor-shell :deep(.aimd-editor-container) {
147
- min-height: 360px;
691
+ height: var(--aimd-markdown-field-editor-height);
692
+ min-height: var(--aimd-markdown-field-editor-height);
148
693
  }
149
694
 
150
695
  .aimd-markdown-field__editor-shell :deep(.milkdown) {
151
- min-height: 360px;
696
+ min-height: var(--aimd-markdown-field-editor-height);
152
697
  }
153
698
 
154
699
  .aimd-markdown-field__editor-shell :deep(.milkdown-editor-content) {
155
- min-height: 360px;
700
+ min-height: var(--aimd-markdown-field-editor-height);
156
701
  padding: 14px 16px 18px;
157
702
  box-sizing: border-box;
158
703
  }