windmill-components 1.83.4 → 1.85.0
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/components/AppConnect.svelte +2 -2
- package/components/ArgInfo.svelte +4 -6
- package/components/ArgInput.svelte +12 -12
- package/components/ArgInput.svelte.d.ts +1 -2
- package/components/CronInput.svelte +1 -1
- package/components/DisplayResult.svelte +5 -7
- package/components/Dropdown.svelte +5 -4
- package/components/Editor.svelte +47 -47
- package/components/EditorBar.svelte +58 -27
- package/components/FlowBuilder.svelte +65 -59
- package/components/FlowGraphViewer.svelte +3 -8
- package/components/FlowPreviewContent.svelte +11 -9
- package/components/FlowStatusViewer.svelte +54 -44
- package/components/FolderEditor.svelte +2 -10
- package/components/FolderUsageInfo.svelte +1 -1
- package/components/GroupEditor.svelte +6 -15
- package/components/HighlightCode.svelte +1 -1
- package/components/InlineCodeCopy.svelte +2 -1
- package/components/InputTransformForm.svelte +1 -2
- package/components/InputTransformSchemaForm.svelte +1 -1
- package/components/InputTransformsViewer.svelte +1 -1
- package/components/LightweightArgInput.svelte +9 -0
- package/components/LightweightSchemaForm.svelte +1 -1
- package/components/Modal.svelte +2 -2
- package/components/ModulePreview.svelte +10 -10
- package/components/ModuleStatus.svelte +0 -1
- package/components/Multiselect.svelte +1 -0
- package/components/ObjectResourceInput.svelte +1 -23
- package/components/Path.svelte +42 -92
- package/components/Range.svelte +1 -4
- package/components/ResourceEditor.svelte +6 -6
- package/components/ResourcePicker.svelte +2 -2
- package/components/RunForm.svelte +5 -6
- package/components/ScheduleEditor.svelte +10 -10
- package/components/SchemaModal.svelte +1 -0
- package/components/SchemaModal.svelte.d.ts +1 -1
- package/components/ScriptEditor.svelte +0 -1
- package/components/SearchItems.svelte +1 -1
- package/components/SharedBadge.svelte +0 -1
- package/components/SimpleEditor.svelte +10 -36
- package/components/TemplateEditor.svelte +8 -29
- package/components/apps/components/display/AppBarChart.svelte +5 -5
- package/components/apps/components/display/AppImage.svelte +1 -1
- package/components/apps/components/display/AppPdf.svelte +12 -11
- package/components/apps/components/display/AppPdf.svelte.d.ts +1 -0
- package/components/apps/components/display/AppText.svelte +10 -10
- package/components/apps/components/display/table/AppAggridTable.svelte +25 -12
- package/components/apps/components/display/table/AppAggridTable.svelte.d.ts +1 -1
- package/components/apps/components/display/table/AppTable.svelte +1 -2
- package/components/apps/components/display/table/AppTableFooter.svelte +0 -1
- package/components/apps/components/helpers/NonRunnableComponent.svelte +1 -3
- package/components/apps/components/helpers/RunnableComponent.svelte +16 -0
- package/components/apps/components/helpers/eval.d.ts +4 -0
- package/components/apps/components/helpers/eval.js +3 -1
- package/components/apps/components/inputs/AppMultiSelect.svelte +2 -2
- package/components/apps/components/inputs/AppRangeInput.svelte +5 -5
- package/components/apps/components/inputs/AppTextInput.svelte +11 -7
- package/components/apps/components/layout/AppTabs.svelte +1 -1
- package/components/apps/editor/AppEditor.svelte +13 -17
- package/components/apps/editor/AppEditorHeader.svelte +37 -2
- package/components/apps/editor/SubGridEditor.svelte +5 -7
- package/components/apps/editor/appUtils.d.ts +2 -0
- package/components/apps/editor/appUtils.js +30 -1
- package/components/apps/editor/component/ComponentWrapper.svelte +6 -2
- package/components/apps/editor/componentsPanel/CssSettings.svelte +0 -2
- package/components/apps/editor/componentsPanel/QuickStyleMenu.svelte +2 -2
- package/components/apps/editor/contextPanel/ContextPanel.svelte +1 -2
- package/components/apps/editor/contextPanel/components/IdEditor.svelte +90 -0
- package/components/apps/editor/contextPanel/components/IdEditor.svelte.d.ts +18 -0
- package/components/apps/editor/contextPanel/components/OutputHeader.svelte +92 -21
- package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +3 -3
- package/components/apps/editor/settingsPanel/TableActions.svelte +1 -1
- package/components/apps/editor/settingsPanel/mainInput/WorkspaceFlowList.svelte +2 -5
- package/components/apps/editor/settingsPanel/mainInput/WorkspaceScriptList.svelte +2 -5
- package/components/apps/svelte-grid/utils/helper.js +1 -1
- package/components/apps/types.d.ts +6 -0
- package/components/apps/utils.d.ts +1 -3
- package/components/apps/utils.js +2 -30
- package/components/common/badge/Badge.svelte +0 -1
- package/components/common/button/ButtonPopup.svelte +13 -10
- package/components/common/drawer/Drawer.svelte +2 -2
- package/components/common/drawer/DrawerContent.svelte +1 -5
- package/components/common/popup/Popup.svelte +7 -3
- package/components/common/popup/Popup.svelte.d.ts +6 -0
- package/components/common/table/AppRow.svelte +0 -1
- package/components/common/table/FlowRow.svelte +0 -1
- package/components/common/table/ScriptRow.svelte +0 -1
- package/components/flows/CreateActionsApp.svelte +2 -2
- package/components/flows/content/DynamicInputHelpBox.svelte +1 -0
- package/components/flows/content/FlowBranchesAllWrapper.svelte +2 -2
- package/components/flows/content/FlowBranchesOneWrapper.svelte +2 -2
- package/components/flows/content/FlowInputsFlow.svelte +1 -1
- package/components/flows/content/FlowInputsFlow.svelte.d.ts +1 -3
- package/components/flows/content/FlowModuleComponent.svelte +26 -28
- package/components/flows/content/FlowModuleWrapper.svelte +0 -1
- package/components/flows/content/FlowRetries.svelte +1 -2
- package/components/flows/content/ScriptEditorDrawer.svelte +1 -1
- package/components/flows/flowStateUtils.d.ts +0 -3
- package/components/flows/flowStateUtils.js +3 -23
- package/components/flows/header/FlowPreviewButtons.svelte +0 -1
- package/components/flows/idUtils.d.ts +4 -0
- package/components/flows/idUtils.js +47 -0
- package/components/flows/map/FlowModuleSchemaItem.svelte +6 -6
- package/components/flows/map/MapItem.svelte +9 -9
- package/components/flows/map/MapItem.svelte.d.ts +0 -1
- package/components/flows/utils.d.ts +0 -2
- package/components/flows/utils.js +3 -35
- package/components/graph/FlowGraph.svelte +1 -1
- package/components/graph/svelvet/collapsible/controllers/util.js +3 -14
- package/components/graph/svelvet/container/views/GraphView.svelte +9 -14
- package/components/graph/svelvet/container/views/Svelvet.svelte +1 -0
- package/components/graph/svelvet/edges/controllers/anchorCbDev.js +5 -5
- package/components/graph/svelvet/edges/controllers/util.js +1 -1
- package/components/graph/svelvet/edges/models/Edge.js +2 -2
- package/components/graph/svelvet/edges/views/Edges/SimpleBezierEdge.svelte +1 -1
- package/components/graph/svelvet/nodes/models/Node.js +0 -1
- package/components/graph/svelvet/nodes/views/Node.svelte +0 -1
- package/components/graph/svelvet/nodes/views/Node.svelte.d.ts +0 -1
- package/components/graph/svelvet/store/controllers/util.d.ts +1 -1
- package/components/graph/svelvet/store/controllers/util.js +3 -3
- package/components/home/ItemsList.svelte +11 -11
- package/components/propertyPicker/ObjectViewer.svelte +0 -5
- package/components/propertyPicker/ObjectViewer.svelte.d.ts +0 -1
- package/components/sidebar/WorkspaceMenu.svelte +8 -4
- package/editorUtils.d.ts +3 -0
- package/editorUtils.js +5 -2
- package/gen/core/OpenAPI.js +1 -1
- package/gen/index.d.ts +1 -1
- package/gen/index.js +1 -0
- package/gen/models/MainArgSignature.d.ts +8 -0
- package/gen/models/MainArgSignature.js +8 -1
- package/infer.js +3 -0
- package/init_scripts/python_init_code.d.ts +1 -1
- package/init_scripts/python_init_code.js +2 -2
- package/package.json +673 -674
- package/stores.js +14 -1
- package/user.d.ts +1 -1
- package/user.js +6 -6
- package/components/graph/svelvet/editEdges/views/EditEdge.svelte +0 -151
- package/components/graph/svelvet/editEdges/views/EditEdge.svelte.d.ts +0 -20
- package/components/path_store.d.ts +0 -1
- package/components/path_store.js +0 -2
|
@@ -339,7 +339,7 @@ let filteredConnectsManual = [];
|
|
|
339
339
|
<h2 class="mt-8 mb-4">Non OAuth APIs & Resources</h2>
|
|
340
340
|
<div class="grid sm:grid-cols-2 md:grid-cols-3 gap-x-2 gap-y-1 items-center mb-2">
|
|
341
341
|
{#if filteredConnectsManual}
|
|
342
|
-
{#each filteredConnectsManual as [key,
|
|
342
|
+
{#each filteredConnectsManual as [key, _]}
|
|
343
343
|
<Button
|
|
344
344
|
size="sm"
|
|
345
345
|
variant="border"
|
|
@@ -383,7 +383,7 @@ let filteredConnectsManual = [];
|
|
|
383
383
|
</div>
|
|
384
384
|
{#if apiTokenApps[resource_type].img}
|
|
385
385
|
<div class="mt-4 w-full overflow-hidden">
|
|
386
|
-
<img class="m-auto
|
|
386
|
+
<img class="m-auto max-h-60" alt="connect" src={apiTokenApps[resource_type].img} />
|
|
387
387
|
</div>
|
|
388
388
|
{/if}
|
|
389
389
|
{/if}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
import Tooltip from './Tooltip.svelte';
|
|
3
|
-
import json from 'svelte-highlight/languages/json';
|
|
4
|
-
import { Highlight } from 'svelte-highlight';
|
|
5
|
-
import { ResourceService } from '../gen';
|
|
1
|
+
<script>import { ResourceService } from '../gen';
|
|
6
2
|
import { workspaceStore } from '../stores';
|
|
7
|
-
import
|
|
3
|
+
import { truncate } from '../utils';
|
|
8
4
|
import { DrawerContent } from './common';
|
|
5
|
+
import Drawer from './common/drawer/Drawer.svelte';
|
|
9
6
|
import ObjectViewer from './propertyPicker/ObjectViewer.svelte';
|
|
7
|
+
import Tooltip from './Tooltip.svelte';
|
|
10
8
|
export let value;
|
|
11
9
|
let jsonViewer;
|
|
12
10
|
let jsonViewerContent;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
<script>import { faChevronDown, faChevronUp, faDollarSign,
|
|
1
|
+
<script>import { faChevronDown, faChevronUp, faDollarSign, faPlus } from '@fortawesome/free-solid-svg-icons';
|
|
2
2
|
import { setInputCat as computeInputCat } from '../utils';
|
|
3
|
-
import {
|
|
3
|
+
import { X } from 'lucide-svelte';
|
|
4
4
|
import { createEventDispatcher } from 'svelte';
|
|
5
|
+
import autosize from 'svelte-autosize';
|
|
5
6
|
import Icon from 'svelte-awesome';
|
|
7
|
+
import { fade } from 'svelte/transition';
|
|
8
|
+
import JsonEditor from './apps/editor/settingsPanel/inputEditor/JsonEditor.svelte';
|
|
9
|
+
import { Badge, Button } from './common';
|
|
6
10
|
import FieldHeader from './FieldHeader.svelte';
|
|
11
|
+
import NumberTypeNarrowing from './NumberTypeNarrowing.svelte';
|
|
7
12
|
import ObjectResourceInput from './ObjectResourceInput.svelte';
|
|
8
13
|
import ObjectTypeNarrowing from './ObjectTypeNarrowing.svelte';
|
|
14
|
+
import Password from './Password.svelte';
|
|
15
|
+
import Range from './Range.svelte';
|
|
9
16
|
import ResourcePicker from './ResourcePicker.svelte';
|
|
10
|
-
import StringTypeNarrowing from './StringTypeNarrowing.svelte';
|
|
11
17
|
import SchemaForm from './SchemaForm.svelte';
|
|
12
18
|
import SimpleEditor from './SimpleEditor.svelte';
|
|
13
|
-
import
|
|
19
|
+
import StringTypeNarrowing from './StringTypeNarrowing.svelte';
|
|
14
20
|
import Toggle from './Toggle.svelte';
|
|
15
|
-
import Password from './Password.svelte';
|
|
16
|
-
import NumberTypeNarrowing from './NumberTypeNarrowing.svelte';
|
|
17
|
-
import Range from './Range.svelte';
|
|
18
|
-
import JsonEditor from './apps/editor/settingsPanel/inputEditor/JsonEditor.svelte';
|
|
19
|
-
import { fade } from 'svelte/transition';
|
|
20
|
-
import { X } from 'lucide-svelte';
|
|
21
21
|
export let label = '';
|
|
22
22
|
export let value;
|
|
23
23
|
export let defaultValue = undefined;
|
|
@@ -28,7 +28,6 @@ export let type = undefined;
|
|
|
28
28
|
export let required = false;
|
|
29
29
|
export let pattern = undefined;
|
|
30
30
|
export let valid = required ? false : true;
|
|
31
|
-
export let maxRows = 10;
|
|
32
31
|
export let enum_ = undefined;
|
|
33
32
|
export let disabled = false;
|
|
34
33
|
export let editableSchema = false;
|
|
@@ -45,7 +44,6 @@ export let noMargin = false;
|
|
|
45
44
|
export let extra = {};
|
|
46
45
|
let seeEditable = enum_ != undefined || pattern != undefined;
|
|
47
46
|
const dispatch = createEventDispatcher();
|
|
48
|
-
$: maxHeight = maxRows ? `${1 + maxRows * 1.2}em` : `auto`;
|
|
49
47
|
$: validateInput(pattern, value);
|
|
50
48
|
let error = '';
|
|
51
49
|
let el = undefined;
|
|
@@ -143,6 +141,7 @@ let redraw = 0;
|
|
|
143
141
|
let itemsLimit = 50;
|
|
144
142
|
</script>
|
|
145
143
|
|
|
144
|
+
<!-- svelte-ignore a11y-autofocus -->
|
|
146
145
|
<div class="flex flex-col w-full min-w-[250px]">
|
|
147
146
|
<div>
|
|
148
147
|
{#if displayHeader}
|
|
@@ -150,6 +149,7 @@ let itemsLimit = 50;
|
|
|
150
149
|
{/if}
|
|
151
150
|
{#if editableSchema}
|
|
152
151
|
<div class="p-2 my-1 text-xs border-solid border border-gray-400">
|
|
152
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
153
153
|
<span
|
|
154
154
|
class="underline"
|
|
155
155
|
on:click={() => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import type { SchemaProperty } from '../common';
|
|
3
|
+
import type ItemPicker from './ItemPicker.svelte';
|
|
3
4
|
import SimpleEditor from './SimpleEditor.svelte';
|
|
4
5
|
import type VariableEditor from './VariableEditor.svelte';
|
|
5
|
-
import type ItemPicker from './ItemPicker.svelte';
|
|
6
6
|
declare const __propDef: {
|
|
7
7
|
props: {
|
|
8
8
|
label?: string | undefined;
|
|
@@ -15,7 +15,6 @@ declare const __propDef: {
|
|
|
15
15
|
required?: boolean | undefined;
|
|
16
16
|
pattern?: undefined | string;
|
|
17
17
|
valid?: boolean | undefined;
|
|
18
|
-
maxRows?: number | undefined;
|
|
19
18
|
enum_?: string[] | undefined;
|
|
20
19
|
disabled?: boolean | undefined;
|
|
21
20
|
editableSchema?: boolean | undefined;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script>import { ScheduleService } from '../gen';
|
|
6
|
-
import { displayDate, emptyString, formatCron
|
|
6
|
+
import { displayDate, emptyString, formatCron } from '../utils';
|
|
7
7
|
import CollapseLink from './CollapseLink.svelte';
|
|
8
8
|
export let validCRON = true;
|
|
9
9
|
let preview = [];
|
|
@@ -82,19 +82,17 @@ let jsonViewer;
|
|
|
82
82
|
<div class="mb-2 text-gray-500 text-sm bg-gray-50/20">
|
|
83
83
|
as JSON <input class="windmillapp" type="checkbox" bind:checked={forceJson} /></div
|
|
84
84
|
>{/if}{#if typeof result == 'object' && Object.keys(result).length > 0}<div
|
|
85
|
-
class="mb-2 min-w-[
|
|
85
|
+
class="mb-2 min-w-[300px] text-sm text-gray-700 relative"
|
|
86
86
|
>The result keys are: <b>{truncate(Object.keys(result).join(', '), 50)}</b>
|
|
87
|
-
<div class="text-gray-500 text-sm
|
|
87
|
+
<div class="text-gray-500 text-sm absolute top-0 right-2">
|
|
88
88
|
<button on:click={jsonViewer.openDrawer}>Expand JSON</button>
|
|
89
89
|
</div></div
|
|
90
90
|
>{/if}{#if !forceJson && resultKind == 'table-col'}<div
|
|
91
|
-
class="grid grid-flow-col-dense border border-gray-200 rounded-md
|
|
91
|
+
class="grid grid-flow-col-dense border border-gray-200 rounded-md"
|
|
92
92
|
>
|
|
93
93
|
{#each Object.keys(result) as col}
|
|
94
94
|
<div class="flex flex-col max-h-40 min-w-full">
|
|
95
|
-
<div
|
|
96
|
-
class="px-12 text-left uppercase border-b bg-gray-50 overflow-hidden rounded-t-md "
|
|
97
|
-
>
|
|
95
|
+
<div class="px-12 text-left uppercase border-b bg-gray-50 overflow-hidden rounded-t-md">
|
|
98
96
|
{col}
|
|
99
97
|
</div>
|
|
100
98
|
{#if Array.isArray(result[col])}
|
|
@@ -108,7 +106,7 @@ let jsonViewer;
|
|
|
108
106
|
{/each}
|
|
109
107
|
</div>
|
|
110
108
|
{:else if !forceJson && resultKind == 'table-row'}<div
|
|
111
|
-
class="grid grid-flow-col-dense border border-gray-200
|
|
109
|
+
class="grid grid-flow-col-dense border border-gray-200"
|
|
112
110
|
>
|
|
113
111
|
<TableCustom>
|
|
114
112
|
<tbody slot="body">
|
|
@@ -39,8 +39,8 @@ const dispatch = createEventDispatcher();
|
|
|
39
39
|
dispatch('click', { item: item?.eventName })
|
|
40
40
|
}
|
|
41
41
|
}}
|
|
42
|
-
class="block w-full
|
|
43
|
-
px-4 py-2 text-sm text-gray-700 text-left
|
|
42
|
+
class="block w-full whitespace-nowrap hover:drop-shadow-sm hover:bg-gray-50 hover:bg-opacity-30
|
|
43
|
+
px-4 py-2 text-sm text-gray-700 text-left
|
|
44
44
|
{item.disabled ? 'bg-gray-200' : ''}
|
|
45
45
|
{item.separatorTop ? 'border-t' : ''} {item.separatorBottom ? 'border-b' : ''} {item.type ==
|
|
46
46
|
'delete'
|
|
@@ -64,7 +64,7 @@ const dispatch = createEventDispatcher();
|
|
|
64
64
|
<a
|
|
65
65
|
href={item.href}
|
|
66
66
|
on:click|stopPropagation|preventDefault={() => goto(item.href ?? '')}
|
|
67
|
-
class="block w-full px-4 font-semibold text-left
|
|
67
|
+
class="block w-full px-4 font-semibold text-left py-2 text-sm text-gray-700 hover:drop-shadow-sm hover:bg-gray-50 hover:bg-opacity-30
|
|
68
68
|
{item.disabled ? 'bg-gray-200' : ''}"
|
|
69
69
|
role="menuitem"
|
|
70
70
|
tabindex="-1"
|
|
@@ -81,9 +81,10 @@ const dispatch = createEventDispatcher();
|
|
|
81
81
|
{item.displayName}
|
|
82
82
|
</a>
|
|
83
83
|
{:else}
|
|
84
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
84
85
|
<span
|
|
85
86
|
class:bg-gray-50={item.disabled}
|
|
86
|
-
class="block
|
|
87
|
+
class="block text-left px-4 py-2 text-sm text-gray-700 cursor-auto"
|
|
87
88
|
role="menuitem"
|
|
88
89
|
tabindex="-1"
|
|
89
90
|
id="user-menu-item-{name}-{i}}"
|
package/components/Editor.svelte
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
<script context="module">import
|
|
1
|
+
<script context="module">import getDialogServiceOverride from 'vscode/service-override/dialogs';
|
|
2
|
+
import getNotificationServiceOverride from 'vscode/service-override/notifications';
|
|
2
3
|
import { StandaloneServices } from 'vscode/services';
|
|
3
4
|
try {
|
|
4
5
|
StandaloneServices?.initialize({
|
|
5
|
-
...
|
|
6
|
+
...getNotificationServiceOverride(document.body),
|
|
7
|
+
...getDialogServiceOverride()
|
|
6
8
|
});
|
|
7
9
|
}
|
|
8
10
|
catch (e) {
|
|
@@ -10,14 +12,12 @@ catch (e) {
|
|
|
10
12
|
}
|
|
11
13
|
</script>
|
|
12
14
|
|
|
13
|
-
<script>import { browser
|
|
15
|
+
<script>import { browser } from '$app/environment';
|
|
14
16
|
import { page } from '$app/stores';
|
|
15
17
|
import { sendUserToast } from '../utils';
|
|
16
|
-
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
|
|
17
|
-
import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker';
|
|
18
18
|
import { buildWorkerDefinition } from 'monaco-editor-workers';
|
|
19
19
|
import { createEventDispatcher, onDestroy, onMount } from 'svelte';
|
|
20
|
-
import {
|
|
20
|
+
import { editor as meditor, KeyCode, KeyMod, languages, Uri as mUri } from 'monaco-editor';
|
|
21
21
|
languages.typescript.typescriptDefaults.setCompilerOptions({
|
|
22
22
|
target: languages.typescript.ScriptTarget.Latest,
|
|
23
23
|
allowNonTsExtensions: true,
|
|
@@ -39,8 +39,8 @@ meditor.defineTheme('myTheme', {
|
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
meditor.setTheme('myTheme');
|
|
42
|
-
import { BASH_INIT_CODE, DENO_INIT_CODE_CLEAR, GO_INIT_CODE, PYTHON_INIT_CODE_CLEAR } from '../script_helpers';
|
|
43
42
|
import { createHash as randomHash, editorConfig, langToExt, updateOptions } from '../editorUtils';
|
|
43
|
+
import { BASH_INIT_CODE, DENO_INIT_CODE_CLEAR, GO_INIT_CODE, PYTHON_INIT_CODE_CLEAR } from '../script_helpers';
|
|
44
44
|
import { dirtyStore } from './common/confirmationModal/dirtyStore';
|
|
45
45
|
let divEl = null;
|
|
46
46
|
let editor;
|
|
@@ -60,24 +60,7 @@ let nbWsAttempt = 0;
|
|
|
60
60
|
let disposeMethod;
|
|
61
61
|
const dispatch = createEventDispatcher();
|
|
62
62
|
const uri = `file:///tmp/monaco/${hash}.${langToExt(lang)}`;
|
|
63
|
-
|
|
64
|
-
if (dev) {
|
|
65
|
-
buildWorkerDefinition('../../../node_modules/monaco-editor-workers/dist/workers', import.meta.url, false);
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
// @ts-ignore
|
|
69
|
-
self.MonacoEnvironment = {
|
|
70
|
-
getWorker: function (_moduleId, label) {
|
|
71
|
-
if (label === 'typescript' || label === 'javascript') {
|
|
72
|
-
return new tsWorker();
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
return new editorWorker();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
}
|
|
63
|
+
buildWorkerDefinition('../../../workers', import.meta.url, false);
|
|
81
64
|
export function getCode() {
|
|
82
65
|
return editor?.getValue() ?? '';
|
|
83
66
|
}
|
|
@@ -151,7 +134,7 @@ export async function reloadWebsocket() {
|
|
|
151
134
|
// install Monaco language client services
|
|
152
135
|
const { MonacoServices } = await import('monaco-languageclient');
|
|
153
136
|
monacoServices = MonacoServices.install();
|
|
154
|
-
function createLanguageClient(transports, name, initializationOptions) {
|
|
137
|
+
function createLanguageClient(transports, name, initializationOptions, middlewareOptions) {
|
|
155
138
|
const client = new MonacoLanguageClient({
|
|
156
139
|
name: name,
|
|
157
140
|
clientOptions: {
|
|
@@ -168,13 +151,10 @@ export async function reloadWebsocket() {
|
|
|
168
151
|
initializationOptions,
|
|
169
152
|
middleware: {
|
|
170
153
|
workspace: {
|
|
171
|
-
configuration:
|
|
172
|
-
|
|
173
|
-
{
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
];
|
|
177
|
-
}
|
|
154
|
+
configuration: middlewareOptions ??
|
|
155
|
+
((params, token, next) => {
|
|
156
|
+
return [{ enabled: true }];
|
|
157
|
+
})
|
|
178
158
|
}
|
|
179
159
|
}
|
|
180
160
|
},
|
|
@@ -186,14 +166,17 @@ export async function reloadWebsocket() {
|
|
|
186
166
|
});
|
|
187
167
|
return client;
|
|
188
168
|
}
|
|
189
|
-
async function connectToLanguageServer(url, name,
|
|
169
|
+
async function connectToLanguageServer(url, name, initOptions, middlewareOptions) {
|
|
190
170
|
try {
|
|
191
171
|
const webSocket = new WebSocket(url);
|
|
192
172
|
webSocket.onopen = async () => {
|
|
193
173
|
const socket = toSocket(webSocket);
|
|
194
174
|
const reader = new WebSocketMessageReader(socket);
|
|
195
175
|
const writer = new WebSocketMessageWriter(socket);
|
|
196
|
-
const languageClient = createLanguageClient({ reader, writer }, name,
|
|
176
|
+
const languageClient = createLanguageClient({ reader, writer }, name, initOptions, middlewareOptions);
|
|
177
|
+
if (middlewareOptions != undefined) {
|
|
178
|
+
languageClient.registerConfigurationFeatures();
|
|
179
|
+
}
|
|
197
180
|
websockets.push([languageClient, webSocket]);
|
|
198
181
|
// HACK ALERT: for some reasons, the client need to be restarted to take into account the 'go get <dep>' command
|
|
199
182
|
// the only way I could figure out to listen for this event is this. I'm sure there is a better way to do this
|
|
@@ -285,18 +268,33 @@ export async function reloadWebsocket() {
|
|
|
285
268
|
}
|
|
286
269
|
}
|
|
287
270
|
}
|
|
288
|
-
});
|
|
271
|
+
}, undefined);
|
|
289
272
|
}
|
|
290
273
|
else if (lang === 'python') {
|
|
291
|
-
await connectToLanguageServer(`${wsProtocol}://${$page.url.host}/ws/pyright`, 'pyright', {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
274
|
+
await connectToLanguageServer(`${wsProtocol}://${$page.url.host}/ws/pyright`, 'pyright', {}, (params, token, next) => {
|
|
275
|
+
if (params.items.find((x) => x.section === 'python')) {
|
|
276
|
+
return [
|
|
277
|
+
{
|
|
278
|
+
analysis: {
|
|
279
|
+
useLibraryCodeForTypes: true,
|
|
280
|
+
autoImportCompletions: true,
|
|
281
|
+
diagnosticSeverityOverrides: { reportMissingImports: 'none' },
|
|
282
|
+
typeCheckingMode: 'basic'
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
];
|
|
286
|
+
}
|
|
287
|
+
if (params.items.find((x) => x.section === 'python.analysis')) {
|
|
288
|
+
return [
|
|
289
|
+
{
|
|
290
|
+
useLibraryCodeForTypes: true,
|
|
291
|
+
autoImportCompletions: true,
|
|
292
|
+
diagnosticSeverityOverrides: { reportMissingImports: 'none' },
|
|
293
|
+
typeCheckingMode: 'basic'
|
|
294
|
+
}
|
|
295
|
+
];
|
|
296
|
+
}
|
|
297
|
+
return next(params, token);
|
|
300
298
|
});
|
|
301
299
|
connectToLanguageServer(`${wsProtocol}://${$page.url.host}/ws/black`, 'black', {
|
|
302
300
|
formatters: {
|
|
@@ -308,12 +306,12 @@ export async function reloadWebsocket() {
|
|
|
308
306
|
formatFiletypes: {
|
|
309
307
|
python: 'black'
|
|
310
308
|
}
|
|
311
|
-
});
|
|
309
|
+
}, undefined);
|
|
312
310
|
}
|
|
313
311
|
else if (lang === 'go') {
|
|
314
312
|
connectToLanguageServer(`${wsProtocol}://${$page.url.host}/ws/go`, 'go', {
|
|
315
313
|
'build.allowImplicitNetworkAccess': true
|
|
316
|
-
});
|
|
314
|
+
}, undefined);
|
|
317
315
|
}
|
|
318
316
|
websocketInterval && clearInterval(websocketInterval);
|
|
319
317
|
websocketInterval = setInterval(() => {
|
|
@@ -360,11 +358,13 @@ async function closeWebsockets() {
|
|
|
360
358
|
websockets = [];
|
|
361
359
|
websocketInterval && clearInterval(websocketInterval);
|
|
362
360
|
}
|
|
361
|
+
let widgets = document.getElementById('monaco-widgets-root') ?? undefined;
|
|
363
362
|
async function loadMonaco() {
|
|
364
363
|
const model = meditor.createModel(code, lang, mUri.parse(uri));
|
|
365
364
|
model.updateOptions(updateOptions);
|
|
366
365
|
editor = meditor.create(divEl, {
|
|
367
366
|
...editorConfig(model, code, lang, automaticLayout, fixedOverflowWidgets),
|
|
367
|
+
overflowWidgetsDomNode: widgets,
|
|
368
368
|
tabSize: lang == 'python' ? 4 : 2
|
|
369
369
|
});
|
|
370
370
|
let timeoutModel = undefined;
|
|
@@ -56,6 +56,7 @@ async function onScriptPick(e) {
|
|
|
56
56
|
codeViewer?.openDrawer?.();
|
|
57
57
|
codeObj = await getScriptByPath(e.detail.path ?? '');
|
|
58
58
|
}
|
|
59
|
+
let version = __pkg__.version;
|
|
59
60
|
</script>
|
|
60
61
|
|
|
61
62
|
<Drawer bind:this={scriptPicker} size="900px">
|
|
@@ -113,7 +114,7 @@ async function onScriptPick(e) {
|
|
|
113
114
|
if (lang == 'deno') {
|
|
114
115
|
if (!editor.getCode().includes('import * as wmill from')) {
|
|
115
116
|
editor.insertAtBeginning(
|
|
116
|
-
`import * as wmill from 'https://deno.land/x/windmill@v${
|
|
117
|
+
`import * as wmill from 'https://deno.land/x/windmill@v${version}/mod.ts'\n`
|
|
117
118
|
)
|
|
118
119
|
}
|
|
119
120
|
editor.insertAtCursor(`(await wmill.getVariable('${path}'))`)
|
|
@@ -160,7 +161,7 @@ async function onScriptPick(e) {
|
|
|
160
161
|
if (lang == 'deno') {
|
|
161
162
|
if (!editor.getCode().includes('import * as wmill from')) {
|
|
162
163
|
editor.insertAtBeginning(
|
|
163
|
-
`import * as wmill from 'https://deno.land/x/windmill@v${
|
|
164
|
+
`import * as wmill from 'https://deno.land/x/windmill@v${version}/mod.ts'\n`
|
|
164
165
|
)
|
|
165
166
|
}
|
|
166
167
|
editor.insertAtCursor(`(await wmill.getResource('${path}'))`)
|
|
@@ -210,7 +211,13 @@ async function onScriptPick(e) {
|
|
|
210
211
|
{validCode ? 'Valid' : 'Invalid'}
|
|
211
212
|
</Badge>
|
|
212
213
|
<div class="flex items-center divide-x">
|
|
213
|
-
<Popover
|
|
214
|
+
<Popover
|
|
215
|
+
notClickable
|
|
216
|
+
placement="bottom"
|
|
217
|
+
disapperTimoout={0}
|
|
218
|
+
class="pr-1"
|
|
219
|
+
disablePopup={!iconOnly}
|
|
220
|
+
>
|
|
214
221
|
<Button
|
|
215
222
|
color="light"
|
|
216
223
|
btnClasses="!font-medium !h-full"
|
|
@@ -222,11 +229,15 @@ async function onScriptPick(e) {
|
|
|
222
229
|
>
|
|
223
230
|
+Context Var
|
|
224
231
|
</Button>
|
|
225
|
-
<svelte:fragment slot="text">
|
|
226
|
-
Add context variable
|
|
227
|
-
</svelte:fragment>
|
|
232
|
+
<svelte:fragment slot="text">Add context variable</svelte:fragment>
|
|
228
233
|
</Popover>
|
|
229
|
-
<Popover
|
|
234
|
+
<Popover
|
|
235
|
+
notClickable
|
|
236
|
+
placement="bottom"
|
|
237
|
+
disapperTimoout={0}
|
|
238
|
+
class="px-1"
|
|
239
|
+
disablePopup={!iconOnly}
|
|
240
|
+
>
|
|
230
241
|
<Button
|
|
231
242
|
color="light"
|
|
232
243
|
btnClasses="!font-medium !h-full"
|
|
@@ -238,11 +249,15 @@ async function onScriptPick(e) {
|
|
|
238
249
|
>
|
|
239
250
|
+Variable
|
|
240
251
|
</Button>
|
|
241
|
-
<svelte:fragment slot="text">
|
|
242
|
-
Add variable
|
|
243
|
-
</svelte:fragment>
|
|
252
|
+
<svelte:fragment slot="text">Add variable</svelte:fragment>
|
|
244
253
|
</Popover>
|
|
245
|
-
<Popover
|
|
254
|
+
<Popover
|
|
255
|
+
notClickable
|
|
256
|
+
placement="bottom"
|
|
257
|
+
disapperTimoout={0}
|
|
258
|
+
class="px-1"
|
|
259
|
+
disablePopup={!iconOnly}
|
|
260
|
+
>
|
|
246
261
|
<Button
|
|
247
262
|
btnClasses="!font-medium !h-full"
|
|
248
263
|
size="xs"
|
|
@@ -254,11 +269,15 @@ async function onScriptPick(e) {
|
|
|
254
269
|
>
|
|
255
270
|
+Resource
|
|
256
271
|
</Button>
|
|
257
|
-
<svelte:fragment slot="text">
|
|
258
|
-
Add resource
|
|
259
|
-
</svelte:fragment>
|
|
272
|
+
<svelte:fragment slot="text">Add resource</svelte:fragment>
|
|
260
273
|
</Popover>
|
|
261
|
-
<Popover
|
|
274
|
+
<Popover
|
|
275
|
+
notClickable
|
|
276
|
+
placement="bottom"
|
|
277
|
+
disapperTimoout={0}
|
|
278
|
+
class="px-1"
|
|
279
|
+
disablePopup={!iconOnly}
|
|
280
|
+
>
|
|
262
281
|
<Button
|
|
263
282
|
btnClasses="!font-medium !h-full"
|
|
264
283
|
size="xs"
|
|
@@ -270,11 +289,15 @@ async function onScriptPick(e) {
|
|
|
270
289
|
>
|
|
271
290
|
Reset
|
|
272
291
|
</Button>
|
|
273
|
-
<svelte:fragment slot="text">
|
|
274
|
-
Reset
|
|
275
|
-
</svelte:fragment>
|
|
292
|
+
<svelte:fragment slot="text">Reset</svelte:fragment>
|
|
276
293
|
</Popover>
|
|
277
|
-
<Popover
|
|
294
|
+
<Popover
|
|
295
|
+
notClickable
|
|
296
|
+
placement="bottom"
|
|
297
|
+
disapperTimoout={0}
|
|
298
|
+
class="px-1"
|
|
299
|
+
disablePopup={!iconOnly}
|
|
300
|
+
>
|
|
278
301
|
<Button
|
|
279
302
|
btnClasses="!font-medium !h-full"
|
|
280
303
|
size="xs"
|
|
@@ -297,11 +320,15 @@ async function onScriptPick(e) {
|
|
|
297
320
|
{/if}
|
|
298
321
|
</span>
|
|
299
322
|
</Button>
|
|
300
|
-
<svelte:fragment slot="text">
|
|
301
|
-
Reload assistant
|
|
302
|
-
</svelte:fragment>
|
|
323
|
+
<svelte:fragment slot="text">Reload assistant</svelte:fragment>
|
|
303
324
|
</Popover>
|
|
304
|
-
<Popover
|
|
325
|
+
<Popover
|
|
326
|
+
notClickable
|
|
327
|
+
placement="bottom"
|
|
328
|
+
disapperTimoout={0}
|
|
329
|
+
class="px-1"
|
|
330
|
+
disablePopup={!iconOnly}
|
|
331
|
+
>
|
|
305
332
|
<Button
|
|
306
333
|
btnClasses="!font-medium"
|
|
307
334
|
size="xs"
|
|
@@ -319,7 +346,13 @@ async function onScriptPick(e) {
|
|
|
319
346
|
</Popover>
|
|
320
347
|
</div>
|
|
321
348
|
</div>
|
|
322
|
-
<Popover
|
|
349
|
+
<Popover
|
|
350
|
+
notClickable
|
|
351
|
+
placement="bottom"
|
|
352
|
+
disapperTimoout={0}
|
|
353
|
+
class="px-1"
|
|
354
|
+
disablePopup={!iconOnly}
|
|
355
|
+
>
|
|
323
356
|
<Button
|
|
324
357
|
btnClasses="!font-medium"
|
|
325
358
|
size="xs"
|
|
@@ -331,9 +364,7 @@ async function onScriptPick(e) {
|
|
|
331
364
|
>
|
|
332
365
|
Script
|
|
333
366
|
</Button>
|
|
334
|
-
<svelte:fragment slot="text">
|
|
335
|
-
Script
|
|
336
|
-
</svelte:fragment>
|
|
367
|
+
<svelte:fragment slot="text">Script</svelte:fragment>
|
|
337
368
|
</Popover>
|
|
338
369
|
</div>
|
|
339
370
|
|