windmill-components 1.383.8 → 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 -125
- 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 +16 -122
- 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,93 +868,6 @@ async function loadMonaco() {
|
|
|
772
868
|
// console.log('bef ready')
|
|
773
869
|
// console.log('af ready')
|
|
774
870
|
initialized = true;
|
|
775
|
-
await import('@codingame/monaco-vscode-standalone-languages');
|
|
776
|
-
await import('@codingame/monaco-vscode-standalone-typescript-language-features');
|
|
777
|
-
languages.typescript.typescriptDefaults.addExtraLib(processStdContent, 'process.d.ts');
|
|
778
|
-
languages.typescript.javascriptDefaults.setModeConfiguration({
|
|
779
|
-
completionItems: true,
|
|
780
|
-
hovers: true,
|
|
781
|
-
documentSymbols: true,
|
|
782
|
-
definitions: true,
|
|
783
|
-
references: true,
|
|
784
|
-
documentHighlights: true,
|
|
785
|
-
rename: true,
|
|
786
|
-
diagnostics: true,
|
|
787
|
-
documentRangeFormattingEdits: true,
|
|
788
|
-
signatureHelp: true,
|
|
789
|
-
onTypeFormattingEdits: true,
|
|
790
|
-
codeActions: true,
|
|
791
|
-
inlayHints: true
|
|
792
|
-
});
|
|
793
|
-
languages.typescript.typescriptDefaults.setModeConfiguration({
|
|
794
|
-
completionItems: true,
|
|
795
|
-
hovers: true,
|
|
796
|
-
documentSymbols: true,
|
|
797
|
-
definitions: true,
|
|
798
|
-
references: true,
|
|
799
|
-
documentHighlights: true,
|
|
800
|
-
rename: true,
|
|
801
|
-
diagnostics: true,
|
|
802
|
-
documentRangeFormattingEdits: true,
|
|
803
|
-
signatureHelp: true,
|
|
804
|
-
onTypeFormattingEdits: true,
|
|
805
|
-
codeActions: true,
|
|
806
|
-
inlayHints: true
|
|
807
|
-
});
|
|
808
|
-
languages.typescript.javascriptDefaults.setEagerModelSync(true);
|
|
809
|
-
languages.typescript.typescriptDefaults.setEagerModelSync(true);
|
|
810
|
-
languages.typescript.javascriptDefaults.setDiagnosticsOptions({
|
|
811
|
-
noSemanticValidation: false,
|
|
812
|
-
noSyntaxValidation: false,
|
|
813
|
-
noSuggestionDiagnostics: false,
|
|
814
|
-
diagnosticCodesToIgnore: [1108]
|
|
815
|
-
});
|
|
816
|
-
languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
|
817
|
-
noSemanticValidation: false,
|
|
818
|
-
noSyntaxValidation: false,
|
|
819
|
-
noSuggestionDiagnostics: false,
|
|
820
|
-
diagnosticCodesToIgnore: [1108]
|
|
821
|
-
});
|
|
822
|
-
languages.typescript.typescriptDefaults.setCompilerOptions({
|
|
823
|
-
target: languages.typescript.ScriptTarget.Latest,
|
|
824
|
-
allowNonTsExtensions: true,
|
|
825
|
-
noSemanticValidation: false,
|
|
826
|
-
noSyntaxValidation: false,
|
|
827
|
-
completionItems: true,
|
|
828
|
-
hovers: true,
|
|
829
|
-
documentSymbols: true,
|
|
830
|
-
definitions: true,
|
|
831
|
-
references: true,
|
|
832
|
-
documentHighlights: true,
|
|
833
|
-
rename: true,
|
|
834
|
-
diagnostics: true,
|
|
835
|
-
documentRangeFormattingEdits: true,
|
|
836
|
-
signatureHelp: true,
|
|
837
|
-
onTypeFormattingEdits: true,
|
|
838
|
-
codeActions: true,
|
|
839
|
-
inlayHints: true,
|
|
840
|
-
checkJs: true,
|
|
841
|
-
allowJs: true,
|
|
842
|
-
noUnusedLocals: true,
|
|
843
|
-
strict: true,
|
|
844
|
-
noLib: false,
|
|
845
|
-
allowImportingTsExtensions: true,
|
|
846
|
-
moduleResolution: languages.typescript.ModuleResolutionKind.NodeJs
|
|
847
|
-
});
|
|
848
|
-
languages.typescript.javascriptDefaults.setCompilerOptions({
|
|
849
|
-
target: languages.typescript.ScriptTarget.Latest,
|
|
850
|
-
allowNonTsExtensions: true,
|
|
851
|
-
noSemanticValidation: false,
|
|
852
|
-
noSyntaxValidation: false,
|
|
853
|
-
allowImportingTsExtensions: true,
|
|
854
|
-
checkJs: true,
|
|
855
|
-
allowJs: true,
|
|
856
|
-
noUnusedParameters: true,
|
|
857
|
-
noUnusedLocals: true,
|
|
858
|
-
strict: true,
|
|
859
|
-
noLib: true,
|
|
860
|
-
moduleResolution: languages.typescript.ModuleResolutionKind.NodeJs
|
|
861
|
-
});
|
|
862
871
|
try {
|
|
863
872
|
model = meditor.createModel(code, lang, mUri.parse(uri));
|
|
864
873
|
}
|
|
@@ -879,21 +888,6 @@ async function loadMonaco() {
|
|
|
879
888
|
tabSize: lang == 'python' ? 4 : 2,
|
|
880
889
|
folding
|
|
881
890
|
});
|
|
882
|
-
// const wrapper = new MonacoEditorLanguageClientWrapper()
|
|
883
|
-
// const userConfig: UserConfig = {
|
|
884
|
-
// wrapperConfig: {
|
|
885
|
-
// editorAppConfig: {
|
|
886
|
-
// $type: 'classic',
|
|
887
|
-
// codeResources: {
|
|
888
|
-
// main: {
|
|
889
|
-
// text: 'console.log("FOO")")',
|
|
890
|
-
// uri: '/workspace/hello.ts'
|
|
891
|
-
// }
|
|
892
|
-
// }
|
|
893
|
-
// }
|
|
894
|
-
// }
|
|
895
|
-
// }
|
|
896
|
-
// await wrapper.initAndStart(userConfig, divEl)
|
|
897
891
|
let timeoutModel = undefined;
|
|
898
892
|
let ataModel = undefined;
|
|
899
893
|
editor?.onDidChangeModelContent((event) => {
|
|
@@ -957,15 +951,15 @@ async function loadMonaco() {
|
|
|
957
951
|
async function setTypescriptExtraLibs() {
|
|
958
952
|
if (lang === 'typescript' && scriptLang != 'deno') {
|
|
959
953
|
const hostname = getHostname();
|
|
960
|
-
const stdLib = { content: libStdContent, filePath: 'es6.d.ts' }
|
|
954
|
+
// const stdLib = { content: libStdContent, filePath: 'es6.d.ts' }
|
|
961
955
|
if (scriptLang == 'bun' || scriptLang == 'bunnative') {
|
|
962
|
-
const processLib = { content: processStdContent, filePath: 'process.d.ts' }
|
|
963
|
-
const domLib = { content: domContent, filePath: 'dom.d.ts' }
|
|
964
|
-
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])
|
|
965
959
|
}
|
|
966
960
|
else {
|
|
967
|
-
const denoFetch = { content: denoFetchContent, filePath: 'deno_fetch.d.ts' }
|
|
968
|
-
languages.typescript.typescriptDefaults.setExtraLibs([stdLib, denoFetch])
|
|
961
|
+
// const denoFetch = { content: denoFetchContent, filePath: 'deno_fetch.d.ts' }
|
|
962
|
+
// languages.typescript.typescriptDefaults.setExtraLibs([stdLib, denoFetch])
|
|
969
963
|
let localContent = windmillFetchContent;
|
|
970
964
|
let p = '/tmp/monaco/windmill.d.ts';
|
|
971
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,125 +1,10 @@
|
|
|
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
|
-
import cssWorker from '@windmill-labs/monaco-editor-wrapper/workers/module/css?worker';
|
|
114
|
-
import htmlWorker from '@windmill-labs/monaco-editor-wrapper/workers/module/html?worker';
|
|
115
|
-
import tsWorker from '@windmill-labs/monaco-editor-wrapper/workers/module/ts?worker';
|
|
116
|
-
import jsonWorker from '@windmill-labs/monaco-editor-wrapper/workers/module/json?worker';
|
|
117
|
-
import editorWorker from '@windmill-labs/monaco-editor-wrapper/workers/module/editor?worker';
|
|
118
|
-
// import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker'
|
|
119
|
-
// import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker'
|
|
120
|
-
// import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker'
|
|
121
|
-
// import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'
|
|
122
|
-
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) {
|
|
123
8
|
useWorkerFactory({
|
|
124
9
|
ignoreMapping: true,
|
|
125
10
|
workerLoaders: {
|
|
@@ -146,6 +31,15 @@ export function buildWorkerDefinition(...args) {
|
|
|
146
31
|
css: () => {
|
|
147
32
|
console.log('html');
|
|
148
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'
|
|
42
|
+
});
|
|
149
43
|
}
|
|
150
44
|
}
|
|
151
45
|
});
|
|
@@ -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",
|