{"license":"MIT","name":"react-konva","description":"React binding to canvas element via Konva framework","version":"16.6.0-1","keywords":["react","canvas","jsx","konva"],"bugs":{"url":"https://github.com/konvajs/react-konva/issues"},"licenses":"MIT","main":"lib/index.js","repository":{"type":"git","url":"git+ssh://git@github.com/konvajs/react-konva.git"},"source":"./src/react-konva-fiber.js","dependencies":{"fbjs":"^1.0.0","react-reconciler":"^0.16.0"},"peerDependencies":{"react":"16.6.0","react-dom":"16.6.0","konva":"^2.0.0"},"devDependencies":{"chai":"^4.2.0","enzyme":"^3.7.0","enzyme-adapter-react-16":"^1.6.0","konva":"^2.0.0","sinon":"^6.3.5","nwb":"^0.23.0","react":"16.6.0","react-dom":"16.6.0"},"scripts":{"build":"nwb build-react-component","clean":"nwb clean-module && nwb clean-demo","start":"nwb serve-react-demo","test":"nwb test-react","test:coverage":"nwb test-react --coverage","test:watch":"nwb test-react --server","preversion":"npm test","version":"npm run build","postversion":""},"typings":"react-konva.d.ts","readme":"# React Konva\n\n[![Build Status](https://travis-ci.org/konvajs/react-konva.svg?branch=master)](https://travis-ci.org/konvajs/react-konva) [![Greenkeeper badge](https://badges.greenkeeper.io/konvajs/react-konva.svg)](https://greenkeeper.io/)\n\n![ReactKonva Logo](https://cloud.githubusercontent.com/assets/1443320/12193428/3bda2fcc-b623-11e5-8319-b1ccfc95eaec.png)\n\nReact Konva is a JavaScript library for drawing complex canvas graphics using\n[React](http://facebook.github.io/react/).\n\nIt provides declarative and reactive bindings to the\n[Konva Framework](http://konvajs.github.io/).\n\n# [OPEN DEMO](https://codesandbox.io/s/5m3nwp787x)\n\nAn attempt to make [React](http://facebook.github.io/react/) work with the HTML5\ncanvas library. The goal is to have similar declarative markup as normal React\nand to have similar data-flow model.\n\nCurrently you can use all `Konva` components as React components and all `Konva`\nevents are supported on them in same way as normal browser events are supported.\n\nYou can even inspect the components in React dev tools.\n\n## Installation\n\n```bash\nnpm install react-konva konva --save\n```\n\n## [Tutorials and Documentation](https://konvajs.github.io/docs/react/)\n\n## Example\n\n```javascript\nimport React, { Component } from 'react';\nimport { render } from 'react-dom';\nimport { Stage, Layer, Rect, Text } from 'react-konva';\nimport Konva from 'konva';\n\nclass ColoredRect extends React.Component {\n  state = {\n    color: 'green'\n  };\n  handleClick = () => {\n    this.setState({\n      color: Konva.Util.getRandomColor()\n    });\n  };\n  render() {\n    return (\n      <Rect\n        x={20}\n        y={20}\n        width={50}\n        height={50}\n        fill={this.state.color}\n        shadowBlur={5}\n        onClick={this.handleClick}\n      />\n    );\n  }\n}\n\nclass App extends Component {\n  render() {\n    return (\n      <Stage width={window.innerWidth} height={window.innerHeight}>\n        <Layer>\n          <Text text=\"Try click on rect\" />\n          <ColoredRect />\n        </Layer>\n      </Stage>\n    );\n  }\n}\n\nrender(<App />, document.getElementById('root'));\n```\n\nAll `react-konva` components correspond to `Konva` components of the same name.\nAll the parameters available for `Konva` objects are valid props for\ncorresponding `react-konva` components, unless otherwise noted.\n\nCore shapes are: Rect, Circle, Ellipse, Line, Image, Text, TextPath, Star,\nLabel, SVG Path, RegularPolygon. Also you can create custom shape.\n\nTo get more info about `Konva` you can read\n[Konva Overview](http://konvajs.github.io/docs/overview.html).\n\n**Actually you don't need to learn `react-konva`. Just learn `Konva` framework, you will understand how to use `react-konva`**\n\n## Comparisons\n\n### react-konva vs react-canvas\n\n[react-canvas](https://github.com/Flipboard/react-canvas) is a completely\ndifferent react plugin. It allows you to draw DOM-like objects (images, texts)\non canvas element in very performant way. It is NOT about drawing graphics, but\nreact-konva is exactly for drawing complex graphics on `<canvas>` element from\nReact.\n\n### react-konva vs react-art\n\n[react-art](https://github.com/reactjs/react-art) allows you to draw graphics on\na page. It also supports SVG for output. But it has no support of events of\nshapes.\n\n### react-konva vs vanilla canvas\n\nVanilla canvas is faster because when you use `react-konva` you have two layers of abstractions. Konva framework is on top of canvas and React is on top of Konva.\nDepending on the use case this approach can be slow.\nThe purpose of `react-konva` is to reduce the complexity of the application and use well-known declarative way for drawing on canvas.\n\n## [CHANGELOG](https://github.com/konvajs/react-konva/releases)\n\n\n**Note: you can find a lot of demos and examples of using Konva there:\n[http://konvajs.github.io/](http://konvajs.github.io/). Really, just go there and take a look what Konva can do for you. You will be able to do the same with `react-konva` too.**\n\n### Getting reference to Konva objects\n\nTo get reference of `Konva` instance of a node you can use `ref` property.\n\n```javascript\nclass MyShape extends React.Component {\n  componentDidMount() {\n    // log Konva.Circle instance\n    console.log(this.circle);\n  }\n  render() {\n    return <Circle ref={ref => (this.circle = ref)} radius={50} fill=\"black\" />;\n  }\n}\n```\n\nThat will work for all nodes except `Stage`. To get `Stage` instance you have to\nuse:\n\n```javascript\nclass App extends React.Component {\n  componentDidMount() {\n    // log stage react wrapper\n    console.log(this.stageRef);\n    // log Konva.Stage instance\n    console.log(this.stageRef.getStage());\n  }\n  render() {\n    return <Stage ref={ref => (this.stageRef = ref)} width={300} height={300} />;\n  }\n}\n```","readmeFilename":"README.md","gitHead":"b2c2417d0863f71e4558c3a1b8b4d3b66f516d40","homepage":"https://github.com/konvajs/react-konva#readme","_id":"react-konva@16.6.0-1","_npmVersion":"6.3.0","_nodeVersion":"10.0.0","_npmUser":{"name":"lavrton","email":"lavrton@gmail.com"},"dist":{"integrity":"sha512-7pLucZ/cA01+EhAqyf59bK+HPoBrzFa05k8imxZbBDKe3o93EsSiB/nQ06eVZsvFlojvkw7sVkYoTJaz38V+Fw==","shasum":"84f2940dd8baaff855be45c7a4a9bb7108f8bf13","tarball":"http://registry-npm.ywwl.com/react-konva/download/react-konva-16.6.0-1.tgz","fileCount":7,"unpackedSize":30696,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb0HePCRA9TVsSAnZWagAAn+MP/A8/4swZwVoXaMNIFrIf\nMfbqc7BEAHLH4fqaz2qzbLkNEjeoMdDyUQdVeXiTh4l5cxT5JiEvPOJw3ckX\njv4PTHyhz8L4rVI01PdYouA/2Cvx2Y0mgH8Hr8JbqoH5cDVAOG7h6uuYsxWM\nN7UkcQSqaBOn0NV5RaK7mv+BqeJUD6EVvB5Kd0ak/HKXqLhoyF0TsijxsFzW\ne8EVpyeVUcMTD6/4g0t2f6yeCul9KUxukKaS8K0aWli53au0+26DeoszhTP2\nVHyeVoZGMyRiX5iz0cUmtdZ5B0hnFDxIptw0A+Qkq3T1P23A6GFVb25oB9wD\nsv0NYDlpD6rF+1z0E8lxfPHvXB0t+m7Df2VebQ6TxqZTfrGoCsNCxBeQpFep\n2GF0cgKTUTF4ZuLRrFkC7tJBVsKsuQmGQU8aE1OvC0BxxX4ccnzE1y2iw0Fh\nBMOBjGOzLeQclE2X+SrR11Lt9sdDFwuef9GTdIkqwx8jFkHOyjL8NHS1SnoW\nNiYu7BuGkxt6oNAE6LRvzrD6m/9uZIx9R9tTxN7RNBvgKqHEsYIUTklQXkOQ\nyAHpKS0L8jNk2PfeilJQuPwzE9yGA+6y5Pe9HoG0zLDP5k14guDqcs6rImk4\nNOYmWJBgIShDP4IZhc30BRc1nzzzFcGpNraLBKDYkLLudPgIXFuPEIfihKDq\nxf0n\r\n=BJF1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEdNhsF5hdvhu1cZwON8k0elm+G2FT8DiJO7NVtHEHV9AiEAlZdlAmYIT8UJK6eoEkZ4x3A1jNmBHd2jFPwlcGpzcxo="}],"size":10126,"noattachment":false,"key":"/react-konva/-/react-konva-16.6.0-1.tgz"},"maintainers":[{"name":"lavrton","email":"lavrton@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-konva_16.6.0-1_1540388750977_0.8064899334107278"},"_hasShrinkwrap":false,"publish_time":1540388751115,"_cnpm_publish_time":1540388751115,"dist-tags":{"beta":"19.0.0-1","latest":"19.3.2","legacy":"18.2.16","next":"19.2.0-3"}}