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

26
node_modules/art/modes/script/_image.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
var Class = require('../../core/class');
var Base = require('./base');
module.exports = Class(Base, {
base_initialize: Base.prototype.initialize,
initialize: function(src, width, height){
this.base_initialize();
if (src != null) this.draw.apply(this, arguments);
},
draw: function(){
this.args = Array.prototype.slice.call(arguments);
return this;
},
base_toExpression: Base.prototype.toExpression,
toExpression: function(expr){
var artImage = this.artVar.property('Image');
if (!expr) expr = artImage.construct.apply(artImage, this.args);
return this.base_toExpression(expr);
}
});

24
node_modules/art/modes/script/base.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
var Class = require('../../core/class');
var Color = require('../../core/color');
var Node = require('./node');
Color.prototype.toExpression = Color.prototype.toHEX;
module.exports = Class(Node, {
/* styles */
fill: function(color){ return this._addCall('fill', arguments); },
fillRadial: function(stops, focusX, focusY, radius, centerX, centerY){ return this._addCall('fillRadial', arguments); },
fillLinear: function(stops, angle){
if (angle == null) return this._addCall('fill', stops);
return this._addCall('fillLinear', arguments);
},
fillImage: function(){ return this._addCall('fillImage', arguments); },
stroke: function(color, width, cap, join){ return this._addCall('stroke', arguments); }
});

76
node_modules/art/modes/script/font.js generated vendored Normal file
View File

@@ -0,0 +1,76 @@
var Class = require('../../core/class');
var Base = require('./base');
var Modulizer = require('./modulizer');
var fonts = {}, fontsInUse = null;
var artVar = Base.prototype.artVar, artFont = artVar.property('Font');
var parseFontString = function(font){
var regexp = /^\s*((?:(?:normal|bold|italic)\s+)*)(?:(\d+(?:\.\d+)?)[ptexm\%]*(?:\s*\/.*?)?\s+)?\s*\"?([^\"]*)/i,
match = regexp.exec(font);
return {
fontFamily: match[3],
fontSize: match[2],
fontStyle: (/italic/.exec(match[1]) || ''),
fontWeight: (/bold/.exec(match[1]) || '')
};
};
var Font = Class(Base, {
base_initialize: Base.prototype.initialize,
initialize: function(text, font, alignment){
this.base_initialize();
if (text != null && font != null) this.draw(text, font, alignment);
},
draw: function(text, fontArg, alignment){
var font = (typeof fontArg == 'string') ? parseFontString(fontArg) : fontArg;
if (font){
var family = font.fontFamily || font['font-family'],
weight = font.fontWeight || font['font-weight'] || 'normal',
style = font.fontStyle || font['font-style'] || 'normal',
size = parseFloat(font.fontSize || font['font-size'] || font.size);
this.font = font.glyphs ? null : weight + style + family;
}
this.args = Array.prototype.slice.call(arguments);
return this;
},
base_toExpression: Base.prototype.toExpression,
toExpression: function(expr){
if (this.font && fontsInUse) fontsInUse[this.font] = fonts[this.font];
if (!expr) expr = this.args ? artFont.construct.apply(artFont, this.args) : artFont.construct();
return this.base_toExpression(expr);
}
});
Font.register = function(font){
var face = font.face,
family = face['font-family'],
weight = (face['font-weight'] > 500 ? 'bold' : 'normal'),
style = (face['font-stretch'] == 'oblique' || face['font-style'] == 'oblique' || face['font-style'] == 'italic' ? 'italic' : 'normal');
fonts[weight + style + family] = font;
return this;
};
var _toModuleStatements = Modulizer._toModuleStatements;
Modulizer._toModuleStatements = function(){
fontsInUse = {};
var statements = _toModuleStatements.call(this);
for (var font in fontsInUse){
var registerStatement = artFont.property('register').call(fontsInUse[font]);
statements.push(registerStatement);
}
statements.push(statements[1]);
statements.splice(1, 1);
fontsInUse = null;
return statements;
};
module.exports = Font;

26
node_modules/art/modes/script/group.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
var Class = require('../../core/class');
var Container = require('../../dom/container');
var Node = require('./node');
module.exports = Class(Node, Container, {
element_initialize: Node.prototype.initialize,
initialize: function(){
this.element_initialize();
},
element_toExpression: Node.prototype.toExpression,
toExpression: function(){
var artGroup = this.artVar.property('Group'),
grab = artGroup.construct().property('grab');
var children = [], node = this.firstChild;
while (node){
children.push(node.toExpression());
node = node.nextSibling;
}
return this.element_toExpression(grab.call.apply(grab, children));
}
});

32
node_modules/art/modes/script/modulizer.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
var AST = require('../../lib/ast-js/ast');
var artVar = new AST.Variable('ART'),
moduleVar = new AST.Variable('module'),
exportsProp = moduleVar.property('exports'),
requireVar = new AST.Variable('require'),
requireART = requireVar.call('art'),
requireStatement = artVar.assign(requireART);
var Modulizer = {
artVar: artVar,
toExpression: function(){
throw new Error('You need to implement toExpression on this class.');
},
_toModuleStatements: function(){
var fn = new AST.Function(null, null, [ new AST.Return(this.toExpression()) ]);
return [requireStatement, exportsProp.assign(fn)];
},
toModule: function(){
return new AST.Block(
// Make this overridable even when mixed in
Modulizer._toModuleStatements.call(this)
);
}
};
module.exports = Modulizer;

60
node_modules/art/modes/script/node.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
var Class = require('../../core/class');
var Transform = require('../../core/transform');
var Modulizer = require('./modulizer');
var Element = require('../../dom/dummy');
module.exports = Class(Modulizer, Transform, Element, {
initialize: function(){
this._calls = [];
},
_addCall: function(property, args){
this._calls.push({ prop: property, args: Array.prototype.slice.call(args) });
return this;
},
toExpression: function(expr){
var calls = this._calls, propExpr;
for (var i = 0, l = calls.length; i < l; i++){
var call = calls[i];
propExpr = expr.property(call.prop);
expr = propExpr.call.apply(propExpr, call.args);
}
if (this.xx != 1 || this.xy != 0 || this.yx != 0 || this.yy != 1){
propExpr = expr.property('transform');
expr = propExpr.call.apply(propExpr, (this.x != 0 || this.y != 0) ? [
this.xx, this.xy,
this.yx, this.yy,
this.x, this.y
] : [
this.xx, this.xy,
this.yx, this.yy
]);
} else if (this.x != 0 || this.y != 0){
expr = expr.property('move').call(this.x, this.y);
}
return expr;
},
// transforms
blend: function(opacity){ return this._addCall('blend', arguments); },
// visibility
hide: function(){ return this._addCall('hide', arguments); },
show: function(){ return this._addCall('show', arguments); },
// interaction
indicate: function(){ return this._addCall('indicate', arguments); },
// ignore
subscribe: function(){
return this;
}
});

1
node_modules/art/modes/script/path.js generated vendored Normal file
View File

@@ -0,0 +1 @@
module.exports = require('../svg/path');

28
node_modules/art/modes/script/shape.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
var Class = require('../../core/class');
var Base = require('./base');
var Path = require('./path');
module.exports = Class(Base, {
base_initialize: Base.prototype.initialize,
initialize: function(path){
this.base_initialize();
if (path != null) this.draw(path);
},
draw: function(path, width, height){
path = ((path instanceof Path) ? path : new Path(path)).toString();
this.args = arguments.length < 3 ? [ path ] : [ path, width, height ];
return this;
},
base_toExpression: Base.prototype.toExpression,
toExpression: function(expr){
var artShape = this.artVar.property('Shape');
if (!expr) expr = artShape.construct.apply(artShape, this.args);
return this.base_toExpression(expr);
}
});

35
node_modules/art/modes/script/surface.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
var Class = require('../../core/class');
var Container = require('../../dom/container');
var Modulizer = require('./modulizer');
module.exports = Class(Container, Modulizer, {
initialize: function(width, height){
this.resize(width, height);
},
resize: function(width, height){
this.width = width;
this.height = height;
return this;
},
toExpression: function(){
var expr = this.artVar.property('Surface').construct(this.width, this.height);
if (!this.firstChild) return expr;
var children = [], node = this.firstChild;
while (node){
children.push(node);
node = node.nextSibling;
}
var grab = expr.property('grab');
return grab.call.apply(grab, children);
},
// ignore
subscribe: function(){
return this;
}
});

26
node_modules/art/modes/script/text.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
var Class = require('../../core/class');
var Base = require('./base');
module.exports = Class(Base, {
base_initialize: Base.prototype.initialize,
initialize: function(text){
this.base_initialize();
if (text != null) this.draw.apply(this, arguments);
},
draw: function(){
this.args = Array.prototype.slice.call(arguments);
return this;
},
base_toExpression: Base.prototype.toExpression,
toExpression: function(expr){
var artText = this.artVar.property('Text');
if (!expr) expr = artText.construct.apply(artText, this.args);
return this.base_toExpression(expr);
}
});