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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import { Alert,
|
|
1
|
+
<script>import { Alert, Tab } from '../../common';
|
|
2
2
|
import TabContent from '../../common/tabs/TabContent.svelte';
|
|
3
3
|
import Tabs from '../../common/tabs/Tabs.svelte';
|
|
4
4
|
import Toggle from '../../Toggle.svelte';
|
|
@@ -26,7 +26,7 @@ let selected = 'early-stop';
|
|
|
26
26
|
<h3 class="mb-4">{value.branches.length} branch{value.branches.length > 1 ? 'es' : ''}</h3
|
|
27
27
|
>
|
|
28
28
|
<div class="flex flex-col gap-y-4 py-2 w-full max-w-xl">
|
|
29
|
-
{#each value.branches as branch
|
|
29
|
+
{#each value.branches as branch}
|
|
30
30
|
<div class="flex flex-row gap-x-4 w-full items-center">
|
|
31
31
|
<div class="grow">
|
|
32
32
|
<input type="text" bind:value={branch.summary} placeholder="Summary" />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import { Alert, Badge,
|
|
1
|
+
<script>import { Alert, Badge, Tab } from '../../common';
|
|
2
2
|
import TabContent from '../../common/tabs/TabContent.svelte';
|
|
3
3
|
import Tabs from '../../common/tabs/Tabs.svelte';
|
|
4
4
|
import FlowCard from '../common/FlowCard.svelte';
|
|
@@ -34,7 +34,7 @@ let selected = 'early-stop';
|
|
|
34
34
|
chosen</p
|
|
35
35
|
>
|
|
36
36
|
</div>
|
|
37
|
-
{#each value.branches as branch
|
|
37
|
+
{#each value.branches as branch}
|
|
38
38
|
<div class="flex flex-col gap-x-2 p-2 items-center border border-gray-400">
|
|
39
39
|
<input
|
|
40
40
|
class="w-full"
|
|
@@ -7,7 +7,7 @@ import { emptyString } from '../../../utils';
|
|
|
7
7
|
import { createEventDispatcher } from 'svelte';
|
|
8
8
|
import { flip } from 'svelte/animate';
|
|
9
9
|
import { fade } from 'svelte/transition';
|
|
10
|
-
export let failureModule
|
|
10
|
+
// export let failureModule: boolean
|
|
11
11
|
const dispatch = createEventDispatcher();
|
|
12
12
|
let items = undefined;
|
|
13
13
|
let filteredItems = undefined;
|
|
@@ -154,33 +154,31 @@ let forceReload = 0;
|
|
|
154
154
|
<Splitpanes horizontal>
|
|
155
155
|
<Pane size={isScript ? 30 : 50} minSize={20}>
|
|
156
156
|
{#if value.type === 'rawscript'}
|
|
157
|
-
<
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
/>
|
|
183
|
-
</div>
|
|
157
|
+
<Editor
|
|
158
|
+
bind:websocketAlive
|
|
159
|
+
bind:this={editor}
|
|
160
|
+
class="h-full relative"
|
|
161
|
+
bind:code={value.content}
|
|
162
|
+
deno={value.language === RawScript.language.DENO}
|
|
163
|
+
lang={scriptLangToEditorLang(value.language)}
|
|
164
|
+
automaticLayout={true}
|
|
165
|
+
cmdEnterAction={async () => {
|
|
166
|
+
selected = 'test'
|
|
167
|
+
if (value.type === 'rawscript') {
|
|
168
|
+
value.content = editor.getCode()
|
|
169
|
+
}
|
|
170
|
+
await reload(flowModule)
|
|
171
|
+
modulePreview?.runTestWithStepArgs()
|
|
172
|
+
}}
|
|
173
|
+
on:change={async (event) => {
|
|
174
|
+
if (flowModule.value.type === 'rawscript') {
|
|
175
|
+
flowModule.value.content = event.detail
|
|
176
|
+
}
|
|
177
|
+
await reload(flowModule)
|
|
178
|
+
}}
|
|
179
|
+
formatAction={() => reload(flowModule)}
|
|
180
|
+
fixedOverflowWidgets={true}
|
|
181
|
+
/>
|
|
184
182
|
{:else if value.type === 'script'}
|
|
185
183
|
{#key forceReload}
|
|
186
184
|
<FlowModuleScript path={value.path} hash={value.hash} />
|
|
@@ -239,7 +237,7 @@ let forceReload = 0;
|
|
|
239
237
|
<FlowModuleSleep previousModuleId={previousModule?.id} bind:flowModule />
|
|
240
238
|
</div>
|
|
241
239
|
{:else if selected === 'advanced-same_worker'}
|
|
242
|
-
<div class="p-4
|
|
240
|
+
<div class="p-4 h-full overflow-auto">
|
|
243
241
|
<Alert type="info" title="Share a directory between steps">
|
|
244
242
|
If shared directory is set, will share a folder that will be mounted on
|
|
245
243
|
`./shared` for each of them to pass data between each other.
|
|
@@ -35,7 +35,6 @@ export let previousModule = undefined;
|
|
|
35
35
|
|
|
36
36
|
{#if flowModule.value.flow}
|
|
37
37
|
<FlowInputsFlow
|
|
38
|
-
failureModule={$selectedId === 'failure'}
|
|
39
38
|
on:pick={async ({ detail }) => {
|
|
40
39
|
const { path, summary } = detail
|
|
41
40
|
const [module, state] = await pickFlow(path, summary, flowModule.id)
|
|
@@ -3,7 +3,7 @@ import ScriptEditor from '../../ScriptEditor.svelte';
|
|
|
3
3
|
import { ScriptService } from '../../../gen';
|
|
4
4
|
import { inferArgs } from '../../../infer';
|
|
5
5
|
import { workspaceStore } from '../../../stores';
|
|
6
|
-
import { emptySchema,
|
|
6
|
+
import { emptySchema, sendUserToast } from '../../../utils';
|
|
7
7
|
import { faSave } from '@fortawesome/free-solid-svg-icons';
|
|
8
8
|
import { Loader2 } from 'lucide-svelte';
|
|
9
9
|
import { createEventDispatcher } from 'svelte';
|
|
@@ -2,10 +2,7 @@ import type { Schema } from '../../common';
|
|
|
2
2
|
import { Script, type Flow, type FlowModule, type PathFlow, type PathScript, type RawScript } from '../../gen';
|
|
3
3
|
import { type Writable } from 'svelte/store';
|
|
4
4
|
import type { FlowModuleState, FlowState } from './flowState';
|
|
5
|
-
import { Mutex } from 'async-mutex';
|
|
6
5
|
export declare function loadFlowModuleState(flowModule: FlowModule): Promise<FlowModuleState>;
|
|
7
|
-
export declare const idMutex: Mutex;
|
|
8
|
-
export declare function getNextId(currentKeys: string[]): string;
|
|
9
6
|
export declare function nextId(flowState: FlowState): string;
|
|
10
7
|
export declare function pickScript(path: string, summary: string, id: string, hash?: string): Promise<[FlowModule & {
|
|
11
8
|
value: PathScript;
|
|
@@ -3,8 +3,8 @@ import { initialCode } from '../../script_helpers';
|
|
|
3
3
|
import { userStore, workspaceStore } from '../../stores';
|
|
4
4
|
import { getScriptByPath } from '../../utils';
|
|
5
5
|
import { get } from 'svelte/store';
|
|
6
|
-
import { charsToNumber,
|
|
7
|
-
import {
|
|
6
|
+
import { charsToNumber, numberToChars } from './idUtils';
|
|
7
|
+
import { emptyFlowModuleState, findNextAvailablePath, loadSchemaFromModule, NEVER_TESTED_THIS_FAR } from './utils';
|
|
8
8
|
export async function loadFlowModuleState(flowModule) {
|
|
9
9
|
try {
|
|
10
10
|
const { input_transforms, schema } = await loadSchemaFromModule(flowModule);
|
|
@@ -20,26 +20,6 @@ export async function loadFlowModuleState(flowModule) {
|
|
|
20
20
|
return emptyFlowModuleState();
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
export const idMutex = new Mutex();
|
|
24
|
-
const forbiddenIds = ['do'];
|
|
25
|
-
export function getNextId(currentKeys) {
|
|
26
|
-
const max = currentKeys.reduce((acc, key) => {
|
|
27
|
-
if (key === 'failure' || key.includes('branch') || key.includes('loop')) {
|
|
28
|
-
return acc;
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
const num = charsToNumber(key);
|
|
32
|
-
return Math.max(acc, num + 1);
|
|
33
|
-
}
|
|
34
|
-
}, 0);
|
|
35
|
-
const char = numberToChars(max);
|
|
36
|
-
if (forbiddenIds.includes(char)) {
|
|
37
|
-
return getNextId(currentKeys.concat(char));
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
return char;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
23
|
// Computes the next available id
|
|
44
24
|
export function nextId(flowState) {
|
|
45
25
|
const max = Object.keys(flowState).reduce((acc, key) => {
|
|
@@ -163,7 +143,7 @@ export async function createScriptFromInlineScript(flowModule, suffix, schema, f
|
|
|
163
143
|
const originalScriptPath = flowModule.value.path;
|
|
164
144
|
const wasForked = Boolean(originalScriptPath);
|
|
165
145
|
if (wasForked && originalScriptPath) {
|
|
166
|
-
const [
|
|
146
|
+
const [_first, _second, ...others] = originalScriptPath.split('/');
|
|
167
147
|
suffix = others.join('/');
|
|
168
148
|
}
|
|
169
149
|
const path = `${flow.path}/${suffix}`;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const aCharCode = 'a'.charCodeAt(0);
|
|
2
|
+
export const forbiddenIds = ['do', 'bg', 'ctx', 'state'];
|
|
3
|
+
export function numberToChars(n) {
|
|
4
|
+
if (n < 0) {
|
|
5
|
+
return '-' + numberToChars(-n);
|
|
6
|
+
}
|
|
7
|
+
var b = [n], sp, out, i, div;
|
|
8
|
+
sp = 0;
|
|
9
|
+
while (sp < b.length) {
|
|
10
|
+
if (b[sp] > 25) {
|
|
11
|
+
div = Math.floor(b[sp] / 26);
|
|
12
|
+
b[sp + 1] = div - 1;
|
|
13
|
+
b[sp] %= 26;
|
|
14
|
+
}
|
|
15
|
+
sp += 1;
|
|
16
|
+
}
|
|
17
|
+
out = '';
|
|
18
|
+
for (i = 0; i < b.length; i += 1) {
|
|
19
|
+
let charCode = aCharCode + b[i];
|
|
20
|
+
out = String.fromCharCode(charCode) + out;
|
|
21
|
+
}
|
|
22
|
+
return out;
|
|
23
|
+
}
|
|
24
|
+
export function getNextId(currentKeys) {
|
|
25
|
+
const takenKeys = [...currentKeys, ...forbiddenIds].map(charsToNumber);
|
|
26
|
+
let i = charsToNumber('a');
|
|
27
|
+
while (true) {
|
|
28
|
+
if (!takenKeys.includes(i)) {
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
i++;
|
|
32
|
+
}
|
|
33
|
+
return numberToChars(i);
|
|
34
|
+
}
|
|
35
|
+
export function charsToNumber(n) {
|
|
36
|
+
if (n.charAt(0) == '-') {
|
|
37
|
+
return charsToNumber(n.slice(1)) * -1;
|
|
38
|
+
}
|
|
39
|
+
let b = Math.pow(26, n.length - 1);
|
|
40
|
+
let res = 0;
|
|
41
|
+
for (let c of n) {
|
|
42
|
+
let charCode = c == '-' || c == '_' ? aCharCode + 25 : c.charCodeAt(0);
|
|
43
|
+
res += (charCode - aCharCode + 1) * b;
|
|
44
|
+
b = b / 26;
|
|
45
|
+
}
|
|
46
|
+
return res - 1;
|
|
47
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script>import Badge from '../../common/badge/Badge.svelte';
|
|
2
2
|
import Popover from '../../Popover.svelte';
|
|
3
3
|
import { classNames } from '../../../utils';
|
|
4
|
+
import { Bed, Move, PhoneIncoming, Repeat, Square, X } from 'lucide-svelte';
|
|
4
5
|
import { createEventDispatcher } from 'svelte';
|
|
5
6
|
import { fade } from 'svelte/transition';
|
|
6
|
-
import { Bed, Move, PhoneIncoming, Repeat, Square, X } from 'lucide-svelte';
|
|
7
7
|
export let selected = false;
|
|
8
8
|
export let deletable = false;
|
|
9
9
|
export let retry = false;
|
|
@@ -75,7 +75,7 @@ const dispatch = createEventDispatcher();
|
|
|
75
75
|
{/if}
|
|
76
76
|
</div>
|
|
77
77
|
<div
|
|
78
|
-
class="flex gap-1 justify-between items-center w-full overflow-hidden rounded-sm
|
|
78
|
+
class="flex gap-1 justify-between items-center w-full overflow-hidden rounded-sm
|
|
79
79
|
border border-gray-400 p-2 text-2xs module"
|
|
80
80
|
>
|
|
81
81
|
{#if $$slots.icon}
|
|
@@ -91,8 +91,8 @@ const dispatch = createEventDispatcher();
|
|
|
91
91
|
</div>
|
|
92
92
|
{#if deletable}
|
|
93
93
|
<button
|
|
94
|
-
class="absolute -top-2 -right-2 rounded-full h-4 w-4 trash center-center
|
|
95
|
-
border-[1.5px] border-gray-700 bg-white duration-150 hover:bg-red-400 hover:text-white
|
|
94
|
+
class="absolute -top-2 -right-2 rounded-full h-4 w-4 trash center-center
|
|
95
|
+
border-[1.5px] border-gray-700 bg-white duration-150 hover:bg-red-400 hover:text-white
|
|
96
96
|
hover:border-red-700 {selected ? '' : '!hidden'}"
|
|
97
97
|
on:click|preventDefault|stopPropagation={(event) =>
|
|
98
98
|
dispatch('delete', { event, id, type: modType })}
|
|
@@ -101,8 +101,8 @@ const dispatch = createEventDispatcher();
|
|
|
101
101
|
</button>
|
|
102
102
|
|
|
103
103
|
<button
|
|
104
|
-
class="absolute -top-2 right-10 rounded-full h-4 w-4 trash center-center
|
|
105
|
-
border-[1.5px] border-gray-700 bg-white duration-150 hover:bg-blue-400 hover:text-white
|
|
104
|
+
class="absolute -top-2 right-10 rounded-full h-4 w-4 trash center-center
|
|
105
|
+
border-[1.5px] border-gray-700 bg-white duration-150 hover:bg-blue-400 hover:text-white
|
|
106
106
|
hover:border-blue-700 {selected ? '' : '!hidden'}"
|
|
107
107
|
on:click|preventDefault|stopPropagation={(event) => dispatch('move')}
|
|
108
108
|
>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
<script>import { Button } from '../../common';
|
|
2
|
+
import LanguageIcon from '../../common/languageIcons/LanguageIcon.svelte';
|
|
3
|
+
import IconedResourceType from '../../IconedResourceType.svelte';
|
|
4
4
|
import { faBarsStaggered, faCodeBranch, faLongArrowDown } from '@fortawesome/free-solid-svg-icons';
|
|
5
|
+
import { Building, ClipboardCopy, GitBranchPlus, Repeat, Square } from 'lucide-svelte';
|
|
6
|
+
import { createEventDispatcher, getContext } from 'svelte';
|
|
5
7
|
import Icon from 'svelte-awesome';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { Building, ClipboardCopy, GitBranchPlus, Move, Repeat, Square } from 'lucide-svelte';
|
|
9
|
-
import { Button } from '../../common';
|
|
8
|
+
import FlowModuleSchemaItem from './FlowModuleSchemaItem.svelte';
|
|
9
|
+
import InsertModuleButton from './InsertModuleButton.svelte';
|
|
10
10
|
export let mod;
|
|
11
11
|
export let trigger;
|
|
12
12
|
export let insertable;
|
|
13
13
|
export let insertableEnd = false;
|
|
14
|
-
export let annotation = undefined
|
|
14
|
+
// export let annotation: string | undefined = undefined
|
|
15
15
|
export let branchable = false;
|
|
16
16
|
export let bgColor = '';
|
|
17
17
|
export let modules;
|
|
@@ -168,7 +168,7 @@ let openMenu2 = undefined;
|
|
|
168
168
|
dispatch('insert', { modules, index: idx + 1, detail: 'move' })
|
|
169
169
|
}}
|
|
170
170
|
type="button"
|
|
171
|
-
class=" text-gray-900 bg-white border mx-0.5
|
|
171
|
+
class=" text-gray-900 bg-white border mx-0.5 border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-200 font-medium rounded-full text-sm w-6 h-6 flex items-center justify-center"
|
|
172
172
|
>
|
|
173
173
|
<ClipboardCopy size={12} />
|
|
174
174
|
</button>
|
|
@@ -15,6 +15,4 @@ export declare function runFlowPreview(args: Record<string, any>, flow: Flow): P
|
|
|
15
15
|
export declare function codeToStaticTemplate(code?: string): string | undefined;
|
|
16
16
|
export declare const NEVER_TESTED_THIS_FAR = "never tested this far";
|
|
17
17
|
export declare function emptyFlowModuleState(): FlowModuleState;
|
|
18
|
-
export declare function numberToChars(n: number): any;
|
|
19
|
-
export declare function charsToNumber(n: string): number;
|
|
20
18
|
export declare function findNextAvailablePath(path: string): Promise<string>;
|
|
@@ -124,6 +124,9 @@ export function codeToStaticTemplate(code) {
|
|
|
124
124
|
if (line[0] == '`' && line.charAt(line.length - 1) == '`') {
|
|
125
125
|
return line.slice(1, line.length - 1).replaceAll('\\`', '`');
|
|
126
126
|
}
|
|
127
|
+
else {
|
|
128
|
+
return `\$\{${line}\}`;
|
|
129
|
+
}
|
|
127
130
|
}
|
|
128
131
|
return undefined;
|
|
129
132
|
}
|
|
@@ -134,41 +137,6 @@ export function emptyFlowModuleState() {
|
|
|
134
137
|
previewResult: NEVER_TESTED_THIS_FAR
|
|
135
138
|
};
|
|
136
139
|
}
|
|
137
|
-
const aCharCode = 'a'.charCodeAt(0);
|
|
138
|
-
export function numberToChars(n) {
|
|
139
|
-
if (n < 0) {
|
|
140
|
-
return '-' + numberToChars(-n);
|
|
141
|
-
}
|
|
142
|
-
var b = [n], sp, out, i, div;
|
|
143
|
-
sp = 0;
|
|
144
|
-
while (sp < b.length) {
|
|
145
|
-
if (b[sp] > 25) {
|
|
146
|
-
div = Math.floor(b[sp] / 26);
|
|
147
|
-
b[sp + 1] = div - 1;
|
|
148
|
-
b[sp] %= 26;
|
|
149
|
-
}
|
|
150
|
-
sp += 1;
|
|
151
|
-
}
|
|
152
|
-
out = '';
|
|
153
|
-
for (i = 0; i < b.length; i += 1) {
|
|
154
|
-
let charCode = aCharCode + b[i];
|
|
155
|
-
out = String.fromCharCode(charCode) + out;
|
|
156
|
-
}
|
|
157
|
-
return out;
|
|
158
|
-
}
|
|
159
|
-
export function charsToNumber(n) {
|
|
160
|
-
if (n.charAt(0) == '-') {
|
|
161
|
-
return charsToNumber(n.slice(1)) * -1;
|
|
162
|
-
}
|
|
163
|
-
let b = Math.pow(26, n.length - 1);
|
|
164
|
-
let res = 0;
|
|
165
|
-
for (let c of n) {
|
|
166
|
-
let charCode = c == '-' || c == '_' ? aCharCode + 25 : c.charCodeAt(0);
|
|
167
|
-
res += (charCode - aCharCode + 1) * b;
|
|
168
|
-
b = b / 26;
|
|
169
|
-
}
|
|
170
|
-
return res - 1;
|
|
171
|
-
}
|
|
172
140
|
export async function findNextAvailablePath(path) {
|
|
173
141
|
try {
|
|
174
142
|
await ScriptService.getScriptByPath({
|
|
@@ -14,22 +14,12 @@ export function populateCollapsibleStore(store, userNodes, userEdges, canvasId)
|
|
|
14
14
|
}
|
|
15
15
|
store.collapsibleStore.set(newCollapsibleStore);
|
|
16
16
|
}
|
|
17
|
-
/*
|
|
18
|
-
|
|
19
|
-
*/
|
|
20
|
-
function incrementHideCount(store, nodeId) {
|
|
21
|
-
const collapsibles = get(store.collapsibleStore);
|
|
22
|
-
for (let collapsible of collapsibles)
|
|
23
|
-
if (collapsible.nodeId === nodeId)
|
|
24
|
-
collapsible.hideCount++;
|
|
25
|
-
store.collapsibleStore.set(collapsibles);
|
|
26
|
-
}
|
|
27
17
|
// Given a nodeId, find ids of all connecting target nodes
|
|
28
18
|
function findTargets(store, nodeId) {
|
|
29
19
|
// get source anchors on the node
|
|
30
20
|
const anchors = getAnchors(store, {
|
|
31
21
|
nodeId: nodeId,
|
|
32
|
-
sourceOrTarget: 'source'
|
|
22
|
+
sourceOrTarget: 'source'
|
|
33
23
|
});
|
|
34
24
|
// get target anchors on other node, and record the node id
|
|
35
25
|
const targetNodeIds = [];
|
|
@@ -128,8 +118,7 @@ export function filterByCollapsible(store, nodes, resizeNodes, anchors, edges) {
|
|
|
128
118
|
const filteredAnchors = anchors.filter((selfAnchor) => {
|
|
129
119
|
const otherAnchorId = selfAnchor.getOtherAnchorId();
|
|
130
120
|
const otherAnchor = get(store.anchorsStore)[otherAnchorId];
|
|
131
|
-
if (filteredNodeIds.includes(selfAnchor.nodeId) &&
|
|
132
|
-
filteredNodeIds.includes(otherAnchor.nodeId))
|
|
121
|
+
if (filteredNodeIds.includes(selfAnchor.nodeId) && filteredNodeIds.includes(otherAnchor.nodeId))
|
|
133
122
|
return true;
|
|
134
123
|
return false;
|
|
135
124
|
});
|
|
@@ -139,6 +128,6 @@ export function filterByCollapsible(store, nodes, resizeNodes, anchors, edges) {
|
|
|
139
128
|
filteredNodes,
|
|
140
129
|
filteredResizeNodes,
|
|
141
130
|
filteredAnchors,
|
|
142
|
-
filteredEdges
|
|
131
|
+
filteredEdges
|
|
143
132
|
};
|
|
144
133
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
import { zoom,
|
|
3
|
-
import {
|
|
1
|
+
<script>import { pointer, select, selectAll } from 'd3-selection';
|
|
2
|
+
import { zoom, zoomIdentity, zoomTransform } from 'd3-zoom';
|
|
3
|
+
import { onMount } from 'svelte';
|
|
4
4
|
import SimpleBezierEdge from '../../edges/views/Edges/SimpleBezierEdge.svelte';
|
|
5
|
-
import StepEdge from '../../edges/views/Edges/StepEdge.svelte';
|
|
6
5
|
import SmoothStepEdge from '../../edges/views/Edges/SmoothStepEdge.svelte';
|
|
6
|
+
import StepEdge from '../../edges/views/Edges/StepEdge.svelte';
|
|
7
7
|
import Node from '../../nodes/views/Node.svelte';
|
|
8
|
+
import { determineD3Instance } from '../..//d3/controllers/d3';
|
|
8
9
|
import { findStore } from '../../store/controllers/storeApi';
|
|
9
|
-
import { determineD3Instance, zoomInit } from '../..//d3/controllers/d3';
|
|
10
|
-
import { filterByCollapsible } from '../../collapsible/controllers/util';
|
|
11
10
|
import { onDestroy } from 'svelte';
|
|
12
11
|
//these are typscripted as any, however they have been transformed inside of store.ts
|
|
13
12
|
export let canvasId;
|
|
@@ -17,10 +16,9 @@ export let boundary = false;
|
|
|
17
16
|
export let scroll = false;
|
|
18
17
|
// here we lookup the store using the unique key
|
|
19
18
|
const store = findStore(canvasId);
|
|
20
|
-
const { edgesStore, nodesStore,
|
|
19
|
+
const { edgesStore, nodesStore, nodeSelected, backgroundStore, movementStore, widthStore, heightStore, d3Scale } = store;
|
|
21
20
|
$: nodes = Object.values($nodesStore);
|
|
22
21
|
$: edges = Object.values($edgesStore);
|
|
23
|
-
$: anchors = Object.values($anchorsStore);
|
|
24
22
|
// declaring the grid and dot size for d3's transformations and zoom
|
|
25
23
|
const gridSize = 15;
|
|
26
24
|
const dotSize = 10;
|
|
@@ -35,7 +33,6 @@ let d3 = {
|
|
|
35
33
|
};
|
|
36
34
|
let d3Zoom = determineD3Instance(boundary, d3, nodeSelected, width, height, movementStore, backgroundStore, gridSize, dotSize, canvasId, d3Scale, handleZoom);
|
|
37
35
|
// d3Translate is used for the minimap
|
|
38
|
-
let d3Translate = { x: 0, y: 0, k: 1 };
|
|
39
36
|
onMount(() => {
|
|
40
37
|
// actualizes the d3 instance
|
|
41
38
|
const nodes = d3.select(`.zoomable`).call(d3Zoom).on('dblclick.zoom', null);
|
|
@@ -93,7 +90,6 @@ onDestroy(() => {
|
|
|
93
90
|
// moves canvas when you click on the minimap
|
|
94
91
|
// handles case for when minimap sends message back to initiate translation event (click to traverse minimap)
|
|
95
92
|
// moves camera to the clicked node
|
|
96
|
-
const key = canvasId;
|
|
97
93
|
function handleZoom(e) {
|
|
98
94
|
if (!$movementStore)
|
|
99
95
|
return;
|
|
@@ -104,7 +100,6 @@ function handleZoom(e) {
|
|
|
104
100
|
// transform div elements (nodes)
|
|
105
101
|
//@ts-ignore
|
|
106
102
|
let transform = d3.zoomTransform(this);
|
|
107
|
-
d3Translate = transform;
|
|
108
103
|
store.d3ZoomParameters.set({ ...transform }); // record x,y position of pan, and zoom level
|
|
109
104
|
// selects and transforms all node divs from class 'Node' and performs transformation
|
|
110
105
|
d3.select(`.Node-${canvasId}`)
|
|
@@ -121,9 +116,9 @@ function handleZoom(e) {
|
|
|
121
116
|
<div class={`Node Node-${canvasId}`}>
|
|
122
117
|
{#each nodes as node}
|
|
123
118
|
{#if node.data.html}
|
|
124
|
-
<Node {node} {canvasId}
|
|
119
|
+
<Node {node} {canvasId}>{@html node.data.html}</Node>
|
|
125
120
|
{:else if node.data.custom}
|
|
126
|
-
<Node isCustom {node} {canvasId}
|
|
121
|
+
<Node isCustom {node} {canvasId}>
|
|
127
122
|
<svelte:component
|
|
128
123
|
this={node.data.custom.component}
|
|
129
124
|
on:new={(e) => node?.data?.custom?.cb?.('new', e.detail)}
|
|
@@ -137,7 +132,7 @@ function handleZoom(e) {
|
|
|
137
132
|
/>
|
|
138
133
|
</Node>
|
|
139
134
|
{:else}
|
|
140
|
-
<Node {node} {canvasId}
|
|
135
|
+
<Node {node} {canvasId}>{node.data.label}</Node>
|
|
141
136
|
{/if}
|
|
142
137
|
{/each}
|
|
143
138
|
</div>
|
|
@@ -46,7 +46,7 @@ export function dynamicCbCreator(store, edgeId, anchorId) {
|
|
|
46
46
|
nodeSelf.positionX + nodeSelf.width / 2,
|
|
47
47
|
nodeSelf.positionY + nodeSelf.height / 2,
|
|
48
48
|
nodeOther.positionX + nodeOther.width / 2,
|
|
49
|
-
nodeOther.positionY + nodeOther.height / 2
|
|
49
|
+
nodeOther.positionY + nodeOther.height / 2
|
|
50
50
|
];
|
|
51
51
|
// record angle for later. We use this so we don't have an infinite loop
|
|
52
52
|
let prevAngle = anchorSelf.angle;
|
|
@@ -57,14 +57,14 @@ export function dynamicCbCreator(store, edgeId, anchorId) {
|
|
|
57
57
|
// self node is on the left, other node is on the right
|
|
58
58
|
if (nodeSelf.positionX < nodeOther.positionX) {
|
|
59
59
|
const [selfX, selfY] = rightCb(nodeSelf.positionX, nodeSelf.positionY, nodeSelf.width, nodeSelf.height);
|
|
60
|
-
|
|
60
|
+
leftCb(nodeOther.positionX, nodeOther.positionY, nodeOther.width, nodeOther.height);
|
|
61
61
|
anchorSelf.setPosition(selfX, selfY);
|
|
62
62
|
anchorSelf.angle = 0; // if the self node is on the left, the anchor should have orientation of 0 degrees on the unit circle
|
|
63
63
|
}
|
|
64
64
|
else {
|
|
65
65
|
// in this case, the self node is on the right and the other node is on the left
|
|
66
66
|
const [selfX, selfY] = leftCb(nodeSelf.positionX, nodeSelf.positionY, nodeSelf.width, nodeSelf.height);
|
|
67
|
-
|
|
67
|
+
rightCb(nodeOther.positionX, nodeOther.positionY, nodeOther.width, nodeOther.height);
|
|
68
68
|
anchorSelf.setPosition(selfX, selfY);
|
|
69
69
|
anchorSelf.angle = 180;
|
|
70
70
|
}
|
|
@@ -73,13 +73,13 @@ export function dynamicCbCreator(store, edgeId, anchorId) {
|
|
|
73
73
|
if (nodeSelf.positionY < nodeOther.positionY) {
|
|
74
74
|
// here the self node is above the other node
|
|
75
75
|
const [selfX, selfY] = bottomCb(nodeSelf.positionX, nodeSelf.positionY, nodeSelf.width, nodeSelf.height);
|
|
76
|
-
|
|
76
|
+
topCb(nodeOther.positionX, nodeOther.positionY, nodeOther.width, nodeOther.height);
|
|
77
77
|
anchorSelf.setPosition(selfX, selfY);
|
|
78
78
|
anchorSelf.angle = 270;
|
|
79
79
|
}
|
|
80
80
|
else {
|
|
81
81
|
const [selfX, selfY] = topCb(nodeSelf.positionX, nodeSelf.positionY, nodeSelf.width, nodeSelf.height);
|
|
82
|
-
|
|
82
|
+
bottomCb(nodeOther.positionX, nodeOther.positionY, nodeOther.width, nodeOther.height);
|
|
83
83
|
anchorSelf.setPosition(selfX, selfY);
|
|
84
84
|
anchorSelf.angle = 90;
|
|
85
85
|
}
|
|
@@ -33,7 +33,7 @@ export function getAnchors(store, filter) {
|
|
|
33
33
|
* @returns The source or target Anchor object of a given edge
|
|
34
34
|
*/
|
|
35
35
|
export function getAnchorFromEdge(store, edgeId, sourceOrTarget) {
|
|
36
|
-
|
|
36
|
+
getEdgeById(store, edgeId);
|
|
37
37
|
const anchors = getAnchors(store, { edgeId: edgeId });
|
|
38
38
|
if (anchors.length !== 2)
|
|
39
39
|
throw `there should be two anchors for a given edge, there are ${anchors.length}`;
|
|
@@ -58,7 +58,7 @@ export class Edge {
|
|
|
58
58
|
*/
|
|
59
59
|
delete() {
|
|
60
60
|
const store = stores[this.canvasId];
|
|
61
|
-
const {
|
|
61
|
+
const { anchorsStore, edgesStore } = store;
|
|
62
62
|
const sourceAnchor = getAnchorFromEdge(store, this.id, 'source'); // this is a bit wasteful
|
|
63
63
|
const targetAnchor = getAnchorFromEdge(store, this.id, 'target');
|
|
64
64
|
anchorsStore.update((anchors) => {
|
|
@@ -89,7 +89,7 @@ export class Edge {
|
|
|
89
89
|
noHandle: this.noHandle,
|
|
90
90
|
arrow: this.arrow,
|
|
91
91
|
source: 'dummy',
|
|
92
|
-
target: 'dummy'
|
|
92
|
+
target: 'dummy' // these will be set later
|
|
93
93
|
};
|
|
94
94
|
// set source, target on exportableData
|
|
95
95
|
const store = findStore(this.canvasId);
|
|
@@ -102,7 +102,7 @@ function getSimpleBezierCenter({ sourceX, sourceY, sourcePosition = Position.Bot
|
|
|
102
102
|
export let canvasId;
|
|
103
103
|
export let edgeId;
|
|
104
104
|
const store = findStore(canvasId);
|
|
105
|
-
const {
|
|
105
|
+
const { edgesStore } = store;
|
|
106
106
|
let edge;
|
|
107
107
|
$: edge = $edgesStore[edgeId];
|
|
108
108
|
let params;
|