Skip to content

Commit

Permalink
New build for the fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelmalonenz committed Feb 14, 2016
1 parent f6252d4 commit 36161a7
Show file tree
Hide file tree
Showing 21 changed files with 617 additions and 69 deletions.
33 changes: 33 additions & 0 deletions dist/amd/aurelia/dragula.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
define(['exports', 'aurelia-dependency-injection'], function (exports, _aureliaDependencyInjection) {
'use strict';

Object.defineProperty(exports, '__esModule', {
value: true
});

var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

var Dragula = (function () {
function Dragula(options) {
_classCallCheck(this, Dragula);

this.options = Object.assign({}, _aureliaDependencyInjection.Container.instance.get(GLOBAL_OPTIONS), options);
}

_createClass(Dragula, [{
key: 'containers',
get: function get() {
return this.options.containers;
},
set: function set(value) {
this.options.containers = value;
}
}]);

return Dragula;
})();

exports.Dragula = Dragula;
});
60 changes: 60 additions & 0 deletions dist/amd/aurelia/options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
define(['exports'], function (exports) {
'use strict';

Object.defineProperty(exports, '__esModule', {
value: true
});

var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

var GLOBAL_OPTIONS = 'GlobalOptions';

exports.GLOBAL_OPTIONS = GLOBAL_OPTIONS;
var DIRECTION = {
VERTICAL: 'vertical',
HORIZONTAL: 'horizontal'
};

exports.DIRECTION = DIRECTION;

var Options = (function () {
function Options() {
_classCallCheck(this, Options);

this.moves = this.always;
this.accepts = this.always;
this.invalid = this.invalidTarget;
this.containers = [];
this.isContainer = this.never;
this.copy = false;
this.copySortSource = false;
this.revertOnSpill = false;
this.removeOnSpill = false;
this.direction = DIRECTION.VERTICAL, this.ignoreInputTextSelection = true;
this.mirrorContainer = document.body;
}

_createClass(Options, [{
key: 'always',
value: function always() {
return true;
}
}, {
key: 'never',
value: function never() {
return false;
}
}, {
key: 'invalidTarget',
value: function invalidTarget() {
return false;
}
}]);

return Options;
})();

exports.Options = Options;
});
36 changes: 36 additions & 0 deletions dist/amd/classes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
define(['exports'], function (exports) {
'use strict';

Object.defineProperty(exports, '__esModule', {
value: true
});
exports.add = add;
exports.rm = rm;

var cache = {};
var start = '(?:^|\\s)';
var end = '(?:\\s|$)';

function lookupClass(className) {
var cached = cache[className];
if (cached) {
cached.lastIndex = 0;
} else {
cache[className] = cached = new RegExp(start + className + end, 'g');
}
return cached;
}

function add(el, className) {
var current = el.className;
if (!current.length) {
el.className = className;
} else if (!lookupClass(className).test(current)) {
el.className += ' ' + className;
}
}

function rm(el, className) {
el.className = el.className.replace(lookupClass(className), ' ').trim();
}
});
50 changes: 25 additions & 25 deletions dist/amd/dragula.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
define(['exports'], function (exports) {
define(['exports', 'contra', 'crossvent', './classes'], function (exports, _contra, _crossvent, _classes) {
'use strict';

var emitter = require('contra/emitter');
var crossvent = require('crossvent');
var classes = require('./classes');
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.dragula = dragula;

var doc = document;
var documentElement = doc.documentElement;

Expand Down Expand Up @@ -65,7 +67,7 @@ define(['exports'], function (exports) {
o.mirrorContainer = doc.body;
}

var drake = emitter({
var drake = (0, _contra.emitter)({
containers: o.containers,
start: manualStart,
end: end,
Expand Down Expand Up @@ -100,8 +102,8 @@ define(['exports'], function (exports) {

function movements(remove) {
var op = remove ? 'remove' : 'add';
crossvent[op](documentElement, 'selectstart', preventGrabbed);
crossvent[op](documentElement, 'click', preventGrabbed);
_crossvent[op](documentElement, 'selectstart', preventGrabbed);
_crossvent[op](documentElement, 'click', preventGrabbed);
}

function destroy() {
Expand Down Expand Up @@ -170,7 +172,7 @@ define(['exports'], function (exports) {
_offsetX = getCoord('pageX', e) - offset.left;
_offsetY = getCoord('pageY', e) - offset.top;

classes.add(_copy || _item, 'gu-transit');
_classes.add(_copy || _item, 'gu-transit');
renderMirrorImage();
drag(e);
}
Expand Down Expand Up @@ -323,7 +325,7 @@ define(['exports'], function (exports) {
ungrab();
removeMirrorImage();
if (item) {
classes.rm(item, 'gu-transit');
_classes.rm(item, 'gu-transit');
}
if (_renderTimer) {
clearTimeout(_renderTimer);
Expand Down Expand Up @@ -435,12 +437,12 @@ define(['exports'], function (exports) {
}

function spillOver(el) {
classes.rm(el, 'gu-hide');
_classes.rm(el, 'gu-hide');
}

function spillOut(el) {
if (drake.dragging) {
classes.add(el, 'gu-hide');
_classes.add(el, 'gu-hide');
}
}

Expand All @@ -452,17 +454,17 @@ define(['exports'], function (exports) {
_mirror = _item.cloneNode(true);
_mirror.style.width = getRectWidth(rect) + 'px';
_mirror.style.height = getRectHeight(rect) + 'px';
classes.rm(_mirror, 'gu-transit');
classes.add(_mirror, 'gu-mirror');
_classes.rm(_mirror, 'gu-transit');
_classes.add(_mirror, 'gu-mirror');
o.mirrorContainer.appendChild(_mirror);
touchy(documentElement, 'add', 'mousemove', drag);
classes.add(o.mirrorContainer, 'gu-unselectable');
_classes.add(o.mirrorContainer, 'gu-unselectable');
drake.emit('cloned', _mirror, _item, 'mirror');
}

function removeMirrorImage() {
if (_mirror) {
classes.rm(o.mirrorContainer, 'gu-unselectable');
_classes.rm(o.mirrorContainer, 'gu-unselectable');
touchy(documentElement, 'remove', 'mousemove', drag);
getParent(_mirror).removeChild(_mirror);
_mirror = null;
Expand Down Expand Up @@ -537,13 +539,13 @@ define(['exports'], function (exports) {
mousedown: 'MSPointerDown',
mousemove: 'MSPointerMove'
};
if (global.navigator.pointerEnabled) {
crossvent[op](el, pointers[type], fn);
} else if (global.navigator.msPointerEnabled) {
crossvent[op](el, microsoft[type], fn);
if (window.navigator.pointerEnabled) {
_crossvent[op](el, pointers[type], fn);
} else if (window.navigator.msPointerEnabled) {
_crossvent[op](el, microsoft[type], fn);
} else {
crossvent[op](el, touch[type], fn);
crossvent[op](el, type, fn);
_crossvent[op](el, touch[type], fn);
_crossvent[op](el, type, fn);
}
}

Expand Down Expand Up @@ -572,8 +574,8 @@ define(['exports'], function (exports) {
}

function getScroll(scrollProp, offsetProp) {
if (typeof global[offsetProp] !== 'undefined') {
return global[offsetProp];
if (typeof window[offsetProp] !== 'undefined') {
return window[offsetProp];
}
if (documentElement.clientHeight) {
return documentElement[scrollProp];
Expand Down Expand Up @@ -661,6 +663,4 @@ define(['exports'], function (exports) {
}
return host[coord];
}

module.exports = dragula;
});
12 changes: 9 additions & 3 deletions dist/amd/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
define(['exports'], function (exports) {
define(['exports', './aurelia/options', './dragula'], function (exports, _aureliaOptions, _dragula) {
'use strict';

Object.defineProperty(exports, '__esModule', {
value: true
});
exports.configure = configure;
exports.dragula = _dragula.dragula;

function configure(config) {
config.globalResources('./dragula.js');
function configure(config, callback) {
var defaults = new _aureliaOptions.Options();
config.container.registerInstance(_aureliaOptions.GLOBAL_OPTIONS, defaults);

if (callback !== undefined && typeof callback === 'function') {
callback(defaults);
}
}
});
33 changes: 33 additions & 0 deletions dist/commonjs/aurelia/dragula.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
'use strict';

Object.defineProperty(exports, '__esModule', {
value: true
});

var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

var _aureliaDependencyInjection = require('aurelia-dependency-injection');

var Dragula = (function () {
function Dragula(options) {
_classCallCheck(this, Dragula);

this.options = Object.assign({}, _aureliaDependencyInjection.Container.instance.get(GLOBAL_OPTIONS), options);
}

_createClass(Dragula, [{
key: 'containers',
get: function get() {
return this.options.containers;
},
set: function set(value) {
this.options.containers = value;
}
}]);

return Dragula;
})();

exports.Dragula = Dragula;
58 changes: 58 additions & 0 deletions dist/commonjs/aurelia/options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
'use strict';

Object.defineProperty(exports, '__esModule', {
value: true
});

var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

var GLOBAL_OPTIONS = 'GlobalOptions';

exports.GLOBAL_OPTIONS = GLOBAL_OPTIONS;
var DIRECTION = {
VERTICAL: 'vertical',
HORIZONTAL: 'horizontal'
};

exports.DIRECTION = DIRECTION;

var Options = (function () {
function Options() {
_classCallCheck(this, Options);

this.moves = this.always;
this.accepts = this.always;
this.invalid = this.invalidTarget;
this.containers = [];
this.isContainer = this.never;
this.copy = false;
this.copySortSource = false;
this.revertOnSpill = false;
this.removeOnSpill = false;
this.direction = DIRECTION.VERTICAL, this.ignoreInputTextSelection = true;
this.mirrorContainer = document.body;
}

_createClass(Options, [{
key: 'always',
value: function always() {
return true;
}
}, {
key: 'never',
value: function never() {
return false;
}
}, {
key: 'invalidTarget',
value: function invalidTarget() {
return false;
}
}]);

return Options;
})();

exports.Options = Options;
Loading

0 comments on commit 36161a7

Please sign in to comment.