refactor(svelte/react): cleanup exports

This commit is contained in:
moklick
2023-06-15 13:44:21 +02:00
parent 80c694aceb
commit 019dab3be1
20 changed files with 191 additions and 61 deletions
@@ -1,7 +1,8 @@
<script lang="ts">
import type { ChangeEventHandler } from 'svelte/elements';
import { writable } from 'svelte/store';
import SvelteFlow, {
import {
SvelteFlow,
Controls,
Background,
BackgroundVariant,
@@ -1,6 +1,7 @@
<script lang="ts">
import { writable } from 'svelte/store';
import SvelteFlow, {
import {
SvelteFlow,
Controls,
Background,
BackgroundVariant,
@@ -1,6 +1,7 @@
<script lang="ts">
import { writable } from 'svelte/store';
import SvelteFlow, {
import {
SvelteFlow,
Controls,
Background,
BackgroundVariant,
@@ -1,6 +1,7 @@
<script lang="ts">
import { writable } from 'svelte/store';
import SvelteFlow, {
import {
SvelteFlow,
Controls,
Panel,
PanOnScrollMode,
@@ -1,7 +1,7 @@
<script lang="ts">
import { writable } from 'svelte/store';
import SvelteFlow, {
import {
SvelteFlow,
Controls,
Background,
BackgroundVariant,
@@ -11,6 +11,7 @@
type NodeTypes,
type EdgeTypes
} from '../../lib/index';
import { CustomNode } from './CustomNode';
import { CustomEdge } from './CustomEdge';
@@ -1,7 +1,11 @@
<script lang="ts">
import { getBezierPath } from '@xyflow/system';
import { BaseEdge, EdgeLabelRenderer, useSvelteFlow, type EdgeProps } from '../../../lib/index';
import {
BaseEdge,
EdgeLabelRenderer,
useSvelteFlow,
type EdgeProps,
getBezierPath
} from '../../../lib/index';
type $$Props = EdgeProps;
@@ -1,6 +1,5 @@
<script lang="ts">
import { Position } from '@xyflow/system';
import { Handle } from '../../../lib/index';
import { Handle, Position } from '../../../lib/index';
export let data: { label: string } = { label: 'Node' };
export let xPos: number = 0;
@@ -1,6 +1,7 @@
<script lang="ts">
import { writable } from 'svelte/store';
import SvelteFlow, {
import {
SvelteFlow,
Controls,
Background,
BackgroundVariant,
@@ -1,6 +1,7 @@
<script lang="ts">
import { writable } from 'svelte/store';
import SvelteFlow, {
import {
SvelteFlow,
Controls,
Background,
BackgroundVariant,
@@ -8,6 +9,7 @@
type NodeTypes,
type Node
} from '../../lib/index';
import { DebugNode } from './DebugNode';
const nodeTypes: NodeTypes = {
@@ -1,6 +1,7 @@
<script lang="ts">
import { writable } from 'svelte/store';
import SvelteFlow, { Controls, Background, BackgroundVariant, MiniMap } from '../../lib/index';
import { SvelteFlow, Controls, Background, BackgroundVariant, MiniMap } from '../../lib/index';
import Sidebar from './Sidebar.svelte';
const nodes = writable([
@@ -1,18 +1,29 @@
<script lang="ts">
import { writable } from 'svelte/store';
import SvelteFlow, {
import {
SvelteFlow,
Controls,
Background,
BackgroundVariant,
type IsValidConnection
type IsValidConnection,
Position
} from '../../lib/index';
const nodeDefaults = {
sourcePosition: Position.Right,
targetPosition: Position.Left
};
const nodes = writable([
{ id: '0', type: 'default', position: { x: 0, y: 150 }, data: { label: 'only connectable with B' } },
{ id: 'A', type: 'default', position: { x: 250, y: 0 }, data: { label: 'A' } },
{ id: 'B', type: 'default', position: { x: 250, y: 150 }, data: { label: 'B' } },
{ id: 'C', type: 'default', position: { x: 250, y: 300 }, data: { label: 'C' } }
{
id: '0',
position: { x: 0, y: 150 },
data: { label: 'only connectable with B' },
...nodeDefaults
},
{ id: 'A', position: { x: 250, y: 0 }, data: { label: 'A' }, ...nodeDefaults },
{ id: 'B', position: { x: 250, y: 150 }, data: { label: 'B' }, ...nodeDefaults },
{ id: 'C', position: { x: 250, y: 300 }, data: { label: 'C' }, ...nodeDefaults }
]);
const edges = writable([]);
@@ -20,14 +31,7 @@
const isValidConnection: IsValidConnection = (connection) => connection.target === 'B';
</script>
<SvelteFlow
{nodes}
{edges}
fitView
minZoom={0.1}
maxZoom={2.5}
isValidConnection={isValidConnection}
>
<SvelteFlow {nodes} {edges} fitView minZoom={0.1} maxZoom={2.5} {isValidConnection}>
<Controls />
<Background variant={BackgroundVariant.Dots} />
</SvelteFlow>