@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
@@ -0,0 +1,254 @@
1
+ import { defineComponent as p, ref as m, watch as V, h as T, computed as l, shallowRef as te, onBeforeUnmount as oe, openBlock as r, createElementBlock as n, normalizeStyle as ie, normalizeClass as C, createElementVNode as s, toDisplayString as c, unref as v, createVNode as E, createCommentVNode as g, createBlock as re } from "vue";
2
+ import { g as ne, _ as de } from "./AimdEditor.vue_vue_type_style_index_0_lang-CzfYPp5r.js";
3
+ import { ax as le, l as se } from "./useCodeBlockRendering-qA6gj4vz.js";
4
+ import "@airalogy/aimd-core";
5
+ import { renderToVue as ce, createMermaidRenderer as ue } from "@airalogy/aimd-renderer";
6
+ import { c as me } from "./useMonacoAutoHeight-D4T-El3J.js";
7
+ import { _ as ve } from "./_commonjsHelpers-B5RozER-.js";
8
+ const fe = { class: "aimd-field aimd-field--no-style aimd-field__label" }, we = { class: "aimd-field__scope aimd-field__scope--var" }, he = { class: "aimd-field__id" }, ke = { class: "aimd-markdown-field__header-actions" }, _e = ["aria-label"], pe = ["aria-pressed"], ge = ["aria-pressed"], be = {
9
+ key: 0,
10
+ class: "aimd-markdown-field__assigner-actions"
11
+ }, ye = {
12
+ key: 0,
13
+ class: "aimd-markdown-field__assigner-action"
14
+ }, Re = {
15
+ key: 1,
16
+ class: "aimd-markdown-field__assigner-state"
17
+ }, Me = {
18
+ key: 0,
19
+ class: "aimd-rec-inline__assigner-error aimd-markdown-field__assigner-error"
20
+ }, Ve = { class: "aimd-markdown-field__editor-shell" }, Ce = {
21
+ key: 0,
22
+ class: "aimd-markdown-field__preview-shell"
23
+ }, Ee = {
24
+ key: 0,
25
+ class: "aimd-markdown-field__preview-empty"
26
+ }, Se = {
27
+ key: 1,
28
+ class: "aimd-markdown-field__preview-fallback"
29
+ }, Le = {
30
+ key: 2,
31
+ class: "aimd-markdown-field__preview"
32
+ }, Be = /* @__PURE__ */ p({
33
+ __name: "AimdMarkdownField",
34
+ props: {
35
+ modelValue: { default: void 0 },
36
+ varId: {},
37
+ disabled: { type: Boolean, default: !1 },
38
+ locale: { default: void 0 },
39
+ messages: {},
40
+ assignerControl: { default: void 0 },
41
+ assignerStatus: { default: void 0 },
42
+ assignerError: { default: void 0 }
43
+ },
44
+ emits: ["update:modelValue", "blur"],
45
+ setup(a, { emit: F }) {
46
+ const d = a, S = F;
47
+ function L(e) {
48
+ return typeof e == "string" ? e : e == null ? "" : String(e);
49
+ }
50
+ function w(e) {
51
+ return e?.toLowerCase().startsWith("zh") ?? !1;
52
+ }
53
+ let N = 0;
54
+ const z = p({
55
+ name: "AimdMarkdownMermaidBlock",
56
+ props: {
57
+ code: { type: String, required: !0 }
58
+ },
59
+ setup(e) {
60
+ const t = m(""), i = m(!1);
61
+ let M = 0;
62
+ async function Y() {
63
+ const A = e.code.trim(), q = ++M;
64
+ if (!A) {
65
+ t.value = "", i.value = !1;
66
+ return;
67
+ }
68
+ try {
69
+ const x = (await import("./mermaid.core-CuZ3nINf.js").then((ae) => ae.bm)).default;
70
+ x.initialize({
71
+ startOnLoad: !1,
72
+ securityLevel: "strict"
73
+ });
74
+ const ee = await x.render(`aimd-markdown-mermaid-${++N}`, A);
75
+ if (q !== M)
76
+ return;
77
+ t.value = ee.svg, i.value = !1;
78
+ } catch {
79
+ if (q !== M)
80
+ return;
81
+ t.value = "", i.value = !0;
82
+ }
83
+ }
84
+ return V(() => e.code, () => {
85
+ Y();
86
+ }, { immediate: !0 }), () => i.value ? T("pre", { class: "aimd-markdown-field__mermaid-fallback" }, e.code) : T("div", {
87
+ class: "aimd-markdown-field__mermaid",
88
+ innerHTML: t.value
89
+ });
90
+ }
91
+ }), { preRenderer: P } = le(() => {
92
+ R();
93
+ }), b = m(null), o = m(L(d.modelValue)), h = m(o.value.trim() ? "preview" : "source"), u = me({
94
+ getInitialValue: () => o.value,
95
+ getLayoutElement: () => b.value?.querySelector(".aimd-editor-container"),
96
+ maxHeight: 560
97
+ }), B = u.editorHeight, O = l(() => ({
98
+ "--aimd-markdown-field-editor-height": `${B.value}px`
99
+ })), k = te([]), _ = m(!1);
100
+ let y = 0;
101
+ const H = p({
102
+ name: "RenderVNode",
103
+ props: {
104
+ vnode: { type: Object, required: !0 }
105
+ },
106
+ setup(e) {
107
+ return () => e.vnode;
108
+ }
109
+ }), $ = p({
110
+ name: "AimdMarkdownFieldPreviewOutlet",
111
+ props: {
112
+ nodes: {
113
+ type: Array,
114
+ required: !0
115
+ }
116
+ },
117
+ setup(e) {
118
+ return () => e.nodes;
119
+ }
120
+ }), I = l(() => !!o.value.trim()), f = l(() => h.value === "preview"), D = l(() => w(d.locale) ? "预览" : "Preview"), U = l(() => w(d.locale) ? "源码" : "Source"), j = l(() => w(d.locale) ? "暂无内容" : "No content"), W = l(() => w(d.locale) ? "Markdown 显示模式" : "Markdown view mode"), Z = l(() => ({
121
+ minimap: { enabled: !1 },
122
+ lineHeight: u.lineHeight,
123
+ padding: { top: 12, bottom: 12 },
124
+ scrollbar: { vertical: "auto", horizontal: "auto" }
125
+ }));
126
+ async function R() {
127
+ const e = o.value.trim(), t = ++y;
128
+ if (!e) {
129
+ k.value = [], _.value = !1;
130
+ return;
131
+ }
132
+ try {
133
+ const i = await ce(e, {
134
+ locale: d.locale,
135
+ mode: "preview",
136
+ elementRenderers: {
137
+ pre: se(
138
+ ue(z),
139
+ P
140
+ )
141
+ }
142
+ });
143
+ if (t !== y)
144
+ return;
145
+ k.value = i.nodes, _.value = !1;
146
+ } catch {
147
+ if (t !== y)
148
+ return;
149
+ k.value = [], _.value = !0;
150
+ }
151
+ }
152
+ function G() {
153
+ h.value = "preview", R();
154
+ }
155
+ function J() {
156
+ h.value = "source";
157
+ }
158
+ function K(e) {
159
+ u.syncEstimatedEditorHeight(e), e !== o.value && (o.value = e, S("update:modelValue", e));
160
+ }
161
+ function Q(e) {
162
+ e.monaco && u.attachEditor(e.monaco);
163
+ }
164
+ function X(e) {
165
+ const t = b.value, i = e.relatedTarget;
166
+ !t || i && t.contains(i) || S("blur");
167
+ }
168
+ return V(() => d.modelValue, (e) => {
169
+ const t = L(e);
170
+ if (t === o.value)
171
+ return;
172
+ const i = I.value;
173
+ o.value = t, u.syncEstimatedEditorHeight(t), !i && t.trim() && (h.value = "preview");
174
+ }), oe(() => {
175
+ u.dispose();
176
+ }), V(
177
+ () => [o.value, d.locale],
178
+ () => {
179
+ R();
180
+ },
181
+ { immediate: !0 }
182
+ ), (e, t) => (r(), n("div", {
183
+ ref_key: "fieldRootRef",
184
+ ref: b,
185
+ class: C(["aimd-rec-inline aimd-rec-inline--var-stacked aimd-rec-inline--var-markdown aimd-field-wrapper aimd-markdown-field", {
186
+ "aimd-markdown-field--disabled": a.disabled,
187
+ "aimd-markdown-field--has-assigner-control": a.assignerControl || a.assignerStatus
188
+ }]),
189
+ style: ie(O.value),
190
+ onFocusout: X
191
+ }, [
192
+ s("span", fe, [
193
+ s("span", we, c(v(ne)("var", a.messages)), 1),
194
+ s("span", he, c(a.varId), 1),
195
+ s("span", ke, [
196
+ s("span", {
197
+ class: "aimd-markdown-field__view-switch",
198
+ "aria-label": W.value
199
+ }, [
200
+ s("button", {
201
+ type: "button",
202
+ class: C(["aimd-markdown-field__view-btn", { "aimd-markdown-field__view-btn--active": f.value }]),
203
+ "aria-pressed": f.value,
204
+ onClick: G
205
+ }, c(D.value), 11, pe),
206
+ s("button", {
207
+ type: "button",
208
+ class: C(["aimd-markdown-field__view-btn", { "aimd-markdown-field__view-btn--active": !f.value }]),
209
+ "aria-pressed": !f.value,
210
+ onClick: J
211
+ }, c(U.value), 11, ge)
212
+ ], 8, _e),
213
+ a.assignerControl || a.assignerStatus ? (r(), n("span", be, [
214
+ a.assignerControl ? (r(), n("span", ye, [
215
+ E(v(H), { vnode: a.assignerControl }, null, 8, ["vnode"])
216
+ ])) : g("", !0),
217
+ a.assignerStatus ? (r(), n("span", Re, [
218
+ E(v(H), { vnode: a.assignerStatus }, null, 8, ["vnode"])
219
+ ])) : g("", !0)
220
+ ])) : g("", !0)
221
+ ])
222
+ ]),
223
+ a.assignerError ? (r(), n("span", Me, c(a.assignerError), 1)) : g("", !0),
224
+ s("div", Ve, [
225
+ f.value ? (r(), n("div", Ce, [
226
+ I.value ? _.value ? (r(), n("pre", Se, c(o.value), 1)) : (r(), n("div", Le, [
227
+ E(v($), { nodes: k.value }, null, 8, ["nodes"])
228
+ ])) : (r(), n("div", Ee, c(j.value), 1))
229
+ ])) : (r(), re(v(de), {
230
+ key: 1,
231
+ class: "aimd-markdown-field__editor",
232
+ "model-value": o.value,
233
+ locale: a.locale,
234
+ mode: "source",
235
+ theme: "aimd-light",
236
+ "show-top-bar": !0,
237
+ "show-toolbar": !a.disabled,
238
+ "show-md-toolbar": !0,
239
+ "show-aimd-toolbar": !0,
240
+ "enable-block-handle": !a.disabled,
241
+ "keep-inactive-editors-mounted": !1,
242
+ "min-height": v(B),
243
+ readonly: a.disabled,
244
+ "monaco-options": Z.value,
245
+ "onUpdate:modelValue": K,
246
+ onReady: Q
247
+ }, null, 8, ["model-value", "locale", "show-toolbar", "enable-block-handle", "min-height", "readonly", "monaco-options"]))
248
+ ])
249
+ ], 38));
250
+ }
251
+ }), ze = /* @__PURE__ */ ve(Be, [["__scopeId", "data-v-e24d200a"]]);
252
+ export {
253
+ ze as default
254
+ };
@@ -0,0 +1,259 @@
1
+ import { defineComponent as K, ref as h, computed as a, shallowRef as re, watch as R, onBeforeUnmount as se, openBlock as r, createElementBlock as m, normalizeStyle as ue, normalizeClass as U, createElementVNode as l, toDisplayString as s, createCommentVNode as ce, createBlock as me, unref as M, createVNode as fe, nextTick as ve } from "vue";
2
+ import { _ as we } from "./AimdEditor.vue_vue_type_style_index_0_lang-CzfYPp5r.js";
3
+ import { ax as he } from "./useCodeBlockRendering-qA6gj4vz.js";
4
+ import "@airalogy/aimd-core";
5
+ import { renderToVue as be } from "@airalogy/aimd-renderer";
6
+ import { c as _e } from "./useMonacoAutoHeight-D4T-El3J.js";
7
+ import { _ as pe } from "./_commonjsHelpers-B5RozER-.js";
8
+ const ke = {
9
+ key: 0,
10
+ class: "aimd-markdown-note-field__preview-shell"
11
+ }, ye = {
12
+ key: 0,
13
+ class: "aimd-markdown-note-field__preview-actions"
14
+ }, ge = ["aria-label"], Ee = {
15
+ type: "button",
16
+ class: "aimd-markdown-note-field__view-btn aimd-markdown-note-field__view-btn--active",
17
+ "aria-pressed": "true"
18
+ }, Re = ["tabindex", "role"], Ve = {
19
+ key: 0,
20
+ class: "aimd-markdown-note-field__preview-fallback"
21
+ }, Ce = {
22
+ key: 1,
23
+ class: "aimd-markdown-note-field__editor-shell"
24
+ }, Fe = { class: "aimd-markdown-note-field__editor-actions" }, Se = ["aria-label"], xe = ["disabled"], He = {
25
+ type: "button",
26
+ class: "aimd-markdown-note-field__view-btn aimd-markdown-note-field__view-btn--active",
27
+ "aria-pressed": "true"
28
+ }, Te = {
29
+ key: 2,
30
+ class: "aimd-markdown-note-field__empty"
31
+ }, Me = /* @__PURE__ */ K({
32
+ __name: "AimdMarkdownNoteField",
33
+ props: {
34
+ modelValue: { default: void 0 },
35
+ disabled: { type: Boolean, default: !1 },
36
+ locale: { default: void 0 },
37
+ minHeight: {}
38
+ },
39
+ emits: ["update:modelValue", "blur", "close"],
40
+ setup(i, { emit: $ }) {
41
+ const t = i, b = $;
42
+ function N(e) {
43
+ return typeof e == "string" ? e : e == null ? "" : String(e);
44
+ }
45
+ function f(e) {
46
+ return e?.toLowerCase().startsWith("zh") ?? !1;
47
+ }
48
+ const V = h(null), P = h(null), n = h(N(t.modelValue)), u = _e({
49
+ getInitialValue: () => n.value,
50
+ getLayoutElement: () => V.value?.querySelector(".aimd-editor-container"),
51
+ minHeight: t.minHeight,
52
+ maxHeight: 420
53
+ }), B = u.editorHeight, W = a(() => ({
54
+ "--aimd-markdown-note-editor-height": `${B.value}px`
55
+ })), d = h(!1), _ = re([]), p = h(!1);
56
+ let C = 0, v = null, w = null, k = !1, F = !1;
57
+ const { preRenderer: Z } = he(() => {
58
+ x();
59
+ }), c = a(() => !!n.value.trim()), S = a(() => c.value && !d.value), y = a(() => !t.disabled && (!c.value || d.value)), j = a(() => !S.value && !y.value), J = a(() => f(t.locale) ? "关闭备注" : "Close note"), Q = a(() => f(t.locale) ? "暂无备注" : "No notes"), L = a(() => f(t.locale) ? "预览" : "Preview"), A = a(() => f(t.locale) ? "源码" : "Source"), I = a(() => f(t.locale) ? "备注显示模式" : "Note view mode"), X = a(() => ({
60
+ minimap: { enabled: !1 },
61
+ lineHeight: u.lineHeight,
62
+ padding: { top: 12, bottom: 12 },
63
+ scrollbar: { vertical: "auto", horizontal: "auto" }
64
+ })), Y = K({
65
+ name: "AimdMarkdownNotePreviewOutlet",
66
+ props: {
67
+ nodes: {
68
+ type: Array,
69
+ required: !0
70
+ }
71
+ },
72
+ setup(e) {
73
+ return () => e.nodes;
74
+ }
75
+ });
76
+ function z() {
77
+ if (t.disabled) {
78
+ d.value = !1;
79
+ return;
80
+ }
81
+ c.value || (d.value = !0);
82
+ }
83
+ function ee(e) {
84
+ u.syncEstimatedEditorHeight(e), e !== n.value && (n.value = e, b("update:modelValue", e));
85
+ }
86
+ async function x() {
87
+ const e = n.value.trim(), o = ++C;
88
+ if (!e) {
89
+ _.value = [], p.value = !1;
90
+ return;
91
+ }
92
+ try {
93
+ const E = await be(e, {
94
+ locale: t.locale,
95
+ elementRenderers: {
96
+ pre: Z
97
+ }
98
+ });
99
+ if (o !== C)
100
+ return;
101
+ _.value = E.nodes, p.value = !1;
102
+ } catch {
103
+ if (o !== C)
104
+ return;
105
+ _.value = [], p.value = !0;
106
+ }
107
+ }
108
+ async function H() {
109
+ t.disabled || (O(), d.value = !0, await D());
110
+ }
111
+ function te() {
112
+ c.value && (O(), d.value = !1, x());
113
+ }
114
+ function oe() {
115
+ T(), g(), d.value = !1, b("close"), b("blur");
116
+ }
117
+ function ae(e) {
118
+ t.disabled || e.target instanceof Element && e.target.closest("a, button, input, textarea, select, summary, details") || H();
119
+ }
120
+ function ie(e) {
121
+ t.disabled || e.key !== "Enter" && e.key !== " " || (e.preventDefault(), H());
122
+ }
123
+ function g() {
124
+ v && (clearTimeout(v), v = null);
125
+ }
126
+ function T() {
127
+ w && (clearTimeout(w), w = null), k = !1;
128
+ }
129
+ function O() {
130
+ T(), k = !0, w = setTimeout(() => {
131
+ w = null, k = !1;
132
+ }, 80);
133
+ }
134
+ function q() {
135
+ const e = P.value?.getMonacoEditor?.();
136
+ return e?.focus ? (F = !1, e.focus(), !0) : (F = !0, !1);
137
+ }
138
+ async function D() {
139
+ await ve(), q();
140
+ }
141
+ function ne(e) {
142
+ e.monaco && u.attachEditor(e.monaco), F && q();
143
+ }
144
+ function le() {
145
+ g();
146
+ }
147
+ function de(e) {
148
+ const o = V.value, E = e.relatedTarget;
149
+ !o || E && o.contains(E) || k || (g(), v = setTimeout(() => {
150
+ v = null;
151
+ const G = typeof document < "u" ? document.activeElement : null;
152
+ G instanceof Node && o.contains(G) || (c.value && (d.value = !1), b("blur"));
153
+ }, 0));
154
+ }
155
+ return R(() => t.modelValue, (e) => {
156
+ const o = N(e);
157
+ o !== n.value && (n.value = o, u.syncEstimatedEditorHeight(o));
158
+ }), R(
159
+ () => [n.value, t.locale],
160
+ () => {
161
+ z(), x();
162
+ },
163
+ { immediate: !0 }
164
+ ), R(() => t.disabled, () => {
165
+ z();
166
+ }), R(y, (e) => {
167
+ e && !t.disabled && D();
168
+ }, { immediate: !0 }), se(() => {
169
+ g(), T(), u.dispose();
170
+ }), (e, o) => (r(), m("div", {
171
+ ref_key: "fieldRootRef",
172
+ ref: V,
173
+ class: U(["aimd-markdown-note-field", {
174
+ "aimd-markdown-note-field--disabled": i.disabled,
175
+ "aimd-markdown-note-field--preview": S.value,
176
+ "aimd-markdown-note-field--editor": y.value,
177
+ "aimd-markdown-note-field--empty": j.value
178
+ }]),
179
+ style: ue(W.value),
180
+ onFocusin: le,
181
+ onFocusout: de
182
+ }, [
183
+ S.value ? (r(), m("div", ke, [
184
+ i.disabled ? ce("", !0) : (r(), m("div", ye, [
185
+ l("span", {
186
+ class: "aimd-markdown-note-field__view-switch",
187
+ role: "group",
188
+ "aria-label": I.value
189
+ }, [
190
+ l("button", Ee, s(L.value), 1),
191
+ l("button", {
192
+ type: "button",
193
+ class: "aimd-markdown-note-field__view-btn aimd-markdown-note-field__view-btn--source",
194
+ "aria-pressed": "false",
195
+ onClick: H
196
+ }, s(A.value), 1)
197
+ ], 8, ge)
198
+ ])),
199
+ l("div", {
200
+ class: U(["aimd-markdown-note-field__preview", { "aimd-markdown-note-field__preview--interactive": !i.disabled }]),
201
+ tabindex: i.disabled ? void 0 : 0,
202
+ role: i.disabled ? void 0 : "button",
203
+ onClick: ae,
204
+ onKeydown: ie
205
+ }, [
206
+ p.value ? (r(), m("pre", Ve, s(n.value), 1)) : (r(), me(M(Y), {
207
+ key: 1,
208
+ nodes: _.value
209
+ }, null, 8, ["nodes"]))
210
+ ], 42, Re)
211
+ ])) : y.value ? (r(), m("div", Ce, [
212
+ l("div", Fe, [
213
+ l("span", {
214
+ class: "aimd-markdown-note-field__view-switch",
215
+ role: "group",
216
+ "aria-label": I.value
217
+ }, [
218
+ l("button", {
219
+ type: "button",
220
+ class: "aimd-markdown-note-field__view-btn aimd-markdown-note-field__view-btn--preview",
221
+ disabled: !c.value,
222
+ "aria-pressed": "false",
223
+ onClick: te
224
+ }, s(L.value), 9, xe),
225
+ l("button", He, s(A.value), 1)
226
+ ], 8, Se),
227
+ l("button", {
228
+ type: "button",
229
+ class: "aimd-markdown-note-field__editor-close",
230
+ onClick: oe
231
+ }, s(J.value), 1)
232
+ ]),
233
+ fe(M(we), {
234
+ ref_key: "editorRef",
235
+ ref: P,
236
+ class: "aimd-markdown-note-field__editor",
237
+ "model-value": n.value,
238
+ locale: i.locale,
239
+ mode: "source",
240
+ theme: "aimd-light",
241
+ "show-top-bar": !0,
242
+ "show-toolbar": !i.disabled,
243
+ "show-md-toolbar": !0,
244
+ "show-aimd-toolbar": !0,
245
+ "enable-block-handle": !i.disabled,
246
+ "keep-inactive-editors-mounted": !1,
247
+ "min-height": M(B),
248
+ readonly: i.disabled,
249
+ "monaco-options": X.value,
250
+ "onUpdate:modelValue": ee,
251
+ onReady: ne
252
+ }, null, 8, ["model-value", "locale", "show-toolbar", "enable-block-handle", "min-height", "readonly", "monaco-options"])
253
+ ])) : (r(), m("div", Te, s(Q.value), 1))
254
+ ], 38));
255
+ }
256
+ }), Oe = /* @__PURE__ */ pe(Me, [["__scopeId", "data-v-25a9e4e8"]]);
257
+ export {
258
+ Oe as default
259
+ };
@@ -34,7 +34,7 @@ function f(e) {
34
34
  }
35
35
  export {
36
36
  a as _,
37
- c as a,
37
+ f as a,
38
38
  s as c,
39
- f as g
39
+ c as g
40
40
  };