start to migrate
This commit is contained in:
@@ -1,15 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Handle, Position, type NodeProps } from '@xyflow/svelte';
|
||||
|
||||
type $$Props = NodeProps;
|
||||
|
||||
interface Props {
|
||||
isConnectable: $$Props['isConnectable'];
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
let { isConnectable, ...rest }: Props = $props();
|
||||
rest;
|
||||
let { isConnectable }: NodeProps = $props();
|
||||
|
||||
const handleStyle = 'width: 10px; height: 10px; bottom: -5px;';
|
||||
</script>
|
||||
|
||||
@@ -2,16 +2,7 @@
|
||||
import type { Writable } from 'svelte/store';
|
||||
import { Handle, Position, type NodeProps, type Node } from '@xyflow/svelte';
|
||||
|
||||
type $$Props = NodeProps<Node<{ colorStore: Writable<string> }>>;
|
||||
|
||||
interface Props {
|
||||
data: $$Props['data'];
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
let { data, ...rest }: Props = $props();
|
||||
|
||||
rest;
|
||||
let { data }: NodeProps<Node<{ colorStore: Writable<string> }>> = $props();
|
||||
|
||||
const { colorStore } = data;
|
||||
</script>
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Handle, Position, type NodeProps, type Connection } from '@xyflow/svelte';
|
||||
|
||||
type $$Props = NodeProps;
|
||||
|
||||
interface Props {
|
||||
id: $$Props['id'];
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
let { id, ...rest }: Props = $props();
|
||||
let { id }: NodeProps = $props();
|
||||
|
||||
function onConnectTarget(connection: Connection[]) {
|
||||
console.log('connect target', connection);
|
||||
@@ -25,8 +18,6 @@
|
||||
function onDisconnectSource(connection: Connection[]) {
|
||||
console.log('disconnect source', connection);
|
||||
}
|
||||
|
||||
rest;
|
||||
</script>
|
||||
|
||||
<div class="custom">
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { NodeToolbar, type NodeProps, Handle, Position } from '@xyflow/svelte';
|
||||
|
||||
type $$Props = NodeProps;
|
||||
rest;
|
||||
|
||||
interface Props {
|
||||
data: $$Props['data'];
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
let { data, ...rest }: Props = $props();
|
||||
let { data }: NodeProps = $props();
|
||||
</script>
|
||||
|
||||
<NodeToolbar
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { Handle, Position, type BuiltInNode, type NodeProps } from '@xyflow/svelte';
|
||||
|
||||
type $$Props = NodeProps<BuiltInNode>;
|
||||
rest;
|
||||
|
||||
interface Props {
|
||||
data?: { label: string };
|
||||
positionAbsoluteX?: number;
|
||||
positionAbsoluteY?: number;
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
let { data = { label: 'Node' }, positionAbsoluteX = 0, positionAbsoluteY = 0, ...rest }: Props = $props();
|
||||
let {
|
||||
data = { label: 'Node' },
|
||||
positionAbsoluteX = 0,
|
||||
positionAbsoluteY = 0
|
||||
}: NodeProps = $props();
|
||||
</script>
|
||||
|
||||
<div class="custom">
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
<script lang="ts">
|
||||
import type { BuiltInNode, NodeProps } from '@xyflow/svelte';
|
||||
|
||||
type $$Props = NodeProps<BuiltInNode>;
|
||||
rest;
|
||||
|
||||
interface Props {
|
||||
data?: { label: string };
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
let { data = { label: 'Node' }, ...rest }: Props = $props();
|
||||
let { data = { label: 'Node' } }: NodeProps<BuiltInNode> = $props();
|
||||
</script>
|
||||
|
||||
<div class="custom">
|
||||
|
||||
@@ -8,22 +8,16 @@
|
||||
} from '@xyflow/svelte';
|
||||
import { isTextNode, type MyNode } from './+page.svelte';
|
||||
|
||||
type $$Props = NodeProps;
|
||||
|
||||
interface Props {
|
||||
id: $$Props['id'];
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
let { id, ...rest }: Props = $props();
|
||||
rest;
|
||||
let { id }: NodeProps = $props();
|
||||
|
||||
const connections = useHandleConnections({
|
||||
nodeId: id,
|
||||
type: 'target'
|
||||
});
|
||||
|
||||
let nodeData = $derived(useNodesData<MyNode>($connections.map((connection) => connection.source)));
|
||||
let nodeData = $derived(
|
||||
useNodesData<MyNode>($connections.map((connection) => connection.source))
|
||||
);
|
||||
let textNodes = $derived($nodeData.filter(isTextNode));
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,18 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { Handle, Position, type NodeProps, useSvelteFlow } from '@xyflow/svelte';
|
||||
|
||||
type $$Props = NodeProps;
|
||||
|
||||
interface Props {
|
||||
id: $$Props['id'];
|
||||
data: $$Props['data'];
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
let { id, data, ...rest }: Props = $props();
|
||||
let { id, data }: NodeProps = $props();
|
||||
|
||||
const { updateNodeData } = useSvelteFlow();
|
||||
rest;
|
||||
</script>
|
||||
|
||||
<div class="custom">
|
||||
|
||||
@@ -1,20 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { Handle, Position, type NodeProps, useUpdateNodeInternals } from '@xyflow/svelte';
|
||||
|
||||
type $$Props = NodeProps;
|
||||
|
||||
interface Props {
|
||||
id: $$Props['id'];
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
let { id, ...rest }: Props = $props();
|
||||
rest;
|
||||
let { id }: NodeProps = $props();
|
||||
|
||||
const updateNodeInternals = useUpdateNodeInternals();
|
||||
|
||||
let handleCount = $state(1);
|
||||
|
||||
|
||||
const onClick = () => {
|
||||
handleCount += 1;
|
||||
|
||||
Reference in New Issue
Block a user