-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from natrontech/DEV-11-f-visual-drag-drop-inter…
…face Dev 11 f visual drag drop interface
- Loading branch information
Showing
5 changed files
with
96 additions
and
133 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
58 changes: 58 additions & 0 deletions
58
ui/frontend/src/lib/components/canvas/nodes/ComponentNode.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<script lang="ts"> | ||
import { Button } from "flowbite-svelte"; | ||
import { Boxes, Cable, Pencil, Trash } from "lucide-svelte"; | ||
import { Anchor, Node, type Connections, type NodeConfig } from "svelvet"; | ||
export let isSelected: boolean = false; | ||
export let activeHover: boolean = false; | ||
export let nodeProps: NodeConfig = {}; | ||
export let idx: number = 0; | ||
export let selectNode = (idx: number) => {}; | ||
export let deleteNode = (idx: number) => {}; | ||
export let addConnection = (sourceNode: NodeConfig, targetNode: NodeConfig) => {}; | ||
</script> | ||
|
||
<Node {...nodeProps} drop="cursor" dynamic={true} on:nodeClicked={() => selectNode(idx)}> | ||
|
||
<div | ||
class="node | ||
bg-white | ||
border-background | ||
rounded-xl | ||
p-2 | ||
" | ||
> | ||
<div class="input-anchors"> | ||
<Anchor multiple input nodeConnect direction="south" invisible={!isSelected} /> | ||
</div> | ||
<div class="output-anchors"> | ||
<Anchor multiple output nodeConnect invisible={!activeHover} /> | ||
</div> | ||
<div> | ||
<Button | ||
outline | ||
class="" | ||
size="xs" | ||
on:click={() => { | ||
selectNode(idx); | ||
}} | ||
> | ||
<Boxes class="w-5 h-5" strokeWidth={2} /> | ||
</Button> | ||
<Button outline class="" size="xs" on:click={() => selectNode(idx)}> | ||
<Cable class="w-5 h-5" strokeWidth={2} /> | ||
</Button> | ||
|
||
<Button outline class="" size="xs" on:click={() => selectNode(idx)}> | ||
<Pencil class="w-5 h-5" strokeWidth={2} /> | ||
</Button> | ||
|
||
<Button outline color="red" class="" size="xs" on:click={() => deleteNode(idx)}> | ||
<Trash class="w-5 h-5" strokeWidth={2} /> | ||
</Button> | ||
</div> | ||
<h1 class="text-2xl font-bold pr-10">{nodeProps.label}</h1> | ||
</div> | ||
</Node> |
14 changes: 0 additions & 14 deletions
14
ui/frontend/src/lib/components/canvas/nodes/LayoutNode.svelte
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function randomId(): string { | ||
return Math.random().toString(36).substr(2, 9); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters