-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Timofey Dergachev
committed
Jun 25, 2017
0 parents
commit 8372e23
Showing
49 changed files
with
972 additions
and
0 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,20 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.hbs] | ||
insert_final_newline = false | ||
|
||
[*.{diff,md}] | ||
trim_trailing_whitespace = false |
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,9 @@ | ||
{ | ||
/** | ||
Ember CLI sends analytics information by default. The data is completely | ||
anonymous, but there are times when you might want to disable this behavior. | ||
|
||
Setting `disableAnalytics` to true will prevent any data from being sent. | ||
*/ | ||
"disableAnalytics": false | ||
} |
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,13 @@ | ||
module.exports = { | ||
root: true, | ||
parserOptions: { | ||
ecmaVersion: 2017, | ||
sourceType: 'module' | ||
}, | ||
extends: 'eslint:recommended', | ||
env: { | ||
browser: true | ||
}, | ||
rules: { | ||
} | ||
}; |
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,18 @@ | ||
# See https://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
# compiled output | ||
/dist | ||
/tmp | ||
|
||
# dependencies | ||
/node_modules | ||
/bower_components | ||
|
||
# misc | ||
/.sass-cache | ||
/connect.lock | ||
/coverage/* | ||
/libpeerconnection.log | ||
npm-debug.log* | ||
testem.log | ||
yarn.lock |
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,16 @@ | ||
/bower_components | ||
/config/ember-try.js | ||
/dist | ||
/tests | ||
/tmp | ||
**/.gitkeep | ||
.bowerrc | ||
.editorconfig | ||
.ember-cli | ||
.gitignore | ||
.eslintrc.js | ||
.watchmanconfig | ||
.travis.yml | ||
bower.json | ||
ember-cli-build.js | ||
testem.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
language: node_js | ||
node_js: | ||
- "6" | ||
|
||
sudo: false | ||
|
||
cache: | ||
yarn: true | ||
|
||
env: | ||
- EMBER_TRY_SCENARIO=ember-lts-2.4 | ||
- EMBER_TRY_SCENARIO=ember-lts-2.8 | ||
- EMBER_TRY_SCENARIO=ember-release | ||
|
||
matrix: | ||
fast_finish: true | ||
|
||
before_install: | ||
- curl -o- -L https://yarnpkg.com/install.sh | bash | ||
- export PATH=$HOME/.yarn/bin:$PATH | ||
- yarn global add phantomjs-prebuilt | ||
- phantomjs --version | ||
|
||
install: | ||
- yarn install --no-lockfile | ||
|
||
script: | ||
# Usually, it's ok to finish the test scenario without reverting | ||
# to the addon's original dependency state, skipping "cleanup". | ||
- node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO test --skip-cleanup |
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,3 @@ | ||
{ | ||
"ignore_dirs": ["tmp", "dist"] | ||
} |
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,3 @@ | ||
0.1.0 / 2017-06-25 | ||
================== | ||
- Initial commit |
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,21 @@ | ||
# The MIT License | ||
|
||
Copyright © 2017 [Timofey Dergachev](https://exeto.me/en) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
--- | ||
|
||
# Лицензия MIT | ||
|
||
Copyright © 2017 [Тимофей Дергачёв](https://exeto.me/) | ||
|
||
Данная лицензия разрешает лицам, получившим копию данного программного обеспечения и сопутствующей документации (в дальнейшем именуемыми «Программное Обеспечение»), безвозмездно использовать Программное Обеспечение без ограничений, включая неограниченное право на использование, копирование, изменение, добавление, публикацию, распространение, сублицензирование и/или продажу копий Программного Обеспечения, также как и лицам, которым предоставляется данное Программное Обеспечение, при соблюдении следующих условий: | ||
|
||
Указанное выше уведомление об авторском праве и данные условия должны быть включены во все копии или значимые части данного Программного Обеспечения. | ||
|
||
ДАННОЕ ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ ПРЕДОСТАВЛЯЕТСЯ «КАК ЕСТЬ», БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ, ЯВНО ВЫРАЖЕННЫХ ИЛИ ПОДРАЗУМЕВАЕМЫХ, ВКЛЮЧАЯ, НО НЕ ОГРАНИЧИВАЯСЬ ГАРАНТИЯМИ ТОВАРНОЙ ПРИГОДНОСТИ, СООТВЕТСТВИЯ ПО ЕГО КОНКРЕТНОМУ НАЗНАЧЕНИЮ И ОТСУТСТВИЯ НАРУШЕНИЙ ПРАВ. НИ В КАКОМ СЛУЧАЕ АВТОРЫ ИЛИ ПРАВООБЛАДАТЕЛИ НЕ НЕСУТ ОТВЕТСТВЕННОСТИ ПО ИСКАМ О ВОЗМЕЩЕНИИ УЩЕРБА, УБЫТКОВ ИЛИ ДРУГИХ ТРЕБОВАНИЙ ПО ДЕЙСТВУЮЩИМ КОНТРАКТАМ, ДЕЛИКТАМ ИЛИ ИНОМУ, ВОЗНИКШИМ ИЗ, ИМЕЮЩИМ ПРИЧИНОЙ ИЛИ СВЯЗАННЫМ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ ИЛИ ИСПОЛЬЗОВАНИЕМ ПРОГРАММНОГО ОБЕСПЕЧЕНИЯ ИЛИ ИНЫМИ ДЕЙСТВИЯМИ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ. |
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,114 @@ | ||
# ember-cli-jss [![Build Status][buildstat-image]][buildstat-url] | ||
|
||
> JSS integration for Ember | ||
## Install | ||
|
||
```bash | ||
$ npm install --save-dev ember-browserify | ||
$ npm install --save ember-cli-jss jss jss-preset-default | ||
``` | ||
|
||
## Usage | ||
|
||
The property `stylesheet` must be an instance of the `StyleSheet`. | ||
|
||
Properties `jssNames` and `jssNameBindings` work like `classNames` and `classNameBindings`, respectively. | ||
|
||
When you update properties listed in the `jssObservedProps`, dynamic styles will be updated. | ||
|
||
```js | ||
// ...awesome-component/component.js | ||
|
||
import Ember from 'ember'; | ||
import JSS from 'ember-cli-jss'; | ||
import stylesheet from './stylesheet'; | ||
|
||
export default Ember.Component.extend(JSS, { | ||
stylesheet, | ||
jssNames: ['wrapper'], | ||
jssNameBindings: ['isShow:show'], | ||
jssObservedProps: ['color'], | ||
|
||
color: 'blue', | ||
isShow: true, | ||
|
||
actions: { | ||
changeColor(color) { | ||
this.set('color', color); | ||
}, | ||
}, | ||
}); | ||
``` | ||
|
||
Constructor `StyleSheet` accepts the same arguments as [`jss.createStyleSheet`](http://cssinjs.org/js-api?v=v8.0.0#create-style-sheet). | ||
|
||
```js | ||
// ...awesome-component/stylesheet.js | ||
|
||
import { StyleSheet } from 'ember-cli-jss'; | ||
|
||
export default new StyleSheet({ | ||
wrapper: { | ||
width: 600, | ||
display: 'none', | ||
}, | ||
|
||
show: { | ||
display: 'block', | ||
}, | ||
|
||
content: { | ||
color: data => data.color; | ||
}, | ||
}); | ||
``` | ||
|
||
```hbs | ||
{{!-- ...awesome-component/template.hbs --}} | ||
<button type="button" {{action "changeColor" "green"}}> | ||
Green | ||
</button> | ||
<div class="{{jss 'content'}}"> | ||
Lorem ipsum... | ||
</div> | ||
``` | ||
|
||
## Helper | ||
|
||
```hbs | ||
<button class="{{jss 'large' 'primary' disabled=true}}"> | ||
Submit | ||
</button> | ||
``` | ||
|
||
## Configuration | ||
|
||
Plugin [`jss-preset-default`](https://github.com/cssinjs/jss-preset-default) applied by default. Please note that the work of the dynamic properties depends on [`jss-compose`](https://github.com/cssinjs/jss-compose) plugin. | ||
|
||
You can override the `app/initializers/ember-cli-jss.js`. Use `setup`, it takes the same arguments as [`jss.setup`](http://cssinjs.org/js-api?v=v8.0.0#setup-jss-instance). | ||
|
||
```js | ||
// ...app/initializers/ember-cli-jss.js | ||
|
||
import { setup } from 'ember-cli-jss'; | ||
import compose from 'npm:jss-compose'; | ||
|
||
export function initialize() { | ||
setup(compose.default()); | ||
} | ||
|
||
export default { | ||
name: 'ember-cli-jss', | ||
initialize, | ||
}; | ||
``` | ||
|
||
## License | ||
|
||
[MIT](LICENSE.md) © [Timofey Dergachev](https://exeto.me/) | ||
|
||
[buildstat-url]: https://travis-ci.org/exeto/ember-cli-jss?branch=master | ||
[buildstat-image]: https://img.shields.io/travis/exeto/ember-cli-jss/master.svg?style=flat-square |
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,27 @@ | ||
import Ember from 'ember'; | ||
|
||
const { merge } = Ember; | ||
|
||
export default (staticSheet, styles) => { | ||
for (const name in styles) { | ||
const className = staticSheet.classes[name]; | ||
|
||
if (!className) { | ||
break; | ||
} | ||
|
||
merge(styles[name], { composes: className }); | ||
} | ||
|
||
if (styles) { | ||
for (const name in staticSheet.classes) { | ||
const className = styles[name]; | ||
|
||
if (!className) { | ||
styles[name] = { composes: staticSheet.classes[name] } | ||
} | ||
} | ||
} | ||
|
||
return styles | ||
} |
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,17 @@ | ||
import Ember from 'ember'; | ||
|
||
const { | ||
Helper: { helper }, | ||
} = Ember; | ||
|
||
export default helper((params, hash) => { | ||
const { classes = {} } = hash; | ||
|
||
const items = Object.keys(hash) | ||
.filter(key => ( | ||
key !== 'classes' && | ||
hash[key] | ||
)); | ||
|
||
return [...params, ...items].map(param => classes[param] || '').join(' '); | ||
}); |
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,6 @@ | ||
import Mixin from './mixin'; | ||
import StyleSheet from './stylesheet'; | ||
import setup from './setup'; | ||
|
||
export default Mixin; | ||
export { StyleSheet, setup }; |
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,11 @@ | ||
import { setup } from 'ember-cli-jss'; | ||
import preset from 'npm:jss-preset-default'; | ||
|
||
export function initialize() { | ||
setup(preset.default()); | ||
} | ||
|
||
export default { | ||
name: 'ember-cli-jss', | ||
initialize, | ||
}; |
Oops, something went wrong.