modern-monaco 0.0.0-beta.0 → 0.0.0-beta.2
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/LICENSE +1 -1
- package/README.md +129 -87
- package/dist/cache.js +1 -1
- package/dist/core.js +479 -0
- package/dist/editor-core.js +128 -21
- package/dist/index.js +29166 -449
- package/dist/lsp/css/setup.js +6 -7
- package/dist/lsp/css/worker.js +8961 -1355
- package/dist/lsp/html/setup.js +7 -8
- package/dist/lsp/html/worker.js +6506 -672
- package/dist/lsp/json/setup.js +5 -6
- package/dist/lsp/json/worker.js +395 -393
- package/dist/lsp/language-service.js +21 -21
- package/dist/lsp/typescript/libs.js +11 -9
- package/dist/lsp/typescript/setup.js +6 -7
- package/dist/shiki-wasm.js +1 -1
- package/dist/shiki.js +129 -751
- package/dist/ssr/index.js +13 -18
- package/dist/ssr/workerd.js +13 -18
- package/dist/util.js +7 -3
- package/dist/workspace.js +16 -16
- package/package.json +31 -13
- package/types/core.d.ts +4 -0
- package/types/index.d.ts +31 -8
- package/types/jsonSchema.d.ts +2 -0
- package/types/lsp.d.ts +7 -1
- package/types/ssr.d.ts +5 -5
- package/types/textmate.d.ts +1 -1
- package/types/cache.d.ts +0 -7
package/dist/ssr/index.js
CHANGED
|
@@ -6,37 +6,32 @@ import { getWasmInstance } from "../shiki-wasm.js";
|
|
|
6
6
|
import { getLanguageIdFromPath, initShiki } from "../shiki.js";
|
|
7
7
|
import { render } from "../shiki.js";
|
|
8
8
|
var ssrHighlighter;
|
|
9
|
-
async function
|
|
10
|
-
const
|
|
11
|
-
const
|
|
9
|
+
async function renderToString(input, options) {
|
|
10
|
+
const { language, theme, shiki } = options ?? {};
|
|
11
|
+
const filename = typeof input === "string" ? void 0 : input.filename;
|
|
12
|
+
const highlighter = await (ssrHighlighter ?? (ssrHighlighter = initShiki(shiki)));
|
|
12
13
|
const promises = [];
|
|
14
|
+
if (theme && !highlighter.getLoadedThemes().includes(theme)) {
|
|
15
|
+
console.info(`[modern-monaco] Loading theme '${theme}' from ${shiki?.tmDownloadCDN ?? "https://esm.sh"}/tm-themes ...`);
|
|
16
|
+
promises.push(highlighter.loadThemeFromCDN(theme));
|
|
17
|
+
}
|
|
13
18
|
if (language || filename) {
|
|
14
19
|
const languageId = language ?? getLanguageIdFromPath(filename);
|
|
15
20
|
if (languageId && !highlighter.getLoadedLanguages().includes(languageId)) {
|
|
16
21
|
console.info(
|
|
17
|
-
`[modern-monaco] Loading garmmar '${languageId}' from ${
|
|
22
|
+
`[modern-monaco] Loading garmmar '${languageId}' from ${shiki?.tmDownloadCDN ?? "https://esm.sh"}/tm-grammars ...`
|
|
18
23
|
);
|
|
19
24
|
promises.push(highlighter.loadGrammarFromCDN(languageId));
|
|
20
25
|
}
|
|
21
26
|
}
|
|
22
|
-
if (theme) {
|
|
23
|
-
if (!highlighter.getLoadedThemes().includes(theme)) {
|
|
24
|
-
console.info(`[modern-monaco] Loading theme '${theme}' from ${options.shiki?.downloadCDN ?? "https://esm.sh"}/tm-themes ...`);
|
|
25
|
-
promises.push(highlighter.loadThemeFromCDN(theme));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
27
|
if (promises.length > 0) {
|
|
29
28
|
await Promise.all(promises);
|
|
30
29
|
}
|
|
31
|
-
return highlighter;
|
|
32
|
-
}
|
|
33
|
-
async function renderToString(options) {
|
|
34
|
-
const highlighter = await initRenderHighlighter(options);
|
|
35
|
-
return render(highlighter, options);
|
|
30
|
+
return render(highlighter, input, options);
|
|
36
31
|
}
|
|
37
|
-
async function renderToWebComponent(options) {
|
|
38
|
-
const prerender = await renderToString(options);
|
|
39
|
-
return '<monaco-editor><script type="application/json" class="monaco-editor-options">' + JSON.stringify(options) + '<\/script><div class="monaco-editor-prerender" style="width:100%;height:100%;">' + prerender + "</div></monaco-editor>";
|
|
32
|
+
async function renderToWebComponent(input, options) {
|
|
33
|
+
const prerender = await renderToString(input, options);
|
|
34
|
+
return '<monaco-editor><script type="application/json" class="monaco-editor-options">' + JSON.stringify([input, options]) + '<\/script><div class="monaco-editor-prerender" style="width:100%;height:100%;">' + prerender + "</div></monaco-editor>";
|
|
40
35
|
}
|
|
41
36
|
|
|
42
37
|
// src/ssr/index.ts
|
package/dist/ssr/workerd.js
CHANGED
|
@@ -5,37 +5,32 @@ import { setDefaultWasmLoader } from "../shiki.js";
|
|
|
5
5
|
import { getLanguageIdFromPath, initShiki } from "../shiki.js";
|
|
6
6
|
import { render } from "../shiki.js";
|
|
7
7
|
var ssrHighlighter;
|
|
8
|
-
async function
|
|
9
|
-
const
|
|
10
|
-
const
|
|
8
|
+
async function renderToString(input, options) {
|
|
9
|
+
const { language, theme, shiki } = options ?? {};
|
|
10
|
+
const filename = typeof input === "string" ? void 0 : input.filename;
|
|
11
|
+
const highlighter = await (ssrHighlighter ?? (ssrHighlighter = initShiki(shiki)));
|
|
11
12
|
const promises = [];
|
|
13
|
+
if (theme && !highlighter.getLoadedThemes().includes(theme)) {
|
|
14
|
+
console.info(`[modern-monaco] Loading theme '${theme}' from ${shiki?.tmDownloadCDN ?? "https://esm.sh"}/tm-themes ...`);
|
|
15
|
+
promises.push(highlighter.loadThemeFromCDN(theme));
|
|
16
|
+
}
|
|
12
17
|
if (language || filename) {
|
|
13
18
|
const languageId = language ?? getLanguageIdFromPath(filename);
|
|
14
19
|
if (languageId && !highlighter.getLoadedLanguages().includes(languageId)) {
|
|
15
20
|
console.info(
|
|
16
|
-
`[modern-monaco] Loading garmmar '${languageId}' from ${
|
|
21
|
+
`[modern-monaco] Loading garmmar '${languageId}' from ${shiki?.tmDownloadCDN ?? "https://esm.sh"}/tm-grammars ...`
|
|
17
22
|
);
|
|
18
23
|
promises.push(highlighter.loadGrammarFromCDN(languageId));
|
|
19
24
|
}
|
|
20
25
|
}
|
|
21
|
-
if (theme) {
|
|
22
|
-
if (!highlighter.getLoadedThemes().includes(theme)) {
|
|
23
|
-
console.info(`[modern-monaco] Loading theme '${theme}' from ${options.shiki?.downloadCDN ?? "https://esm.sh"}/tm-themes ...`);
|
|
24
|
-
promises.push(highlighter.loadThemeFromCDN(theme));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
26
|
if (promises.length > 0) {
|
|
28
27
|
await Promise.all(promises);
|
|
29
28
|
}
|
|
30
|
-
return highlighter;
|
|
31
|
-
}
|
|
32
|
-
async function renderToString(options) {
|
|
33
|
-
const highlighter = await initRenderHighlighter(options);
|
|
34
|
-
return render(highlighter, options);
|
|
29
|
+
return render(highlighter, input, options);
|
|
35
30
|
}
|
|
36
|
-
async function renderToWebComponent(options) {
|
|
37
|
-
const prerender = await renderToString(options);
|
|
38
|
-
return '<monaco-editor><script type="application/json" class="monaco-editor-options">' + JSON.stringify(options) + '<\/script><div class="monaco-editor-prerender" style="width:100%;height:100%;">' + prerender + "</div></monaco-editor>";
|
|
31
|
+
async function renderToWebComponent(input, options) {
|
|
32
|
+
const prerender = await renderToString(input, options);
|
|
33
|
+
return '<monaco-editor><script type="application/json" class="monaco-editor-options">' + JSON.stringify([input, options]) + '<\/script><div class="monaco-editor-prerender" style="width:100%;height:100%;">' + prerender + "</div></monaco-editor>";
|
|
39
34
|
}
|
|
40
35
|
|
|
41
36
|
// src/ssr/workerd.ts
|
package/dist/util.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/util.ts
|
|
2
|
-
var enc = new TextEncoder();
|
|
3
|
-
var dec = new TextDecoder();
|
|
2
|
+
var enc = /* @__PURE__ */ new TextEncoder();
|
|
3
|
+
var dec = /* @__PURE__ */ new TextDecoder();
|
|
4
4
|
function encode(data) {
|
|
5
5
|
return typeof data === "string" ? enc.encode(data) : data;
|
|
6
6
|
}
|
|
@@ -27,7 +27,10 @@ function filenameToURL(filename) {
|
|
|
27
27
|
function isPlainObject(v) {
|
|
28
28
|
return typeof v === "object" && v !== null && v.constructor === Object;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function isDigital(v) {
|
|
31
|
+
return typeof v === "number" || typeof v === "string" && /^\d+$/.test(v);
|
|
32
|
+
}
|
|
33
|
+
function debunce(fn, delay) {
|
|
31
34
|
let timer = null;
|
|
32
35
|
return () => {
|
|
33
36
|
if (timer !== null) {
|
|
@@ -182,6 +185,7 @@ export {
|
|
|
182
185
|
defineProperty,
|
|
183
186
|
encode,
|
|
184
187
|
filenameToURL,
|
|
188
|
+
isDigital,
|
|
185
189
|
isPlainObject,
|
|
186
190
|
openIDB,
|
|
187
191
|
openIDBCursor,
|
package/dist/workspace.js
CHANGED
|
@@ -23,7 +23,7 @@ var Workspace = class {
|
|
|
23
23
|
const db = new WorkspaceDatabase(
|
|
24
24
|
name,
|
|
25
25
|
{
|
|
26
|
-
name: "fs
|
|
26
|
+
name: "fs-meta",
|
|
27
27
|
keyPath: "url",
|
|
28
28
|
onCreate: async (store) => {
|
|
29
29
|
if (initialFiles) {
|
|
@@ -53,7 +53,7 @@ var Workspace = class {
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
|
-
name: "fs
|
|
56
|
+
name: "fs-blob",
|
|
57
57
|
keyPath: "url",
|
|
58
58
|
onCreate: async (store) => {
|
|
59
59
|
if (initialFiles) {
|
|
@@ -70,13 +70,13 @@ var Workspace = class {
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
|
-
name: "
|
|
73
|
+
name: "viewstate",
|
|
74
74
|
keyPath: "url"
|
|
75
75
|
}
|
|
76
76
|
);
|
|
77
77
|
this._monaco = promiseWithResolvers();
|
|
78
78
|
this._fs = new FS(db);
|
|
79
|
-
this._viewState = new WorkspaceStateStorage(db, "
|
|
79
|
+
this._viewState = new WorkspaceStateStorage(db, "viewstate");
|
|
80
80
|
this._entryFile = entryFile;
|
|
81
81
|
if (browserHistory) {
|
|
82
82
|
if (!globalThis.history) {
|
|
@@ -87,7 +87,7 @@ var Workspace = class {
|
|
|
87
87
|
this._history = new LocalStorageHistory(name);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
|
|
90
|
+
setupMonaco(monaco) {
|
|
91
91
|
this._monaco.resolve(monaco);
|
|
92
92
|
}
|
|
93
93
|
get entryFile() {
|
|
@@ -179,15 +179,15 @@ var FS = class {
|
|
|
179
179
|
return db.transaction(storeName, readwrite ? "readwrite" : "readonly").objectStore(storeName);
|
|
180
180
|
}
|
|
181
181
|
async _getIdbObjectStores(readwrite = false) {
|
|
182
|
-
const transaction = (await this._db.open()).transaction(["fs
|
|
183
|
-
return [transaction.objectStore("fs
|
|
182
|
+
const transaction = (await this._db.open()).transaction(["fs-meta", "fs-blob"], readwrite ? "readwrite" : "readonly");
|
|
183
|
+
return [transaction.objectStore("fs-meta"), transaction.objectStore("fs-blob")];
|
|
184
184
|
}
|
|
185
185
|
/**
|
|
186
186
|
* read the fs entries
|
|
187
187
|
* @internal
|
|
188
188
|
*/
|
|
189
189
|
async entries() {
|
|
190
|
-
const metaStore = await this._getIdbObjectStore("fs
|
|
190
|
+
const metaStore = await this._getIdbObjectStore("fs-meta");
|
|
191
191
|
const entries = await promisifyIDBRequest(metaStore.getAll());
|
|
192
192
|
return entries.map(({ url, type }) => [url, type]);
|
|
193
193
|
}
|
|
@@ -196,7 +196,7 @@ var FS = class {
|
|
|
196
196
|
if (url === "file:///") {
|
|
197
197
|
return { type: 2, version: 1, ctime: 0, mtime: 0, size: 0 };
|
|
198
198
|
}
|
|
199
|
-
const metaStore = await this._getIdbObjectStore("fs
|
|
199
|
+
const metaStore = await this._getIdbObjectStore("fs-meta");
|
|
200
200
|
const stat = await promisifyIDBRequest(metaStore.get(url));
|
|
201
201
|
if (!stat) {
|
|
202
202
|
throw new ErrorNotFound(url);
|
|
@@ -206,7 +206,7 @@ var FS = class {
|
|
|
206
206
|
async createDirectory(name) {
|
|
207
207
|
const now = Date.now();
|
|
208
208
|
const { pathname, href: url } = filenameToURL(name);
|
|
209
|
-
const metaStore = await this._getIdbObjectStore("fs
|
|
209
|
+
const metaStore = await this._getIdbObjectStore("fs-meta", true);
|
|
210
210
|
const promises = [];
|
|
211
211
|
const newDirs = [];
|
|
212
212
|
let parent = pathname.slice(0, pathname.lastIndexOf("/"));
|
|
@@ -242,7 +242,7 @@ var FS = class {
|
|
|
242
242
|
if (stat.type !== 2) {
|
|
243
243
|
throw new Error(`read ${pathname}: not a directory`);
|
|
244
244
|
}
|
|
245
|
-
const metaStore = await this._getIdbObjectStore("fs
|
|
245
|
+
const metaStore = await this._getIdbObjectStore("fs-meta");
|
|
246
246
|
const entries = [];
|
|
247
247
|
const dir = "file://" + pathname + (pathname.endsWith("/") ? "" : "/");
|
|
248
248
|
await openIDBCursor(metaStore, IDBKeyRange.lowerBound(dir, true), (cursor) => {
|
|
@@ -260,7 +260,7 @@ var FS = class {
|
|
|
260
260
|
}
|
|
261
261
|
async readFile(name) {
|
|
262
262
|
const url = filenameToURL(name).href;
|
|
263
|
-
const blobStore = await this._getIdbObjectStore("fs
|
|
263
|
+
const blobStore = await this._getIdbObjectStore("fs-blob");
|
|
264
264
|
const file = await promisifyIDBRequest(blobStore.get(url));
|
|
265
265
|
if (!file) {
|
|
266
266
|
throw new ErrorNotFound(url);
|
|
@@ -348,12 +348,12 @@ var FS = class {
|
|
|
348
348
|
if (entries.length > 0) {
|
|
349
349
|
throw new Error(`delete ${url}: directory not empty`);
|
|
350
350
|
}
|
|
351
|
-
const metaStore = await this._getIdbObjectStore("fs
|
|
351
|
+
const metaStore = await this._getIdbObjectStore("fs-meta", true);
|
|
352
352
|
await promisifyIDBRequest(metaStore.delete(url));
|
|
353
353
|
this._notify("remove", pathname, 2);
|
|
354
354
|
}
|
|
355
355
|
} else {
|
|
356
|
-
const metaStore = await this._getIdbObjectStore("fs
|
|
356
|
+
const metaStore = await this._getIdbObjectStore("fs-meta", true);
|
|
357
357
|
await promisifyIDBRequest(metaStore.delete(url));
|
|
358
358
|
this._notify("remove", pathname, stat.type);
|
|
359
359
|
}
|
|
@@ -460,7 +460,7 @@ var ErrorNotFound = class extends Error {
|
|
|
460
460
|
var WorkspaceDatabase = class {
|
|
461
461
|
_db;
|
|
462
462
|
constructor(workspaceName, ...stores) {
|
|
463
|
-
const open = () => openIDB("monaco
|
|
463
|
+
const open = () => openIDB("modern-monaco-workspace/" + workspaceName, 1, ...stores).then((db) => {
|
|
464
464
|
db.onclose = () => {
|
|
465
465
|
this._db = open();
|
|
466
466
|
};
|
|
@@ -494,7 +494,7 @@ var LocalStorageHistory = class {
|
|
|
494
494
|
_handlers = /* @__PURE__ */ new Set();
|
|
495
495
|
constructor(scope, maxHistory = 100) {
|
|
496
496
|
const defaultState = { "current": -1, "history": [] };
|
|
497
|
-
this._state = supportLocalStorage() ? createPersistStateStorage(
|
|
497
|
+
this._state = supportLocalStorage() ? createPersistStateStorage("modern-monaco-workspace-history:" + scope, defaultState) : defaultState;
|
|
498
498
|
this._maxHistory = maxHistory;
|
|
499
499
|
}
|
|
500
500
|
_onPopState() {
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modern-monaco",
|
|
3
3
|
"description": "A modern version of Monaco Editor",
|
|
4
|
-
"version": "0.0.0-beta.
|
|
4
|
+
"version": "0.0.0-beta.2",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
6
7
|
"module": "dist/index.js",
|
|
7
8
|
"types": "types/index.d.ts",
|
|
8
9
|
"exports": {
|
|
@@ -10,6 +11,19 @@
|
|
|
10
11
|
"import": "./dist/index.js",
|
|
11
12
|
"types": "./types/index.d.ts"
|
|
12
13
|
},
|
|
14
|
+
"./core": {
|
|
15
|
+
"import": "./dist/core.js",
|
|
16
|
+
"types": "./types/core.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"./workspace": {
|
|
19
|
+
"import": "./dist/workspace.js",
|
|
20
|
+
"types": "./types/workspace.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./ssr": {
|
|
23
|
+
"workerd": "./dist/ssr/workerd.js",
|
|
24
|
+
"import": "./dist/ssr/index.js",
|
|
25
|
+
"types": "./types/ssr.d.ts"
|
|
26
|
+
},
|
|
13
27
|
"./editor-core": {
|
|
14
28
|
"import": "./dist/editor-core.js",
|
|
15
29
|
"types": "./types/monaco.d.ts"
|
|
@@ -17,10 +31,14 @@
|
|
|
17
31
|
"./editor-worker": {
|
|
18
32
|
"import": "./dist/editor-worker.js"
|
|
19
33
|
},
|
|
20
|
-
"./
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
34
|
+
"./cache": {
|
|
35
|
+
"import": "./dist/cache.js"
|
|
36
|
+
},
|
|
37
|
+
"./shiki": {
|
|
38
|
+
"import": "./dist/shiki.js"
|
|
39
|
+
},
|
|
40
|
+
"./utils": {
|
|
41
|
+
"import": "./dist/utils.js"
|
|
24
42
|
},
|
|
25
43
|
"./lsp/*": {
|
|
26
44
|
"import": "./dist/lsp/*.js"
|
|
@@ -44,15 +62,15 @@
|
|
|
44
62
|
"sideEffects": false,
|
|
45
63
|
"devDependencies": {
|
|
46
64
|
"@esm.sh/import-map": "0.1.1",
|
|
47
|
-
"@shikijs/core": "3.
|
|
48
|
-
"@shikijs/engine-oniguruma": "3.
|
|
65
|
+
"@shikijs/core": "3.9.1",
|
|
66
|
+
"@shikijs/engine-oniguruma": "3.9.1",
|
|
49
67
|
"monaco-editor-core": "0.52.2",
|
|
50
|
-
"tm-grammars": "1.
|
|
51
|
-
"tm-themes": "1.10.
|
|
52
|
-
"typescript": "5.
|
|
53
|
-
"vscode-css-languageservice": "6.3.
|
|
54
|
-
"vscode-html-languageservice": "5.
|
|
55
|
-
"vscode-json-languageservice": "5.
|
|
68
|
+
"tm-grammars": "1.24.1",
|
|
69
|
+
"tm-themes": "1.10.7",
|
|
70
|
+
"typescript": "5.9.2",
|
|
71
|
+
"vscode-css-languageservice": "6.3.7",
|
|
72
|
+
"vscode-html-languageservice": "5.5.1",
|
|
73
|
+
"vscode-json-languageservice": "5.6.1",
|
|
56
74
|
"vscode-languageserver-textdocument": "1.0.12",
|
|
57
75
|
"vscode-languageserver-types": "3.17.5"
|
|
58
76
|
},
|
package/types/core.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export function registerLSPProvider(lang: string, provider: import("./lsp.d.ts").LSPProvider): void;
|
|
2
|
+
export function registerSyntax(...syntaxes: import("./index.d.ts").TextmateGrammar[]): void;
|
|
3
|
+
export function registerTheme(theme: import("./index.d.ts").TextmateTheme): void;
|
|
4
|
+
export * from "./index";
|
package/types/index.d.ts
CHANGED
|
@@ -1,32 +1,51 @@
|
|
|
1
1
|
import type monacoNS from "./monaco.d.ts";
|
|
2
2
|
import type { LSPConfig } from "./lsp.d.ts";
|
|
3
3
|
import type { TextmateGrammarName, TextmateThemeName } from "./textmate.d.ts";
|
|
4
|
-
import type { Workspace } from "./workspace.d.ts";
|
|
4
|
+
import type { ErrorNotFound, Workspace } from "./workspace.d.ts";
|
|
5
5
|
|
|
6
6
|
type Awaitable<T> = T | Promise<T>;
|
|
7
7
|
type MaybeGetter<T> = Awaitable<MaybeModule<T>> | (() => Awaitable<MaybeModule<T>>);
|
|
8
8
|
type MaybeModule<T> = T | { default: T };
|
|
9
9
|
type MaybeArray<T> = T | T[];
|
|
10
|
-
type LanguageInput = MaybeGetter<MaybeArray<
|
|
11
|
-
type ThemeInput = MaybeGetter<
|
|
10
|
+
type LanguageInput = MaybeGetter<MaybeArray<TextmateGrammar>>;
|
|
11
|
+
type ThemeInput = MaybeGetter<TextmateTheme>;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
export type TextmateGrammar = {
|
|
14
14
|
name: string;
|
|
15
|
-
|
|
15
|
+
scopeName: string;
|
|
16
|
+
displayName?: string;
|
|
17
|
+
foldingStartMarker?: string;
|
|
18
|
+
foldingStopMarker?: string;
|
|
19
|
+
injectionSelector?: string;
|
|
20
|
+
injectTo?: string[];
|
|
21
|
+
injections?: Record<string, any>;
|
|
22
|
+
patterns: any[];
|
|
23
|
+
repository?: Record<string, any>;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type TextmateTheme = {
|
|
27
|
+
type?: "dark" | "light";
|
|
28
|
+
name: string;
|
|
29
|
+
displayName?: string;
|
|
30
|
+
colors?: Record<string, string>;
|
|
31
|
+
tokenColors?: any[];
|
|
32
|
+
semanticTokenColors?: Record<string, string>;
|
|
33
|
+
semanticHighlighting?: boolean;
|
|
34
|
+
};
|
|
16
35
|
|
|
17
36
|
export interface ShikiInitOptions {
|
|
18
37
|
/**
|
|
19
38
|
* Theme names, or theme registration objects to be loaded upfront.
|
|
20
39
|
*/
|
|
21
|
-
theme?: TextmateThemeName | URL | ThemeInput;
|
|
40
|
+
theme?: TextmateThemeName | (string & {}) | URL | ThemeInput;
|
|
22
41
|
/**
|
|
23
42
|
* Language names, or language registration objects to be loaded upfront.
|
|
24
43
|
*/
|
|
25
|
-
langs?: (TextmateGrammarName | URL | LanguageInput)[];
|
|
44
|
+
langs?: (TextmateGrammarName | (string & {}) | URL | LanguageInput)[];
|
|
26
45
|
/**
|
|
27
46
|
* The CDN base URL to download themes and languages from. Default: "https://esm.sh".
|
|
28
47
|
*/
|
|
29
|
-
|
|
48
|
+
tmDownloadCDN?: string;
|
|
30
49
|
}
|
|
31
50
|
|
|
32
51
|
export interface InitOptions extends ShikiInitOptions {
|
|
@@ -44,4 +63,8 @@ export function init(options?: InitOptions): Promise<typeof monacoNS>;
|
|
|
44
63
|
export function lazy(options?: InitOptions): void;
|
|
45
64
|
export function hydrate(options?: InitOptions): void;
|
|
46
65
|
|
|
66
|
+
export const errors: {
|
|
67
|
+
NotFound: ErrorNotFound;
|
|
68
|
+
};
|
|
69
|
+
|
|
47
70
|
export { Workspace };
|
package/types/jsonSchema.d.ts
CHANGED
|
@@ -77,6 +77,8 @@ export interface JSONSchema {
|
|
|
77
77
|
patternErrorMessage?: string;
|
|
78
78
|
deprecationMessage?: string;
|
|
79
79
|
enumDescriptions?: string[];
|
|
80
|
+
enumSortTexts?: string[];
|
|
81
|
+
enumDetails?: string[];
|
|
80
82
|
markdownEnumDescriptions?: string[];
|
|
81
83
|
markdownDescription?: string;
|
|
82
84
|
doNotSuggest?: boolean;
|
package/types/lsp.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type ts from "typescript";
|
|
2
2
|
import type monacoNS from "./monaco.d.ts";
|
|
3
|
-
import type { ImportMap } from "./import-map.d.ts";
|
|
4
3
|
import type { JSONSchema } from "./jsonSchema.d.ts";
|
|
5
4
|
import type { Workspace } from "./workspace.d.ts";
|
|
6
5
|
|
|
6
|
+
/** The import maps follow the spec at https://wicg.github.io/import-maps/. */
|
|
7
|
+
export interface ImportMap {
|
|
8
|
+
imports: Record<string, string>;
|
|
9
|
+
scopes: Record<string, Record<string, string>>;
|
|
10
|
+
}
|
|
11
|
+
|
|
7
12
|
export interface FormatOptions {
|
|
8
13
|
/** Size of a tab in spaces. Default: 4. */
|
|
9
14
|
tabSize?: number;
|
|
@@ -92,6 +97,7 @@ declare global {
|
|
|
92
97
|
};
|
|
93
98
|
css?: {};
|
|
94
99
|
json?: {
|
|
100
|
+
/** JSON schemas for JSON language service. */
|
|
95
101
|
schemas?: JSONSchemaSource[];
|
|
96
102
|
};
|
|
97
103
|
typescript?: {
|
package/types/ssr.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type monacoNS from "./monaco.d.ts";
|
|
2
2
|
import type { ShikiInitOptions } from "./index.d.ts";
|
|
3
3
|
|
|
4
|
+
export type RenderInput = string | { filename: string; code: string };
|
|
5
|
+
|
|
4
6
|
export interface RenderOptions extends monacoNS.editor.IStandaloneEditorConstructionOptions {
|
|
5
|
-
code: string;
|
|
6
7
|
filename?: string;
|
|
7
|
-
|
|
8
|
+
fontDigitWidth?: number;
|
|
8
9
|
userAgent?: string;
|
|
9
|
-
fontAspectRatio?: number;
|
|
10
10
|
shiki?: ShikiInitOptions;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export function renderToString(options: RenderOptions): Promise<string>;
|
|
14
|
-
export function renderToWebComponent(options: RenderOptions): Promise<string>;
|
|
13
|
+
export function renderToString(code: RenderInput, options: RenderOptions): Promise<string>;
|
|
14
|
+
export function renderToWebComponent(code: RenderInput, options: RenderOptions): Promise<string>;
|
package/types/textmate.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export type TextmateThemeName = "andromeeda" | "aurora-x" | "ayu-dark" | "catppuccin-frappe" | "catppuccin-latte" | "catppuccin-macchiato" | "catppuccin-mocha" | "dark-plus" | "dracula" | "dracula-soft" | "everforest-dark" | "everforest-light" | "github-dark" | "github-dark-default" | "github-dark-dimmed" | "github-dark-high-contrast" | "github-light" | "github-light-default" | "github-light-high-contrast" | "gruvbox-dark-hard" | "gruvbox-dark-medium" | "gruvbox-dark-soft" | "gruvbox-light-hard" | "gruvbox-light-medium" | "gruvbox-light-soft" | "houston" | "kanagawa-dragon" | "kanagawa-lotus" | "kanagawa-wave" | "laserwave" | "light-plus" | "material-theme" | "material-theme-darker" | "material-theme-lighter" | "material-theme-ocean" | "material-theme-palenight" | "min-dark" | "min-light" | "monokai" | "night-owl" | "nord" | "one-dark-pro" | "one-light" | "plastic" | "poimandres" | "red" | "rose-pine" | "rose-pine-dawn" | "rose-pine-moon" | "slack-dark" | "slack-ochin" | "snazzy-light" | "solarized-dark" | "solarized-light" | "synthwave-84" | "tokyo-night" | "vesper" | "vitesse-black" | "vitesse-dark" | "vitesse-light";
|
|
2
|
-
export type TextmateGrammarName = "abap" | "actionscript-3" | "ada" | "angular-html" | "angular-ts" | "apache" | "apex" | "apl" | "applescript" | "ara" | "asciidoc" | "asm" | "astro" | "awk" | "ballerina" | "bat" | "beancount" | "berry" | "bibtex" | "bicep" | "blade" | "bsl" | "c" | "cadence" | "cairo" | "clarity" | "clojure" | "cmake" | "cobol" | "codeowners" | "codeql" | "coffee" | "common-lisp" | "coq" | "cpp" | "crystal" | "csharp" | "css" | "csv" | "cue" | "cypher" | "d" | "dart" | "dax" | "desktop" | "diff" | "docker" | "dotenv" | "dream-maker" | "edge" | "elixir" | "elm" | "emacs-lisp" | "erb" | "erlang" | "fennel" | "fish" | "fluent" | "fortran-fixed-form" | "fortran-free-form" | "fsharp" | "gdresource" | "gdscript" | "gdshader" | "genie" | "gherkin" | "git-commit" | "git-rebase" | "gleam" | "glimmer-js" | "glimmer-ts" | "glsl" | "gnuplot" | "go" | "graphql" | "groovy" | "hack" | "haml" | "handlebars" | "haskell" | "haxe" | "hcl" | "hjson" | "hlsl" | "html" | "html-derivative" | "http" | "hxml" | "hy" | "imba" | "ini" | "java" | "javascript" | "jinja" | "jison" | "json" | "json5" | "jsonc" | "jsonl" | "jsonnet" | "jssm" | "jsx" | "julia" | "kotlin" | "kusto" | "latex" | "lean" | "less" | "liquid" | "llvm" | "log" | "logo" | "lua" | "luau" | "make" | "markdown" | "marko" | "matlab" | "mdc" | "mdx" | "mermaid" | "mipsasm" | "mojo" | "move" | "narrat" | "nextflow" | "nginx" | "nim" | "nix" | "nushell" | "objective-c" | "objective-cpp" | "ocaml" | "pascal" | "perl" | "php" | "plsql" | "po" | "polar" | "postcss" | "powerquery" | "powershell" | "prisma" | "prolog" | "proto" | "pug" | "puppet" | "purescript" | "python" | "qml" | "qmldir" | "qss" | "r" | "racket" | "raku" | "razor" | "reg" | "regexp" | "rel" | "riscv" | "rst" | "ruby" | "rust" | "sas" | "sass" | "scala" | "scheme" | "scss" | "sdbl" | "shaderlab" | "shellscript" | "shellsession" | "smalltalk" | "solidity" | "soy" | "sparql" | "splunk" | "sql" | "ssh-config" | "stata" | "stylus" | "svelte" | "swift" | "system-verilog" | "systemd" | "talonscript" | "tasl" | "tcl" | "templ" | "terraform" | "tex" | "toml" | "ts-tags" | "tsv" | "tsx" | "turtle" | "twig" | "typescript" | "typespec" | "typst" | "v" | "vala" | "vb" | "verilog" | "vhdl" | "viml" | "vue" | "vue-html" | "vyper" | "wasm" | "wenyan" | "wgsl" | "wikitext" | "wit" | "wolfram" | "xml" | "xsl" | "yaml" | "zenscript" | "zig";
|
|
2
|
+
export type TextmateGrammarName = "abap" | "actionscript-3" | "ada" | "angular-html" | "angular-ts" | "apache" | "apex" | "apl" | "applescript" | "ara" | "asciidoc" | "asm" | "astro" | "awk" | "ballerina" | "bat" | "beancount" | "berry" | "bibtex" | "bicep" | "blade" | "bsl" | "c" | "cadence" | "cairo" | "clarity" | "clojure" | "cmake" | "cobol" | "codeowners" | "codeql" | "coffee" | "common-lisp" | "coq" | "cpp" | "crystal" | "csharp" | "css" | "csv" | "cue" | "cypher" | "d" | "dart" | "dax" | "desktop" | "diff" | "docker" | "dotenv" | "dream-maker" | "edge" | "elixir" | "elm" | "emacs-lisp" | "erb" | "erlang" | "fennel" | "fish" | "fluent" | "fortran-fixed-form" | "fortran-free-form" | "fsharp" | "gdresource" | "gdscript" | "gdshader" | "genie" | "gherkin" | "git-commit" | "git-rebase" | "gleam" | "glimmer-js" | "glimmer-ts" | "glsl" | "gnuplot" | "go" | "graphql" | "groovy" | "hack" | "haml" | "handlebars" | "haskell" | "haxe" | "hcl" | "hjson" | "hlsl" | "html" | "html-derivative" | "http" | "hxml" | "hy" | "imba" | "ini" | "java" | "javascript" | "jinja" | "jison" | "json" | "json5" | "jsonc" | "jsonl" | "jsonnet" | "jssm" | "jsx" | "julia" | "kotlin" | "kusto" | "latex" | "lean" | "less" | "liquid" | "llvm" | "log" | "logo" | "lua" | "luau" | "make" | "markdown" | "marko" | "matlab" | "mdc" | "mdx" | "mermaid" | "mipsasm" | "mojo" | "move" | "narrat" | "nextflow" | "nginx" | "nim" | "nix" | "nushell" | "objective-c" | "objective-cpp" | "ocaml" | "pascal" | "perl" | "php" | "plsql" | "po" | "polar" | "postcss" | "powerquery" | "powershell" | "prisma" | "prolog" | "proto" | "pug" | "puppet" | "purescript" | "python" | "qml" | "qmldir" | "qss" | "r" | "racket" | "raku" | "razor" | "reg" | "regexp" | "rel" | "riscv" | "rst" | "ruby" | "rust" | "sas" | "sass" | "scala" | "scheme" | "scss" | "sdbl" | "shaderlab" | "shellscript" | "shellsession" | "smalltalk" | "solidity" | "soy" | "sparql" | "splunk" | "sql" | "ssh-config" | "stata" | "stylus" | "svelte" | "swift" | "system-verilog" | "systemd" | "talonscript" | "tasl" | "tcl" | "templ" | "terraform" | "tex" | "toml" | "ts-tags" | "tsv" | "tsx" | "turtle" | "twig" | "typescript" | "typespec" | "typst" | "v" | "vala" | "vb" | "verilog" | "vhdl" | "viml" | "vue" | "vue-html" | "vue-vine" | "vyper" | "wasm" | "wenyan" | "wgsl" | "wikitext" | "wit" | "wolfram" | "xml" | "xsl" | "yaml" | "zenscript" | "zig";
|