replace svelvet with fork to remove zoom and node moving

This commit is contained in:
Ruben Fiszel
2022-12-15 01:53:35 +01:00
parent 847dfe1c15
commit d1edf4e5c7
9 changed files with 61 additions and 30 deletions
+19 -19
View File
@@ -39,6 +39,7 @@
"@types/vscode": "~1.73.1",
"@typescript-eslint/eslint-plugin": "^5.46.1",
"@typescript-eslint/parser": "^5.46.1",
"@windmill-labs/svelvet": "^4.0.6",
"@zerodevx/svelte-toast": "^0.8.1",
"autoprefixer": "^10.4.13",
"cssnano": "^5.1.14",
@@ -68,7 +69,6 @@
"svelte-preprocess": "^4.9.8",
"svelte-splitpanes": "^0.7.3",
"svelte2tsx": "^0.5.22",
"svelvet": "^4.0.3",
"tailwindcss": "^3.2.2",
"tslib": "^2.4.1",
"typescript": "^4.9.3"
@@ -803,6 +803,15 @@
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@windmill-labs/svelvet": {
"version": "4.0.6",
"resolved": "https://registry.npmjs.org/@windmill-labs/svelvet/-/svelvet-4.0.6.tgz",
"integrity": "sha512-EGD0LH/0BGMy9bkGOlVywHMhniG74RKn1w/ue4ybCj5c+exsg0sTdgxDvuVcAHXuCbn7Iv+KrLQzeZVZecKHvw==",
"dev": true,
"dependencies": {
"d3-zoom": "^3.0.0"
}
},
"node_modules/@zeit/schemas": {
"version": "2.21.0",
"resolved": "https://registry.npmjs.org/@zeit/schemas/-/schemas-2.21.0.tgz",
@@ -6227,15 +6236,6 @@
"typescript": "^4.1.2"
}
},
"node_modules/svelvet": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/svelvet/-/svelvet-4.0.3.tgz",
"integrity": "sha512-eNE0l50G+p26gHdAiWlqopqBBTgIWv3LYYvRB/EHbieQmNRqObu6VIxnIcjp8MRWRrl82p6qyer54gxH4fY3qA==",
"dev": true,
"dependencies": {
"d3-zoom": "^3.0.0"
}
},
"node_modules/svg-tags": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/svg-tags/-/svg-tags-1.0.0.tgz",
@@ -7483,6 +7483,15 @@
"eslint-visitor-keys": "^3.3.0"
}
},
"@windmill-labs/svelvet": {
"version": "4.0.6",
"resolved": "https://registry.npmjs.org/@windmill-labs/svelvet/-/svelvet-4.0.6.tgz",
"integrity": "sha512-EGD0LH/0BGMy9bkGOlVywHMhniG74RKn1w/ue4ybCj5c+exsg0sTdgxDvuVcAHXuCbn7Iv+KrLQzeZVZecKHvw==",
"dev": true,
"requires": {
"d3-zoom": "^3.0.0"
}
},
"@zeit/schemas": {
"version": "2.21.0",
"resolved": "https://registry.npmjs.org/@zeit/schemas/-/schemas-2.21.0.tgz",
@@ -11345,15 +11354,6 @@
"pascal-case": "^3.1.1"
}
},
"svelvet": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/svelvet/-/svelvet-4.0.3.tgz",
"integrity": "sha512-eNE0l50G+p26gHdAiWlqopqBBTgIWv3LYYvRB/EHbieQmNRqObu6VIxnIcjp8MRWRrl82p6qyer54gxH4fY3qA==",
"dev": true,
"requires": {
"d3-zoom": "^3.0.0"
}
},
"svg-tags": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/svg-tags/-/svg-tags-1.0.0.tgz",
+1 -1
View File
@@ -23,6 +23,7 @@
"@types/vscode": "~1.73.1",
"@typescript-eslint/eslint-plugin": "^5.46.1",
"@typescript-eslint/parser": "^5.46.1",
"@windmill-labs/svelvet": "^4.0.6",
"@zerodevx/svelte-toast": "^0.8.1",
"autoprefixer": "^10.4.13",
"cssnano": "^5.1.14",
@@ -52,7 +53,6 @@
"svelte-preprocess": "^4.9.8",
"svelte-splitpanes": "^0.7.3",
"svelte2tsx": "^0.5.22",
"svelvet": "^4.0.3",
"tailwindcss": "^3.2.2",
"tslib": "^2.4.1",
"typescript": "^4.9.3"
@@ -39,9 +39,9 @@
</script>
<Tabs bind:selected={tab}>
<Tab value="ui">Flow rendered</Tab>
<Tab value="ui">Graph</Tab>
<Tab value="json">Json</Tab>
<Tab value="schema">Input schema of the flow</Tab>
<Tab value="schema">Input Schema</Tab>
<svelte:fragment slot="content">
<TabContent value="ui">
+1 -1
View File
@@ -111,7 +111,7 @@
<SchemaForm {autofocus} schema={runnable.schema} bind:isValid bind:args />
{/if}
{:else}
<div class="text-sm">No schema</div>
<div class="text-xs text-gray-600">No schema</div>
{/if}
{#if viewOptions}
<div transition:slide class="mt-6">
@@ -5,7 +5,6 @@
import { slide } from 'svelte/transition'
import { createPopperActions, type PopperOptions } from 'svelte-popperjs'
import { clickOutside } from '../../../utils'
import { Kbd } from '..'
import { createStateMachine } from '../../../stateMachine'
export let ref: HTMLElement
@@ -14,7 +13,6 @@
export let openOn: (keyof HTMLElementEventMap)[] = ['focus']
/** Events on the reference element */
export let closeOn: (keyof HTMLElementEventMap)[] = ['blur']
export let disableInstruction = false
export let innerClasses = ''
export let outerClasses = ''
@@ -1,5 +1,6 @@
<script lang="ts">
import Svelvet, { type Edge } from 'svelvet'
import Svelvet from '@windmill-labs/svelvet'
import { sugiyama, dagStratify, decrossOpt, coordCenter } from 'd3-dag'
import { type FlowModule, FlowStatusModule, type ForloopFlow, RawScript } from '../../gen'
import {
@@ -14,7 +15,8 @@
type Branch,
type NestedNodes,
type ModuleHost,
type GraphModuleState
type GraphModuleState,
type Edge
} from '.'
import { defaultIfEmptyString, truncateRev } from '$lib/utils'
import { createEventDispatcher } from 'svelte'
+32 -1
View File
@@ -1,6 +1,37 @@
import type { FlowStatusModule } from "$lib/gen"
import type { Node as SvelvetNode } from "svelvet"
export interface SvelvetNode<T = any> {
id: number;
position: { x: number, y: number };
data: T;
width: number;
height: number;
bgColor?: string;
fontSize?: number;
borderColor?: string;
parentNode?: number;
childNodes?: number[];
borderRadius?: number;
textColor?: string;
clickCallback?: Function;
image?: boolean;
src?: string;
sourcePosition?: 'left' | 'right' | 'top' | 'bottom';
targetPosition?: 'left' | 'right' | 'top' | 'bottom';
}
export interface Edge {
id: string;
source: number;
target: number;
label?: string;
labelBgColor?: string;
labelTextColor?: string;
edgeColor?: string;
type?: string;
animate?: boolean;
noHandle?: boolean;
arrow?: boolean;
}
export type ModuleHost = 'workspace' | 'inline' | 'hub'
export type Node = SvelvetNode & { parentIds: string[], edgeLabel?: string, host?: ModuleHost }
@@ -243,7 +243,7 @@
runAction={runFlow}
/>
</div>
<div class="mt-6">
<div class="mt-6 box">
{defaultIfEmptyString(flow.description, 'No description')}
</div>
</div>
@@ -340,7 +340,7 @@
runAction={runScript}
/>
</div>
<div class="mt-6">
<div class="mt-6 box">
{defaultIfEmptyString(script.description, 'No description')}
</div>
</div>