feat: Update API

BREAKING CHANGE: 

Each icon in the `feather.icons` object is now an `Icon` object with a `name`, `contents`, `tags` and `attrs` property.
```js
/* BEFORE */
feather.icons.x
// '<line ... /><line ... />'

/* AFTER */
feather.icons.x
// {
//    name: 'x',
//    contents: '<line ... /><line ... />`,
//    tags: ['cancel', 'close', 'delete', 'remove'],
//    attrs: {
//      class: 'feather feather-x',
//      xmlns: 'http://www.w3.org/2000/svg',
//      width: 24,
//      height: 24,
//      viewBox: '0 0 24 24',
//      fill: 'none',
//      stroke: 'currentColor',
//      'stroke-width': 2,
//      'stroke-linecap': 'round',
//      'stroke-linejoin': 'round',
//    }
// }
```

`feather.toSvg()` has been deprecated in favor of `feather.icons[name].toSvg()`:
```js
/* BEFORE */
feather.toSvg('x')

/* AFTER */
feather.icons.x.toSvg()
```

`feather.replace()` now copies all attributes on the placeholder element (i.e. `<i>`) to the `<svg>` tag instead of just `class` and `id`:

```html
<i data-feather="circle" id="my-circle" class="foo bar" stroke-width="1"></i>
<!--
<i> will be replaced with:
<svg id="my-circle" class="feather feather-circle foo bar" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle></svg>
-->
```
This commit is contained in:
Cole Bemis
2017-11-18 20:00:16 -08:00
committed by GitHub
parent 0dc2bf5c9d
commit f243624fbd
32 changed files with 825 additions and 274 deletions

View File

@@ -7,30 +7,36 @@
"dist"
],
"scripts": {
"all": "make",
"lint": "make lint",
"test": "make test",
"build": "make build",
"start": "npm-run-all --sequential build lint test",
"build": "./bin/build.sh",
"lint": "eslint .",
"test": "jest",
"commitmsg": "validate-commit-msg",
"cm": "git-cz",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"dependencies": {
"classnames": "^2.2.5"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-loader": "^7.1.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-register": "^6.24.1",
"cheerio": "^1.0.0-rc.2",
"commitizen": "^2.9.6",
"core-js": "^2.4.1",
"cz-conventional-changelog": "^2.0.0",
"cz-conventional-changelog": "^2.1.0",
"eslint": "^4.0.0",
"eslint-config-airbnb-base": "^11.2.0",
"eslint-plugin-import": "^2.5.0",
"husky": "^0.13.4",
"jest": "^21.2.1",
"npm-run-all": "^4.1.2",
"parse5": "^3.0.2",
"prettier": "^1.8.2",
"rimraf": "^2.6.2",
"rsvp": "^3.6.0",
"semantic-release": "^6.3.6",
"svgo": "^0.7.2",