@ternarytech-io/gears-ui 0.6.0 → 0.6.1
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/package.json +1 -1
- package/src/monaco.ts +38 -27
package/package.json
CHANGED
package/src/monaco.ts
CHANGED
|
@@ -1,27 +1,38 @@
|
|
|
1
|
-
// Monaco, set up once: bundled web workers (no CDN; Gears may run offline) and light and dark
|
|
2
|
-
// themes on the Gears palette. TCodeEditor loads this the first time an editor is shown, so apps
|
|
3
|
-
// that never show one don't download Monaco.
|
|
4
|
-
import * as monaco from 'monaco-editor'
|
|
5
|
-
import EditorWorker from 'monaco-editor/editor/editor.worker?worker'
|
|
6
|
-
import JsonWorker from 'monaco-editor/languages/features/json/json.worker?worker'
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
// Monaco, set up once: bundled web workers (no CDN; Gears may run offline) and light and dark
|
|
2
|
+
// themes on the Gears palette. TCodeEditor loads this the first time an editor is shown, so apps
|
|
3
|
+
// that never show one don't download Monaco.
|
|
4
|
+
import * as monaco from 'monaco-editor'
|
|
5
|
+
import EditorWorker from 'monaco-editor/editor/editor.worker?worker'
|
|
6
|
+
import JsonWorker from 'monaco-editor/languages/features/json/json.worker?worker'
|
|
7
|
+
import CssWorker from 'monaco-editor/languages/features/css/css.worker?worker'
|
|
8
|
+
import HtmlWorker from 'monaco-editor/languages/features/html/html.worker?worker'
|
|
9
|
+
import TsWorker from 'monaco-editor/languages/features/typescript/ts.worker?worker'
|
|
10
|
+
|
|
11
|
+
// Each language service has its own worker (the editor's can't answer an HTML or CSS editor's
|
|
12
|
+
// requests); each loads only when an editor in its language is shown.
|
|
13
|
+
self.MonacoEnvironment = {
|
|
14
|
+
getWorker(_id: string, label: string) {
|
|
15
|
+
switch (label) {
|
|
16
|
+
case 'json': return new JsonWorker()
|
|
17
|
+
case 'css': case 'scss': case 'less': return new CssWorker()
|
|
18
|
+
case 'html': case 'handlebars': case 'razor': return new HtmlWorker()
|
|
19
|
+
case 'typescript': case 'javascript': return new TsWorker()
|
|
20
|
+
default: return new EditorWorker()
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
monaco.editor.defineTheme('gears-light', {
|
|
26
|
+
base: 'vs',
|
|
27
|
+
inherit: true,
|
|
28
|
+
rules: [],
|
|
29
|
+
colors: { 'editor.background': '#ffffff', 'editorLineNumber.foreground': '#a2a8b1', 'editor.lineHighlightBackground': '#f6f7f9' }
|
|
30
|
+
})
|
|
31
|
+
monaco.editor.defineTheme('gears-dark', {
|
|
32
|
+
base: 'vs-dark',
|
|
33
|
+
inherit: true,
|
|
34
|
+
rules: [],
|
|
35
|
+
colors: { 'editor.background': '#232525', 'editorLineNumber.foreground': '#5d6470', 'editor.lineHighlightBackground': '#2c2f2f' }
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
export default monaco
|