chore(examples): only use bundle

This commit is contained in:
moklick
2022-08-09 18:55:32 +02:00
parent affae72f7e
commit 0f835a2961
48 changed files with 194 additions and 513 deletions
+4 -7
View File
@@ -1,5 +1,5 @@
import React from 'react';
import { useStore, useStoreApi } from '@react-flow/core';
import { useStore, useStoreApi } from '@react-flow/bundle';
import styles from './provider.module.css';
@@ -16,19 +16,16 @@ const Sidebar = () => {
return (
<aside className={styles.aside}>
<div className={styles.description}>
This is an example of how you can access the internal state outside of
the ReactFlow component.
This is an example of how you can access the internal state outside of the ReactFlow component.
</div>
<div className={styles.title}>Zoom & pan transform</div>
<div className={styles.transform}>
[{transform[0].toFixed(2)}, {transform[1].toFixed(2)},{' '}
{transform[2].toFixed(2)}]
[{transform[0].toFixed(2)}, {transform[1].toFixed(2)}, {transform[2].toFixed(2)}]
</div>
<div className={styles.title}>Nodes</div>
{Array.from(nodeInternals).map(([, node]) => (
<div key={node.id}>
Node {node.id} - x: {node.position.x.toFixed(2)}, y:{' '}
{node.position.y.toFixed(2)}
Node {node.id} - x: {node.position.x.toFixed(2)}, y: {node.position.y.toFixed(2)}
</div>
))}
+3 -7
View File
@@ -11,15 +11,14 @@ import {
useNodesState,
useEdgesState,
ReactFlowInstance,
} from '@react-flow/renderer';
} from '@react-flow/bundle';
import Sidebar from './Sidebar';
import styles from './provider.module.css';
const onNodeClick = (_: MouseEvent, node: Node) => console.log('click', node);
const onInit = (reactFlowInstance: ReactFlowInstance) =>
console.log('pane ready:', reactFlowInstance);
const onInit = (reactFlowInstance: ReactFlowInstance) => console.log('pane ready:', reactFlowInstance);
const initialNodes: Node[] = [
{
@@ -41,10 +40,7 @@ const initialEdges: Edge[] = [
const ProviderFlow = () => {
const [nodes, , onNodesChange] = useNodesState(initialNodes);
const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
const onConnect = useCallback(
(params: Edge | Connection) => setEdges((els) => addEdge(params, els)),
[setEdges]
);
const onConnect = useCallback((params: Edge | Connection) => setEdges((els) => addEdge(params, els)), [setEdges]);
return (
<div className={styles.providerflow}>