@airalogy/aimd-recorder 1.17.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 (106) 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-D6ZgCDpp.js → AimdDnaSequenceField-KZU2Zj3E.js} +2 -2
  5. package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-B5Tq4zPV.js → AimdEditor.vue_vue_type_style_index_0_lang-CzfYPp5r.js} +3922 -3829
  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 +3279 -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-xLajJhyA.js → useCodeBlockRendering-qA6gj4vz.js} +3035 -2254
  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 +9 -8
  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__/recorder-assigner-control.test.ts +844 -0
  72. package/src/__tests__/recorder-editor.test.ts +17 -0
  73. package/src/__tests__/recorder-markdown-assigner-integration.test.ts +49 -0
  74. package/src/__tests__/step-field.test.ts +47 -1
  75. package/src/__tests__/type-plugins.test.ts +1 -0
  76. package/src/__tests__/var-field-render.test.ts +741 -1
  77. package/src/components/AimdCodeField.vue +24 -5
  78. package/src/components/AimdMarkdownField.vue +548 -11
  79. package/src/components/AimdMarkdownNoteField.vue +241 -30
  80. package/src/components/AimdRecorder.vue +1521 -95
  81. package/src/components/AimdRecorderEditor.vue +276 -8
  82. package/src/components/AimdRecorderWysiwygFieldHost.vue +6 -0
  83. package/src/components/AimdRecorderWysiwygSurface.vue +32 -0
  84. package/src/components/AimdStepCheckField.vue +82 -18
  85. package/src/components/AimdVarField.vue +694 -25
  86. package/src/components/AimdVarTableField.vue +283 -110
  87. package/src/components/icons/AimdAssignerCalculatorIcon.vue +18 -0
  88. package/src/components/icons/AimdAssignerCloudStatusIcon.vue +22 -0
  89. package/src/components/recorderMilkdownPlugin.ts +14 -0
  90. package/src/composables/__tests__/useRecordState.test.ts +86 -0
  91. package/src/composables/__tests__/useVarHelpers.test.ts +133 -0
  92. package/src/composables/index.ts +27 -1
  93. package/src/composables/useAssignerRunner.ts +376 -0
  94. package/src/composables/useCodeBlockRendering.ts +51 -0
  95. package/src/composables/useFieldRendering.ts +32 -4
  96. package/src/composables/useMonacoAutoHeight.ts +127 -0
  97. package/src/composables/useRecordState.ts +22 -3
  98. package/src/composables/useVarHelpers.ts +377 -9
  99. package/src/index.ts +13 -0
  100. package/src/locales.ts +45 -0
  101. package/src/styles/aimd.css +151 -1
  102. package/src/type-plugins.ts +7 -0
  103. package/src/types.ts +93 -2
  104. package/dist/AimdCodeField-DC3DPvgc.js +0 -172
  105. package/dist/AimdMarkdownField-BJ20QtO8.js +0 -67
  106. package/dist/AimdMarkdownNoteField-DwAQhoyk.js +0 -186
package/README.md CHANGED
@@ -1,13 +1,14 @@
1
1
  # @airalogy/aimd-recorder
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/%40airalogy%2Faimd-recorder?logo=npm&color=cb3837)](https://www.npmjs.com/package/@airalogy/aimd-recorder)
4
- [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/airalogy/aimd/blob/main/LICENSE)
4
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/airalogy/airalogy/blob/main/LICENSE)
5
5
 
6
6
  Reusable recording UI for AIMD (Airalogy Markdown), including inline protocol recorder, the combined `AimdRecorderEditor`, quiz answer components, and styles.
7
7
 
8
8
  Built-in variable input types include `CurrentTime`, `UserName`, `AiralogyMarkdown`, and `DNASequence`.
9
- `AiralogyMarkdown` now uses a full-width embedded AIMD/Markdown editor in recorder mode, opens in `Source` mode by default, keeps the full top toolbar, and still supports switching to `WYSIWYG` instead of a plain textarea.
9
+ `AiralogyMarkdown` now uses a full-width embedded AIMD/Markdown field in recorder mode with rendered preview and source-editing modes; source editing keeps the full top toolbar and still supports switching to `WYSIWYG` instead of a plain textarea.
10
10
  In recorder/edit mode, `ref_var` references display current var values as readonly inline content when available.
11
+ `var` and `var_table` labels display AIMD `title`, keep canonical ids visible, and reveal `description` plus `example`/`examples` details only on hover or keyboard focus. Host `fieldMeta` can override the same display fields at runtime.
11
12
  Frontend-only `assigner runtime=client` blocks are executed locally for pure var computations.
12
13
  For simultaneous protocol restructuring and data entry, `AimdRecorderEditor` keeps the AIMD source editor and recorder bound to the same `content` + `record` state and can surface detached values after field IDs disappear from the current protocol.
13
14
 
@@ -33,10 +34,10 @@ import "@airalogy/aimd-recorder/styles"
33
34
 
34
35
  const content = ref(`# Protocol
35
36
 
36
- Sample: {{var|sample_name: str}}
37
+ Sample: {{var|sample_name: str, title="Sample name", description="Human-readable sample label", examples=["S-001"]}}
37
38
  Operator: {{var|operator: UserName}}
38
39
  Record Time: {{var|current_time: CurrentTime}}
39
- Temperature: {{var|temperature: float = 25.0}}
40
+ Temperature: {{var|temperature: float = 25.0, title="Temperature (C)", description="Ambient temperature in Celsius", examples=[25.0, 37.0]}}
40
41
  Notes: {{var|notes: AiralogyMarkdown}}
41
42
  Plasmid: {{var|plasmid: DNASequence}}`)
42
43
  const record = ref<AimdProtocolRecordData>(createEmptyProtocolRecordData())
@@ -52,7 +53,7 @@ const record = ref<AimdProtocolRecordData>(createEmptyProtocolRecordData())
52
53
  </template>
53
54
  ```
54
55
 
55
- `AiralogyMarkdown` fields render a full-width embedded AIMD/Markdown editor with the full top toolbar, default to `Source` mode, and still support switching to `WYSIWYG`. Even when the field is authored mid-sentence, recorder lifts it into its own block row instead of keeping it as a tiny inline control.
56
+ `AiralogyMarkdown` fields render a full-width embedded AIMD/Markdown area with `Preview` and `Source` modes; preview uses the AIMD renderer and renders Mermaid code blocks. Source editing keeps the full top toolbar and still supports switching to `WYSIWYG`. Even when the field is authored mid-sentence, recorder lifts it into its own block row instead of keeping it as a tiny inline control.
56
57
 
57
58
  Numeric `var` inputs honor Pydantic-style constraints such as `gt`, `ge`, `lt`, `le`, and `multiple_of`; these constraints apply to `int`, `integer`, `float`, and `number` var types.
58
59
  Client assigners also use these constraints for dependency readiness, so an assigner will not run while a dependent numeric field violates its declared bounds.
@@ -189,11 +190,11 @@ Pass `fieldAdapters` to `AimdRecorder` when the host app needs to replace or wra
189
190
 
190
191
  If the host app needs per-type behavior instead, use `typePlugins`. A type plugin can define the initial value, normalization, display/parsing hooks, and even a dedicated widget for one specific AIMD type token.
191
192
 
192
- The built-in `AiralogyMarkdown` editor uses this same extension path, so a host plugin can still replace it if needed.
193
+ The built-in `AiralogyMarkdown` field uses this same extension path, so a host plugin can still replace it when it needs a different preview/source workflow.
193
194
 
194
195
  See:
195
196
 
196
- - `aimd/docs/en/packages/type-plugins.md`
197
+ - `docs/aimd/en/packages/type-plugins.md`
197
198
 
198
199
  ### Quiz Recorder Only
199
200
 
@@ -227,9 +228,9 @@ If a choice option defines `followups`, the recorder renders those inputs after
227
228
 
228
229
  ## Documentation
229
230
 
230
- - EN: <https://airalogy.github.io/aimd/en/packages/aimd-recorder>
231
- - 中文: <https://airalogy.github.io/aimd/zh/packages/aimd-recorder>
232
- - Source docs: `aimd/docs/en/packages/aimd-recorder.md`, `aimd/docs/zh/packages/aimd-recorder.md`
231
+ - EN: <https://airalogy.github.io/airalogy/aimd/en/packages/aimd-recorder>
232
+ - 中文: <https://airalogy.github.io/airalogy/aimd/zh/packages/aimd-recorder>
233
+ - Source docs: `docs/aimd/en/packages/aimd-recorder.md`, `docs/aimd/zh/packages/aimd-recorder.md`
233
234
 
234
235
  ## Citation
235
236
 
package/README.zh-CN.md CHANGED
@@ -1,13 +1,14 @@
1
1
  # @airalogy/aimd-recorder
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/%40airalogy%2Faimd-recorder?logo=npm&color=cb3837)](https://www.npmjs.com/package/@airalogy/aimd-recorder)
4
- [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/airalogy/aimd/blob/main/LICENSE)
4
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/airalogy/airalogy/blob/main/LICENSE)
5
5
 
6
6
  AIMD(Airalogy Markdown)记录 UI 组件与样式集合,包含协议内联录入组件、组合式 `AimdRecorderEditor` 与可复用题目作答控件。
7
7
 
8
8
  内置变量控件支持 `CurrentTime`、`UserName`、`AiralogyMarkdown` 和 `DNASequence`。
9
- `AiralogyMarkdown` 现在会在 recorder 中以横铺内嵌 AIMD/Markdown 编辑器呈现,默认进入 `源码` 模式,并保留完整顶部工具栏,同时支持切换到 `所见即所得`,而不是普通 textarea。
9
+ `AiralogyMarkdown` 现在会在 recorder 中以横铺内嵌 AIMD/Markdown 字段呈现,可在渲染预览和源码编辑之间切换;源码编辑保留完整顶部工具栏,并继续支持切换到 `所见即所得`,而不是普通 textarea。
10
10
  在 recorder/edit 模式下,`ref_var` 如果已经有记录值,会优先以只读内联内容显示该值。
11
+ `var` 和 `var_table` 标签会显示 AIMD 的 `title`,保留规范 id,并且只在 hover 或键盘 focus 时展示 `description` 与 `example`/`examples` 详情;宿主也可以通过 `fieldMeta` 在运行时覆盖这些显示字段。
11
12
  前端受限的 `assigner runtime=client` 代码块会在 recorder 中本地执行,用于纯 `var` 计算。
12
13
  如果需要一边改 Protocol 结构、一边继续填写字段数据,可以使用 `AimdRecorderEditor`,它会把源码编辑器和 recorder 绑定到同一份 `content` 与 `record`,并在字段 id 从当前 protocol 里消失后单独展示旧数据。
13
14
 
@@ -33,10 +34,10 @@ import "@airalogy/aimd-recorder/styles"
33
34
 
34
35
  const content = ref(`# Protocol
35
36
 
36
- 样本名:{{var|sample_name: str}}
37
+ 样本名:{{var|sample_name: str, title="样本名", description="样本的人类可读标签", examples=["S-001"]}}
37
38
  记录者:{{var|operator: UserName}}
38
39
  记录时间:{{var|current_time: CurrentTime}}
39
- 温度设置:{{var|temperature: float = 25.0}}
40
+ 温度设置:{{var|temperature: float = 25.0, title="温度 (C)", description="环境温度,单位为摄氏度", examples=[25.0, 37.0]}}
40
41
  实验摘要:{{var|summary: AiralogyMarkdown}}
41
42
  质粒:{{var|plasmid: DNASequence}}`)
42
43
  const record = ref<AimdProtocolRecordData>(createEmptyProtocolRecordData())
@@ -52,7 +53,7 @@ const record = ref<AimdProtocolRecordData>(createEmptyProtocolRecordData())
52
53
  </template>
53
54
  ```
54
55
 
55
- `AiralogyMarkdown` 字段会渲染一个横铺内嵌的 AIMD/Markdown 编辑器,默认进入 `源码` 模式,并保留完整顶部工具栏,同时支持切换到 `所见即所得`。即使它写在一行文字中间,recorder 也会把这个字段提升成下一行的块级编辑区,而不是继续当成段内小控件。
56
+ `AiralogyMarkdown` 字段会渲染一个横铺内嵌的 AIMD/Markdown 区域,可在 `预览` 和 `源码` 之间切换;预览会通过 AIMD renderer 输出 Markdown,并渲染 Mermaid 代码块。源码编辑保留完整顶部工具栏,同时支持切换到 `所见即所得`。即使它写在一行文字中间,recorder 也会把这个字段提升成下一行的块级编辑区,而不是继续当成段内小控件。
56
57
 
57
58
  数值 `var` 输入会识别 `gt`、`ge`、`lt`、`le`、`multiple_of` 这类 Pydantic 风格约束;这些约束只对 `int`、`integer`、`float`、`number` 类型生效。
58
59
  client assigner 也会用这些约束判断依赖是否就绪,因此依赖的数值字段违反声明边界时,assigner 不会执行。
@@ -189,11 +190,11 @@ const fieldAdapters = {
189
190
 
190
191
  如果宿主应用需要的是某个具体类型的行为扩展,而不是整体替换某类字段 UI,则应该使用 `typePlugins`。type plugin 可以为单个 AIMD 类型定义初始值、归一化、显示/解析钩子,甚至完整的专用 widget。
191
192
 
192
- 内建的 `AiralogyMarkdown` 编辑器也是沿用这条扩展路径实现的,因此宿主应用如果需要不同的源码/所见即所得工作流,仍然可以覆盖它。
193
+ 内建的 `AiralogyMarkdown` 字段也是沿用这条扩展路径实现的,因此宿主应用如果需要不同的预览/源码工作流,仍然可以覆盖它。
193
194
 
194
195
  参见:
195
196
 
196
- - `aimd/docs/zh/packages/type-plugins.md`
197
+ - `docs/aimd/zh/packages/type-plugins.md`
197
198
 
198
199
  ### 仅题目控件
199
200
 
@@ -227,6 +228,6 @@ const quiz = {
227
228
 
228
229
  ## 文档
229
230
 
230
- - EN: <https://airalogy.github.io/aimd/en/packages/aimd-recorder>
231
- - 中文: <https://airalogy.github.io/aimd/zh/packages/aimd-recorder>
232
- - 文档源码:`aimd/docs/en/packages/aimd-recorder.md`、`aimd/docs/zh/packages/aimd-recorder.md`
231
+ - EN: <https://airalogy.github.io/airalogy/aimd/en/packages/aimd-recorder>
232
+ - 中文: <https://airalogy.github.io/airalogy/aimd/zh/packages/aimd-recorder>
233
+ - 文档源码:`docs/aimd/en/packages/aimd-recorder.md`、`docs/aimd/zh/packages/aimd-recorder.md`
@@ -0,0 +1,182 @@
1
+ import { defineComponent as B, ref as c, computed as L, onMounted as D, onBeforeUnmount as z, watch as h, openBlock as m, createElementBlock as f, normalizeStyle as F, normalizeClass as S, createElementVNode as _, Fragment as $, createCommentVNode as x, nextTick as T } from "vue";
2
+ import { c as A } from "./useMonacoAutoHeight-D4T-El3J.js";
3
+ import { _ as I } from "./_commonjsHelpers-B5RozER-.js";
4
+ function P(o) {
5
+ return new Worker(
6
+ "/assets/editor.worker-CpuX8TSY.js",
7
+ {
8
+ name: o?.name
9
+ }
10
+ );
11
+ }
12
+ function N(o) {
13
+ return new Worker(
14
+ "/assets/css.worker-Dmf38jDD.js",
15
+ {
16
+ name: o?.name
17
+ }
18
+ );
19
+ }
20
+ function O(o) {
21
+ return new Worker(
22
+ "/assets/html.worker-DotaEs7v.js",
23
+ {
24
+ name: o?.name
25
+ }
26
+ );
27
+ }
28
+ function q(o) {
29
+ return new Worker(
30
+ "/assets/json.worker-B4VHhH6h.js",
31
+ {
32
+ name: o?.name
33
+ }
34
+ );
35
+ }
36
+ function U(o) {
37
+ return new Worker(
38
+ "/assets/ts.worker-sl17zBDo.js",
39
+ {
40
+ name: o?.name
41
+ }
42
+ );
43
+ }
44
+ const X = {
45
+ css: () => import("./monaco.contribution-b5xkgQ-s.js"),
46
+ scss: () => import("./monaco.contribution-b5xkgQ-s.js"),
47
+ less: () => import("./monaco.contribution-b5xkgQ-s.js"),
48
+ html: () => import("./monaco.contribution-C-bQhUTI.js"),
49
+ javascript: () => import("./monaco.contribution-Col-f0XR.js"),
50
+ typescript: () => import("./monaco.contribution-Col-f0XR.js"),
51
+ json: () => import("./monaco.contribution-CCVvl3Jx.js"),
52
+ ini: () => import("./ini.contribution-DyWtiacL.js"),
53
+ markdown: () => import("./markdown.contribution-DYYk6zUU.js"),
54
+ python: () => import("./python.contribution-CcKs2Ktm.js"),
55
+ shell: () => import("./shell.contribution-B80NZ3iO.js"),
56
+ sql: () => import("./sql.contribution-DQy36aE5.js"),
57
+ xml: () => import("./xml.contribution-XMOaon8i.js"),
58
+ yaml: () => import("./yaml.contribution-DRRVhJmJ.js")
59
+ }, b = /* @__PURE__ */ new Map();
60
+ function Y() {
61
+ typeof globalThis > "u" || typeof globalThis.MonacoEnvironment?.getWorker == "function" || (globalThis.MonacoEnvironment = {
62
+ getWorker(s, t) {
63
+ return t === "json" ? new q() : t === "css" || t === "scss" || t === "less" ? new N() : t === "html" || t === "handlebars" || t === "razor" ? new O() : t === "typescript" || t === "javascript" ? new U() : new P();
64
+ }
65
+ });
66
+ }
67
+ async function E(o) {
68
+ const s = X[o];
69
+ if (!s)
70
+ return;
71
+ const t = b.get(o);
72
+ if (t)
73
+ return t;
74
+ const i = Promise.resolve(s()).then(() => {
75
+ });
76
+ return b.set(o, i), i;
77
+ }
78
+ const G = {
79
+ key: 0,
80
+ class: "aimd-code-field__fallback-shell"
81
+ }, J = ["value", "disabled"], K = {
82
+ key: 0,
83
+ class: "aimd-code-field__loading"
84
+ }, Q = /* @__PURE__ */ B({
85
+ __name: "AimdCodeField",
86
+ props: {
87
+ modelValue: { default: "" },
88
+ language: {},
89
+ disabled: { type: Boolean, default: !1 }
90
+ },
91
+ emits: ["update:modelValue", "blur"],
92
+ setup(o, { emit: s }) {
93
+ const t = o, i = s, l = c(null), p = c(!0), g = c(null), a = c(y(t.modelValue)), n = A({
94
+ getInitialValue: () => a.value,
95
+ getLayoutElement: () => l.value,
96
+ maxHeight: 520
97
+ }), W = n.editorHeight, M = L(() => ({
98
+ "--aimd-code-field-editor-height": `${W.value}px`
99
+ }));
100
+ let d = null, r = null, u = null, v = !1;
101
+ function y(e) {
102
+ return typeof e == "string" ? e : typeof e == "number" ? String(e) : "";
103
+ }
104
+ function k(e) {
105
+ n.syncEstimatedEditorHeight(e), e !== a.value && (a.value = e, i("update:modelValue", e));
106
+ }
107
+ async function C(e) {
108
+ !d || !u || (await E(e), d.editor.setModelLanguage(u, e));
109
+ }
110
+ async function H() {
111
+ if (!(!l.value || r)) {
112
+ p.value = !0, g.value = null;
113
+ try {
114
+ Y(), d = await import("./editor.main-Du02abDl.js"), await E(t.language), r = d.editor.create(l.value, {
115
+ value: a.value,
116
+ language: t.language,
117
+ theme: "vs",
118
+ minimap: { enabled: !1 },
119
+ scrollBeyondLastLine: !1,
120
+ automaticLayout: !0,
121
+ lineNumbers: "on",
122
+ wordWrap: "on",
123
+ lineHeight: n.lineHeight,
124
+ tabSize: 2,
125
+ padding: { top: 12, bottom: 12 },
126
+ scrollbar: { vertical: "auto", horizontal: "auto" },
127
+ readOnly: t.disabled
128
+ }), u = r.getModel(), r.onDidChangeModelContent(() => {
129
+ v || !r || k(r.getValue());
130
+ }), r.onDidBlurEditorWidget(() => {
131
+ i("blur");
132
+ }), n.attachEditor(r);
133
+ } catch (e) {
134
+ g.value = e instanceof Error ? e.message : "Failed to load Monaco editor.";
135
+ } finally {
136
+ p.value = !1;
137
+ }
138
+ }
139
+ }
140
+ function j(e) {
141
+ a.value = e, n.syncEstimatedEditorHeight(e), !(!r || e === r.getValue()) && (v = !0, r.setValue(e), v = !1, T(n.syncMeasuredEditorHeight));
142
+ }
143
+ function V(e) {
144
+ k(e.target.value);
145
+ }
146
+ return D(() => {
147
+ H();
148
+ }), z(() => {
149
+ n.dispose(), r?.dispose(), u?.dispose();
150
+ }), h(() => t.modelValue, (e) => {
151
+ j(y(e));
152
+ }), h(() => t.disabled, (e) => {
153
+ r?.updateOptions({ readOnly: e });
154
+ }), h(() => t.language, async (e) => {
155
+ r && await C(e);
156
+ }), (e, w) => (m(), f("div", {
157
+ class: S(["aimd-code-field", { "aimd-code-field--disabled": o.disabled }]),
158
+ style: F(M.value)
159
+ }, [
160
+ g.value ? (m(), f("div", G, [
161
+ _("textarea", {
162
+ class: "aimd-code-field__fallback",
163
+ value: a.value,
164
+ disabled: o.disabled,
165
+ spellcheck: "false",
166
+ onInput: V,
167
+ onBlur: w[0] || (w[0] = (R) => i("blur"))
168
+ }, null, 40, J)
169
+ ])) : (m(), f($, { key: 1 }, [
170
+ p.value ? (m(), f("div", K, "Loading code editor…")) : x("", !0),
171
+ _("div", {
172
+ ref_key: "editorContainer",
173
+ ref: l,
174
+ class: "aimd-code-field__editor"
175
+ }, null, 512)
176
+ ], 64))
177
+ ], 6));
178
+ }
179
+ }), oe = /* @__PURE__ */ I(Q, [["__scopeId", "data-v-1e42ae17"]]);
180
+ export {
181
+ oe as default
182
+ };
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as Om, openBlock as wi, createElementBlock as Ji, Fragment as qg, createElementVNode as wt, toDisplayString as ln, normalizeClass as q0, createCommentVNode as _y, ref as lg, computed as uh, watch as $T, onMounted as NA, onBeforeUnmount as zA, createVNode as eS, unref as dE, renderList as HT, normalizeStyle as DA, createBlock as hE, nextTick as BA } from "vue";
2
- import { a5 as HA, ap as kT, t as kA, R as gE, e as UA, i as vE, u as yE, m as mE, l as LA, k as pE } from "./useFieldRendering-xLajJhyA.js";
3
- import { g as GA, c as bE, a as IA, _ as FA } from "./_commonjsHelpers-CZXJ37nu.js";
2
+ import { ap as HA, aS as kT, E as kA, a8 as gE, g as UA, k as vE, H as yE, p as mE, o as LA, n as pE } from "./useCodeBlockRendering-qA6gj4vz.js";
3
+ import { a as GA, c as bE, g as IA, _ as FA } from "./_commonjsHelpers-B5RozER-.js";
4
4
  const tC = "dna_annotation";
5
5
  function nC(Me, Ze) {
6
6
  return `${tC}:${Me}:${Ze}`;