@kpi4me/golden-layout
Version:
A multi-screen javascript Layout manager https://golden-layout.com
476 lines (475 loc) • 9.69 kB
JavaScript
// Generated by CoffeeScript 2.0.0-beta8
var ArrayExpression, AssignmentExpression, BinaryExpression, BlockStatement, CallExpression, createNode, ctor, difference, exports, FunctionDeclaration, FunctionExpression, GenSym, handleLists, handlePrimitives, Identifier, isStatement, Literal, LogicalExpression, MemberExpression, NewExpression, node, nodeData, Nodes, ObjectExpression, params, Program, SequenceExpression, SwitchCase, SwitchStatement, TryStatement, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclaration;
difference = require('./functional-helpers').difference;
exports = null != ('undefined' !== typeof module && null != module ? module.exports : void 0) ? 'undefined' !== typeof module && null != module ? module.exports : void 0 : this;
createNode = function (type, props) {
return function (super$) {
extends$(class$, super$);
function class$() {
var i, prop;
for (var i$ = 0, length$ = props.length; i$ < length$; ++i$) {
prop = props[i$];
i = i$;
this[prop] = arguments[i];
}
}
class$.prototype.type = type;
class$.prototype.childNodes = props;
return class$;
}(Nodes);
};
this.Nodes = Nodes = function () {
function Nodes() {
}
Nodes.prototype.listMembers = [];
Nodes.prototype['instanceof'] = function (ctors) {
var ctor;
ctors = 1 <= arguments.length ? [].slice.call(arguments, 0) : [];
for (var i$ = 0, length$ = ctors.length; i$ < length$; ++i$) {
ctor = ctors[i$];
if (!(this.type === ctor.prototype.type))
continue;
return true;
}
return false;
};
Nodes.prototype.toBasicObject = function () {
var child, obj, p;
obj = { type: this.type };
if (null != this.leadingComments)
obj.leadingComments = this.leadingComments;
for (var i$ = 0, length$ = this.childNodes.length; i$ < length$; ++i$) {
child = this.childNodes[i$];
if (in$(child, this.listMembers)) {
obj[child] = function (accum$) {
for (var i$1 = 0, length$1 = this[child].length; i$1 < length$1; ++i$1) {
p = this[child][i$1];
accum$.push('undefined' !== typeof p && null != p ? p.toBasicObject() : void 0);
}
return accum$;
}.call(this, []);
} else {
obj[child] = null != this[child] ? this[child].toBasicObject() : void 0;
}
}
if (null != this.line && null != this.column)
obj.loc = {
start: {
line: this.line,
column: this.column
}
};
if (null != this.offset)
obj.range = [
this.offset,
null != this.raw ? this.offset + this.raw.length : void 0
];
if (null != this.raw)
obj.raw = this.raw;
return obj;
};
return Nodes;
}();
nodeData = [
[
'ArrayExpression',
false,
['elements']
],
[
'AssignmentExpression',
false,
[
'operator',
'left',
'right'
]
],
[
'BinaryExpression',
false,
[
'operator',
'left',
'right'
]
],
[
'BlockStatement',
true,
['body']
],
[
'BreakStatement',
true,
['label']
],
[
'CallExpression',
false,
[
'callee',
'arguments'
]
],
[
'CatchClause',
true,
[
'param',
'body'
]
],
[
'ConditionalExpression',
false,
[
'test',
'consequent',
'alternate'
]
],
[
'ContinueStatement',
true,
['label']
],
[
'DebuggerStatement',
true,
[]
],
[
'DoWhileStatement',
true,
[
'body',
'test'
]
],
[
'EmptyStatement',
true,
[]
],
[
'ExpressionStatement',
true,
['expression']
],
[
'ForInStatement',
true,
[
'left',
'right',
'body'
]
],
[
'ForStatement',
true,
[
'init',
'test',
'update',
'body'
]
],
[
'FunctionDeclaration',
true,
[
'id',
'params',
'body'
]
],
[
'FunctionExpression',
false,
[
'id',
'params',
'body'
]
],
[
'GenSym',
false,
[
'ns',
'uniqueId'
]
],
[
'Identifier',
false,
['name']
],
[
'IfStatement',
true,
[
'test',
'consequent',
'alternate'
]
],
[
'LabeledStatement',
true,
[
'label',
'body'
]
],
[
'Literal',
false,
['value']
],
[
'LogicalExpression',
false,
[
'operator',
'left',
'right'
]
],
[
'MemberExpression',
false,
[
'computed',
'object',
'property'
]
],
[
'NewExpression',
false,
[
'callee',
'arguments'
]
],
[
'ObjectExpression',
false,
['properties']
],
[
'Program',
true,
['body']
],
[
'Property',
true,
[
'key',
'value'
]
],
[
'ReturnStatement',
true,
['argument']
],
[
'SequenceExpression',
false,
['expressions']
],
[
'SwitchCase',
true,
[
'test',
'consequent'
]
],
[
'SwitchStatement',
true,
[
'discriminant',
'cases'
]
],
[
'ThisExpression',
false,
[]
],
[
'ThrowStatement',
true,
['argument']
],
[
'TryStatement',
true,
[
'block',
'handlers',
'finalizer'
]
],
[
'UnaryExpression',
false,
[
'operator',
'argument'
]
],
[
'UpdateExpression',
false,
[
'operator',
'prefix',
'argument'
]
],
[
'VariableDeclaration',
true,
[
'kind',
'declarations'
]
],
[
'VariableDeclarator',
true,
[
'id',
'init'
]
],
[
'WhileStatement',
true,
[
'test',
'body'
]
],
[
'WithStatement',
true,
[
'object',
'body'
]
]
];
for (var i$ = 0, length$ = nodeData.length; i$ < length$; ++i$) {
{
cache$ = nodeData[i$];
node = cache$[0];
isStatement = cache$[1];
params = cache$[2];
}
exports[node] = ctor = createNode(node, params);
ctor.prototype.isStatement = isStatement;
ctor.prototype.isExpression = !isStatement;
}
cache$1 = exports;
Program = cache$1.Program;
BlockStatement = cache$1.BlockStatement;
Literal = cache$1.Literal;
Identifier = cache$1.Identifier;
FunctionExpression = cache$1.FunctionExpression;
CallExpression = cache$1.CallExpression;
SequenceExpression = cache$1.SequenceExpression;
ArrayExpression = cache$1.ArrayExpression;
BinaryExpression = cache$1.BinaryExpression;
UnaryExpression = cache$1.UnaryExpression;
NewExpression = cache$1.NewExpression;
VariableDeclaration = cache$1.VariableDeclaration;
ObjectExpression = cache$1.ObjectExpression;
MemberExpression = cache$1.MemberExpression;
UpdateExpression = cache$1.UpdateExpression;
AssignmentExpression = cache$1.AssignmentExpression;
LogicalExpression = cache$1.LogicalExpression;
GenSym = cache$1.GenSym;
FunctionDeclaration = cache$1.FunctionDeclaration;
VariableDeclaration = cache$1.VariableDeclaration;
SwitchStatement = cache$1.SwitchStatement;
SwitchCase = cache$1.SwitchCase;
TryStatement = cache$1.TryStatement;
handlePrimitives = function (ctor, primitives) {
ctor.prototype.childNodes = difference(ctor.prototype.childNodes, primitives);
return ctor.prototype.toBasicObject = function () {
var obj, primitive;
obj = Nodes.prototype.toBasicObject.call(this);
for (var i$1 = 0, length$1 = primitives.length; i$1 < length$1; ++i$1) {
primitive = primitives[i$1];
obj[primitive] = this[primitive];
}
return obj;
};
};
handlePrimitives(AssignmentExpression, ['operator']);
handlePrimitives(BinaryExpression, ['operator']);
handlePrimitives(LogicalExpression, ['operator']);
handlePrimitives(GenSym, [
'ns',
'uniqueId'
]);
handlePrimitives(Identifier, ['name']);
handlePrimitives(Literal, ['value']);
handlePrimitives(MemberExpression, ['computed']);
handlePrimitives(UnaryExpression, ['operator']);
handlePrimitives(UpdateExpression, [
'operator',
'prefix'
]);
handlePrimitives(VariableDeclaration, ['kind']);
handleLists = function (ctor, listProps) {
return ctor.prototype.listMembers = listProps;
};
handleLists(ArrayExpression, ['elements']);
handleLists(BlockStatement, ['body']);
handleLists(CallExpression, ['arguments']);
handleLists(FunctionDeclaration, ['params']);
handleLists(FunctionExpression, ['params']);
handleLists(NewExpression, ['arguments']);
handleLists(ObjectExpression, ['properties']);
handleLists(Program, ['body']);
handleLists(SequenceExpression, ['expressions']);
handleLists(SwitchCase, ['consequent']);
handleLists(SwitchStatement, ['cases']);
handleLists(TryStatement, ['handlers']);
handleLists(VariableDeclaration, ['declarations']);
FunctionDeclaration.prototype.generated = FunctionExpression.prototype.generated = false;
FunctionDeclaration.prototype.g = FunctionExpression.prototype.g = function () {
this.generated = true;
return this;
};
function isOwn$(o, p) {
return {}.hasOwnProperty.call(o, p);
}
function extends$(child, parent) {
for (var key in parent)
if (isOwn$(parent, key))
child[key] = parent[key];
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
}
function in$(member, list) {
for (var i = 0, length = list.length; i < length; ++i)
if (i in list && list[i] === member)
return true;
return false;
}