modern-monaco 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.mjs +8 -8
- package/dist/editor-core.mjs +1 -3
- package/dist/index.mjs +8 -8
- package/dist/shiki-wasm.mjs +1 -1
- package/dist/shiki.mjs +55 -13
- package/dist/util.mjs +0 -9
- package/dist/workspace.mjs +12 -17
- package/package.json +5 -5
- package/types/textmate.d.ts +1 -1
package/dist/core.mjs
CHANGED
|
@@ -40,7 +40,7 @@ function isObject(v) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
// package.json
|
|
43
|
-
var version = "0.3.
|
|
43
|
+
var version = "0.3.3";
|
|
44
44
|
|
|
45
45
|
// src/core.ts
|
|
46
46
|
import { getExtnameFromLanguageId, getLanguageIdFromPath, grammars, initShiki, setDefaultWasmLoader, themes } from "./shiki.mjs";
|
|
@@ -48,7 +48,7 @@ import { initShikiMonacoTokenizer, registerShikiMonacoTokenizer } from "./shiki.
|
|
|
48
48
|
import { render } from "./shiki.mjs";
|
|
49
49
|
import { getWasmInstance } from "./shiki-wasm.mjs";
|
|
50
50
|
import { NotFoundError, Workspace } from "./workspace.mjs";
|
|
51
|
-
import { debunce, decode,
|
|
51
|
+
import { debunce, decode, isDigital } from "./util.mjs";
|
|
52
52
|
var editorProps = [
|
|
53
53
|
"autoDetectHighContrast",
|
|
54
54
|
"automaticLayout",
|
|
@@ -90,7 +90,7 @@ var setStyle = (el, style) => Object.assign(el.style, style);
|
|
|
90
90
|
async function init(options) {
|
|
91
91
|
const langs = (options?.langs ?? []).concat(syntaxes);
|
|
92
92
|
const shiki = await initShiki({ ...options, langs });
|
|
93
|
-
return loadMonaco(shiki, options?.workspace, options?.lsp
|
|
93
|
+
return loadMonaco(shiki, options?.workspace, options?.lsp);
|
|
94
94
|
}
|
|
95
95
|
function lazy(options) {
|
|
96
96
|
if (!customElements.get("monaco-editor")) {
|
|
@@ -216,7 +216,6 @@ function lazy(options) {
|
|
|
216
216
|
theme = theme.toLowerCase().replace(/ +/g, "-");
|
|
217
217
|
}
|
|
218
218
|
const highlighter = await initShiki({ ...options, theme, langs });
|
|
219
|
-
renderOptions.theme = highlighter.getLoadedThemes()[0];
|
|
220
219
|
let prerenderEl;
|
|
221
220
|
for (const el of this.children) {
|
|
222
221
|
if (el.className === "monaco-editor-prerender") {
|
|
@@ -253,7 +252,7 @@ function lazy(options) {
|
|
|
253
252
|
}
|
|
254
253
|
}
|
|
255
254
|
{
|
|
256
|
-
const monaco = await (monacoPromise ?? (monacoPromise = loadMonaco(highlighter, workspace, options?.lsp
|
|
255
|
+
const monaco = await (monacoPromise ?? (monacoPromise = loadMonaco(highlighter, workspace, options?.lsp)));
|
|
257
256
|
const editor = monaco.editor.create(containerEl, renderOptions);
|
|
258
257
|
if (workspace) {
|
|
259
258
|
const storeViewState = () => {
|
|
@@ -327,9 +326,10 @@ function lazy(options) {
|
|
|
327
326
|
function hydrate(options) {
|
|
328
327
|
return lazy(options);
|
|
329
328
|
}
|
|
330
|
-
async function loadMonaco(highlighter, workspace, lsp
|
|
331
|
-
let
|
|
332
|
-
let
|
|
329
|
+
async function loadMonaco(highlighter, workspace, lsp) {
|
|
330
|
+
let cdnUrl = `https://esm.sh/modern-monaco@${version}`;
|
|
331
|
+
let editorCoreModuleUrl = `${cdnUrl}/es2022/editor-core.mjs`;
|
|
332
|
+
let lspModuleUrl = `${cdnUrl}/es2022/lsp.mjs`;
|
|
333
333
|
let importmapEl = null;
|
|
334
334
|
if (importmapEl = document.querySelector("script[type='importmap']")) {
|
|
335
335
|
try {
|
package/dist/editor-core.mjs
CHANGED
|
@@ -200145,9 +200145,7 @@ var defaultEditorOptions = {
|
|
|
200145
200145
|
automaticLayout: true,
|
|
200146
200146
|
minimap: { enabled: false },
|
|
200147
200147
|
stickyScroll: { enabled: false },
|
|
200148
|
-
scrollBeyondLastLine: false
|
|
200149
|
-
matchBrackets: "never",
|
|
200150
|
-
theme: "vitesse-dark"
|
|
200148
|
+
scrollBeyondLastLine: false
|
|
200151
200149
|
};
|
|
200152
200150
|
var { create: create3, createModel: createModel2, getModel: getModel2 } = editor;
|
|
200153
200151
|
Object.assign(editor, {
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// node_modules/.pnpm/tm-themes@1.10.
|
|
1
|
+
// node_modules/.pnpm/tm-themes@1.10.13/node_modules/tm-themes/themes/vitesse-dark.json
|
|
2
2
|
var vitesse_dark_default = {
|
|
3
3
|
colors: {
|
|
4
4
|
"activityBar.activeBorder": "#4d9375",
|
|
@@ -693,7 +693,7 @@ var vitesse_dark_default = {
|
|
|
693
693
|
type: "dark"
|
|
694
694
|
};
|
|
695
695
|
|
|
696
|
-
// node_modules/.pnpm/tm-grammars@1.
|
|
696
|
+
// node_modules/.pnpm/tm-grammars@1.26.0/node_modules/tm-grammars/grammars/html.json
|
|
697
697
|
var html_default = {
|
|
698
698
|
displayName: "HTML",
|
|
699
699
|
injections: {
|
|
@@ -3322,7 +3322,7 @@ var html_default = {
|
|
|
3322
3322
|
scopeName: "text.html.basic"
|
|
3323
3323
|
};
|
|
3324
3324
|
|
|
3325
|
-
// node_modules/.pnpm/tm-grammars@1.
|
|
3325
|
+
// node_modules/.pnpm/tm-grammars@1.26.0/node_modules/tm-grammars/grammars/css.json
|
|
3326
3326
|
var css_default = {
|
|
3327
3327
|
displayName: "CSS",
|
|
3328
3328
|
name: "css",
|
|
@@ -5184,7 +5184,7 @@ var css_default = {
|
|
|
5184
5184
|
scopeName: "source.css"
|
|
5185
5185
|
};
|
|
5186
5186
|
|
|
5187
|
-
// node_modules/.pnpm/tm-grammars@1.
|
|
5187
|
+
// node_modules/.pnpm/tm-grammars@1.26.0/node_modules/tm-grammars/grammars/javascript.json
|
|
5188
5188
|
var javascript_default = {
|
|
5189
5189
|
displayName: "JavaScript",
|
|
5190
5190
|
name: "javascript",
|
|
@@ -11182,7 +11182,7 @@ var javascript_default = {
|
|
|
11182
11182
|
scopeName: "source.js"
|
|
11183
11183
|
};
|
|
11184
11184
|
|
|
11185
|
-
// node_modules/.pnpm/tm-grammars@1.
|
|
11185
|
+
// node_modules/.pnpm/tm-grammars@1.26.0/node_modules/tm-grammars/grammars/typescript.json
|
|
11186
11186
|
var typescript_default = {
|
|
11187
11187
|
displayName: "TypeScript",
|
|
11188
11188
|
name: "typescript",
|
|
@@ -16931,7 +16931,7 @@ var typescript_default = {
|
|
|
16931
16931
|
scopeName: "source.ts"
|
|
16932
16932
|
};
|
|
16933
16933
|
|
|
16934
|
-
// node_modules/.pnpm/tm-grammars@1.
|
|
16934
|
+
// node_modules/.pnpm/tm-grammars@1.26.0/node_modules/tm-grammars/grammars/jsx.json
|
|
16935
16935
|
var jsx_default = {
|
|
16936
16936
|
displayName: "JSX",
|
|
16937
16937
|
name: "jsx",
|
|
@@ -22929,7 +22929,7 @@ var jsx_default = {
|
|
|
22929
22929
|
scopeName: "source.js.jsx"
|
|
22930
22930
|
};
|
|
22931
22931
|
|
|
22932
|
-
// node_modules/.pnpm/tm-grammars@1.
|
|
22932
|
+
// node_modules/.pnpm/tm-grammars@1.26.0/node_modules/tm-grammars/grammars/tsx.json
|
|
22933
22933
|
var tsx_default = {
|
|
22934
22934
|
displayName: "TSX",
|
|
22935
22935
|
name: "tsx",
|
|
@@ -28927,7 +28927,7 @@ var tsx_default = {
|
|
|
28927
28927
|
scopeName: "source.tsx"
|
|
28928
28928
|
};
|
|
28929
28929
|
|
|
28930
|
-
// node_modules/.pnpm/tm-grammars@1.
|
|
28930
|
+
// node_modules/.pnpm/tm-grammars@1.26.0/node_modules/tm-grammars/grammars/json.json
|
|
28931
28931
|
var json_default = {
|
|
28932
28932
|
displayName: "JSON",
|
|
28933
28933
|
name: "json",
|