Skip to content

Commit a66cf4b

Browse files
committed
v1.0.6
1 parent 735edfd commit a66cf4b

30 files changed

+1530
-1409
lines changed

.eslintrc.js

+9-12
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,20 @@ module.exports = {
77
'prettier/@typescript-eslint',
88
],
99
parser: '@typescript-eslint/parser',
10+
parserOptions: {
11+
ecmaVersion: 2018,
12+
sourceType: 'module',
13+
ecmaFeatures: {
14+
jsx: true,
15+
}
16+
},
1017
plugins: [
1118
'@typescript-eslint',
1219
'prettier',
1320
'react-hooks',
1421
],
1522
rules: {
16-
'prettier/prettier': [
17-
'error',
18-
{
19-
bracketSpacing: true,
20-
jsxBracketSameLine: true,
21-
singleQuote: true,
22-
tabWidth: 2,
23-
trailingComma: 'all',
24-
useTabs: false,
25-
},
26-
],
23+
'@typescript-eslint/explicit-function-return-type': 'off',
2724
'react-hooks/rules-of-hooks': 'error',
2825
'react-hooks/exhaustive-deps': 'warn',
2926
},
@@ -32,4 +29,4 @@ module.exports = {
3229
version: 'detect',
3330
},
3431
},
35-
};
32+
};

.npmignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
public/
2+
node_modules/

.prettierrc.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
'bracketSpacing': true,
3+
'jsxBracketSameLine': true,
4+
'singleQuote': true,
5+
'tabWidth': 2,
6+
'trailingComma': 'all',
7+
'useTabs': false,
8+
};

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [1.0.6](https://github.com/chrisrzhou/react-wordcloud/compare/v1.0.5...v1.0.6) (2019-06-08)
7+
8+
- Support deterministic behavior for randomn layout and colors by configuring the `options.deterministic` field. This makes testing and creating fixed wordcloud views convenient.
9+
- Expose Typescript types.
10+
- Use various `d3-*` packages instead of importing `d3` entirely.
11+
- Update `docz` and docs. Add Codesandbox examples.
12+
- Move prettier rules from `.eslintrc.js` to `.prettierrc.js`. This supports better formatting in MDX files with VSCode.
13+
614
## [1.0.5](https://github.com/chrisrzhou/react-wordcloud/compare/v1.0.4...v1.0.5) (2019-03-16)
715

816
### New:

README.md

+9-25
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Simple React + D3 wordcloud component with powerful features. Uses the [`d3-cloud`](https://github.com/jasondavies/d3-cloud) layout.
44

5-
![image](https://github.com/chrisrzhou/react-wordcloud/raw/master/wordcloud.png)
5+
![image](/public/wordcloud.png)
66

77
## Install
88

@@ -16,37 +16,28 @@ Note that `react-wordcloud` requires `react^16.8.3` as a peer dependency.
1616

1717
### Documented Examples
1818

19-
View all documented examples and gallery of `react-globe` applications at https://react-globe.netlify.com/.
19+
View all documented examples and gallery of `react-wordcloud` applications at https://react-wordcloud.netlify.com/.
2020

2121
### Local Examples
2222

2323
You can also run the examples locally:
2424

2525
```bash
26-
git clone [email protected]:chrisrzhou/react-globe
27-
28-
cd react-globe
29-
yarn
30-
yarn dev
26+
git clone [email protected]:chrisrzhou/react-wordcloud
27+
cd react-wordcloud && yarn && yarn dev
3128
```
3229

3330
### Basic Example (no props)
3431

35-
<img src="/public/basic.png" width="500px" />
36-
37-
[![Edit react-globe-simple](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/bgov9)
32+
[![Edit react-wordcloud-simple](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/bgov9)
3833

3934
### Responsive Example
4035

41-
<img src="/public/basic.png" width="500px" />
42-
43-
[![Edit react-globe-simple](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/55sb8)
36+
[![Edit react-wordcloud-simple](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/55sb8)
4437

4538
### Configurable Options Example
4639

47-
<img src="/public/options.png" width="500px" />
48-
49-
[![Edit react-globe-interactive](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/fnk8w)
40+
[![Edit react-wordcloud-interactive](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/fnk8w)
5041

5142
## Development
5243

@@ -71,22 +62,15 @@ Feel free to contribute by submitting a pull request.
7162

7263
## Wordcloud Generator
7364

74-
Create wordclouds using this wordcloud generator: https://chrisrzhou.github.io/wordcloud-generator/
65+
Create wordclouds using this wordcloud generator: https://wordcloud-generator.netlify.com/
7566

7667
Features supported:
7768

78-
- Editing and uploading text inputs
69+
- Edit and Upload text inputs
7970
- Various NLP methods (stopwords, ngrams)
8071
- Wordcloud configurations
8172
- Export/save/share wordclouds
8273

83-
## TODOs
84-
85-
- [ ] Update dependencies and `docz`
86-
- [ ] Expose types
87-
- [ ] Update CHANGELOG
88-
- [ ] Update `react-wordcloud-generator`
89-
9074
## Donate
9175

9276
My projects will always be (ads-)free. I constantly learn from the community, so these projects are a way of giving back to the community. If you liked this project or find it useful, feel free to buy me a cup of coffee ☕️ through a small donation!

docs/ReactWordcloud.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from '../src';

docs/changelog.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ name: CHANGELOG
33
route: /changelog
44
---
55

6-
import Changelog from "./../CHANGELOG.md";
6+
import Changelog from '../CHANGELOG.md';
77

88
<Changelog />

docs/faq.mdx

+6-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ name: FAQ
33
route: /faq
44
---
55

6-
import { Playground } from "docz";
7-
import ReactWordcloud from "./../src";
6+
import { Playground } from 'docz';
7+
8+
import ReactWordcloud from './ReactWordcloud';
89

910
# FAQ
1011

@@ -22,9 +23,9 @@ This issue happens when the most frequent word is also the **longest** word. For
2223
<ReactWordcloud
2324
size={[200, 200]}
2425
words={[
25-
{ text: "this_is_a_long_word_and_also_the_most_frequent", value: 45 },
26-
{ text: "some_word", value: 35 },
27-
{ text: "another_word", value: 20 }
26+
{ text: 'this_is_a_long_word_and_also_the_most_frequent', value: 45 },
27+
{ text: 'some_word', value: 35 },
28+
{ text: 'another_word', value: 20 },
2829
]}
2930
/>
3031
</Playground>

docs/introduction.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ name: README
33
route: /
44
---
55

6-
import ReadMe from "./../README.md";
6+
import ReadMe from './../README.md';
77

88
<ReadMe />

docs/props.mdx

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
name: Props
3+
route: /props
4+
---
5+
6+
import { Props } from 'docz';
7+
8+
import ReactWordcloud from './ReactWordcloud';
9+
10+
# Props
11+
12+
<Props of={ReactWordcloud} />

docs/usage/basic.mdx

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ route: /usage/basic
44
menu: Usage
55
---
66

7-
import { Playground } from "docz";
8-
import ReactWordcloud from "./../../src";
9-
import words from "./words";
7+
import { Playground } from 'docz';
8+
9+
import ReactWordcloud from '../ReactWordcloud';
10+
import words from './words';
1011

1112
# Basic Example
1213

docs/usage/callbacks.mdx

+11-10
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ route: /usage/callbacks
44
menu: Usage
55
---
66

7-
import { useState } from "react";
8-
import { Playground } from "docz";
9-
import ReactWordcloud from "./../../src";
10-
import words from "./words";
7+
import { Playground } from 'docz';
8+
import { useState } from 'react';
9+
10+
import ReactWordcloud from '../ReactWordcloud';
11+
import words from './words';
1112

1213
# Callbacks
1314

@@ -24,11 +25,11 @@ In the example below, we can pass custom `getWordColor` and `getWordTooltip` cal
2425
words={words}
2526
callbacks={{
2627
getWordColor: ({ value }) => {
27-
return value > 50 ? "blue" : "red";
28+
return value > 50 ? 'blue' : 'red';
2829
},
2930
getWordTooltip: ({ text, value }) => {
3031
return value > 50 ? `${text.toUpperCase()} (> 50)` : `${text} (<= 50)`;
31-
}
32+
},
3233
}}
3334
/>
3435
</Playground>
@@ -42,14 +43,14 @@ You can pass callbacks such as `onWordClick`, `onWordMouseEnter` and `onWordMous
4243
function getCallback(callback) {
4344
return function(word) {
4445
console.log(
45-
`Callback: "${callback}". Word: ${JSON.stringify(word, null, 2)}`
46+
`Callback: "${callback}". Word: ${JSON.stringify(word, null, 2)}`,
4647
);
4748
};
4849
}
4950
const callbacks = {
50-
onWordClick: getCallback("onWordClick"),
51-
onWordMouseOut: getCallback("onWordMouseOut"),
52-
onWordMouseOver: getCallback("onWordMouseOver")
51+
onWordClick: getCallback('onWordClick'),
52+
onWordMouseOut: getCallback('onWordMouseOut'),
53+
onWordMouseOver: getCallback('onWordMouseOver'),
5354
};
5455
return <ReactWordcloud words={words} callbacks={callbacks} />;
5556
}}

docs/usage/options.mdx

+24-23
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ route: /usage/options
44
menu: Usage
55
---
66

7-
import { Playground } from "docz";
8-
import ReactWordcloud from "./../../src";
9-
import words from "./words";
7+
import { Playground } from 'docz';
8+
9+
import ReactWordcloud from '../ReactWordcloud';
10+
import words from './words';
1011

1112
# Options
1213

@@ -19,7 +20,7 @@ You can customize many visual and layout properties of `ReactWordcloud` by using
1920
<Playground>
2021
<ReactWordcloud
2122
options={{
22-
colors: ["#1f77b4", "#9467bd", "#8c564b"]
23+
colors: ['#1f77b4', '#9467bd', '#8c564b'],
2324
}}
2425
words={words}
2526
/>
@@ -32,7 +33,7 @@ If enabled, will produce the same output given a certain input. In contrast, the
3233
<Playground>
3334
<ReactWordcloud
3435
options={{
35-
deterministic: true
36+
deterministic: true,
3637
}}
3738
words={words}
3839
/>
@@ -45,10 +46,10 @@ Configure wordfont styles using the `fontFamily`, `fontSizes`, `fontStyle`, `fon
4546
<Playground>
4647
<ReactWordcloud
4748
options={{
48-
fontFamily: "courier new",
49+
fontFamily: 'courier new',
4950
fontSizes: [10, 20],
50-
fontStyle: "italic",
51-
fontWeight: "bold"
51+
fontStyle: 'italic',
52+
fontWeight: 'bold',
5253
}}
5354
words={words}
5455
/>
@@ -62,7 +63,7 @@ By default `ReactWordcloud` will apply random rotations if the `rotations` optio
6263
<ReactWordcloud
6364
options={{
6465
rotations: 3,
65-
rotationAngles: [0, 90]
66+
rotationAngles: [0, 90],
6667
}}
6768
words={words}
6869
/>
@@ -75,8 +76,8 @@ Configure the wordcloud layout by using the `scale`, `spiral` options.
7576
<Playground>
7677
<ReactWordcloud
7778
options={{
78-
scale: "log",
79-
spiral: "rectangular"
79+
scale: 'log',
80+
spiral: 'rectangular',
8081
}}
8182
words={words}
8283
/>
@@ -91,25 +92,25 @@ Use the code editor to edit and play around with some of these options!
9192
words={words}
9293
options={{
9394
colors: [
94-
"#1f77b4",
95-
"#ff7f0e",
96-
"#2ca02c",
97-
"#d62728",
98-
"#9467bd",
99-
"#8c564b"
95+
'#1f77b4',
96+
'#ff7f0e',
97+
'#2ca02c',
98+
'#d62728',
99+
'#9467bd',
100+
'#8c564b',
100101
],
101102
enableTooltip: true,
102103
deterministic: false,
103-
fontFamily: "impact",
104+
fontFamily: 'impact',
104105
fontSizes: [5, 60],
105-
fontStyle: "normal",
106-
fontWeight: "normal",
106+
fontStyle: 'normal',
107+
fontWeight: 'normal',
107108
padding: 1,
108109
rotations: 3,
109110
rotationAngles: [0, 90],
110-
scale: "sqrt",
111-
spiral: "archimedean",
112-
transitionDuration: 1000
111+
scale: 'sqrt',
112+
spiral: 'archimedean',
113+
transitionDuration: 1000,
113114
}}
114115
/>
115116
</Playground>

docs/usage/props.mdx

-12
This file was deleted.

0 commit comments

Comments
 (0)