Skip to content

Commit 90442fa

Browse files
committed
Initial implementation
0 parents  commit 90442fa

35 files changed

+19099
-0
lines changed

.editorconfig

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
end_of_line = lf
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
indent_style = space
13+
indent_size = 2
14+
15+
[*.hbs]
16+
insert_final_newline = false
17+
18+
[*.{diff,md}]
19+
trim_trailing_whitespace = false

.ember-cli

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
/**
3+
Ember CLI sends analytics information by default. The data is completely
4+
anonymous, but there are times when you might want to disable this behavior.
5+
6+
Setting `disableAnalytics` to true will prevent any data from being sent.
7+
*/
8+
"disableAnalytics": false
9+
}

.eslintignore

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# unconventional js
2+
/blueprints/*/files/
3+
/vendor/
4+
5+
# compiled output
6+
/dist/
7+
/tmp/
8+
9+
# dependencies
10+
/bower_components/
11+
/node_modules/
12+
13+
# misc
14+
/coverage/
15+
!.*
16+
.*/
17+
.eslintcache
18+
19+
# ember-try
20+
/.node_modules.ember-try/
21+
/bower.json.ember-try
22+
/package.json.ember-try

.eslintrc.js

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
'use strict';
2+
3+
module.exports = {
4+
root: true,
5+
parser: 'babel-eslint',
6+
parserOptions: {
7+
ecmaVersion: 2018,
8+
sourceType: 'module',
9+
ecmaFeatures: {
10+
legacyDecorators: true,
11+
},
12+
},
13+
plugins: ['ember'],
14+
extends: [
15+
'eslint:recommended',
16+
'plugin:ember/recommended',
17+
'plugin:prettier/recommended',
18+
],
19+
env: {
20+
browser: true,
21+
},
22+
rules: {},
23+
overrides: [
24+
// node files
25+
{
26+
files: [
27+
'.eslintrc.js',
28+
'.prettierrc.js',
29+
'.template-lintrc.js',
30+
'ember-cli-build.js',
31+
'index.js',
32+
'testem.js',
33+
'blueprints/*/index.js',
34+
'config/**/*.js',
35+
'tests/dummy/config/**/*.js',
36+
],
37+
excludedFiles: [
38+
'addon/**',
39+
'addon-test-support/**',
40+
'app/**',
41+
'tests/dummy/app/**',
42+
],
43+
parserOptions: {
44+
sourceType: 'script',
45+
},
46+
env: {
47+
browser: false,
48+
node: true,
49+
},
50+
plugins: ['node'],
51+
extends: ['plugin:node/recommended'],
52+
},
53+
{
54+
// Test files:
55+
files: ['tests/**/*-test.{js,ts}'],
56+
extends: ['plugin:qunit/recommended'],
57+
},
58+
],
59+
};

.gitignore

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# See https://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist/
5+
/tmp/
6+
7+
# dependencies
8+
/bower_components/
9+
/node_modules/
10+
11+
# misc
12+
/.env*
13+
/.pnp*
14+
/.sass-cache
15+
/.eslintcache
16+
/connect.lock
17+
/coverage/
18+
/libpeerconnection.log
19+
/npm-debug.log*
20+
/testem.log
21+
/yarn-error.log
22+
23+
# ember-try
24+
/.node_modules.ember-try/
25+
/bower.json.ember-try
26+
/package.json.ember-try

.npmignore

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# compiled output
2+
/dist/
3+
/tmp/
4+
5+
# dependencies
6+
/bower_components/
7+
8+
# misc
9+
/.bowerrc
10+
/.editorconfig
11+
/.ember-cli
12+
/.env*
13+
/.eslintcache
14+
/.eslintignore
15+
/.eslintrc.js
16+
/.git/
17+
/.gitignore
18+
/.prettierignore
19+
/.prettierrc.js
20+
/.template-lintrc.js
21+
/.travis.yml
22+
/.watchmanconfig
23+
/bower.json
24+
/config/ember-try.js
25+
/CONTRIBUTING.md
26+
/ember-cli-build.js
27+
/testem.js
28+
/tests/
29+
/yarn-error.log
30+
/yarn.lock
31+
.gitkeep
32+
33+
# ember-try
34+
/.node_modules.ember-try/
35+
/bower.json.ember-try
36+
/package.json.ember-try

.prettierignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# unconventional js
2+
/blueprints/*/files/
3+
/vendor/
4+
5+
# compiled output
6+
/dist/
7+
/tmp/
8+
9+
# dependencies
10+
/bower_components/
11+
/node_modules/
12+
13+
# misc
14+
/coverage/
15+
!.*
16+
.eslintcache
17+
18+
# ember-try
19+
/.node_modules.ember-try/
20+
/bower.json.ember-try
21+
/package.json.ember-try

.prettierrc.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
'use strict';
2+
3+
module.exports = {
4+
singleQuote: true,
5+
};

.template-lintrc.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
'use strict';
2+
3+
module.exports = {
4+
extends: 'recommended',
5+
};

.travis.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
language: node_js
3+
node_js:
4+
# we recommend testing addons with the same minimum supported node version as Ember CLI
5+
# so that your addon works for all apps
6+
- "10"
7+
8+
dist: xenial
9+
10+
addons:
11+
chrome: stable
12+
13+
cache:
14+
directories:
15+
- $HOME/.npm
16+
17+
env:
18+
global:
19+
# See https://git.io/vdao3 for details.
20+
- JOBS=1
21+
22+
branches:
23+
only:
24+
- master
25+
# npm version tags
26+
- /^v\d+\.\d+\.\d+/
27+
28+
jobs:
29+
fast_finish: true
30+
allow_failures:
31+
- env: EMBER_TRY_SCENARIO=ember-canary
32+
33+
include:
34+
# runs linting and tests with current locked deps
35+
- stage: "Tests"
36+
name: "Tests"
37+
script:
38+
- npm run lint
39+
- npm run test:ember
40+
41+
- stage: "Additional Tests"
42+
name: "Floating Dependencies"
43+
install:
44+
- npm install --no-package-lock
45+
script:
46+
- npm run test:ember
47+
48+
# we recommend new addons test the current and previous LTS
49+
# as well as latest stable release (bonus points to beta/canary)
50+
- env: EMBER_TRY_SCENARIO=ember-lts-3.20
51+
- env: EMBER_TRY_SCENARIO=ember-lts-3.24
52+
- env: EMBER_TRY_SCENARIO=ember-release
53+
- env: EMBER_TRY_SCENARIO=ember-beta
54+
- env: EMBER_TRY_SCENARIO=ember-canary
55+
- env: EMBER_TRY_SCENARIO=ember-default-with-jquery
56+
- env: EMBER_TRY_SCENARIO=ember-classic
57+
- env: EMBER_TRY_SCENARIO=embroider-safe
58+
- env: EMBER_TRY_SCENARIO=embroider-optimized
59+
60+
script:
61+
- node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO

.watchmanconfig

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"ignore_dirs": ["tmp", "dist"]
3+
}

CONTRIBUTING.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# How To Contribute
2+
3+
## Installation
4+
5+
* `git clone <repository-url>`
6+
* `cd ember-class-list`
7+
* `npm install`
8+
9+
## Linting
10+
11+
* `npm run lint`
12+
* `npm run lint:fix`
13+
14+
## Running tests
15+
16+
* `ember test` – Runs the test suite on the current Ember version
17+
* `ember test --server` – Runs the test suite in "watch mode"
18+
* `ember try:each` – Runs the test suite against multiple Ember versions
19+
20+
## Running the dummy application
21+
22+
* `ember serve`
23+
* Visit the dummy application at [http://localhost:4200](http://localhost:4200).
24+
25+
For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).

LICENSE.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2021
4+
5+
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:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
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.

README.md

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# ember-class-list
2+
3+
Concatenate really long dynamic class lists without worrying about whitespace.
4+
5+
### Without ember-class-list
6+
7+
```hbs
8+
<div class="Btn
9+
{{if this.loaded "active"}}
10+
{{this.theme}}
11+
">
12+
Update Photo
13+
</div>
14+
```
15+
_output:_
16+
```html
17+
<div class="Btn
18+
19+
dark
20+
">
21+
Update Photo
22+
</div>
23+
```
24+
25+
### With ember-class-list
26+
27+
```hbs
28+
<div class={{class-list
29+
"Btn"
30+
{{if this.loaded "active"}}
31+
{{this.theme}}
32+
>
33+
Update Photo
34+
</div>
35+
```
36+
_output:_
37+
```html
38+
<div class="Btn dark">
39+
Update Photo
40+
</div>
41+
```
42+
43+
## Compatibility
44+
45+
* Ember.js v3.4 or above
46+
* Ember CLI v3.4 or above
47+
* Node.js v10 or above
48+
49+
50+
## Installation
51+
52+
```
53+
ember install ember-class-list
54+
```
55+
56+
57+
## Usage
58+
59+
[Longer description of how to use the addon in apps.]
60+
61+
62+
## Contributing
63+
64+
See the [Contributing](CONTRIBUTING.md) guide for details.
65+
66+
67+
## License
68+
69+
This project is licensed under the [MIT License](LICENSE.md).

addon/helpers/class-list.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { helper } from '@ember/component/helper';
2+
3+
export default helper(function classList(positional) {
4+
return positional
5+
.filter(Boolean)
6+
.map(c => String(c).trim())
7+
.join(' ');
8+
});

app/helpers/class-list.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from 'ember-class-list/helpers/class-list';

0 commit comments

Comments
 (0)