@kong-ui-public/monaco-editor 0.7.2 → 0.7.3
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.
- package/dist/runtime/monaco-editor.es.js +153 -153
- package/dist/runtime/monaco-editor.umd.js +1 -1
- package/dist/runtime/style.css +1 -1
- package/dist/types/src/components/MonacoEditor.vue.d.ts +5 -0
- package/dist/types/src/components/MonacoEditor.vue.d.ts.map +1 -1
- package/dist/types/src/composables/useMonacoEditor.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +1 -5
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { toValue as
|
|
2
|
-
import { ProgressIcon as ue, CodeblockIcon as
|
|
3
|
-
import * as
|
|
4
|
-
import { shikiToMonaco as
|
|
1
|
+
import { toValue as _, ref as J, shallowRef as Q, reactive as X, watch as x, onMounted as Y, onActivated as Z, onBeforeUnmount as ee, onWatcherCleanup as te, defineComponent as V, resolveComponent as oe, createBlock as M, openBlock as C, createSlots as ae, withCtx as T, resolveDynamicComponent as ne, mergeModels as re, useModel as se, useTemplateRef as ie, computed as O, createElementBlock as le, normalizeClass as ce, createElementVNode as de, renderSlot as F, createVNode as W, Transition as L, createCommentVNode as R, unref as p } from "vue";
|
|
2
|
+
import { ProgressIcon as ue, CodeblockIcon as ge } from "@kong/icons";
|
|
3
|
+
import * as g from "monaco-editor";
|
|
4
|
+
import { shikiToMonaco as me } from "@shikijs/monaco";
|
|
5
5
|
import { getSingletonHighlighter as fe, bundledLanguages as pe, bundledThemes as he } from "shiki";
|
|
6
6
|
import { createI18n as ve, i18nTComponent as ye } from "@kong-ui-public/i18n";
|
|
7
7
|
const Se = "'JetBrains Mono', Consolas, monospace", be = "12px", Ce = "500", Ee = "20px", _e = Object.freeze({
|
|
@@ -59,78 +59,78 @@ const Se = "'JetBrains Mono', Consolas, monospace", be = "12px", Ce = "500", Ee
|
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
62
|
-
const
|
|
62
|
+
const N = () => {
|
|
63
63
|
};
|
|
64
|
-
function
|
|
64
|
+
function Me(o, t) {
|
|
65
65
|
function e(...a) {
|
|
66
|
-
return new Promise((
|
|
66
|
+
return new Promise((s, n) => {
|
|
67
67
|
Promise.resolve(o(() => t.apply(this, a), {
|
|
68
68
|
fn: t,
|
|
69
69
|
thisArg: this,
|
|
70
70
|
args: a
|
|
71
|
-
})).then(
|
|
71
|
+
})).then(s).catch(n);
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
return e;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
let e, a,
|
|
78
|
-
const
|
|
79
|
-
clearTimeout(i),
|
|
76
|
+
function we(o, t = {}) {
|
|
77
|
+
let e, a, s = N;
|
|
78
|
+
const n = (i) => {
|
|
79
|
+
clearTimeout(i), s(), s = N;
|
|
80
80
|
};
|
|
81
81
|
let l;
|
|
82
82
|
return (i) => {
|
|
83
|
-
const
|
|
84
|
-
return e &&
|
|
85
|
-
|
|
86
|
-
e &&
|
|
87
|
-
},
|
|
88
|
-
a &&
|
|
89
|
-
},
|
|
83
|
+
const v = _(o), m = _(t.maxWait);
|
|
84
|
+
return e && n(e), v <= 0 || m !== void 0 && m <= 0 ? (a && (n(a), a = void 0), Promise.resolve(i())) : new Promise((y, f) => {
|
|
85
|
+
s = t.rejectOnCancel ? f : y, l = i, m && !a && (a = setTimeout(() => {
|
|
86
|
+
e && n(e), a = void 0, y(l());
|
|
87
|
+
}, m)), e = setTimeout(() => {
|
|
88
|
+
a && n(a), a = void 0, y(i());
|
|
89
|
+
}, v);
|
|
90
90
|
});
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
93
|
// @__NO_SIDE_EFFECTS__
|
|
94
94
|
function Oe(o, t = 200, e = {}) {
|
|
95
|
-
return we(
|
|
95
|
+
return Me(we(t, e), o);
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function U(o) {
|
|
98
98
|
var t;
|
|
99
|
-
const e =
|
|
99
|
+
const e = _(o);
|
|
100
100
|
return (t = e == null ? void 0 : e.$el) !== null && t !== void 0 ? t : e;
|
|
101
101
|
}
|
|
102
|
-
const
|
|
102
|
+
const I = "[monaco-editor] [lifecycle]", h = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new WeakMap();
|
|
103
103
|
function ke(o) {
|
|
104
|
-
let t =
|
|
104
|
+
let t = h.get(o.source);
|
|
105
105
|
if (!t) {
|
|
106
106
|
let e;
|
|
107
107
|
switch (o.type) {
|
|
108
108
|
case "editor":
|
|
109
|
-
e = o.source.onDidDispose(() =>
|
|
109
|
+
e = o.source.onDidDispose(() => A(o.source));
|
|
110
110
|
break;
|
|
111
111
|
case "model":
|
|
112
|
-
e = o.source.onWillDispose(() =>
|
|
112
|
+
e = o.source.onWillDispose(() => A(o.source));
|
|
113
113
|
break;
|
|
114
114
|
default:
|
|
115
|
-
throw new Error(`${
|
|
115
|
+
throw new Error(`${I} Unknown scope: ${o}`);
|
|
116
116
|
}
|
|
117
117
|
t = {
|
|
118
118
|
disposables: /* @__PURE__ */ new Set(),
|
|
119
119
|
scopeListener: e
|
|
120
|
-
},
|
|
120
|
+
}, h.set(o.source, t);
|
|
121
121
|
}
|
|
122
122
|
return t;
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
const t =
|
|
126
|
-
t && (t.scopeListener.dispose(),
|
|
124
|
+
function K(o) {
|
|
125
|
+
const t = h.get(o);
|
|
126
|
+
t && (t.scopeListener.dispose(), h.delete(o));
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function B(o, t) {
|
|
129
129
|
ke(t).disposables.add(o);
|
|
130
130
|
}
|
|
131
131
|
function P(o, t) {
|
|
132
|
-
const e =
|
|
133
|
-
e && (e.disposables.delete(o), e.disposables.size === 0 &&
|
|
132
|
+
const e = h.get(t.source);
|
|
133
|
+
e && (e.disposables.delete(o), e.disposables.size === 0 && K(t.source));
|
|
134
134
|
}
|
|
135
135
|
function Te(o) {
|
|
136
136
|
const t = [];
|
|
@@ -143,48 +143,48 @@ function Te(o) {
|
|
|
143
143
|
}), t.length)
|
|
144
144
|
throw new AggregateError(
|
|
145
145
|
t,
|
|
146
|
-
`${
|
|
146
|
+
`${I} One or more disposables threw while being disposed.`
|
|
147
147
|
);
|
|
148
148
|
}
|
|
149
149
|
function Ie(o, t) {
|
|
150
|
-
var l,
|
|
151
|
-
let e = o, a =
|
|
150
|
+
var l, u;
|
|
151
|
+
let e = o, a = S.get(e);
|
|
152
152
|
if (!a) {
|
|
153
|
-
const i =
|
|
154
|
-
i && (e = i, a =
|
|
153
|
+
const i = k.get(o);
|
|
154
|
+
i && (e = i, a = S.get(i));
|
|
155
155
|
}
|
|
156
156
|
if (a)
|
|
157
|
-
return ((l = a.scope) == null ? void 0 : l.type) === (t == null ? void 0 : t.type) && ((
|
|
158
|
-
const
|
|
157
|
+
return ((l = a.scope) == null ? void 0 : l.type) === (t == null ? void 0 : t.type) && ((u = a.scope) == null ? void 0 : u.source) === (t == null ? void 0 : t.source) || (a.scope && P(a.decorated, a.scope), t ? (B(a.decorated, t), a.scope = t) : a.scope = void 0), a.decorated;
|
|
158
|
+
const s = e.dispose, n = {
|
|
159
159
|
dispose: () => {
|
|
160
|
-
const i =
|
|
160
|
+
const i = S.get(e);
|
|
161
161
|
if (i)
|
|
162
|
-
return i.scope && P(
|
|
162
|
+
return i.scope && P(n, i.scope), S.delete(e), k.delete(n), s.call(e);
|
|
163
163
|
}
|
|
164
164
|
};
|
|
165
|
-
return
|
|
165
|
+
return S.set(e, { decorated: n, scope: t }), k.set(n, e), t && B(n, t), n;
|
|
166
166
|
}
|
|
167
|
-
function
|
|
167
|
+
function $(o, t) {
|
|
168
168
|
return Ie(t, { type: "editor", source: o });
|
|
169
169
|
}
|
|
170
|
-
function
|
|
171
|
-
const t =
|
|
170
|
+
function A(o) {
|
|
171
|
+
const t = h.get(o);
|
|
172
172
|
if (!t) return;
|
|
173
173
|
const e = Array.from(t.disposables);
|
|
174
174
|
try {
|
|
175
175
|
Te(e);
|
|
176
176
|
} catch (a) {
|
|
177
|
-
console.warn(`${
|
|
177
|
+
console.warn(`${I} Encountered errors while disposing scoped disposables:`, a, ", Source:", o);
|
|
178
178
|
}
|
|
179
|
-
|
|
179
|
+
K(o);
|
|
180
180
|
}
|
|
181
|
-
const
|
|
182
|
-
let
|
|
181
|
+
const z = J(!1);
|
|
182
|
+
let b = null;
|
|
183
183
|
async function De() {
|
|
184
|
-
return
|
|
184
|
+
return b || (b = (async () => {
|
|
185
185
|
var o, t;
|
|
186
186
|
try {
|
|
187
|
-
const e = ((o =
|
|
187
|
+
const e = ((o = g.json) == null ? void 0 : o.jsonDefaults) || ((t = g.languages.json) == null ? void 0 : t.jsonDefaults);
|
|
188
188
|
e == null || e.setModeConfiguration({ tokens: !1 });
|
|
189
189
|
const a = await fe(
|
|
190
190
|
{
|
|
@@ -192,91 +192,86 @@ async function De() {
|
|
|
192
192
|
langs: Object.values(pe)
|
|
193
193
|
}
|
|
194
194
|
);
|
|
195
|
-
a.getLoadedLanguages().forEach((
|
|
196
|
-
|
|
197
|
-
}),
|
|
195
|
+
a.getLoadedLanguages().forEach((s) => {
|
|
196
|
+
g.languages.register({ id: s });
|
|
197
|
+
}), me(a, g), z.value = !0;
|
|
198
198
|
} catch (e) {
|
|
199
|
-
throw
|
|
199
|
+
throw b = null, e;
|
|
200
200
|
}
|
|
201
|
-
})(),
|
|
201
|
+
})(), b);
|
|
202
202
|
}
|
|
203
|
-
function
|
|
204
|
-
const e =
|
|
205
|
-
let a = !1;
|
|
206
|
-
const
|
|
203
|
+
function xe(o, t) {
|
|
204
|
+
const e = Q();
|
|
205
|
+
let a, s = !1, n = !1;
|
|
206
|
+
const l = X({
|
|
207
207
|
editorStatus: "loading",
|
|
208
208
|
searchBoxIsRevealed: !1,
|
|
209
209
|
hasContent: !1,
|
|
210
210
|
theme: t.theme || "light"
|
|
211
|
-
}),
|
|
212
|
-
!
|
|
213
|
-
},
|
|
214
|
-
var
|
|
215
|
-
return (
|
|
216
|
-
},
|
|
211
|
+
}), u = (r) => {
|
|
212
|
+
!s || !e.value || e.value.setValue(r);
|
|
213
|
+
}, i = (r) => {
|
|
214
|
+
var d;
|
|
215
|
+
return (d = e.value) == null ? void 0 : d.updateOptions({ readOnly: r });
|
|
216
|
+
}, v = () => {
|
|
217
217
|
var r;
|
|
218
218
|
return (r = e.value) == null ? void 0 : r.focus();
|
|
219
|
-
},
|
|
219
|
+
}, m = (r) => {
|
|
220
220
|
try {
|
|
221
221
|
if (!e.value || !r) return;
|
|
222
222
|
e.value.focus(), e.value.trigger("keyboard", r, null);
|
|
223
|
-
} catch (
|
|
224
|
-
console.error(`useMonacoEditor: Failed to trigger command: ${r}`,
|
|
223
|
+
} catch (d) {
|
|
224
|
+
console.error(`useMonacoEditor: Failed to trigger command: ${r}`, d);
|
|
225
225
|
}
|
|
226
|
-
},
|
|
226
|
+
}, y = () => {
|
|
227
227
|
var r;
|
|
228
228
|
try {
|
|
229
229
|
if (!e.value) return;
|
|
230
|
-
if (
|
|
230
|
+
if (l.searchBoxIsRevealed)
|
|
231
231
|
return (r = e.value.getContribution("editor.contrib.findController")) == null ? void 0 : r.closeFindWidget();
|
|
232
|
-
|
|
233
|
-
} catch (
|
|
234
|
-
console.error("useMonacoEditor: Failed to close findController.",
|
|
232
|
+
m("actions.find");
|
|
233
|
+
} catch (d) {
|
|
234
|
+
console.error("useMonacoEditor: Failed to close findController.", d);
|
|
235
235
|
}
|
|
236
|
-
},
|
|
236
|
+
}, f = /* @__PURE__ */ Oe(() => g.editor.remeasureFonts(), 200);
|
|
237
237
|
return (() => {
|
|
238
|
-
De()
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
if (!(w instanceof HTMLElement) || !g) {
|
|
244
|
-
a = !1;
|
|
238
|
+
De(), x([z, () => _(o)], ([r, d], [, G]) => {
|
|
239
|
+
var D;
|
|
240
|
+
const w = U(d), q = U(G);
|
|
241
|
+
if (!(w instanceof HTMLElement) || !r) {
|
|
242
|
+
s = !1;
|
|
245
243
|
return;
|
|
246
244
|
}
|
|
247
|
-
if (!(
|
|
248
|
-
if (!
|
|
249
|
-
const c =
|
|
250
|
-
|
|
245
|
+
if (!(s && q === w)) {
|
|
246
|
+
if (!a) {
|
|
247
|
+
const c = g.Uri.parse(`inmemory://model/${t.language}-${crypto.randomUUID()}`);
|
|
248
|
+
a = g.editor.createModel(t.code.value, t.language, c);
|
|
251
249
|
}
|
|
252
|
-
e.value =
|
|
250
|
+
e.value = g.editor.create(w, {
|
|
253
251
|
..._e,
|
|
254
252
|
readOnly: t.readOnly || !1,
|
|
255
253
|
language: t.language,
|
|
256
|
-
theme:
|
|
257
|
-
model:
|
|
254
|
+
theme: l.theme === "light" ? "catppuccin-latte" : "catppuccin-mocha",
|
|
255
|
+
model: a,
|
|
258
256
|
editContext: !1,
|
|
259
257
|
...t.monacoOptions
|
|
260
|
-
}),
|
|
258
|
+
}), s = !0, l.editorStatus = "ready", l.hasContent = !!t.code.value, $(
|
|
261
259
|
e.value,
|
|
262
260
|
e.value.onDidChangeModelContent(() => {
|
|
263
|
-
|
|
261
|
+
if (n) return;
|
|
264
262
|
const c = e.value.getValue();
|
|
265
|
-
|
|
263
|
+
l.hasContent = !!c.length, t.code.value = c;
|
|
266
264
|
})
|
|
267
|
-
), (
|
|
265
|
+
), (D = t.onCreated) == null || D.call(t), f();
|
|
268
266
|
try {
|
|
269
|
-
const c = e.value.getContribution("editor.contrib.findController");
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
// This returns a disposable
|
|
278
|
-
);
|
|
279
|
-
}
|
|
267
|
+
const c = e.value.getContribution("editor.contrib.findController"), E = c == null ? void 0 : c.getState();
|
|
268
|
+
$(
|
|
269
|
+
e.value,
|
|
270
|
+
E == null ? void 0 : E.onFindReplaceStateChange(() => {
|
|
271
|
+
l.searchBoxIsRevealed = E.isRevealed;
|
|
272
|
+
})
|
|
273
|
+
// This returns a disposable
|
|
274
|
+
);
|
|
280
275
|
} catch (c) {
|
|
281
276
|
console.error("useMonacoEditor: Failed to get the state of findController", c);
|
|
282
277
|
}
|
|
@@ -289,22 +284,31 @@ function Fe(o, t) {
|
|
|
289
284
|
immediate: !0,
|
|
290
285
|
flush: "post"
|
|
291
286
|
});
|
|
292
|
-
})(),
|
|
287
|
+
})(), x(() => t.code.value, (r) => {
|
|
288
|
+
if (!e.value || !a || !s) return;
|
|
289
|
+
const d = a.getValue();
|
|
290
|
+
r !== d && (n = !0, e.value.executeEdits("external", [
|
|
291
|
+
{
|
|
292
|
+
range: a.getFullModelRange(),
|
|
293
|
+
text: r
|
|
294
|
+
}
|
|
295
|
+
]), e.value.pushUndoStop(), l.hasContent = !!r.length, n = !1);
|
|
296
|
+
}), Y(f), Z(f), ee(() => {
|
|
293
297
|
if (!e.value) return;
|
|
294
298
|
const r = e.value.getModel();
|
|
295
299
|
e.value.dispose(), r && r.dispose();
|
|
296
300
|
}), {
|
|
297
301
|
editor: e,
|
|
298
|
-
editorStates:
|
|
299
|
-
setContent:
|
|
300
|
-
setReadOnly:
|
|
301
|
-
focus:
|
|
302
|
-
remeasureFonts:
|
|
303
|
-
toggleSearchWidget:
|
|
304
|
-
triggerKeyboardCommand:
|
|
302
|
+
editorStates: l,
|
|
303
|
+
setContent: u,
|
|
304
|
+
setReadOnly: i,
|
|
305
|
+
focus: v,
|
|
306
|
+
remeasureFonts: f,
|
|
307
|
+
toggleSearchWidget: y,
|
|
308
|
+
triggerKeyboardCommand: m
|
|
305
309
|
};
|
|
306
310
|
}
|
|
307
|
-
const
|
|
311
|
+
const Fe = {
|
|
308
312
|
messages: {
|
|
309
313
|
empty_message: "The editor is currently empty. Start typing to add content.",
|
|
310
314
|
empty_title: "No content available",
|
|
@@ -312,7 +316,7 @@ const xe = {
|
|
|
312
316
|
loading_title: "{type} editor"
|
|
313
317
|
}
|
|
314
318
|
}, We = {
|
|
315
|
-
editor:
|
|
319
|
+
editor: Fe
|
|
316
320
|
};
|
|
317
321
|
function Le() {
|
|
318
322
|
const o = ve("en-us", We);
|
|
@@ -332,31 +336,32 @@ const Re = /* @__PURE__ */ V({
|
|
|
332
336
|
setup(o) {
|
|
333
337
|
return (t, e) => {
|
|
334
338
|
const a = oe("KEmptyState");
|
|
335
|
-
return
|
|
339
|
+
return C(), M(a, {
|
|
336
340
|
class: "monaco-editor-status-overlay",
|
|
337
341
|
message: o.message,
|
|
338
342
|
title: o.title
|
|
339
343
|
}, ae({ _: 2 }, [
|
|
340
344
|
o.icon ? {
|
|
341
345
|
name: "icon",
|
|
342
|
-
fn:
|
|
343
|
-
(
|
|
346
|
+
fn: T(() => [
|
|
347
|
+
(C(), M(ne(o.icon), { decorative: "" }))
|
|
344
348
|
]),
|
|
345
349
|
key: "0"
|
|
346
350
|
} : void 0
|
|
347
351
|
]), 1032, ["message", "title"]);
|
|
348
352
|
};
|
|
349
353
|
}
|
|
350
|
-
}),
|
|
354
|
+
}), H = (o, t) => {
|
|
351
355
|
const e = o.__vccOpts || o;
|
|
352
|
-
for (const [a,
|
|
353
|
-
e[a] =
|
|
356
|
+
for (const [a, s] of t)
|
|
357
|
+
e[a] = s;
|
|
354
358
|
return e;
|
|
355
|
-
},
|
|
359
|
+
}, j = /* @__PURE__ */ H(Re, [["__scopeId", "data-v-062eadb5"]]), Ne = /* @__PURE__ */ V({
|
|
356
360
|
__name: "MonacoEditor",
|
|
357
361
|
props: /* @__PURE__ */ re({
|
|
358
362
|
theme: { default: "light" },
|
|
359
363
|
language: { default: "markdown" },
|
|
364
|
+
loading: { type: Boolean, default: !1 },
|
|
360
365
|
options: { default: () => {
|
|
361
366
|
} }
|
|
362
367
|
}, {
|
|
@@ -368,19 +373,16 @@ const Re = /* @__PURE__ */ V({
|
|
|
368
373
|
}),
|
|
369
374
|
emits: ["update:modelValue"],
|
|
370
375
|
setup(o) {
|
|
371
|
-
const t = se(o, "modelValue"), { i18n: e } = Le(), a = ie("editorRef"),
|
|
376
|
+
const t = se(o, "modelValue"), { i18n: e } = Le(), a = ie("editorRef"), s = O(() => o.theme === "dark" ? "dark" : "light"), n = O(() => u.editorStates.editorStatus === "loading" || o.loading), l = O(() => u.editorStates.editorStatus === "ready" && !u.editorStates.hasContent), u = xe(a, {
|
|
372
377
|
language: o.language,
|
|
373
378
|
code: t,
|
|
374
|
-
theme:
|
|
375
|
-
monacoOptions: o.options
|
|
376
|
-
onChanged: (d) => {
|
|
377
|
-
t.value = d;
|
|
378
|
-
}
|
|
379
|
+
theme: s.value,
|
|
380
|
+
monacoOptions: o.options
|
|
379
381
|
});
|
|
380
|
-
return (
|
|
382
|
+
return (i, v) => (C(), le("div", {
|
|
381
383
|
class: ce(["monaco-editor-container", [
|
|
382
|
-
|
|
383
|
-
{ loading:
|
|
384
|
+
s.value,
|
|
385
|
+
{ loading: n.value }
|
|
384
386
|
]]),
|
|
385
387
|
"data-testid": "monaco-editor-container"
|
|
386
388
|
}, [
|
|
@@ -390,40 +392,38 @@ const Re = /* @__PURE__ */ V({
|
|
|
390
392
|
class: "monaco-editor-target",
|
|
391
393
|
"data-testid": "monaco-editor-target"
|
|
392
394
|
}, null, 512),
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
default: O(() => [
|
|
398
|
-
m(l).editorStates.editorStatus === "loading" ? (S(), _($, {
|
|
395
|
+
F(i.$slots, "state-loading", { isLoading: n.value }, () => [
|
|
396
|
+
W(L, { name: "fade" }, {
|
|
397
|
+
default: T(() => [
|
|
398
|
+
n.value ? (C(), M(j, {
|
|
399
399
|
key: 0,
|
|
400
400
|
"data-testid": "monaco-editor-status-overlay-loading",
|
|
401
|
-
icon:
|
|
402
|
-
message:
|
|
403
|
-
title:
|
|
404
|
-
}, null, 8, ["icon", "message", "title"])) :
|
|
401
|
+
icon: p(ue),
|
|
402
|
+
message: p(e).t("editor.messages.loading_message", { type: o.language }),
|
|
403
|
+
title: p(e).t("editor.messages.loading_title", { type: o.language })
|
|
404
|
+
}, null, 8, ["icon", "message", "title"])) : R("", !0)
|
|
405
405
|
]),
|
|
406
406
|
_: 1
|
|
407
407
|
})
|
|
408
408
|
], !0),
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
default:
|
|
412
|
-
|
|
409
|
+
F(i.$slots, "state-empty", { isEmpty: l.value }, () => [
|
|
410
|
+
W(L, { name: "fade" }, {
|
|
411
|
+
default: T(() => [
|
|
412
|
+
l.value && !n.value ? (C(), M(j, {
|
|
413
413
|
key: 0,
|
|
414
414
|
"data-testid": "monaco-editor-status-overlay-empty",
|
|
415
|
-
icon:
|
|
416
|
-
message:
|
|
417
|
-
title:
|
|
418
|
-
}, null, 8, ["icon", "message", "title"])) :
|
|
415
|
+
icon: p(ge),
|
|
416
|
+
message: p(e).t("editor.messages.empty_message"),
|
|
417
|
+
title: p(e).t("editor.messages.empty_title")
|
|
418
|
+
}, null, 8, ["icon", "message", "title"])) : R("", !0)
|
|
419
419
|
]),
|
|
420
420
|
_: 1
|
|
421
421
|
})
|
|
422
422
|
], !0)
|
|
423
423
|
], 2));
|
|
424
424
|
}
|
|
425
|
-
}),
|
|
425
|
+
}), Ve = /* @__PURE__ */ H(Ne, [["__scopeId", "data-v-9568e08d"]]);
|
|
426
426
|
export {
|
|
427
|
-
|
|
428
|
-
|
|
427
|
+
Ve as MonacoEditor,
|
|
428
|
+
xe as useMonacoEditor
|
|
429
429
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(d,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("@kong/icons"),require("monaco-editor"),require("@shikijs/monaco"),require("shiki"),require("@kong-ui-public/i18n")):typeof define=="function"&&define.amd?define(["exports","vue","@kong/icons","monaco-editor","@shikijs/monaco","shiki","@kong-ui-public/i18n"],n):(d=typeof globalThis<"u"?globalThis:d||self,n(d["kong-ui-public-monaco-editor"]={},d.Vue,d.KongIcons,d.monaco,d.monaco$1,d.shiki,d["kong-ui-public-i18n"]))})(this,function(d,n,T,V,K,C,w){"use strict";function $(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const a=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,a.get?a:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const m=$(V),A=Object.freeze({autoClosingQuotes:"always",automaticLayout:!0,bracketPairColorization:{enabled:!0},hideCursorInOverviewRuler:!0,fontFamily:"'JetBrains Mono', Consolas, monospace",fontSize:Number("12px".replace("px","")),fontWeight:"500",lineHeight:Number("20px".replace("px","")),formatOnPaste:!0,formatOnType:!0,lineNumbersMinChars:3,minimap:{enabled:!1},stickyScroll:{enabled:!0},suggest:{showWords:!1},quickSuggestions:!0,suggestOnTriggerCharacters:!0,wordBasedSuggestions:"off",overviewRulerLanes:0,renderWhitespace:"boundary",scrollBeyondLastLine:!1,roundedSelection:!1,wordWrapColumn:120,colorDecorators:!0,folding:!0,fixedOverflowWidgets:!0,tabSize:2,detectIndentation:!1,insertSpaces:!0,trimAutoWhitespace:!0,wordWrap:"bounded",find:{addExtraSpaceOnTop:!1}});typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const v=()=>{};function H(o,t){function e(...a){return new Promise((s,r)=>{Promise.resolve(o(()=>t.apply(this,a),{fn:t,thisArg:this,args:a})).then(s).catch(r)})}return e}function q(o,t={}){let e,a,s=v;const r=l=>{clearTimeout(l),s(),s=v};let c;return l=>{const S=n.toValue(o),p=n.toValue(t.maxWait);return e&&r(e),S<=0||p!==void 0&&p<=0?(a&&(r(a),a=void 0),Promise.resolve(l())):new Promise((k,y)=>{s=t.rejectOnCancel?y:k,c=l,p&&!a&&(a=setTimeout(()=>{e&&r(e),a=void 0,k(c())},p)),e=setTimeout(()=>{a&&r(a),a=void 0,k(l())},S)})}}function z(o,t=200,e={}){return H(q(t,e),o)}function D(o){var t;const e=n.toValue(o);return(t=e==null?void 0:e.$el)!==null&&t!==void 0?t:e}const M="[monaco-editor] [lifecycle]",h=new WeakMap,_=new Map,O=new WeakMap;function G(o){let t=h.get(o.source);if(!t){let e;switch(o.type){case"editor":e=o.source.onDidDispose(()=>W(o.source));break;case"model":e=o.source.onWillDispose(()=>W(o.source));break;default:throw new Error(`${M} Unknown scope: ${o}`)}t={disposables:new Set,scopeListener:e},h.set(o.source,t)}return t}function x(o){const t=h.get(o);t&&(t.scopeListener.dispose(),h.delete(o))}function F(o,t){G(t).disposables.add(o)}function N(o,t){const e=h.get(t.source);e&&(e.disposables.delete(o),e.disposables.size===0&&x(t.source))}function Y(o){const t=[];if(o.forEach(e=>{try{e.dispose()}catch(a){t.push(a)}}),t.length)throw new AggregateError(t,`${M} One or more disposables threw while being disposed.`)}function Z(o,t){var c,g;let e=o,a=_.get(e);if(!a){const l=O.get(o);l&&(e=l,a=_.get(l))}if(a)return((c=a.scope)==null?void 0:c.type)===(t==null?void 0:t.type)&&((g=a.scope)==null?void 0:g.source)===(t==null?void 0:t.source)||(a.scope&&N(a.decorated,a.scope),t?(F(a.decorated,t),a.scope=t):a.scope=void 0),a.decorated;const s=e.dispose,r={dispose:()=>{const l=_.get(e);if(l)return l.scope&&N(r,l.scope),_.delete(e),O.delete(r),s.call(e)}};return _.set(e,{decorated:r,scope:t}),O.set(r,e),t&&F(r,t),r}function L(o,t){return Z(t,{type:"editor",source:o})}function W(o){const t=h.get(o);if(!t)return;const e=Array.from(t.disposables);try{Y(e)}catch(a){console.warn(`${M} Encountered errors while disposing scoped disposables:`,a,", Source:",o)}x(o)}const B=n.ref(!1);let b=null;async function J(){return b||(b=(async()=>{var o,t;try{const e=((o=m.json)==null?void 0:o.jsonDefaults)||((t=m.languages.json)==null?void 0:t.jsonDefaults);e==null||e.setModeConfiguration({tokens:!1});const a=await C.getSingletonHighlighter({themes:Object.values(C.bundledThemes),langs:Object.values(C.bundledLanguages)});a.getLoadedLanguages().forEach(s=>{m.languages.register({id:s})}),K.shikiToMonaco(a,m),B.value=!0}catch(e){throw b=null,e}})(),b)}function U(o,t){const e=n.shallowRef();let a,s=!1,r=!1;const c=n.reactive({editorStatus:"loading",searchBoxIsRevealed:!1,hasContent:!1,theme:t.theme||"light"}),g=i=>{!s||!e.value||e.value.setValue(i)},l=i=>{var f;return(f=e.value)==null?void 0:f.updateOptions({readOnly:i})},S=()=>{var i;return(i=e.value)==null?void 0:i.focus()},p=i=>{try{if(!e.value||!i)return;e.value.focus(),e.value.trigger("keyboard",i,null)}catch(f){console.error(`useMonacoEditor: Failed to trigger command: ${i}`,f)}},k=()=>{var i;try{if(!e.value)return;if(c.searchBoxIsRevealed)return(i=e.value.getContribution("editor.contrib.findController"))==null?void 0:i.closeFindWidget();p("actions.find")}catch(f){console.error("useMonacoEditor: Failed to close findController.",f)}},y=z(()=>m.editor.remeasureFonts(),200);return(()=>{J(),n.watch([B,()=>n.toValue(o)],([i,f],[,oe])=>{var P;const I=D(f),ne=D(oe);if(!(I instanceof HTMLElement)||!i){s=!1;return}if(!(s&&ne===I)){if(!a){const u=m.Uri.parse(`inmemory://model/${t.language}-${crypto.randomUUID()}`);a=m.editor.createModel(t.code.value,t.language,u)}e.value=m.editor.create(I,{...A,readOnly:t.readOnly||!1,language:t.language,theme:c.theme==="light"?"catppuccin-latte":"catppuccin-mocha",model:a,editContext:!1,...t.monacoOptions}),s=!0,c.editorStatus="ready",c.hasContent=!!t.code.value,L(e.value,e.value.onDidChangeModelContent(()=>{if(r)return;const u=e.value.getValue();c.hasContent=!!u.length,t.code.value=u})),(P=t.onCreated)==null||P.call(t),y();try{const u=e.value.getContribution("editor.contrib.findController"),E=u==null?void 0:u.getState();L(e.value,E==null?void 0:E.onFindReplaceStateChange(()=>{c.searchBoxIsRevealed=E.isRevealed}))}catch(u){console.error("useMonacoEditor: Failed to get the state of findController",u)}n.onWatcherCleanup(()=>{var u;(u=e.value)==null||u.dispose()})}},{immediate:!0,flush:"post"})})(),n.watch(()=>t.code.value,i=>{if(!e.value||!a||!s)return;const f=a.getValue();i!==f&&(r=!0,e.value.executeEdits("external",[{range:a.getFullModelRange(),text:i}]),e.value.pushUndoStop(),c.hasContent=!!i.length,r=!1)}),n.onMounted(y),n.onActivated(y),n.onBeforeUnmount(()=>{if(!e.value)return;const i=e.value.getModel();e.value.dispose(),i&&i.dispose()}),{editor:e,editorStates:c,setContent:g,setReadOnly:l,focus:S,remeasureFonts:y,toggleSearchWidget:k,triggerKeyboardCommand:p}}const Q={editor:{messages:{empty_message:"The editor is currently empty. Start typing to add content.",empty_title:"No content available",loading_message:"Please wait while the {type} content is loaded.",loading_title:"{type} editor"}}};function X(){const o=w.createI18n("en-us",Q);return{i18n:o,i18nT:w.i18nTComponent(o)}}const ee=n.defineComponent({__name:"MonacoEditorStatusOverlay",props:{title:{},message:{},icon:{}},setup(o){return(t,e)=>{const a=n.resolveComponent("KEmptyState");return n.openBlock(),n.createBlock(a,{class:"monaco-editor-status-overlay",message:o.message,title:o.title},n.createSlots({_:2},[o.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(o.icon),{decorative:""}))]),key:"0"}:void 0]),1032,["message","title"])}}}),j=(o,t)=>{const e=o.__vccOpts||o;for(const[a,s]of t)e[a]=s;return e},R=j(ee,[["__scopeId","data-v-062eadb5"]]),te=j(n.defineComponent({__name:"MonacoEditor",props:n.mergeModels({theme:{default:"light"},language:{default:"markdown"},loading:{type:Boolean,default:!1},options:{default:()=>{}}},{modelValue:{type:String,required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const t=n.useModel(o,"modelValue"),{i18n:e}=X(),a=n.useTemplateRef("editorRef"),s=n.computed(()=>o.theme==="dark"?"dark":"light"),r=n.computed(()=>g.editorStates.editorStatus==="loading"||o.loading),c=n.computed(()=>g.editorStates.editorStatus==="ready"&&!g.editorStates.hasContent),g=U(a,{language:o.language,code:t,theme:s.value,monacoOptions:o.options});return(l,S)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["monaco-editor-container",[s.value,{loading:r.value}]]),"data-testid":"monaco-editor-container"},[n.createElementVNode("div",{ref_key:"editorRef",ref:a,class:"monaco-editor-target","data-testid":"monaco-editor-target"},null,512),n.renderSlot(l.$slots,"state-loading",{isLoading:r.value},()=>[n.createVNode(n.Transition,{name:"fade"},{default:n.withCtx(()=>[r.value?(n.openBlock(),n.createBlock(R,{key:0,"data-testid":"monaco-editor-status-overlay-loading",icon:n.unref(T.ProgressIcon),message:n.unref(e).t("editor.messages.loading_message",{type:o.language}),title:n.unref(e).t("editor.messages.loading_title",{type:o.language})},null,8,["icon","message","title"])):n.createCommentVNode("",!0)]),_:1})],!0),n.renderSlot(l.$slots,"state-empty",{isEmpty:c.value},()=>[n.createVNode(n.Transition,{name:"fade"},{default:n.withCtx(()=>[c.value&&!r.value?(n.openBlock(),n.createBlock(R,{key:0,"data-testid":"monaco-editor-status-overlay-empty",icon:n.unref(T.CodeblockIcon),message:n.unref(e).t("editor.messages.empty_message"),title:n.unref(e).t("editor.messages.empty_title")},null,8,["icon","message","title"])):n.createCommentVNode("",!0)]),_:1})],!0)],2))}}),[["__scopeId","data-v-9568e08d"]]);d.MonacoEditor=te,d.useMonacoEditor=U,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
package/dist/runtime/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.monaco-editor-status-overlay[data-v-062eadb5]{background:transparent;left:50%;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%)}.monaco-editor-status-overlay[data-v-062eadb5] .empty-state-content{align-items:center;display:flex;flex-direction:column}.monaco-editor-status-overlay[data-v-062eadb5] .empty-state-content .empty-state-icon,.monaco-editor-status-overlay[data-v-062eadb5] .empty-state-content .empty-state-title,.monaco-editor-status-overlay[data-v-062eadb5] .empty-state-content .empty-state-message{color:#afb7c5;color:var(--kui-color-text-neutral-weak, #afb7c5)}.monaco-editor-status-overlay[data-v-062eadb5] .empty-state-content .empty-state-title{text-transform:capitalize}.monaco-editor-container[data-v-
|
|
1
|
+
.monaco-editor-status-overlay[data-v-062eadb5]{background:transparent;left:50%;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%)}.monaco-editor-status-overlay[data-v-062eadb5] .empty-state-content{align-items:center;display:flex;flex-direction:column}.monaco-editor-status-overlay[data-v-062eadb5] .empty-state-content .empty-state-icon,.monaco-editor-status-overlay[data-v-062eadb5] .empty-state-content .empty-state-title,.monaco-editor-status-overlay[data-v-062eadb5] .empty-state-content .empty-state-message{color:#afb7c5;color:var(--kui-color-text-neutral-weak, #afb7c5)}.monaco-editor-status-overlay[data-v-062eadb5] .empty-state-content .empty-state-title{text-transform:capitalize}.monaco-editor-container[data-v-9568e08d]{background:#fff;background:var(--kui-color-background, #ffffff);display:flex;flex-direction:column;height:100%;overflow:hidden;position:relative;width:100%}.monaco-editor-container.loading[data-v-9568e08d]{pointer-events:none;-webkit-user-select:none;user-select:none}.monaco-editor-container.loading .monaco-editor-target[data-v-9568e08d]{filter:blur(2px);opacity:0;pointer-events:none;-webkit-user-select:none;user-select:none}.monaco-editor-target[data-v-9568e08d]{height:100%;overflow:hidden;position:relative;transition:all .2s ease-in-out;transition:all var(--kui-animation-duration-20, .2s) ease-in-out;width:100%}.monaco-editor-target[data-v-9568e08d] .monaco-editor{position:absolute;--vscode-editor-background: var(--kui-color-background, #ffffff);--vscode-editorGutter-background: var(--kui-color-background, #ffffff);--vscode-editorLineNumber-activeForeground: var(--kui-color-text-primary, #0044f4);--vscode-editorSuggestWidget-background: var(--kui-color-background, #ffffff);--vscode-editorSuggestWidget-border: var(--kui-color-border, #e0e4ea);--vscode-editorSuggestWidget-highlightForeground: var(--kui-color-text-decorative-purple, #6f28ff);--vscode-editorSuggestWidget-focusHighlightForeground: var(--kui-color-text-decorative-purple, #6f28ff);--vscode-menu-background: var(--kui-color-background, #ffffff);--vscode-menu-border: var(--kui-color-border, #e0e4ea);--vscode-menu-separatorBackground: var(--kui-color-border, #e0e4ea);--vscode-focusBorder: var(--kui-color-text-neutral, #6c7489);--vscode-input-background: var(--kui-color-background, #ffffff);--vscode-sash-hoverBorder: var(--kui-color-border-primary, #0044f4)}.monaco-editor-target[data-v-9568e08d] .monaco-editor .sticky-widget{z-index:2}.monaco-editor-target[data-v-9568e08d] .monaco-editor .suggest-details-container{border-radius:10px!important;border-radius:var(--kui-border-radius-50, 10px)!important}.monaco-editor-target[data-v-9568e08d] .monaco-editor .suggest-details-container .suggest-details{border-radius:10px!important;border-radius:var(--kui-border-radius-50, 10px)!important;overflow-x:hidden;overflow-y:auto}.monaco-editor-target[data-v-9568e08d] .monaco-editor .suggest-details-container .suggest-details .type{overflow-wrap:break-word!important}.monaco-editor-target[data-v-9568e08d] .monaco-editor .suggest-widget{border-radius:10px!important;border-radius:var(--kui-border-radius-50, 10px)!important;min-height:30px!important}.monaco-editor-target[data-v-9568e08d] .monaco-editor .suggest-widget.shows-details{border-radius:10px!important;border-radius:var(--kui-border-radius-50, 10px)!important;min-height:30px!important;overflow-x:hidden;overflow-y:auto;scrollbar-width:thin}.monaco-editor-target[data-v-9568e08d] .monaco-editor .suggest-widget .tree,.monaco-editor-target[data-v-9568e08d] .monaco-editor .suggest-widget .monaco-scrollable-element,.monaco-editor-target[data-v-9568e08d] .monaco-editor .suggest-widget .monaco-list,.monaco-editor-target[data-v-9568e08d] .monaco-editor .suggest-widget .monaco-list-rows{border-radius:8px!important;border-radius:var(--kui-border-radius-40, 8px)!important}.monaco-editor-target[data-v-9568e08d] .monaco-editor .suggest-widget .monaco-list-rows{overflow-x:hidden;overflow-y:auto}.monaco-editor-target[data-v-9568e08d] .monaco-editor .suggest-widget .monaco-list-row{padding:0 6px;padding:var(--kui-space-0, 0px) var(--kui-space-30, 6px)}.monaco-editor-target[data-v-9568e08d] .monaco-editor .suggest-widget .monaco-list-row.focused{background:#e0e4ea;background:var(--kui-color-background-neutral-weaker, #e0e4ea)}.monaco-editor-target[data-v-9568e08d] .monaco-editor .suggest-widget .monaco-list-row.focused .monaco-icon-label,.monaco-editor-target[data-v-9568e08d] .monaco-editor .suggest-widget .monaco-list-row.focused .suggest-icon{color:#232633!important;color:var(--kui-color-text-neutral-strongest, #232633)!important}.monaco-editor-target[data-v-9568e08d] .monaco-editor .suggest-widget .monaco-list-row.focused .details-label{color:#232633;color:var(--kui-color-text-neutral-strongest, #232633)}.monaco-editor-target[data-v-9568e08d] .monaco-editor .suggest-widget .monaco-list-row .highlight{font-weight:600;font-weight:var(--kui-font-weight-semibold, 600)}.monaco-editor-target[data-v-9568e08d] .monaco-editor .suggest-widget .monaco-list-row:first-child.focused{border-top-left-radius:6px;border-top-left-radius:var(--kui-border-radius-30, 6px)}.monaco-editor-target[data-v-9568e08d] .monaco-editor .suggest-widget .monaco-list-row .suggest-icon:not(.codicon-symbol-property){color:#0044f4;color:var(--kui-color-text-primary, #0044f4)}.monaco-editor-target[data-v-9568e08d] .monaco-editor .suggest-widget .monaco-list-row .monaco-icon-label{color:#6c7489!important;color:var(--kui-color-text-neutral, #6c7489)!important}.monaco-editor-target[data-v-9568e08d] .monaco-editor .codicon-suggest-more-info{transform:translateY(2px)!important}.monaco-editor-target[data-v-9568e08d] .monaco-editor .find-widget{background:#fff;background:var(--kui-color-background, #ffffff);border-bottom:1px solid #e0e4ea;border-bottom:var(--kui-border-width-10, 1px) solid var(--kui-color-border-neutral-weaker, #e0e4ea);border-radius:0;border-radius:var(--kui-border-radius-0, 0px);right:0!important}.monaco-editor-target[data-v-9568e08d] .monaco-editor .find-widget .monaco-sash{background-color:#e0e4ea;background-color:var(--kui-color-background-neutral-weaker, #e0e4ea);width:1px!important}.monaco-editor-target[data-v-9568e08d] .monaco-editor .find-widget .monaco-inputbox{background-color:#fff!important;background-color:var(--kui-color-background, #ffffff)!important;border:1px solid #e0e4ea!important;border:var(--kui-border-width-10, 1px) solid var(--kui-color-border-neutral-weaker, #e0e4ea)!important;border-radius:6px;border-radius:var(--kui-border-radius-30, 6px);padding:0 2px;padding:var(--kui-space-0, 0px) var(--kui-space-10, 2px)}.fade-enter-active[data-v-9568e08d],.fade-leave-active[data-v-9568e08d]{transition:opacity .2s ease;transition:opacity var(--kui-animation-duration-20, .2s) ease}.fade-enter-from[data-v-9568e08d],.fade-leave-to[data-v-9568e08d]{opacity:0}.fade-enter-to[data-v-9568e08d],.fade-leave-from[data-v-9568e08d]{opacity:1}
|
|
@@ -11,6 +11,11 @@ type __VLS_Props = {
|
|
|
11
11
|
* @default 'markdown'
|
|
12
12
|
*/
|
|
13
13
|
language?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the editor is in a loading state.
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
loading?: boolean;
|
|
14
19
|
/**
|
|
15
20
|
* Additional Monaco Editor options to customize the editor further.
|
|
16
21
|
* @default undefined
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonacoEditor.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/MonacoEditor.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MonacoEditor.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/MonacoEditor.vue"],"names":[],"mappings":"AAwTA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAE5C,KAAK,WAAW,GAAG;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;MAGE;IACF,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,oCAAoC,CAAC,GAAG,SAAS,CAAA;CAC3E,CAAC;AASF;;GAEG;AACH,QAAA,MAAM,KAAK,wDAGT,CAAA;AAwBF,KAAK,gBAAgB,GAAG;IACxB;;OAEG;IACH,UAAU,EAAE,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC;CACjC,CAAC;AAKF,KAAK,iBAAiB,GAAG,WAAW,GAAG,gBAAgB,CAAC;AA+IxD,QAAA,IAAI,OAAO;;CAAU,EAAE,QAAQ;;CAAY,CAAE;AAC7C,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GACpD;IAAE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAOtD,QAAA,MAAM,UAAU;;;;kFAGd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMonacoEditor.d.ts","sourceRoot":"","sources":["../../../../src/composables/useMonacoEditor.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAKvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AACzE,OAAO,KAAK,EAAsB,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAyC1E;;;;;EAKE;AACF,wBAAgB,eAAe,CAAC,CAAC,SAAS,YAAY,EACpD,MAAM,EAAE,uBAAuB,CAAC,CAAC,CAAC,EAClC,OAAO,EAAE,sBAAsB;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useMonacoEditor.d.ts","sourceRoot":"","sources":["../../../../src/composables/useMonacoEditor.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAKvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AACzE,OAAO,KAAK,EAAsB,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAyC1E;;;;;EAKE;AACF,wBAAgB,eAAe,CAAC,CAAC,SAAS,YAAY,EACpD,MAAM,EAAE,uBAAuB,CAAC,CAAC,CAAC,EAClC,OAAO,EAAE,sBAAsB;;;;;;;;0BA2BF,MAAM,KAAG,IAAI;4BAOX,OAAO,KAAG,IAAI;iBAG3B,IAAI;;8BAkBS,IAAI;iCAXC,MAAM,KAAG,IAAI;EA4KlD"}
|
|
@@ -5,7 +5,7 @@ import type { Ref } from 'vue';
|
|
|
5
5
|
*/
|
|
6
6
|
export interface UseMonacoEditorOptions {
|
|
7
7
|
/**
|
|
8
|
-
* The
|
|
8
|
+
* The content of the editor
|
|
9
9
|
*/
|
|
10
10
|
code: Ref<string>;
|
|
11
11
|
/**
|
|
@@ -20,10 +20,6 @@ export interface UseMonacoEditorOptions {
|
|
|
20
20
|
* The theme of the editor
|
|
21
21
|
*/
|
|
22
22
|
theme?: EditorThemes;
|
|
23
|
-
/**
|
|
24
|
-
* Callback function triggered when the content changes
|
|
25
|
-
*/
|
|
26
|
-
onChanged?: (content: string) => void;
|
|
27
23
|
/**
|
|
28
24
|
* Callback function triggered when the editor is created
|
|
29
25
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAE9B;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;MAEE;IACF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAE9B;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;MAEE;IACF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,GAAG,CAAA;IACb;;;MAGE;IACF,aAAa,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,oCAAoC,CAAC,CAAA;CACrE;AAED,iDAAiD;AACjD,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,CAAA;AAE3C,sCAAsC;AACtC,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,CAAA;AAG9C,MAAM,WAAW,kBAAkB;IACjC;;;;QAII;IACJ,YAAY,EAAE,YAAY,CAAA;IAE1B;;;QAGI;IACJ,mBAAmB,EAAE,OAAO,CAAA;IAE5B;;;QAGI;IACJ,UAAU,EAAE,OAAO,CAAA;IAEnB;;;;QAII;IACJ,KAAK,EAAE,YAAY,CAAA;CACpB"}
|