-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from tur-nr/release/v1
Release/v1
- Loading branch information
Showing
32 changed files
with
5,547 additions
and
3,531 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"presets": [ | ||
["env", { | ||
"targets": { | ||
"node": "current" | ||
} | ||
}] | ||
], | ||
"plugins": [ | ||
"transform-object-rest-spread" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_style = tab | ||
indent_size = 4 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[{*.json,.babelrc,.travis.yml}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.md] | ||
indent_style = space | ||
|
||
[*.html] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
bower_components | ||
coverage | ||
node_modules | ||
.idea | ||
*.log | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
bower_components | ||
coverage | ||
test | ||
.babelrc | ||
.editorconfig | ||
.gitignore | ||
.npmignore | ||
.travis.yml | ||
gulpfile.babel.js | ||
wct.conf.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,27 @@ | ||
language: node_js | ||
sudo: true | ||
dist: trusty | ||
node_js: 4 | ||
cache: | ||
directories: | ||
- node_modules | ||
|
||
sudo: true | ||
|
||
language: node_js | ||
|
||
node_js: stable | ||
|
||
addons: | ||
firefox: 46.0 | ||
firefox: latest | ||
apt: | ||
sources: | ||
- google-chrome | ||
packages: | ||
- google-chrome-stable | ||
|
||
cache: | ||
yarn: true | ||
|
||
before_script: | ||
- bower install | ||
- npm run lint | ||
|
||
script: | ||
- xvfb-run npm test | ||
|
||
after_script: | ||
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,136 +1,32 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Polymer Redux Demo</title> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes"> | ||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script> | ||
<script src="../../../node_modules/redux/dist/redux.js"></script> | ||
|
||
<link rel="import" href="../../iron-demo-helpers/demo-pages-shared-styles.html"> | ||
<link rel="import" href="../../iron-demo-helpers/demo-snippet.html"> | ||
|
||
<link rel="import" href="../polymer-redux.html"> | ||
|
||
<style is="custom-style" include="demo-pages-shared-styles"> | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<div class="vertical-section-container"> | ||
<h3>Polymer Redux Demo</h3> | ||
<demo-snippet> | ||
<template> | ||
<!-- redux setup --> | ||
<script> | ||
const reducer = (state, action) => { | ||
if (!state) return { friends: [] }; | ||
|
||
// copy friends list | ||
friends = state.friends.slice(0); | ||
|
||
switch (action.type) { | ||
case 'ADD_FRIEND': | ||
friends.push(action.friend); | ||
break; | ||
case 'REMOVE_FRIEND': | ||
const idx = friends.indexOf(action.friend) | ||
if (idx !== -1) { | ||
friends.splice(idx, 1) | ||
} | ||
break; | ||
case 'SORT_FRIENDS': | ||
friends.sort() | ||
break; | ||
} | ||
|
||
state.friends = friends; | ||
|
||
return state; | ||
} | ||
const store = Redux.createStore(reducer); | ||
const ReduxBehavior = PolymerRedux(store); | ||
</script> | ||
|
||
<!-- friends list module --> | ||
<dom-module id="friends-list"> | ||
<template> | ||
<p> | ||
<span>You have [[friends.length]] friend(s).</span> | ||
<template is="dom-if" if="[[canSortFriends(friends.length)]]"> | ||
<button on-click="sortFriends">Sort Friends</button> | ||
</template> | ||
</p> | ||
<ul> | ||
<template is="dom-repeat" items="[[friends]]"> | ||
<li> | ||
<span>[[item]]</span> | ||
<button on-click="removeFriend">Remove</button> | ||
</li> | ||
</template> | ||
</ul> | ||
<input id="friend-name" placeholder="Name" on-keypress="handleKeypress"> | ||
<button on-click="addFriend">Add Friend</button> | ||
</template> | ||
</dom-module> | ||
<script> | ||
Polymer({ | ||
is: 'friends-list', | ||
behaviors: [ ReduxBehavior ], | ||
properties: { | ||
friends: { | ||
type: Array, | ||
statePath: 'friends' | ||
} | ||
}, | ||
actions: { | ||
add: function(name) { | ||
return { | ||
type: 'ADD_FRIEND', | ||
friend: name | ||
}; | ||
}, | ||
remove: function(name) { | ||
return { | ||
type: 'REMOVE_FRIEND', | ||
friend: name | ||
}; | ||
}, | ||
sort: function() { | ||
return { | ||
type: 'SORT_FRIENDS' | ||
}; | ||
}, | ||
}, | ||
addFriend: function() { | ||
const input = this.$['friend-name']; | ||
if (input.value) { | ||
this.dispatch('add', input.value); | ||
input.value = ''; | ||
input.focus(); | ||
} | ||
}, | ||
removeFriend: function(event) { | ||
this.dispatch('remove', event.model.item); | ||
}, | ||
sortFriends: function() { | ||
this.dispatch('sort'); | ||
}, | ||
canSortFriends: function(length) { | ||
return length > 1; | ||
}, | ||
handleKeypress: function(event) { | ||
if (event.charCode === 13) { | ||
this.addFriend(); | ||
} | ||
} | ||
}); | ||
</script> | ||
|
||
<!-- demo --> | ||
<friends-list></friends-list> | ||
</template> | ||
</demo-snippet> | ||
</div> | ||
</body> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes"> | ||
|
||
<title>polymer-redux Demo</title> | ||
|
||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script> | ||
|
||
<link rel="import" href="./message-mixin.html"> | ||
</head> | ||
<body> | ||
<dom-module id="my-element"> | ||
<template> | ||
<p>[[message]]</p> | ||
<button on-click="handleUpdateMessage">Update message</button> | ||
</template> | ||
<script> | ||
class MyElement extends MessageMixin(Polymer.Element) { | ||
static get is() { return 'my-element'; } | ||
|
||
handleUpdateMessage() { | ||
this.dispatch('updateMessage', 'Nothing changes by staying the same, quite literally.'); | ||
} | ||
} | ||
window.customElements.define(MyElement.is, MyElement); | ||
</script> | ||
</dom-module> | ||
<my-element></my-element> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<link rel="import" href="./redux-mixin.html"> | ||
<script> | ||
MessageMixin = Parent => class MessageMixin extends ReduxMixin(Parent) { | ||
static get properties() { | ||
return { | ||
message: { | ||
type: String, | ||
statePath: 'message' | ||
} | ||
}; | ||
} | ||
|
||
static get actions() { | ||
return { | ||
updateMessage(message) { | ||
return { | ||
type: 'UPDATE_MESSAGE', | ||
message | ||
} | ||
} | ||
}; | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<link rel="import" href="../polymer-redux.html"> | ||
<script src="../node_modules/redux/dist/redux.js"></script> | ||
<script> | ||
const initial = { | ||
message: 'Hello from PolymerRedux' | ||
}; | ||
const reducer = (state = initial, action) => { | ||
switch (action.type) { | ||
case 'UPDATE_MESSAGE': | ||
return Object.assign({}, state, { | ||
message: action.message | ||
}); | ||
|
||
default: | ||
return state; | ||
} | ||
}; | ||
const store = Redux.createStore(reducer); | ||
ReduxMixin = PolymerRedux(store); | ||
</script> |
Oops, something went wrong.