windmill-components 1.382.3 → 1.383.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/components/Dev.svelte +2 -1
- package/package/components/DiffDrawer.svelte +2 -0
- package/package/components/DiffEditor.svelte +12 -12
- package/package/components/DiffEditor.svelte.d.ts +5 -6
- package/package/components/Editor.svelte +78 -63
- package/package/components/Editor.svelte.d.ts +4 -11
- package/package/components/EditorTheme.svelte +2 -2
- package/package/components/FlowViewer.svelte +4 -45
- package/package/components/FlowViewerInner.svelte +109 -0
- package/package/components/FlowViewerInner.svelte.d.ts +22 -0
- package/package/components/ScriptBuilder.svelte +6 -4
- package/package/components/ScriptBuilder.svelte.d.ts +1 -0
- package/package/components/ScriptEditor.svelte +1 -6
- package/package/components/SimpleEditor.svelte +40 -28
- package/package/components/SimpleEditor.svelte.d.ts +5 -8
- package/package/components/TemplateEditor.svelte +6 -4
- package/package/components/TemplateEditor.svelte.d.ts +3 -3
- package/package/components/apps/components/display/AppNavbarItem.svelte +1 -1
- package/package/components/apps/editor/AppEditor.svelte +34 -3
- package/package/components/apps/editor/AppEditorHeader.svelte +17 -7
- package/package/components/apps/editor/AppPreview.svelte +4 -1
- package/package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +2 -1
- package/package/components/apps/types.d.ts +1 -0
- package/package/components/build_workers.d.ts +1 -1
- package/package/components/build_workers.js +146 -51
- package/package/components/common/toggleButton-v2/ToggleEnable.svelte +34 -0
- package/package/components/common/toggleButton-v2/ToggleEnable.svelte.d.ts +23 -0
- package/package/components/details/DetailPageDetailPanel.svelte +4 -38
- package/package/components/flows/content/FlowModuleComponent.svelte +2 -1
- package/package/components/flows/content/FlowModuleScript.svelte +1 -0
- package/package/components/flows/idUtils.js +2 -1
- package/package/components/vscode.d.ts +2 -1
- package/package/components/vscode.js +22 -8
- package/package/editorUtils.d.ts +6 -1
- package/package/editorUtils.js +6 -1
- package/package/gen/core/OpenAPI.js +1 -1
- package/package/gen/schemas.gen.d.ts +12 -0
- package/package/gen/schemas.gen.js +12 -0
- package/package/gen/services.gen.d.ts +4 -3
- package/package/gen/services.gen.js +7 -5
- package/package/gen/types.gen.d.ts +16 -8
- package/package.json +18 -19
|
@@ -371,7 +371,8 @@ setContext('FlowEditorContext', {
|
|
|
371
371
|
testStepStore,
|
|
372
372
|
saveDraft: () => { },
|
|
373
373
|
initialPath: '',
|
|
374
|
-
flowInputsStore: writable({})
|
|
374
|
+
flowInputsStore: writable({}),
|
|
375
|
+
customUi: {}
|
|
375
376
|
});
|
|
376
377
|
$: updateFlow($flowStore);
|
|
377
378
|
let lastSent = undefined;
|
|
@@ -158,6 +158,7 @@ $: updateContentType(data, diffType);
|
|
|
158
158
|
{#key diffType}
|
|
159
159
|
{#if contentType === 'content'}
|
|
160
160
|
<DiffEditor
|
|
161
|
+
open={true}
|
|
161
162
|
automaticLayout
|
|
162
163
|
class="h-full"
|
|
163
164
|
defaultLang={lang}
|
|
@@ -168,6 +169,7 @@ $: updateContentType(data, diffType);
|
|
|
168
169
|
/>
|
|
169
170
|
{:else if contentType === 'metadata'}
|
|
170
171
|
<DiffEditor
|
|
172
|
+
open={true}
|
|
171
173
|
automaticLayout
|
|
172
174
|
class="h-full"
|
|
173
175
|
defaultLang="yaml"
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
<script>import { BROWSER } from 'esm-env';
|
|
2
2
|
import { onMount } from 'svelte';
|
|
3
|
+
import '@codingame/monaco-vscode-standalone-languages';
|
|
4
|
+
import '@codingame/monaco-vscode-standalone-json-language-features';
|
|
5
|
+
import '@codingame/monaco-vscode-standalone-typescript-language-features';
|
|
3
6
|
import { editor as meditor } from 'monaco-editor';
|
|
4
|
-
import '
|
|
5
|
-
import 'monaco-editor/esm/vs/basic-languages/go/go.contribution';
|
|
6
|
-
import 'monaco-editor/esm/vs/basic-languages/shell/shell.contribution';
|
|
7
|
-
import 'monaco-editor/esm/vs/basic-languages/typescript/typescript.contribution';
|
|
8
|
-
import 'monaco-editor/esm/vs/basic-languages/sql/sql.contribution';
|
|
9
|
-
import 'monaco-editor/esm/vs/language/typescript/monaco.contribution';
|
|
7
|
+
import 'vscode/localExtensionHost';
|
|
10
8
|
import { initializeVscode } from './vscode';
|
|
11
9
|
import EditorTheme from './EditorTheme.svelte';
|
|
12
10
|
import { buildWorkerDefinition } from './build_workers';
|
|
@@ -22,6 +20,7 @@ export let readOnly = false;
|
|
|
22
20
|
let diffEditor;
|
|
23
21
|
let diffDivEl = null;
|
|
24
22
|
let editorWidth = SIDE_BY_SIDE_MIN_WIDTH;
|
|
23
|
+
export let open = false;
|
|
25
24
|
async function loadDiffEditor() {
|
|
26
25
|
await initializeVscode();
|
|
27
26
|
if (!diffDivEl) {
|
|
@@ -72,18 +71,18 @@ export function getModified() {
|
|
|
72
71
|
return diffEditor?.getModel()?.modified.getValue() ?? '';
|
|
73
72
|
}
|
|
74
73
|
export function show() {
|
|
75
|
-
|
|
74
|
+
open = true;
|
|
76
75
|
}
|
|
77
76
|
export function hide() {
|
|
78
|
-
|
|
77
|
+
open = false;
|
|
79
78
|
}
|
|
80
79
|
function onWidthChange(editorWidth) {
|
|
81
80
|
diffEditor?.updateOptions({ renderSideBySide: editorWidth >= SIDE_BY_SIDE_MIN_WIDTH });
|
|
82
81
|
}
|
|
83
82
|
$: onWidthChange(editorWidth);
|
|
83
|
+
$: open && diffDivEl && loadDiffEditor();
|
|
84
84
|
onMount(() => {
|
|
85
85
|
if (BROWSER) {
|
|
86
|
-
loadDiffEditor();
|
|
87
86
|
return () => {
|
|
88
87
|
diffEditor?.dispose();
|
|
89
88
|
};
|
|
@@ -91,6 +90,7 @@ onMount(() => {
|
|
|
91
90
|
});
|
|
92
91
|
</script>
|
|
93
92
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
<div bind:this={diffDivEl} class="{$$props.class} editor" bind:clientWidth={editorWidth} />
|
|
93
|
+
{#if open}
|
|
94
|
+
<EditorTheme />
|
|
95
|
+
<div bind:this={diffDivEl} class="{$$props.class} editor" bind:clientWidth={editorWidth} />
|
|
96
|
+
{/if}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import 'monaco-
|
|
3
|
-
import 'monaco-
|
|
4
|
-
import 'monaco-
|
|
5
|
-
import '
|
|
6
|
-
import 'monaco-editor/esm/vs/basic-languages/sql/sql.contribution';
|
|
7
|
-
import 'monaco-editor/esm/vs/language/typescript/monaco.contribution';
|
|
2
|
+
import '@codingame/monaco-vscode-standalone-languages';
|
|
3
|
+
import '@codingame/monaco-vscode-standalone-json-language-features';
|
|
4
|
+
import '@codingame/monaco-vscode-standalone-typescript-language-features';
|
|
5
|
+
import 'vscode/localExtensionHost';
|
|
8
6
|
declare const __propDef: {
|
|
9
7
|
props: {
|
|
10
8
|
[x: string]: any;
|
|
@@ -15,6 +13,7 @@ declare const __propDef: {
|
|
|
15
13
|
defaultOriginal?: string | undefined;
|
|
16
14
|
defaultModified?: string | undefined;
|
|
17
15
|
readOnly?: boolean | undefined;
|
|
16
|
+
open?: boolean | undefined;
|
|
18
17
|
setupModel?: ((lang: string, original?: string, modified?: string, modifiedLang?: string) => void) | undefined;
|
|
19
18
|
setOriginal?: ((code: string) => void) | undefined;
|
|
20
19
|
getOriginal?: (() => string) | undefined;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
+
<!-- <script lang="ts"></script> -->
|
|
2
|
+
|
|
1
3
|
<script>import { BROWSER } from 'esm-env';
|
|
2
4
|
import { sendUserToast } from '../toast';
|
|
3
5
|
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';
|
|
11
|
+
import 'vscode/localExtensionHost';
|
|
4
12
|
import * as vscode from 'vscode';
|
|
5
|
-
import
|
|
6
|
-
import 'monaco-
|
|
7
|
-
import '
|
|
8
|
-
import 'monaco-editor/esm/vs/basic-languages/shell/shell.contribution';
|
|
9
|
-
import 'monaco-editor/esm/vs/basic-languages/typescript/typescript.contribution';
|
|
10
|
-
import 'monaco-editor/esm/vs/basic-languages/sql/sql.contribution';
|
|
11
|
-
import 'monaco-editor/esm/vs/basic-languages/graphql/graphql.contribution';
|
|
12
|
-
import 'monaco-editor/esm/vs/basic-languages/powershell/powershell.contribution';
|
|
13
|
-
import 'monaco-editor/esm/vs/basic-languages/php/php.contribution';
|
|
14
|
-
import 'monaco-editor/esm/vs/language/typescript/monaco.contribution';
|
|
15
|
-
import 'monaco-editor/esm/vs/basic-languages/css/css.contribution';
|
|
16
|
-
// import libStdContent from '../es6.d.ts.txt?raw'
|
|
17
|
-
// import domContent from '../dom.d.ts.txt?raw'
|
|
18
|
-
// import denoFetchContent from '../deno_fetch.d.ts.txt?raw'
|
|
13
|
+
// import '@codingame/monaco-vscode-typescript-basics-default-extension'
|
|
14
|
+
// import '@codingame/monaco-vscode-typescript-language-features-default-extension'
|
|
15
|
+
// import 'vscode/localExtensionHost'
|
|
19
16
|
import processStdContent from '../process.d.ts.txt?raw';
|
|
20
17
|
import windmillFetchContent from '../windmill_fetch.d.ts.txt?raw';
|
|
21
18
|
import { MonacoLanguageClient } from 'monaco-languageclient';
|
|
@@ -27,17 +24,18 @@ import { createHash as randomHash, editorConfig, langToExt, updateOptions } from
|
|
|
27
24
|
import { buildWorkerDefinition } from './build_workers';
|
|
28
25
|
import { workspaceStore } from '../stores';
|
|
29
26
|
import { UserService } from '../gen';
|
|
30
|
-
import {
|
|
27
|
+
import { initializeVscode } from './vscode';
|
|
28
|
+
// import { initializeMode } from 'monaco-graphql/esm/initializeMode.js'
|
|
31
29
|
import { sleep } from '../utils';
|
|
32
30
|
import { editorCodeCompletion } from './copilot/completion';
|
|
33
|
-
import {
|
|
31
|
+
import { editor as meditor, languages, KeyCode, KeyMod, Uri as mUri } from 'monaco-editor';
|
|
34
32
|
import EditorTheme from './EditorTheme.svelte';
|
|
35
33
|
import { BIGQUERY_TYPES, MSSQL_TYPES, MYSQL_TYPES, POSTGRES_TYPES, SNOWFLAKE_TYPES } from '../consts';
|
|
36
34
|
import { setupTypeAcquisition } from '../ata/index';
|
|
37
35
|
import { initWasm, parseDeps } from '../infer';
|
|
38
36
|
// import EditorTheme from './EditorTheme.svelte'
|
|
39
37
|
let divEl = null;
|
|
40
|
-
let editor;
|
|
38
|
+
let editor = null;
|
|
41
39
|
export let lang;
|
|
42
40
|
export let code = '';
|
|
43
41
|
export let cmdEnterAction = undefined;
|
|
@@ -91,6 +89,7 @@ const uri = lang != 'go' && lang != 'typescript' && lang != 'python'
|
|
|
91
89
|
: `file:///tmp/monaco/${randomHash()}.${langToExt(lang)}`;
|
|
92
90
|
console.log('uri', uri);
|
|
93
91
|
buildWorkerDefinition('../../../workers', import.meta.url, false);
|
|
92
|
+
// buildWorkerDefinition()
|
|
94
93
|
export function getCode() {
|
|
95
94
|
return editor?.getValue() ?? '';
|
|
96
95
|
}
|
|
@@ -283,13 +282,13 @@ function addDBSchemaCompletions() {
|
|
|
283
282
|
return;
|
|
284
283
|
}
|
|
285
284
|
if (schemaLang === 'graphql') {
|
|
286
|
-
graphqlService ||= initializeMode()
|
|
287
|
-
graphqlService?.setSchemaConfig([
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
])
|
|
285
|
+
// graphqlService ||= initializeMode()
|
|
286
|
+
// graphqlService?.setSchemaConfig([
|
|
287
|
+
// {
|
|
288
|
+
// uri: 'my-schema.graphql',
|
|
289
|
+
// introspectionJSON: schema
|
|
290
|
+
// }
|
|
291
|
+
// ])
|
|
293
292
|
}
|
|
294
293
|
else {
|
|
295
294
|
if (sqlSchemaCompletor) {
|
|
@@ -765,7 +764,8 @@ let ata = undefined;
|
|
|
765
764
|
async function loadMonaco() {
|
|
766
765
|
try {
|
|
767
766
|
console.log("Loading Monaco's language client");
|
|
768
|
-
await initializeVscode();
|
|
767
|
+
await initializeVscode('editor');
|
|
768
|
+
console.log('done loading Monaco and vscode');
|
|
769
769
|
}
|
|
770
770
|
catch (e) {
|
|
771
771
|
console.log('error initializing services', e);
|
|
@@ -773,32 +773,6 @@ async function loadMonaco() {
|
|
|
773
773
|
// console.log('bef ready')
|
|
774
774
|
// console.log('af ready')
|
|
775
775
|
initialized = true;
|
|
776
|
-
languages.typescript.typescriptDefaults.setCompilerOptions({
|
|
777
|
-
target: languages.typescript.ScriptTarget.Latest,
|
|
778
|
-
allowNonTsExtensions: true,
|
|
779
|
-
noSemanticValidation: false,
|
|
780
|
-
noSyntaxValidation: false,
|
|
781
|
-
completionItems: true,
|
|
782
|
-
hovers: true,
|
|
783
|
-
documentSymbols: true,
|
|
784
|
-
definitions: true,
|
|
785
|
-
references: true,
|
|
786
|
-
documentHighlights: true,
|
|
787
|
-
rename: true,
|
|
788
|
-
diagnostics: true,
|
|
789
|
-
documentRangeFormattingEdits: true,
|
|
790
|
-
signatureHelp: true,
|
|
791
|
-
onTypeFormattingEdits: true,
|
|
792
|
-
codeActions: true,
|
|
793
|
-
inlayHints: true,
|
|
794
|
-
checkJs: true,
|
|
795
|
-
allowJs: true,
|
|
796
|
-
noUnusedLocals: true,
|
|
797
|
-
strict: true,
|
|
798
|
-
noLib: false,
|
|
799
|
-
allowImportingTsExtensions: true,
|
|
800
|
-
moduleResolution: languages.typescript.ModuleResolutionKind.NodeJs
|
|
801
|
-
});
|
|
802
776
|
languages.typescript.typescriptDefaults.addExtraLib(processStdContent, 'process.d.ts');
|
|
803
777
|
languages.typescript.javascriptDefaults.setModeConfiguration({
|
|
804
778
|
completionItems: true,
|
|
@@ -844,6 +818,32 @@ async function loadMonaco() {
|
|
|
844
818
|
noSuggestionDiagnostics: false,
|
|
845
819
|
diagnosticCodesToIgnore: [1108]
|
|
846
820
|
});
|
|
821
|
+
languages.typescript.typescriptDefaults.setCompilerOptions({
|
|
822
|
+
target: languages.typescript.ScriptTarget.Latest,
|
|
823
|
+
allowNonTsExtensions: true,
|
|
824
|
+
noSemanticValidation: false,
|
|
825
|
+
noSyntaxValidation: false,
|
|
826
|
+
completionItems: true,
|
|
827
|
+
hovers: true,
|
|
828
|
+
documentSymbols: true,
|
|
829
|
+
definitions: true,
|
|
830
|
+
references: true,
|
|
831
|
+
documentHighlights: true,
|
|
832
|
+
rename: true,
|
|
833
|
+
diagnostics: true,
|
|
834
|
+
documentRangeFormattingEdits: true,
|
|
835
|
+
signatureHelp: true,
|
|
836
|
+
onTypeFormattingEdits: true,
|
|
837
|
+
codeActions: true,
|
|
838
|
+
inlayHints: true,
|
|
839
|
+
checkJs: true,
|
|
840
|
+
allowJs: true,
|
|
841
|
+
noUnusedLocals: true,
|
|
842
|
+
strict: true,
|
|
843
|
+
noLib: false,
|
|
844
|
+
allowImportingTsExtensions: true,
|
|
845
|
+
moduleResolution: languages.typescript.ModuleResolutionKind.NodeJs
|
|
846
|
+
});
|
|
847
847
|
languages.typescript.javascriptDefaults.setCompilerOptions({
|
|
848
848
|
target: languages.typescript.ScriptTarget.Latest,
|
|
849
849
|
allowNonTsExtensions: true,
|
|
@@ -878,9 +878,24 @@ async function loadMonaco() {
|
|
|
878
878
|
tabSize: lang == 'python' ? 4 : 2,
|
|
879
879
|
folding
|
|
880
880
|
});
|
|
881
|
+
// const wrapper = new MonacoEditorLanguageClientWrapper()
|
|
882
|
+
// const userConfig: UserConfig = {
|
|
883
|
+
// wrapperConfig: {
|
|
884
|
+
// editorAppConfig: {
|
|
885
|
+
// $type: 'classic',
|
|
886
|
+
// codeResources: {
|
|
887
|
+
// main: {
|
|
888
|
+
// text: 'console.log("FOO")")',
|
|
889
|
+
// uri: '/workspace/hello.ts'
|
|
890
|
+
// }
|
|
891
|
+
// }
|
|
892
|
+
// }
|
|
893
|
+
// }
|
|
894
|
+
// }
|
|
895
|
+
// await wrapper.initAndStart(userConfig, divEl)
|
|
881
896
|
let timeoutModel = undefined;
|
|
882
897
|
let ataModel = undefined;
|
|
883
|
-
editor
|
|
898
|
+
editor?.onDidChangeModelContent((event) => {
|
|
884
899
|
timeoutModel && clearTimeout(timeoutModel);
|
|
885
900
|
timeoutModel = setTimeout(() => {
|
|
886
901
|
let ncode = getCode();
|
|
@@ -894,20 +909,20 @@ async function loadMonaco() {
|
|
|
894
909
|
ata?.(getCode());
|
|
895
910
|
}, 1000);
|
|
896
911
|
});
|
|
897
|
-
editor
|
|
912
|
+
editor?.onDidBlurEditorText(() => {
|
|
898
913
|
dispatch('blur');
|
|
899
914
|
});
|
|
900
|
-
editor
|
|
915
|
+
editor?.onDidFocusEditorText(() => {
|
|
901
916
|
dispatch('focus');
|
|
902
|
-
editor
|
|
917
|
+
editor?.addCommand(KeyMod.CtrlCmd | KeyCode.KeyS, function () {
|
|
903
918
|
code = getCode();
|
|
904
919
|
shouldBindKey && format && format();
|
|
905
920
|
});
|
|
906
|
-
editor
|
|
921
|
+
editor?.addCommand(KeyMod.CtrlCmd | KeyCode.Enter, function () {
|
|
907
922
|
code = getCode();
|
|
908
923
|
shouldBindKey && cmdEnterAction && cmdEnterAction();
|
|
909
924
|
});
|
|
910
|
-
editor
|
|
925
|
+
editor?.addCommand(KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Digit7, function () {
|
|
911
926
|
// CMD + slash (toggle comment) on some EU keyboards
|
|
912
927
|
editor?.trigger('keyboard', 'editor.action.commentLine', {});
|
|
913
928
|
});
|
|
@@ -941,15 +956,15 @@ async function loadMonaco() {
|
|
|
941
956
|
async function setTypescriptExtraLibs() {
|
|
942
957
|
if (lang === 'typescript' && scriptLang != 'deno') {
|
|
943
958
|
const hostname = getHostname();
|
|
944
|
-
|
|
959
|
+
const stdLib = { content: libStdContent, filePath: 'es6.d.ts' };
|
|
945
960
|
if (scriptLang == 'bun' || scriptLang == 'bunnative') {
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
961
|
+
const processLib = { content: processStdContent, filePath: 'process.d.ts' };
|
|
962
|
+
const domLib = { content: domContent, filePath: 'dom.d.ts' };
|
|
963
|
+
languages.typescript.typescriptDefaults.setExtraLibs([stdLib, domLib, processLib]);
|
|
949
964
|
}
|
|
950
965
|
else {
|
|
951
|
-
|
|
952
|
-
|
|
966
|
+
const denoFetch = { content: denoFetchContent, filePath: 'deno_fetch.d.ts' };
|
|
967
|
+
languages.typescript.typescriptDefaults.setExtraLibs([stdLib, denoFetch]);
|
|
953
968
|
let localContent = windmillFetchContent;
|
|
954
969
|
let p = '/tmp/monaco/windmill.d.ts';
|
|
955
970
|
let nuri = mUri.parse(p);
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import
|
|
3
|
-
import 'monaco-
|
|
4
|
-
import '
|
|
5
|
-
import 'monaco-editor/esm/vs/basic-languages/shell/shell.contribution';
|
|
6
|
-
import 'monaco-editor/esm/vs/basic-languages/typescript/typescript.contribution';
|
|
7
|
-
import 'monaco-editor/esm/vs/basic-languages/sql/sql.contribution';
|
|
8
|
-
import 'monaco-editor/esm/vs/basic-languages/graphql/graphql.contribution';
|
|
9
|
-
import 'monaco-editor/esm/vs/basic-languages/powershell/powershell.contribution';
|
|
10
|
-
import 'monaco-editor/esm/vs/basic-languages/php/php.contribution';
|
|
11
|
-
import 'monaco-editor/esm/vs/language/typescript/monaco.contribution';
|
|
12
|
-
import 'monaco-editor/esm/vs/basic-languages/css/css.contribution';
|
|
2
|
+
import '@codingame/monaco-vscode-standalone-languages';
|
|
3
|
+
import '@codingame/monaco-vscode-standalone-typescript-language-features';
|
|
4
|
+
import 'vscode/localExtensionHost';
|
|
13
5
|
import { type Preview } from '../gen';
|
|
14
6
|
import type { Text } from 'yjs';
|
|
7
|
+
import { editor as meditor } from 'monaco-editor';
|
|
15
8
|
declare const __propDef: {
|
|
16
9
|
props: {
|
|
17
10
|
[x: string]: any;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<script>import {
|
|
1
|
+
<script>import { isInitialized } from './vscode';
|
|
2
|
+
import { editor as meditor } from 'monaco-editor/esm/vs/editor/editor.api';
|
|
2
3
|
import { onMount } from 'svelte';
|
|
3
4
|
import DarkModeObserver from './DarkModeObserver.svelte';
|
|
4
|
-
import { isInitialized } from './vscode';
|
|
5
5
|
function onThemeChange() {
|
|
6
6
|
if (isInitialized) {
|
|
7
7
|
if (document.documentElement.classList.contains('dark')) {
|
|
@@ -1,28 +1,16 @@
|
|
|
1
|
-
<script>import
|
|
2
|
-
import json from 'svelte-highlight/languages/json';
|
|
3
|
-
import { Tab, Tabs, TabContent, Button } from './common';
|
|
1
|
+
<script>import { Tab, Tabs, TabContent } from './common';
|
|
4
2
|
import SchemaViewer from './SchemaViewer.svelte';
|
|
5
3
|
import FieldHeader from './FieldHeader.svelte';
|
|
6
|
-
import { copyToClipboard } from '../utils';
|
|
7
4
|
import FlowGraphViewer from './FlowGraphViewer.svelte';
|
|
8
|
-
import { Clipboard } from 'lucide-svelte';
|
|
9
|
-
import YAML from 'yaml';
|
|
10
|
-
import { yaml } from 'svelte-highlight/languages';
|
|
11
5
|
import HighlightTheme from './HighlightTheme.svelte';
|
|
6
|
+
import FlowViewerInner from './FlowViewerInner.svelte';
|
|
12
7
|
export let flow;
|
|
13
8
|
export let initialOpen = undefined;
|
|
14
9
|
export let noSide = false;
|
|
15
|
-
$: flowFiltered = {
|
|
16
|
-
summary: flow.summary,
|
|
17
|
-
description: flow.description,
|
|
18
|
-
value: flow.value,
|
|
19
|
-
schema: flow.schema
|
|
20
|
-
};
|
|
21
10
|
export let noGraph = false;
|
|
22
11
|
export let tab = noGraph ? 'schema' : 'ui';
|
|
23
12
|
export let noSummary = false;
|
|
24
13
|
export let noGraphDownload = false;
|
|
25
|
-
let rawType = 'yaml';
|
|
26
14
|
let open = {};
|
|
27
15
|
if (initialOpen) {
|
|
28
16
|
open[initialOpen] = true;
|
|
@@ -77,37 +65,8 @@ function toAny(x) {
|
|
|
77
65
|
<FlowGraphViewer download={!noGraphDownload} {noSide} {flow} overflowAuto />
|
|
78
66
|
</div>
|
|
79
67
|
</TabContent>
|
|
80
|
-
<TabContent value="raw"
|
|
81
|
-
|
|
82
|
-
<Tab value="yaml">YAML</Tab>
|
|
83
|
-
<Tab value="json">JSON</Tab>
|
|
84
|
-
<svelte:fragment slot="content">
|
|
85
|
-
<div class="relative pt-2">
|
|
86
|
-
<Button
|
|
87
|
-
on:click={() =>
|
|
88
|
-
copyToClipboard(
|
|
89
|
-
rawType === 'yaml'
|
|
90
|
-
? YAML.stringify(flowFiltered)
|
|
91
|
-
: JSON.stringify(flowFiltered, null, 4)
|
|
92
|
-
)}
|
|
93
|
-
color="light"
|
|
94
|
-
variant="border"
|
|
95
|
-
size="xs"
|
|
96
|
-
startIcon={{ icon: Clipboard }}
|
|
97
|
-
btnClasses="absolute top-2 right-2 w-min"
|
|
98
|
-
>
|
|
99
|
-
Copy content
|
|
100
|
-
</Button>
|
|
101
|
-
<Highlight
|
|
102
|
-
class="overflow-auto px-1"
|
|
103
|
-
language={rawType === 'yaml' ? yaml : json}
|
|
104
|
-
code={rawType === 'yaml'
|
|
105
|
-
? YAML.stringify(flowFiltered)
|
|
106
|
-
: JSON.stringify(flowFiltered, null, 4)}
|
|
107
|
-
/>
|
|
108
|
-
</div>
|
|
109
|
-
</svelte:fragment>
|
|
110
|
-
</Tabs>
|
|
68
|
+
<TabContent value="raw">
|
|
69
|
+
<FlowViewerInner {flow} />
|
|
111
70
|
</TabContent>
|
|
112
71
|
<TabContent value="schema">
|
|
113
72
|
<div class="my-4" />
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<script>import Highlight from 'svelte-highlight';
|
|
2
|
+
import json from 'svelte-highlight/languages/json';
|
|
3
|
+
import { Tab, Tabs, Button } from './common';
|
|
4
|
+
import { copyToClipboard } from '../utils';
|
|
5
|
+
import { ArrowDown, Clipboard } from 'lucide-svelte';
|
|
6
|
+
import YAML from 'yaml';
|
|
7
|
+
import { yaml } from 'svelte-highlight/languages';
|
|
8
|
+
import HighlightTheme from './HighlightTheme.svelte';
|
|
9
|
+
export let flow;
|
|
10
|
+
$: flowFiltered = {
|
|
11
|
+
summary: flow.summary,
|
|
12
|
+
description: flow.description,
|
|
13
|
+
value: flow.value,
|
|
14
|
+
schema: flow.schema
|
|
15
|
+
};
|
|
16
|
+
let rawType = 'yaml';
|
|
17
|
+
function trimStringToLines(inputString, maxLines = 100) {
|
|
18
|
+
const lines = inputString?.split('\n') ?? [];
|
|
19
|
+
const linesToKeep = lines.slice(0, maxLines);
|
|
20
|
+
return linesToKeep.join('\n');
|
|
21
|
+
}
|
|
22
|
+
let code = '';
|
|
23
|
+
function computeCode() {
|
|
24
|
+
const str = rawType === 'json' ? JSON.stringify(flowFiltered, null, 4) : YAML.stringify(flowFiltered);
|
|
25
|
+
const numberOfLines = str.split('\n').length;
|
|
26
|
+
if (numberOfLines > maxLines) {
|
|
27
|
+
shouldDisplayLoadMore = true;
|
|
28
|
+
}
|
|
29
|
+
code = str;
|
|
30
|
+
}
|
|
31
|
+
let shouldDisplayLoadMore = false;
|
|
32
|
+
$: flowFiltered && rawType && computeCode();
|
|
33
|
+
let maxLines = 100;
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<HighlightTheme />
|
|
37
|
+
|
|
38
|
+
<div>
|
|
39
|
+
<Tabs
|
|
40
|
+
bind:selected={rawType}
|
|
41
|
+
on:selected={() => {
|
|
42
|
+
maxLines = 100
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
<Tab value="yaml">YAML</Tab>
|
|
46
|
+
<Tab value="json">JSON</Tab>
|
|
47
|
+
<svelte:fragment slot="content">
|
|
48
|
+
<div class="relative pt-2">
|
|
49
|
+
<Button
|
|
50
|
+
on:click={() =>
|
|
51
|
+
copyToClipboard(
|
|
52
|
+
rawType === 'yaml'
|
|
53
|
+
? YAML.stringify(flowFiltered)
|
|
54
|
+
: JSON.stringify(flowFiltered, null, 4)
|
|
55
|
+
)}
|
|
56
|
+
color="light"
|
|
57
|
+
variant="border"
|
|
58
|
+
size="xs"
|
|
59
|
+
startIcon={{ icon: Clipboard }}
|
|
60
|
+
btnClasses="absolute top-2 right-2 w-min"
|
|
61
|
+
>
|
|
62
|
+
Copy content
|
|
63
|
+
</Button>
|
|
64
|
+
|
|
65
|
+
<div class={shouldDisplayLoadMore ? 'code-container' : ''}>
|
|
66
|
+
<Highlight
|
|
67
|
+
class="overflow-auto px-1"
|
|
68
|
+
language={rawType === 'yaml' ? yaml : json}
|
|
69
|
+
code={trimStringToLines(code, maxLines)}
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
{#if shouldDisplayLoadMore}
|
|
73
|
+
<Button
|
|
74
|
+
on:click={() => {
|
|
75
|
+
maxLines += 500
|
|
76
|
+
|
|
77
|
+
// If the code is less than the max lines, we don't need to show the button
|
|
78
|
+
if (maxLines >= code?.split('\n').length) {
|
|
79
|
+
shouldDisplayLoadMore = false
|
|
80
|
+
}
|
|
81
|
+
}}
|
|
82
|
+
color="light"
|
|
83
|
+
size="xs"
|
|
84
|
+
btnClasses="mb-2 mx-2"
|
|
85
|
+
startIcon={{ icon: ArrowDown }}
|
|
86
|
+
>
|
|
87
|
+
Show more
|
|
88
|
+
</Button>
|
|
89
|
+
{/if}
|
|
90
|
+
</div>
|
|
91
|
+
</svelte:fragment>
|
|
92
|
+
</Tabs>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<style>
|
|
96
|
+
.code-container {
|
|
97
|
+
position: relative;
|
|
98
|
+
overflow: hidden;
|
|
99
|
+
}
|
|
100
|
+
.code-container::after {
|
|
101
|
+
content: '';
|
|
102
|
+
position: absolute;
|
|
103
|
+
bottom: 0;
|
|
104
|
+
left: 0;
|
|
105
|
+
right: 0;
|
|
106
|
+
height: 100px;
|
|
107
|
+
background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgb(var(--color-surface)));
|
|
108
|
+
pointer-events: none;
|
|
109
|
+
}</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { FlowValue } from '../gen';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
flow: {
|
|
6
|
+
summary: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
value: FlowValue;
|
|
9
|
+
schema?: any;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {};
|
|
16
|
+
};
|
|
17
|
+
export type FlowViewerInnerProps = typeof __propDef.props;
|
|
18
|
+
export type FlowViewerInnerEvents = typeof __propDef.events;
|
|
19
|
+
export type FlowViewerInnerSlots = typeof __propDef.slots;
|
|
20
|
+
export default class FlowViewerInner extends SvelteComponent<FlowViewerInnerProps, FlowViewerInnerEvents, FlowViewerInnerSlots> {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -38,16 +38,18 @@ export let template = 'script';
|
|
|
38
38
|
export let initialArgs = {};
|
|
39
39
|
export let lockedLanguage = false;
|
|
40
40
|
export let showMeta = false;
|
|
41
|
+
export let neverShowMeta = false;
|
|
41
42
|
export let diffDrawer = undefined;
|
|
42
43
|
export let savedScript = undefined;
|
|
43
44
|
export let searchParams = new URLSearchParams();
|
|
44
45
|
export let disableHistoryChange = false;
|
|
45
46
|
export let replaceStateFn = (url) => window.history.replaceState(null, '', url);
|
|
46
47
|
export let customUi = {};
|
|
47
|
-
let metadataOpen =
|
|
48
|
-
(
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
let metadataOpen = !neverShowMeta &&
|
|
49
|
+
(showMeta ||
|
|
50
|
+
(initialPath == '' &&
|
|
51
|
+
searchParams.get('state') == undefined &&
|
|
52
|
+
searchParams.get('collab') == undefined));
|
|
51
53
|
let editor = undefined;
|
|
52
54
|
let scriptEditor = undefined;
|
|
53
55
|
let scheduleStore = writable({
|
|
@@ -11,6 +11,7 @@ declare const __propDef: {
|
|
|
11
11
|
initialArgs?: Record<string, any> | undefined;
|
|
12
12
|
lockedLanguage?: boolean | undefined;
|
|
13
13
|
showMeta?: boolean | undefined;
|
|
14
|
+
neverShowMeta?: boolean | undefined;
|
|
14
15
|
diffDrawer?: DiffDrawer | undefined;
|
|
15
16
|
savedScript?: NewScriptWithDraft | undefined;
|
|
16
17
|
searchParams?: URLSearchParams | undefined;
|
|
@@ -277,12 +277,7 @@ function collabUrl() {
|
|
|
277
277
|
{fixedOverflowWidgets}
|
|
278
278
|
{args}
|
|
279
279
|
/>
|
|
280
|
-
<DiffEditor
|
|
281
|
-
bind:this={diffEditor}
|
|
282
|
-
automaticLayout
|
|
283
|
-
{fixedOverflowWidgets}
|
|
284
|
-
class="hidden h-full"
|
|
285
|
-
/>
|
|
280
|
+
<DiffEditor bind:this={diffEditor} automaticLayout {fixedOverflowWidgets} />
|
|
286
281
|
{/key}
|
|
287
282
|
</div>
|
|
288
283
|
</Pane>
|