diff --git a/assets/icons/unlock.svg b/assets/icons/unlock.svg
index 22ed8018..ba34f03f 100644
--- a/assets/icons/unlock.svg
+++ b/assets/icons/unlock.svg
@@ -1 +1 @@
-
+
\ No newline at end of file
diff --git a/cypress/integration/flow/basic.spec.js b/cypress/integration/flow/basic.spec.js
index dccabd28..e160f369 100644
--- a/cypress/integration/flow/basic.spec.js
+++ b/cypress/integration/flow/basic.spec.js
@@ -6,7 +6,7 @@ describe('Basic Graph Rendering', () => {
cy.get('.react-flow-basic-example'); // check if className prop works
cy.get('.react-flow__node').should('have.length', 4);
cy.get('.react-flow__edge').should('have.length', 2);
- cy.get('.react-flow__node').children('div').children('.react-flow__handle');
+ cy.get('.react-flow__node').children('.react-flow__handle');
});
it('renders a grid', () => {
diff --git a/cypress/integration/flow/inactive.spec.js b/cypress/integration/flow/inactive.spec.js
index 44209137..751318f3 100644
--- a/cypress/integration/flow/inactive.spec.js
+++ b/cypress/integration/flow/inactive.spec.js
@@ -5,7 +5,7 @@ describe('Inactive Graph Rendering', () => {
cy.get('.react-flow__renderer');
cy.get('.react-flow__node').should('have.length', 4);
cy.get('.react-flow__edge').should('have.length', 2);
- cy.get('.react-flow__node').children('div').children('.react-flow__handle');
+ cy.get('.react-flow__node').children('.react-flow__handle');
});
it('tries to select a node by click', () => {
diff --git a/example/src/CustomNode/ColorSelectorNode.js b/example/src/CustomNode/ColorSelectorNode.js
index 53b687e0..fa5f2447 100644
--- a/example/src/CustomNode/ColorSelectorNode.js
+++ b/example/src/CustomNode/ColorSelectorNode.js
@@ -2,11 +2,9 @@ import React from 'react';
import { Handle } from 'react-flow-renderer';
-export default ({ data, styles }) => {
+export default ({ data }) => {
return (
-
+ <>
{
id="b"
style={{ bottom: 10, top: 'auto', background: '#fff' }}
/>
-
+ >
);
};
diff --git a/example/src/CustomNode/index.js b/example/src/CustomNode/index.js
index 96f7eda7..b64793e0 100644
--- a/example/src/CustomNode/index.js
+++ b/example/src/CustomNode/index.js
@@ -37,7 +37,7 @@ const CustomNodeFlow = () => {
setElements([
{ id: '1', type: 'input', data: { label: 'An input node' }, position: { x: 0, y: 50 }, sourcePosition: 'right' },
- { id: '2', type: 'selectorNode', data: { onChange: onChange, color: initBgColor }, position: { x: 250, y: 50 } },
+ { id: '2', type: 'selectorNode', data: { onChange: onChange, color: initBgColor }, style: { border: '1px solid #777' }, position: { x: 250, y: 50 } },
{ id: '3', type: 'output', data: { label: 'Output A' }, position: { x: 550, y: 25 }, targetPosition: 'left' },
{ id: '4', type: 'output', data: { label: 'Output B' }, position: { x: 550, y: 100 }, targetPosition: 'left' },
diff --git a/example/src/index.css b/example/src/index.css
index cf5db29f..1851ded3 100644
--- a/example/src/index.css
+++ b/example/src/index.css
@@ -136,9 +136,9 @@ nav a.active:before {
color: #111;
}
-.dark-node>div {
- background: #333 !important;
- color: #f8f8f8 !important;
+.dark-node {
+ background: #333;
+ color: #f8f8f8;
}
@media screen and (min-width: 768px) {
diff --git a/rollup.config.js b/rollup.config.js
index ddd31efb..32e8c51f 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -37,7 +37,9 @@ export default [
],
plugins: [
bundleSize(),
- postcss(),
+ postcss({
+ minimize: isProd,
+ }),
babel({
exclude: 'node_modules/**',
}),
diff --git a/src/additional-components/Background/index.tsx b/src/additional-components/Background/index.tsx
index 782dd1b4..4228a089 100644
--- a/src/additional-components/Background/index.tsx
+++ b/src/additional-components/Background/index.tsx
@@ -1,10 +1,12 @@
-import React, { memo, HTMLAttributes, CSSProperties } from 'react';
+import React, { memo, HTMLAttributes } from 'react';
import classnames from 'classnames';
import { useStoreState } from '../../store/hooks';
import { BackgroundVariant } from '../../types';
import { createGridLinesPath, createGridDotsPath } from './utils';
+import './style.css';
+
interface BackgroundProps extends HTMLAttributes {
variant?: BackgroundVariant;
gap?: number;
@@ -12,19 +14,13 @@ interface BackgroundProps extends HTMLAttributes {
size?: number;
}
-const baseStyles: CSSProperties = {
- position: 'absolute',
- top: 0,
- left: 0,
-};
-
const defaultColors = {
[BackgroundVariant.Dots]: '#999',
[BackgroundVariant.Lines]: '#eee',
};
const Background = memo(
- ({ variant = BackgroundVariant.Dots, gap = 24, size = 0.5, color, style = {}, className = '' }: BackgroundProps) => {
+ ({ variant = BackgroundVariant.Dots, gap = 24, size = 0.5, color, style, className }: BackgroundProps) => {
const width = useStoreState((s) => s.width);
const height = useStoreState((s) => s.height);
const [x, y, scale] = useStoreState((s) => s.transform);
@@ -42,7 +38,7 @@ const Background = memo(
const stroke = isLines ? bgColor : 'none';
return (
-