windmill-components 1.383.6 → 1.383.9
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/components/DiffEditor.svelte +8 -0
- package/package/components/Editor.svelte +119 -123
- package/package/components/ScriptEditor.svelte +1 -0
- package/package/components/SimpleEditor.svelte +48 -35
- package/package/components/SimpleEditor.svelte.d.ts +4 -0
- package/package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +1 -0
- package/package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte +2 -1
- package/package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte.d.ts +1 -0
- package/package/components/build_workers.d.ts +1 -1
- package/package/components/build_workers.js +21 -130
- package/package/components/flows/content/FlowModuleComponent.svelte +1 -0
- package/package/components/vscode.js +1 -1
- package/package/scripts.d.ts +1 -1
- package/package/scripts.js +1 -1
- package/package.json +6 -3
|
@@ -42,8 +42,12 @@ async function loadDiffEditor() {
|
|
|
42
42
|
if (defaultOriginal !== undefined &&
|
|
43
43
|
defaultModified !== undefined &&
|
|
44
44
|
defaultLang !== undefined) {
|
|
45
|
+
console.log('SETUP');
|
|
45
46
|
setupModel(defaultLang, defaultOriginal, defaultModified, defaultModifiedLang);
|
|
46
47
|
}
|
|
48
|
+
else {
|
|
49
|
+
console.log('NO SETUP', defaultOriginal, defaultModified, defaultLang);
|
|
50
|
+
}
|
|
47
51
|
}
|
|
48
52
|
export function setupModel(lang, original, modified, modifiedLang) {
|
|
49
53
|
diffEditor?.setModel({
|
|
@@ -58,18 +62,22 @@ export function setupModel(lang, original, modified, modifiedLang) {
|
|
|
58
62
|
}
|
|
59
63
|
}
|
|
60
64
|
export function setOriginal(code) {
|
|
65
|
+
console.log('setOriginal', code);
|
|
61
66
|
diffEditor?.getModel()?.original?.setValue(code);
|
|
67
|
+
defaultOriginal = code;
|
|
62
68
|
}
|
|
63
69
|
export function getOriginal() {
|
|
64
70
|
return diffEditor?.getModel()?.original.getValue() ?? '';
|
|
65
71
|
}
|
|
66
72
|
export function setModified(code) {
|
|
67
73
|
diffEditor?.getModel()?.modified?.setValue(code);
|
|
74
|
+
defaultModified = code;
|
|
68
75
|
}
|
|
69
76
|
export function getModified() {
|
|
70
77
|
return diffEditor?.getModel()?.modified.getValue() ?? '';
|
|
71
78
|
}
|
|
72
79
|
export function show() {
|
|
80
|
+
console.log('show');
|
|
73
81
|
open = true;
|
|
74
82
|
}
|
|
75
83
|
export function hide() {
|
|
@@ -1,20 +1,117 @@
|
|
|
1
1
|
<!-- <script lang="ts"></script> -->
|
|
2
2
|
|
|
3
|
+
<script context="module">
|
|
4
|
+
import '@codingame/monaco-vscode-standalone-languages'
|
|
5
|
+
import '@codingame/monaco-vscode-standalone-typescript-language-features'
|
|
6
|
+
|
|
7
|
+
import processStdContent from '../process.d.ts.txt?raw'
|
|
8
|
+
import windmillFetchContent from '../windmill_fetch.d.ts.txt?raw'
|
|
9
|
+
|
|
10
|
+
languages.typescript.typescriptDefaults.addExtraLib(processStdContent, 'process.d.ts')
|
|
11
|
+
|
|
12
|
+
// languages.typescript.javascriptDefaults.setModeConfiguration({
|
|
13
|
+
// completionItems: true,
|
|
14
|
+
// hovers: true,
|
|
15
|
+
// documentSymbols: true,
|
|
16
|
+
// definitions: true,
|
|
17
|
+
// references: true,
|
|
18
|
+
// documentHighlights: true,
|
|
19
|
+
// rename: true,
|
|
20
|
+
// diagnostics: true,
|
|
21
|
+
// documentRangeFormattingEdits: true,
|
|
22
|
+
// signatureHelp: true,
|
|
23
|
+
// onTypeFormattingEdits: true,
|
|
24
|
+
// codeActions: true,
|
|
25
|
+
// inlayHints: true
|
|
26
|
+
// })
|
|
27
|
+
|
|
28
|
+
languages.typescript.typescriptDefaults.setModeConfiguration({
|
|
29
|
+
completionItems: true,
|
|
30
|
+
hovers: true,
|
|
31
|
+
documentSymbols: true,
|
|
32
|
+
definitions: true,
|
|
33
|
+
references: true,
|
|
34
|
+
documentHighlights: true,
|
|
35
|
+
rename: true,
|
|
36
|
+
diagnostics: true,
|
|
37
|
+
documentRangeFormattingEdits: true,
|
|
38
|
+
signatureHelp: true,
|
|
39
|
+
onTypeFormattingEdits: true,
|
|
40
|
+
codeActions: true,
|
|
41
|
+
inlayHints: true
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
// languages.typescript.javascriptDefaults.setEagerModelSync(true)
|
|
45
|
+
languages.typescript.typescriptDefaults.setEagerModelSync(true)
|
|
46
|
+
|
|
47
|
+
// languages.typescript.javascriptDefaults.setDiagnosticsOptions({
|
|
48
|
+
// noSemanticValidation: false,
|
|
49
|
+
// noSyntaxValidation: false,
|
|
50
|
+
// noSuggestionDiagnostics: false,
|
|
51
|
+
// diagnosticCodesToIgnore: [1108]
|
|
52
|
+
// })
|
|
53
|
+
|
|
54
|
+
languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
|
55
|
+
noSemanticValidation: false,
|
|
56
|
+
noSyntaxValidation: false,
|
|
57
|
+
noSuggestionDiagnostics: false,
|
|
58
|
+
diagnosticCodesToIgnore: [1108]
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
languages.typescript.typescriptDefaults.setCompilerOptions({
|
|
62
|
+
target: languages.typescript.ScriptTarget.Latest,
|
|
63
|
+
allowNonTsExtensions: true,
|
|
64
|
+
noSemanticValidation: false,
|
|
65
|
+
noSyntaxValidation: false,
|
|
66
|
+
completionItems: true,
|
|
67
|
+
hovers: true,
|
|
68
|
+
documentSymbols: true,
|
|
69
|
+
definitions: true,
|
|
70
|
+
references: true,
|
|
71
|
+
documentHighlights: true,
|
|
72
|
+
rename: true,
|
|
73
|
+
diagnostics: true,
|
|
74
|
+
documentRangeFormattingEdits: true,
|
|
75
|
+
signatureHelp: true,
|
|
76
|
+
onTypeFormattingEdits: true,
|
|
77
|
+
codeActions: true,
|
|
78
|
+
inlayHints: true,
|
|
79
|
+
checkJs: true,
|
|
80
|
+
allowJs: true,
|
|
81
|
+
noUnusedLocals: true,
|
|
82
|
+
strict: true,
|
|
83
|
+
noLib: false,
|
|
84
|
+
allowImportingTsExtensions: true,
|
|
85
|
+
moduleResolution: languages.typescript.ModuleResolutionKind.NodeJs
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
// languages.typescript.javascriptDefaults.setCompilerOptions({
|
|
89
|
+
// target: languages.typescript.ScriptTarget.Latest,
|
|
90
|
+
// allowNonTsExtensions: true,
|
|
91
|
+
// noSemanticValidation: false,
|
|
92
|
+
// noSyntaxValidation: false,
|
|
93
|
+
// allowImportingTsExtensions: true,
|
|
94
|
+
// checkJs: true,
|
|
95
|
+
// allowJs: true,
|
|
96
|
+
// noUnusedParameters: true,
|
|
97
|
+
// noUnusedLocals: true,
|
|
98
|
+
// strict: true,
|
|
99
|
+
// noLib: true,
|
|
100
|
+
// moduleResolution: languages.typescript.ModuleResolutionKind.NodeJs
|
|
101
|
+
// })
|
|
102
|
+
</script>
|
|
103
|
+
|
|
3
104
|
<script>import { BROWSER } from 'esm-env';
|
|
4
105
|
import { sendUserToast } from '../toast';
|
|
5
106
|
import { createEventDispatcher, onDestroy, onMount } from 'svelte';
|
|
6
|
-
import libStdContent from '../es6.d.ts.txt?raw'
|
|
7
|
-
import domContent from '../dom.d.ts.txt?raw'
|
|
8
|
-
import denoFetchContent from '../deno_fetch.d.ts.txt?raw'
|
|
9
|
-
import '@codingame/monaco-vscode-standalone-languages';
|
|
10
|
-
import '@codingame/monaco-vscode-standalone-typescript-language-features';
|
|
107
|
+
// import libStdContent from '../es6.d.ts.txt?raw'
|
|
108
|
+
// import domContent from '../dom.d.ts.txt?raw'
|
|
109
|
+
// import denoFetchContent from '../deno_fetch.d.ts.txt?raw'
|
|
11
110
|
import * as vscode from 'vscode';
|
|
12
111
|
// import '@codingame/monaco-vscode-typescript-basics-default-extension'
|
|
13
112
|
// import '@codingame/monaco-vscode-typescript-language-features-default-extension'
|
|
14
113
|
// import 'vscode/localExtensionHost'
|
|
15
|
-
import
|
|
16
|
-
import windmillFetchContent from '../windmill_fetch.d.ts.txt?raw';
|
|
17
|
-
import { MonacoLanguageClient } from '@windmill-labs/monaco-languageclient';
|
|
114
|
+
import { MonacoLanguageClient } from 'monaco-languageclient';
|
|
18
115
|
import { toSocket, WebSocketMessageReader, WebSocketMessageWriter } from 'vscode-ws-jsonrpc';
|
|
19
116
|
import { CloseAction, ErrorAction, RequestType } from 'vscode-languageclient';
|
|
20
117
|
import { MonacoBinding } from 'y-monaco';
|
|
@@ -24,7 +121,7 @@ import { buildWorkerDefinition } from './build_workers';
|
|
|
24
121
|
import { workspaceStore } from '../stores';
|
|
25
122
|
import { UserService } from '../gen';
|
|
26
123
|
import { initializeVscode } from './vscode';
|
|
27
|
-
|
|
124
|
+
import { initializeMode } from 'monaco-graphql/esm/initializeMode.js';
|
|
28
125
|
import { sleep } from '../utils';
|
|
29
126
|
import { editorCodeCompletion } from './copilot/completion';
|
|
30
127
|
import { editor as meditor, languages, KeyCode, KeyMod, Uri as mUri } from 'monaco-editor';
|
|
@@ -88,7 +185,6 @@ const uri = lang != 'go' && lang != 'typescript' && lang != 'python'
|
|
|
88
185
|
: `file:///tmp/monaco/${randomHash()}.${langToExt(lang)}`;
|
|
89
186
|
console.log('uri', uri);
|
|
90
187
|
buildWorkerDefinition('../../../workers', import.meta.url, false);
|
|
91
|
-
// buildWorkerDefinition()
|
|
92
188
|
export function getCode() {
|
|
93
189
|
return editor?.getValue() ?? '';
|
|
94
190
|
}
|
|
@@ -281,13 +377,13 @@ function addDBSchemaCompletions() {
|
|
|
281
377
|
return;
|
|
282
378
|
}
|
|
283
379
|
if (schemaLang === 'graphql') {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
380
|
+
graphqlService ||= initializeMode();
|
|
381
|
+
graphqlService?.setSchemaConfig([
|
|
382
|
+
{
|
|
383
|
+
uri: 'my-schema.graphql',
|
|
384
|
+
introspectionJSON: schema
|
|
385
|
+
}
|
|
386
|
+
]);
|
|
291
387
|
}
|
|
292
388
|
else {
|
|
293
389
|
if (sqlSchemaCompletor) {
|
|
@@ -772,91 +868,6 @@ async function loadMonaco() {
|
|
|
772
868
|
// console.log('bef ready')
|
|
773
869
|
// console.log('af ready')
|
|
774
870
|
initialized = true;
|
|
775
|
-
languages.typescript.typescriptDefaults.addExtraLib(processStdContent, 'process.d.ts');
|
|
776
|
-
languages.typescript.javascriptDefaults.setModeConfiguration({
|
|
777
|
-
completionItems: true,
|
|
778
|
-
hovers: true,
|
|
779
|
-
documentSymbols: true,
|
|
780
|
-
definitions: true,
|
|
781
|
-
references: true,
|
|
782
|
-
documentHighlights: true,
|
|
783
|
-
rename: true,
|
|
784
|
-
diagnostics: true,
|
|
785
|
-
documentRangeFormattingEdits: true,
|
|
786
|
-
signatureHelp: true,
|
|
787
|
-
onTypeFormattingEdits: true,
|
|
788
|
-
codeActions: true,
|
|
789
|
-
inlayHints: true
|
|
790
|
-
});
|
|
791
|
-
languages.typescript.typescriptDefaults.setModeConfiguration({
|
|
792
|
-
completionItems: true,
|
|
793
|
-
hovers: true,
|
|
794
|
-
documentSymbols: true,
|
|
795
|
-
definitions: true,
|
|
796
|
-
references: true,
|
|
797
|
-
documentHighlights: true,
|
|
798
|
-
rename: true,
|
|
799
|
-
diagnostics: true,
|
|
800
|
-
documentRangeFormattingEdits: true,
|
|
801
|
-
signatureHelp: true,
|
|
802
|
-
onTypeFormattingEdits: true,
|
|
803
|
-
codeActions: true,
|
|
804
|
-
inlayHints: true
|
|
805
|
-
});
|
|
806
|
-
languages.typescript.javascriptDefaults.setEagerModelSync(true);
|
|
807
|
-
languages.typescript.typescriptDefaults.setEagerModelSync(true);
|
|
808
|
-
languages.typescript.javascriptDefaults.setDiagnosticsOptions({
|
|
809
|
-
noSemanticValidation: false,
|
|
810
|
-
noSyntaxValidation: false,
|
|
811
|
-
noSuggestionDiagnostics: false,
|
|
812
|
-
diagnosticCodesToIgnore: [1108]
|
|
813
|
-
});
|
|
814
|
-
languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
|
815
|
-
noSemanticValidation: false,
|
|
816
|
-
noSyntaxValidation: false,
|
|
817
|
-
noSuggestionDiagnostics: false,
|
|
818
|
-
diagnosticCodesToIgnore: [1108]
|
|
819
|
-
});
|
|
820
|
-
languages.typescript.typescriptDefaults.setCompilerOptions({
|
|
821
|
-
target: languages.typescript.ScriptTarget.Latest,
|
|
822
|
-
allowNonTsExtensions: true,
|
|
823
|
-
noSemanticValidation: false,
|
|
824
|
-
noSyntaxValidation: false,
|
|
825
|
-
completionItems: true,
|
|
826
|
-
hovers: true,
|
|
827
|
-
documentSymbols: true,
|
|
828
|
-
definitions: true,
|
|
829
|
-
references: true,
|
|
830
|
-
documentHighlights: true,
|
|
831
|
-
rename: true,
|
|
832
|
-
diagnostics: true,
|
|
833
|
-
documentRangeFormattingEdits: true,
|
|
834
|
-
signatureHelp: true,
|
|
835
|
-
onTypeFormattingEdits: true,
|
|
836
|
-
codeActions: true,
|
|
837
|
-
inlayHints: true,
|
|
838
|
-
checkJs: true,
|
|
839
|
-
allowJs: true,
|
|
840
|
-
noUnusedLocals: true,
|
|
841
|
-
strict: true,
|
|
842
|
-
noLib: false,
|
|
843
|
-
allowImportingTsExtensions: true,
|
|
844
|
-
moduleResolution: languages.typescript.ModuleResolutionKind.NodeJs
|
|
845
|
-
});
|
|
846
|
-
languages.typescript.javascriptDefaults.setCompilerOptions({
|
|
847
|
-
target: languages.typescript.ScriptTarget.Latest,
|
|
848
|
-
allowNonTsExtensions: true,
|
|
849
|
-
noSemanticValidation: false,
|
|
850
|
-
noSyntaxValidation: false,
|
|
851
|
-
allowImportingTsExtensions: true,
|
|
852
|
-
checkJs: true,
|
|
853
|
-
allowJs: true,
|
|
854
|
-
noUnusedParameters: true,
|
|
855
|
-
noUnusedLocals: true,
|
|
856
|
-
strict: true,
|
|
857
|
-
noLib: true,
|
|
858
|
-
moduleResolution: languages.typescript.ModuleResolutionKind.NodeJs
|
|
859
|
-
});
|
|
860
871
|
try {
|
|
861
872
|
model = meditor.createModel(code, lang, mUri.parse(uri));
|
|
862
873
|
}
|
|
@@ -877,21 +888,6 @@ async function loadMonaco() {
|
|
|
877
888
|
tabSize: lang == 'python' ? 4 : 2,
|
|
878
889
|
folding
|
|
879
890
|
});
|
|
880
|
-
// const wrapper = new MonacoEditorLanguageClientWrapper()
|
|
881
|
-
// const userConfig: UserConfig = {
|
|
882
|
-
// wrapperConfig: {
|
|
883
|
-
// editorAppConfig: {
|
|
884
|
-
// $type: 'classic',
|
|
885
|
-
// codeResources: {
|
|
886
|
-
// main: {
|
|
887
|
-
// text: 'console.log("FOO")")',
|
|
888
|
-
// uri: '/workspace/hello.ts'
|
|
889
|
-
// }
|
|
890
|
-
// }
|
|
891
|
-
// }
|
|
892
|
-
// }
|
|
893
|
-
// }
|
|
894
|
-
// await wrapper.initAndStart(userConfig, divEl)
|
|
895
891
|
let timeoutModel = undefined;
|
|
896
892
|
let ataModel = undefined;
|
|
897
893
|
editor?.onDidChangeModelContent((event) => {
|
|
@@ -955,15 +951,15 @@ async function loadMonaco() {
|
|
|
955
951
|
async function setTypescriptExtraLibs() {
|
|
956
952
|
if (lang === 'typescript' && scriptLang != 'deno') {
|
|
957
953
|
const hostname = getHostname();
|
|
958
|
-
const stdLib = { content: libStdContent, filePath: 'es6.d.ts' }
|
|
954
|
+
// const stdLib = { content: libStdContent, filePath: 'es6.d.ts' }
|
|
959
955
|
if (scriptLang == 'bun' || scriptLang == 'bunnative') {
|
|
960
|
-
const processLib = { content: processStdContent, filePath: 'process.d.ts' }
|
|
961
|
-
const domLib = { content: domContent, filePath: 'dom.d.ts' }
|
|
962
|
-
languages.typescript.typescriptDefaults.setExtraLibs([stdLib, domLib, processLib])
|
|
956
|
+
// const processLib = { content: processStdContent, filePath: 'process.d.ts' }
|
|
957
|
+
// const domLib = { content: domContent, filePath: 'dom.d.ts' }
|
|
958
|
+
// languages.typescript.typescriptDefaults.setExtraLibs([stdLib, domLib, processLib])
|
|
963
959
|
}
|
|
964
960
|
else {
|
|
965
|
-
const denoFetch = { content: denoFetchContent, filePath: 'deno_fetch.d.ts' }
|
|
966
|
-
languages.typescript.typescriptDefaults.setExtraLibs([stdLib, denoFetch])
|
|
961
|
+
// const denoFetch = { content: denoFetchContent, filePath: 'deno_fetch.d.ts' }
|
|
962
|
+
// languages.typescript.typescriptDefaults.setExtraLibs([stdLib, denoFetch])
|
|
967
963
|
let localContent = windmillFetchContent;
|
|
968
964
|
let p = '/tmp/monaco/windmill.d.ts';
|
|
969
965
|
let nuri = mUri.parse(p);
|
|
@@ -1,23 +1,39 @@
|
|
|
1
1
|
<script context="module">
|
|
2
2
|
let cssClassesLoaded = writable(false)
|
|
3
3
|
let tailwindClassesLoaded = writable(false)
|
|
4
|
+
|
|
5
|
+
import '@codingame/monaco-vscode-standalone-languages'
|
|
6
|
+
import '@codingame/monaco-vscode-standalone-json-language-features'
|
|
7
|
+
import '@codingame/monaco-vscode-standalone-css-language-features'
|
|
8
|
+
import '@codingame/monaco-vscode-standalone-typescript-language-features'
|
|
9
|
+
|
|
10
|
+
languages.typescript.javascriptDefaults.setCompilerOptions({
|
|
11
|
+
target: languages.typescript.ScriptTarget.Latest,
|
|
12
|
+
allowNonTsExtensions: true,
|
|
13
|
+
noSemanticValidation: false,
|
|
14
|
+
noLib: true,
|
|
15
|
+
moduleResolution: languages.typescript.ModuleResolutionKind.NodeJs
|
|
16
|
+
})
|
|
17
|
+
languages.typescript.javascriptDefaults.setDiagnosticsOptions({
|
|
18
|
+
noSemanticValidation: false,
|
|
19
|
+
noSyntaxValidation: false,
|
|
20
|
+
noSuggestionDiagnostics: false,
|
|
21
|
+
diagnosticCodesToIgnore: [1108]
|
|
22
|
+
})
|
|
23
|
+
languages.json.jsonDefaults.setDiagnosticsOptions({
|
|
24
|
+
validate: true,
|
|
25
|
+
allowComments: false,
|
|
26
|
+
schemas: [],
|
|
27
|
+
enableSchemaRequest: true
|
|
28
|
+
})
|
|
4
29
|
</script>
|
|
5
30
|
|
|
6
31
|
<script>import { BROWSER } from 'esm-env';
|
|
7
32
|
import { createHash, editorConfig, langToExt, updateOptions } from '../editorUtils';
|
|
8
33
|
import { editor as meditor, KeyCode, KeyMod, Uri as mUri, languages } from 'monaco-editor';
|
|
9
|
-
// import 'monaco-editor/esm/vs/basic-languages/sql/sql.contribution'
|
|
10
|
-
// import 'monaco-editor/esm/vs/basic-languages/yaml/yaml.contribution'
|
|
11
|
-
// import 'monaco-editor/esm/vs/basic-languages/javascript/javascript.contribution'
|
|
12
|
-
// import 'monaco-editor/esm/vs/basic-languages/typescript/typescript.contribution'
|
|
13
|
-
// import 'monaco-editor/esm/vs/language/typescript/monaco.contribution'
|
|
14
|
-
// import 'monaco-editor/esm/vs/language/json/monaco.contribution'
|
|
15
|
-
// import 'monaco-editor/esm/vs/basic-languages/css/css.contribution'
|
|
16
|
-
// import 'monaco-editor/esm/vs/language/css/monaco.contribution'
|
|
17
34
|
import '@codingame/monaco-vscode-standalone-languages';
|
|
18
35
|
import '@codingame/monaco-vscode-standalone-json-language-features';
|
|
19
36
|
import '@codingame/monaco-vscode-standalone-css-language-features';
|
|
20
|
-
// import '@codingame/monaco-vscode-standalone-yaml-language-features'
|
|
21
37
|
import '@codingame/monaco-vscode-standalone-typescript-language-features';
|
|
22
38
|
import { allClasses } from './apps/editor/componentsPanel/cssUtils';
|
|
23
39
|
import { createEventDispatcher, onDestroy, onMount } from 'svelte';
|
|
@@ -48,13 +64,7 @@ export let domLib = false;
|
|
|
48
64
|
export let autofocus = false;
|
|
49
65
|
const dispatch = createEventDispatcher();
|
|
50
66
|
const uri = `file:///${hash}.${langToExt(lang)}`;
|
|
51
|
-
buildWorkerDefinition();
|
|
52
|
-
// monaco.languages.register({
|
|
53
|
-
// id: 'json',
|
|
54
|
-
// extensions: ['.json', '.jsonc'],
|
|
55
|
-
// aliases: ['JSON', 'json'],
|
|
56
|
-
// mimetypes: ['application/json']
|
|
57
|
-
// })
|
|
67
|
+
buildWorkerDefinition('../../../workers', import.meta.url);
|
|
58
68
|
export function getCode() {
|
|
59
69
|
return editor?.getValue() ?? '';
|
|
60
70
|
}
|
|
@@ -118,25 +128,28 @@ $: disableTabCond?.set(!code && !!suggestion);
|
|
|
118
128
|
async function loadMonaco() {
|
|
119
129
|
await initializeVscode();
|
|
120
130
|
initialized = true;
|
|
121
|
-
//
|
|
122
|
-
//
|
|
123
|
-
//
|
|
124
|
-
//
|
|
125
|
-
//
|
|
126
|
-
//
|
|
127
|
-
//
|
|
128
|
-
//
|
|
129
|
-
//
|
|
130
|
-
//
|
|
131
|
-
//
|
|
132
|
-
//
|
|
133
|
-
//
|
|
134
|
-
//
|
|
135
|
-
//
|
|
136
|
-
//
|
|
137
|
-
//
|
|
138
|
-
//
|
|
139
|
-
//
|
|
131
|
+
// if (lang === 'javascript') {
|
|
132
|
+
// languages.typescript.javascriptDefaults.setCompilerOptions({
|
|
133
|
+
// target: languages.typescript.ScriptTarget.Latest,
|
|
134
|
+
// allowNonTsExtensions: true,
|
|
135
|
+
// noSemanticValidation: false,
|
|
136
|
+
// noLib: true,
|
|
137
|
+
// moduleResolution: languages.typescript.ModuleResolutionKind.NodeJs
|
|
138
|
+
// })
|
|
139
|
+
// languages.typescript.javascriptDefaults.setDiagnosticsOptions({
|
|
140
|
+
// noSemanticValidation: false,
|
|
141
|
+
// noSyntaxValidation: false,
|
|
142
|
+
// noSuggestionDiagnostics: false,
|
|
143
|
+
// diagnosticCodesToIgnore: [1108]
|
|
144
|
+
// })
|
|
145
|
+
// } else if (lang === 'json') {
|
|
146
|
+
// languages.json.jsonDefaults.setDiagnosticsOptions({
|
|
147
|
+
// validate: true,
|
|
148
|
+
// allowComments: false,
|
|
149
|
+
// schemas: [],
|
|
150
|
+
// enableSchemaRequest: true
|
|
151
|
+
// })
|
|
152
|
+
// }
|
|
140
153
|
try {
|
|
141
154
|
model = meditor.createModel(code, lang, mUri.parse(uri));
|
|
142
155
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
+
import '@codingame/monaco-vscode-standalone-languages';
|
|
3
|
+
import '@codingame/monaco-vscode-standalone-json-language-features';
|
|
4
|
+
import '@codingame/monaco-vscode-standalone-css-language-features';
|
|
5
|
+
import '@codingame/monaco-vscode-standalone-typescript-language-features';
|
|
2
6
|
import { editor as meditor } from 'monaco-editor';
|
|
3
7
|
import '@codingame/monaco-vscode-standalone-languages';
|
|
4
8
|
import '@codingame/monaco-vscode-standalone-json-language-features';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import '@codingame/monaco-vscode-standalone-json-language-features';
|
|
2
|
+
import SimpleEditor from '../../../../SimpleEditor.svelte';
|
|
2
3
|
export let code;
|
|
3
4
|
export let value = undefined;
|
|
4
5
|
export let error = '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function buildWorkerDefinition(...args: any[]): void;
|
|
1
|
+
export declare function buildWorkerDefinition(workerPath: string, basePath: string, ...args: any[]): void;
|
|
@@ -1,153 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker'
|
|
9
|
-
// import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker'
|
|
10
|
-
// import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker'
|
|
11
|
-
// import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'
|
|
12
|
-
// import type { Environment } from 'monaco-editor/esm/vs/editor/editor.api.js'
|
|
13
|
-
// interface MonacoEnvironmentEnhanced extends Environment {
|
|
14
|
-
// workerOverrideGlobals: WorkerOverrideGlobals
|
|
15
|
-
// }
|
|
16
|
-
// type WorkerOverrideGlobals = {
|
|
17
|
-
// basePath: string
|
|
18
|
-
// workerPath: string
|
|
19
|
-
// workerOptions: WorkerOptions
|
|
20
|
-
// }
|
|
21
|
-
// export function buildWorkerDefinition(
|
|
22
|
-
// workerPath: string,
|
|
23
|
-
// basePath: string,
|
|
24
|
-
// useModuleWorker: boolean
|
|
25
|
-
// ) {
|
|
26
|
-
// const monWin = self as Window
|
|
27
|
-
// const workerOverrideGlobals: WorkerOverrideGlobals = {
|
|
28
|
-
// basePath: basePath,
|
|
29
|
-
// workerPath: workerPath,
|
|
30
|
-
// workerOptions: {
|
|
31
|
-
// type: useModuleWorker ? 'module' : 'classic'
|
|
32
|
-
// }
|
|
33
|
-
// }
|
|
34
|
-
// if (!monWin.MonacoEnvironment) {
|
|
35
|
-
// monWin.MonacoEnvironment = {
|
|
36
|
-
// workerOverrideGlobals: workerOverrideGlobals,
|
|
37
|
-
// createTrustedTypesPolicy: (_policyName: string) => {
|
|
38
|
-
// return undefined
|
|
39
|
-
// }
|
|
40
|
-
// } as MonacoEnvironmentEnhanced
|
|
41
|
-
// }
|
|
42
|
-
// const monEnv = monWin.MonacoEnvironment as MonacoEnvironmentEnhanced
|
|
43
|
-
// monEnv.workerOverrideGlobals = workerOverrideGlobals
|
|
44
|
-
// const getWorker = (_: string, label: string) => {
|
|
45
|
-
// console.log('getWorker: workerId: ' + _ + ' label: ' + label)
|
|
46
|
-
// switch (label) {
|
|
47
|
-
// case 'template':
|
|
48
|
-
// case 'typescript':
|
|
49
|
-
// case 'javascript':
|
|
50
|
-
// return new tsWorker()
|
|
51
|
-
// case 'html':
|
|
52
|
-
// case 'handlebars':
|
|
53
|
-
// case 'razor':
|
|
54
|
-
// return new htmlWorker()
|
|
55
|
-
// case 'css':
|
|
56
|
-
// case 'scss':
|
|
57
|
-
// case 'less':
|
|
58
|
-
// return new cssWorker()
|
|
59
|
-
// case 'json':
|
|
60
|
-
// return new jsonWorker()
|
|
61
|
-
// case 'graphql':
|
|
62
|
-
// const workerFilename = `graphql.worker.bundle.js`
|
|
63
|
-
// const workerPathLocal = `${workerOverrideGlobals.workerPath}/${workerFilename}`
|
|
64
|
-
// const workerUrl = new URL(workerPathLocal, workerOverrideGlobals.basePath)
|
|
65
|
-
// return new Worker(workerUrl.href, {
|
|
66
|
-
// name: label
|
|
67
|
-
// })
|
|
68
|
-
// default:
|
|
69
|
-
// return new editorWorker()
|
|
70
|
-
// }
|
|
71
|
-
// }
|
|
72
|
-
// monWin.MonacoEnvironment.getWorker = getWorker
|
|
73
|
-
// }
|
|
74
|
-
// //
|
|
75
|
-
// export type WorkerLoader = () => Worker
|
|
76
|
-
// const workerLoaders: Partial<Record<string, WorkerLoader>> = {
|
|
77
|
-
// editorWorkerService: () =>
|
|
78
|
-
// new Worker(new URL('monaco-editor/esm/vs/editor/editor.worker.js', import.meta.url), {
|
|
79
|
-
// type: 'module'
|
|
80
|
-
// }),
|
|
81
|
-
// textMateWorker: () =>
|
|
82
|
-
// new Worker(
|
|
83
|
-
// new URL('@codingame/monaco-vscode-textmate-service-override/worker', import.meta.url),
|
|
84
|
-
// { type: 'module' }
|
|
85
|
-
// ),
|
|
86
|
-
// languageDetectionWorkerService: () =>
|
|
87
|
-
// new Worker(
|
|
88
|
-
// new URL(
|
|
89
|
-
// '@codingame/monaco-vscode-language-detection-worker-service-override/worker',
|
|
90
|
-
// import.meta.url
|
|
91
|
-
// ),
|
|
92
|
-
// { type: 'module' }
|
|
93
|
-
// )
|
|
94
|
-
// }
|
|
95
|
-
// export function registerWorkerLoader(label: string, workerLoader: WorkerLoader): void {
|
|
96
|
-
// workerLoaders[label] = workerLoader
|
|
97
|
-
// }
|
|
98
|
-
// export function buildWorkerDefinition() {
|
|
99
|
-
// // Do not use monaco-editor-webpack-plugin because it doesn't handle properly cross origin workers
|
|
100
|
-
// window.MonacoEnvironment = {
|
|
101
|
-
// getWorker: function (moduleId, label) {
|
|
102
|
-
// console.log('LOAD')
|
|
103
|
-
// const workerFactory = workerLoaders[label]
|
|
104
|
-
// if (workerFactory != null) {
|
|
105
|
-
// return workerFactory()
|
|
106
|
-
// }
|
|
107
|
-
// throw new Error(`Unimplemented worker ${label} (${moduleId})`)
|
|
108
|
-
// }
|
|
109
|
-
// }
|
|
110
|
-
// }
|
|
111
|
-
// import { graphql } from 'graphql'
|
|
112
|
-
import { useWorkerFactory } from '@windmill-labs/monaco-editor-wrapper/workerFactory';
|
|
113
|
-
export function buildWorkerDefinition(...args) {
|
|
1
|
+
import { useWorkerFactory } from 'monaco-editor-wrapper/workerFactory';
|
|
2
|
+
import cssWorker from 'monaco-editor-wrapper/workers/module/css?worker';
|
|
3
|
+
import htmlWorker from 'monaco-editor-wrapper/workers/module/html?worker';
|
|
4
|
+
import tsWorker from 'monaco-editor-wrapper/workers/module/ts?worker';
|
|
5
|
+
import jsonWorker from 'monaco-editor-wrapper/workers/module/json?worker';
|
|
6
|
+
import editorWorker from 'monaco-editor-wrapper/workers/module/editor?worker';
|
|
7
|
+
export function buildWorkerDefinition(workerPath, basePath, ...args) {
|
|
114
8
|
useWorkerFactory({
|
|
115
9
|
ignoreMapping: true,
|
|
116
10
|
workerLoaders: {
|
|
117
11
|
editorWorkerService: () => {
|
|
118
12
|
console.log('editorWorkerService');
|
|
119
|
-
return new
|
|
120
|
-
type: 'module'
|
|
121
|
-
});
|
|
13
|
+
return new editorWorker();
|
|
122
14
|
},
|
|
123
15
|
javascript: () => {
|
|
124
16
|
console.log('javascript');
|
|
125
|
-
return new
|
|
126
|
-
type: 'module'
|
|
127
|
-
});
|
|
17
|
+
return new tsWorker();
|
|
128
18
|
},
|
|
129
19
|
typescript: () => {
|
|
130
20
|
console.log('typescript');
|
|
131
|
-
return new
|
|
132
|
-
type: 'module'
|
|
133
|
-
});
|
|
21
|
+
return new tsWorker();
|
|
134
22
|
},
|
|
135
23
|
json: () => {
|
|
136
24
|
console.log('json');
|
|
137
|
-
return new
|
|
138
|
-
type: 'module'
|
|
139
|
-
});
|
|
25
|
+
return new jsonWorker();
|
|
140
26
|
},
|
|
141
27
|
html: () => {
|
|
142
28
|
console.log('html');
|
|
143
|
-
return new
|
|
144
|
-
type: 'module'
|
|
145
|
-
});
|
|
29
|
+
return new htmlWorker();
|
|
146
30
|
},
|
|
147
31
|
css: () => {
|
|
148
32
|
console.log('html');
|
|
149
|
-
return new
|
|
150
|
-
|
|
33
|
+
return new cssWorker();
|
|
34
|
+
},
|
|
35
|
+
graphql: () => {
|
|
36
|
+
console.log('graphql');
|
|
37
|
+
const workerFilename = `graphql.worker.bundle.js`;
|
|
38
|
+
const workerPathLocal = `${workerPath}/${workerFilename}`;
|
|
39
|
+
const workerUrl = new URL(workerPathLocal, basePath);
|
|
40
|
+
return new Worker(workerUrl.href, {
|
|
41
|
+
name: 'graphql'
|
|
151
42
|
});
|
|
152
43
|
}
|
|
153
44
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { initServices } from '
|
|
1
|
+
import { initServices } from 'monaco-languageclient/vscode/services';
|
|
2
2
|
// import getThemeServiceOverride from '@codingame/monaco-vscode-theme-service-override'
|
|
3
3
|
// import getTextmateServiceOverride from '@codingame/monaco-vscode-textmate-service-override'
|
|
4
4
|
import getMonarchServiceOverride from '@codingame/monaco-vscode-monarch-service-override';
|
package/package/scripts.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Schema, SupportedLanguage } from './common';
|
|
2
2
|
import { type Script } from './gen';
|
|
3
|
-
export declare function scriptLangToEditorLang(lang: Script['language'] | 'bunnative' | undefined): "go" | "powershell" | "graphql" | "php" | "sql" | "typescript" | "python" | "shell";
|
|
3
|
+
export declare function scriptLangToEditorLang(lang: Script['language'] | 'bunnative' | 'frontend' | undefined): "go" | "powershell" | "graphql" | "php" | "sql" | "typescript" | "python" | "shell";
|
|
4
4
|
export type ScriptSchedule = {
|
|
5
5
|
summary: string | undefined;
|
|
6
6
|
args: Record<string, any>;
|
package/package/scripts.js
CHANGED
|
@@ -6,7 +6,7 @@ export function scriptLangToEditorLang(lang) {
|
|
|
6
6
|
if (lang == 'deno') {
|
|
7
7
|
return 'typescript';
|
|
8
8
|
}
|
|
9
|
-
else if (lang == 'bun' || lang == 'bunnative') {
|
|
9
|
+
else if (lang == 'bun' || lang == 'bunnative' || lang == 'frontend') {
|
|
10
10
|
return 'typescript';
|
|
11
11
|
}
|
|
12
12
|
else if (lang == 'nativets') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "windmill-components",
|
|
3
|
-
"version": "1.383.
|
|
3
|
+
"version": "1.383.9",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite dev",
|
|
6
6
|
"build": "vite build",
|
|
@@ -73,6 +73,9 @@
|
|
|
73
73
|
"@rgossiaux/svelte-headlessui": {
|
|
74
74
|
"svelte": "$svelte"
|
|
75
75
|
},
|
|
76
|
+
"monaco-graphql": {
|
|
77
|
+
"monaco-editor": "$monaco-editor"
|
|
78
|
+
},
|
|
76
79
|
"svelte-chartjs": {
|
|
77
80
|
"svelte": "$svelte"
|
|
78
81
|
}
|
|
@@ -116,9 +119,9 @@
|
|
|
116
119
|
"lucide-svelte": "^0.293.0",
|
|
117
120
|
"minimatch": "^10.0.1",
|
|
118
121
|
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~8.0.2",
|
|
119
|
-
"
|
|
122
|
+
"monaco-editor-wrapper": "^5.5.2",
|
|
120
123
|
"monaco-graphql": "^1.6.0",
|
|
121
|
-
"
|
|
124
|
+
"monaco-languageclient": "~8.8.2",
|
|
122
125
|
"ol": "^7.4.0",
|
|
123
126
|
"openai": "^4.47.1",
|
|
124
127
|
"p-limit": "^6.1.0",
|