Skip to content

Commit 7f154e2

Browse files
committed
Merge branch 'master' of github.com:lironhl/react-d3-graph into feature/d3_v6_support
2 parents aed74f1 + b566a95 commit 7f154e2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+30600
-15050
lines changed

Diff for: .github/FUNDING.YML

-4
This file was deleted.

Diff for: .github/workflows/nodejs.yml

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
strategy:
1818
matrix:
1919
node-version: [10.x, 12.x]
20+
react-version: [16.14.0, latest]
2021

2122
steps:
2223
- uses: actions/checkout@v2
@@ -25,6 +26,7 @@ jobs:
2526
with:
2627
node-version: ${{ matrix.node-version }}
2728
- run: npm install
29+
- run: npm install react@${{ matrix.react-version }}
2830
- run: npm run dist:sandbox
2931
- run: npm start -- --silent &
3032
- run: npm run lint

Diff for: .github_changelog_generator

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
project=react-d3-graph
2+
unreleased=true
3+
future-release=2.6.0
4+
since-tag=2.5.0

Diff for: CHANGELOG.md

+251-196
Large diffs are not rendered by default.

Diff for: HISTORY.md

+469
Large diffs are not rendered by default.

Diff for: README.md

+21-65
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,24 @@
33
[![npm version](https://img.shields.io/npm/v/react-d3-graph.svg?style=flat-square)](https://www.npmjs.com/package/react-d3-graph) [![npm](https://img.shields.io/npm/dw/react-d3-graph.svg?style=flat-square)](https://www.npmjs.com/package/react-d3-graph)
44
[![npm](https://img.shields.io/npm/dt/react-d3-graph.svg?style=flat-square)](https://www.npmjs.com/package/react-d3-graph) [![probot enabled](https://img.shields.io/badge/probot:stale-enabled-yellow.svg?longCache=true&style=flat-square)](https://probot.github.io/) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
55

6-
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/DanielCaldas321)
7-
86
:book: [Documentation](https://danielcaldas.github.io/react-d3-graph/docs/index.html)
97

108
### _Interactive and configurable graphs with react and d3 effortlessly_
119

1210
[![react-d3-graph gif sample](https://github.com/danielcaldas/react-d3-graph/blob/master/sandbox/rd3g_v2.gif?raw=true)](https://danielcaldas.github.io/react-d3-graph/sandbox/index.html)
1311

14-
## Donations
15-
16-
If you enjoy this library, please consider [supporting me](https://paypal.me/DanielCaldas321) for developing and maintaining it.
17-
18-
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://paypal.me/DanielCaldas321)
19-
2012
## Playground
2113

2214
[Here a live playground](https://danielcaldas.github.io/react-d3-graph/sandbox/index.html) page where you can interactively config your own graph, and generate a ready to use configuration! :sunglasses:
2315

2416
You can also load different data sets and configurations via URL query parameter. Below is a table with all the data sets available in the live sandbox for you to interactively explore different kinds of integrations with the library.
2517

26-
| Name | Link | Source | Description |
27-
| :---------- | :---------------------------------------------------------------------------------------------------- | :------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
28-
| small | [see it in action](https://danielcaldas.github.io/react-d3-graph/sandbox/index.html?data=small) | `sandbox/data/small` | This is a good example to get you started. It has only 4 nodes. It's good to discuss over integration details and it's also good to report issues that you might found in the library. It's much easier to debug over a tiny graph. |
29-
| custom-node | [see it in action](https://danielcaldas.github.io/react-d3-graph/sandbox/index.html?data=custom-node) | `sandbox/data/custom-node` | In this example you'll be able to see the power of the feature [node.viewGenerator](https://danielcaldas.github.io/react-d3-graph/docs/#node-view-generator) to create highly customizable nodes for you graph that go beyond the simple shapes that come out of the box with the library. |
30-
| marvel | [see it in action](https://danielcaldas.github.io/react-d3-graph/sandbox/index.html?data=marvel) | `sandbox/data/marvel` | In this thematic example you can see how several features such as: [nodeHighlightBehavior](https://danielcaldas.github.io/react-d3-graph/docs/#node-highlight-behavior), [custom SVGs for nodes](https://danielcaldas.github.io/react-d3-graph/docs/#node-svg), [collapsible](https://danielcaldas.github.io/react-d3-graph/docs/#collapsible) etc. come together on top of a directed graph that displays some characters from the Marvel Universe. |
31-
| static | [see it in action](https://danielcaldas.github.io/react-d3-graph/sandbox/index.html?data=static) | `sandbox/data/static` | If your goal is not to have nodes dancing around with the default [d3 forces](https://danielcaldas.github.io/react-d3-graph/docs/#config-d3) that the library provides, you can opt by making your nodes static and positioned them always in the same _(x, y)_ coordinates. To achieve this you can make use of [staticGraphWithDragAndDrop](https://danielcaldas.github.io/react-d3-graph/docs/#static-graph-with-drag-and-drop) or [staticGraph](https://danielcaldas.github.io/react-d3-graph/docs/#static-graph) |
18+
| Name | Link | Source | Description |
19+
| :----- | :---------------------------------------------------------------------------------------- | :------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
20+
| small | [demo](https://danielcaldas.github.io/react-d3-graph/sandbox/index.html?data=small) | `sandbox/data/small` | This is a good example to get you started. It has only 4 nodes. It's good to discuss over integration details and it's also good to report issues that you might found in the library. It's much easier to debug over a tiny graph. |
21+
| custom | [demo](https://danielcaldas.github.io/react-d3-graph/sandbox/index.html?data=custom-node) | `sandbox/data/custom-node` | In this example you'll be able to see the power of the feature [node.viewGenerator](https://danielcaldas.github.io/react-d3-graph/docs/#node-view-generator) to create highly customizable nodes for you graph that go beyond the simple shapes that come out of the box with the library. |
22+
| marvel | [demo](https://danielcaldas.github.io/react-d3-graph/sandbox/index.html?data=marvel) | `sandbox/data/marvel` | In this thematic example you can see how several features such as: [nodeHighlightBehavior](https://danielcaldas.github.io/react-d3-graph/docs/#node-highlight-behavior), [custom SVGs for nodes](https://danielcaldas.github.io/react-d3-graph/docs/#node-svg), [collapsible](https://danielcaldas.github.io/react-d3-graph/docs/#collapsible) etc. come together on top of a directed graph that displays some characters from the Marvel Universe. |
23+
| static | [demo](https://danielcaldas.github.io/react-d3-graph/sandbox/index.html?data=static) | `sandbox/data/static` | If your goal is not to have nodes dancing around with the default [d3 forces](https://danielcaldas.github.io/react-d3-graph/docs/#config-d3) that the library provides, you can opt by making your nodes static and positioned them always in the same _(x, y)_ coordinates. To achieve this you can make use of [staticGraphWithDragAndDrop](https://danielcaldas.github.io/react-d3-graph/docs/#static-graph-with-drag-and-drop) or [staticGraph](https://danielcaldas.github.io/react-d3-graph/docs/#static-graph) |
3224

3325
Do you want to visualize your own data set on the live sandbox? Just submit a PR! You're welcome 😁.
3426

@@ -54,7 +46,7 @@ npm install react-d3-graph
5446
> npm WARN [email protected] requires a peer of d3@^5.5.0 but none is installed. You must install peer dependencies yourself.
5547
> npm WARN [email protected] requires a peer of react@^16.4.1 but none is installed. You must install peer dependencies yourself.
5648
57-
## Usage sample
49+
## Minimal usage example
5850

5951
Graph component is the main component for react-d3-graph components, its interface allows its user to build the graph once the user provides the data, configuration (optional) and callback interactions (also optional).
6052
The code for the [live example](https://danielcaldas.github.io/react-d3-graph/sandbox/index.html) can be consulted [here](https://github.com/danielcaldas/react-d3-graph/blob/master/sandbox/Sandbox.jsx).
@@ -71,8 +63,7 @@ const data = {
7163
],
7264
};
7365

74-
// the graph configuration, you only need to pass down properties
75-
// that you want to override, otherwise default ones will be used
66+
// the graph configuration, just override the ones you need
7667
const myConfig = {
7768
nodeHighlightBehavior: true,
7869
node: {
@@ -85,72 +76,37 @@ const myConfig = {
8576
},
8677
};
8778

88-
// graph event callbacks
89-
const onClickGraph = function() {
90-
window.alert(`Clicked the graph background`);
91-
};
92-
9379
const onClickNode = function(nodeId) {
9480
window.alert(`Clicked node ${nodeId}`);
9581
};
9682

97-
const onDoubleClickNode = function(nodeId) {
98-
window.alert(`Double clicked node ${nodeId}`);
99-
};
100-
101-
const onRightClickNode = function(event, nodeId) {
102-
window.alert(`Right clicked node ${nodeId}`);
103-
};
104-
105-
const onMouseOverNode = function(nodeId) {
106-
window.alert(`Mouse over node ${nodeId}`);
107-
};
108-
109-
const onMouseOutNode = function(nodeId) {
110-
window.alert(`Mouse out node ${nodeId}`);
111-
};
112-
11383
const onClickLink = function(source, target) {
11484
window.alert(`Clicked link between ${source} and ${target}`);
11585
};
11686

117-
const onRightClickLink = function(event, source, target) {
118-
window.alert(`Right clicked link between ${source} and ${target}`);
119-
};
120-
121-
const onMouseOverLink = function(source, target) {
122-
window.alert(`Mouse over in link between ${source} and ${target}`);
123-
};
124-
125-
const onMouseOutLink = function(source, target) {
126-
window.alert(`Mouse out link between ${source} and ${target}`);
127-
};
128-
129-
const onNodePositionChange = function(nodeId, x, y) {
130-
window.alert(`Node ${nodeId} is moved to new position. New position is x= ${x} y= ${y}`);
131-
};
132-
13387
<Graph
134-
id="graph-id" // id is mandatory, if no id is defined rd3g will throw an error
88+
id="graph-id" // id is mandatory
13589
data={data}
13690
config={myConfig}
13791
onClickNode={onClickNode}
138-
onDoubleClickNode={onDoubleClickNode}
139-
onRightClickNode={onRightClickNode}
140-
onClickGraph={onClickGraph}
14192
onClickLink={onClickLink}
142-
onRightClickLink={onRightClickLink}
143-
onMouseOverNode={onMouseOverNode}
144-
onMouseOutNode={onMouseOutNode}
145-
onMouseOverLink={onMouseOverLink}
146-
onMouseOutLink={onMouseOutLink}
147-
onNodePositionChange={onNodePositionChange}
14893
/>;
14994
```
15095

96+
For more advanced use cases check [the official documentation](https://danielcaldas.github.io/react-d3-graph/docs/index.html).
97+
98+
## Core Team
99+
100+
The group of maintainers driving the project.
101+
102+
| [Daniel Caldas](https://github.com/danielcaldas) | [Sara Hernández](https://github.com/LonelyPrincess) | [Terahn Harrison](https://github.com/terahn) | [Antonin Klopp-Tosser](https://github.com/antoninklopp) |
103+
| ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
104+
| ![danielcaldas](https://avatars2.githubusercontent.com/u/11733994?s=120&u=e6b6edacde9c76844785e21d0568a4ba7c7f9aa4&v=4) | ![LonelyPrincess](https://avatars3.githubusercontent.com/u/17673317?s=120&u=d3170de2d3d4adf6268b892213927c8439d2f513&v=4) | ![terahn](https://avatars2.githubusercontent.com/u/23760949?s=120&u=9182d8d602285c507a1e88a0629785323b2f8703&v=4) | ![antonin](https://avatars2.githubusercontent.com/u/26838971?s=120&u=e3767df46ed6d7ef40d95562450d96a6bac5c437&v=4) |
105+
| [@\_danielcaldas](https://twitter.com/_danielcaldas) | | | |
106+
151107
## Contributions
152108

153-
Contributions are welcome, feel free to submit new ideas/features, just open an issue or send me an email or something. If you are more a _hands on_ person, just submit a pull request. Before jumping into coding, please take a look at the contribution guidelines [CONTRIBUTING.md](https://github.com/danielcaldas/react-d3-graph/blob/master/CONTRIBUTING.md).
109+
Contributions are welcome, feel free to submit new ideas/features, just go ahead and open an issue. If you are more a _hands on_ person, just submit a pull request. Before jumping into coding, please take a look at the contribution guidelines [CONTRIBUTING.md](https://github.com/danielcaldas/react-d3-graph/blob/master/CONTRIBUTING.md).
154110

155111
To run react-d3-graph in development mode you just need to run `npm run dev` and the interactive sandbox will reload with the changes to the library code, that way you can test your changes not only through unit test but also through a real life example. It's that simple. The development workflow usually should follow the steps:
156112

Diff for: RELEASE_PROCESS.md

+27-18
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,34 @@
1-
## Release Process
1+
# Release Process
22

3-
This is not yet a full automated process, so here are a few steps to get the thing properly released on github and publish under npm registry.
3+
Here are the steps to get the thing properly released on GitHub and published under the npm public registry. There's the need of some manual interventions throughout the release process.
44

5-
### Setup (serve a local version to run tests against it)
5+
## Requirements
66

7-
1. npm run dist:sandbox
8-
2. npm run start (server should keep running in the background as we're going to run
9-
cypress against it)
7+
- Make sure you're able to run `react-d3-graph` locally, follow the `Contributions` steps in the `README.md`.
8+
- Install the [github-changelog-generator](https://github.com/github-changelog-generator/github-changelog-generator) gem locally. The distribution script will use it to automatically generate a changelog (if possible version >=1.15.2).
9+
- Verify the version: `github_changelog_generator -v`
1010

1111
### Release steps
1212

13-
1. Update versioning in package.json
14-
2. npm run dist
15-
3. npm run docs
16-
4. Small tweaks on documentation page (quicklinks)
17-
5. Replace current files in docs for the generated ones in gen-docs
18-
6. Generate CHANGELOG.md
19-
```bash
20-
github_changelog_generator since-tag=<PREVIOUS_RELEASED_VERSION> -u GITHUB_USERNAME
13+
1. Update versioning in `package.json`, `package-lock.json` and `.github_changelog_generator`.
14+
2. `npm run dist:sandbox` - generates new sandbox assets.
15+
3. `npm run start` - server should keep running in the background as we're going to run
16+
cypress against it.
17+
4. ```bash
18+
# https://github.com/github-changelog-generator/github-changelog-generator#github-token
19+
export CHANGELOG_GITHUB_TOKEN="«your-40-digit-github-token»"
20+
export GITHUB_USERNAME="«your-github-user-name»"
21+
export VERSION_PREV=x.x.x
22+
export VERSION_NEW=x.x.x
23+
24+
npm run dist
2125
```
22-
7. git commit -m "Release x.x.x"
23-
8. Create release x.x.x in github
24-
9. git pull (origin master)
25-
10. npm publish
26+
27+
Please fill in the `VERSION_*` env vars properly to ensure we link documentation during the build process.
28+
29+
5. `git commit -am "Release x.x.x"`.
30+
6. Create the release x.x.x in GitHub. Go to [releases](https://github.com/danielcaldas/react-d3-graph/releases) and click `"Draft a new release"`.
31+
1. Pick a suitable title that highlights some of the most relevant changes.
32+
2. Copy & paste the output of the new CHANGELOG into the release notes.
33+
7. Once you're done on GitHub, go back to you terminal and type `git pull origin master` to pull the latest tag.
34+
8. `npm publish` (see [npm-publish docs](https://docs.npmjs.com/cli/v6/commands/npm-publish) for more details).

Diff for: .babelrc renamed to babel.config.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
{
2-
"presets": ["@babel/preset-env", "@babel/preset-react"],
3-
"plugins": [
1+
module.exports = {
2+
presets: [["@babel/preset-env", { targets: { node: "current" } }], "@babel/preset-react"],
3+
plugins: [
44
"@babel/plugin-proposal-class-properties",
55
"@babel/plugin-proposal-object-rest-spread",
66
"@babel/plugin-proposal-optional-chaining",
7-
]
8-
}
7+
],
8+
};

0 commit comments

Comments
 (0)