mudlet-map-editor 0.7.1 → 0.10.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.
@@ -0,0 +1,611 @@
1
+ import { a as e, c as t, f as n, h as r, o as i, p as a } from "./editor.api2-PX2PsJx9.js";
2
+ import { r as o } from "./monaco.contribution-CRzon75s.js";
3
+ //#region node_modules/monaco-editor/esm/vs/common/workers.js
4
+ function s(e, t) {
5
+ let n = globalThis.MonacoEnvironment;
6
+ if (n?.createTrustedTypesPolicy) try {
7
+ return n.createTrustedTypesPolicy(e, t);
8
+ } catch (e) {
9
+ console.error(e);
10
+ return;
11
+ }
12
+ try {
13
+ return globalThis.trustedTypes?.createPolicy(e, t);
14
+ } catch (e) {
15
+ console.error(e);
16
+ return;
17
+ }
18
+ }
19
+ var c = typeof self == "object" && self.constructor && self.constructor.name === "DedicatedWorkerGlobalScope" && globalThis.workerttPolicy !== void 0 ? globalThis.workerttPolicy : s("defaultWorkerFactory", { createScriptURL: (e) => e });
20
+ function l(e) {
21
+ let t = e.label, n = globalThis.MonacoEnvironment;
22
+ if (n) {
23
+ if (typeof n.getWorker == "function") return n.getWorker("workerMain.js", t);
24
+ if (typeof n.getWorkerUrl == "function") {
25
+ let e = n.getWorkerUrl("workerMain.js", t);
26
+ return new Worker(c ? c.createScriptURL(e) : e, {
27
+ name: t,
28
+ type: "module"
29
+ });
30
+ }
31
+ }
32
+ if (e.createWorker) return e.createWorker();
33
+ throw Error("You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker");
34
+ }
35
+ function u(e) {
36
+ let t = Promise.resolve(l({
37
+ label: e.label ?? "monaco-editor-worker",
38
+ moduleId: e.moduleId,
39
+ createWorker: e.createWorker
40
+ })).then((t) => (t.postMessage("ignore"), t.postMessage(e.createData), t));
41
+ return a.createWebWorker({
42
+ worker: t,
43
+ host: e.host,
44
+ keepIdleModels: e.keepIdleModels
45
+ });
46
+ }
47
+ //#endregion
48
+ //#region node_modules/monaco-editor/esm/vs/language/typescript/workerManager.js
49
+ var d = class {
50
+ constructor(e, t) {
51
+ this._modeId = e, this._defaults = t, this._worker = null, this._client = null, this._configChangeListener = this._defaults.onDidChange(() => this._stopWorker()), this._updateExtraLibsToken = 0, this._extraLibsChangeListener = this._defaults.onDidExtraLibsChange(() => this._updateExtraLibs());
52
+ }
53
+ dispose() {
54
+ this._configChangeListener.dispose(), this._extraLibsChangeListener.dispose(), this._stopWorker();
55
+ }
56
+ _stopWorker() {
57
+ this._worker &&= (this._worker.dispose(), null), this._client = null;
58
+ }
59
+ async _updateExtraLibs() {
60
+ if (!this._worker) return;
61
+ let e = ++this._updateExtraLibsToken, t = await this._worker.getProxy();
62
+ this._updateExtraLibsToken === e && t.updateExtraLibs(this._defaults.getExtraLibs());
63
+ }
64
+ _getClient() {
65
+ return this._client ||= (async () => (this._worker = u({
66
+ moduleId: "vs/language/typescript/tsWorker",
67
+ createWorker: () => new Worker(new URL(
68
+ /* @vite-ignore */
69
+ "/assets/ts.worker-C20_IzgO.js",
70
+ "" + import.meta.url
71
+ ), { type: "module" }),
72
+ label: this._modeId,
73
+ keepIdleModels: !0,
74
+ createData: {
75
+ compilerOptions: this._defaults.getCompilerOptions(),
76
+ extraLibs: this._defaults.getExtraLibs(),
77
+ customWorkerPath: this._defaults.workerOptions.customWorkerPath,
78
+ inlayHintsOptions: this._defaults.inlayHintsOptions
79
+ }
80
+ }), this._defaults.getEagerModelSync() ? await this._worker.withSyncedResources(a.getModels().filter((e) => e.getLanguageId() === this._modeId).map((e) => e.uri)) : await this._worker.getProxy()))(), this._client;
81
+ }
82
+ async getLanguageServiceWorker(...e) {
83
+ let t = await this._getClient();
84
+ return this._worker && await this._worker.withSyncedResources(e), t;
85
+ }
86
+ }, f = {};
87
+ f["lib.d.ts"] = !0, f["lib.decorators.d.ts"] = !0, f["lib.decorators.legacy.d.ts"] = !0, f["lib.dom.asynciterable.d.ts"] = !0, f["lib.dom.d.ts"] = !0, f["lib.dom.iterable.d.ts"] = !0, f["lib.es2015.collection.d.ts"] = !0, f["lib.es2015.core.d.ts"] = !0, f["lib.es2015.d.ts"] = !0, f["lib.es2015.generator.d.ts"] = !0, f["lib.es2015.iterable.d.ts"] = !0, f["lib.es2015.promise.d.ts"] = !0, f["lib.es2015.proxy.d.ts"] = !0, f["lib.es2015.reflect.d.ts"] = !0, f["lib.es2015.symbol.d.ts"] = !0, f["lib.es2015.symbol.wellknown.d.ts"] = !0, f["lib.es2016.array.include.d.ts"] = !0, f["lib.es2016.d.ts"] = !0, f["lib.es2016.full.d.ts"] = !0, f["lib.es2016.intl.d.ts"] = !0, f["lib.es2017.arraybuffer.d.ts"] = !0, f["lib.es2017.d.ts"] = !0, f["lib.es2017.date.d.ts"] = !0, f["lib.es2017.full.d.ts"] = !0, f["lib.es2017.intl.d.ts"] = !0, f["lib.es2017.object.d.ts"] = !0, f["lib.es2017.sharedmemory.d.ts"] = !0, f["lib.es2017.string.d.ts"] = !0, f["lib.es2017.typedarrays.d.ts"] = !0, f["lib.es2018.asyncgenerator.d.ts"] = !0, f["lib.es2018.asynciterable.d.ts"] = !0, f["lib.es2018.d.ts"] = !0, f["lib.es2018.full.d.ts"] = !0, f["lib.es2018.intl.d.ts"] = !0, f["lib.es2018.promise.d.ts"] = !0, f["lib.es2018.regexp.d.ts"] = !0, f["lib.es2019.array.d.ts"] = !0, f["lib.es2019.d.ts"] = !0, f["lib.es2019.full.d.ts"] = !0, f["lib.es2019.intl.d.ts"] = !0, f["lib.es2019.object.d.ts"] = !0, f["lib.es2019.string.d.ts"] = !0, f["lib.es2019.symbol.d.ts"] = !0, f["lib.es2020.bigint.d.ts"] = !0, f["lib.es2020.d.ts"] = !0, f["lib.es2020.date.d.ts"] = !0, f["lib.es2020.full.d.ts"] = !0, f["lib.es2020.intl.d.ts"] = !0, f["lib.es2020.number.d.ts"] = !0, f["lib.es2020.promise.d.ts"] = !0, f["lib.es2020.sharedmemory.d.ts"] = !0, f["lib.es2020.string.d.ts"] = !0, f["lib.es2020.symbol.wellknown.d.ts"] = !0, f["lib.es2021.d.ts"] = !0, f["lib.es2021.full.d.ts"] = !0, f["lib.es2021.intl.d.ts"] = !0, f["lib.es2021.promise.d.ts"] = !0, f["lib.es2021.string.d.ts"] = !0, f["lib.es2021.weakref.d.ts"] = !0, f["lib.es2022.array.d.ts"] = !0, f["lib.es2022.d.ts"] = !0, f["lib.es2022.error.d.ts"] = !0, f["lib.es2022.full.d.ts"] = !0, f["lib.es2022.intl.d.ts"] = !0, f["lib.es2022.object.d.ts"] = !0, f["lib.es2022.regexp.d.ts"] = !0, f["lib.es2022.string.d.ts"] = !0, f["lib.es2023.array.d.ts"] = !0, f["lib.es2023.collection.d.ts"] = !0, f["lib.es2023.d.ts"] = !0, f["lib.es2023.full.d.ts"] = !0, f["lib.es2023.intl.d.ts"] = !0, f["lib.es2024.arraybuffer.d.ts"] = !0, f["lib.es2024.collection.d.ts"] = !0, f["lib.es2024.d.ts"] = !0, f["lib.es2024.full.d.ts"] = !0, f["lib.es2024.object.d.ts"] = !0, f["lib.es2024.promise.d.ts"] = !0, f["lib.es2024.regexp.d.ts"] = !0, f["lib.es2024.sharedmemory.d.ts"] = !0, f["lib.es2024.string.d.ts"] = !0, f["lib.es5.d.ts"] = !0, f["lib.es6.d.ts"] = !0, f["lib.esnext.array.d.ts"] = !0, f["lib.esnext.collection.d.ts"] = !0, f["lib.esnext.d.ts"] = !0, f["lib.esnext.decorators.d.ts"] = !0, f["lib.esnext.disposable.d.ts"] = !0, f["lib.esnext.error.d.ts"] = !0, f["lib.esnext.float16.d.ts"] = !0, f["lib.esnext.full.d.ts"] = !0, f["lib.esnext.intl.d.ts"] = !0, f["lib.esnext.iterator.d.ts"] = !0, f["lib.esnext.promise.d.ts"] = !0, f["lib.esnext.sharedmemory.d.ts"] = !0, f["lib.scripthost.d.ts"] = !0, f["lib.webworker.asynciterable.d.ts"] = !0, f["lib.webworker.d.ts"] = !0, f["lib.webworker.importscripts.d.ts"] = !0, f["lib.webworker.iterable.d.ts"] = !0;
88
+ //#endregion
89
+ //#region node_modules/monaco-editor/esm/vs/language/typescript/languageFeatures.js
90
+ function p(e, t, n = 0) {
91
+ if (typeof e == "string") return e;
92
+ if (e === void 0) return "";
93
+ let r = "";
94
+ if (n) {
95
+ r += t;
96
+ for (let e = 0; e < n; e++) r += " ";
97
+ }
98
+ if (r += e.messageText, n++, e.next) for (let i of e.next) r += p(i, t, n);
99
+ return r;
100
+ }
101
+ function m(e) {
102
+ return e ? e.map((e) => e.text).join("") : "";
103
+ }
104
+ var h = class {
105
+ constructor(e) {
106
+ this._worker = e;
107
+ }
108
+ _textSpanToRange(e, t) {
109
+ let n = e.getPositionAt(t.start), r = e.getPositionAt(t.start + t.length), { lineNumber: i, column: a } = n, { lineNumber: o, column: s } = r;
110
+ return {
111
+ startLineNumber: i,
112
+ startColumn: a,
113
+ endLineNumber: o,
114
+ endColumn: s
115
+ };
116
+ }
117
+ }, g = class {
118
+ constructor(e) {
119
+ this._worker = e, this._libFiles = {}, this._hasFetchedLibFiles = !1, this._fetchLibFilesPromise = null;
120
+ }
121
+ isLibFile(e) {
122
+ return e && e.path.indexOf("/lib.") === 0 ? !!f[e.path.slice(1)] : !1;
123
+ }
124
+ getOrCreateModel(e) {
125
+ let t = n.parse(e), r = a.getModel(t);
126
+ if (r) return r;
127
+ if (this.isLibFile(t) && this._hasFetchedLibFiles) return a.createModel(this._libFiles[t.path.slice(1)], "typescript", t);
128
+ let i = o.getExtraLibs()[e];
129
+ return i ? a.createModel(i.content, "typescript", t) : null;
130
+ }
131
+ _containsLibFile(e) {
132
+ for (let t of e) if (this.isLibFile(t)) return !0;
133
+ return !1;
134
+ }
135
+ async fetchLibFilesIfNecessary(e) {
136
+ this._containsLibFile(e) && await this._fetchLibFiles();
137
+ }
138
+ _fetchLibFiles() {
139
+ return this._fetchLibFilesPromise ||= this._worker().then((e) => e.getLibFiles()).then((e) => {
140
+ this._hasFetchedLibFiles = !0, this._libFiles = e;
141
+ }), this._fetchLibFilesPromise;
142
+ }
143
+ }, _ = class extends h {
144
+ constructor(e, t, n, r) {
145
+ super(r), this._libFiles = e, this._defaults = t, this._selector = n, this._disposables = [], this._listener = /* @__PURE__ */ Object.create(null);
146
+ let i = (e) => {
147
+ if (e.getLanguageId() !== n) return;
148
+ let t = () => {
149
+ let { onlyVisible: t } = this._defaults.getDiagnosticsOptions();
150
+ t ? e.isAttachedToEditor() && this._doValidate(e) : this._doValidate(e);
151
+ }, r, i = e.onDidChangeContent(() => {
152
+ clearTimeout(r), r = window.setTimeout(t, 500);
153
+ }), o = e.onDidChangeAttached(() => {
154
+ let { onlyVisible: n } = this._defaults.getDiagnosticsOptions();
155
+ n && (e.isAttachedToEditor() ? t() : a.setModelMarkers(e, this._selector, []));
156
+ });
157
+ this._listener[e.uri.toString()] = { dispose() {
158
+ i.dispose(), o.dispose(), clearTimeout(r);
159
+ } }, t();
160
+ }, o = (e) => {
161
+ a.setModelMarkers(e, this._selector, []);
162
+ let t = e.uri.toString();
163
+ this._listener[t] && (this._listener[t].dispose(), delete this._listener[t]);
164
+ };
165
+ this._disposables.push(a.onDidCreateModel((e) => i(e))), this._disposables.push(a.onWillDisposeModel(o)), this._disposables.push(a.onDidChangeModelLanguage((e) => {
166
+ o(e.model), i(e.model);
167
+ })), this._disposables.push({ dispose() {
168
+ for (let e of a.getModels()) o(e);
169
+ } });
170
+ let s = () => {
171
+ for (let e of a.getModels()) o(e), i(e);
172
+ };
173
+ this._disposables.push(this._defaults.onDidChange(s)), this._disposables.push(this._defaults.onDidExtraLibsChange(s)), a.getModels().forEach((e) => i(e));
174
+ }
175
+ dispose() {
176
+ this._disposables.forEach((e) => e && e.dispose()), this._disposables = [];
177
+ }
178
+ async _doValidate(e) {
179
+ let t = await this._worker(e.uri);
180
+ if (e.isDisposed()) return;
181
+ let r = [], { noSyntaxValidation: i, noSemanticValidation: o, noSuggestionDiagnostics: s } = this._defaults.getDiagnosticsOptions();
182
+ i || r.push(t.getSyntacticDiagnostics(e.uri.toString())), o || r.push(t.getSemanticDiagnostics(e.uri.toString())), s || r.push(t.getSuggestionDiagnostics(e.uri.toString()));
183
+ let c = await Promise.all(r);
184
+ if (!c || e.isDisposed()) return;
185
+ let l = c.reduce((e, t) => t.concat(e), []).filter((e) => (this._defaults.getDiagnosticsOptions().diagnosticCodesToIgnore || []).indexOf(e.code) === -1), u = l.map((e) => e.relatedInformation || []).reduce((e, t) => t.concat(e), []).map((e) => e.file ? n.parse(e.file.fileName) : null);
186
+ await this._libFiles.fetchLibFilesIfNecessary(u), !e.isDisposed() && a.setModelMarkers(e, this._selector, l.map((t) => this._convertDiagnostics(e, t)));
187
+ }
188
+ _convertDiagnostics(e, t) {
189
+ let n = t.start || 0, r = t.length || 1, { lineNumber: a, column: o } = e.getPositionAt(n), { lineNumber: s, column: c } = e.getPositionAt(n + r), l = [];
190
+ return t.reportsUnnecessary && l.push(i.Unnecessary), t.reportsDeprecated && l.push(i.Deprecated), {
191
+ severity: this._tsDiagnosticCategoryToMarkerSeverity(t.category),
192
+ startLineNumber: a,
193
+ startColumn: o,
194
+ endLineNumber: s,
195
+ endColumn: c,
196
+ message: p(t.messageText, "\n"),
197
+ code: t.code.toString(),
198
+ tags: l,
199
+ relatedInformation: this._convertRelatedInformation(e, t.relatedInformation)
200
+ };
201
+ }
202
+ _convertRelatedInformation(e, t) {
203
+ if (!t) return [];
204
+ let n = [];
205
+ return t.forEach((t) => {
206
+ let r = e;
207
+ if (t.file && (r = this._libFiles.getOrCreateModel(t.file.fileName)), !r) return;
208
+ let i = t.start || 0, a = t.length || 1, { lineNumber: o, column: s } = r.getPositionAt(i), { lineNumber: c, column: l } = r.getPositionAt(i + a);
209
+ n.push({
210
+ resource: r.uri,
211
+ startLineNumber: o,
212
+ startColumn: s,
213
+ endLineNumber: c,
214
+ endColumn: l,
215
+ message: p(t.messageText, "\n")
216
+ });
217
+ }), n;
218
+ }
219
+ _tsDiagnosticCategoryToMarkerSeverity(t) {
220
+ switch (t) {
221
+ case 1: return e.Error;
222
+ case 3: return e.Info;
223
+ case 0: return e.Warning;
224
+ case 2: return e.Hint;
225
+ }
226
+ return e.Info;
227
+ }
228
+ }, v = class e extends h {
229
+ get triggerCharacters() {
230
+ return ["."];
231
+ }
232
+ async provideCompletionItems(n, i, a, o) {
233
+ let s = n.getWordUntilPosition(i), c = new t(i.lineNumber, s.startColumn, i.lineNumber, s.endColumn), l = n.uri, u = n.getOffsetAt(i), d = await this._worker(l);
234
+ if (n.isDisposed()) return;
235
+ let f = await d.getCompletionsAtPosition(l.toString(), u);
236
+ if (!(!f || n.isDisposed())) return { suggestions: f.entries.map((a) => {
237
+ let o = c;
238
+ if (a.replacementSpan) {
239
+ let e = n.getPositionAt(a.replacementSpan.start), r = n.getPositionAt(a.replacementSpan.start + a.replacementSpan.length);
240
+ o = new t(e.lineNumber, e.column, r.lineNumber, r.column);
241
+ }
242
+ let s = [];
243
+ return a.kindModifiers !== void 0 && a.kindModifiers.indexOf("deprecated") !== -1 && s.push(r.CompletionItemTag.Deprecated), {
244
+ uri: l,
245
+ position: i,
246
+ offset: u,
247
+ range: o,
248
+ label: a.name,
249
+ insertText: a.name,
250
+ sortText: a.sortText,
251
+ kind: e.convertKind(a.kind),
252
+ tags: s
253
+ };
254
+ }) };
255
+ }
256
+ async resolveCompletionItem(t, n) {
257
+ let r = t, i = r.uri, a = r.position, o = r.offset, s = await (await this._worker(i)).getCompletionEntryDetails(i.toString(), o, r.label);
258
+ return s ? {
259
+ uri: i,
260
+ position: a,
261
+ label: s.name,
262
+ kind: e.convertKind(s.kind),
263
+ detail: m(s.displayParts),
264
+ documentation: { value: e.createDocumentationString(s) }
265
+ } : r;
266
+ }
267
+ static convertKind(e) {
268
+ switch (e) {
269
+ case E.primitiveType:
270
+ case E.keyword: return r.CompletionItemKind.Keyword;
271
+ case E.variable:
272
+ case E.localVariable: return r.CompletionItemKind.Variable;
273
+ case E.memberVariable:
274
+ case E.memberGetAccessor:
275
+ case E.memberSetAccessor: return r.CompletionItemKind.Field;
276
+ case E.function:
277
+ case E.memberFunction:
278
+ case E.constructSignature:
279
+ case E.callSignature:
280
+ case E.indexSignature: return r.CompletionItemKind.Function;
281
+ case E.enum: return r.CompletionItemKind.Enum;
282
+ case E.module: return r.CompletionItemKind.Module;
283
+ case E.class: return r.CompletionItemKind.Class;
284
+ case E.interface: return r.CompletionItemKind.Interface;
285
+ case E.warning: return r.CompletionItemKind.File;
286
+ }
287
+ return r.CompletionItemKind.Property;
288
+ }
289
+ static createDocumentationString(e) {
290
+ let t = m(e.documentation);
291
+ if (e.tags) for (let n of e.tags) t += `
292
+
293
+ ${y(n)}`;
294
+ return t;
295
+ }
296
+ };
297
+ function y(e) {
298
+ let t = `*@${e.name}*`;
299
+ if (e.name === "param" && e.text) {
300
+ let [n, ...r] = e.text;
301
+ t += `\`${n.text}\``, r.length > 0 && (t += ` \u2014 ${r.map((e) => e.text).join(" ")}`);
302
+ } else Array.isArray(e.text) ? t += ` \u2014 ${e.text.map((e) => e.text).join(" ")}` : e.text && (t += ` \u2014 ${e.text}`);
303
+ return t;
304
+ }
305
+ var b = class e extends h {
306
+ constructor() {
307
+ super(...arguments), this.signatureHelpTriggerCharacters = ["(", ","];
308
+ }
309
+ static _toSignatureHelpTriggerReason(e) {
310
+ switch (e.triggerKind) {
311
+ case r.SignatureHelpTriggerKind.TriggerCharacter: return e.triggerCharacter ? e.isRetrigger ? {
312
+ kind: "retrigger",
313
+ triggerCharacter: e.triggerCharacter
314
+ } : {
315
+ kind: "characterTyped",
316
+ triggerCharacter: e.triggerCharacter
317
+ } : { kind: "invoked" };
318
+ case r.SignatureHelpTriggerKind.ContentChange: return e.isRetrigger ? { kind: "retrigger" } : { kind: "invoked" };
319
+ case r.SignatureHelpTriggerKind.Invoke:
320
+ default: return { kind: "invoked" };
321
+ }
322
+ }
323
+ async provideSignatureHelp(t, n, r, i) {
324
+ let a = t.uri, o = t.getOffsetAt(n), s = await this._worker(a);
325
+ if (t.isDisposed()) return;
326
+ let c = await s.getSignatureHelpItems(a.toString(), o, { triggerReason: e._toSignatureHelpTriggerReason(i) });
327
+ if (!c || t.isDisposed()) return;
328
+ let l = {
329
+ activeSignature: c.selectedItemIndex,
330
+ activeParameter: c.argumentIndex,
331
+ signatures: []
332
+ };
333
+ return c.items.forEach((e) => {
334
+ let t = {
335
+ label: "",
336
+ parameters: []
337
+ };
338
+ t.documentation = { value: m(e.documentation) }, t.label += m(e.prefixDisplayParts), e.parameters.forEach((n, r, i) => {
339
+ let a = m(n.displayParts), o = {
340
+ label: a,
341
+ documentation: { value: m(n.documentation) }
342
+ };
343
+ t.label += a, t.parameters.push(o), r < i.length - 1 && (t.label += m(e.separatorDisplayParts));
344
+ }), t.label += m(e.suffixDisplayParts), l.signatures.push(t);
345
+ }), {
346
+ value: l,
347
+ dispose() {}
348
+ };
349
+ }
350
+ }, x = class extends h {
351
+ async provideHover(e, t, n) {
352
+ let r = e.uri, i = e.getOffsetAt(t), a = await this._worker(r);
353
+ if (e.isDisposed()) return;
354
+ let o = await a.getQuickInfoAtPosition(r.toString(), i);
355
+ if (!o || e.isDisposed()) return;
356
+ let s = m(o.documentation), c = o.tags ? o.tags.map((e) => y(e)).join(" \n\n") : "", l = m(o.displayParts);
357
+ return {
358
+ range: this._textSpanToRange(e, o.textSpan),
359
+ contents: [{ value: "```typescript\n" + l + "\n```\n" }, { value: s + (c ? "\n\n" + c : "") }]
360
+ };
361
+ }
362
+ }, S = class extends h {
363
+ async provideDocumentHighlights(e, t, n) {
364
+ let i = e.uri, a = e.getOffsetAt(t), o = await this._worker(i);
365
+ if (e.isDisposed()) return;
366
+ let s = await o.getDocumentHighlights(i.toString(), a, [i.toString()]);
367
+ if (!(!s || e.isDisposed())) return s.flatMap((t) => t.highlightSpans.map((t) => ({
368
+ range: this._textSpanToRange(e, t.textSpan),
369
+ kind: t.kind === "writtenReference" ? r.DocumentHighlightKind.Write : r.DocumentHighlightKind.Text
370
+ })));
371
+ }
372
+ }, C = class extends h {
373
+ constructor(e, t) {
374
+ super(t), this._libFiles = e;
375
+ }
376
+ async provideDefinition(e, t, r) {
377
+ let i = e.uri, a = e.getOffsetAt(t), o = await this._worker(i);
378
+ if (e.isDisposed()) return;
379
+ let s = await o.getDefinitionAtPosition(i.toString(), a);
380
+ if (!s || e.isDisposed() || (await this._libFiles.fetchLibFilesIfNecessary(s.map((e) => n.parse(e.fileName))), e.isDisposed())) return;
381
+ let c = [];
382
+ for (let e of s) {
383
+ let t = this._libFiles.getOrCreateModel(e.fileName);
384
+ t && c.push({
385
+ uri: t.uri,
386
+ range: this._textSpanToRange(t, e.textSpan)
387
+ });
388
+ }
389
+ return c;
390
+ }
391
+ }, w = class extends h {
392
+ constructor(e, t) {
393
+ super(t), this._libFiles = e;
394
+ }
395
+ async provideReferences(e, t, r, i) {
396
+ let a = e.uri, o = e.getOffsetAt(t), s = await this._worker(a);
397
+ if (e.isDisposed()) return;
398
+ let c = await s.getReferencesAtPosition(a.toString(), o);
399
+ if (!c || e.isDisposed() || (await this._libFiles.fetchLibFilesIfNecessary(c.map((e) => n.parse(e.fileName))), e.isDisposed())) return;
400
+ let l = [];
401
+ for (let e of c) {
402
+ let t = this._libFiles.getOrCreateModel(e.fileName);
403
+ t && l.push({
404
+ uri: t.uri,
405
+ range: this._textSpanToRange(t, e.textSpan)
406
+ });
407
+ }
408
+ return l;
409
+ }
410
+ }, T = class extends h {
411
+ async provideDocumentSymbols(e, t) {
412
+ let n = e.uri, i = await this._worker(n);
413
+ if (e.isDisposed()) return;
414
+ let a = await i.getNavigationTree(n.toString());
415
+ if (!a || e.isDisposed()) return;
416
+ let o = (t, n) => ({
417
+ name: t.text,
418
+ detail: "",
419
+ kind: D[t.kind] || r.SymbolKind.Variable,
420
+ range: this._textSpanToRange(e, t.spans[0]),
421
+ selectionRange: this._textSpanToRange(e, t.spans[0]),
422
+ tags: [],
423
+ children: t.childItems?.map((e) => o(e, t.text)),
424
+ containerName: n
425
+ });
426
+ return a.childItems ? a.childItems.map((e) => o(e)) : [];
427
+ }
428
+ }, E = class {};
429
+ E.unknown = "", E.keyword = "keyword", E.script = "script", E.module = "module", E.class = "class", E.interface = "interface", E.type = "type", E.enum = "enum", E.variable = "var", E.localVariable = "local var", E.function = "function", E.localFunction = "local function", E.memberFunction = "method", E.memberGetAccessor = "getter", E.memberSetAccessor = "setter", E.memberVariable = "property", E.constructorImplementation = "constructor", E.callSignature = "call", E.indexSignature = "index", E.constructSignature = "construct", E.parameter = "parameter", E.typeParameter = "type parameter", E.primitiveType = "primitive type", E.label = "label", E.alias = "alias", E.const = "const", E.let = "let", E.warning = "warning";
430
+ var D = /* @__PURE__ */ Object.create(null);
431
+ D[E.module] = r.SymbolKind.Module, D[E.class] = r.SymbolKind.Class, D[E.enum] = r.SymbolKind.Enum, D[E.interface] = r.SymbolKind.Interface, D[E.memberFunction] = r.SymbolKind.Method, D[E.memberVariable] = r.SymbolKind.Property, D[E.memberGetAccessor] = r.SymbolKind.Property, D[E.memberSetAccessor] = r.SymbolKind.Property, D[E.variable] = r.SymbolKind.Variable, D[E.const] = r.SymbolKind.Variable, D[E.localVariable] = r.SymbolKind.Variable, D[E.variable] = r.SymbolKind.Variable, D[E.function] = r.SymbolKind.Function, D[E.localFunction] = r.SymbolKind.Function;
432
+ var O = class extends h {
433
+ static _convertOptions(e) {
434
+ return {
435
+ ConvertTabsToSpaces: e.insertSpaces,
436
+ TabSize: e.tabSize,
437
+ IndentSize: e.tabSize,
438
+ IndentStyle: 2,
439
+ NewLineCharacter: "\n",
440
+ InsertSpaceAfterCommaDelimiter: !0,
441
+ InsertSpaceAfterSemicolonInForStatements: !0,
442
+ InsertSpaceBeforeAndAfterBinaryOperators: !0,
443
+ InsertSpaceAfterKeywordsInControlFlowStatements: !0,
444
+ InsertSpaceAfterFunctionKeywordForAnonymousFunctions: !0,
445
+ InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: !1,
446
+ InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: !1,
447
+ InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: !1,
448
+ PlaceOpenBraceOnNewLineForControlBlocks: !1,
449
+ PlaceOpenBraceOnNewLineForFunctions: !1
450
+ };
451
+ }
452
+ _convertTextChanges(e, t) {
453
+ return {
454
+ text: t.newText,
455
+ range: this._textSpanToRange(e, t.span)
456
+ };
457
+ }
458
+ }, k = class extends O {
459
+ constructor() {
460
+ super(...arguments), this.canFormatMultipleRanges = !1;
461
+ }
462
+ async provideDocumentRangeFormattingEdits(e, t, n, r) {
463
+ let i = e.uri, a = e.getOffsetAt({
464
+ lineNumber: t.startLineNumber,
465
+ column: t.startColumn
466
+ }), o = e.getOffsetAt({
467
+ lineNumber: t.endLineNumber,
468
+ column: t.endColumn
469
+ }), s = await this._worker(i);
470
+ if (e.isDisposed()) return;
471
+ let c = await s.getFormattingEditsForRange(i.toString(), a, o, O._convertOptions(n));
472
+ if (!(!c || e.isDisposed())) return c.map((t) => this._convertTextChanges(e, t));
473
+ }
474
+ }, A = class extends O {
475
+ get autoFormatTriggerCharacters() {
476
+ return [
477
+ ";",
478
+ "}",
479
+ "\n"
480
+ ];
481
+ }
482
+ async provideOnTypeFormattingEdits(e, t, n, r, i) {
483
+ let a = e.uri, o = e.getOffsetAt(t), s = await this._worker(a);
484
+ if (e.isDisposed()) return;
485
+ let c = await s.getFormattingEditsAfterKeystroke(a.toString(), o, n, O._convertOptions(r));
486
+ if (!(!c || e.isDisposed())) return c.map((t) => this._convertTextChanges(e, t));
487
+ }
488
+ }, j = class extends O {
489
+ async provideCodeActions(e, t, n, r) {
490
+ let i = e.uri, a = e.getOffsetAt({
491
+ lineNumber: t.startLineNumber,
492
+ column: t.startColumn
493
+ }), o = e.getOffsetAt({
494
+ lineNumber: t.endLineNumber,
495
+ column: t.endColumn
496
+ }), s = O._convertOptions(e.getOptions()), c = n.markers.filter((e) => e.code).map((e) => e.code).map(Number), l = await this._worker(i);
497
+ if (e.isDisposed()) return;
498
+ let u = await l.getCodeFixesAtPosition(i.toString(), a, o, c, s);
499
+ return !u || e.isDisposed() ? {
500
+ actions: [],
501
+ dispose: () => {}
502
+ } : {
503
+ actions: u.filter((e) => e.changes.filter((e) => e.isNewFile).length === 0).map((t) => this._tsCodeFixActionToMonacoCodeAction(e, n, t)),
504
+ dispose: () => {}
505
+ };
506
+ }
507
+ _tsCodeFixActionToMonacoCodeAction(e, t, n) {
508
+ let r = [];
509
+ for (let t of n.changes) for (let n of t.textChanges) r.push({
510
+ resource: e.uri,
511
+ versionId: void 0,
512
+ textEdit: {
513
+ range: this._textSpanToRange(e, n.span),
514
+ text: n.newText
515
+ }
516
+ });
517
+ return {
518
+ title: n.description,
519
+ edit: { edits: r },
520
+ diagnostics: t.markers,
521
+ kind: "quickfix"
522
+ };
523
+ }
524
+ }, M = class extends h {
525
+ constructor(e, t) {
526
+ super(t), this._libFiles = e;
527
+ }
528
+ async provideRenameEdits(e, t, n, r) {
529
+ let i = e.uri, a = i.toString(), o = e.getOffsetAt(t), s = await this._worker(i);
530
+ if (e.isDisposed()) return;
531
+ let c = await s.getRenameInfo(a, o, { allowRenameOfImportPath: !1 });
532
+ if (c.canRename === !1) return {
533
+ edits: [],
534
+ rejectReason: c.localizedErrorMessage
535
+ };
536
+ if (c.fileToRename !== void 0) throw Error("Renaming files is not supported.");
537
+ let l = await s.findRenameLocations(a, o, !1, !1, !1);
538
+ if (!l || e.isDisposed()) return;
539
+ let u = [];
540
+ for (let e of l) {
541
+ let t = this._libFiles.getOrCreateModel(e.fileName);
542
+ if (t) u.push({
543
+ resource: t.uri,
544
+ versionId: void 0,
545
+ textEdit: {
546
+ range: this._textSpanToRange(t, e.textSpan),
547
+ text: n
548
+ }
549
+ });
550
+ else throw Error(`Unknown file ${e.fileName}.`);
551
+ }
552
+ return { edits: u };
553
+ }
554
+ }, N = class extends h {
555
+ async provideInlayHints(e, t, n) {
556
+ let r = e.uri, i = r.toString(), a = e.getOffsetAt({
557
+ lineNumber: t.startLineNumber,
558
+ column: t.startColumn
559
+ }), o = e.getOffsetAt({
560
+ lineNumber: t.endLineNumber,
561
+ column: t.endColumn
562
+ }), s = await this._worker(r);
563
+ return e.isDisposed() ? null : {
564
+ hints: (await s.provideInlayHints(i, a, o)).map((t) => ({
565
+ ...t,
566
+ label: t.text,
567
+ position: e.getPositionAt(t.position),
568
+ kind: this._convertHintKind(t.kind)
569
+ })),
570
+ dispose: () => {}
571
+ };
572
+ }
573
+ _convertHintKind(e) {
574
+ switch (e) {
575
+ case "Parameter": return r.InlayHintKind.Parameter;
576
+ case "Type": return r.InlayHintKind.Type;
577
+ default: return r.InlayHintKind.Type;
578
+ }
579
+ }
580
+ }, P, F;
581
+ function I(e) {
582
+ F = B(e, "typescript");
583
+ }
584
+ function L(e) {
585
+ P = B(e, "javascript");
586
+ }
587
+ function R() {
588
+ return new Promise((e, t) => {
589
+ if (!P) return t("JavaScript not registered!");
590
+ e(P);
591
+ });
592
+ }
593
+ function z() {
594
+ return new Promise((e, t) => {
595
+ if (!F) return t("TypeScript not registered!");
596
+ e(F);
597
+ });
598
+ }
599
+ function B(e, t) {
600
+ let n = [], i = new d(t, e), a = (...e) => i.getLanguageServiceWorker(...e), o = new g(a);
601
+ function s() {
602
+ let { modeConfiguration: i } = e;
603
+ V(n), i.completionItems && n.push(r.registerCompletionItemProvider(t, new v(a))), i.signatureHelp && n.push(r.registerSignatureHelpProvider(t, new b(a))), i.hovers && n.push(r.registerHoverProvider(t, new x(a))), i.documentHighlights && n.push(r.registerDocumentHighlightProvider(t, new S(a))), i.definitions && n.push(r.registerDefinitionProvider(t, new C(o, a))), i.references && n.push(r.registerReferenceProvider(t, new w(o, a))), i.documentSymbols && n.push(r.registerDocumentSymbolProvider(t, new T(a))), i.rename && n.push(r.registerRenameProvider(t, new M(o, a))), i.documentRangeFormattingEdits && n.push(r.registerDocumentRangeFormattingEditProvider(t, new k(a))), i.onTypeFormattingEdits && n.push(r.registerOnTypeFormattingEditProvider(t, new A(a))), i.codeActions && n.push(r.registerCodeActionProvider(t, new j(a))), i.inlayHints && n.push(r.registerInlayHintsProvider(t, new N(a))), i.diagnostics && n.push(new _(o, e, t, a));
604
+ }
605
+ return s(), a;
606
+ }
607
+ function V(e) {
608
+ for (; e.length;) e.pop().dispose();
609
+ }
610
+ //#endregion
611
+ export { h as Adapter, j as CodeActionAdaptor, C as DefinitionAdapter, _ as DiagnosticsAdapter, S as DocumentHighlightAdapter, k as FormatAdapter, O as FormatHelper, A as FormatOnTypeAdapter, N as InlayHintsAdapter, E as Kind, g as LibFiles, T as OutlineAdapter, x as QuickInfoAdapter, w as ReferenceAdapter, M as RenameAdapter, b as SignatureHelpAdapter, v as SuggestAdapter, d as WorkerManager, p as flattenDiagnosticMessageText, R as getJavaScriptWorker, z as getTypeScriptWorker, L as setupJavaScript, I as setupTypeScript };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mudlet-map-editor",
3
- "version": "0.7.1",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "description": "Mudlet Map Editor",
6
6
  "keywords": [
@@ -36,8 +36,8 @@
36
36
  },
37
37
  "peerDependencies": {
38
38
  "konva": ">=10",
39
- "mudlet-map-binary-reader": ">=0.8.0",
40
- "mudlet-map-renderer": ">=0.40.0-konva",
39
+ "mudlet-map-binary-reader": ">=0.9.0",
40
+ "mudlet-map-renderer": ">=0.41.0-konva",
41
41
  "react": ">=19",
42
42
  "react-dom": ">=19"
43
43
  },
@@ -48,12 +48,16 @@
48
48
  "@vitejs/plugin-react": "^6.0.1",
49
49
  "buffer": "^6.0.3",
50
50
  "konva": "^10.2.5",
51
- "mudlet-map-binary-reader": "^0.8.0",
52
- "mudlet-map-renderer": "^0.40.0-konva",
51
+ "mudlet-map-binary-reader": "^0.9.0",
52
+ "mudlet-map-renderer": "^0.41.1-konva",
53
53
  "react": "^19.2.5",
54
54
  "react-dom": "^19.2.5",
55
55
  "typescript": "^6.0.3",
56
56
  "vite": "^8.0.8",
57
57
  "vite-plugin-node-polyfills": "^0.26.0"
58
+ },
59
+ "dependencies": {
60
+ "@monaco-editor/react": "^4.7.0",
61
+ "monaco-editor": "^0.55.1"
58
62
  }
59
63
  }