initial commit taken from gitlab.lrz.de

This commit is contained in:
privatereese
2018-08-24 18:09:42 +02:00
parent ae54ed4c48
commit fc05486403
28494 changed files with 2159823 additions and 0 deletions

16
node_modules/art/dom/container.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
var Class = require('../core/class');
module.exports = Class({
grab: function(){
for (var i = 0; i < arguments.length; i++) arguments[i].inject(this);
return this;
},
empty: function(){
var node;
while (node = this.firstChild) node.eject();
return this;
}
});

116
node_modules/art/dom/dummy.js generated vendored Normal file
View File

@@ -0,0 +1,116 @@
var Class = require('../core/class');
module.exports = Class({
// placement
_resetPlacement: function(){
var container = this.parentNode;
if (container){
var previous = this.previousSibling, next = this.nextSibling;
if (previous){
previous.nextSibling = next;
} else {
container.firstChild = next;
}
if (next){
next.previousSibling = previous;
} else {
container.lastChild = this.previousSibling;
}
}
this.previousSibling = null;
this.nextSibling = null;
this.parentNode = null;
return this;
},
inject: function(container){
this._resetPlacement();
var last = container.lastChild;
if (last){
last.nextSibling = this;
this.previousSibling = last;
} else {
container.firstChild = this;
}
container.lastChild = this;
this.parentNode = container;
this._place();
return this;
},
injectBefore: function(sibling){
this._resetPlacement();
var container = sibling.parentNode;
if (!container) return this;
var previous = sibling.previousSibling;
if (previous){
previous.nextSibling = this;
this.previousSibling = previous;
} else {
container.firstChild = this;
}
sibling.previousSibling = this;
this.nextSibling = sibling;
this.parentNode = container;
this._place();
return this;
},
eject: function(){
this._resetPlacement();
this._place();
return this;
},
_place: function(){},
// events
dispatch: function(event){
var events = this._events,
listeners = events && events[event.type];
if (listeners){
listeners = listeners.slice(0);
for (var i = 0, l = listeners.length; i < l; i++){
var fn = listeners[i], result;
if (typeof fn == 'function')
result = fn.call(this, event);
else
result = fn.handleEvent(event);
if (result === false) event.preventDefault();
}
}
if (this.parentNode && this.parentNode.dispatch){
this.parentNode.dispatch(event);
}
},
subscribe: function(type, fn, bind){
if (typeof type != 'string'){ // listen type / fn with object
var subscriptions = [];
for (var t in type) subscriptions.push(this.subscribe(t, type[t]));
return function(){ // unsubscribe
for (var i = 0, l = subscriptions.length; i < l; i++)
subscriptions[i]();
return this;
};
} else { // listen to one
var bound = typeof fn === 'function' ? fn.bind(bind || this) : fn,
events = this._events || (this._events = {}),
listeners = events[type] || (events[type] = []);
listeners.push(bound);
return function(){
// unsubscribe
for (var i = 0, l = listeners.length; i < l; i++){
if (listeners[i] === bound){
listeners.splice(i, 1);
break;
}
}
}
}
}
});

83
node_modules/art/dom/native.js generated vendored Normal file
View File

@@ -0,0 +1,83 @@
var Class = require('../core/class');
function elementFrom(node){
if (node.toElement) return node.toElement();
if (node.getDOMNode) return node.getDOMNode();
if (node.getNode) return node.getNode();
return node;
}
module.exports = Class({
// conventions
toElement: function(){
return this.element;
},
getDOMNode: function(){
return this.toElement();
},
getNode: function(){
return this.toElement();
},
// placement
inject: function(container){
(container.containerElement || elementFrom(container))
.appendChild(this.element);
return this;
},
injectBefore: function(sibling){
var element = elementFrom(sibling);
element.parentNode.insertBefore(this.element, element);
return this;
},
eject: function(){
var element = this.element, parent = element.parentNode;
if (parent) parent.removeChild(element); // TODO: VML Nodes are dead after being ejected
return this;
},
// events
subscribe: function(type, fn, bind){
if (typeof type != 'string'){ // listen type / fn with object
var subscriptions = [];
for (var t in type) subscriptions.push(this.subscribe(t, type[t]));
return function(){ // unsubscribe
for (var i = 0, l = subscriptions.length; i < l; i++)
subscriptions[i]();
return this;
};
} else { // listen to one
if (!bind) bind = this;
var bound;
if (typeof fn === 'function'){
bound = fn.bind ? fn.bind(bind)
: function(){ return fn.apply(bind, arguments); };
} else {
bound = fn;
}
var element = this.element;
if (element.addEventListener){
element.addEventListener(type, bound, false);
return function(){ // unsubscribe
element.removeEventListener(type, bound, false);
return this;
};
} else {
element.attachEvent('on' + type, bound);
return function(){ // unsubscribe
element.detachEvent('on' + type, bound);
return this;
};
}
}
}
});

32
node_modules/art/dom/shadow.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
var Class = require('../core/class');
var Dummy = require('./dummy');
var Native = require('./native');
module.exports = Class(Dummy, Native, {
dummy_inject: Dummy.prototype.inject,
dummy_injectBefore: Dummy.prototype.injectBefore,
dummy_eject: Dummy.prototype.eject,
native_inject: Native.prototype.inject,
native_injectBefore: Native.prototype.injectBefore,
native_eject: Native.prototype.eject,
inject: function(container){
this.dummy_inject(container);
this.native_inject(container);
return this;
},
injectBefore: function(sibling){
this.dummy_injectBefore(sibling);
this.native_injectBefore(sibling);
return this;
},
eject: function(){
this.dummy_eject();
this.native_eject();
return this;
}
});