-
-
Notifications
You must be signed in to change notification settings - Fork 172
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 #304 from open-source-labs/dev
feat: added connect and disconnect methods to Node component
- Loading branch information
Showing
52 changed files
with
1,104 additions
and
603 deletions.
There are no files selected for viewing
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,27 @@ | ||
<script lang="ts"> | ||
import { Svelvet, Node, Anchor } from '$lib'; | ||
import { getContext } from 'svelte'; | ||
function addAndConnect(connect: (connections: string | number) => void) { | ||
connect(totalNodes + 4); | ||
totalNodes++; | ||
} | ||
let totalNodes = 0; | ||
</script> | ||
|
||
<Node | ||
position={{ x: 100, y: 300 }} | ||
dimensions={{ width: 400, height: 300 }} | ||
let:connect | ||
let:disconnect | ||
useDefaults | ||
> | ||
<div> | ||
<button on:click={() => connect(2)}>Connect 2</button> | ||
<button on:click={() => addAndConnect(connect)}>Connect and Add</button> | ||
<button on:click={() => disconnect(2)}>Disconnect Last From 2</button> | ||
<button on:click={() => disconnect([[2, '3']])}>Disconnect Node 2/Anchor 3</button> | ||
<button on:click={() => connect(3)}>Connect 3</button> | ||
<button on:click={() => disconnect(3)}>Disconnect Last From 3</button> | ||
</div> | ||
<Anchor /> | ||
</Node> |
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
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,17 @@ | ||
import { SvelteComponentTyped } from 'svelte'; | ||
declare const __propDef: { | ||
props: Record<string, never>; | ||
events: { | ||
[evt: string]: CustomEvent<any>; | ||
}; | ||
slots: {}; | ||
}; | ||
export type CustomEdgeProps = typeof __propDef.props; | ||
export type CustomEdgeEvents = typeof __propDef.events; | ||
export type CustomEdgeSlots = typeof __propDef.slots; | ||
export default class CustomEdge extends SvelteComponentTyped< | ||
CustomEdgeProps, | ||
CustomEdgeEvents, | ||
CustomEdgeSlots | ||
> {} | ||
export {}; |
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,17 @@ | ||
import { SvelteComponentTyped } from 'svelte'; | ||
declare const __propDef: { | ||
props: Record<string, never>; | ||
events: { | ||
[evt: string]: CustomEvent<any>; | ||
}; | ||
slots: {}; | ||
}; | ||
export type CustomNodeProps = typeof __propDef.props; | ||
export type CustomNodeEvents = typeof __propDef.events; | ||
export type CustomNodeSlots = typeof __propDef.slots; | ||
export default class CustomNode extends SvelteComponentTyped< | ||
CustomNodeProps, | ||
CustomNodeEvents, | ||
CustomNodeSlots | ||
> {} | ||
export {}; |
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,17 @@ | ||
import { SvelteComponentTyped } from 'svelte'; | ||
declare const __propDef: { | ||
props: Record<string, never>; | ||
events: { | ||
[evt: string]: CustomEvent<any>; | ||
}; | ||
slots: {}; | ||
}; | ||
export type InputNodeProps = typeof __propDef.props; | ||
export type InputNodeEvents = typeof __propDef.events; | ||
export type InputNodeSlots = typeof __propDef.slots; | ||
export default class InputNode extends SvelteComponentTyped< | ||
InputNodeProps, | ||
InputNodeEvents, | ||
InputNodeSlots | ||
> {} | ||
export {}; |
Oops, something went wrong.