├── .babelrc ├── .eslintrc ├── .gitignore ├── .travis.yml ├── CHANGES.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── karma.conf.js ├── modules ├── Clone.js └── __tests__ │ ├── .eslintrc │ └── Clone-test.js ├── package.json ├── scripts ├── build.js └── release.sh ├── tests.webpack.js └── webpack.config.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "stage": 0, 3 | "loose": "all", 4 | "plugins": [ 5 | "dev-expression" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "rackt", 3 | "globals": { 4 | "__DEV__": true 5 | }, 6 | "rules": { 7 | "react/jsx-uses-react": 1, 8 | "react/jsx-no-undef": 2, 9 | "react/wrap-multilines": 2 10 | }, 11 | "plugins": [ 12 | "react" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | es6 2 | lib 3 | umd 4 | examples/**/*-bundle.js 5 | node_modules 6 | npm-debug.log 7 | website/index.html 8 | website/tags/* 9 | coverage 10 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - stable 5 | env: 6 | - 7 | - SKIP_BC=1 FAIL_ON_WARNINGS=1 8 | cache: 9 | directories: 10 | - node_modules 11 | before_install: 12 | - export CHROME_BIN=chromium-browser 13 | - export DISPLAY=:99.0 14 | - sh -e /etc/init.d/xvfb start 15 | after_success: 16 | - cat ./coverage/lcov.info | ./node_modules/codecov.io/bin/codecov.io.js 17 | - cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js 18 | branches: 19 | only: 20 | - master 21 | -------------------------------------------------------------------------------- /CHANGES.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryanflorence/react-clone/8884fe140b5a89815c4123d531c9350b80445384/CHANGES.md -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Tests 2 | 3 | All commits that fix bugs or add features need a test. 4 | 5 | `` Do not merge code without tests.`` 6 | 7 | ## Changelog 8 | 9 | All commits that change or add to the API must be done in a pull request 10 | that also: 11 | 12 | - Add an entry to `CHANGES.md` with clear steps for updating code for 13 | changed or removed API. 14 | - Updates examples 15 | - Updates the docs 16 | 17 | ### Development 18 | 19 | - `npm test` will fire up a karma test runner and watch for changes 20 | 21 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Ryan Florence 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | React Clone 2 | =========== 3 | 4 | Declarative element cloning for React. 5 | 6 | ### Installation 7 | 8 | Using [npm](https://www.npmjs.com/): 9 | 10 | $ npm install react-clone 11 | 12 | Then with a module bundler like [webpack](https://webpack.github.io/) that supports either CommonJS or ES2015 modules, use as you would anything else: 13 | 14 | ```js 15 | // using an ES6 transpiler, like babel 16 | import Clone from 'react-clone' 17 | 18 | // not using an ES6 transpiler 19 | var Clone = require('react-clone').default 20 | ``` 21 | 22 | The UMD build is also available on [npmcdn](https://npmcdn.com). You can find the library on `window.ReactClone`. 23 | 24 | ```html 25 | 26 | ``` 27 | 28 | 29 | ### Usage 30 | 31 | ```js 32 | const button =