Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@reactflow/background

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reactflow/background - npm Package Compare versions

Comparing version 11.0.0-next.5 to 11.0.0-next.6

14

dist/esm/index.js
import { jsx, jsxs } from 'react/jsx-runtime';
import { memo, useRef, useId } from 'react';
import { memo, useRef } from 'react';
import cc from 'classcat';
import { useStore } from '@reactflow/core';
import shallow from 'zustand/shallow';

@@ -30,3 +31,3 @@ var BackgroundVariant;

};
const transformSelector = (s) => s.transform;
const selector = (s) => ({ transform: s.transform, rfId: s.rfId });
function Background({ variant = BackgroundVariant.Dots, gap = 25,

@@ -38,4 +39,3 @@ // only used for dots and cross

const ref = useRef(null);
const patternId = useId();
const [tX, tY, tScale] = useStore(transformSelector);
const { transform, rfId } = useStore(selector, shallow);
const patternColor = color || defaultColor[variant];

@@ -46,4 +46,4 @@ const patternSize = size || defaultSize[variant];

const gapXY = Array.isArray(gap) ? gap : [gap, gap];
const scaledGap = [gapXY[0] * tScale || 1, gapXY[1] * tScale || 1];
const scaledSize = patternSize * tScale;
const scaledGap = [gapXY[0] * transform[2] || 1, gapXY[1] * transform[2] || 1];
const scaledSize = patternSize * transform[2];
const patternDimensions = isCross ? [scaledSize, scaledSize] : scaledGap;

@@ -60,3 +60,3 @@ const patternOffset = isDots

left: 0,
}, ref: ref, children: [jsx("pattern", { id: patternId, x: tX % scaledGap[0], y: tY % scaledGap[1], width: scaledGap[0], height: scaledGap[1], patternUnits: "userSpaceOnUse", patternTransform: `translate(-${patternOffset[0]},-${patternOffset[1]})`, children: isDots ? (jsx(DotPattern, { color: patternColor, radius: scaledSize / 2 })) : (jsx(LinePattern, { dimensions: patternDimensions, color: patternColor, lineWidth: lineWidth })) }), jsx("rect", { x: "0", y: "0", width: "100%", height: "100%", fill: `url(#${patternId})` })] }));
}, ref: ref, children: [jsx("pattern", { id: rfId, x: transform[0] % scaledGap[0], y: transform[1] % scaledGap[1], width: scaledGap[0], height: scaledGap[1], patternUnits: "userSpaceOnUse", patternTransform: `translate(-${patternOffset[0]},-${patternOffset[1]})`, children: isDots ? (jsx(DotPattern, { color: patternColor, radius: scaledSize / 2 })) : (jsx(LinePattern, { dimensions: patternDimensions, color: patternColor, lineWidth: lineWidth })) }), jsx("rect", { x: "0", y: "0", width: "100%", height: "100%", fill: `url(#${rfId})` })] }));
}

@@ -63,0 +63,0 @@ Background.displayName = 'Background';

{
"name": "@reactflow/background",
"version": "11.0.0-next.5",
"version": "11.0.0-next.6",
"description": "Background component with different variants for React Flow",

@@ -32,4 +32,5 @@ "keywords": [

"@babel/runtime": "^7.18.9",
"@reactflow/core": "11.0.0-next.5",
"classcat": "^5.0.3"
"@reactflow/core": "11.0.0-next.6",
"classcat": "^5.0.3",
"zustand": "^4.0.0"
},

@@ -41,9 +42,16 @@ "devDependencies": {

"@types/node": "^18.7.16",
"@types/react": "^18.0.19"
"@types/react": "^18.0.19",
"react": "^18.2.0",
"typescript": "^4.7.4"
},
"peerDependencies": {
"react": ">=18",
"react-dom": ">=18"
"react": ">=17",
"react-dom": ">=17"
},
"rollup": {
"globals": {
"zustand": "Zustand",
"zustand/shallow": "zustandShallow",
"classcat": "cc"
},
"name": "ReactFlowBackground"

@@ -50,0 +58,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc