Skip to content

Commit 32264b3

Browse files
authored
Merge pull request #43 from tbolis/fix-the-latest-greatest
Fix the latest greatest
2 parents 247ca2f + 063fd3c commit 32264b3

26 files changed

+8026
-5399
lines changed

.babelrc

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
{
22
"presets": [
3-
[
4-
"env",
5-
{
6-
"modules": false
7-
}
8-
],
9-
"react",
10-
"stage-0"
3+
"@babel/preset-env", "@babel/preset-react"
114
],
125
"plugins": [
6+
"@babel/plugin-transform-runtime",
137
"react-hot-loader/babel",
14-
"transform-object-assign",
15-
"transform-react-display-name",
16-
"transform-runtime"
8+
9+
// Stage 2 https://github.com/babel/babel/tree/master/packages/babel-preset-stage-2
10+
["@babel/plugin-proposal-decorators", { "legacy": true }],
11+
"@babel/plugin-proposal-function-sent",
12+
"@babel/plugin-proposal-export-namespace-from",
13+
"@babel/plugin-proposal-numeric-separator",
14+
"@babel/plugin-proposal-throw-expressions",
15+
16+
// Stage 3
17+
"@babel/plugin-syntax-dynamic-import",
18+
"@babel/plugin-syntax-import-meta",
19+
["@babel/plugin-proposal-class-properties", { "loose": true }],
20+
"@babel/plugin-proposal-json-strings"
1721
]
1822
}

.eslintrc

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,25 @@
22
"parser": "babel-eslint",
33
"plugins": [
44
"react",
5+
"jest",
56
"eslint-plugin-react"
67
],
78
"env": {
8-
"browser": true,
9-
"amd": true,
109
"es6": true,
11-
"node": false
10+
"jest": true,
11+
"amd": true,
12+
"browser": true,
13+
"node": true
1214
},
13-
"rules": {
14-
"comma-dangle": 1,
15-
"quotes": [
16-
1,
17-
"single"
18-
],
19-
"no-undef": 1,
20-
"global-strict": 0,
21-
"no-extra-semi": 1,
22-
"no-underscore-dangle": 0,
23-
"no-extra-parens": 0,
24-
"no-console": 1,
25-
"no-unused-vars": 1,
26-
"no-trailing-spaces": [
27-
1,
28-
{
29-
"skipBlankLines": true
30-
}
31-
],
32-
"no-alert": 0,
33-
"no-unreachable": 1,
34-
"react/jsx-uses-react": 1,
35-
"react/jsx-uses-vars": 1
15+
"extends": [
16+
"eslint:recommended",
17+
"plugin:react/recommended"
18+
],
19+
"globals": {
20+
"React": true,
21+
"document": true,
22+
"require": true,
23+
"window": true,
24+
"localStorage": true
3625
}
3726
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ node_modules
158158

159159
lib/
160160
build/
161+
dist/
161162

162163
### Windows template
163164
# Windows image file caches

.npmignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ docs/
88
.gitignore
99
.karma.config.js
1010
webpack.*
11+
yarn.lock
12+
package.lock
1113

1214

1315
### Linux template
@@ -168,7 +170,6 @@ build/Release
168170
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
169171
node_modules
170172

171-
lib/
172173
build/
173174

174175
### Windows template

.travis.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
language: node_js
22
node_js:
3+
- "10"
4+
- "9"
35
- "8"
4-
- "7"
5-
- "6"
6+
cache:
7+
yarn: true
8+
directories:
9+
- node_modules
610
env:
711
- CXX=g++-4.8
812
addons:
@@ -13,5 +17,5 @@ addons:
1317
- g++-4.8
1418
before_install:
1519
- sudo apt-get update -qq
20+
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.9.4
1621
- sudo apt-get install -y -qq libgif-dev libpng-dev libjpeg8-dev libpango1.0-dev libcairo2-dev
17-
script: 'npm run build && npm run test'

README.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,17 @@ A Sketch tool for React based applications, backed-up by [FabricJS](http://fabri
1616
npm install react-sketch --save
1717
```
1818

19+
or with yarn
20+
21+
```sh
22+
yarn add react-sketch
23+
```
24+
1925
### Source installation
2026

2127
In order to build from source, read the [relevant instructions](http://fabricjs.com/fabric-intro-part-4#node) first.
2228

23-
Tested with node versions 4,5,6,7,8.
29+
Tested with node versions 6,7,8.
2430

2531
## Usage
2632

@@ -35,7 +41,7 @@ class SketchFieldDemo extends React.Component {
3541
<SketchField width='1024px'
3642
height='768px'
3743
tool={Tools.Pencil}
38-
color='black'
44+
lineColor='black'
3945
lineWidth={3}/>
4046
)
4147
}
@@ -54,10 +60,10 @@ Configuration Options
5460
| undoSteps | Number | 15 | number of undo/redo steps to maintain |
5561
| imageFormat | String | png | image format when calling toDataURL, can be png or jpeg |
5662
| width | Number | No Value(null)| Set/control the canvas width, if left empty the sketch will scale to parent element |
57-
| height | Number | 512 | Set/control the canvas height, if left empty the sketch will take a reasonable default height |
58-
| defaultData | JSON or data URL | | Default initial data, can be json or URL data accroding to configuration option below, in the case of data URL the initial drawing will be imported as an image |
59-
| defaultDataType | Enumeration (string) | json | The Type of initial data, can be either json or url |
60-
| widthCorrection | Number | 2 | Specify some width correction which will be applied on resize of canvas, this will help to correct some possible border on the canvas style |
63+
| height | Number | 512 | Set/control the canvas height, if left empty the sketch will take a reasonable default height |
64+
| value | JSON | | Property to utilize and handle the sketch data as controlled component |
65+
| defaultValue | JSON | | Default initial data, to load. If value is set then value will be loaded instead |
66+
| widthCorrection | Number | 2 | Specify some width correction which will be applied on resize of canvas, this will help to correct some possible border on the canvas style |
6167
| heightCorrection | Number | 0 | Specify some height correction which will be applied on resize of canvas, this will help to correct some possible border on the canvas style |
6268

6369

@@ -67,6 +73,7 @@ Available tools
6773
|--- |--- |
6874
| Pencil | Free drawing pencil |
6975
| Line | Gives you the ability to draw lines |
76+
| Rectangle | Create rectangles |
7077
| Circle | Create circles |
7178
| Rectangle | Create Rectangles |
7279
| Select | Disables drawing and gives you the ability to modify existing elements in the canvas |
@@ -79,11 +86,11 @@ The project includes a webpack server for running the examples, just run:
7986

8087
```sh
8188
git clone https://github.com/tbolis/react-sketch.git
82-
npm install
89+
yarn install
8390
npm start
8491
```
8592

86-
and navigate to http://localhost:9999
93+
and navigate to http://localhost:23000
8794

8895
You can as well check the live showcase here: http://tbolis.github.io/showcase/react-sketch/
8996

examples/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
};
2424
(function () {
2525
var wf = document.createElement('script');
26-
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
26+
wf.src = ('https:' === document.location.protocol ? 'https' : 'http') +
2727
'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
2828
wf.type = 'text/javascript';
2929
wf.async = 'true';

examples/main.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ body, html {
1515
min-height: 100%;
1616
width: 100%;
1717
height: 100%;
18-
background-color: #eeffd3;
18+
background-color: #607d8b;
1919
color: #000000;
2020
}
2121

0 commit comments

Comments
 (0)