@kong-ui-public/monaco-editor 0.8.0 → 0.8.1-pr.2776.6f79634e6.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.
Potentially problematic release.
This version of @kong-ui-public/monaco-editor might be problematic. Click here for more details.
- package/dist/runtime/json-CkL__jXi.js +525 -0
- package/dist/runtime/monaco-editor.es.js +297 -233
- package/dist/runtime/monaco-editor.umd.js +7 -1
- package/dist/runtime/style.css +1 -1
- package/dist/types/src/components/MonacoEditor.vue.d.ts +1 -1
- package/dist/types/src/components/MonacoEditor.vue.d.ts.map +1 -1
- package/dist/types/src/context/index.d.ts +4 -0
- package/dist/types/src/context/index.d.ts.map +1 -0
- package/dist/types/src/context/json.d.ts +3 -0
- package/dist/types/src/context/json.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/singletons/model-contexts.d.ts +61 -0
- package/dist/types/src/singletons/model-contexts.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/json/index.d.ts +2 -0
- package/dist/types/src/types/json/index.d.ts.map +1 -0
- package/dist/types/src/types/json/model-context.d.ts +7 -0
- package/dist/types/src/types/json/model-context.d.ts.map +1 -0
- package/dist/types/src/types/model-context.d.ts +11 -0
- package/dist/types/src/types/model-context.d.ts.map +1 -0
- package/package.json +2 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { toValue as
|
|
2
|
-
import { ProgressIcon as
|
|
3
|
-
import * as
|
|
4
|
-
import { shikiToMonaco as
|
|
5
|
-
import { getSingletonHighlighter as
|
|
6
|
-
import { createI18n as
|
|
7
|
-
const
|
|
1
|
+
import { toValue as _, ref as ne, shallowRef as ae, reactive as re, watch as L, onMounted as se, onActivated as ie, onBeforeUnmount as le, onWatcherCleanup as ce, defineComponent as Y, resolveComponent as ue, createBlock as I, openBlock as S, createSlots as de, withCtx as F, resolveDynamicComponent as ge, mergeModels as A, useModel as fe, useTemplateRef as me, computed as T, createElementBlock as pe, normalizeClass as he, createElementVNode as ve, renderSlot as $, createVNode as P, Transition as V, createCommentVNode as B, unref as v } from "vue";
|
|
2
|
+
import { ProgressIcon as ye, CodeblockIcon as Ce } from "@kong/icons";
|
|
3
|
+
import * as f from "monaco-editor";
|
|
4
|
+
import { shikiToMonaco as be } from "@shikijs/monaco";
|
|
5
|
+
import { getSingletonHighlighter as Se, bundledLanguages as Me, bundledThemes as Ee } from "shiki";
|
|
6
|
+
import { createI18n as we, i18nTComponent as xe } from "@kong-ui-public/i18n";
|
|
7
|
+
const _e = "'JetBrains Mono', Consolas, monospace", Ie = "12px", ke = "500", Oe = "20px", Te = Object.freeze({
|
|
8
8
|
autoClosingQuotes: "always",
|
|
9
9
|
automaticLayout: !0,
|
|
10
10
|
// Auto resize layout
|
|
@@ -13,10 +13,10 @@ const be = "'JetBrains Mono', Consolas, monospace", Ce = "12px", Ee = "500", Me
|
|
|
13
13
|
},
|
|
14
14
|
hideCursorInOverviewRuler: !0,
|
|
15
15
|
// hide the cursor position in the minimap TODO: maybe hide it on first line or change it colour
|
|
16
|
-
fontFamily:
|
|
17
|
-
fontSize: Number(
|
|
18
|
-
fontWeight:
|
|
19
|
-
lineHeight: Number(
|
|
16
|
+
fontFamily: _e,
|
|
17
|
+
fontSize: Number(Ie.replace("px", "")),
|
|
18
|
+
fontWeight: ke,
|
|
19
|
+
lineHeight: Number(Oe.replace("px", "")),
|
|
20
20
|
formatOnPaste: !0,
|
|
21
21
|
formatOnType: !0,
|
|
22
22
|
// Add to enable automatic formatting as the user types.
|
|
@@ -59,253 +59,253 @@ const be = "'JetBrains Mono', Consolas, monospace", Ce = "12px", Ee = "500", Me
|
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
62
|
-
const
|
|
62
|
+
const K = () => {
|
|
63
63
|
};
|
|
64
|
-
function
|
|
65
|
-
function
|
|
66
|
-
return new Promise((
|
|
67
|
-
Promise.resolve(
|
|
68
|
-
fn:
|
|
64
|
+
function De(e, o) {
|
|
65
|
+
function t(...n) {
|
|
66
|
+
return new Promise((a, s) => {
|
|
67
|
+
Promise.resolve(e(() => o.apply(this, n), {
|
|
68
|
+
fn: o,
|
|
69
69
|
thisArg: this,
|
|
70
|
-
args:
|
|
71
|
-
})).then(
|
|
70
|
+
args: n
|
|
71
|
+
})).then(a).catch(s);
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
-
return
|
|
74
|
+
return t;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
let
|
|
78
|
-
const
|
|
79
|
-
clearTimeout(
|
|
76
|
+
function Le(e, o = {}) {
|
|
77
|
+
let t, n, a = K;
|
|
78
|
+
const s = (i) => {
|
|
79
|
+
clearTimeout(i), a(), a = K;
|
|
80
80
|
};
|
|
81
81
|
let l;
|
|
82
|
-
return (
|
|
83
|
-
const p =
|
|
84
|
-
return
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}, g)),
|
|
88
|
-
|
|
82
|
+
return (i) => {
|
|
83
|
+
const p = _(e), g = _(o.maxWait);
|
|
84
|
+
return t && s(t), p <= 0 || g !== void 0 && g <= 0 ? (n && (s(n), n = void 0), Promise.resolve(i())) : new Promise((c, h) => {
|
|
85
|
+
a = o.rejectOnCancel ? h : c, l = i, g && !n && (n = setTimeout(() => {
|
|
86
|
+
t && s(t), n = void 0, c(l());
|
|
87
|
+
}, g)), t = setTimeout(() => {
|
|
88
|
+
n && s(n), n = void 0, c(i());
|
|
89
89
|
}, p);
|
|
90
90
|
});
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
93
|
// @__NO_SIDE_EFFECTS__
|
|
94
|
-
function
|
|
95
|
-
return
|
|
94
|
+
function Fe(e, o = 200, t = {}) {
|
|
95
|
+
return De(Le(o, t), e);
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
var
|
|
99
|
-
const
|
|
100
|
-
return (
|
|
97
|
+
function j(e) {
|
|
98
|
+
var o;
|
|
99
|
+
const t = _(e);
|
|
100
|
+
return (o = t == null ? void 0 : t.$el) !== null && o !== void 0 ? o : t;
|
|
101
101
|
}
|
|
102
|
-
const
|
|
103
|
-
function
|
|
104
|
-
let
|
|
105
|
-
if (!
|
|
106
|
-
let
|
|
107
|
-
switch (
|
|
102
|
+
const R = "[monaco-editor] [lifecycle]", y = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new WeakMap();
|
|
103
|
+
function We(e) {
|
|
104
|
+
let o = y.get(e.source);
|
|
105
|
+
if (!o) {
|
|
106
|
+
let t;
|
|
107
|
+
switch (e.type) {
|
|
108
108
|
case "editor":
|
|
109
|
-
|
|
109
|
+
t = e.source.onDidDispose(() => X(e.source));
|
|
110
110
|
break;
|
|
111
111
|
case "model":
|
|
112
|
-
|
|
112
|
+
t = e.source.onWillDispose(() => X(e.source));
|
|
113
113
|
break;
|
|
114
114
|
default:
|
|
115
|
-
throw new Error(`${
|
|
115
|
+
throw new Error(`${R} Unknown scope: ${e}`);
|
|
116
116
|
}
|
|
117
|
-
|
|
117
|
+
o = {
|
|
118
118
|
disposables: /* @__PURE__ */ new Set(),
|
|
119
|
-
scopeListener:
|
|
120
|
-
}, y.set(
|
|
119
|
+
scopeListener: t
|
|
120
|
+
}, y.set(e.source, o);
|
|
121
121
|
}
|
|
122
|
-
return
|
|
122
|
+
return o;
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
const
|
|
126
|
-
|
|
124
|
+
function Q(e) {
|
|
125
|
+
const o = y.get(e);
|
|
126
|
+
o && (o.scopeListener.dispose(), y.delete(e));
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
|
|
128
|
+
function z(e, o) {
|
|
129
|
+
We(o).disposables.add(e);
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
const
|
|
133
|
-
|
|
131
|
+
function G(e, o) {
|
|
132
|
+
const t = y.get(o.source);
|
|
133
|
+
t && (t.disposables.delete(e), t.disposables.size === 0 && Q(o.source));
|
|
134
134
|
}
|
|
135
|
-
function
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
135
|
+
function Re(e) {
|
|
136
|
+
const o = [];
|
|
137
|
+
if (e.forEach((t) => {
|
|
138
138
|
try {
|
|
139
|
-
|
|
140
|
-
} catch (
|
|
141
|
-
|
|
139
|
+
t.dispose();
|
|
140
|
+
} catch (n) {
|
|
141
|
+
o.push(n);
|
|
142
142
|
}
|
|
143
|
-
}),
|
|
143
|
+
}), o.length)
|
|
144
144
|
throw new AggregateError(
|
|
145
|
-
|
|
146
|
-
`${
|
|
145
|
+
o,
|
|
146
|
+
`${R} One or more disposables threw while being disposed.`
|
|
147
147
|
);
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
var l,
|
|
151
|
-
let
|
|
152
|
-
if (!
|
|
153
|
-
const
|
|
154
|
-
|
|
149
|
+
function Ne(e, o) {
|
|
150
|
+
var l, m;
|
|
151
|
+
let t = e, n = C.get(t);
|
|
152
|
+
if (!n) {
|
|
153
|
+
const i = D.get(e);
|
|
154
|
+
i && (t = i, n = C.get(i));
|
|
155
155
|
}
|
|
156
|
-
if (
|
|
157
|
-
return ((l =
|
|
158
|
-
const
|
|
156
|
+
if (n)
|
|
157
|
+
return ((l = n.scope) == null ? void 0 : l.type) === (o == null ? void 0 : o.type) && ((m = n.scope) == null ? void 0 : m.source) === (o == null ? void 0 : o.source) || (n.scope && G(n.decorated, n.scope), o ? (z(n.decorated, o), n.scope = o) : n.scope = void 0), n.decorated;
|
|
158
|
+
const a = t.dispose, s = {
|
|
159
159
|
dispose: () => {
|
|
160
|
-
const
|
|
161
|
-
if (
|
|
162
|
-
return
|
|
160
|
+
const i = C.get(t);
|
|
161
|
+
if (i)
|
|
162
|
+
return i.scope && G(s, i.scope), C.delete(t), D.delete(s), a.call(t);
|
|
163
163
|
}
|
|
164
164
|
};
|
|
165
|
-
return
|
|
165
|
+
return C.set(t, { decorated: s, scope: o }), D.set(s, t), o && z(s, o), s;
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
return
|
|
167
|
+
function H(e, o) {
|
|
168
|
+
return Ne(o, { type: "editor", source: e });
|
|
169
169
|
}
|
|
170
|
-
function
|
|
171
|
-
const
|
|
172
|
-
if (!
|
|
173
|
-
const
|
|
170
|
+
function X(e) {
|
|
171
|
+
const o = y.get(e);
|
|
172
|
+
if (!o) return;
|
|
173
|
+
const t = Array.from(o.disposables);
|
|
174
174
|
try {
|
|
175
|
-
|
|
176
|
-
} catch (
|
|
177
|
-
console.warn(`${
|
|
175
|
+
Re(t);
|
|
176
|
+
} catch (n) {
|
|
177
|
+
console.warn(`${R} Encountered errors while disposing scoped disposables:`, n, ", Source:", e);
|
|
178
178
|
}
|
|
179
|
-
|
|
179
|
+
Q(e);
|
|
180
180
|
}
|
|
181
|
-
const
|
|
181
|
+
const Z = ne(!1);
|
|
182
182
|
let b = null;
|
|
183
|
-
async function
|
|
183
|
+
async function Ue() {
|
|
184
184
|
return b || (b = (async () => {
|
|
185
|
-
var
|
|
185
|
+
var e, o;
|
|
186
186
|
try {
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
const
|
|
187
|
+
const t = ((e = f.json) == null ? void 0 : e.jsonDefaults) || ((o = f.languages.json) == null ? void 0 : o.jsonDefaults);
|
|
188
|
+
t == null || t.setModeConfiguration({ tokens: !1 });
|
|
189
|
+
const n = await Se(
|
|
190
190
|
{
|
|
191
|
-
themes: Object.values(
|
|
192
|
-
langs: Object.values(
|
|
191
|
+
themes: Object.values(Ee),
|
|
192
|
+
langs: Object.values(Me)
|
|
193
193
|
}
|
|
194
194
|
);
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}),
|
|
198
|
-
} catch (
|
|
199
|
-
throw b = null,
|
|
195
|
+
n.getLoadedLanguages().forEach((a) => {
|
|
196
|
+
f.languages.register({ id: a });
|
|
197
|
+
}), be(n, f), Z.value = !0;
|
|
198
|
+
} catch (t) {
|
|
199
|
+
throw b = null, t;
|
|
200
200
|
}
|
|
201
201
|
})(), b);
|
|
202
202
|
}
|
|
203
|
-
function
|
|
204
|
-
const
|
|
205
|
-
let
|
|
206
|
-
const l =
|
|
203
|
+
function Ae(e, o) {
|
|
204
|
+
const t = ae();
|
|
205
|
+
let n, a = !1, s = !1;
|
|
206
|
+
const l = re({
|
|
207
207
|
editorStatus: "loading",
|
|
208
208
|
searchBoxIsRevealed: !1,
|
|
209
209
|
hasContent: !1,
|
|
210
|
-
theme:
|
|
211
|
-
}),
|
|
212
|
-
!
|
|
213
|
-
},
|
|
214
|
-
var
|
|
215
|
-
return (
|
|
210
|
+
theme: o.theme || "light"
|
|
211
|
+
}), m = (r) => {
|
|
212
|
+
!a || !t.value || t.value.setValue(r);
|
|
213
|
+
}, i = (r) => {
|
|
214
|
+
var u;
|
|
215
|
+
return (u = t.value) == null ? void 0 : u.updateOptions({ readOnly: r });
|
|
216
216
|
}, p = () => {
|
|
217
|
-
var
|
|
218
|
-
return (
|
|
219
|
-
}, g = (
|
|
220
|
-
var
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
}, c = (
|
|
217
|
+
var r;
|
|
218
|
+
return (r = t.value) == null ? void 0 : r.focus();
|
|
219
|
+
}, g = (r) => {
|
|
220
|
+
var w;
|
|
221
|
+
const u = (w = t.value) == null ? void 0 : w.getModel();
|
|
222
|
+
u && f.editor.setModelLanguage(u, r);
|
|
223
|
+
}, c = (r) => {
|
|
224
224
|
try {
|
|
225
|
-
if (!
|
|
226
|
-
|
|
227
|
-
} catch (
|
|
228
|
-
console.error(`useMonacoEditor: Failed to trigger command: ${
|
|
225
|
+
if (!t.value || !r) return;
|
|
226
|
+
t.value.focus(), t.value.trigger("keyboard", r, null);
|
|
227
|
+
} catch (u) {
|
|
228
|
+
console.error(`useMonacoEditor: Failed to trigger command: ${r}`, u);
|
|
229
229
|
}
|
|
230
230
|
}, h = () => {
|
|
231
|
-
var
|
|
231
|
+
var r;
|
|
232
232
|
try {
|
|
233
|
-
if (!
|
|
233
|
+
if (!t.value) return;
|
|
234
234
|
if (l.searchBoxIsRevealed)
|
|
235
|
-
return (
|
|
235
|
+
return (r = t.value.getContribution("editor.contrib.findController")) == null ? void 0 : r.closeFindWidget();
|
|
236
236
|
c("actions.find");
|
|
237
|
-
} catch (
|
|
238
|
-
console.error("useMonacoEditor: Failed to close findController.",
|
|
237
|
+
} catch (u) {
|
|
238
|
+
console.error("useMonacoEditor: Failed to close findController.", u);
|
|
239
239
|
}
|
|
240
|
-
}, E = /* @__PURE__ */
|
|
240
|
+
}, E = /* @__PURE__ */ Fe(() => f.editor.remeasureFonts(), 200);
|
|
241
241
|
return (() => {
|
|
242
|
-
|
|
243
|
-
var
|
|
244
|
-
const
|
|
245
|
-
if (!(
|
|
246
|
-
|
|
242
|
+
Ue(), L([Z, () => _(e)], ([r, u], [, w]) => {
|
|
243
|
+
var U;
|
|
244
|
+
const O = j(u), oe = j(w);
|
|
245
|
+
if (!(O instanceof HTMLElement) || !r) {
|
|
246
|
+
a = !1;
|
|
247
247
|
return;
|
|
248
248
|
}
|
|
249
|
-
if (!(
|
|
250
|
-
if (!
|
|
251
|
-
const
|
|
252
|
-
|
|
249
|
+
if (!(a && oe === O)) {
|
|
250
|
+
if (!n) {
|
|
251
|
+
const d = f.Uri.parse(`inmemory://model/${o.language}-${crypto.randomUUID()}`);
|
|
252
|
+
n = f.editor.createModel(o.code.value, o.language, d);
|
|
253
253
|
}
|
|
254
|
-
|
|
255
|
-
...
|
|
256
|
-
readOnly:
|
|
257
|
-
language:
|
|
254
|
+
t.value = f.editor.create(O, {
|
|
255
|
+
...Te,
|
|
256
|
+
readOnly: o.readOnly || !1,
|
|
257
|
+
language: o.language,
|
|
258
258
|
theme: l.theme === "light" ? "catppuccin-latte" : "catppuccin-mocha",
|
|
259
|
-
model:
|
|
259
|
+
model: n,
|
|
260
260
|
editContext: !1,
|
|
261
|
-
...
|
|
262
|
-
}),
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
if (
|
|
266
|
-
const
|
|
267
|
-
l.hasContent = !!
|
|
261
|
+
...o.monacoOptions
|
|
262
|
+
}), a = !0, l.editorStatus = "ready", l.hasContent = !!o.code.value, H(
|
|
263
|
+
t.value,
|
|
264
|
+
t.value.onDidChangeModelContent(() => {
|
|
265
|
+
if (s) return;
|
|
266
|
+
const d = t.value.getValue();
|
|
267
|
+
l.hasContent = !!d.length, o.code.value = d;
|
|
268
268
|
})
|
|
269
|
-
), (
|
|
269
|
+
), (U = o.onReady) == null || U.call(o, t.value), E();
|
|
270
270
|
try {
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
l.searchBoxIsRevealed =
|
|
271
|
+
const d = t.value.getContribution("editor.contrib.findController"), x = d == null ? void 0 : d.getState();
|
|
272
|
+
H(
|
|
273
|
+
t.value,
|
|
274
|
+
x == null ? void 0 : x.onFindReplaceStateChange(() => {
|
|
275
|
+
l.searchBoxIsRevealed = x.isRevealed;
|
|
276
276
|
})
|
|
277
277
|
// This returns a disposable
|
|
278
278
|
);
|
|
279
|
-
} catch (
|
|
280
|
-
console.error("useMonacoEditor: Failed to get the state of findController",
|
|
279
|
+
} catch (d) {
|
|
280
|
+
console.error("useMonacoEditor: Failed to get the state of findController", d);
|
|
281
281
|
}
|
|
282
|
-
|
|
283
|
-
var
|
|
284
|
-
(
|
|
282
|
+
ce(() => {
|
|
283
|
+
var d;
|
|
284
|
+
(d = t.value) == null || d.dispose();
|
|
285
285
|
});
|
|
286
286
|
}
|
|
287
287
|
}, {
|
|
288
288
|
immediate: !0,
|
|
289
289
|
flush: "post"
|
|
290
290
|
});
|
|
291
|
-
})(),
|
|
292
|
-
if (!
|
|
293
|
-
const
|
|
294
|
-
|
|
291
|
+
})(), L(o.code, (r) => {
|
|
292
|
+
if (!t.value || !n || !a) return;
|
|
293
|
+
const u = n.getValue();
|
|
294
|
+
r !== u && (s = !0, t.value.executeEdits("external", [
|
|
295
295
|
{
|
|
296
|
-
range:
|
|
297
|
-
text:
|
|
296
|
+
range: n.getFullModelRange(),
|
|
297
|
+
text: r
|
|
298
298
|
}
|
|
299
|
-
]),
|
|
300
|
-
}),
|
|
301
|
-
if (!
|
|
302
|
-
const
|
|
303
|
-
|
|
299
|
+
]), t.value.pushUndoStop(), l.hasContent = !!r.length, s = !1);
|
|
300
|
+
}), se(E), ie(E), le(() => {
|
|
301
|
+
if (!t.value) return;
|
|
302
|
+
const r = t.value.getModel();
|
|
303
|
+
t.value.dispose(), r && r.dispose();
|
|
304
304
|
}), {
|
|
305
|
-
editor:
|
|
305
|
+
editor: t,
|
|
306
306
|
editorStates: l,
|
|
307
|
-
setContent:
|
|
308
|
-
setReadOnly:
|
|
307
|
+
setContent: m,
|
|
308
|
+
setReadOnly: i,
|
|
309
309
|
focus: p,
|
|
310
310
|
setLanguage: g,
|
|
311
311
|
remeasureFonts: E,
|
|
@@ -313,57 +313,57 @@ function Fe(o, t) {
|
|
|
313
313
|
triggerKeyboardCommand: c
|
|
314
314
|
};
|
|
315
315
|
}
|
|
316
|
-
const
|
|
316
|
+
const $e = {
|
|
317
317
|
messages: {
|
|
318
318
|
empty_message: "The editor is currently empty. Start typing to add content.",
|
|
319
319
|
empty_title: "No content available",
|
|
320
320
|
loading_message: "Please wait while the {type} content is loaded.",
|
|
321
321
|
loading_title: "{type} editor"
|
|
322
322
|
}
|
|
323
|
-
},
|
|
324
|
-
editor:
|
|
323
|
+
}, Pe = {
|
|
324
|
+
editor: $e
|
|
325
325
|
};
|
|
326
|
-
function
|
|
327
|
-
const
|
|
326
|
+
function Ve() {
|
|
327
|
+
const e = we("en-us", Pe);
|
|
328
328
|
return {
|
|
329
|
-
i18n:
|
|
330
|
-
i18nT:
|
|
329
|
+
i18n: e,
|
|
330
|
+
i18nT: xe(e)
|
|
331
331
|
// Translation component <i18n-t>
|
|
332
332
|
};
|
|
333
333
|
}
|
|
334
|
-
const
|
|
334
|
+
const Be = /* @__PURE__ */ Y({
|
|
335
335
|
__name: "MonacoEditorStatusOverlay",
|
|
336
336
|
props: {
|
|
337
337
|
title: {},
|
|
338
338
|
message: {},
|
|
339
339
|
icon: {}
|
|
340
340
|
},
|
|
341
|
-
setup(
|
|
342
|
-
return (
|
|
343
|
-
const
|
|
344
|
-
return
|
|
341
|
+
setup(e) {
|
|
342
|
+
return (o, t) => {
|
|
343
|
+
const n = ue("KEmptyState");
|
|
344
|
+
return S(), I(n, {
|
|
345
345
|
class: "monaco-editor-status-overlay",
|
|
346
|
-
message:
|
|
347
|
-
title:
|
|
348
|
-
},
|
|
349
|
-
|
|
346
|
+
message: e.message,
|
|
347
|
+
title: e.title
|
|
348
|
+
}, de({ _: 2 }, [
|
|
349
|
+
e.icon ? {
|
|
350
350
|
name: "icon",
|
|
351
|
-
fn:
|
|
352
|
-
(
|
|
351
|
+
fn: F(() => [
|
|
352
|
+
(S(), I(ge(e.icon), { decorative: "" }))
|
|
353
353
|
]),
|
|
354
354
|
key: "0"
|
|
355
355
|
} : void 0
|
|
356
356
|
]), 1032, ["message", "title"]);
|
|
357
357
|
};
|
|
358
358
|
}
|
|
359
|
-
}),
|
|
360
|
-
const
|
|
361
|
-
for (const [
|
|
362
|
-
|
|
363
|
-
return
|
|
364
|
-
},
|
|
359
|
+
}), ee = (e, o) => {
|
|
360
|
+
const t = e.__vccOpts || e;
|
|
361
|
+
for (const [n, a] of o)
|
|
362
|
+
t[n] = a;
|
|
363
|
+
return t;
|
|
364
|
+
}, q = /* @__PURE__ */ ee(Be, [["__scopeId", "data-v-062eadb5"]]), Ke = /* @__PURE__ */ Y({
|
|
365
365
|
__name: "MonacoEditor",
|
|
366
|
-
props: /* @__PURE__ */
|
|
366
|
+
props: /* @__PURE__ */ A({
|
|
367
367
|
theme: { default: "light" },
|
|
368
368
|
language: { default: "markdown" },
|
|
369
369
|
loading: { type: Boolean, default: !1 },
|
|
@@ -376,57 +376,57 @@ const Ne = /* @__PURE__ */ H({
|
|
|
376
376
|
},
|
|
377
377
|
modelModifiers: {}
|
|
378
378
|
}),
|
|
379
|
-
emits: /* @__PURE__ */
|
|
380
|
-
setup(
|
|
381
|
-
const
|
|
382
|
-
language:
|
|
383
|
-
code:
|
|
384
|
-
theme:
|
|
385
|
-
monacoOptions:
|
|
379
|
+
emits: /* @__PURE__ */ A(["ready"], ["update:modelValue"]),
|
|
380
|
+
setup(e, { expose: o, emit: t }) {
|
|
381
|
+
const n = t, a = fe(e, "modelValue"), { i18n: s } = Ve(), l = me("editorRef"), m = T(() => e.theme === "dark" ? "dark" : "light"), i = T(() => g.editorStates.editorStatus === "loading" || e.loading), p = T(() => g.editorStates.editorStatus === "ready" && !g.editorStates.hasContent), g = Ae(l, {
|
|
382
|
+
language: e.language,
|
|
383
|
+
code: a,
|
|
384
|
+
theme: m.value,
|
|
385
|
+
monacoOptions: e.options,
|
|
386
386
|
onReady: (c) => {
|
|
387
|
-
|
|
387
|
+
n("ready", c);
|
|
388
388
|
}
|
|
389
389
|
});
|
|
390
|
-
return
|
|
390
|
+
return o({
|
|
391
391
|
monacoEditor: g
|
|
392
|
-
}),
|
|
392
|
+
}), L(() => e.language, (c, h) => {
|
|
393
393
|
c !== h && g.setLanguage(c);
|
|
394
|
-
}), (c, h) => (
|
|
395
|
-
class:
|
|
396
|
-
|
|
397
|
-
{ loading:
|
|
394
|
+
}), (c, h) => (S(), pe("div", {
|
|
395
|
+
class: he(["monaco-editor-container", [
|
|
396
|
+
m.value,
|
|
397
|
+
{ loading: i.value }
|
|
398
398
|
]]),
|
|
399
399
|
"data-testid": "monaco-editor-container"
|
|
400
400
|
}, [
|
|
401
|
-
|
|
401
|
+
ve("div", {
|
|
402
402
|
ref_key: "editorRef",
|
|
403
403
|
ref: l,
|
|
404
404
|
class: "monaco-editor-target",
|
|
405
405
|
"data-testid": "monaco-editor-target"
|
|
406
406
|
}, null, 512),
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
default:
|
|
410
|
-
|
|
407
|
+
$(c.$slots, "state-loading", { isLoading: i.value }, () => [
|
|
408
|
+
P(V, { name: "fade" }, {
|
|
409
|
+
default: F(() => [
|
|
410
|
+
i.value ? (S(), I(q, {
|
|
411
411
|
key: 0,
|
|
412
412
|
"data-testid": "monaco-editor-status-overlay-loading",
|
|
413
|
-
icon: v(
|
|
414
|
-
message: v(
|
|
415
|
-
title: v(
|
|
413
|
+
icon: v(ye),
|
|
414
|
+
message: v(s).t("editor.messages.loading_message", { type: e.language }),
|
|
415
|
+
title: v(s).t("editor.messages.loading_title", { type: e.language })
|
|
416
416
|
}, null, 8, ["icon", "message", "title"])) : B("", !0)
|
|
417
417
|
]),
|
|
418
418
|
_: 1
|
|
419
419
|
})
|
|
420
420
|
], !0),
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
default:
|
|
424
|
-
p.value && !
|
|
421
|
+
$(c.$slots, "state-empty", { isEmpty: p.value }, () => [
|
|
422
|
+
P(V, { name: "fade" }, {
|
|
423
|
+
default: F(() => [
|
|
424
|
+
p.value && !i.value ? (S(), I(q, {
|
|
425
425
|
key: 0,
|
|
426
426
|
"data-testid": "monaco-editor-status-overlay-empty",
|
|
427
|
-
icon: v(
|
|
428
|
-
message: v(
|
|
429
|
-
title: v(
|
|
427
|
+
icon: v(Ce),
|
|
428
|
+
message: v(s).t("editor.messages.empty_message"),
|
|
429
|
+
title: v(s).t("editor.messages.empty_title")
|
|
430
430
|
}, null, 8, ["icon", "message", "title"])) : B("", !0)
|
|
431
431
|
]),
|
|
432
432
|
_: 1
|
|
@@ -434,8 +434,72 @@ const Ne = /* @__PURE__ */ H({
|
|
|
434
434
|
], !0)
|
|
435
435
|
], 2));
|
|
436
436
|
}
|
|
437
|
-
}),
|
|
437
|
+
}), tt = /* @__PURE__ */ ee(Ke, [["__scopeId", "data-v-740f231e"]]);
|
|
438
|
+
async function J(e) {
|
|
439
|
+
const o = e.getLanguageId(), t = e.getAlternativeVersionId();
|
|
440
|
+
switch (o) {
|
|
441
|
+
case "json": {
|
|
442
|
+
const n = e.getValue(), { parseIntoJSONContext: a } = await import("./json-CkL__jXi.js");
|
|
443
|
+
return a(n, t);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
return {
|
|
447
|
+
isDefault: !0,
|
|
448
|
+
language: o,
|
|
449
|
+
altVersionId: t
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
const je = "[monaco-editor] [model-contexts]", ze = 3, M = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakMap();
|
|
453
|
+
function Ge(e) {
|
|
454
|
+
return `${e.getLanguageId()}\0${e.getAlternativeVersionId()}`;
|
|
455
|
+
}
|
|
456
|
+
async function He(e) {
|
|
457
|
+
if (N(e) === 0)
|
|
458
|
+
return J(e);
|
|
459
|
+
let t = M.get(e);
|
|
460
|
+
t || (t = /* @__PURE__ */ new Map(), M.set(e, t));
|
|
461
|
+
const n = Ge(e);
|
|
462
|
+
let a = t.get(n);
|
|
463
|
+
return a ? (t.delete(n), t.set(n, a)) : (a = await J(e), t.set(n, a), te(e)), a;
|
|
464
|
+
}
|
|
465
|
+
function te(e) {
|
|
466
|
+
const o = M.get(e);
|
|
467
|
+
if (!o) return;
|
|
468
|
+
const t = N(e);
|
|
469
|
+
if (t === 0) {
|
|
470
|
+
M.delete(e);
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
for (; o.size > t; ) {
|
|
474
|
+
const n = o.keys().next().value;
|
|
475
|
+
if (n === void 0) break;
|
|
476
|
+
o.delete(n);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
function N(e) {
|
|
480
|
+
let o = k.get(e);
|
|
481
|
+
return o === void 0 && (o = ze, k.set(e, o)), o;
|
|
482
|
+
}
|
|
483
|
+
function ot(e, o) {
|
|
484
|
+
if (o < 0 || !Number.isInteger(o) || !Number.isFinite(o) || Number.isNaN(o))
|
|
485
|
+
throw new Error(`${je} Capacity must be a non-negative finite integer`);
|
|
486
|
+
const t = N(e);
|
|
487
|
+
o !== t && (k.set(e, o), te(e));
|
|
488
|
+
}
|
|
489
|
+
async function nt(e) {
|
|
490
|
+
return W.has(e) || W.set(e, e.onWillDispose(() => {
|
|
491
|
+
Xe(e);
|
|
492
|
+
})), He(e);
|
|
493
|
+
}
|
|
494
|
+
function Xe(e) {
|
|
495
|
+
M.delete(e), k.delete(e), W.delete(e);
|
|
496
|
+
}
|
|
438
497
|
export {
|
|
439
|
-
|
|
440
|
-
|
|
498
|
+
ze as DEFAULT_MODEL_CONTEXTS_LRU_CAPACITY,
|
|
499
|
+
tt as MonacoEditor,
|
|
500
|
+
nt as getModelContext,
|
|
501
|
+
N as getModelContextsCapacity,
|
|
502
|
+
Xe as invalidateModelContexts,
|
|
503
|
+
ot as setModelContextsCapacity,
|
|
504
|
+
Ae as useMonacoEditor
|
|
441
505
|
};
|