Skip to content

Commit 8a80c20

Browse files
author
Collier Devlin
committed
Initial commit
0 parents  commit 8a80c20

40 files changed

+109044
-0
lines changed

.babelrc

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"presets": [
3+
[
4+
"env",
5+
{
6+
"targets": {
7+
"browsers": [
8+
"last 2 versions"
9+
]
10+
}
11+
}
12+
]
13+
],
14+
"plugins": [
15+
"transform-vue-jsx",
16+
"transform-object-rest-spread"
17+
],
18+
"env": {
19+
"test": {
20+
"plugins": [
21+
"istanbul"
22+
]
23+
}
24+
}
25+
}

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/*.js

.eslintrc.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module.exports = {
2+
root: true,
3+
parser: 'babel-eslint',
4+
parserOptions: {
5+
sourceType: 'module'
6+
},
7+
extends: 'vue',
8+
// add your custom rules here
9+
'rules': {
10+
// allow async-await
11+
'generator-star-spacing': 0,
12+
// allow debugger during development
13+
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
14+
},
15+
globals: {
16+
requestAnimationFrame: true,
17+
performance: true
18+
}
19+
}

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.DS_Store
2+
node_modules/
3+
npm-debug.log
4+
test/coverage
5+
yarn-error.log
6+
reports

.npmignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build
2+
reports
3+
src
4+
test

.stylelintrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"processors": ["stylelint-processor-html"],
3+
"extends": "stylelint-config-standard",
4+
"rules": {
5+
"no-empty-source": null
6+
}
7+
}

CONTRIBUTING.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Contributing
2+
3+
Contributions are **welcome** and will be fully **credited**.
4+
5+
We accept contributions via Pull Requests on [Github](https://github.com//orloe-table-row-expander).
6+
7+
8+
## Pull Requests
9+
10+
- **Keep the same style** - eslint will automatically be ran before committing
11+
12+
- **Tip** to pass lint tests easier use the `npm run lint:fix` command
13+
14+
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
15+
16+
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
17+
18+
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
19+
20+
- **Create feature branches** - Don't ask us to pull from your master branch.
21+
22+
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
23+
24+
- **Send coherent history** - Make sure your commits message means something
25+
26+
27+
## Running Tests
28+
29+
Launch visual tests and watch the components at the same time
30+
31+
``` bash
32+
$ npm run dev
33+
```
34+
35+
36+
**Happy coding**!

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Collier Devlin
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.

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# vue-tiles
2+
A vue plugin using Muuri's responsive, sortable, filterable and draggable grid layouts.

build/utils/index.js

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
const ExtractTextPlugin = require('extract-text-webpack-plugin')
2+
const { join } = require('path')
3+
4+
const {
5+
red,
6+
logError
7+
} = require('./log')
8+
9+
const {
10+
processStyle
11+
} = require('./style')
12+
13+
const uppercamelcase = require('uppercamelcase')
14+
15+
exports.write = require('./write')
16+
17+
const {
18+
author,
19+
name,
20+
version,
21+
dllPlugin
22+
} = require('../../package.json')
23+
24+
const authorName = author.replace(/\s+<.*/, '')
25+
const minExt = process.env.NODE_ENV === 'production' ? '.min' : ''
26+
27+
exports.author = authorName
28+
exports.version = version
29+
exports.dllName = dllPlugin.name
30+
exports.moduleName = uppercamelcase(name)
31+
exports.name = name
32+
exports.filename = name + minExt
33+
exports.banner = `/*!
34+
* ${name} v${version}
35+
* (c) ${new Date().getFullYear()} ${authorName}
36+
* Released under the MIT License.
37+
*/
38+
`
39+
40+
// log.js
41+
exports.red = red
42+
exports.logError = logError
43+
44+
// It'd be better to add a sass property to the vue-loader options
45+
// but it simply don't work
46+
const sassOptions = {
47+
includePaths: [
48+
join(__dirname, '../../node_modules')
49+
]
50+
}
51+
52+
// don't extract css in test mode
53+
const nullLoader = process.env.NODE_ENV === 'common' ? 'null-loader!' : ''
54+
exports.vueLoaders =
55+
process.env.BABEL_ENV === 'test' ? {
56+
css: 'css-loader',
57+
scss: `css-loader!sass-loader?${JSON.stringify(sassOptions)}`
58+
} : {
59+
css: ExtractTextPlugin.extract(`${nullLoader}css-loader`),
60+
scss: ExtractTextPlugin.extract(
61+
`${nullLoader}css-loader!sass-loader?${JSON.stringify(sassOptions)}`
62+
)
63+
}
64+
65+
// style.js
66+
exports.processStyle = processStyle

build/utils/log.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
function logError (e) {
2+
console.log(e)
3+
}
4+
5+
function blue (str) {
6+
return `\x1b[1m\x1b[34m${str}\x1b[39m\x1b[22m`
7+
}
8+
9+
function green (str) {
10+
return `\x1b[1m\x1b[32m${str}\x1b[39m\x1b[22m`
11+
}
12+
13+
function red (str) {
14+
return `\x1b[1m\x1b[31m${str}\x1b[39m\x1b[22m`
15+
}
16+
17+
function yellow (str) {
18+
return `\x1b[1m\x1b[33m${str}\x1b[39m\x1b[22m`
19+
}
20+
21+
module.exports = {
22+
blue,
23+
green,
24+
red,
25+
yellow,
26+
logError
27+
}

build/utils/style.js

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
const path = require('path')
2+
const postcss = require('postcss')
3+
const cssnext = require('postcss-cssnext')
4+
const CleanCSS = require('clean-css')
5+
const { logError } = require('./log.js')
6+
const write = require('./write.js')
7+
8+
function processCss (style) {
9+
const componentName = path.basename(style.id, '.vue')
10+
return postcss([cssnext()])
11+
.process(style.code, {})
12+
.then(result => {
13+
return {
14+
name: componentName,
15+
css: result.css,
16+
map: result.map
17+
}
18+
})
19+
}
20+
21+
let stylus
22+
function processStylus (style) {
23+
try {
24+
stylus = stylus || require('stylus')
25+
} catch (e) {
26+
logError(e)
27+
}
28+
const componentName = path.basename(style.id, '.vue')
29+
return new Promise((resolve, reject) => {
30+
stylus.render(style.code, function (err, css) {
31+
if (err) return reject(err)
32+
resolve({
33+
original: {
34+
code: style.code,
35+
ext: 'styl'
36+
},
37+
name: componentName,
38+
css
39+
})
40+
})
41+
})
42+
}
43+
44+
function processStyle (style) {
45+
if (style.lang === 'css') {
46+
return processCss(style)
47+
} else if (style.lang === 'stylus') {
48+
return processStylus(style)
49+
} else {
50+
throw new Error(`Unknown style language '${style.lang}'`)
51+
}
52+
}
53+
54+
function writeCss (style) {
55+
write(`dist/${style.name}.css`, style.css)
56+
if (style.original) {
57+
write(`dist/${style.name}.${style.original.ext}`, style.original.code)
58+
}
59+
if (style.map) write(`dist/${style.name}.css.map`, style.map)
60+
write(`dist/${style.name}.min.css`, new CleanCSS().minify(style.css).styles)
61+
}
62+
63+
module.exports = {
64+
writeCss,
65+
processStyle
66+
}

build/utils/write.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const fs = require('fs')
2+
3+
const { blue } = require('./log.js')
4+
5+
function write (dest, code) {
6+
return new Promise(function (resolve, reject) {
7+
fs.writeFile(dest, code, function (err) {
8+
if (err) return reject(err)
9+
console.log(blue(dest) + ' ' + getSize(code))
10+
resolve(code)
11+
})
12+
})
13+
}
14+
15+
function getSize (code) {
16+
return (code.length / 1024).toFixed(2) + 'kb'
17+
}
18+
19+
module.exports = write

build/webpack.config.base.js

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
const webpack = require('webpack')
2+
const ExtractTextPlugin = require('extract-text-webpack-plugin')
3+
const { resolve } = require('path')
4+
5+
const {
6+
banner,
7+
filename,
8+
version,
9+
vueLoaders
10+
} = require('./utils')
11+
12+
const plugins = [
13+
new webpack.DefinePlugin({
14+
'__VERSION__': JSON.stringify(version),
15+
'process.env.NODE_ENV': '"test"'
16+
}),
17+
new webpack.BannerPlugin({ banner, raw: true, entryOnly: true }),
18+
new ExtractTextPlugin({
19+
filename: `${filename}.css`,
20+
// Don't extract css in test mode
21+
disable: /^(common|test)$/.test(process.env.NODE_ENV)
22+
})
23+
]
24+
25+
module.exports = {
26+
output: {
27+
path: resolve(__dirname, '../dist'),
28+
filename: `${filename}.common.js`
29+
},
30+
entry: ['velocityjs', 'hammerjs', './src/index.js'],
31+
resolve: {
32+
extensions: ['.js', '.vue', '.jsx', 'css'],
33+
alias: {
34+
'src': resolve(__dirname, '../src')
35+
}
36+
},
37+
plugins: [
38+
new webpack.ProvidePlugin({
39+
$: "jquery",
40+
jQuery: "jquery"
41+
})
42+
],
43+
module: {
44+
rules: [
45+
{
46+
test: /.jsx?$/,
47+
use: 'babel-loader',
48+
include: [
49+
resolve(__dirname, '../node_modules/@material'),
50+
resolve(__dirname, '../src'),
51+
resolve(__dirname, '../test')
52+
]
53+
},
54+
{
55+
test: /\.vue$/,
56+
loader: 'vue-loader',
57+
options: {
58+
loaders: vueLoaders,
59+
postcss: [require('postcss-cssnext')()],
60+
optimizeSSR: false
61+
}
62+
},
63+
{
64+
test: /\.scss$/,
65+
loaders: ["style", "css", "sass"],
66+
include: resolve('assetsPath')
67+
},
68+
]
69+
},
70+
node: {
71+
fs: 'empty',
72+
net: 'empty'
73+
},
74+
plugins
75+
}

0 commit comments

Comments
 (0)