Permalink
Browse files

v0.1.0

  • Loading branch information...
1 parent e61504f commit 7386ceeb8aff4c3de12713891bed2edd573eb867 @niklasramo niklasramo committed Sep 15, 2016
Showing with 5,612 additions and 181 deletions.
  1. +4 −0 .gitignore
  2. +88 −0 .jscsrc
  3. +5 −0 .travis.yml
  4. +0 −2 README.md
  5. +0 −18 demo/index.html
  6. +0 −3 demo/styles/main.css
  7. +89 −0 gulpfile.js
  8. +88 −0 karma.local-conf.js
  9. +99 −0 karma.sauce-browsers.js
  10. +73 −0 karma.sauce-conf.js
  11. +102 −147 muuri.js
  12. +24 −0 muuri.min.js
  13. +45 −0 package.json
  14. +305 −0 tests/qunit-1.23.1.css
  15. +4,334 −0 tests/qunit-1.23.1.js
  16. +14 −0 tests/tests.html
  17. +232 −0 tests/tests.js
  18. +9 −7 website/index.html
  19. +1 −0 website/scripts/main.js
  20. +100 −4 website/styles/main.css
View
@@ -0,0 +1,4 @@
+node_modules
+/coverage
+*.log
+*.env
View
@@ -0,0 +1,88 @@
+{
+ "disallowArrowFunctions": true,
+ "disallowMixedSpacesAndTabs": true,
+ "disallowMultipleLineStrings": true,
+ "disallowMultipleVarDecl": true,
+ "disallowSpacesInsideParentheses": true,
+ "disallowTrailingWhitespace": true,
+ "disallowTrailingComma": true,
+ "disallowKeywords": [
+ "with"
+ ],
+ "disallowSpacesInCallExpression": true,
+ "disallowSpacesInNamedFunctionExpression": {
+ "beforeOpeningRoundBrace": true
+ },
+ "disallowSpaceAfterObjectKeys": true,
+ "disallowMultipleLineBreaks": true,
+ "requireCapitalizedConstructors": true,
+ "requireSpaceBetweenArguments": true,
+ "requireSemicolons": true,
+ "requireParenthesesAroundIIFE": true,
+ "requireOperatorBeforeLineBreak": true,
+ "requireCommaBeforeLineBreak": true,
+ "requireCamelCaseOrUpperCaseIdentifiers": true,
+ "requireSpacesInForStatement": true,
+ "requireSpaceBeforeBlockStatements": true,
+ "requireSpacesInFunctionExpression": {
+ "beforeOpeningCurlyBrace": true
+ },
+ "requireSpacesInFunctionDeclaration": {
+ "beforeOpeningCurlyBrace": true
+ },
+ "requireSpacesInAnonymousFunctionExpression": {
+ "beforeOpeningRoundBrace": true,
+ "beforeOpeningCurlyBrace": true
+ },
+ "requireSpacesInConditionalExpression": true,
+ "requireSpaceAfterBinaryOperators": true,
+ "requireLineFeedAtFileEnd": true,
+ "requireCurlyBraces": [
+ "if",
+ "else",
+ "for",
+ "while",
+ "do",
+ "try",
+ "catch"
+ ],
+ "requireSpaceAfterKeywords": [
+ "if",
+ "else",
+ "for",
+ "while",
+ "do",
+ "switch",
+ "return",
+ "try",
+ "catch"
+ ],
+ "requireSpaceBeforeBinaryOperators": [
+ "=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=",
+ "&=", "|=", "^=", "+=",
+ "+", "-", "*", "/", "%", "<<", ">>", ">>>", "&",
+ "|", "^", "&&", "||", "===", "==", ">=",
+ "<=", "<", ">", "!=", "!=="
+ ],
+ "validateQuoteMarks": {
+ "mark": "'",
+ "escape": true
+ },
+ "validateAlignedFunctionParameters": {
+ "lineBreakAfterOpeningBraces": true,
+ "lineBreakBeforeClosingBraces": true
+ },
+ "validateParameterSeparator": ", ",
+ "validateIndentation": 2,
+ "jsDoc": {
+ "checkAnnotations": true,
+ "checkParamNames": true,
+ "requireParamTypes": true,
+ "checkRedundantParams": true,
+ "checkReturnTypes": true,
+ "checkRedundantReturns": true,
+ "requireReturnTypes": true,
+ "checkTypes": true,
+ "checkRedundantAccess": true
+ }
+}
View
@@ -0,0 +1,5 @@
+language: node_js
+node_js:
+ - "4"
+env:
+ email: false
View
@@ -2,8 +2,6 @@
A dynamic grid layout with built-in support for dragging and dropping grid items. Uses a custom bin-packing layout algorithm (similar to that of [Packery](https://github.com/metafizzy/packery)) for positioning the grid items. Powered by [Velocity](https://github.com/julianshapiro/velocity) (animations) and [Hammer.js](https://github.com/hammerjs/hammer.js) (touch gestures). Works in IE9+ and modern browsers.
-**So, why was this library built?** We at Haltu had need for a library that would essentially be a combination of [Packery](https://github.com/metafizzy/packery), [Hammer.js](https://github.com/hammerjs/hammer.js) and [Sortable](https://github.com/RubaXa/Sortable). We started out hacking away with Packery, but had to make an awful lot of hacks/workarounds to make it work nicely on touch devices with the drag-and-drop feature for our purposes. Also we needed to have connected grids where you could drag an item from one to another. On top of it all we needed a way to filter the items. This is an attempt to build a buttery smooth layout library that can handle all those aspects.
-
**A word of warning.** This library is currently under active development and not yet ready for prime time. Use at your own risk, API and functionality might be subject to change.
## Table of contents
View
@@ -14,14 +14,6 @@
<body>
- <nav class="navbar navbar-default navbar-fixed-top">
- <div class="container">
- <div class="navbar-header">
- <a class="navbar-brand" href="#">Muuri Demo</a>
- </div>
- </div>
- </nav>
-
<section id="demo">
<div class="container">
@@ -42,16 +34,6 @@
</div>
</section>
- <footer>
- <div class="container">
- <nav class="navbar navbar-default">
- <div class="container">
- <p class="navbar-text">&copy; 2015 <a href="http://www.haltu.fi/">Haltu Oy</a></p>
- </div>
- </nav>
- </div>
- </footer>
-
<script src="scripts/vendor/jquery.js"></script>
<script src="scripts/vendor/bootstrap.js"></script>
<script src="scripts/vendor/lodash.js"></script>
@@ -4,9 +4,6 @@ html {
overflow-y: scroll;
overflow-x: hidden;
}
-body {
- padding-top: 70px;
-}
html.dragging body {
-moz-user-select: none;
-webkit-user-select: none;
View
@@ -0,0 +1,89 @@
+var fs = require('fs');
+var gulp = require('gulp');
+var jscs = require('gulp-jscs');
+var karma = require('karma');
+var uglify = require('gulp-uglify');
+var rename = require('gulp-rename');
+var size = require('gulp-size');
+var runSequence = require('run-sequence');
+var argv = require('yargs').argv;
+var fileExists = function (filePath) {
+ try {
+ return fs.statSync(filePath).isFile();
+ } catch (err) {
+ return false;
+ }
+};
+
+// Load environment variables if .env file exists
+if (fileExists('./.env')) {
+ require('dotenv').load();
+}
+
+gulp.task('validate', function () {
+
+ return gulp
+ .src('./muuri.js')
+ .pipe(jscs())
+ .pipe(jscs.reporter());
+
+});
+
+gulp.task('compress', function() {
+
+ return gulp
+ .src('./muuri.js')
+ .pipe(size({title: 'development'}))
+ .pipe(uglify({
+ preserveComments: 'some'
+ }))
+ .pipe(size({title: 'minified'}))
+ .pipe(size({title: 'gzipped', gzip: true}))
+ .pipe(rename('muuri.min.js'))
+ .pipe(gulp.dest('./'));
+
+});
+
+gulp.task('test', function (done) {
+
+ var isLocal = !!argv.local;
+ var configPath = isLocal ? '/karma.local-conf.js' : '/karma.sauce-conf.js';
+ var browserMapper = {
+ 'safari': 'Safari',
+ 'ie9': 'IE9',
+ 'ie10': 'IE10',
+ 'ie11': 'IE11',
+ 'firefox': 'Firefox',
+ 'chrome': 'Chrome'
+ };
+ var opts = {
+ configFile: __dirname + configPath,
+ action: 'run'
+ };
+
+ if (argv.reporters) {
+ opts.reporters = argv.reporters.split(',');
+ }
+
+ if (argv.browsers) {
+ if (isLocal) {
+ opts.browsers = argv.browsers.split(',').map(function (browserName) {
+ return browserMapper[browserName.toLowerCase()] || '';
+ });
+ }
+ else {
+ opts.browsers = require('./karma.sauce-browsers.js').getBrowsers(argv.browsers);
+ }
+ }
+
+ (new karma.Server(opts, function (exitCode) {
+ done(exitCode);
+ })).start();
+
+});
+
+gulp.task('default', function (done) {
+
+ runSequence('validate', 'test', 'compress', done);
+
+});
View
@@ -0,0 +1,88 @@
+module.exports = function (config) {
+
+ var stn = {};
+
+ stn.basePath = '';
+
+ // https://npmjs.org/browse/keyword/karma-adapter
+ stn.frameworks = [
+ 'qunit'
+ ];
+
+ // plugins to use
+ stn.plugins = [
+ 'karma-qunit',
+ 'karma-chrome-launcher',
+ 'karma-firefox-launcher',
+ 'karma-safari-launcher',
+ 'karma-ie-launcher',
+ 'karma-story-reporter',
+ 'karma-coverage'
+ ];
+
+ // list of files / patterns to load in the browser
+ stn.files = [
+ './muuri.js',
+ './tests/tests.js'
+ ];
+
+ // list of files to exclude
+ stn.exclude = [];
+
+ // possible values: 'dots', 'progress', 'story'
+ // https://npmjs.org/browse/keyword/karma-reporter
+ stn.reporters = ['dots'];
+
+ stn.preprocessors = {
+ './muuri.js': ['coverage']
+ };
+
+ stn.coverageReporter = {
+ type : 'html',
+ dir : 'coverage/'
+ };
+
+ // web server port
+ stn.port = 8888;
+
+ // enable / disable colors in the output (reporters and logs)
+ stn.colors = true;
+
+ // level of logging
+ // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+ stn.logLevel = config.LOG_INFO;
+
+ stn.autoWatch = false;
+
+ stn.customLaunchers = {
+ IE11: {
+ base: 'IE',
+ 'x-ua-compatible': 'IE=EmulateIE11'
+ },
+ IE10: {
+ base: 'IE',
+ 'x-ua-compatible': 'IE=EmulateIE10'
+ },
+ IE9: {
+ base: 'IE',
+ 'x-ua-compatible': 'IE=EmulateIE9'
+ }
+ };
+
+ stn.browsers = [
+ 'Chrome'
+ ];
+
+ stn.captureTimeout = 60000;
+
+ stn.browserDisconnectTolerance = 2;
+
+ stn.browserDisconnectTimeout = 10000;
+
+ stn.browserNoActivityTimeout = 120000;
+
+ stn.singleRun = true;
+
+ config.set(stn);
+
+};
Oops, something went wrong.

0 comments on commit 7386cee

Please sign in to comment.