Skip to content

Commit

Permalink
Build for test (and maybe release)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelmalonenz committed Mar 18, 2016
1 parent 05ab65c commit 1ac59ac
Show file tree
Hide file tree
Showing 5 changed files with 168 additions and 64 deletions.
56 changes: 42 additions & 14 deletions dist/amd/dragula-and-drop.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
define(['exports', 'babel-runtime/helpers/create-class', 'babel-runtime/helpers/class-call-check', 'babel-runtime/core-js/object/assign', 'aurelia-templating', 'aurelia-binding', 'aurelia-dependency-injection', './options', './dragula'], function (exports, _babelRuntimeHelpersCreateClass, _babelRuntimeHelpersClassCallCheck, _babelRuntimeCoreJsObjectAssign, _aureliaTemplating, _aureliaBinding, _aureliaDependencyInjection, _options, _dragula) {
define(['exports', 'babel-runtime/helpers/create-class', 'babel-runtime/helpers/class-call-check', 'babel-runtime/core-js/object/assign', 'aurelia-templating', 'aurelia-binding', './options', './dragula'], function (exports, _babelRuntimeHelpersCreateClass, _babelRuntimeHelpersClassCallCheck, _babelRuntimeCoreJsObjectAssign, _aureliaTemplating, _aureliaBinding, _options, _dragula) {
'use strict';

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

var DragulaAndDrop = (function () {
function DragulaAndDrop(globalOptions) {
function DragulaAndDrop() {
(0, _babelRuntimeHelpersClassCallCheck['default'])(this, _DragulaAndDrop);

this.globalOptions = globalOptions;
this.drake;
}

(0, _babelRuntimeHelpersCreateClass['default'])(DragulaAndDrop, [{
key: 'bind',
value: function bind() {
var _this = this;

var boundOptions = {
moves: this.moves,
accepts: this.accepts,
invalid: this.invalid,
containers: this.containers,
isContainer: this.isContainer,
copy: this.copy,
copySortSource: this.copySortSource,
revertOnSpill: this.revertOnSpill,
Expand All @@ -31,19 +28,50 @@ define(['exports', 'babel-runtime/helpers/create-class', 'babel-runtime/helpers/
mirrorContainer: this.mirrorContainer
};

var options = (0, _babelRuntimeCoreJsObjectAssign['default'])({}, this.globalOptions, boundOptions);
this.drake = new _dragula.Dragula(options);
var aureliaOptions = {
isContainer: function isContainer(el) {
if (!el) {
return false;
}
if (typeof _this.isContainer === 'function') {
return _this.isContainer({ el: el });
}

if (_this.dragula.dragging) {
return el.classList.contains(_this.targetClass);
}
return el.classList.contains(_this.sourceClass);
},
moves: function moves(item, source, handle, sibling) {
return _this.moves({ item: item, source: source, handle: handle, sibling: sibling });
},
accepts: function accepts(item, target, source, currentSibling) {
return _this.accepts({ item: item, target: target, source: source, currentSibling: currentSibling });
},
invalid: function invalid(item, handle) {
return _this.invalid({ item: item, handle: handle });
}
};

var options = (0, _babelRuntimeCoreJsObjectAssign['default'])(aureliaOptions, boundOptions);
this.dragula = new _dragula.Dragula(options);

this.dragula.on('drop', function (el, target, source, sibling) {
_this.dragula.cancel();
_this.dropFn({ el: el, target: target, source: source, sibling: sibling });
});
}
}, {
key: 'unbind',
value: function unbind() {
this.drake.destroy();
this.dragula.destroy();
}
}]);
var _DragulaAndDrop = DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.noView)()(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaDependencyInjection.inject)(_options.GLOBAL_OPTIONS)(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.customElement)('dragula-and-drop')(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'sourceClass', attribute: 'source-class', defaultValue: 'drag-source', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'targetClass', attribute: 'target-class', defaultValue: 'drop-target', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'mirrorContainer', attribute: 'mirror-container', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'ignoreInputTextSelection', attribute: 'ingore-input-text-selection', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'direction', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
Expand All @@ -53,9 +81,9 @@ define(['exports', 'babel-runtime/helpers/create-class', 'babel-runtime/helpers/
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'copy', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'isContainer', attribute: 'is-container', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'containers', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'invalid', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'accepts', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'moves', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'invalid', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: _options.Options.invalidTarget })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'accepts', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: _options.Options.always })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'moves', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: _options.Options.always })(DragulaAndDrop) || DragulaAndDrop;
return DragulaAndDrop;
})();

Expand Down
56 changes: 41 additions & 15 deletions dist/commonjs/dragula-and-drop.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,24 @@ var _aureliaTemplating = require('aurelia-templating');

var _aureliaBinding = require('aurelia-binding');

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

var _options = require('./options');

var _dragula = require('./dragula');

var DragulaAndDrop = (function () {
function DragulaAndDrop(globalOptions) {
function DragulaAndDrop() {
_classCallCheck(this, _DragulaAndDrop);

this.globalOptions = globalOptions;
this.drake;
}

_createClass(DragulaAndDrop, [{
key: 'bind',
value: function bind() {
var _this = this;

var boundOptions = {
moves: this.moves,
accepts: this.accepts,
invalid: this.invalid,
containers: this.containers,
isContainer: this.isContainer,
copy: this.copy,
copySortSource: this.copySortSource,
revertOnSpill: this.revertOnSpill,
Expand All @@ -46,20 +41,51 @@ var DragulaAndDrop = (function () {
mirrorContainer: this.mirrorContainer
};

var options = _Object$assign({}, this.globalOptions, boundOptions);
this.drake = new _dragula.Dragula(options);
var aureliaOptions = {
isContainer: function isContainer(el) {
if (!el) {
return false;
}
if (typeof _this.isContainer === 'function') {
return _this.isContainer({ el: el });
}

if (_this.dragula.dragging) {
return el.classList.contains(_this.targetClass);
}
return el.classList.contains(_this.sourceClass);
},
moves: function moves(item, source, handle, sibling) {
return _this.moves({ item: item, source: source, handle: handle, sibling: sibling });
},
accepts: function accepts(item, target, source, currentSibling) {
return _this.accepts({ item: item, target: target, source: source, currentSibling: currentSibling });
},
invalid: function invalid(item, handle) {
return _this.invalid({ item: item, handle: handle });
}
};

var options = _Object$assign(aureliaOptions, boundOptions);
this.dragula = new _dragula.Dragula(options);

this.dragula.on('drop', function (el, target, source, sibling) {
_this.dragula.cancel();
_this.dropFn({ el: el, target: target, source: source, sibling: sibling });
});
}
}, {
key: 'unbind',
value: function unbind() {
this.drake.destroy();
this.dragula.destroy();
}
}]);

var _DragulaAndDrop = DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.noView)()(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaDependencyInjection.inject)(_options.GLOBAL_OPTIONS)(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.customElement)('dragula-and-drop')(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'sourceClass', attribute: 'source-class', defaultValue: 'drag-source', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'targetClass', attribute: 'target-class', defaultValue: 'drop-target', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'mirrorContainer', attribute: 'mirror-container', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'ignoreInputTextSelection', attribute: 'ingore-input-text-selection', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'direction', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
Expand All @@ -69,9 +95,9 @@ var DragulaAndDrop = (function () {
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'copy', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'isContainer', attribute: 'is-container', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'containers', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'invalid', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'accepts', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'moves', defaultBindingMode: _aureliaBinding.bindingMode.oneTime })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'invalid', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: _options.Options.invalidTarget })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'accepts', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: _options.Options.always })(DragulaAndDrop) || DragulaAndDrop;
DragulaAndDrop = (0, _aureliaTemplating.bindable)({ name: 'moves', defaultBindingMode: _aureliaBinding.bindingMode.oneTime, defaultValue: _options.Options.always })(DragulaAndDrop) || DragulaAndDrop;
return DragulaAndDrop;
})();

Expand Down
56 changes: 41 additions & 15 deletions dist/es6/dragula-and-drop.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import {customElement, bindable, noView} from 'aurelia-templating';
import {bindingMode} from 'aurelia-binding';
import {inject} from 'aurelia-dependency-injection';

import {Options, DIRECTION, GLOBAL_OPTIONS} from './options';
import {Options} from './options';
import {Dragula} from './dragula';

@bindable({ name: 'moves', defaultBindingMode: bindingMode.oneTime })
@bindable({ name: 'accepts', defaultBindingMode: bindingMode.oneTime })
@bindable({ name: 'invalid', defaultBindingMode: bindingMode.oneTime })
@bindable({ name: 'moves', defaultBindingMode: bindingMode.oneTime, defaultValue: Options.always })
@bindable({ name: 'accepts', defaultBindingMode: bindingMode.oneTime, defaultValue: Options.always })
@bindable({ name: 'invalid', defaultBindingMode: bindingMode.oneTime, defaultValue: Options.invalidTarget })
@bindable({ name: 'containers', defaultBindingMode: bindingMode.oneTime })
@bindable({ name: 'isContainer', attribute: 'is-container', defaultBindingMode: bindingMode.oneTime })
@bindable({ name: 'copy', defaultBindingMode: bindingMode.oneTime })
Expand All @@ -17,23 +16,19 @@ import {Dragula} from './dragula';
@bindable({ name: 'direction', defaultBindingMode: bindingMode.oneTime })
@bindable({ name: 'ignoreInputTextSelection', attribute: 'ingore-input-text-selection', defaultBindingMode: bindingMode.oneTime })
@bindable({ name: 'mirrorContainer', attribute: 'mirror-container', defaultBindingMode: bindingMode.oneTime })
@bindable({ name: 'targetClass', attribute: 'target-class', defaultValue: 'drop-target', defaultBindingMode: bindingMode.oneTime })
@bindable({ name: 'sourceClass', attribute: 'source-class', defaultValue: 'drag-source', defaultBindingMode: bindingMode.oneTime })
@customElement('dragula-and-drop')
@inject(GLOBAL_OPTIONS)
@noView()
export class DragulaAndDrop {

constructor(globalOptions) {
this.globalOptions = globalOptions;
constructor() {
this.drake;
}

bind() {
let boundOptions = {
moves: this.moves,
accepts: this.accepts,
invalid: this.invalid,
containers: this.containers,
isContainer: this.isContainer,
copy: this.copy,
copySortSource: this.copySortSource,
revertOnSpill: this.revertOnSpill,
Expand All @@ -43,11 +38,42 @@ export class DragulaAndDrop {
mirrorContainer: this.mirrorContainer
};

let options = Object.assign({}, this.globalOptions, boundOptions);
this.drake = new Dragula(options);
let aureliaOptions = {
isContainer: el => {
if (!el) {
return false;
}
if (typeof this.isContainer === 'function') {
return this.isContainer({ el: el });
}

if (this.dragula.dragging) {
return el.classList.contains(this.targetClass);
}
return el.classList.contains(this.sourceClass);
},
moves: (item, source, handle, sibling) => {
return this.moves({ item: item, source: source, handle: handle, sibling: sibling });
},
accepts: (item, target, source, currentSibling) => {
return this.accepts({ item: item, target: target, source: source, currentSibling });
},
invalid: (item, handle) => {
return this.invalid({ item: item, handle: handle });
}
};

let options = Object.assign(aureliaOptions, boundOptions);
this.dragula = new Dragula(options);

this.dragula.on('drop', (el, target, source, sibling) => {
this.dragula.cancel();
this.dropFn({ el: el, target: target, source: source, sibling: sibling });
});
}

unbind() {
this.drake.destroy();
this.dragula.destroy();
}

}
2 changes: 1 addition & 1 deletion dist/es6/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function configure(config, callback) {
let defaults = new Options();
config.container.registerInstance(GLOBAL_OPTIONS, defaults);

if (callback !== undefined && typeof(callback) === 'function') {
if (callback !== undefined && typeof callback === 'function') {
callback(defaults);
}

Expand Down
Loading

0 comments on commit 1ac59ac

Please sign in to comment.