@kong-ui-public/monaco-editor 0.7.5 → 0.8.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.
- package/README.md +34 -0
- package/dist/runtime/monaco-editor.es.js +141 -136
- 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 +21 -1
- package/dist/types/src/components/MonacoEditor.vue.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +2 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -113,6 +113,40 @@ Whether the editor is in a loading state. When true, displays a loading overlay.
|
|
|
113
113
|
|
|
114
114
|
Additional Monaco Editor options to customize the editor further. See [Monaco Editor API](https://microsoft.github.io/monaco-editor/typedoc/interfaces/editor.IStandaloneEditorConstructionOptions.html) for available options.
|
|
115
115
|
|
|
116
|
+
### Events
|
|
117
|
+
|
|
118
|
+
#### `ready`
|
|
119
|
+
|
|
120
|
+
Emitted when the Monaco editor instance is initialized and ready for use.
|
|
121
|
+
|
|
122
|
+
**Payload:**
|
|
123
|
+
|
|
124
|
+
- `editor`: The Monaco `IStandaloneCodeEditor` instance.
|
|
125
|
+
|
|
126
|
+
##### Example
|
|
127
|
+
|
|
128
|
+
```vue
|
|
129
|
+
<template>
|
|
130
|
+
<MonacoEditor
|
|
131
|
+
v-model="code"
|
|
132
|
+
language="javascript"
|
|
133
|
+
@ready="onEditorReady"
|
|
134
|
+
/>
|
|
135
|
+
</template>
|
|
136
|
+
|
|
137
|
+
<script setup lang="ts">
|
|
138
|
+
import { ref } from 'vue'
|
|
139
|
+
import type { editor } from 'monaco-editor'
|
|
140
|
+
|
|
141
|
+
const code = ref('// your code here')
|
|
142
|
+
|
|
143
|
+
function onEditorReady(editorInstance: editor.IStandaloneCodeEditor) {
|
|
144
|
+
// You can now use the Monaco editor instance
|
|
145
|
+
editorInstance.focus()
|
|
146
|
+
}
|
|
147
|
+
</script>
|
|
148
|
+
```
|
|
149
|
+
|
|
116
150
|
### v-model
|
|
117
151
|
|
|
118
152
|
The component requires a `v-model` binding to manage the editor content:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { toValue as
|
|
1
|
+
import { toValue as w, ref as X, shallowRef as Y, reactive as Z, watch as x, onMounted as ee, onActivated as te, onBeforeUnmount as oe, onWatcherCleanup as ae, defineComponent as H, resolveComponent as ne, createBlock as O, openBlock as C, createSlots as re, withCtx as D, resolveDynamicComponent as se, mergeModels as R, useModel as ie, useTemplateRef as le, computed as T, createElementBlock as ce, normalizeClass as de, createElementVNode as ue, renderSlot as W, createVNode as N, Transition as U, createCommentVNode as B, unref as v } from "vue";
|
|
2
2
|
import { ProgressIcon as ge, CodeblockIcon as me } from "@kong/icons";
|
|
3
|
-
import * as
|
|
3
|
+
import * as m from "monaco-editor";
|
|
4
4
|
import { shikiToMonaco as fe } from "@shikijs/monaco";
|
|
5
5
|
import { getSingletonHighlighter as pe, bundledLanguages as he, bundledThemes as ve } from "shiki";
|
|
6
6
|
import { createI18n as ye, i18nTComponent as Se } from "@kong-ui-public/i18n";
|
|
@@ -59,7 +59,7 @@ 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 P = () => {
|
|
63
63
|
};
|
|
64
64
|
function we(o, t) {
|
|
65
65
|
function e(...a) {
|
|
@@ -74,19 +74,19 @@ function we(o, t) {
|
|
|
74
74
|
return e;
|
|
75
75
|
}
|
|
76
76
|
function Oe(o, t = {}) {
|
|
77
|
-
let e, a, i =
|
|
77
|
+
let e, a, i = P;
|
|
78
78
|
const r = (s) => {
|
|
79
|
-
clearTimeout(s), i(), i =
|
|
79
|
+
clearTimeout(s), i(), i = P;
|
|
80
80
|
};
|
|
81
81
|
let l;
|
|
82
82
|
return (s) => {
|
|
83
|
-
const
|
|
84
|
-
return e && r(e),
|
|
85
|
-
i = t.rejectOnCancel ?
|
|
86
|
-
e && r(e), a = void 0,
|
|
87
|
-
},
|
|
88
|
-
a && r(a), a = void 0,
|
|
89
|
-
},
|
|
83
|
+
const p = w(o), g = w(t.maxWait);
|
|
84
|
+
return e && r(e), p <= 0 || g !== void 0 && g <= 0 ? (a && (r(a), a = void 0), Promise.resolve(s())) : new Promise((c, h) => {
|
|
85
|
+
i = t.rejectOnCancel ? h : c, l = s, g && !a && (a = setTimeout(() => {
|
|
86
|
+
e && r(e), a = void 0, c(l());
|
|
87
|
+
}, g)), e = setTimeout(() => {
|
|
88
|
+
a && r(a), a = void 0, c(s());
|
|
89
|
+
}, p);
|
|
90
90
|
});
|
|
91
91
|
};
|
|
92
92
|
}
|
|
@@ -94,22 +94,22 @@ function Oe(o, t = {}) {
|
|
|
94
94
|
function ke(o, t = 200, e = {}) {
|
|
95
95
|
return we(Oe(t, e), o);
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function $(o) {
|
|
98
98
|
var t;
|
|
99
|
-
const e =
|
|
99
|
+
const e = w(o);
|
|
100
100
|
return (t = e == null ? void 0 : e.$el) !== null && t !== void 0 ? t : e;
|
|
101
101
|
}
|
|
102
|
-
const F = "[monaco-editor] [lifecycle]",
|
|
102
|
+
const F = "[monaco-editor] [lifecycle]", y = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new WeakMap();
|
|
103
103
|
function Te(o) {
|
|
104
|
-
let t =
|
|
104
|
+
let t = y.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(() => K(o.source));
|
|
110
110
|
break;
|
|
111
111
|
case "model":
|
|
112
|
-
e = o.source.onWillDispose(() =>
|
|
112
|
+
e = o.source.onWillDispose(() => K(o.source));
|
|
113
113
|
break;
|
|
114
114
|
default:
|
|
115
115
|
throw new Error(`${F} Unknown scope: ${o}`);
|
|
@@ -117,20 +117,20 @@ function Te(o) {
|
|
|
117
117
|
t = {
|
|
118
118
|
disposables: /* @__PURE__ */ new Set(),
|
|
119
119
|
scopeListener: e
|
|
120
|
-
},
|
|
120
|
+
}, y.set(o.source, t);
|
|
121
121
|
}
|
|
122
122
|
return t;
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
const t =
|
|
126
|
-
t && (t.scopeListener.dispose(),
|
|
124
|
+
function G(o) {
|
|
125
|
+
const t = y.get(o);
|
|
126
|
+
t && (t.scopeListener.dispose(), y.delete(o));
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function A(o, t) {
|
|
129
129
|
Te(t).disposables.add(o);
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
const e =
|
|
133
|
-
e && (e.disposables.delete(o), e.disposables.size === 0 &&
|
|
131
|
+
function j(o, t) {
|
|
132
|
+
const e = y.get(t.source);
|
|
133
|
+
e && (e.disposables.delete(o), e.disposables.size === 0 && G(t.source));
|
|
134
134
|
}
|
|
135
135
|
function Ie(o) {
|
|
136
136
|
const t = [];
|
|
@@ -146,29 +146,29 @@ function Ie(o) {
|
|
|
146
146
|
`${F} One or more disposables threw while being disposed.`
|
|
147
147
|
);
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
var l,
|
|
151
|
-
let e = o, a =
|
|
149
|
+
function xe(o, t) {
|
|
150
|
+
var l, f;
|
|
151
|
+
let e = o, a = S.get(e);
|
|
152
152
|
if (!a) {
|
|
153
153
|
const s = I.get(o);
|
|
154
|
-
s && (e = s, a =
|
|
154
|
+
s && (e = s, a = S.get(s));
|
|
155
155
|
}
|
|
156
156
|
if (a)
|
|
157
|
-
return ((l = a.scope) == null ? void 0 : l.type) === (t == null ? void 0 : t.type) && ((
|
|
157
|
+
return ((l = a.scope) == null ? void 0 : l.type) === (t == null ? void 0 : t.type) && ((f = a.scope) == null ? void 0 : f.source) === (t == null ? void 0 : t.source) || (a.scope && j(a.decorated, a.scope), t ? (A(a.decorated, t), a.scope = t) : a.scope = void 0), a.decorated;
|
|
158
158
|
const i = e.dispose, r = {
|
|
159
159
|
dispose: () => {
|
|
160
|
-
const s =
|
|
160
|
+
const s = S.get(e);
|
|
161
161
|
if (s)
|
|
162
|
-
return s.scope &&
|
|
162
|
+
return s.scope && j(r, s.scope), S.delete(e), I.delete(r), i.call(e);
|
|
163
163
|
}
|
|
164
164
|
};
|
|
165
|
-
return
|
|
165
|
+
return S.set(e, { decorated: r, scope: t }), I.set(r, e), t && A(r, t), r;
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
return
|
|
167
|
+
function V(o, t) {
|
|
168
|
+
return xe(t, { type: "editor", source: o });
|
|
169
169
|
}
|
|
170
|
-
function
|
|
171
|
-
const t =
|
|
170
|
+
function K(o) {
|
|
171
|
+
const t = y.get(o);
|
|
172
172
|
if (!t) return;
|
|
173
173
|
const e = Array.from(t.disposables);
|
|
174
174
|
try {
|
|
@@ -176,15 +176,15 @@ function V(o) {
|
|
|
176
176
|
} catch (a) {
|
|
177
177
|
console.warn(`${F} Encountered errors while disposing scoped disposables:`, a, ", Source:", o);
|
|
178
178
|
}
|
|
179
|
-
|
|
179
|
+
G(o);
|
|
180
180
|
}
|
|
181
|
-
const
|
|
182
|
-
let
|
|
183
|
-
async function
|
|
184
|
-
return
|
|
181
|
+
const q = X(!1);
|
|
182
|
+
let b = null;
|
|
183
|
+
async function De() {
|
|
184
|
+
return b || (b = (async () => {
|
|
185
185
|
var o, t;
|
|
186
186
|
try {
|
|
187
|
-
const e = ((o =
|
|
187
|
+
const e = ((o = m.json) == null ? void 0 : o.jsonDefaults) || ((t = m.languages.json) == null ? void 0 : t.jsonDefaults);
|
|
188
188
|
e == null || e.setModeConfiguration({ tokens: !1 });
|
|
189
189
|
const a = await pe(
|
|
190
190
|
{
|
|
@@ -193,65 +193,65 @@ async function xe() {
|
|
|
193
193
|
}
|
|
194
194
|
);
|
|
195
195
|
a.getLoadedLanguages().forEach((i) => {
|
|
196
|
-
|
|
197
|
-
}), fe(a,
|
|
196
|
+
m.languages.register({ id: i });
|
|
197
|
+
}), fe(a, m), q.value = !0;
|
|
198
198
|
} catch (e) {
|
|
199
|
-
throw
|
|
199
|
+
throw b = null, e;
|
|
200
200
|
}
|
|
201
|
-
})(),
|
|
201
|
+
})(), b);
|
|
202
202
|
}
|
|
203
203
|
function Fe(o, t) {
|
|
204
|
-
const e =
|
|
204
|
+
const e = Y();
|
|
205
205
|
let a, i = !1, r = !1;
|
|
206
|
-
const l =
|
|
206
|
+
const l = Z({
|
|
207
207
|
editorStatus: "loading",
|
|
208
208
|
searchBoxIsRevealed: !1,
|
|
209
209
|
hasContent: !1,
|
|
210
210
|
theme: t.theme || "light"
|
|
211
|
-
}),
|
|
211
|
+
}), f = (n) => {
|
|
212
212
|
!i || !e.value || e.value.setValue(n);
|
|
213
213
|
}, s = (n) => {
|
|
214
|
-
var
|
|
215
|
-
return (
|
|
216
|
-
},
|
|
214
|
+
var d;
|
|
215
|
+
return (d = e.value) == null ? void 0 : d.updateOptions({ readOnly: n });
|
|
216
|
+
}, p = () => {
|
|
217
217
|
var n;
|
|
218
218
|
return (n = e.value) == null ? void 0 : n.focus();
|
|
219
|
-
},
|
|
220
|
-
var
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
},
|
|
219
|
+
}, g = (n) => {
|
|
220
|
+
var M;
|
|
221
|
+
const d = (M = e.value) == null ? void 0 : M.getModel();
|
|
222
|
+
d && m.editor.setModelLanguage(d, n);
|
|
223
|
+
}, c = (n) => {
|
|
224
224
|
try {
|
|
225
225
|
if (!e.value || !n) return;
|
|
226
226
|
e.value.focus(), e.value.trigger("keyboard", n, null);
|
|
227
|
-
} catch (
|
|
228
|
-
console.error(`useMonacoEditor: Failed to trigger command: ${n}`,
|
|
227
|
+
} catch (d) {
|
|
228
|
+
console.error(`useMonacoEditor: Failed to trigger command: ${n}`, d);
|
|
229
229
|
}
|
|
230
|
-
},
|
|
230
|
+
}, h = () => {
|
|
231
231
|
var n;
|
|
232
232
|
try {
|
|
233
233
|
if (!e.value) return;
|
|
234
234
|
if (l.searchBoxIsRevealed)
|
|
235
235
|
return (n = e.value.getContribution("editor.contrib.findController")) == null ? void 0 : n.closeFindWidget();
|
|
236
|
-
|
|
237
|
-
} catch (
|
|
238
|
-
console.error("useMonacoEditor: Failed to close findController.",
|
|
236
|
+
c("actions.find");
|
|
237
|
+
} catch (d) {
|
|
238
|
+
console.error("useMonacoEditor: Failed to close findController.", d);
|
|
239
239
|
}
|
|
240
|
-
},
|
|
240
|
+
}, E = /* @__PURE__ */ ke(() => m.editor.remeasureFonts(), 200);
|
|
241
241
|
return (() => {
|
|
242
|
-
|
|
242
|
+
De(), x([q, () => w(o)], ([n, d], [, M]) => {
|
|
243
243
|
var L;
|
|
244
|
-
const k =
|
|
244
|
+
const k = $(d), Q = $(M);
|
|
245
245
|
if (!(k instanceof HTMLElement) || !n) {
|
|
246
246
|
i = !1;
|
|
247
247
|
return;
|
|
248
248
|
}
|
|
249
|
-
if (!(i &&
|
|
249
|
+
if (!(i && Q === k)) {
|
|
250
250
|
if (!a) {
|
|
251
|
-
const
|
|
252
|
-
a =
|
|
251
|
+
const u = m.Uri.parse(`inmemory://model/${t.language}-${crypto.randomUUID()}`);
|
|
252
|
+
a = m.editor.createModel(t.code.value, t.language, u);
|
|
253
253
|
}
|
|
254
|
-
e.value =
|
|
254
|
+
e.value = m.editor.create(k, {
|
|
255
255
|
..._e,
|
|
256
256
|
readOnly: t.readOnly || !1,
|
|
257
257
|
language: t.language,
|
|
@@ -259,58 +259,58 @@ function Fe(o, t) {
|
|
|
259
259
|
model: a,
|
|
260
260
|
editContext: !1,
|
|
261
261
|
...t.monacoOptions
|
|
262
|
-
}), i = !0, l.editorStatus = "ready", l.hasContent = !!t.code.value,
|
|
262
|
+
}), i = !0, l.editorStatus = "ready", l.hasContent = !!t.code.value, V(
|
|
263
263
|
e.value,
|
|
264
264
|
e.value.onDidChangeModelContent(() => {
|
|
265
265
|
if (r) return;
|
|
266
|
-
const
|
|
267
|
-
l.hasContent = !!
|
|
266
|
+
const u = e.value.getValue();
|
|
267
|
+
l.hasContent = !!u.length, t.code.value = u;
|
|
268
268
|
})
|
|
269
|
-
), (L = t.
|
|
269
|
+
), (L = t.onReady) == null || L.call(t, e.value), E();
|
|
270
270
|
try {
|
|
271
|
-
const
|
|
272
|
-
|
|
271
|
+
const u = e.value.getContribution("editor.contrib.findController"), _ = u == null ? void 0 : u.getState();
|
|
272
|
+
V(
|
|
273
273
|
e.value,
|
|
274
|
-
|
|
275
|
-
l.searchBoxIsRevealed =
|
|
274
|
+
_ == null ? void 0 : _.onFindReplaceStateChange(() => {
|
|
275
|
+
l.searchBoxIsRevealed = _.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 (u) {
|
|
280
|
+
console.error("useMonacoEditor: Failed to get the state of findController", u);
|
|
281
281
|
}
|
|
282
|
-
|
|
283
|
-
var
|
|
284
|
-
(
|
|
282
|
+
ae(() => {
|
|
283
|
+
var u;
|
|
284
|
+
(u = e.value) == null || u.dispose();
|
|
285
285
|
});
|
|
286
286
|
}
|
|
287
287
|
}, {
|
|
288
288
|
immediate: !0,
|
|
289
289
|
flush: "post"
|
|
290
290
|
});
|
|
291
|
-
})(),
|
|
291
|
+
})(), x(t.code, (n) => {
|
|
292
292
|
if (!e.value || !a || !i) return;
|
|
293
|
-
const
|
|
294
|
-
n !==
|
|
293
|
+
const d = a.getValue();
|
|
294
|
+
n !== d && (r = !0, e.value.executeEdits("external", [
|
|
295
295
|
{
|
|
296
296
|
range: a.getFullModelRange(),
|
|
297
297
|
text: n
|
|
298
298
|
}
|
|
299
299
|
]), e.value.pushUndoStop(), l.hasContent = !!n.length, r = !1);
|
|
300
|
-
}),
|
|
300
|
+
}), ee(E), te(E), oe(() => {
|
|
301
301
|
if (!e.value) return;
|
|
302
302
|
const n = e.value.getModel();
|
|
303
303
|
e.value.dispose(), n && n.dispose();
|
|
304
304
|
}), {
|
|
305
305
|
editor: e,
|
|
306
306
|
editorStates: l,
|
|
307
|
-
setContent:
|
|
307
|
+
setContent: f,
|
|
308
308
|
setReadOnly: s,
|
|
309
|
-
focus:
|
|
310
|
-
setLanguage:
|
|
311
|
-
remeasureFonts:
|
|
312
|
-
toggleSearchWidget:
|
|
313
|
-
triggerKeyboardCommand:
|
|
309
|
+
focus: p,
|
|
310
|
+
setLanguage: g,
|
|
311
|
+
remeasureFonts: E,
|
|
312
|
+
toggleSearchWidget: h,
|
|
313
|
+
triggerKeyboardCommand: c
|
|
314
314
|
};
|
|
315
315
|
}
|
|
316
316
|
const Le = {
|
|
@@ -320,18 +320,18 @@ const Le = {
|
|
|
320
320
|
loading_message: "Please wait while the {type} content is loaded.",
|
|
321
321
|
loading_title: "{type} editor"
|
|
322
322
|
}
|
|
323
|
-
},
|
|
323
|
+
}, Re = {
|
|
324
324
|
editor: Le
|
|
325
325
|
};
|
|
326
|
-
function
|
|
327
|
-
const o = ye("en-us",
|
|
326
|
+
function We() {
|
|
327
|
+
const o = ye("en-us", Re);
|
|
328
328
|
return {
|
|
329
329
|
i18n: o,
|
|
330
330
|
i18nT: Se(o)
|
|
331
331
|
// Translation component <i18n-t>
|
|
332
332
|
};
|
|
333
333
|
}
|
|
334
|
-
const Ne = /* @__PURE__ */
|
|
334
|
+
const Ne = /* @__PURE__ */ H({
|
|
335
335
|
__name: "MonacoEditorStatusOverlay",
|
|
336
336
|
props: {
|
|
337
337
|
title: {},
|
|
@@ -340,30 +340,30 @@ const Ne = /* @__PURE__ */ z({
|
|
|
340
340
|
},
|
|
341
341
|
setup(o) {
|
|
342
342
|
return (t, e) => {
|
|
343
|
-
const a =
|
|
344
|
-
return
|
|
343
|
+
const a = ne("KEmptyState");
|
|
344
|
+
return C(), O(a, {
|
|
345
345
|
class: "monaco-editor-status-overlay",
|
|
346
346
|
message: o.message,
|
|
347
347
|
title: o.title
|
|
348
|
-
},
|
|
348
|
+
}, re({ _: 2 }, [
|
|
349
349
|
o.icon ? {
|
|
350
350
|
name: "icon",
|
|
351
|
-
fn:
|
|
352
|
-
(
|
|
351
|
+
fn: D(() => [
|
|
352
|
+
(C(), O(se(o.icon), { decorative: "" }))
|
|
353
353
|
]),
|
|
354
354
|
key: "0"
|
|
355
355
|
} : void 0
|
|
356
356
|
]), 1032, ["message", "title"]);
|
|
357
357
|
};
|
|
358
358
|
}
|
|
359
|
-
}),
|
|
359
|
+
}), J = (o, t) => {
|
|
360
360
|
const e = o.__vccOpts || o;
|
|
361
361
|
for (const [a, i] of t)
|
|
362
362
|
e[a] = i;
|
|
363
363
|
return e;
|
|
364
|
-
},
|
|
364
|
+
}, z = /* @__PURE__ */ J(Ne, [["__scopeId", "data-v-062eadb5"]]), Ue = /* @__PURE__ */ H({
|
|
365
365
|
__name: "MonacoEditor",
|
|
366
|
-
props: /* @__PURE__ */
|
|
366
|
+
props: /* @__PURE__ */ R({
|
|
367
367
|
theme: { default: "light" },
|
|
368
368
|
language: { default: "markdown" },
|
|
369
369
|
loading: { type: Boolean, default: !1 },
|
|
@@ -376,60 +376,65 @@ const Ne = /* @__PURE__ */ z({
|
|
|
376
376
|
},
|
|
377
377
|
modelModifiers: {}
|
|
378
378
|
}),
|
|
379
|
-
emits: ["update:modelValue"],
|
|
380
|
-
setup(o) {
|
|
381
|
-
const
|
|
379
|
+
emits: /* @__PURE__ */ R(["ready"], ["update:modelValue"]),
|
|
380
|
+
setup(o, { expose: t, emit: e }) {
|
|
381
|
+
const a = e, i = ie(o, "modelValue"), { i18n: r } = We(), l = le("editorRef"), f = T(() => o.theme === "dark" ? "dark" : "light"), s = T(() => g.editorStates.editorStatus === "loading" || o.loading), p = T(() => g.editorStates.editorStatus === "ready" && !g.editorStates.hasContent), g = Fe(l, {
|
|
382
382
|
language: o.language,
|
|
383
|
-
code:
|
|
384
|
-
theme:
|
|
385
|
-
monacoOptions: o.options
|
|
383
|
+
code: i,
|
|
384
|
+
theme: f.value,
|
|
385
|
+
monacoOptions: o.options,
|
|
386
|
+
onReady: (c) => {
|
|
387
|
+
a("ready", c);
|
|
388
|
+
}
|
|
386
389
|
});
|
|
387
|
-
return
|
|
388
|
-
|
|
389
|
-
}), (
|
|
390
|
+
return t({
|
|
391
|
+
monacoEditor: g
|
|
392
|
+
}), x(() => o.language, (c, h) => {
|
|
393
|
+
c !== h && g.setLanguage(c);
|
|
394
|
+
}), (c, h) => (C(), ce("div", {
|
|
390
395
|
class: de(["monaco-editor-container", [
|
|
391
|
-
|
|
392
|
-
{ loading:
|
|
396
|
+
f.value,
|
|
397
|
+
{ loading: s.value }
|
|
393
398
|
]]),
|
|
394
399
|
"data-testid": "monaco-editor-container"
|
|
395
400
|
}, [
|
|
396
401
|
ue("div", {
|
|
397
402
|
ref_key: "editorRef",
|
|
398
|
-
ref:
|
|
403
|
+
ref: l,
|
|
399
404
|
class: "monaco-editor-target",
|
|
400
405
|
"data-testid": "monaco-editor-target"
|
|
401
406
|
}, null, 512),
|
|
402
|
-
W(
|
|
403
|
-
|
|
404
|
-
default:
|
|
405
|
-
|
|
407
|
+
W(c.$slots, "state-loading", { isLoading: s.value }, () => [
|
|
408
|
+
N(U, { name: "fade" }, {
|
|
409
|
+
default: D(() => [
|
|
410
|
+
s.value ? (C(), O(z, {
|
|
406
411
|
key: 0,
|
|
407
412
|
"data-testid": "monaco-editor-status-overlay-loading",
|
|
408
|
-
icon:
|
|
409
|
-
message:
|
|
410
|
-
title:
|
|
411
|
-
}, null, 8, ["icon", "message", "title"])) :
|
|
413
|
+
icon: v(ge),
|
|
414
|
+
message: v(r).t("editor.messages.loading_message", { type: o.language }),
|
|
415
|
+
title: v(r).t("editor.messages.loading_title", { type: o.language })
|
|
416
|
+
}, null, 8, ["icon", "message", "title"])) : B("", !0)
|
|
412
417
|
]),
|
|
413
418
|
_: 1
|
|
414
419
|
})
|
|
415
420
|
], !0),
|
|
416
|
-
W(
|
|
417
|
-
|
|
418
|
-
default:
|
|
419
|
-
|
|
421
|
+
W(c.$slots, "state-empty", { isEmpty: p.value }, () => [
|
|
422
|
+
N(U, { name: "fade" }, {
|
|
423
|
+
default: D(() => [
|
|
424
|
+
p.value && !s.value ? (C(), O(z, {
|
|
420
425
|
key: 0,
|
|
421
426
|
"data-testid": "monaco-editor-status-overlay-empty",
|
|
422
|
-
icon:
|
|
423
|
-
message:
|
|
424
|
-
title:
|
|
425
|
-
}, null, 8, ["icon", "message", "title"])) :
|
|
427
|
+
icon: v(me),
|
|
428
|
+
message: v(r).t("editor.messages.empty_message"),
|
|
429
|
+
title: v(r).t("editor.messages.empty_title")
|
|
430
|
+
}, null, 8, ["icon", "message", "title"])) : B("", !0)
|
|
426
431
|
]),
|
|
427
432
|
_: 1
|
|
428
433
|
})
|
|
429
434
|
], !0)
|
|
430
435
|
], 2));
|
|
431
436
|
}
|
|
432
|
-
}), Ke = /* @__PURE__ */
|
|
437
|
+
}), Ke = /* @__PURE__ */ J(Ue, [["__scopeId", "data-v-e2083635"]]);
|
|
433
438
|
export {
|
|
434
439
|
Ke as MonacoEditor,
|
|
435
440
|
Fe as useMonacoEditor
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(u,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):(u=typeof globalThis<"u"?globalThis:u||self,n(u["kong-ui-public-monaco-editor"]={},u.Vue,u.KongIcons,u.monaco,u.monaco$1,u.shiki,u["kong-ui-public-i18n"]))})(this,function(u,n,D,$,A,O,v){"use strict";function H(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 p=H($),q=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 x=()=>{};function z(o,t){function e(...a){return new Promise((l,i)=>{Promise.resolve(o(()=>t.apply(this,a),{fn:t,thisArg:this,args:a})).then(l).catch(i)})}return e}function G(o,t={}){let e,a,l=x;const i=s=>{clearTimeout(s),l(),l=x};let c;return s=>{const y=n.toValue(o),m=n.toValue(t.maxWait);return e&&i(e),y<=0||m!==void 0&&m<=0?(a&&(i(a),a=void 0),Promise.resolve(s())):new Promise((d,S)=>{l=t.rejectOnCancel?S:d,c=s,m&&!a&&(a=setTimeout(()=>{e&&i(e),a=void 0,d(c())},m)),e=setTimeout(()=>{a&&i(a),a=void 0,d(s())},y)})}}function Y(o,t=200,e={}){return z(G(t,e),o)}function F(o){var t;const e=n.toValue(o);return(t=e==null?void 0:e.$el)!==null&&t!==void 0?t:e}const I="[monaco-editor] [lifecycle]",b=new WeakMap,_=new Map,T=new WeakMap;function Z(o){let t=b.get(o.source);if(!t){let e;switch(o.type){case"editor":e=o.source.onDidDispose(()=>R(o.source));break;case"model":e=o.source.onWillDispose(()=>R(o.source));break;default:throw new Error(`${I} Unknown scope: ${o}`)}t={disposables:new Set,scopeListener:e},b.set(o.source,t)}return t}function L(o){const t=b.get(o);t&&(t.scopeListener.dispose(),b.delete(o))}function N(o,t){Z(t).disposables.add(o)}function W(o,t){const e=b.get(t.source);e&&(e.disposables.delete(o),e.disposables.size===0&&L(t.source))}function J(o){const t=[];if(o.forEach(e=>{try{e.dispose()}catch(a){t.push(a)}}),t.length)throw new AggregateError(t,`${I} One or more disposables threw while being disposed.`)}function Q(o,t){var c,h;let e=o,a=_.get(e);if(!a){const s=T.get(o);s&&(e=s,a=_.get(s))}if(a)return((c=a.scope)==null?void 0:c.type)===(t==null?void 0:t.type)&&((h=a.scope)==null?void 0:h.source)===(t==null?void 0:t.source)||(a.scope&&W(a.decorated,a.scope),t?(N(a.decorated,t),a.scope=t):a.scope=void 0),a.decorated;const l=e.dispose,i={dispose:()=>{const s=_.get(e);if(s)return s.scope&&W(i,s.scope),_.delete(e),T.delete(i),l.call(e)}};return _.set(e,{decorated:i,scope:t}),T.set(i,e),t&&N(i,t),i}function B(o,t){return Q(t,{type:"editor",source:o})}function R(o){const t=b.get(o);if(!t)return;const e=Array.from(t.disposables);try{J(e)}catch(a){console.warn(`${I} Encountered errors while disposing scoped disposables:`,a,", Source:",o)}L(o)}const U=n.ref(!1);let k=null;async function X(){return k||(k=(async()=>{var o,t;try{const e=((o=p.json)==null?void 0:o.jsonDefaults)||((t=p.languages.json)==null?void 0:t.jsonDefaults);e==null||e.setModeConfiguration({tokens:!1});const a=await O.getSingletonHighlighter({themes:Object.values(O.bundledThemes),langs:Object.values(O.bundledLanguages)});a.getLoadedLanguages().forEach(l=>{p.languages.register({id:l})}),A.shikiToMonaco(a,p),U.value=!0}catch(e){throw k=null,e}})(),k)}function j(o,t){const e=n.shallowRef();let a,l=!1,i=!1;const c=n.reactive({editorStatus:"loading",searchBoxIsRevealed:!1,hasContent:!1,theme:t.theme||"light"}),h=r=>{!l||!e.value||e.value.setValue(r)},s=r=>{var f;return(f=e.value)==null?void 0:f.updateOptions({readOnly:r})},y=()=>{var r;return(r=e.value)==null?void 0:r.focus()},m=r=>{var M;const f=(M=e.value)==null?void 0:M.getModel();f&&p.editor.setModelLanguage(f,r)},d=r=>{try{if(!e.value||!r)return;e.value.focus(),e.value.trigger("keyboard",r,null)}catch(f){console.error(`useMonacoEditor: Failed to trigger command: ${r}`,f)}},S=()=>{var r;try{if(!e.value)return;if(c.searchBoxIsRevealed)return(r=e.value.getContribution("editor.contrib.findController"))==null?void 0:r.closeFindWidget();d("actions.find")}catch(f){console.error("useMonacoEditor: Failed to close findController.",f)}},E=Y(()=>p.editor.remeasureFonts(),200);return(()=>{X(),n.watch([U,()=>n.toValue(o)],([r,f],[,M])=>{var K;const w=F(f),ae=F(M);if(!(w instanceof HTMLElement)||!r){l=!1;return}if(!(l&&ae===w)){if(!a){const g=p.Uri.parse(`inmemory://model/${t.language}-${crypto.randomUUID()}`);a=p.editor.createModel(t.code.value,t.language,g)}e.value=p.editor.create(w,{...q,readOnly:t.readOnly||!1,language:t.language,theme:c.theme==="light"?"catppuccin-latte":"catppuccin-mocha",model:a,editContext:!1,...t.monacoOptions}),l=!0,c.editorStatus="ready",c.hasContent=!!t.code.value,B(e.value,e.value.onDidChangeModelContent(()=>{if(i)return;const g=e.value.getValue();c.hasContent=!!g.length,t.code.value=g})),(K=t.onReady)==null||K.call(t,e.value),E();try{const g=e.value.getContribution("editor.contrib.findController"),C=g==null?void 0:g.getState();B(e.value,C==null?void 0:C.onFindReplaceStateChange(()=>{c.searchBoxIsRevealed=C.isRevealed}))}catch(g){console.error("useMonacoEditor: Failed to get the state of findController",g)}n.onWatcherCleanup(()=>{var g;(g=e.value)==null||g.dispose()})}},{immediate:!0,flush:"post"})})(),n.watch(t.code,r=>{if(!e.value||!a||!l)return;const f=a.getValue();r!==f&&(i=!0,e.value.executeEdits("external",[{range:a.getFullModelRange(),text:r}]),e.value.pushUndoStop(),c.hasContent=!!r.length,i=!1)}),n.onMounted(E),n.onActivated(E),n.onBeforeUnmount(()=>{if(!e.value)return;const r=e.value.getModel();e.value.dispose(),r&&r.dispose()}),{editor:e,editorStates:c,setContent:h,setReadOnly:s,focus:y,setLanguage:m,remeasureFonts:E,toggleSearchWidget:S,triggerKeyboardCommand:d}}const ee={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 te(){const o=v.createI18n("en-us",ee);return{i18n:o,i18nT:v.i18nTComponent(o)}}const oe=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"])}}}),P=(o,t)=>{const e=o.__vccOpts||o;for(const[a,l]of t)e[a]=l;return e},V=P(oe,[["__scopeId","data-v-062eadb5"]]),ne=P(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:n.mergeModels(["ready"],["update:modelValue"]),setup(o,{expose:t,emit:e}){const a=e,l=n.useModel(o,"modelValue"),{i18n:i}=te(),c=n.useTemplateRef("editorRef"),h=n.computed(()=>o.theme==="dark"?"dark":"light"),s=n.computed(()=>m.editorStates.editorStatus==="loading"||o.loading),y=n.computed(()=>m.editorStates.editorStatus==="ready"&&!m.editorStates.hasContent),m=j(c,{language:o.language,code:l,theme:h.value,monacoOptions:o.options,onReady:d=>{a("ready",d)}});return t({monacoEditor:m}),n.watch(()=>o.language,(d,S)=>{d!==S&&m.setLanguage(d)}),(d,S)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["monaco-editor-container",[h.value,{loading:s.value}]]),"data-testid":"monaco-editor-container"},[n.createElementVNode("div",{ref_key:"editorRef",ref:c,class:"monaco-editor-target","data-testid":"monaco-editor-target"},null,512),n.renderSlot(d.$slots,"state-loading",{isLoading:s.value},()=>[n.createVNode(n.Transition,{name:"fade"},{default:n.withCtx(()=>[s.value?(n.openBlock(),n.createBlock(V,{key:0,"data-testid":"monaco-editor-status-overlay-loading",icon:n.unref(D.ProgressIcon),message:n.unref(i).t("editor.messages.loading_message",{type:o.language}),title:n.unref(i).t("editor.messages.loading_title",{type:o.language})},null,8,["icon","message","title"])):n.createCommentVNode("",!0)]),_:1})],!0),n.renderSlot(d.$slots,"state-empty",{isEmpty:y.value},()=>[n.createVNode(n.Transition,{name:"fade"},{default:n.withCtx(()=>[y.value&&!s.value?(n.openBlock(),n.createBlock(V,{key:0,"data-testid":"monaco-editor-status-overlay-empty",icon:n.unref(D.CodeblockIcon),message:n.unref(i).t("editor.messages.empty_message"),title:n.unref(i).t("editor.messages.empty_title")},null,8,["icon","message","title"])):n.createCommentVNode("",!0)]),_:1})],!0)],2))}}),[["__scopeId","data-v-e2083635"]]);u.MonacoEditor=ne,u.useMonacoEditor=j,Object.defineProperty(u,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-e2083635]{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-e2083635]{pointer-events:none;-webkit-user-select:none;user-select:none}.monaco-editor-container.loading .monaco-editor-target[data-v-e2083635]{filter:blur(2px);opacity:0;pointer-events:none;-webkit-user-select:none;user-select:none}.monaco-editor-target[data-v-e2083635]{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-e2083635] .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-e2083635] .monaco-editor .sticky-widget{z-index:2}.monaco-editor-target[data-v-e2083635] .monaco-editor .suggest-details-container{border-radius:10px!important;border-radius:var(--kui-border-radius-50, 10px)!important}.monaco-editor-target[data-v-e2083635] .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-e2083635] .monaco-editor .suggest-details-container .suggest-details .type{overflow-wrap:break-word!important}.monaco-editor-target[data-v-e2083635] .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-e2083635] .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-e2083635] .monaco-editor .suggest-widget .tree,.monaco-editor-target[data-v-e2083635] .monaco-editor .suggest-widget .monaco-scrollable-element,.monaco-editor-target[data-v-e2083635] .monaco-editor .suggest-widget .monaco-list,.monaco-editor-target[data-v-e2083635] .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-e2083635] .monaco-editor .suggest-widget .monaco-list-rows{overflow-x:hidden;overflow-y:auto}.monaco-editor-target[data-v-e2083635] .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-e2083635] .monaco-editor .suggest-widget .monaco-list-row.focused{background:#e0e4ea;background:var(--kui-color-background-neutral-weaker, #e0e4ea)}.monaco-editor-target[data-v-e2083635] .monaco-editor .suggest-widget .monaco-list-row.focused .monaco-icon-label,.monaco-editor-target[data-v-e2083635] .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-e2083635] .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-e2083635] .monaco-editor .suggest-widget .monaco-list-row .highlight{font-weight:600;font-weight:var(--kui-font-weight-semibold, 600)}.monaco-editor-target[data-v-e2083635] .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-e2083635] .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-e2083635] .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-e2083635] .monaco-editor .codicon-suggest-more-info{transform:translateY(2px)!important}.monaco-editor-target[data-v-e2083635] .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-e2083635] .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-e2083635] .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-e2083635],.fade-leave-active[data-v-e2083635]{transition:opacity .2s ease;transition:opacity var(--kui-animation-duration-20, .2s) ease}.fade-enter-from[data-v-e2083635],.fade-leave-to[data-v-e2083635]{opacity:0}.fade-enter-to[data-v-e2083635],.fade-leave-from[data-v-e2083635]{opacity:1}
|
|
@@ -43,9 +43,29 @@ type __VLS_Slots = {} & {
|
|
|
43
43
|
} & {
|
|
44
44
|
'state-empty'?: (props: typeof __VLS_14) => any;
|
|
45
45
|
};
|
|
46
|
-
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
46
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
47
|
+
monacoEditor: {
|
|
48
|
+
editor: import("vue").ShallowRef<editor.IStandaloneCodeEditor | undefined, editor.IStandaloneCodeEditor | undefined>;
|
|
49
|
+
editorStates: {
|
|
50
|
+
editorStatus: import("..").EditorStatus;
|
|
51
|
+
searchBoxIsRevealed: boolean;
|
|
52
|
+
hasContent: boolean;
|
|
53
|
+
theme: EditorThemes;
|
|
54
|
+
};
|
|
55
|
+
setContent: (content: string) => void;
|
|
56
|
+
setReadOnly: (readOnly: boolean) => void;
|
|
57
|
+
focus: () => void;
|
|
58
|
+
setLanguage: (language: string) => void;
|
|
59
|
+
remeasureFonts: import("@vueuse/core").UseDebounceFnReturn<() => void>;
|
|
60
|
+
toggleSearchWidget: () => void;
|
|
61
|
+
triggerKeyboardCommand: (id: string) => void;
|
|
62
|
+
};
|
|
63
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
47
64
|
"update:modelValue": (value: string) => any;
|
|
65
|
+
} & {
|
|
66
|
+
ready: (editor: editor.IStandaloneCodeEditor) => any;
|
|
48
67
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
68
|
+
onReady?: ((editor: editor.IStandaloneCodeEditor) => any) | undefined;
|
|
49
69
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
50
70
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
51
71
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -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":"AA6UA,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;AAkBF;;GAEG;AACH,QAAA,MAAM,KAAK,wDAGT,CAAA;AAsCF,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;;;;;;;;;;;;;;;;;;;;;;;;kFAId,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"}
|
|
@@ -21,9 +21,9 @@ export interface UseMonacoEditorOptions {
|
|
|
21
21
|
*/
|
|
22
22
|
theme?: EditorThemes;
|
|
23
23
|
/**
|
|
24
|
-
* Callback function triggered when the editor is
|
|
24
|
+
* Callback function triggered when the editor is ready
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
onReady?: (editor: editor.IStandaloneCodeEditor) => void;
|
|
27
27
|
/**
|
|
28
28
|
* Additional actions to be added to the editor
|
|
29
29
|
*/
|
|
@@ -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,
|
|
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,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,qBAAqB,KAAK,IAAI,CAAA;IACxD;;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"}
|
package/package.json
CHANGED