2795,6,165,42,381,58,160,56,538,52,145,46,227,44,917,71,219,54,405,50,131,67,169,55,248,53,1070,50,1100,65,969,48,136,50,206,56,166,56,131,42,183,38,662,35,198,28,1665,31,431,33,467,46,95,56,216,57,207,55,295,54,214,48,95,58,209,59,207,57,293,56,230,19,1026,43,255,44,150,39,1139,55,300,56,300,62,212,40,277,30,427,42,461,32,434,39,1377,30,2212,46,367,40,135,49,393,46,442,47,649,60,205,44,520,56,588,60,223,60,195,54,233,49,569,51,340,40,982,62,314,60,675,39,1549,55,289,71,702,47,349,60,972,42,760,54,284,39,887,44,1001,38,75,52,134,59,171,54,397,47,1092,55,75,53,424,99,240,132,255,134,329,150,184,118,572,70,883,79,87,76,299,83,202,101,117,78,96,82,366,82,264,85,131,79,292,71,272,61,256,70,207,72,562,68,449,57,214,53,81,86,277,86,987,85,530,84,519,69,1172,92,685,82,943,84,658,64,183,82,630,81,379,97,394,102,337,72,1190,31,728,39,582,47,433,45,60,46,251,47,355,67,734,50,348,41,155,54,344,44,419,60,2818,55,504,62,611,72,3424,63,877,58,939,53,828,58,756,55,996,54,406,42,1278,72,560,83,226,52,2734,67,770,66,154,54,1460,50,195,52,841,67,416,53,1351,55,1459,71,1648,69,1825,55,634,46,348,34,3502,63,1816,52,107,47,179,44,276,58,132,36,738,61,556,71,299,55,706,77,221,73,718,44,433,40,164,40,152,62,278,62,280,44,412,55,167,74,453,69,562,94,244,128,226,110,524,62,1392,83,480,77,532,73,304,63,217,56,703,77,310,61,740,42,3524,72,759,90,227,87,854,86,1054,107,345,57,392,59,930,44,973,73,484,64,725,65,513,62,168,72,305,70,197,50,176,50,1294,54,456,50,273,50,1290,78,155,54,653,49,239,50,446,50,382,80,202,63,218,56,525,47,101,54,132,51,111,52,219,49,411,39,782,22,1280,49,246,36,488,49,297,51,760,30,577,30,1135,35,1254,48,670,48,199,58,546,42,247,52,279,50,1233,67,153,64,160,53,1248,40,372,37,253,47,138,50,463,45,223,49,174,35,1020,55,235,50,141,41,810,30,1757,39,582,58,324,33,456,41,3507,63,268,35,522,39,95,31,290,35,472,31,859,45,298,37,318,33,70,45,231,57,666,47,553,51,765,51,222,29,381,42,447,59,303,53,294,56,162,51,96,54,112,50,491,39,557,35,390,40,2158,43,646,44,823,49,561,50,1793,46,194,53,441,41,624,47,401,31,4625,50,534,42,674,56,416,33,115,35,371,37,371,31,424,41,228,49,457,39,74,49,1617,56,286,55,1270,47,2509,43,4379,45,2211,46,2007,57,1744,45,2353,43,2069,51,1195,39,251,39,544,35,253,31,175,31,473,26,3477,47,69,41,123,82,227,65,1122,53,760,65,382,76,586,64,581,46,437,35,188,52,288,49,1016,49,358,46,220,43,214,55,549,59,474,45,449,65,384,45,510,51,125,49,195,44,408,47,285,45,414,49,288,46,519,51,371,41,229,35,65,39,120,37,533,35,148,45,195,45,276,47,671,51,796,80,900,58,635,71,595,43,1256,49,739,31,146,43,719,41,1015,51,479,52,4194,66,142,57,1207,57,1089,29,1084,41,668,31,205,59,385,43,881,35,776,35,325,33,252,31,110,8,350,20,184,35,242,41,108,29,1919,38,2995,34,2824,46,315,61,408,47,328,51,475,33,556,25,709,33,707,42,332,24,246,28,93,45,729,41,578,32,595
_info
{"project":"extended-dom-element","branch":"master","version":368,"versionDate":"2024-06-03T14:14:34.000Z","fromVersion":0,"reset":true,"checksumDocs":"390-262532"}
components/JSONFormatter/JSONFormatter.ls
(function(){
return function(json){
var root;
root = Div().html(include("element/element")(json));
root.openAtDepth = function(){
debug("JSONFormatter.openAtDepth isnt supported anymore. please consider changing it");
return root;
};
root.render = function(){
debug("JSONFormatter.render isnt supported anymore. please consider changing it");
return root;
};
return root;
};
})();
components/JSONFormatter/element/_shared/prefix/prefix.ls
(function(){
return function(prefix){
if (prefix) {
return Div().css({
flex: "0 0 auto",
color: Color.cyan[400],
margin: "0 0.25em"
}).html(prefix);
}
};
})();
components/JSONFormatter/element/_shared/singleValue.ls
(function(){
return function(value, prefix, color, preventWrap){
var pw, div;
pw = preventWrap;
div = Div();
return div.css({
display: "flex",
justifyContent: "flex-start",
alignItems: "flex-start",
flexWrap: !pw ? "wrap" : void 8,
width: "100%"
}).append(include("prefix/prefix")(prefix), div.value = Div().css({
color: color,
flex: "0 0 auto",
maxWidth: "100%",
wordWrap: !pw ? "break-word" : void 8,
whiteSpace: pw ? "nowrap" : void 8,
overflow: pw ? "hidden" : void 8,
textOverflow: pw ? "ellipsis" : void 8
}).text(value));
};
})();
components/JSONFormatter/element/boolean/boolean.ls
(function(){
return function(json, prefix){
return include("../_shared/singleValue")(json ? "true" : "false", prefix, Color.pink[700]);
};
})();
components/JSONFormatter/element/date/date.ls
(function(){
return function(json, prefix){
var e;
return include("../_shared/singleValue")((function(){
try {
return json.toISOString();
} catch (e$) {
e = e$;
return json.toString();
}
}()), prefix, Color.red[600]);
};
})();
components/JSONFormatter/element/element.ls
(function(){
var maxDepth;
maxDepth = 10;
return function(json, prefix, depth){
if (depth > maxDepth) {
return include("unhandled/unhandled")("...max depth exceeded...", prefix);
} else if (_.isFunction(json)) {
return include("function/function")(json, prefix);
} else if (_.isDate(json)) {
return include("date/date")(json, prefix);
} else if (json instanceof RegExp) {
return include("regex/regex")(json, prefix);
} else if (_.isObject(json)) {
return include("object/object")(json, prefix, depth);
} else if (_.isString(json)) {
return include("string/string")(json, prefix);
} else if (_.isNumber(json)) {
return include("number/number")(json, prefix);
} else if (_.isBoolean(json)) {
return include("boolean/boolean")(json, prefix);
} else if (_.isUndefined(json) || _.isNull(json)) {
return include("undefined/undefined")(json, prefix);
} else {
return include("unhandled/unhandled")(json, prefix);
}
};
})();
components/JSONFormatter/element/function/formatSolocodeFunc/format.ls
(function(){
return function(f){
if (f.indexOf("$$") >= 0) {
return f.replace(/(\$[SP])/g, "/").replace(/(\$M)/g, "-").replace(/(\$D)/g, ".").replace(/(\$B)/g, " ").replace(/(\$\$)/g, "");
} else {
return f;
}
};
})();
components/JSONFormatter/element/function/function.ls
(function(){
return function(json, prefix){
var functionName;
functionName = include("formatSolocodeFunc/format")(json.toString().replace("function ", '').replace(/[\r\n]/g, '').replace(/\{.*\}/, '') + '{…}');
return Div().css({
color: Color.purple[500]
}).append(include("../_shared/singleValue")("function", prefix), Div().css({
maxWidth: "100%",
wordWrap: "break-word"
}).html(functionName));
};
})();
components/JSONFormatter/element/number/number.ls
(function(){
return function(json, prefix){
return include("../_shared/singleValue")(json + "", prefix, Color.blue[500]);
};
})();
components/JSONFormatter/element/object/arrayLength/arrayLength.ls
(function(){
return function(json){
if (_.isArray(json)) {
return Div().css({
flex: "0 0 auto",
color: Color.lightBlue[600]
}).html("[" + json.length + "]");
}
};
})();
components/JSONFormatter/element/object/arrow/arrow.ls
(function(){
return function(){
return SvgIcon({
svg: "/../extended-dom-element/components/JSONFormatter/svg/triangle.svg",
color: Color.grey[500]
}).css({
flex: "0 0 auto",
fontSize: "0.8em",
userSelect: "none",
marginRight: "0.25em"
});
};
})();
components/JSONFormatter/element/object/name/name.ls
(function(){
return function(json, prefix){
var propType, ref$, ref1$, getFunctionParams, jsonReplacer, showPreview, div;
propType = json.constructor != null ? (ref$ = (ref1$ = /function ([^(]*)/.exec(json.constructor.toString())) != null ? ref1$[1] : void 8) != null ? ref$ : "Object" : "Object";
getFunctionParams = function(fn){
return fn.toString().replace(/((\/\/.*$)|(\/\*[\s\S]*?\*\/)|(\s))/mg, '').match(/^function\s*[^\(]*\(\s*([^\)]*)\)/m)[1];
};
jsonReplacer = function(key, value){
if (_.isFunction(value)) {
return "function (" + getFunctionParams(value) + ")";
} else {
return value;
}
};
if (prefix && propType === "Object") {
try {
propType = JSON.stringify(json, jsonReplacer);
if (propType.length > 100) {
propType = propType.substr(0, 200) + "…";
}
showPreview = true;
} catch (e$) {}
}
div = include("../../_shared/singleValue")(propType, prefix, Color.grey[700], showPreview);
div.setCollapsed = function(collapsed){
if (!showPreview) {
return;
}
if (collapsed) {
return div.value.hide();
} else {
return div.value.show();
}
};
return div;
};
})();
components/JSONFormatter/element/object/object.ls
(function(){
return function(json, prefix, depth){
var collapsed, propertyContainer, updateState, toggle, div, header, arrow;
depth = depth != null ? depth : 0;
collapsed = prefix != null;
propertyContainer = null;
updateState = function(){
if (collapsed) {
arrow.css({
transform: "rotateZ(90deg)",
transition: "150ms"
});
if (propertyContainer != null) {
propertyContainer.hide();
}
return header.setCollapsed(false);
} else {
if (propertyContainer == null) {
propertyContainer = include("properties/properties")(json, prefix, depth);
div.append(propertyContainer);
}
arrow.css({
transform: "rotateZ(180deg)",
transition: "150ms"
});
propertyContainer.show();
return header.setCollapsed(true);
}
};
toggle = function(){
collapsed = !collapsed;
return updateState();
};
div = Div().append(header = include("name/name")(json, prefix).prepend(arrow = include("arrow/arrow")()).append(include("arrayLength/arrayLength")(json)).tap(toggle), !collapsed ? (header.setCollapsed(true), propertyContainer = include("properties/properties")(json, prefix, depth)) : void 8);
updateState();
return div;
};
})();
components/JSONFormatter/element/object/properties/properties.ls
(function(){
return function(json, prefix, depth){
var hasProperties, notOwnPropertiesToShow, div, name, property, propName;
hasProperties = false;
notOwnPropertiesToShow = ["outerHTML"];
div = Div().css({
overflow: "hidden",
marginLeft: "1em"
}).append((function(){
var ref$, own$ = {}.hasOwnProperty, results$ = [];
for (name in ref$ = json) if (own$.call(ref$, name)) {
property = ref$[name];
hasProperties = true;
results$.push(include("../../element")(property, name + ": ", depth + 1));
}
return results$;
}()), (function(){
var i$, ref$, len$, results$ = [];
for (i$ = 0, len$ = (ref$ = notOwnPropertiesToShow).length; i$ < len$; ++i$) {
propName = ref$[i$];
if (json[propName] != null && !json.hasOwnProperty(propName)) {
hasProperties = true;
results$.push(include("../../element")(json[propName], propName + ": ", depth + 1));
}
}
return results$;
}()));
if (!hasProperties) {
div.css({
color: Color.grey[400]
}).html("No properties");
}
return div;
};
})();
components/JSONFormatter/element/regex/regex.ls
(function(){
return function(json, prefix){
return include("../_shared/singleValue")(json.toString(), prefix, Color.red[600]);
};
})();
components/JSONFormatter/element/string/string.ls
(function(){
return function(json, prefix){
var div;
div = include("../_shared/singleValue")('"' + json + '"', prefix, Color.brown[500]);
div.lastChild.css({
whiteSpace: "pre-wrap"
});
return div;
};
})();
components/JSONFormatter/element/undefined/undefined.ls
(function(){
return function(json, prefix){
return include("../_shared/singleValue")(_.isUndefined(json) ? "undefined" : "null", prefix, Color.yellow[900]);
};
})();
components/JSONFormatter/element/unhandled/unhandled.ls
(function(){
return function(json, prefix){
return include("../_shared/singleValue")(json + "", prefix, Color.pink[300]);
};
})();
components/JSONFormatter/svg/triangle.svg
components/button/animation/darken.ls
(function(){
return function(div){
var overlay;
overlay = null;
return {
down: function(){
var bgColor, opacity;
if (!overlay) {
overlay = Div({
position: "absolute",
left: 0,
right: 0,
top: 0,
bottom: 0,
backgroundColor: "black",
borderRadius: div.style.borderRadius,
pointerEvents: "none"
});
}
bgColor = getComputedStyle(div).backgroundColor;
opacity = bgColor === "rgba(0, 0, 0, 0)" || bgColor === "rgb(255, 255, 255)" ? 0.03 : 0.055;
overlay.css({
opacity: opacity
});
return div.append(overlay);
},
up: function(){
return overlay != null ? overlay.remove() : void 8;
},
cancel: function(){
return overlay != null ? overlay.remove() : void 8;
}
};
};
})();
components/button/border/border.ls
(function(){
return function(o){
if (o.type !== "secondary") {
return;
}
return Div({
position: "absolute",
top: 0,
right: 0,
left: 0,
bottom: 0,
border: "1px solid " + Color.grey[300]
});
};
})();
components/button/button.ls
(function(){
return function(o){
var ref$, isEnabled, div;
o = _.isString(o)
? {
label: o
}
: o
? o
: {};
o.labelAllowWrap = (ref$ = o.labelAllowWrap) != null ? ref$ : false;
o.iconColor = (ref$ = o.iconColor) != null
? ref$
: Color.black;
o.iconPosition = (ref$ = o.iconPosition) != null ? ref$ : "left";
o.type = (ref$ = o.type) != null ? ref$ : "primary";
isEnabled = true;
div = Div({
display: "inline-flex",
minWidth: 0,
verticalAlign: 0
}).addClass("button").html(inc("icon/icon")(o), inc("label/label")(o), inc("border/border")(o)).tap({
up: function(){
return typeof o.action == 'function' ? o.action(div) : void 8;
},
animation: "hover",
tapZone: o.tapZone
});
if (o.key != null) {
if (!o.action) {
debug("key only works with action property (not with tap)");
}
div.addClass("keyManager-" + o.key).bind("keyManager", function(){
return o.action(div);
});
}
div.icon = o.iconSvg;
div.iconColor = o.iconColor;
div.label = o.label;
div.setIconColor = function(c){
o.iconColor = c;
o.iconDiv.update(o);
div.setState(div.state);
return div;
};
div.setState = function(state){
div.state = state;
inc("types/" + o.type + "/applyState")(div);
if (!isEnabled && state !== "disabled") {
div.setState("disabled");
}
return div;
};
div.setLabel = function(l){
o.label = l;
o.labelDiv.update(o);
div.setState(div.state);
return div;
};
div.setIcon = function(i){
o.icon = i;
o.iconDiv.update(o);
div.setState(div.state);
return div;
};
div.setEnabled = function(enabled){
isEnabled = enabled;
if (enabled) {
div.setState("normal");
} else {
div.setState("disabled");
}
return div;
};
div.setState("normal");
if (o.state) {
div.setState(o.state);
}
return div;
};
})();
components/button/icon/icon.ls
(function(){
return function(o){
var update, div;
if (!o.icon) {
return;
}
update = function(){
return o.iconDiv.replaceWith(o.iconDiv = include(THISFILE)(o));
};
div = Div({
flex: "0 0 auto",
order: o.iconPosition === "right" ? 1 : void 8
}).html(o.iconSvg = Svg({
svg: o.icon,
color: o.iconColor
}).css({
verticalAlign: "-0.16em",
backgroundColor: o.iconBackgroundColor
}));
div.update = update;
return o.iconDiv = div;
};
})();
components/button/label/label.ls
(function(){
return function(o){
var update, div;
update = function(o){
div.secureHtml(o.label || " ");
return div.css({
padding: !o.icon || !o.label
? "0"
: o.iconPosition === "left" ? "0 0 0 0.3em" : "0 0.3em 0 0",
width: !o.label ? 0 : void 8
});
};
div = Div({
flex: "1 1 auto",
overflow: "hidden",
textOverflow: "ellipsis",
minWidth: 0,
whiteSpace: !o.labelAllowWrap ? "nowrap" : void 8
});
update(o);
div.update = update;
return o.labelDiv = div;
};
})();
components/button/types/primary/applyState.ls
(function(){
return function(div){
return inc("states/" + div.state + "/apply")(div);
};
})();
components/button/types/primary/states/correct/apply.ls
(function(){
return function(div){
var ref$;
if ((ref$ = div.icon) != null) {
ref$.setColor(div.iconColor);
}
return div.css({
pointerEvents: "none",
cursor: "default",
backgroundColor: Color.green[500]
});
};
})();
components/button/types/primary/states/disabled/apply.ls
(function(){
return function(div){
var ref$;
if ((ref$ = div.icon) != null) {
ref$.setColor(Color.grey[500]);
}
return div.css({
pointerEvents: "none",
cursor: "default",
color: Color.grey[500]
});
};
})();
components/button/types/primary/states/normal/apply.ls
(function(){
return function(div){
var ref$;
if ((ref$ = div.icon) != null) {
ref$.setColor(div.iconColor);
}
return div.css({
padding: "0.5em 0.7em 0.55em 0.7em",
backgroundColor: Color.grey[300],
pointerEvents: "inherit",
cursor: "pointer",
color: Color.black,
minHeight: "2.4em"
});
};
})();
components/button/types/primary/states/wrong/apply.ls
(function(){
return function(div){
var ref$;
if ((ref$ = div.icon) != null) {
ref$.setColor(div.iconColor);
}
return div.css({
pointerEvents: "none",
cursor: "default",
backgroundColor: Color.red[500]
});
};
})();
components/button/types/secondary/applyState.ls
(function(){
return function(div){
return inc("states/" + div.state + "/apply")(div);
};
})();
components/button/types/secondary/states/correct/apply.ls
(function(){
return function(div){
var ref$;
if ((ref$ = div.icon) != null) {
ref$.setColor(Color.green[500]);
}
return div.css({
pointerEvents: "none",
cursor: "default",
color: Color.green[500]
});
};
})();
components/button/types/secondary/states/disabled/apply.ls
(function(){
return function(div){
var ref$;
if ((ref$ = div.icon) != null) {
ref$.setColor(Color.grey[300]);
}
return div.css({
pointerEvents: "none",
color: Color.grey[300],
cursor: "default"
});
};
})();
components/button/types/secondary/states/normal/apply.ls
(function(){
return function(div){
var ref$;
if ((ref$ = div.icon) != null) {
ref$.setColor(div.iconColor);
}
return div.css({
padding: "0.5em 0.7em 0.55em 0.7em",
backgroundColor: "transparent",
pointerEvents: "inherit",
cursor: "pointer",
color: Color.black,
minHeight: "2.4em"
});
};
})();
components/button/types/secondary/states/wrong/apply.ls
(function(){
return function(div){
var ref$;
if ((ref$ = div.icon) != null) {
ref$.setColor(Color.red[500]);
}
return div.css({
boxSizing: "border-box",
pointerEvents: "none",
cursor: "default",
color: Color.red[500]
});
};
})();
components/init.ls
(function(){
return function(){
var tags, i$, len$, w, n, f, results$ = [];
tags = ["span", "table", "tbody", "tr", "td", "ul", "ol", "li", "a", "img", "p", "h1", "div", "br", "section", "form", "input", "textarea", "pre", "iframe", "video", "canvas", "style"];
for (i$ = 0, len$ = tags.length; i$ < len$; ++i$) {
(fn$.call(this, tags[i$]));
}
w = {
body: document.body,
JSONFormatter: inc("JSONFormatter/JSONFormatter"),
Svg: inc("svg/svg"),
SvgIcon: inc("svgIcon/svgIcon"),
Button: inc("button/button"),
ScrollDiv: inc("scrollDiv/scrollDiv"),
ScrollDivNext: inc("scrollDivNext/scrollDivNext"),
ZoomDiv: inc("zoomDiv/zoomDiv"),
ListDiv: inc("listDiv/listDiv"),
OverlayMenu: inc("overlayMenu/menu")
};
for (n in w) {
f = w[n];
results$.push(window[n] = f);
}
return results$;
function fn$(tag){
var tagUpper;
tagUpper = tag[0].toUpperCase() + tag.substr(1);
window[tagUpper] = function(css){
var el;
if (css) {
el = document.createElement(tag);
return el.css(css);
} else {
return document.createElement(tag);
}
};
}
};
})();
components/listDiv/calcTopScopeRow/calc.ls
(function(){
return function(o){
var lp, row;
lp = o.getListPosition();
row = o.rowsByIndex[lp.rowIndex];
return {
index: lp.rowIndex,
row: row,
data: o.data[lp.rowIndex],
offsetTop: lp.topOffset,
offsetBottom: lp.topOffset + row.offsetHeight
};
};
})();
components/listDiv/contentDiv/contentDiv.ls
(function(){
return function(o){
var contentDiv;
contentDiv = Div().css({
height: "1000000px"
});
o.div.html(contentDiv);
return contentDiv;
};
})();
components/listDiv/createRow/create.ls
(function(){
return function(o, index, position){
var rowData, rowDiv, error;
rowData = o.data[index];
if (!rowData) {
return;
}
rowDiv = o.rowsByIndex[index];
if (!rowDiv) {
try {
rowDiv = o.row(rowData, index);
} catch (e$) {
error = e$;
rowDiv = Div({
color: Color.red[400],
background: Color.red[50],
padding: "0.1em"
}).html("Row error (index: " + index + ")");
error.message = "createRow error, " + error.message;
setTimeout(function(){
throw error;
});
}
rowDiv.addClass("listRow").css({
width: "100%",
position: "absolute",
contain: "layout"
});
}
o.contentDiv.append(rowDiv);
if (!rowDiv.positionHeight) {
inc("updateAverageRowHeight/update")(o, rowDiv);
}
rowDiv.rowIndex = index;
rowDiv.positionTop = 0;
rowDiv.positionHeight = rowDiv.offsetHeight;
o.rowsByIndex[index] = rowDiv;
if (o.minRowIndex == null || index < o.minRowIndex) {
o.minRowIndex = index;
}
if (o.maxRowIndex == null || index > o.maxRowIndex) {
o.maxRowIndex = index;
}
if (position === "before") {
inc("positionBefore/position")(o, index, index + 1);
}
if (position === "after") {
inc("positionAfter/position")(o, index, index - 1);
}
return rowDiv;
};
})();
components/listDiv/createRow/positionAfter/position.ls
(function(){
return function(o, index1, index2){
var div1, div2, newPositionTop;
div1 = o.rowsByIndex[index1];
div2 = o.rowsByIndex[index2];
newPositionTop = _.round(div2.positionTop + div2.positionHeight);
div1.css({
top: newPositionTop + "px"
});
return div1.positionTop = newPositionTop;
};
})();
components/listDiv/createRow/positionBefore/position.ls
(function(){
return function(o, index1, index2){
var div1, div2, newPositionTop;
div1 = o.rowsByIndex[index1];
div2 = o.rowsByIndex[index2];
newPositionTop = _.round(div2.positionTop - div1.positionHeight);
div1.css({
top: newPositionTop + "px"
});
return div1.positionTop = newPositionTop;
};
})();
components/listDiv/createRow/updateAverageRowHeight/update.ls
(function(){
return function(o, rowDiv){
var t, h;
t = o.averageRowHeightTotal;
h = o.averageRowHeight;
o.averageRowHeight = (h * t + rowDiv.offsetHeight) / (t + 1);
return o.averageRowHeightTotal += 1;
};
})();
components/listDiv/debugDiv/debugDiv.ls
(function(){
return function(o){
var div;
div = Div({
background: Color.orange[100],
position: "absolute",
maxWidth: "100%",
pointerEvents: "none",
padding: "0.1em",
fontSize: "0.7em",
opacity: 0.9
});
if (o.debug) {
o.div.scrollContainerDiv.after(div);
}
return div;
};
})();
components/listDiv/div/div.ls
(function(){
return function(o, p){
return ScrollDiv({
enlargeScrollbarOnHover: p.enlargeScrollbarOnHover,
fadeInScrollbarOnHover: p.fadeInScrollbarOnHover,
scopeRender: p.scopeRender,
scrollbarMode: p.scrollbarMode,
onResize: function(){
return typeof o.onResize == 'function' ? o.onResize() : void 8;
},
onScroll: function(){
return typeof o.onScroll == 'function' ? o.onScroll() : void 8;
}
}).addClass("listDiv");
};
})();
components/listDiv/getListPosition/get.ls
(function(){
return function(o){
var i$, to$, i, row, topOffset;
if (!o.hasStarted) {
return o.listPosition;
}
for (i$ = o.topRowIndex, to$ = o.bottomRowIndex; i$ <= to$; ++i$) {
i = i$;
row = o.rowsByIndex[i];
if (!row) {
break;
}
topOffset = row.positionTop - o.div.scrollTop - o.topFix;
if (topOffset >= 0) {
break;
}
}
if (row) {
return {
rowIndex: row.rowIndex,
topOffset: _.round(topOffset, 1)
};
} else {
return {
rowIndex: 0,
topOffset: 0
};
}
};
})();
components/listDiv/info/info.ls
(function(){
var a;
a = [];
return function(o, l){
if (!o.debug) {
return;
}
if (!o.infoDiv) {
o.infoDiv = Div().css({
background: Color.pink[50],
position: "absolute",
top: "1.5em",
maxWidth: "100%",
pointerEvents: "none",
padding: "0.1em",
fontSize: "0.7em",
opacity: 0.9,
textAlign: "left"
});
o.div.scrollContainerDiv.after(o.infoDiv);
}
a.push(l);
if (a.length > 3) {
a.shift();
}
return o.infoDiv.html(a.join("
"));
};
})();
components/listDiv/insertRow/insert.ls
(function(){
return function(o, p){
var position, rowsByIndexNew, index, ref$, row, top, r;
position = p.position;
if (o.data.length === 0) {
o.data.push(p.data);
o.setListPosition(null, true);
return;
}
o.data.splice(p.position, 0, p.data);
rowsByIndexNew = {};
for (index in ref$ = o.rowsByIndex) {
row = ref$[index];
if (index < position) {
rowsByIndexNew[index] = row;
} else {
row.rowIndex++;
rowsByIndexNew[row.rowIndex] = row;
}
}
o.rowsByIndex = rowsByIndexNew;
o.reachedBottom = false;
o.contentDiv.css({
height: "1000000px"
});
if (position >= o.topRowIndex && position <= o.bottomRowIndex) {
o.info("insertRow " + position + " VISIBLE");
if (position === 0) {
top = o.rowsByIndex[1].positionTop;
r = o.createRow(position, "before");
r.positionTop = top;
r.css({
top: top + "px"
});
} else {
r = o.createRow(position, "after");
}
o.bottomRowIndex += 1;
return o.repositionCurrentRows();
} else if (position > o.bottomRowIndex) {
o.info("insertRow " + position + " BELOW");
return o.maxRowIndex = o.bottomRowIndex;
} else if (position < o.topRowIndex && !o.reachedTop) {
o.info("insertRow " + position + " ABOVE, reachedTop = false");
o.topRowIndex += 1;
return o.onScroll();
} else if (position < o.topRowIndex && o.reachedTop) {
o.info("insertRow " + position + " ABOVE, reachedTop = true");
o.topRowIndex += 1;
o.setListPosition();
return o.onScroll();
}
};
})();
components/listDiv/listDiv.ls
(function(){
return function(p){
var o, ref$;
o = {};
o.data = (ref$ = p.data) != null
? ref$
: [];
o.row = p.row;
o.listPosition = p.listPosition || {
rowIndex: 0,
topOffset: 0
};
o.debug = (ref$ = p.debug) != null ? ref$ : false;
o.nearScopeSize = 0;
p.nearScopeSize == null && (p.nearScopeSize = 0);
p.nearScopeDelay == null && (p.nearScopeDelay = 1000);
o.rowsByIndex = {};
o.topFix = 0;
o.reachedTop = false;
o.reachedBottom = false;
o.topRowIndex = null;
o.bottomRowIndex = null;
o.minRowIndex = null;
o.maxRowIndex = null;
o.averageRowHeight = 0;
o.averageRowHeightTotal = 0;
o.div = inc("div/div")(o, p);
o.contentDiv = inc("contentDiv/contentDiv")(o);
o.debugDiv = inc("debugDiv/debugDiv")(o);
o.createRow = function(index, position){
return inc("createRow/create")(o, index, position);
};
o.onDomAppend = function(){
return inc("onDomAppend/onDomAppend")(o);
};
o.onScroll = function(){
return inc("onScroll/onScroll")(o, p);
};
o.onResize = function(){
return inc("onResize/onResize")(o, p);
};
o.getListPosition = function(){
return inc("getListPosition/get")(o);
};
o.setListPosition = function(p, resetRows){
return inc("setListPosition/set")(p, resetRows, o);
};
o.repositionCurrentRows = function(){
return inc("repositionCurrentRows/reposition")(o);
};
o.updateRow = function(p){
return inc("updateRow/update")(o, p);
};
o.insertRow = function(p){
return inc("insertRow/insert")(o, p);
};
o.removeRow = function(rowIndex){
return inc("removeRow/remove")(o, rowIndex);
};
o.scrollRowIntoView = function(rowIndex, options){
return inc("scrollRowIntoView/scroll")(o, rowIndex, options);
};
o.info = function(l){
return inc("info/info")(o, l);
};
o.calcTopScopeRow = function(){
return inc("calcTopScopeRow/calc")(o);
};
o.onDomAppend();
o.div.setListPosition = o.setListPosition;
o.div.getListPosition = o.getListPosition;
o.div.repositionCurrentRows = o.repositionCurrentRows;
o.div.updateRow = o.updateRow;
o.div.insertRow = o.insertRow;
o.div.removeRow = o.removeRow;
o.div.scrollRowIntoView = o.scrollRowIntoView;
o.div.calcTopScopeRow = o.calcTopScopeRow;
o.div.o = o;
setTimeout(function(){
o.nearScopeSize = p.nearScopeSize;
return o.onScroll();
}, p.nearScopeDelay);
return o.div;
};
})();
components/listDiv/onDomAppend/onDomAppend.ls
(function(){
return function(o){
var f;
return o.div.contentDiv.onDomAppend(f = function(){
if (!o.div.isDomElement()) {
return;
}
if (!o.div.isVisible() || o.div.offsetHeight === 0) {
requestAnimationFrame(f);
return;
}
if (!o.hasStarted) {
o.hasStarted = true;
return o.setListPosition(o.listPosition);
} else {
return o.div.scrollTop = o.scrollTop;
}
});
};
})();
components/listDiv/onResize/onResize.ls
(function(){
return function(o, p){
return typeof o.repositionCurrentRows == 'function' ? o.repositionCurrentRows() : void 8;
};
})();
components/listDiv/onScroll/cleanBottom/clean.ls
(function(){
return function(o){
var bottomRow, topY, h, results$ = [];
for (;;) {
bottomRow = o.rowsByIndex[o.bottomRowIndex];
topY = bottomRow.positionTop - o.div.scrollTop - o.topFix;
h = o.div.offsetHeight * (1 + o.nearScopeSize);
if (topY < h) {
break;
} else if (o.topRowIndex === 0) {
break;
} else {
bottomRow.remove();
results$.push(o.bottomRowIndex--);
}
}
return results$;
};
})();
components/listDiv/onScroll/cleanTop/clean.ls
(function(){
return function(o){
var topRow, topY, bottomY, h, results$ = [];
for (;;) {
topRow = o.rowsByIndex[o.topRowIndex];
topY = topRow.positionTop - o.div.scrollTop - o.topFix;
bottomY = topY + topRow.positionHeight;
h = -o.div.offsetHeight * o.nearScopeSize;
if (bottomY >= h) {
break;
} else if (o.bottomRowIndex === o.data.length - 1) {
break;
} else {
topRow.remove();
results$.push(o.topRowIndex++);
}
}
return results$;
};
})();
components/listDiv/onScroll/fillBottom/fill.ls
(function(){
return function(o){
var bottomRow, isLastRow, topY, bottomY, h1, h2, results$ = [];
for (;;) {
bottomRow = o.rowsByIndex[o.bottomRowIndex];
isLastRow = o.bottomRowIndex === o.data.length - 1;
topY = bottomRow.positionTop - o.div.scrollTop - o.topFix;
bottomY = topY + bottomRow.positionHeight;
h1 = o.div.offsetHeight;
h2 = h1 * (1 + o.nearScopeSize);
if (!isLastRow) {
if (bottomY < h2) {
o.bottomRowIndex++;
results$.push(o.createRow(o.bottomRowIndex, "after"));
} else {
break;
}
} else {
if (bottomY <= h1 && !o.reachedBottom) {
results$.push(inc("reachBottom/reach")(bottomRow, o));
} else {
break;
}
}
}
return results$;
};
})();
components/listDiv/onScroll/fillBottom/reachBottom/reach.ls
(function(){
return function(bottomRow, o){
o.info("reachBottom");
o.reachedBottom = true;
return o.contentDiv.css({
height: bottomRow.positionTop + bottomRow.positionHeight - o.topFix + "px"
});
};
})();
components/listDiv/onScroll/fillTop/fill.ls
(function(){
return function(o){
var topRow, isFirstRow, topY, h, results$ = [];
for (;;) {
topRow = o.rowsByIndex[o.topRowIndex];
isFirstRow = o.topRowIndex === 0;
topY = topRow.positionTop - o.div.scrollTop - o.topFix;
h = -o.div.offsetHeight * o.nearScopeSize;
if (!isFirstRow) {
if (topY >= h) {
o.topRowIndex--;
results$.push(o.createRow(o.topRowIndex, "before"));
} else {
break;
}
} else {
if (topY >= 0 && !o.reachedTop) {
inc("reachTop/reach")(topRow, o);
break;
} else {
break;
}
}
}
return results$;
};
})();
components/listDiv/onScroll/fillTop/reachTop/ios/ios.ls
(function(){
return function(topRow, o){
var scrollTop;
scrollTop = o.div.scrollTop;
o.div.scrollContainerDiv.css({
overflowY: "hidden"
});
o.contentDiv.css({
top: "-" + topRow.positionTop + "px",
height: o.contentDiv.height() - o.topFix + "px"
});
if (o.contentDiv.countScroll > 3) {
o.contentDiv.css({
transform: "translateY(" + (topRow.positionTop - scrollTop) + "px)"
});
requestAnimationFrame(function(){
return o.contentDiv.css({
transform: "translateY(0px)",
transition: "300ms"
});
});
}
o.div.scrollTop = 0;
return o.div.scrollContainerDiv.css({
overflowY: "scroll"
});
};
})();
components/listDiv/onScroll/fillTop/reachTop/isiOs/isiOs.ls
(function(){
return function(){
if (/iPad|iPhone|iPod/.test(navigator.platform)) {
return true;
} else if (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1) {
return true;
} else {
return false;
}
};
})();
components/listDiv/onScroll/fillTop/reachTop/other/other.ls
(function(){
return function(topRow, o){
o.contentDiv.css({
top: "-" + topRow.positionTop + "px",
height: o.contentDiv.height() - o.topFix + "px"
});
return o.div.scrollTop -= o.topFix;
};
})();
components/listDiv/onScroll/fillTop/reachTop/reach.ls
(function(){
return function(topRow, o){
o.info("reachTop");
o.reachedTop = true;
o.topFix = topRow.positionTop;
if (inc("isiOs/isiOs")()) {
return inc("ios/ios")(topRow, o);
} else {
return inc("other/other")(topRow, o);
}
};
})();
components/listDiv/onScroll/manageJump/manage.ls
(function(){
return function(o){
var delta, listPosition, deltaFaktor, deltaRowIndex, newRowIndex;
if (!o.scrollTop) {
return;
}
if (engine.isiOsApp) {
return;
}
delta = o.div.scrollTop - o.scrollTop;
if (Math.abs(delta) < o.div.offsetHeight * 3) {
return;
}
o.info("jump delta px = " + delta);
listPosition = o.getListPosition();
deltaFaktor = delta / o.div.scrollHeightCustom;
deltaRowIndex = parseInt(o.data.length * deltaFaktor);
newRowIndex = listPosition.rowIndex + deltaRowIndex;
o.setListPosition({
rowIndex: newRowIndex,
topOffset: 0
});
return true;
};
})();
components/listDiv/onScroll/manageResize/manage.ls
(function(){
return function(o){
var newWidth;
if (!(o.div.isVisible() && o.div.offsetWidth > 0 && o.div.offsetHeight > 0)) {
return;
}
newWidth = o.div.offsetWidth;
o.lastWidth == null && (o.lastWidth = newWidth);
if (newWidth !== o.lastWidth) {
o.info("resize");
o.lastWidth = newWidth;
o.repositionCurrentRows();
return true;
}
};
})();
components/listDiv/onScroll/onScroll.ls
(function(){
return function(o, p){
var ref$;
if (!o.hasStarted || !o.div.isVisible() || _.isEmpty(o.rowsByIndex) || inc("manageResize/manage")(o) || inc("manageJump/manage")(o)) {
return;
}
if (!o.scrollTop || o.div.scrollTop === o.scrollTop) {
inc("fillTop/fill")(o);
inc("fillBottom/fill")(o);
} else if (o.div.scrollTop > o.scrollTop) {
inc("fillBottom/fill")(o);
inc("cleanTop/clean")(o);
} else if (o.div.scrollTop < o.scrollTop) {
inc("fillTop/fill")(o);
inc("cleanBottom/clean")(o);
}
inc("updateScrollbarCustom/update")(o);
o.scrollTop = o.div.scrollTop;
(ref$ = o.contentDiv).countScroll == null && (ref$.countScroll = 0);
o.contentDiv.countScroll += 1;
if (typeof p.onScroll == 'function') {
p.onScroll(o);
}
inc("onTopVisibleRowChange/onChange")(p, o);
if (o.debug) {
return o.debugDiv.html(("top: " + o.topRowIndex + " bottom: " + o.bottomRowIndex + " ") + ("min: " + o.minRowIndex + " max: " + o.maxRowIndex + " ") + ("nearScopeSize: " + o.nearScopeSize));
}
};
})();
components/listDiv/onScroll/onTopVisibleRowChange/onChange.ls
(function(){
return function(p, o){
var lp, index, data;
if (!p.onTopVisibleRowChange) {
return;
}
lp = o.getListPosition();
index = lp.rowIndex;
data = o.data[lp.rowIndex];
if (o.lastVisibleTopRowIndex === index) {
return;
}
o.lastVisibleTopRowIndex = index;
return p.onTopVisibleRowChange(index, data);
};
})();
components/listDiv/onScroll/updateScrollbarCustom/update.ls
(function(){
return function(o){
var minRow, maxRow, firstRowTop, maxIndex, lastRowBottom;
minRow = o.rowsByIndex[o.minRowIndex];
maxRow = o.rowsByIndex[o.maxRowIndex];
if (!minRow || !maxRow) {
return;
}
firstRowTop = o.minRowIndex === 0
? minRow.positionTop
: minRow.positionTop - o.minRowIndex * o.averageRowHeight;
maxIndex = o.data.length - 1;
lastRowBottom = o.maxRowIndex === maxIndex
? maxRow.positionTop + maxRow.positionHeight
: maxRow.positionTop + maxRow.positionHeight + (maxIndex - o.maxRowIndex) * o.averageRowHeight;
o.div.setScrollHeightCustom(lastRowBottom - firstRowTop);
return o.div.setScrollTopCustom(o.div.scrollTop - firstRowTop + o.topFix);
};
})();
components/listDiv/removeRow/remove.ls
(function(){
return function(o, position){
var oldRow, maxRow, rowsByIndexNew, index, ref$, row, nextRow;
o.data.splice(position, 1);
if (o.data.length === 0) {
o.setListPosition(null, true);
return;
}
oldRow = o.rowsByIndex[position];
if (oldRow != null) {
oldRow.remove();
}
if (position < o.maxRowIndex && oldRow != null) {
maxRow = o.rowsByIndex[o.maxRowIndex];
maxRow.positionTop -= oldRow.positionHeight;
}
if (position <= o.maxRowIndex) {
o.maxRowIndex--;
}
rowsByIndexNew = {};
for (index in ref$ = o.rowsByIndex) {
row = ref$[index];
if (row.rowIndex < position) {
rowsByIndexNew[row.rowIndex] = row;
} else if (row.rowIndex > position) {
row.rowIndex--;
rowsByIndexNew[row.rowIndex] = row;
}
}
o.rowsByIndex = rowsByIndexNew;
o.reachedBottom = false;
o.contentDiv.css({
height: "1000000px"
});
if (position >= o.topRowIndex && position <= o.bottomRowIndex) {
o.info("removeRow " + position + " VISIBLE");
if (nextRow = o.rowsByIndex[position]) {
nextRow.positionTop = oldRow.positionTop;
nextRow.css({
top: oldRow.positionTop + "px"
});
}
o.bottomRowIndex -= 1;
} else if (position > o.bottomRowIndex) {
o.info("removeRow " + position + " BELOW");
} else if (position < o.topRowIndex && !o.reachedTop) {
o.info("removeRow " + position + " ABOVE, reachedTop = false");
o.topRowIndex -= 1;
o.bottomRowIndex -= 1;
} else if (position < o.topRowIndex && o.reachedTop) {
o.info("removeRow " + position + " ABOVE, reachedTop = true");
o.topRowIndex -= 1;
o.bottomRowIndex -= 1;
o.setListPosition();
}
return o.repositionCurrentRows();
};
})();
components/listDiv/repositionCurrentRows/reposition.ls
(function(){
return function(o){
var i$, to$, i;
if (!o.hasStarted || o.topRowIndex == null || o.bottomRowIndex == null) {
return;
}
for (i$ = o.topRowIndex, to$ = o.bottomRowIndex; i$ <= to$; ++i$) {
i = i$;
inc("repositionAfter/reposition")(o, i, i - 1);
}
return o.onScroll();
};
})();
components/listDiv/repositionCurrentRows/repositionAfter/reposition.ls
(function(){
return function(o, index1, index2){
var div1, div2, maxRow, newHeight, dif, newPositionTop;
div1 = o.rowsByIndex[index1];
div2 = o.rowsByIndex[index2];
maxRow = o.rowsByIndex[o.maxRowIndex];
newHeight = div1.offsetHeight;
dif = newHeight - div1.positionHeight;
if (dif !== 0) {
div1.positionHeight = newHeight;
if (o.reachedBottom) {
o.contentDiv.css({
height: o.contentDiv.offsetHeight + dif + "px"
});
}
if (maxRow !== div1) {
maxRow.positionTop += dif;
}
}
if (index1 <= o.topRowIndex || index2 > o.bottomRowIndex) {
return;
}
newPositionTop = _.round(div2.positionTop + div2.positionHeight);
div1.css({
top: newPositionTop + "px"
});
return div1.positionTop = newPositionTop;
};
})();
components/listDiv/scrollRowIntoView/scroll.ls
(function(){
return function(o, rowIndex, options){
var row;
if (rowIndex < o.topRowIndex) {
o.setListPosition({
rowIndex: rowIndex,
topOffset: 0
});
} else if (rowIndex > o.bottomRowIndex) {
o.setListPosition({
rowIndex: rowIndex,
bottomOffset: 0
});
}
row = o.rowsByIndex[rowIndex];
o.div.scrollElementIntoView(row, options);
return row;
};
})();
components/listDiv/setListPosition/createStartRow/create.ls
(function(){
return function(o){
var startIndex, rowDiv, top;
o.div.scrollTop = o.contentDiv.offsetHeight / 2;
startIndex = o.listPosition.rowIndex;
if (!(startIndex >= 0)) {
startIndex = 0;
o.listPosition = {
rowIndex: startIndex,
topOffset: 0
};
} else if (startIndex > o.data.length - 1) {
startIndex = o.data.length - 1;
o.listPosition.rowIndex = startIndex;
}
rowDiv = o.createRow(startIndex);
top = o.listPosition.topOffset != null
? o.div.scrollTop + o.listPosition.topOffset
: o.listPosition.bottomOffset != null
? o.div.scrollTop + o.div.offsetHeight - rowDiv.positionHeight - o.listPosition.bottomOffset
: o.listPosition.centerOffset != null ? o.div.scrollTop + o.div.offsetHeight / 2 + o.listPosition.centerOffset - rowDiv.positionHeight / 2 : void 8;
top = _.round(top);
rowDiv.css({
top: top + "px"
});
if (o.debug) {
rowDiv.css({
background: "yellow"
});
}
rowDiv.positionTop = top;
o.topRowIndex = startIndex;
return o.bottomRowIndex = startIndex;
};
})();
components/listDiv/setListPosition/set.ls
(function(){
return function(listPosition, resetRows, o){
listPosition == null && (listPosition = o.getListPosition());
o.listPosition = listPosition;
if (!o.hasStarted) {
return;
}
o.div.scrollContainerDiv.css({
overflowY: "hidden"
});
if (resetRows) {
o.rowsByIndex = {};
}
o.topFix = 0;
o.reachedTop = false;
o.reachedBottom = false;
o.topRowIndex = null;
o.bottomRowIndex = null;
o.minRowIndex = null;
o.maxRowIndex = null;
o.scrollTop = null;
o.contentDiv = inc("../contentDiv/contentDiv")(o);
o.div.setScrollHeightCustom(null);
o.div.setScrollTopCustom(null);
if (o.data.length > 0) {
inc("createStartRow/create")(o);
}
o.onScroll();
return inc("waitFrames/wait")(2, function(){
return o.div.scrollContainerDiv.css({
overflowY: "scroll"
});
});
};
})();
components/listDiv/setListPosition/waitFrames/wait.ls
(function(){
return function(totalFrames, callback){
var counter, f;
counter = 0;
f = function(){
return requestAnimationFrame(function(){
counter = counter + 1;
if (counter === totalFrames) {
return callback();
} else {
return requestAnimationFrame(f);
}
});
};
return f();
};
})();
components/listDiv/updateRow/update.ls
(function(){
return function(o, p){
var position, oldRow, newRow;
position = p.position;
if (o.data[p.position] == null) {
throw Error("updateRow position doesn't exist");
}
if (p.data) {
o.data[p.position] = p.data;
}
if (o.data.length === 1) {
o.setListPosition(void 8, true);
return;
}
oldRow = o.rowsByIndex[position];
if (!oldRow) {
o.info("updateRow " + position + " unrendered");
return;
}
oldRow.remove();
delete o.rowsByIndex[position];
if (o.rowsByIndex[position + 1]) {
o.createRow(position, "before");
} else {
o.createRow(position, "after");
}
newRow = o.rowsByIndex[position];
if (newRow.positionHeight === oldRow.positionHeight) {
return o.info("updateRow " + position + " no height change");
} else {
o.reachedBottom = false;
o.contentDiv.css({
height: "1000000px"
});
o.repositionCurrentRows();
return o.info("updateRow " + position + " with height change");
}
};
})();
components/overlayMenu/backgroundDiv/div.ls
(function(){
return function(m){
var onContextMenu;
onContextMenu = function(e){
return e.preventDefault();
};
return Div({
position: "fixed",
left: 0,
right: 0,
top: 0,
bottom: 0,
zIndex: 100
}).addClass("overlayMenu mainMenu keyManagerScope").html(Div({
position: "absolute",
top: 0,
bottom: 0,
width: "100%",
backgroundColor: Color.grey[700]
}).keyframeAnimate({
keyframes: {
"0%": {
opacity: 0
},
"100%": {
opacity: 0.2
}
},
duration: 300
}).tap({
up: function(){
return m.close();
},
animation: "none"
}).css({
cursor: "default"
}).css(m.params.cssBackgroundDiv)).onWindowResize(function(){
return m.close();
}).onDomAppend(function(){
body.bind("keydown", m.onKeyDown);
body.bind("mousemove", m.onMouseMove);
return body.bind("contextmenu", onContextMenu);
}).onDomRemove(function(){
body.unbind("keydown", m.onKeyDown);
body.unbind("mousemove", m.onMouseMove);
return body.unbind("contextmenu", onContextMenu);
}).appendTo(m.params.backgroundParentDiv || app.currentPage.pageWrapper);
};
})();
components/overlayMenu/close/close.ls
(function(){
return function(m){
return m.backgroundDiv.remove();
};
})();
components/overlayMenu/createMenuDiv/close/close.ls
(function(){
return function(div, parentItemDiv){
div.closeSubmenu();
return setTimeout(function(){
return div.remove();
});
};
})();
components/overlayMenu/createMenuDiv/closeSubmenu/close.ls
(function(){
return function(menuDiv){
var ref$;
if ((ref$ = menuDiv.submenuDiv) != null) {
ref$.close();
}
menuDiv.submenuDiv = null;
return menuDiv.setFocus();
};
})();
components/overlayMenu/createMenuDiv/cornerDiv/div.ls
(function(){
return function(m, div, parentItemDiv){
if (parentItemDiv || !m.showCornerDiv || !m.params.referenceDiv) {
return;
}
return div.cornerDiv = Div({
position: "absolute",
top: "-0.4em",
left: "0.3em",
display: "flex",
width: "18px",
height: "18px"
}).html(Div({
width: "11px",
height: "11px",
transform: "rotate(45deg)",
backgroundColor: "white"
}).css(m.params.cssCornerDiv));
};
})();
components/overlayMenu/createMenuDiv/create.ls
(function(){
return function(m, items, parentItemDiv){
var div;
items = _.compact(_.ensureArray(items));
div = Div({
display: "flex",
flexDirection: "column",
position: "absolute",
backgroundColor: "white",
textAlign: "left",
maxHeight: m.params.maxHeight,
filter: "drop-shadow(1px 1px 3px rgba(0, 0, 0, 0.4))"
}).css(m.params.cssMenuDiv).addClass("menuDiv").appendTo(m.backgroundDiv);
div.html(inc("cornerDiv/div")(m, div, parentItemDiv), inc("itemsDiv/div")(m, items, div));
div.parentItemDiv = parentItemDiv;
div.items = items;
div.setTopLeftMaxHeight = function(){
return inc("setTopLeftMaxHeight/set")(m, div, parentItemDiv);
};
div.setFocus = function(){
return inc("setFocus/set")(m, div);
};
div.close = function(){
return inc("close/close")(div, parentItemDiv);
};
div.openSubmenu = function(itemDiv, items){
return inc("openSubmenu/open")(m, div, itemDiv, items);
};
div.closeSubmenu = function(){
return inc("closeSubmenu/close")(div);
};
div.hasSubmenu = function(){
return inc("hasSubmenu/has")(div);
};
div.setTopLeftMaxHeight();
div.setFocus();
div.m = m;
return div;
};
})();
components/overlayMenu/createMenuDiv/hasSubmenu/has.ls
(function(){
return function(div){
return div.submenuDiv != null;
};
})();
components/overlayMenu/createMenuDiv/itemsDiv/div.ls
(function(){
return function(m, items, menuDiv){
var index, item;
return menuDiv.itemsDiv = ScrollDiv().css({
flex: "0 1 auto",
maxWidth: m.params.maxWidth
}).css(m.params.cssItemsDiv).html((function(){
var i$, ref$, len$, results$ = [];
for (i$ = 0, len$ = (ref$ = items).length; i$ < len$; ++i$) {
index = i$;
item = ref$[i$];
results$.push(inc("itemDiv/div")(m, item, index, menuDiv));
}
return results$;
}()));
};
})();
components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/_calcMouseIsMovingToSubmenu/calc.ls
(function(){
return function(m, menuDiv){
var submenuDiv;
submenuDiv = m.currentSubmenuDiv;
if (!submenuDiv || submenuDiv === menuDiv || !m.lastMousePosition) {
return false;
}
return inc("checkIntersection/check")(submenuDiv, m);
};
})();
components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/_calcMouseIsMovingToSubmenu/checkIntersection/calVectorMouse/calc.ls
(function(){
return function(m){
var p1, p2, dx, dy, vMouse;
p1 = m.lastMousePosition;
p2 = m.currentMousePosition;
dx = p2.x - p1.x;
dy = p2.y - p1.y;
return vMouse = [
{
x: p1.x,
y: p1.y
}, {
x: p1.x + dx * 1000000,
y: p1.y + dy * 1000000
}
];
};
})();
components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/_calcMouseIsMovingToSubmenu/checkIntersection/calcIntersection/calc.ls
(function(){
return function(v1, v2){
var calc, p1, q1, p2, q2, o1, o2, o3, o4, isIntersecting;
calc = inc("calcOrientation/calc");
p1 = v1[0];
q1 = v1[1];
p2 = v2[0];
q2 = v2[1];
o1 = calc(p1, q1, p2);
o2 = calc(p1, q1, q2);
o3 = calc(p2, q2, p1);
o4 = calc(p2, q2, q1);
return isIntersecting = o1 !== o2 && o3 !== o4;
};
})();
components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/_calcMouseIsMovingToSubmenu/checkIntersection/calcIntersection/calcOrientation/calc.ls
(function(){
return function(p, q, r){
var val;
val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
if (val === 0) {
return 0;
}
if (val > 0) {
return 1;
}
return 2;
};
})();
components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/_calcMouseIsMovingToSubmenu/checkIntersection/check.ls
(function(){
return function(submenuDiv, m){
var o, vMouse, vTop, vBottom, vLeft, vRight, calc;
o = submenuDiv.offset();
vMouse = inc("calVectorMouse/calc")(m);
vTop = [
{
x: o.left,
y: o.top
}, {
x: o.right,
y: o.top
}
];
vBottom = [
{
x: o.left,
y: o.bottom
}, {
x: o.right,
y: o.bottom
}
];
vLeft = [
{
x: o.left,
y: o.top
}, {
x: o.left,
y: o.bottom
}
];
vRight = [
{
x: o.right,
y: o.top
}, {
x: o.right,
y: o.bottom
}
];
calc = inc("calcIntersection/calc");
return calc(vMouse, vTop) || calc(vMouse, vBottom) || calc(vMouse, vLeft) || calc(vMouse, vRight);
};
})();
components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/div.ls
(function(){
return function(item, index, menuDiv, m){
var div;
div = Div({
display: "flex",
padding: "0.6em",
maxWidth: "90vw",
lineHeight: "1.4em",
whiteSpace: "pre-line",
wordBreak: "break-word",
backgroundColor: item.selected ? Color.grey[250] : void 8,
borderTop: index > 0 ? "1px solid " + Color.grey[200] : void 8
}).html(inc("icon/icon")(item), inc("label/label")(item), inc("iconSubmenu/icon")(item)).addClass("itemDiv");
div.bind("mouseenter", function(){
return inc("onMouseEnter/on")(div, menuDiv, m);
});
div.bind("mouseleave", function(){
return inc("onMouseLeave/on")(div, menuDiv, m);
});
div.index = index;
div.item = item;
div.menuDiv = menuDiv;
div.setFocus = function(){
return inc("setFocus/set")(div);
};
div.removeFocus = function(){
return inc("removeFocus/remove")(div);
};
div.hasFocus = function(){
return inc("hasFocus/has")(div);
};
return div;
};
})();
components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/hasFocus/has.ls
(function(){
return function(div){
return div.findFirst(".focusDiv") != null;
};
})();
components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/icon/icon.ls
(function(){
return function(item){
var icon;
icon = item.icon;
if (!icon) {
return;
}
if (_.isObject(icon)) {
return icon;
}
if (_.isFunction(icon)) {
return icon();
}
return SvgIcon({
svg: icon,
color: item.iconColor || Color.grey[600]
}).css({
flex: "0 0 auto",
marginRight: "0.4em"
});
};
})();
components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/iconSubmenu/icon.ls
(function(){
return function(item){
if (!item.items) {
return;
}
return SvgIcon({
svg: path("svg/arrow-right-small.svg"),
color: Color.grey[600],
size: "0.6em"
}).css({
marginLeft: "0.4em"
});
};
})();
components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/iconSubmenu/svg/arrow-right-small.svg
components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/label/label.ls
(function(){
return function(item){
return Div({
flex: "1 1 auto"
}).html(item.label);
};
})();
components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/onMouseEnter/on.ls
(function(){
return function(div, menuDiv, m){
var delay;
div.mouseOver = true;
if (div.onDelayedMouseEnter == null) {
return;
}
delay = inc("../_calcMouseIsMovingToSubmenu/calc")(m, menuDiv) ? 250 : 0;
return setTimeout(function(){
if (div.mouseOver) {
return typeof div.onDelayedMouseEnter == 'function' ? div.onDelayedMouseEnter() : void 8;
}
}, delay);
};
})();
components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/onMouseLeave/on.ls
(function(){
return function(div, menuDiv, m){
var isMovingToSubmenu;
div.mouseOver = false;
if (div.onMouseLeave == null) {
return;
}
isMovingToSubmenu = inc("../_calcMouseIsMovingToSubmenu/calc")(m, menuDiv);
return div.onMouseLeave(isMovingToSubmenu);
};
})();
components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/removeFocus/remove.ls
(function(){
return function(div){
var ref$;
return (ref$ = div.findFirst(".focusDiv")) != null ? ref$.remove() : void 8;
};
})();
components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/_itemDiv/setFocus/set.ls
(function(){
return function(div){
var ref$;
if ((ref$ = div.menuDiv.findFirst(".focusDiv")) != null) {
ref$.remove();
}
return div.prepend(Div({
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
background: Color.grey[250],
pointerEvents: "none"
}).addClass("focusDiv"));
};
})();
components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/customDiv/div.ls
(function(){
return function(m, item, index, menuDiv){
var div;
div = Div().html(item.div).addClass("itemDiv");
if (item.tap || item.click) {
div.tap(function(){
return item.tap(item) || item.click(item);
});
}
div.item = item;
div.menuDiv = menuDiv;
return div;
};
})();
components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/div.ls
(function(){
return function(m, item, index, menuDiv){
var func;
func = item.div
? inc("customDiv/div")
: item.tap || item.click
? inc("tapDiv/div")
: item.items
? inc("submenuDiv/div")
: inc("otherDiv/div");
return func(m, item, index, menuDiv);
};
})();
components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/otherDiv/div.ls
(function(){
return function(m, item, index, menuDiv){
var div;
return div = inc("../_itemDiv/div")(item, index, menuDiv, m).tap({
up: function(){},
animation: "none"
}).css({
cursor: "default"
});
};
})();
components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/submenuDiv/div.ls
(function(){
return function(m, item, index, menuDiv){
var div;
div = inc("../_itemDiv/div")(item, index, menuDiv, m).tap(function(e){
if (!div.hasFocus()) {
div.setFocus();
return menuDiv.openSubmenu(div, item.items);
} else if (e.type !== "mouseup") {
div.removeFocus();
return menuDiv.closeSubmenu();
}
});
div.onDelayedMouseEnter = function(){
div.setFocus();
return menuDiv.openSubmenu(div, item.items);
};
div.onMouseLeave = function(isMovingToSubmenu){
if (!isMovingToSubmenu) {
div.removeFocus();
return menuDiv.closeSubmenu();
}
};
return div;
};
})();
components/overlayMenu/createMenuDiv/itemsDiv/itemDiv/tapDiv/div.ls
(function(){
return function(m, item, index, menuDiv){
var div;
div = inc("../_itemDiv/div")(item, index, menuDiv, m).tap(function(){
m.close();
return (typeof item.tap == 'function' ? item.tap(item) : void 8) || (typeof item.click == 'function' ? item.click(item) : void 8);
});
div.onDelayedMouseEnter = function(){
div.setFocus();
return menuDiv.closeSubmenu();
};
div.onMouseLeave = function(){
return div.removeFocus();
};
return div;
};
})();
components/overlayMenu/createMenuDiv/openSubmenu/open.ls
(function(){
return function(m, menuDiv, itemDiv, items){
itemDiv.setFocus();
menuDiv.closeSubmenu();
menuDiv.submenuDiv = m.createMenuDiv(items, itemDiv);
return m.currentSubmenuDiv = menuDiv.submenuDiv;
};
})();
components/overlayMenu/createMenuDiv/setFocus/set.ls
(function(){
return function(m, div){
m.focusMenuDiv = div;
return div;
};
})();
components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/_shared/calcOverflow/calc.ls
(function(){
return function(m, o1, o2, yDistance, minPadding){
var screenSize, bottom, overflow;
screenSize = body.offset();
bottom = o1.top + o2.height + minPadding + yDistance;
overflow = screenSize.bottom - bottom;
if (overflow < 0) {
return overflow;
}
return 0;
};
})();
components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/_shared/getIsUpIsLeft/get.ls
(function(){
return function(m, o1, o2, minPadding, yDistance, direction, isSubMenu){
var fitsUp, fitsDown, isUp, fitsLeft, fitsRight, isLeft, changedLeftRight;
fitsUp = o2.height + minPadding + yDistance < o1.top;
fitsDown = o1.top + o1.height + o2.height + minPadding + yDistance < body.offsetHeight;
isUp = !fitsUp && !fitsDown
? o1.top > 0.5 * body.offsetHeight
: (_.includes(direction, "up") && fitsUp) || (_.includes(direction, "down") && !fitsDown);
fitsLeft = o2.width + minPadding < o1.left;
fitsRight = !isSubMenu
? o1.left + o2.width + minPadding < body.offsetWidth
: o1.left + o1.width + o2.width + minPadding < body.offsetWidth;
isLeft = (_.includes(direction, "left") && fitsLeft) || (_.includes(direction, "right") && !fitsRight);
changedLeftRight = (_.includes(direction, "right") && !fitsRight) || (_.includes(direction, "left") && !fitsLeft);
return {
isUp: isUp,
isLeft: isLeft,
fitsLeft: fitsLeft,
fitsRight: fitsRight,
changedLeftRight: changedLeftRight
};
};
})();
components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/_shared/getMaxHeight/get.ls
(function(){
return function(m, o2, yDistance, minPadding, isUp, isRootMenu){
var maxHeight, heightLimit, refDiv;
maxHeight = 10000;
heightLimit = body.offsetHeight;
if (m.params.referenceDiv && isRootMenu) {
refDiv = m.params.referenceDiv.offset();
heightLimit = isUp
? refDiv.top
: body.offsetHeight - refDiv.bottom;
}
if (heightLimit < o2.height + yDistance + minPadding) {
maxHeight = heightLimit - yDistance - minPadding;
}
if (m.originalMaxHeight < maxHeight) {
maxHeight = m.originalMaxHeight;
}
return maxHeight;
};
})();
components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/_shared/sharedVars/vars.ls
(function(){
return function(m, menuDiv){
var a, ref$, adjustX, adjustY, yDistance, minPadding;
a = ((ref$ = m.params.adjustXY) != null ? ref$.split(" ") : void 8) || [];
adjustX = +a[0] || 0;
adjustY = +a[1] || 0;
yDistance = m.showCornerDiv && !m.params.referencePoint ? 12 + adjustY : 2;
minPadding = 14;
m.originalMaxHeight == null && (m.originalMaxHeight = +menuDiv.css("maxHeight").replace("px", "") || 10000);
return {
adjustX: adjustX,
adjustY: adjustY,
yDistance: yDistance,
minPadding: minPadding
};
};
})();
components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/root/set.ls
(function(){
return function(m, menuDiv, isRootMenu){
var direction, ref$, o1, o2, ref1$, adjustX, adjustY, yDistance, minPadding, isUp, isLeft, fitsLeft, fitsRight, changedLeftRight;
direction = (ref$ = m.params.direction) != null ? ref$ : "down right";
o1 = m.params.referencePoint
? {
top: m.params.referencePoint.y,
left: m.params.referencePoint.x,
width: 0,
height: 0
}
: (ref$ = m.params.referenceDiv) != null ? ref$.offset() : void 8;
o2 = menuDiv.offset();
ref1$ = inc("../_shared/sharedVars/vars")(m, menuDiv), adjustX = ref1$.adjustX, adjustY = ref1$.adjustY, yDistance = ref1$.yDistance, minPadding = ref1$.minPadding;
ref1$ = inc("../_shared/getIsUpIsLeft/get")(m, o1, o2, minPadding, yDistance, direction), isUp = ref1$.isUp, isLeft = ref1$.isLeft, fitsLeft = ref1$.fitsLeft, fitsRight = ref1$.fitsRight, changedLeftRight = ref1$.changedLeftRight;
if (m.params.referencePoint) {
return inc("setForRefPoint/set")(m, isUp, isLeft, o1, o2, yDistance, minPadding, menuDiv, adjustX, direction, fitsLeft, fitsRight);
} else {
return inc("setForRefDiv/set")(m, isUp, isLeft, o1, o2, yDistance, minPadding, menuDiv, adjustX, isRootMenu, changedLeftRight);
}
};
})();
components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/root/setForRefDiv/cornerDiv/set.ls
(function(){
return function(m, menuDiv, isUp, isLeft){
var refDiv, o3, o4, ref$, leftC, middleRefDiv, topC, ref1$;
refDiv = m.params.referenceDiv.offset();
o3 = menuDiv.offset();
o4 = (ref$ = menuDiv.cornerDiv) != null ? ref$.offset() : void 8;
leftC = isLeft ? o3.width - (o4 != null ? o4.width : void 8) - 6 : 6;
if ((!isLeft && o4.left < refDiv.left) || (isLeft && o3.right - 6 > refDiv.right)) {
middleRefDiv = refDiv.left + refDiv.width / 2;
leftC = middleRefDiv - menuDiv.offset().left - (o4 != null ? o4.width : void 8) / 2;
}
topC = isUp
? o3.height - 9
: -9;
return (ref1$ = menuDiv.cornerDiv) != null ? ref1$.css({
left: leftC + "px",
top: topC + "px"
}) : void 8;
};
})();
components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/root/setForRefDiv/set.ls
(function(){
return function(m, isUp, isLeft, o1, o2, yDistance, minPadding, menuDiv, adjustX, isRootMenu, changedLeftRight){
var w1, w2, top, left, maxHeight;
w1 = isUp ? "up" : "down";
w2 = isLeft ? "left" : "right";
m.subMenuDirection = w1 + " " + w2;
top = isUp
? o1.top - o2.height - yDistance
: o1.top + o1.height + yDistance;
top = Math.max(top, minPadding);
left = isLeft
? o1.left + o1.width - o2.width
: o1.left;
left = Math.max(left, minPadding);
left = Math.min(left, body.offsetWidth - o2.width - minPadding);
if (m.showCornerDiv && m.params.referencePoint != null) {
left = isLeft
? left + 19
: left - 19;
}
maxHeight = inc("../../_shared/getMaxHeight/get")(m, o2, yDistance, minPadding, isUp, isRootMenu);
if (changedLeftRight) {
adjustX *= -1;
}
menuDiv.css({
top: top + "px",
left: left + adjustX + "px",
maxHeight: maxHeight + "px"
});
if (m.showCornerDiv) {
return inc("cornerDiv/set")(m, menuDiv, isUp, isLeft);
}
};
})();
components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/root/setForRefPoint/set.ls
(function(){
return function(m, isUp, isLeft, o1, o2, yDistance, minPadding, menuDiv, adjustX, direction, fitsLeft, fitsRight){
var overflow, maxHeight, top, left;
overflow = inc("../../_shared/calcOverflow/calc")(m, o1, o2, yDistance, minPadding);
maxHeight = inc("../../_shared/getMaxHeight/get")(m, o2, yDistance, minPadding);
top = maxHeight !== 10000
? minPadding
: o1.top + overflow + yDistance;
left = isLeft
? o1.left + o1.width - o2.width
: o1.left + 3;
if (!fitsLeft && !fitsRight) {
left = (window.innerWidth - menuDiv.offsetWidth) / 2;
}
return menuDiv.css({
top: top + "px",
left: left + adjustX + "px",
maxHeight: maxHeight + "px"
});
};
})();
components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/set.ls
(function(){
return function(m, div, parentItemDiv){
if (!parentItemDiv) {
return inc("root/set")(m, div, true);
} else {
return inc("submenu/set")(m, div, parentItemDiv);
}
};
})();
components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/submenu/calcLeft/calc.ls
(function(){
return function(div, isLeft, fitsLeft, fitsRight, o1, o2, m){
var upDown, ref$, left;
upDown = (ref$ = m.subMenuDirection.split(" ")[0]) != null
? ref$
: (ref$ = m.params.direction.split(" ")[0]) != null ? ref$ : "down";
if (!isLeft && !fitsRight) {
left = o1.left - o2.width;
m.subMenuDirection = upDown + " left";
} else if (isLeft && !fitsLeft) {
left = o1.left + o1.width;
m.subMenuDirection = upDown + " right";
} else if (isLeft) {
left = o1.left - o2.width;
m.subMenuDirection = upDown + " left";
} else if (!isLeft) {
left = o1.left + o1.width;
m.subMenuDirection = upDown + " right";
}
return left;
};
})();
components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/submenu/calcTop/calc.ls
(function(){
return function(o1, o2, overflow, parentIndex, maxHeight, isUp, minPadding){
var ref$, top;
if (maxHeight !== 10000) {
ref$ = inc("calcTopWithMaxHeight/calc")(o1, isUp, maxHeight, minPadding), top = ref$.top, maxHeight = ref$.maxHeight;
} else {
top = inc("calcAdjustedTop/calc")(o1, o2, overflow, parentIndex);
}
return {
top: top,
maxHeight: maxHeight
};
};
})();
components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/submenu/calcTop/calcAdjustedTop/calc.ls
(function(){
return function(o1, o2, overflow, parentIndex){
var mod, adjustedOverflow, top;
mod = Math.floor(overflow / o1.height);
adjustedOverflow = mod * o1.height;
if (overflow !== 0) {
adjustedOverflow += o1.height;
if (parentIndex === 0) {
adjustedOverflow -= 2;
}
}
top = o1.top + adjustedOverflow;
if (top + o2.height > body.offset().bottom) {
top -= o1.height;
}
return top;
};
})();
components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/submenu/calcTop/calcTopWithMaxHeight/calc.ls
(function(){
return function(o1, isUp, maxHeight, minPadding){
var mod, adjustY, top;
mod = Math.floor(o1.top / o1.height);
adjustY = isUp ? 6 : 3;
top = o1.top - mod * o1.height - adjustY;
if (body.offsetHeight < top + maxHeight) {
maxHeight = body.offsetHeight - top - minPadding;
}
return {
top: top,
maxHeight: maxHeight
};
};
})();
components/overlayMenu/createMenuDiv/setTopLeftMaxHeight/submenu/set.ls
(function(){
return function(m, div, parentItemDiv){
var ref$, o1, o2, adjustX, adjustY, yDistance, minPadding, isUp, isLeft, fitsRight, fitsLeft, overflow, maxHeight, top, left;
m.subMenuDirection = (ref$ = m.subMenuDirection) != null
? ref$
: (ref$ = m.params.direction) != null ? ref$ : "down right";
o1 = parentItemDiv.offset();
o2 = div.offset();
ref$ = inc("../_shared/sharedVars/vars")(m, div), adjustX = ref$.adjustX, adjustY = ref$.adjustY, yDistance = ref$.yDistance, minPadding = ref$.minPadding;
ref$ = inc("../_shared/getIsUpIsLeft/get")(m, o1, o2, minPadding, yDistance, m.subMenuDirection, true), isUp = ref$.isUp, isLeft = ref$.isLeft, fitsRight = ref$.fitsRight, fitsLeft = ref$.fitsLeft;
overflow = inc("../_shared/calcOverflow/calc")(m, o1, o2, yDistance, minPadding);
maxHeight = inc("../_shared/getMaxHeight/get")(m, o2, yDistance, minPadding, isUp);
ref$ = inc("calcTop/calc")(o1, o2, overflow, parentItemDiv.index, maxHeight, isUp, minPadding), top = ref$.top, maxHeight = ref$.maxHeight;
left = inc("calcLeft/calc")(div, isLeft, fitsLeft, fitsRight, o1, o2, m);
return div.css({
top: top + "px",
left: left + adjustX + "px",
maxHeight: maxHeight + "px"
});
};
})();
components/overlayMenu/menu.ls
(function(){
return function(params){
var m, ref$, div;
m = {};
m.params = params;
m.showCornerDiv = (ref$ = params.showCornerDiv) != null ? ref$ : true;
m.enableKeyboard = (ref$ = params.enableKeyboard) != null ? ref$ : true;
m.lastMousePositions = [];
m.focusMenuDiv = undefined;
m.backgroundDiv = inc("backgroundDiv/div")(m);
m.createMenuDiv = function(items, parentItemDiv){
return inc("createMenuDiv/create")(m, items, parentItemDiv);
};
m.onKeyDown = function(e){
return inc("onKeyDown/on")(m, e);
};
m.onMouseMove = function(e){
return inc("onMouseMove/on")(m, e);
};
m.close = function(){
return inc("close/close")(m);
};
m.createMenuDiv(m.params.items);
div = m.backgroundDiv;
div.close = m.close;
return div;
};
})();
components/overlayMenu/onKeyDown/on.ls
(function(){
return function(m, e){
var ref$;
if (!m.enableKeyboard) {
return;
}
if (e.target.isDivEditable) {
return;
}
if (e.key === "Escape") {
e.preventDefault();
return inc("onEsc/on")(m);
} else if (e.key === "Enter") {
e.preventDefault();
return inc("onEnter/on")(m);
} else if ((ref$ = e.key) === "ArrowUp" || ref$ === "ArrowDown") {
e.preventDefault();
return inc("onUpOrDown/on")(m, e.key);
} else if (e.key === "ArrowRight") {
e.preventDefault();
return inc("onRight/on")(m);
} else if (e.key === "ArrowLeft") {
e.preventDefault();
return inc("onLeft/on")(m);
}
};
})();
components/overlayMenu/onKeyDown/onEnter/on.ls
(function(){
return function(m){
var menuDiv, focusItemDiv, ref$, ref1$;
menuDiv = m.focusMenuDiv;
focusItemDiv = (ref$ = menuDiv.findFirst(".focusDiv")) != null ? ref$.parent() : void 8;
if (!focusItemDiv) {
return;
}
focusItemDiv.triggerTap();
if (!((ref1$ = menuDiv.submenuDiv) != null && ref1$.isVisible())) {
menuDiv.openSubmenu(focusItemDiv, focusItemDiv.item.items);
}
return inc("../onUpOrDown/on")(m, "ArrowDown");
};
})();
components/overlayMenu/onKeyDown/onEsc/on.ls
(function(){
return function(m){
return m.close();
};
})();
components/overlayMenu/onKeyDown/onLeft/on.ls
(function(){
return function(m){
var menuDiv, parentItemDiv;
menuDiv = m.focusMenuDiv;
parentItemDiv = menuDiv.parentItemDiv;
if (!parentItemDiv) {
return;
}
menuDiv.close();
parentItemDiv.menuDiv.setFocus();
return parentItemDiv.setFocus();
};
})();
components/overlayMenu/onKeyDown/onRight/on.ls
(function(){
return function(m){
var menuDiv, focusItemDiv, ref$;
menuDiv = m.focusMenuDiv;
focusItemDiv = (ref$ = menuDiv.findFirst(".focusDiv")) != null ? ref$.parent() : void 8;
if (!focusItemDiv) {
return inc("../onUpOrDown/on")(m, "ArrowDown");
} else if (focusItemDiv != null && focusItemDiv.item.items) {
return inc("../onEnter/on")(m);
}
};
})();
components/overlayMenu/onKeyDown/onUpOrDown/calcNewItemDiv/calc.ls
(function(){
return function(menuDiv, lastFocusItemDiv, key){
var itemDivs, lastIndex, that;
itemDivs = menuDiv.itemsDiv.childrenAll();
itemDivs = _.filter(itemDivs, function(div){
var i;
if (!div.hasClass("itemDiv")) {
return false;
} else {
i = div.item;
return i.items != null || i.tap != null || i.click != null;
}
});
lastIndex = _.indexOf(itemDivs, lastFocusItemDiv);
if (key === "ArrowDown") {
if (!lastFocusItemDiv) {
return _.first(itemDivs);
} else if (that = itemDivs[lastIndex + 1]) {
return that;
} else {
return _.last(itemDivs);
}
} else if (key === "ArrowUp") {
if (!lastFocusItemDiv) {
return _.last(itemDivs);
} else if (that = itemDivs[lastIndex - 1]) {
return that;
} else {
return _.first(itemDivs);
}
}
};
})();
components/overlayMenu/onKeyDown/onUpOrDown/on.ls
(function(){
return function(m, key){
var menuDiv, lastFocusItemDiv, ref$, newItemDiv;
menuDiv = m.focusMenuDiv;
lastFocusItemDiv = (ref$ = menuDiv.findFirst(".focusDiv")) != null ? ref$.parent() : void 8;
newItemDiv = inc("calcNewItemDiv/calc")(menuDiv, lastFocusItemDiv, key);
return newItemDiv != null ? newItemDiv.setFocus() : void 8;
};
})();
components/overlayMenu/onMouseMove/on.ls
(function(){
return function(m, e){
m.lastMousePosition = m.currentMousePosition;
return m.currentMousePosition = {
x: e.clientX,
y: e.clientY
};
};
})();
components/scrollDiv/calcDefaultScrollBarMode/calc.ls
(function(){
return function(){
var a, isDesktop, defaultScrollBarMode;
a = navigator.userAgent.toLowerCase();
isDesktop = _.includes(a, "android") || _.includes(a, "ipad") || _.includes(a, "iphone")
? false
: _.includes(a, "chrome") && _.includes(a, "linux") ? false : true;
return defaultScrollBarMode = isDesktop ? "show" : "auto";
};
})();
components/scrollDiv/cssHeader/cssHeader.ls
(function(){
return function(){
var style;
if (document.head == null || document.head.findFirst('#scrollDivContainerStyles')) {
return;
}
style = Style();
style.setAttribute("id", "scrollDivContainerStyles");
style.innerHTML = '\n .scrollDivContainer{\n -ms-overflow-style:none;\n }\n\n .scrollDivContainer::-webkit-scrollbar{\n display: none;\n }\n';
return document.head.append(style);
};
})();
components/scrollDiv/functions/_shared/scrollTo/scrollTo.ls
(function(){
return function(scrollDiv){
var scrollContainer, lastTime, onFrame, overflowX, overflowY;
scrollDiv.initialScrollOffset = {
left: scrollDiv.scrollContainer.scrollLeft,
top: scrollDiv.scrollContainer.scrollTop
};
if (scrollDiv.scrollFrameRunning) {
return;
}
scrollDiv.scrollFrameRunning = true;
scrollContainer = scrollDiv.scrollContainer;
onFrame = function(timestamp){
var targetOffset, percentage, maxScroll, delta, ref$;
if (!(targetOffset = scrollDiv.targetOffset)) {
delete scrollDiv.scrollFrameRunning;
return;
}
if (lastTime == null) {
lastTime = timestamp;
requestAnimationFrame(onFrame);
return;
}
if (scrollDiv.preventAutoScroll) {
scrollDiv.targetOffset = undefined;
delete scrollDiv.scrollDuration;
delete scrollDiv.currentScrollDuration;
delete scrollDiv.scrollFrameRunning;
delete scrollDiv.initialScrollOffset;
return;
}
scrollDiv.currentScrollDuration += timestamp - lastTime;
percentage = Math.min(1, scrollDiv.currentScrollDuration / scrollDiv.scrollDuration);
percentage = Math.pow(percentage, 2) * (3 - 2 * percentage);
lastTime = timestamp;
maxScroll = {
top: scrollContainer.scrollHeight - scrollContainer.offsetHeight,
left: scrollContainer.scrollWidth - scrollContainer.offsetWidth
};
if (targetOffset.top < 0) {
targetOffset.top = 0;
} else if (targetOffset.top + 1 > maxScroll.top) {
targetOffset.top = maxScroll.top;
}
if (targetOffset.left < 0) {
targetOffset.left = 0;
} else if (targetOffset.left + 1 > maxScroll.left) {
targetOffset.left = maxScroll.left;
}
delta = {
x: targetOffset.left - scrollDiv.initialScrollOffset.left,
y: targetOffset.top - scrollDiv.initialScrollOffset.top
};
scrollContainer.scrollLeft = scrollDiv.initialScrollOffset.left + delta.x * percentage;
scrollContainer.scrollTop = scrollDiv.initialScrollOffset.top + delta.y * percentage;
if (percentage >= 1) {
scrollContainer.scrollTop = targetOffset.top;
scrollContainer.scrollLeft = targetOffset.left;
scrollDiv.targetOffset = undefined;
delete scrollDiv.scrollDuration;
delete scrollDiv.currentScrollDuration;
delete scrollDiv.scrollFrameRunning;
return ref$ = scrollDiv.initialScrollOffset, delete scrollDiv.initialScrollOffset, ref$;
} else {
return requestAnimationFrame(onFrame);
}
};
scrollDiv.updateScrollDiv();
overflowX = scrollDiv.scrollContainer.css("overflowX");
overflowY = scrollDiv.scrollContainer.css("overflowY");
scrollDiv.scrollContainer.css({
overflowX: "hidden",
overflowY: "hidden"
});
return requestAnimationFrame(function(){
var currentOverflowX, currentOverflowY;
currentOverflowX = scrollContainer.css("overflowX");
currentOverflowY = scrollContainer.css("overflowY");
if (currentOverflowX === "hidden") {
scrollContainer.css({
overflowX: overflowX
});
}
if (currentOverflowY === "hidden") {
scrollContainer.css({
overflowY: overflowY
});
}
return onFrame();
});
};
})();
components/scrollDiv/functions/fitSizeToContent/fit.ls
(function(){
return function(div){
return function(axis){
if (axis === "horizontal") {
div.css({
width: div.content.offsetWidth + "px"
});
return div.scrollBars.horizontal.update();
} else if (axis === "vertical") {
div.css({
height: div.content.offsetHeight + "px"
});
return div.scrollBars.vertical.update();
} else {
div.css({
height: div.content.offsetHeight + "px",
width: div.content.offsetWidth + "px"
});
div.scrollBars.horizontal.update();
return div.scrollBars.vertical.update();
}
};
};
})();
components/scrollDiv/functions/scrollBarMode/scrollBarMode.ls
(function(){
return function(div, scrollBarMode){
return function(mode){
var ref$;
if (!mode) {
return scrollBarMode;
}
if (_.isString(mode)) {
scrollBarMode.horizontal = mode;
scrollBarMode.vertical = mode;
} else {
scrollBarMode.horizontal = (ref$ = mode.horizontal) != null
? ref$
: scrollBarMode != null ? scrollBarMode.horizontal : void 8;
scrollBarMode.vertical = (ref$ = mode.vertical) != null
? ref$
: scrollBarMode != null ? scrollBarMode.vertical : void 8;
}
div.scrollBars.horizontal.setMode(scrollBarMode.horizontal);
div.scrollBars.vertical.setMode(scrollBarMode.vertical);
return div;
};
};
})();
components/scrollDiv/functions/scrollElementIntoView/calcOffset/calc.ls
(function(){
return function(scrollDiv, el, options){
var padding, center, top, contentContainer, scrollContainer, scrollbarInsets, scrollContainerHeight, scrollContainerWidth, calcElementOffset, elementOffset, viewportOverflowY, viewportOverflowX, paddingV, skipScrollV, scrollTop, paddingH, x1, skipScrollH, scrollLeft;
padding = (options != null ? options.padding : void 8) || 5;
center = (options != null ? options.center : void 8) || false;
top = (options != null ? options.top : void 8) || false;
contentContainer = scrollDiv.content;
scrollContainer = scrollDiv.scrollContainer;
scrollbarInsets = {
bottom: scrollDiv.scrollBars.vertical.isVisible()
? scrollDiv.offsetHeight - scrollDiv.scrollBars.vertical.offsetTop - scrollDiv.scrollBars.vertical.offsetHeight
: scrollDiv.scrollBars.horizontal.isVisible() ? scrollDiv.offsetHeight - scrollDiv.scrollBars.horizontal.offsetTop - scrollDiv.scrollBars.horizontal.offsetHeight : 0,
right: scrollDiv.scrollBars.vertical.isVisible()
? scrollDiv.offsetWidth - scrollDiv.scrollBars.vertical.offsetLeft - scrollDiv.scrollBars.vertical.offsetWidth
: scrollDiv.scrollBars.horizontal.isVisible() ? scrollDiv.offsetWidth - scrollDiv.scrollBars.horizontal.offsetWidth - scrollDiv.scrollBars.horizontal.offsetWidth : 0,
left: scrollDiv.scrollBars.horizontal.isVisible() ? scrollDiv.scrollBars.horizontal.offsetLeft : 0,
top: scrollDiv.scrollBars.vertical.isVisible() ? scrollDiv.scrollBars.vertical.offsetTop : 0
};
scrollContainerHeight = scrollDiv.offsetHeight - scrollbarInsets.bottom - scrollbarInsets.top;
scrollContainerWidth = scrollDiv.offsetWidth - scrollbarInsets.right - scrollbarInsets.left;
calcElementOffset = function(element){
var offset;
offset = {
width: element.offsetWidth,
height: element.offsetHeight,
top: 0,
left: 0
};
while (element != null && element !== scrollDiv) {
offset.top += element.offsetTop;
offset.left += element.offsetLeft;
element = element.offsetParent;
}
return offset;
};
elementOffset = calcElementOffset(el);
if (!center && elementOffset.height + 1 > scrollContainerHeight) {
viewportOverflowY = true;
}
if (!center && elementOffset.width + 1 > scrollContainerWidth) {
viewportOverflowX = true;
}
paddingV = padding;
if (center) {
paddingV = (scrollContainerHeight - elementOffset.height) / 2;
} else {
if (top || viewportOverflowY || scrollContainer.scrollTop > elementOffset.top - paddingV - scrollbarInsets.top) {} else if (scrollContainer.scrollTop < elementOffset.top - scrollContainerHeight - scrollbarInsets.top + paddingV + elementOffset.height) {
paddingV = scrollContainerHeight - paddingV - elementOffset.height;
} else {
skipScrollV = true;
}
}
if (!skipScrollV) {
scrollTop = elementOffset.top - paddingV - scrollbarInsets.top;
} else {
scrollTop = scrollContainer.scrollTop;
}
paddingH = padding;
x1 = elementOffset.left;
if (center) {
paddingH = (scrollContainerWidth - elementOffset.width) / 2;
} else {
if (viewportOverflowX || scrollContainer.scrollLeft > x1 - paddingH - scrollbarInsets.left) {} else if (scrollContainer.scrollLeft < x1 - scrollContainerWidth - scrollbarInsets.left + paddingH + elementOffset.width) {
paddingH = scrollContainerWidth - paddingH - elementOffset.width;
} else {
skipScrollH = true;
}
}
if (!skipScrollH) {
scrollLeft = x1 - paddingH - scrollbarInsets.left;
} else {
scrollLeft = scrollContainer.scrollLeft;
}
return {
top: _.round(scrollTop, 1),
left: _.round(scrollLeft, 1)
};
};
})();
components/scrollDiv/functions/scrollElementIntoView/scroll.ls
(function(){
return function(div){
var scrollContainer;
scrollContainer = div.scrollContainer;
return function(element, options){
var scroll;
scroll = function(){
var targetOffset, isCurrentTarget, ref$;
targetOffset = include("calcOffset/calc")(div, element, options);
isCurrentTarget = _.isEqual(targetOffset, div.targetOffset);
div.targetOffset = targetOffset;
if (options != null && options.instant) {
scrollContainer.scrollTop = div.targetOffset.top;
return scrollContainer.scrollLeft = div.targetOffset.left;
} else if (isCurrentTarget && div.scrollFrameRunning) {} else {
div.scrollDuration = (ref$ = options != null ? options.duration : void 8) != null ? ref$ : 300;
div.currentScrollDuration = 0;
return include("../_shared/scrollTo/scrollTo")(div);
}
};
return requestAnimationFrame(function(){
if (div.content.contains(element)) {
return scroll();
}
});
};
};
})();
components/scrollDiv/functions/scrollToPosition/scroll.ls
(function(){
return function(div){
var scrollContainer;
scrollContainer = div.scrollContainer;
return function(targetOffset, options){
var scroll;
scroll = function(){
var ref$, isCurrentTarget;
targetOffset = {
top: (ref$ = targetOffset.top) != null
? ref$
: scrollContainer.scrollTop,
left: (ref$ = targetOffset.left) != null
? ref$
: scrollContainer.scrollLeft
};
isCurrentTarget = _.isEqual(targetOffset, div.targetOffset);
div.targetOffset = targetOffset;
if (options != null && options.instant) {
scrollContainer.scrollTop = div.targetOffset.top;
return scrollContainer.scrollLeft = div.targetOffset.left;
} else {
if (isCurrentTarget && div.scrollFrameRunning) {
return;
}
div.scrollDuration = (ref$ = options != null ? options.duration : void 8) != null ? ref$ : 300;
div.currentScrollDuration = 0;
return include("../_shared/scrollTo/scrollTo")(div);
}
};
return requestAnimationFrame(function(){
return scroll();
});
};
};
})();
components/scrollDiv/functions/scrollToTop/scroll.ls
(function(){
return function(div){
var scrollContainer;
scrollContainer = div.scrollContainer;
return function(options){
var scroll;
scroll = function(){
var targetOffset, isCurrentTarget, ref$;
targetOffset = {
top: 0,
left: scrollContainer.scrollLeft
};
isCurrentTarget = _.isEqual(targetOffset, div.targetOffset);
div.targetOffset = targetOffset;
if (options != null && options.instant) {
scrollContainer.scrollTop = div.targetOffset.top;
return scrollContainer.scrollLeft = div.targetOffset.left;
} else {
if (isCurrentTarget && div.scrollFrameRunning) {
return;
}
div.scrollDuration = (ref$ = options != null ? options.duration : void 8) != null ? ref$ : 300;
div.currentScrollDuration = 0;
return include("../_shared/scrollTo/scrollTo")(div);
}
};
return requestAnimationFrame(function(){
return scroll();
});
};
};
})();
components/scrollDiv/functions/setScrollBarMargins/set.ls
(function(){
return function(div, initialMargins){
var lastScrollBarMargins, setMargins;
lastScrollBarMargins = initialMargins;
setMargins = function(margins, force){
var ref$;
if (!force && _.isEqual(margins, lastScrollBarMargins)) {
return;
}
lastScrollBarMargins = margins;
div.scrollBars.vertical.css({
marginTop: (ref$ = margins.top) != null ? ref$ : "",
marginBottom: (ref$ = margins.bottom) != null ? ref$ : "",
marginRight: (ref$ = margins.right) != null ? ref$ : ""
});
div.scrollBars.horizontal.css({
marginBottom: (ref$ = margins.bottom) != null ? ref$ : "",
marginLeft: (ref$ = margins.left) != null ? ref$ : "",
marginRight: (ref$ = margins.right) != null ? ref$ : ""
});
};
setMargins(lastScrollBarMargins, true);
return setMargins;
};
})();
components/scrollDiv/functions/setScrollEnabled/set.ls
(function(){
return function(div, scrollEnabled, scrollBarMode){
return function(options){
var ref$, x, y;
scrollEnabled.horizontal = _.isBoolean(options)
? options
: (ref$ = options != null ? options.horizontal : void 8) != null
? ref$
: scrollEnabled.horizontal;
scrollEnabled.vertical = _.isBoolean(options)
? options
: (ref$ = options != null ? options.vertical : void 8) != null
? ref$
: scrollEnabled.vertical;
if (scrollEnabled.horizontal) {
x = "scroll";
div.scrollBars.horizontal.setMode(scrollBarMode.horizontal);
} else {
x = "hidden";
div.scrollBars.horizontal.setMode("hide");
}
if (scrollEnabled.vertical) {
y = "scroll";
div.scrollBars.vertical.setMode(scrollBarMode.vertical);
} else {
y = "hidden";
div.scrollBars.vertical.setMode("hide");
}
div.scrollContainer.css({
overflowX: x,
overflowY: y
});
return div.content.css({
width: !scrollEnabled.horizontal ? "100%" : "",
height: !scrollEnabled.vertical ? "100%" : "",
paddingRight: "30px",
paddingBottom: "30px"
});
};
};
})();
components/scrollDiv/onScroll/calcNeedsUpdate/calc.ls
(function(){
return function(div){
var lastValues, calc;
lastValues = {
scrollTop: 0,
scrollLeft: 0,
scrollHeight: 0,
scrollWidth: 0,
offsetHeight: 0,
offsetWidth: 0
};
div.lastValues = lastValues;
return calc = function(){
var needsUpdate, n, v;
needsUpdate = false;
for (n in lastValues) {
v = div[n];
if (v !== lastValues[n]) {
needsUpdate = true;
lastValues[n] = v;
}
}
return needsUpdate;
};
};
})();
components/scrollDiv/onScroll/onScroll.ls
(function(){
return function(div, onScroll, scrollBarMode){
var needsUpdate, scopeRender, update, resize, modified, scroll;
needsUpdate = include("calcNeedsUpdate/calc")(div);
scopeRender = include("scopeRender/render");
update = function(forceUpdate){
if (!needsUpdate() && !forceUpdate) {
return;
}
if (typeof onScroll == 'function') {
onScroll();
}
if (scrollBarMode.horizontal !== "hide") {
div.scrollBars.horizontal.update();
}
if (scrollBarMode.vertical !== "hide") {
div.scrollBars.vertical.update();
}
return scopeRender(div);
};
div.updateScrollDiv = function(){
return update(true);
};
resize = function(){
return requestAnimationFrame(function(){
return requestAnimationFrame(update);
});
};
modified = function(e){
if (e == null || e.target === div.scrollContainer) {
return requestAnimationFrame(update);
}
};
scroll = function(e){
if (e == null || e.target === div.scrollContainer) {
inc("../scrollBackFix/update/update")(div);
return update();
}
};
div.scrollContainer.onWindowResize(resize);
div.scrollContainer.onChildrenModified(modified);
div.scrollContainer.onDomRemove(function(){
return body.unbind("scroll", scroll, true, true);
});
return div.scrollContainer.onDomAppend(function(){
body.bind("scroll", scroll, true, true);
return update();
});
};
})();
components/scrollDiv/onScroll/scopeRender/calcOffsetAndDistance/calc.ls
(function(){
return function(elements, scrollContainer){
var scopeCenter, i$, len$, el;
scopeCenter = {
x: scrollContainer.scrollLeft + scrollContainer.offsetWidth / 2,
y: scrollContainer.scrollTop + scrollContainer.offsetHeight / 2
};
for (i$ = 0, len$ = elements.length; i$ < len$; ++i$) {
el = elements[i$];
el.offsetInScrollContainer = include("calcOffset/calc")(el, scrollContainer);
el.scopeDistance = Math.pow(el.offsetInScrollContainer.top - scopeCenter.y, 2) + Math.pow(el.offsetInScrollContainer.left - scopeCenter.x, 2);
}
return elements;
};
})();
components/scrollDiv/onScroll/scopeRender/calcOffsetAndDistance/calcOffset/calc.ls
(function(){
return function(el, scrollContainer){
var top, left;
top = 0;
left = 0;
while (el !== scrollContainer) {
top += el.offsetTop;
left += el.offsetLeft;
el = el.parentNode;
}
return {
top: top,
left: left
};
};
})();
components/scrollDiv/onScroll/scopeRender/render.ls
(function(){
return function(div){
var scrollContainer, ref$, o, ref1$, render;
scrollContainer = div.scrollContainer;
if (!((ref$ = div.scopeRender) != null && ref$.enabled)) {
return;
}
o = div.scopeRender;
o.maxDurations == null && (o.maxDurations = "50 20 10");
o.maxDurationFirstFrameScope == null && (o.maxDurationFirstFrameScope = o.maxDurations.split(" ")[0]);
o.maxDurationPerFrameScope == null && (o.maxDurationPerFrameScope = o.maxDurations.split(" ")[1]);
o.maxDurationPerFrameNearScope == null && (o.maxDurationPerFrameNearScope = o.maxDurations.split(" ")[2]);
o.nearScopeSize == null && (o.nearScopeSize = 0.5);
o.maxDurationScope == null && (o.maxDurationScope = (ref1$ = o.maxDurationFirstFrameScope) != null
? ref1$
: o.maxDurationScope);
render = function(){
var elements, containerHeight, containerWidth, countNearScope, renderPass, renderPassNearScope;
if (!scrollContainer.isVisible()) {
scrollContainer.scopeRenderWaiting = false;
return;
}
elements = scrollContainer.getElementsByClassName("onScopeRender");
if (elements.length === 0) {
scrollContainer.scopeRenderWaiting = false;
return;
}
elements = include("calcOffsetAndDistance/calc")(elements, scrollContainer);
elements = _.orderBy(elements, "scopeDistance", "asc");
containerHeight = scrollContainer.offsetHeight;
containerWidth = scrollContainer.offsetWidth;
countNearScope = -1;
renderPass = include("renderElements/render")({
elements: elements,
topLimit: 0,
bottomLimit: containerHeight,
leftLimit: 0,
rightLimit: containerWidth,
scrollContainer: scrollContainer,
maxDuration: o.maxDurationScope
});
if (renderPass.count === 0) {
renderPassNearScope = include("renderElements/render")({
elements: elements,
topLimit: -containerHeight * o.nearScopeSize,
bottomLimit: containerHeight * (1 + o.nearScopeSize),
leftLimit: -containerWidth * o.nearScopeSize,
rightLimit: containerWidth * (1 + o.nearScopeSize),
scrollContainer: scrollContainer,
maxDuration: o.maxDurationPerFrameNearScope
});
}
if (o.debug) {
if (renderPass.count > 0) {
debug("scope " + renderPass.count + " in " + renderPass.duration + "ms (max=" + o.maxDurationScope + "ms)");
} else if (renderPassNearScope.count > 0) {
debug("nearScope " + renderPassNearScope.count + " in " + renderPassNearScope.duration + "ms (max=" + o.maxDurationPerFrameNearScope + "ms)");
}
}
if (renderPass.count > 0) {
o.maxDurationScope = o.maxDurationPerFrameScope;
}
if (renderPass.count <= 0 && renderPassNearScope.count <= 0) {
return scrollContainer.scopeRenderWaiting = false;
} else if (o.renderSlow) {
scrollContainer.scopeRenderWaiting = true;
return setTimeout(render, 500);
} else {
scrollContainer.scopeRenderWaiting = true;
return requestAnimationFrame(render);
}
};
return render();
};
})();
components/scrollDiv/onScroll/scopeRender/renderElements/render.ls
(function(){
return function(o){
var startedAt, count, duration, i$, ref$, len$, el, offsetTop, offsetLeft;
startedAt = new Date();
count = 0;
duration = 0;
for (i$ = 0, len$ = (ref$ = o.elements).length; i$ < len$; ++i$) {
el = ref$[i$];
offsetTop = el.offsetInScrollContainer.top - o.scrollContainer.scrollTop;
if (offsetTop + el.offsetHeight < o.topLimit || offsetTop > o.bottomLimit) {
continue;
}
offsetLeft = el.offsetInScrollContainer.left - o.scrollContainer.scrollLeft;
if (offsetLeft + el.offsetWidth < o.leftLimit || offsetLeft > o.rightLimit) {
continue;
}
el.removeClass("onScopeRender");
el.onScopeRenderHandler();
count++;
duration = new Date() - startedAt;
if (duration > o.maxDuration) {
break;
}
}
return {
count: count,
duration: duration
};
};
})();
components/scrollDiv/overwriteProperties/defineProperty/define.ls
(function(){
return function(div, p, v){
return Object.defineProperty(div, p, {
configurable: true,
enumerable: true,
get: v.get,
set: v.set
});
};
})();
components/scrollDiv/overwriteProperties/overwrite.ls
(function(){
return function(div){
var properties, p, v, results$ = [];
properties = {
"append": {
get: function(){
return function(){
div.content.append(arguments);
return this;
};
}
},
"prepend": {
get: function(){
return function(){
div.content.prepend(arguments);
return this;
};
}
},
"html": {
get: function(){
return function(){
div.content.html(arguments);
return this;
};
}
},
"secureHtml": {
get: function(){
return function(){
div.content.secureHtml(arguments);
return this;
};
}
},
"text": {
get: function(){
return function(){
div.content.text(arguments);
return this;
};
}
},
"empty": {
get: function(){
return function(){
div.content.empty(arguments);
return this;
};
}
},
"scrollTop": {
get: function(){
return div.scrollContainer.scrollTop;
},
set: function(value){
div.scrollContainer.scrollTop = value;
if (div.enableScrollBackFix) {
div.lastValues.scrollTop = value;
return div.updateScrollDiv();
}
}
},
"scrollHeight": {
get: function(){
return div.scrollContainer.scrollHeight;
}
},
"scrollLeft": {
get: function(){
return div.scrollContainer.scrollLeft;
},
set: function(value){
return div.scrollContainer.scrollLeft = value;
}
},
"scrollWidth": {
get: function(){
return div.scrollContainer.scrollWidth;
}
},
"childrenAll": {
get: function(){
return function(){
return div.content.childrenAll();
};
}
}
};
for (p in properties) {
v = properties[p];
results$.push(include("defineProperty/define")(div, p, v));
}
return results$;
};
})();
components/scrollDiv/scrollBackFix/reset/reset.ls
(function(){
return function(div){
div.scrollBackFix = 0;
div.content.css({
borderBottom: div.scrollBackFix + "px solid transparent"
});
return div.lastValues.scrollTop = div.scrollTop;
};
})();
components/scrollDiv/scrollBackFix/update/update.ls
(function(){
return function(div){
var dif, d, fix;
if (!div.enableScrollBackFix) {
return;
}
if (div.lastValues.scrollTop > div.scrollTop && (div.scrollHeight !== div.lastValues.scrollHeight || div.offsetHeight !== div.lastValues.offsetHeight)) {
dif = div.lastValues.scrollTop - div.scrollTop;
div.scrollBackFix == null && (div.scrollBackFix = 0);
div.scrollBackFix += dif;
div.content.css({
borderBottom: div.scrollBackFix + "px solid transparent"
});
return div.scrollContainer.scrollTop = div.lastValues.scrollTop;
} else if (div.scrollBackFix > 0) {
d = div.scrollContainer;
d = d.scrollHeight - (d.scrollTop + d.offsetHeight);
if (d <= 0) {
return;
}
fix = div.scrollBackFix - d;
fix = Math.max(0, fix);
div.scrollBackFix = fix;
fix = Math.ceil(fix);
return div.content.css({
borderBottom: fix + "px solid transparent"
});
}
};
})();
components/scrollDiv/scrollBars/scrollBar/background/background.ls
(function(){
return function(o){
var div;
div = Div().addClass("scrollBar").css({
pointerEvents: "none"
}).css({
position: "absolute",
top: o.orientation === "vertical" ? 0 : void 8,
left: o.orientation !== "vertical" ? 0 : void 8,
bottom: 0,
right: 0,
width: o.orientation === "vertical" ? "0.7em" : void 8,
height: o.orientation !== "vertical" ? "0.7em" : void 8,
zIndex: 2
});
return o.background = div;
};
})();
components/scrollDiv/scrollBars/scrollBar/bar/bar.ls
(function(){
return function(o){
var updateThickness, div, div2;
updateThickness = function(){
var w;
w = body.width();
w = w < 500
? "0.25em"
: w < 800 ? "0.3em" : "0.35em";
return div2.css({
width: o.orientation === "vertical" ? w : void 8,
height: o.orientation !== "vertical" ? w : void 8
});
};
div = Div().addClass("scrollDiv_bar").css({
position: "absolute",
cursor: "pointer",
willChange: "transform",
pointerEvents: !engine.isMobileApp ? "auto" : void 8,
top: o.orientation === "vertical" ? 0 : void 8,
right: o.orientation === "vertical" ? 0 : void 8,
bottom: o.orientation !== "vertical" ? 0 : void 8,
left: o.orientation !== "vertical" ? 0 : void 8,
width: o.orientation === "vertical" ? "100%" : void 8,
height: o.orientation !== "vertical" ? "100%" : void 8
}).append(div2 = Div().css({
position: "absolute",
height: o.orientation === "vertical" ? "100%" : "0.2em",
width: o.orientation === "vertical" ? "0.2em" : "100%",
backgroundColor: Color.grey[700],
right: o.orientation === "vertical" ? 0 : void 8,
left: o.orientation !== "vertical" ? 0 : void 8,
top: o.orientation === "vertical" ? 0 : void 8,
bottom: o.orientation !== "vertical" ? 0 : void 8,
borderRadius: "0.1em",
opacity: 0.3
})).appendTo(o.background).onWindowResize(updateThickness);
updateThickness();
if (o.mode === "hide") {
div.hide();
}
return o.bar = div;
};
})();
components/scrollDiv/scrollBars/scrollBar/drag/drag.ls
(function(){
return function(o){
var x, y, onDrag, mouseDown, mouseMove, mouseUp;
x = null;
y = null;
onDrag = function(delta){
var scrollContainer, scrollDimension, ref$, dimension, backgroundDimension, handlerDimension;
if (delta === 0) {
return;
}
scrollContainer = o.div.scrollContainer;
if (o.orientation === "vertical") {
scrollDimension = (ref$ = o.div.scrollHeightCustom) != null
? ref$
: scrollContainer.scrollHeight;
dimension = o.div.offsetHeight;
backgroundDimension = o.background.offsetHeight;
} else {
scrollDimension = scrollContainer.scrollWidth;
dimension = o.div.offsetWidth;
backgroundDimension = o.background.offsetWidth;
}
handlerDimension = dimension / scrollDimension * dimension;
delta = delta * dimension / handlerDimension;
delta = delta * dimension / backgroundDimension;
if (o.orientation === "vertical") {
return scrollContainer.scrollTop += delta;
} else {
return scrollContainer.scrollLeft += delta;
}
};
mouseDown = function(e){
x = e.clientX;
y = e.clientY;
body.bind("mousemove", mouseMove);
return body.bind("mouseup", mouseUp);
};
mouseMove = function(e){
var dy, dx;
e.stopPropagation();
e.preventDefault();
if (o.orientation === "vertical") {
dy = e.clientY - y;
y = e.clientY;
return onDrag(dy);
} else {
dx = e.clientX - x;
x = e.clientX;
return onDrag(dx);
}
};
mouseUp = function(e){
body.unbind("mousemove", mouseMove);
return body.unbind("mouseup", mouseUp);
};
return o.bar.bind("mousedown", mouseDown);
};
})();
components/scrollDiv/scrollBars/scrollBar/onFrame/onFrameHorizontal.ls
(function(){
return function(o){
var lastBarWidth, lastBarLeft, minWidth, hideTimeOut, onHideTimeout, onFrame;
lastBarWidth = null;
lastBarLeft = null;
minWidth = 20;
hideTimeOut = null;
onHideTimeout = function(){
var hideTimeOut;
o.bar.fadeOut();
return hideTimeOut = null;
};
onFrame = function(){
var wrapperWidth, contentWidth, scrollLeft, barWidth, barLeft, isScrollable, w, x;
wrapperWidth = o.div.scrollContainer.offsetWidth;
contentWidth = o.div.scrollContainer.scrollWidth;
scrollLeft = o.div.scrollContainer.scrollLeft;
barWidth = wrapperWidth / contentWidth * wrapperWidth;
barLeft = scrollLeft / contentWidth * wrapperWidth;
barWidth = _.round(barWidth);
barLeft = _.round(barLeft);
if (barWidth < minWidth) {
barLeft -= (minWidth - barWidth) * (scrollLeft / (contentWidth - wrapperWidth));
barWidth = minWidth;
}
isScrollable = contentWidth - 2 > wrapperWidth;
o.div.isScrollable.horizontal = isScrollable;
o.div.scrollContainer.css({
overflowX: isScrollable && o.scrollEnabled ? "scroll" : "hidden"
});
if (!isScrollable || o.mode === "hide") {
return o.bar.hide();
} else {
o.bar.show();
if (o.mode === "auto") {
clearTimeout(hideTimeOut);
hideTimeOut = setTimeout(onHideTimeout, o.fadeOutDelay);
}
if (barWidth !== lastBarWidth) {
lastBarWidth = barWidth;
w = barWidth / wrapperWidth * o.background.offsetWidth;
o.bar.css({
width: w + "px"
});
}
if (barLeft !== lastBarLeft) {
lastBarLeft = barLeft;
x = barLeft / wrapperWidth * o.background.offsetWidth;
return o.bar.css({
transform: "translateX(" + x + "px)"
});
}
}
};
if (o.mode === "auto") {
hideTimeOut = setTimeout(onHideTimeout, o.fadeOutDelay);
}
return onFrame;
};
})();
components/scrollDiv/scrollBars/scrollBar/onFrame/onFrameVertical.ls
(function(){
return function(o){
var lastBarHeight, lastBarTop, minHeight, hideTimeOut, onHideTimeout, onFrame;
lastBarHeight = null;
lastBarTop = null;
minHeight = 20;
hideTimeOut = null;
onHideTimeout = function(){
var hideTimeOut;
o.bar.fadeOut();
return hideTimeOut = null;
};
onFrame = function(){
var wrapperHeight, ref$, contentHeight, scrollTop, barHeight, barTop, isScrollable, h, y;
wrapperHeight = (ref$ = o.div.scrollWrapperHeight) != null
? ref$
: o.div.scrollContainer.offsetHeight;
contentHeight = (ref$ = o.div.scrollHeightCustom) != null
? ref$
: o.div.scrollContainer.scrollHeight;
scrollTop = (ref$ = o.div.scrollTopCustom) != null
? ref$
: o.div.scrollContainer.scrollTop;
barHeight = wrapperHeight / contentHeight * wrapperHeight;
barTop = scrollTop / contentHeight * wrapperHeight;
barHeight = _.round(barHeight);
barTop = _.round(barTop);
if (barHeight < minHeight) {
barTop -= (minHeight - barHeight) * (scrollTop / (contentHeight - wrapperHeight));
barHeight = minHeight;
}
isScrollable = contentHeight - 2 > wrapperHeight;
o.div.isScrollable.vertical = isScrollable;
o.div.scrollContainer.css({
overflowY: isScrollable && o.scrollEnabled ? "scroll" : "hidden"
});
if (!isScrollable || o.mode === "hide") {
return o.bar.hide();
} else {
o.bar.show();
if (o.mode === "auto") {
clearTimeout(hideTimeOut);
hideTimeOut = setTimeout(onHideTimeout, o.fadeOutDelay);
}
if (barHeight !== lastBarHeight) {
lastBarHeight = barHeight;
h = barHeight / wrapperHeight * o.background.offsetHeight;
o.bar.css({
height: h + "px"
});
}
if (barTop !== lastBarTop) {
lastBarTop = barTop;
y = barTop / wrapperHeight * o.background.offsetHeight;
return o.bar.css({
transform: "translateY(" + y + "px)"
});
}
}
};
if (o.mode === "auto") {
hideTimeOut = setTimeout(onHideTimeout, o.fadeOutDelay);
}
return onFrame;
};
})();
components/scrollDiv/scrollBars/scrollBar/scrollBar.ls
(function(){
return function(div, orientation, mode, scrollEnabled){
var o, update;
o = {
div: div,
orientation: orientation,
mode: mode,
fadeOutDelay: 2000,
scrollEnabled: scrollEnabled
};
include("background/background")(o);
include("bar/bar")(o);
update = o.orientation === "vertical"
? include("onFrame/onFrameVertical")(o)
: include("onFrame/onFrameHorizontal")(o);
include("drag/drag")(o);
o.background.setMode = function(mode){
o.mode = mode;
if (mode === "hide") {
return o.bar.hide();
} else if (mode === "show") {
return o.bar.show();
}
};
o.background.update = function(){
return update();
};
return o.background;
};
})();
components/scrollDiv/scrollBars/scrollBars.ls
(function(){
return function(div, scrollBarMode, scrollEnabled){
var scrollbars;
scrollbars = {
vertical: include("scrollBar/scrollBar")(div, "vertical", scrollBarMode.vertical, scrollEnabled.vertical),
horizontal: include("scrollBar/scrollBar")(div, "horizontal", scrollBarMode.horizontal, scrollEnabled.horizontal)
};
return scrollbars;
};
})();
components/scrollDiv/scrollDiv.ls
(function(){
return function(o){
var scrollEnabled, ref$, ref1$, ref2$, scrollBarMargins, defaultScrollBarMode, scrollBarMode, ref3$, ref4$, div;
return inc("../scrollDivNext/scrollDivNext")(o);
o == null && (o = {});
include("cssHeader/cssHeader")();
scrollEnabled = {
horizontal: (ref$ = o.enableHorizontalScroll) != null
? ref$
: (ref$ = (ref1$ = o.enableScroll) != null ? ref1$.horizontal : void 8) != null
? ref$
: (ref$ = o.enableScroll) != null ? ref$ : true,
vertical: (ref$ = o.enableVerticalScroll) != null
? ref$
: (ref$ = (ref2$ = o.enableScroll) != null ? ref2$.vertical : void 8) != null
? ref$
: (ref$ = o.enableScroll) != null ? ref$ : true
};
scrollBarMargins = o.scrollBarMargins;
scrollBarMargins == null && (scrollBarMargins = {
left: 0,
top: 0,
bottom: 0,
right: 0
});
defaultScrollBarMode = include("calcDefaultScrollBarMode/calc")();
scrollBarMode = {
horizontal: scrollEnabled.horizontal ? (ref$ = (ref3$ = o.scrollBarMode) != null ? ref3$.horizontal : void 8) != null
? ref$
: (ref$ = o.scrollBarMode) != null ? ref$ : defaultScrollBarMode : "hide",
vertical: scrollEnabled.vertical ? (ref$ = (ref4$ = o.scrollBarMode) != null ? ref4$.vertical : void 8) != null
? ref$
: (ref$ = o.scrollBarMode) != null ? ref$ : defaultScrollBarMode : "hide"
};
div = Div().addClass("scrollDiv");
div.css({
overflow: "hidden",
display: "flex",
flexDirection: "column",
alignItems: "stretch",
justifyContent: "flex-start"
}).append(div.scrollContainer = Div().addClass("scrollDivContainer").css({
flex: "1 1 auto",
marginBottom: "-30px",
marginRight: "-30px",
overflowX: scrollEnabled.horizontal ? "scroll" : "hidden",
overflowY: scrollEnabled.vertical ? "scroll" : "hidden",
webkitOverflowScrolling: "touch"
}).append(div.content = Div().css({
paddingRight: "30px",
paddingBottom: "30px",
minWidth: "100%",
minHeight: "100%",
width: !scrollEnabled.horizontal ? "calc(100% - 30px)" : void 8,
height: !scrollEnabled.vertical ? "calc(100% - 10px)" : void 8,
float: "left"
}))).bind("touchstart mousedown", function(){
return div.preventAutoScroll = true;
}, true, true).bind("touchend touchcancel mouseup mousecancel", function(){
return div.preventAutoScroll = false;
}, true, true).bind("mousewheel", function(){
div.preventAutoScroll = true;
return setTimeout(function(){
return div.preventAutoScroll = false;
}, 500);
}, true, true);
div.isScrollable = {
horizontal: false,
vertical: false
};
div.scrollBars = include("scrollBars/scrollBars")(div, scrollBarMode, scrollEnabled);
div.scopeRender = o.scopeRender;
div.enableScrollBackFix = o.enableScrollBackFix || false;
div.append(_.values(div.scrollBars));
include("onScroll/onScroll")(div, o.onScroll, scrollBarMode);
include("overwriteProperties/overwrite")(div);
div.setScrollBarMargins = include("functions/setScrollBarMargins/set")(div, scrollBarMargins);
div.setScrollEnabled = include("functions/setScrollEnabled/set")(div, scrollEnabled, scrollBarMode);
div.scrollBarMode = include("functions/scrollBarMode/scrollBarMode")(div, scrollBarMode);
div.fitSizeToContent = include("functions/fitSizeToContent/fit")(div);
div.scrollElementIntoView = include("functions/scrollElementIntoView/scroll")(div);
div.scrollToTop = include("functions/scrollToTop/scroll")(div);
div.scrollToPosition = include("functions/scrollToPosition/scroll")(div);
div.resetScrollBackFix = function(){
return inc("scrollBackFix/reset/reset")(div);
};
div.updateScrollBackFix = function(){
return inc("scrollBackFix/update/update")(div);
};
return div;
};
})();
components/scrollDivNext/div/_overwriteProperties/overwrite.ls
(function(){
return function(div, s){
var props, p, v, results$ = [];
div.cssOriginal = div.css;
props = {
html: {
get: function(){
return function(){
s.contentDiv.html(arguments);
return this;
};
}
},
append: {
get: function(){
return function(){
s.contentDiv.append(arguments);
return this;
};
}
},
prepend: {
get: function(){
return function(){
s.contentDiv.prepend(arguments);
return this;
};
}
},
secureHtml: {
get: function(){
return function(){
s.contentDiv.secureHtml(arguments);
return this;
};
}
},
text: {
get: function(){
return function(){
s.contentDiv.text(arguments);
return this;
};
}
},
empty: {
get: function(){
return function(){
s.contentDiv.empty(arguments);
return this;
};
}
},
childrenAll: {
get: function(){
return function(){
return s.contentDiv.childrenAll();
};
}
},
css: {
get: function(){
return function(css){
var p, v, cssProperty;
if (_.isString(css)) {
return div.cssOriginal(css);
}
for (p in css) {
v = css[p];
cssProperty = {};
cssProperty[p] = v;
if (_.includes(p, "overflow")) {
throw Error("dont use overflow css in ScrollDiv!");
} else if (_.includes(p, "padding")) {
s.contentDiv.css(cssProperty);
} else {
div.cssOriginal(cssProperty);
}
}
return this;
};
}
},
scrollHeight: {
get: function(){
return s.scrollContainerDiv.scrollHeight;
}
},
scrollWidth: {
get: function(){
return s.scrollContainerDiv.scrollWidth;
}
},
scrollTop: {
get: function(){
return s.scrollContainerDiv.scrollTop;
},
set: function(v){
return s.scrollContainerDiv.scrollTop = v;
}
},
scrollLeft: {
get: function(){
return s.scrollContainerDiv.scrollLeft;
},
set: function(v){
return s.scrollContainerDiv.scrollLeft = v;
}
}
};
for (p in props) {
v = props[p];
results$.push(Object.defineProperty(div, p, {
configurable: true,
enumerable: true,
get: v.get,
set: v.set
}));
}
return results$;
};
})();
components/scrollDivNext/div/centerSpacer/spacer.ls
(function(){
return function(){
return Div({
flex: "1 1 auto"
}).addClass("centerSpacer").hide();
};
})();
components/scrollDivNext/div/contentDiv/div.ls
(function(){
return function(s){
var div;
div = Div({
minWidth: "100%",
minHeight: "100%",
borderRight: "",
borderBottom: "",
maxWidth: ""
});
return s.contentDiv = div;
};
})();
components/scrollDivNext/div/cropDiv/div.ls
(function(){
return function(s){
var div;
div = Div({
flex: "1 1 auto",
alignSelf: "stretch",
display: "flex",
flexDirection: "column",
justifyContent: "flex-start",
alignItems: "stretch",
overflow: "hidden"
});
inc("neverScroll/never")(div);
return s.cropDiv = div;
};
})();
components/scrollDivNext/div/cropDiv/neverScroll/never.ls
(function(){
return function(div){
return div.bind("scroll", function(){
div.scrollTop = 0;
return div.scrollLeft = 0;
});
};
})();
components/scrollDivNext/div/div.ls
(function(){
return function(s){
var div;
div = Div({
display: "flex",
flexDirection: "column",
justifyContent: "flex-start",
alignItems: "stretch",
overflow: "hidden"
}).addClass("scrollDiv").html(inc("resizeDetectionObject/object")(s, "outside"), inc("cropDiv/div")(s).html(inc("scrollContainerDiv/div")(s).html(inc("centerSpacer/spacer")(), s.contentOutsideDiv = Div({
minHeight: "100%",
minWidth: "100%",
maxWidth: "100%",
overflow: "hidden",
display: "flex",
flexDirection: "column",
alignItems: "flex-start",
justifyContent: "flex-start"
}).html(inc("resizeDetectionObject/object")(s, "inside"), inc("contentDiv/div")(s)), inc("centerSpacer/spacer")())));
inc("_overwriteProperties/overwrite")(div, s);
return s.div = div;
};
})();
components/scrollDivNext/div/resizeDetectionObject/object.ls
(function(){
return function(s, type){
var onResize, obj;
onResize = function(e){
return s.onResize(type, e);
};
return obj = document.createElement("object").attr({
type: "text/html",
data: "about:blank"
}).css({
position: "absolute",
top: 0,
left: 0,
width: "100%",
height: "100%",
visibility: "hidden"
}).bind("load", function(){
var e;
onResize("onLoaded");
try {
return obj.contentWindow.addEventListener("resize", onResize);
} catch (e$) {
e = e$;
try {
return obj.contentDocument.addEventListener("resize", onResize);
} catch (e$) {}
}
});
};
})();
components/scrollDivNext/div/scrollContainerDiv/cssHeader/cssHeader.ls
(function(){
return function(){
var s;
if (document.head == null || document.head.findFirst('#scrollContainerDivStyle')) {
return;
}
s = Style().attr({
id: "scrollContainerDivStyle"
});
s.innerHTML = ".scrollContainerDiv::-webkit-scrollbar{display: none;}";
return document.head.append(s);
};
})();
components/scrollDivNext/div/scrollContainerDiv/div.ls
(function(){
var isOldSafari;
isOldSafari = inc("isSafari_iOs13_or_less/is")();
return function(s){
var div;
inc("cssHeader/cssHeader")();
div = Div({
flex: "1 1 auto",
alignSelf: "stretch",
display: "flex",
flexDirection: "column",
alignItems: "flex-start",
justifyContent: "flex-start",
minWidth: "100%",
minHeight: "100%",
overflow: "",
marginRight: "",
marginBottom: ""
}).css(isOldSafari ? {
webkitOverflowScrolling: "touch"
} : void 8).addClass("scrollContainerDiv").onWindowResize(function(){
return s.refresh();
}).onDomAppend(function(){
return s.refresh();
}).bind("scroll", function(e){
return s.onScroll(e);
});
inc("onChildrenModified/on")(s, div);
return s.scrollContainerDiv = div;
};
})();
components/scrollDivNext/div/scrollContainerDiv/isSafari_iOs13_or_less/is.ls
(function(){
return function(){
var version, mVersion;
version = navigator.userAgent.match(/Version\/(\d+)\.(\d+)\.?(\d+)?/);
mVersion = version != null ? version[1] : void 8;
return mVersion && +mVersion <= 13;
};
})();
components/scrollDivNext/div/scrollContainerDiv/onChildrenModified/on.ls
(function(){
return function(s, div){
var onMutations, observer, config;
if (div.mutationObserver) {
div.mutationObserver.disconnect();
}
onMutations = function(mutationRecords){
var i$, len$, mutation, onScopeRenderElements, results$ = [];
for (i$ = 0, len$ = mutationRecords.length; i$ < len$; ++i$) {
mutation = mutationRecords[i$];
onScopeRenderElements = mutation.target.querySelectorAll('.onScopeRender');
if (onScopeRenderElements.length !== 0) {
results$.push(s.refresh());
}
}
return results$;
};
observer = new MutationObserver(onMutations);
config = {
childList: true,
subtree: true,
attributes: false,
characterData: false
};
observer.observe(div, config);
return div.mutationObserver = observer;
};
})();
components/scrollDivNext/isScrollable/is.ls
(function(){
return function(s, type){
var wrapperWidth, contentWidth, wrapperHeight, contentHeight;
if (type === "x") {
wrapperWidth = s.scrollContainerDiv.offsetWidth;
contentWidth = s.scrollContainerDiv.scrollWidth;
return wrapperWidth < contentWidth;
} else if (type === "y") {
wrapperHeight = s.scrollContainerDiv.offsetHeight;
contentHeight = s.scrollContainerDiv.scrollHeight;
return wrapperHeight < contentHeight;
}
};
})();
components/scrollDivNext/onResize/on.ls
(function(){
return function(s, type, e){
var ref$;
s.refresh();
return typeof (ref$ = s.params).onResize == 'function' ? ref$.onResize(type, e) : void 8;
};
})();
components/scrollDivNext/onScroll/on.ls
(function(){
return function(s, e){
var ref$;
s.refresh(e);
return typeof (ref$ = s.params).onScroll == 'function' ? ref$.onScroll() : void 8;
};
})();
components/scrollDivNext/refresh/hideMinScrollRange/x/hide.ls
(function(){
return function(s){
var sc, range;
sc = s.scrollContainerDiv;
range = sc.scrollWidth - sc.offsetWidth;
if (range <= s.minScrollRangeX) {
sc.css({
overflowX: "hidden"
});
s.scrollbarX.hide();
} else {
sc.css({
overflowX: "scroll"
});
s.scrollbarX.show();
}
};
})();
components/scrollDivNext/refresh/hideMinScrollRange/y/hide.ls
(function(){
return function(s){
var sc, range;
sc = s.scrollContainerDiv;
range = sc.scrollHeight - sc.offsetHeight;
if (range <= s.minScrollRangeY) {
sc.css({
overflowY: "hidden"
});
s.scrollbarY.hide();
} else {
sc.css({
overflowY: "scroll"
});
s.scrollbarY.show();
}
};
})();
components/scrollDivNext/refresh/refresh.ls
(function(){
return function(s, scrollEvent){
inc("scrollBackStop/stop")(s);
inc("scopeRender/render")(s);
if (s.enableScrollY) {
inc("hideMinScrollRange/y/hide")(s);
inc("setScrollbarAutoHide/set")(s, scrollEvent, s.scrollbarY);
s.scrollbarY.update();
}
if (s.enableScrollX) {
inc("hideMinScrollRange/x/hide")(s);
inc("setScrollbarAutoHide/set")(s, scrollEvent, s.scrollbarX);
s.scrollbarX.update();
}
};
})();
components/scrollDivNext/refresh/scopeRender/render.ls
(function(){
return function(s){
var ref$;
if (!((ref$ = s.scopeRender) != null && ref$.enabled) || s.scopeRenderIsBusy) {
return;
}
inc("render/render")(s);
};
})();
components/scrollDivNext/refresh/scopeRender/render/debugMessage/debug.ls
(function(){
return function(s, rInScope, rNearScope){
var m;
m = "";
if (rInScope.count > 0) {
m += "rendering " + rInScope.count + " in scope in " + rInScope.duration + "ms (max=" + rInScope.maxDuration + "ms)";
} else if (rNearScope.count > 0) {
m += "rendering " + rNearScope.count + " in near scope in " + rNearScope.duration + "ms (max=" + rNearScope.maxDuration + "ms)";
}
if (!s.scopeRenderIsBusy) {
m += "all done";
}
return debug(m);
};
})();
components/scrollDivNext/refresh/scopeRender/render/getParams/get.ls
(function(){
return function(s){
var that, sc, a, ref$, ref1$;
if (that = s.scopeRender.params) {
return that;
}
sc = s.scopeRender;
a = (ref$ = (ref1$ = sc.maxDurations) != null ? ref1$.split(" ") : void 8) != null
? ref$
: [];
return sc.params = {
nearScopeSize: (ref$ = sc.nearScopeSize) != null ? ref$ : 0.5,
debug: (ref$ = sc.debug) != null ? ref$ : false,
maxDurationFirstFrameScope: (ref$ = a[0]) != null ? ref$ : 50,
maxDurationPerFrameScope: (ref$ = a[1]) != null ? ref$ : 20,
maxDurationPerFrameNearScope: (ref$ = a[2]) != null ? ref$ : 10
};
};
})();
components/scrollDivNext/refresh/scopeRender/render/getPendingElementsSortedByDistance/get.ls
(function(){
return function(s){
var sc, elements;
sc = s.scrollContainerDiv;
elements = sc.getElementsByClassName("onScopeRender");
if (elements.length === 0) {
return [];
}
return elements = inc("sortByDistance/sort")(elements, sc);
};
})();
components/scrollDivNext/refresh/scopeRender/render/getPendingElementsSortedByDistance/sortByDistance/calcElementOffset/calc.ls
(function(){
return function(el, scrollContainer){
var top, left;
top = 0;
left = 0;
while (el !== scrollContainer) {
top += el.offsetTop;
left += el.offsetLeft;
el = el.parentNode;
}
return {
top: top,
left: left
};
};
})();
components/scrollDivNext/refresh/scopeRender/render/getPendingElementsSortedByDistance/sortByDistance/sort.ls
(function(){
return function(elements, sc){
var scopeCenter, i$, len$, el;
scopeCenter = {
x: sc.scrollLeft + sc.offsetWidth / 2,
y: sc.scrollTop + sc.offsetHeight / 2
};
for (i$ = 0, len$ = elements.length; i$ < len$; ++i$) {
el = elements[i$];
el.offsetInScrollContainer = include("calcElementOffset/calc")(el, sc);
el.scopeDistance = Math.pow(el.offsetInScrollContainer.top - scopeCenter.y, 2) + Math.pow(el.offsetInScrollContainer.left - scopeCenter.x, 2);
}
return _.orderBy(elements, "scopeDistance", "asc");
};
})();
components/scrollDivNext/refresh/scopeRender/render/render.ls
(function(){
return function(s){
var sc, cd, params, elements, resultInScope, resultNearScope;
sc = s.scrollContainerDiv;
cd = s.cropDiv;
params = inc("getParams/get")(s);
elements = inc("getPendingElementsSortedByDistance/get")(s);
if (elements.length === 0 || !sc.isVisible()) {
s.scopeRenderIsBusy = false;
return;
}
resultInScope = include("renderElements/render")({
elements: elements,
topLimit: 0,
bottomLimit: cd.offsetHeight,
leftLimit: 0,
rightLimit: cd.offsetWidth,
scrollContainer: sc,
maxDuration: s.scopeRenderIsBusy != null && !s.scopeRenderIsBusy
? params.maxDurationFirstFrameScope
: params.maxDurationPerFrameScope
});
s.scopeRenderIsBusy = true;
if (resultInScope.count === 0) {
resultNearScope = include("renderElements/render")({
elements: elements,
topLimit: -cd.offsetHeight * params.nearScopeSize,
bottomLimit: cd.offsetHeight * (1 + params.nearScopeSize),
leftLimit: -cd.offsetWidth * params.nearScopeSize,
rightLimit: cd.offsetWidth * (1 + params.nearScopeSize),
scrollContainer: sc,
maxDuration: params.maxDurationPerFrameNearScope
});
}
if ((resultInScope != null ? resultInScope.count : void 8) > 0 || (resultNearScope != null ? resultNearScope.count : void 8) > 0) {
requestAnimationFrame(function(){
return inc(THISFILE)(s);
});
} else {
s.scopeRenderIsBusy = false;
}
if (params.debug) {
inc("debugMessage/debug")(s, resultInScope, resultNearScope);
}
};
})();
components/scrollDivNext/refresh/scopeRender/render/renderElements/isInScope/is.ls
(function(){
return function(el, renderObj){
var offsetTop, offsetLeft;
offsetTop = el.offsetInScrollContainer.top - renderObj.scrollContainer.scrollTop;
if (offsetTop + el.offsetHeight < renderObj.topLimit || offsetTop > renderObj.bottomLimit) {
return false;
}
offsetLeft = el.offsetInScrollContainer.left - renderObj.scrollContainer.scrollLeft;
if (offsetLeft + el.offsetWidth < renderObj.leftLimit || offsetLeft > renderObj.rightLimit) {
return false;
}
return true;
};
})();
components/scrollDivNext/refresh/scopeRender/render/renderElements/render.ls
(function(){
return function(renderObj){
var startedAt, count, duration, i$, ref$, len$, el;
startedAt = new Date();
count = 0;
duration = 0;
for (i$ = 0, len$ = (ref$ = renderObj.elements).length; i$ < len$; ++i$) {
el = ref$[i$];
if (!inc("isInScope/is")(el, renderObj)) {
continue;
}
el.removeClass("onScopeRender");
el.onScopeRenderHandler();
count++;
duration = new Date() - startedAt;
if (duration > renderObj.maxDuration) {
break;
}
}
return {
count: count,
duration: duration,
maxDuration: renderObj.maxDuration
};
};
})();
components/scrollDivNext/refresh/scrollBackStop/calcCompensation/calc.ls
(function(){
return function(s, sc){
var comp;
comp = sc.lastValues.scrollTop - sc.scrollTop;
sc.scrollBackComp == null && (sc.scrollBackComp = 0);
sc.scrollBackComp += comp;
s.contentDiv.css({
borderBottom: sc.scrollBackComp + "px solid transparent"
});
sc.scrollTop = sc.lastValues.scrollTop;
};
})();
components/scrollDivNext/refresh/scrollBackStop/reset/reset.ls
(function(){
return function(s){
var sc;
sc = s.scrollContainerDiv;
s.contentDiv.css({
borderBottom: 0 + "px solid transparent"
});
sc.scrollBackStop = 0;
sc.lastValues.scrollTop = sc.scrollTop;
s.refresh();
};
})();
components/scrollDivNext/refresh/scrollBackStop/stop.ls
(function(){
return function(s){
var sc, ref$, ref1$, ref2$;
if (!s.enableScrollBackStop) {
return;
}
sc = s.scrollContainerDiv;
if (((ref$ = sc.lastValues) != null ? ref$.scrollTop : void 8) > sc.scrollTop && (sc.scrollHeight !== ((ref1$ = sc.lastValues) != null ? ref1$.scrollHeight : void 8) || sc.offsetHeight !== ((ref2$ = sc.lastValues) != null ? ref2$.offsetHeight : void 8))) {
inc("calcCompensation/calc")(s, sc);
} else if (sc.scrollBackComp > 0) {
inc("updateCompensation/update")(s, sc);
}
sc.lastValues = {
scrollTop: sc.scrollTop,
scrollLeft: sc.scrollLeft,
scrollHeight: sc.scrollHeight,
scrollWidth: sc.scrollWidth,
offsetHeight: sc.offsetHeight,
offsetWidth: sc.offsetWidth
};
};
})();
components/scrollDivNext/refresh/scrollBackStop/updateCompensation/update.ls
(function(){
return function(s, sc){
var dif, comp;
dif = sc.scrollHeight - (sc.scrollTop + sc.offsetHeight);
if (dif <= 0) {
return;
}
comp = sc.scrollBackComp - dif;
sc.scrollBackComp = comp >= 0 ? Math.ceil(comp) : 0;
s.contentDiv.css({
borderBottom: sc.scrollBackComp + "px solid transparent"
});
};
})();
components/scrollDivNext/refresh/setScrollbarAutoHide/set.ls
(function(){
return function(s, scrollEvent, div){
if (s.scrollbarMode === "show") {
div.css({
opacity: 1,
transition: ""
});
clearTimeout(div.autoTimeout);
return;
}
if (div.scrollEventCounter == null) {
div.css({
opacity: 0
});
div.scrollEventCounter = 0;
return;
}
if (!scrollEvent) {
return;
}
if (div.scrollEventCounter <= 2) {
div.scrollEventCounter++;
return;
}
div.css({
opacity: 1,
transition: ""
});
clearTimeout(div.autoTimeout);
if (!s.fadeInScrollbarOnHover) {
div.firstChild.css({
pointerEvents: "auto"
});
}
if (!div.hoverEnabled && !div.dragEnabled) {
div.autoTimeout = setTimeout(function(){
if (!s.fadeInScrollbarOnHover) {
div.firstChild.css({
pointerEvents: "none"
});
}
return div.customFadeOut();
}, 2000);
}
};
})();
components/scrollDivNext/scrollDivNext.ls
(function(){
return function(params){
var s, p, ref$, div, a, i$, len$, n;
s = {};
p = params != null
? params
: {};
s.params = p;
s.enableScrollX = (ref$ = p.enableScrollX) != null ? ref$ : false;
s.enableScrollY = (ref$ = p.enableScrollY) != null ? ref$ : true;
s.enableScrollDiagonal = (ref$ = p.enableScrollDiagonal) != null ? ref$ : false;
s.minScrollRangeY = (ref$ = p.minScrollRangeY) != null ? ref$ : 0;
s.minScrollRangeX = (ref$ = p.minScrollRangeX) != null ? ref$ : 0;
s.scrollbarMode = (ref$ = p.scrollbarMode) != null ? ref$ : "auto";
s.scrollbarMargins = (ref$ = p.scrollbarMargins) != null ? ref$ : null;
s.hideInitAutoScrollbar = (ref$ = p.hideInitAutoScrollbar) != null ? ref$ : false;
s.scopeRender = (ref$ = p.scopeRender) != null
? ref$
: {};
s.enableScrollBackStop = (ref$ = p.enableScrollBackStop) != null ? ref$ : false;
s.preventAutoScroll = (ref$ = p.preventAutoScroll) != null ? ref$ : false;
s.centerContent = (ref$ = p.centerContent) != null ? ref$ : false;
s.enlargeScrollbarOnHover = (ref$ = p.enlargeScrollbarOnHover) != null ? ref$ : true;
s.fadeInScrollbarOnHover = (ref$ = p.fadeInScrollbarOnHover) != null ? ref$ : true;
s.div = inc("div/div")(s);
s.scrollbarY = inc("scrollbar/y/scrollbar")(s);
s.scrollbarX = inc("scrollbar/x/scrollbar")(s);
s.refresh = function(e){
return inc("refresh/refresh")(s, e);
};
s.onScroll = function(e){
return inc("onScroll/on")(s, e);
};
s.onResize = function(type, e){
return inc("onResize/on")(s, type, e);
};
s.setEnableScrollY = function(enabled){
return inc("setEnableScroll/y/set")(s, enabled);
};
s.setEnableScrollX = function(enabled){
return inc("setEnableScroll/x/set")(s, enabled);
};
s.setEnableScrollDiagonal = function(enabled){
return inc("setEnableScrollDiagonal/set")(s, enabled);
};
s.setScrollbarMode = function(mode){
return inc("setScrollbarMode/set")(s, mode);
};
s.setScrollbarMargins = function(margins){
return inc("setScrollbarMargins/set")(s, margins);
};
s.setCenterContent = function(enable){
return inc("setCenterContent/set")(s, enable);
};
s.isScrollableX = function(){
return inc("isScrollable/is")(s, "x");
};
s.isScrollableY = function(){
return inc("isScrollable/is")(s, "y");
};
s.resetScrollBackStop = function(){
return inc("refresh/scrollBackStop/reset/reset")(s);
};
s.setScrollTopCustom = function(scrollTop){
return inc("setScrollTopCustom/set")(s, scrollTop);
};
s.setScrollHeightCustom = function(scrollHeight){
return inc("setScrollHeightCustom/set")(s, scrollHeight);
};
s.scrollElementIntoView = function(div, params){
return inc("scrollElementIntoView/scroll")(s, div, params);
};
s.scrollToTop = function(params){
return inc("scrollTo/scroll")(s, 0, params);
};
s.scrollToPosition = function(position, params){
return inc("scrollTo/scroll")(s, position, params);
};
s.setScopeRender = function(params){
return inc("setScopeRender/set")(s, params);
};
s.setEnableScrollX(s.enableScrollX);
s.setEnableScrollY(s.enableScrollY);
s.setEnableScrollDiagonal(s.enableScrollDiagonal);
s.setScrollbarMargins(s.scrollbarMargins);
s.setCenterContent(s.centerContent);
div = s.div;
div.s = s;
a = "setEnableScrollX setEnableScrollY setEnableScrollDiagonal setScrollbarMode setScrollbarMargins setScopeRender scrollElementIntoView scrollToTop scrollToPosition isScrollableX isScrollableY resetScrollBackStop setCenterContent setScrollTopCustom setScrollHeightCustom contentDiv scrollContainerDiv ";
for (i$ = 0, len$ = (ref$ = a.split(" ")).length; i$ < len$; ++i$) {
n = ref$[i$];
div[n] = s[n];
}
return div;
};
})();
components/scrollDivNext/scrollElementIntoView/calcScrollTarget/calc.ls
(function(){
return function(s, el, params){
var ref$, sc, elementOffset, scrollTop, scrollLeft;
params == null && (params = {});
params = {
padding: (ref$ = params.padding) != null ? ref$ : 5,
center: (ref$ = params.center) != null ? ref$ : false,
top: (ref$ = params.top) != null ? ref$ : false,
bottom: (ref$ = params.bottom) != null ? ref$ : false,
left: (ref$ = params.left) != null ? ref$ : false,
right: (ref$ = params.right) != null ? ref$ : false
};
sc = s.scrollContainerDiv;
elementOffset = inc("calcElementOffset/calc")(el, sc);
scrollTop = inc("calcScrollTop/calc")(s, sc, elementOffset, params);
scrollLeft = inc("calcScrollLeft/calc")(s, sc, elementOffset, params);
return {
top: _.round(scrollTop, 1),
left: _.round(scrollLeft, 1)
};
};
})();
components/scrollDivNext/scrollElementIntoView/calcScrollTarget/calcElementOffset/calc.ls
(function(){
return function(el, sc){
var o;
o = {
width: el.offsetWidth,
height: el.offsetHeight,
top: 0,
left: 0
};
while (el !== sc) {
o.top += el.offsetTop;
o.left += el.offsetLeft;
el = el.parentNode;
}
return o;
};
})();
components/scrollDivNext/scrollElementIntoView/calcScrollTarget/calcScrollLeft/calc.ls
(function(){
return function(s, sc, elOffset, params){
var paddingIsntPossible, t, that, padding, pLeft, pRight;
paddingIsntPossible = s.cropDiv.offsetWidth - 1 < elOffset.width + params.padding * 2;
if (params.center === true || paddingIsntPossible) {
t = elOffset.left + elOffset.width / 2;
t -= s.cropDiv.offsetWidth / 2;
return t;
} else if (params.left === true) {
return elOffset.left;
} else if (params.right === true) {
t = elOffset.left + elOffset.width;
t -= s.cropDiv.offsetWidth;
return t;
} else if (that = params.padding) {
padding = that;
pLeft = elOffset.left - sc.scrollLeft;
pRight = s.cropDiv.offsetWidth - pLeft - elOffset.width;
if (pLeft >= padding && pRight >= padding) {
return sc.scrollLeft;
} else if (pLeft < padding) {
return sc.scrollLeft - (padding - pLeft);
} else {
return sc.scrollLeft + (padding - pRight);
}
}
};
})();
components/scrollDivNext/scrollElementIntoView/calcScrollTarget/calcScrollTop/calc.ls
(function(){
return function(s, sc, elOffset, params){
var sbMargins, t, cropDivHeight, that, padding, pTop, pBottom;
sbMargins = inc("calcScrollBarMargins/calc")(s);
if (params.center === true) {
t = elOffset.top + elOffset.height / 2;
cropDivHeight = s.cropDiv.offsetHeight;
if (sbMargins) {
cropDivHeight -= sbMargins.top + sbMargins.bottom;
}
t -= cropDivHeight / 2;
return t;
} else if (params.top === true) {
t = elOffset.top;
if (sbMargins) {
t -= sbMargins.top;
}
return t;
} else if (params.bottom === true) {
t = elOffset.top + elOffset.height;
t -= s.cropDiv.offsetHeight;
if (sbMargins) {
t += sbMargins.bottom;
}
return t;
} else if (that = params.padding) {
padding = that;
pTop = elOffset.top - sc.scrollTop;
pBottom = s.cropDiv.offsetHeight - pTop - elOffset.height;
if (sbMargins) {
pTop -= sbMargins.top;
pBottom -= sbMargins.bottom;
}
if (pTop >= padding && pBottom >= padding) {
return sc.scrollTop;
} else if (pTop < padding) {
return sc.scrollTop - (padding - pTop);
} else {
return sc.scrollTop + (padding - pBottom);
}
}
};
})();
components/scrollDivNext/scrollElementIntoView/calcScrollTarget/calcScrollTop/calcScrollBarMargins/calc.ls
(function(){
return function(s){
var sbMargins, top, bottom, t, b;
if (sbMargins = s.params.scrollbarMargins) {
top = Div({
height: sbMargins.top
}).appendTo(s.cropDiv);
bottom = Div({
height: sbMargins.bottom
}).appendTo(s.cropDiv);
t = top.height();
b = bottom.height();
top.remove();
bottom.remove();
return {
top: t,
bottom: b
};
}
};
})();
components/scrollDivNext/scrollElementIntoView/scroll.ls
(function(){
return function(s, targetDiv, params){
var ref$, targetPosition;
if (!targetDiv || !targetDiv.isVisible() || !s.scrollContainerDiv.contains(targetDiv) || s.preventAutoScroll) {
return;
}
if ((ref$ = app.currentPage) != null) {
ref$.updateLayout();
}
targetPosition = inc("calcScrollTarget/calc")(s, targetDiv, params);
return s.scrollToPosition(targetPosition, params);
};
})();
components/scrollDivNext/scrollTo/animatedScroll/scroll.ls
(function(){
return function(s, sc, params, targetPosition){
var startedAt, startScrollLeft, startScrollTop, onFrame;
if (_.isEqual(targetPosition, s.targetPosition)) {
return;
}
s.targetPosition = targetPosition;
startedAt = new Date();
startScrollLeft = sc.scrollLeft;
startScrollTop = sc.scrollTop;
onFrame = function(){
var duration, percentage;
if (!_.isEqual(targetPosition, s.targetPosition)) {
return;
}
if (!s.div.isVisible()) {
return;
}
duration = new Date() - startedAt;
percentage = Math.min(1, duration / params.duration);
percentage = Math.pow(percentage, 2) * (3 - 2 * percentage);
sc.scrollLeft = startScrollLeft + (targetPosition.left - startScrollLeft) * percentage;
sc.scrollTop = startScrollTop + (targetPosition.top - startScrollTop) * percentage;
if (percentage < 1) {
return requestAnimationFrame(onFrame);
} else {
return s.targetPosition = undefined;
}
};
return requestAnimationFrame(onFrame);
};
})();
components/scrollDivNext/scrollTo/scroll.ls
(function(){
return function(s, targetPosition, params){
var sc, ref$;
if (targetPosition == null || s.preventAutoScroll) {
return;
}
sc = s.scrollContainerDiv;
params == null && (params = {});
params = {
padding: (ref$ = params.padding) != null ? ref$ : 5,
center: (ref$ = params.center) != null ? ref$ : false,
top: (ref$ = params.top) != null ? ref$ : false,
bottom: (ref$ = params.bottom) != null ? ref$ : false,
left: (ref$ = params.left) != null ? ref$ : false,
right: (ref$ = params.right) != null ? ref$ : false,
instant: (ref$ = params.instant) != null ? ref$ : false,
duration: (ref$ = params.duration) != null ? ref$ : 300
};
if (_.isNumber(targetPosition)) {
targetPosition = {
top: targetPosition,
left: sc.scrollLeft
};
}
if ((params != null ? params.instant : void 8) === true) {
sc.scrollTop = targetPosition.top;
sc.scrollLeft = targetPosition.left;
s.targetPosition = null;
} else {
inc("animatedScroll/scroll")(s, sc, params, targetPosition);
}
};
})();
components/scrollDivNext/scrollbar/_shared/changeScrollbarSize/change.ls
(function(){
return function(s, div, barDiv, size, axis){
if (!s.enlargeScrollbarOnHover) {
return;
}
div.css({
transition: "200ms"
});
barDiv.css({
borderRadius: size - 3 + "px",
transition: "200ms"
});
if (axis === "y") {
div.css({
width: size + "px"
});
barDiv.css({
width: size + "px"
});
} else {
div.css({
height: size + "px"
});
barDiv.css({
height: size + "px"
});
}
setTimeout(function(){
div.css({
transition: ""
});
return barDiv.css({
transition: ""
});
}, 200);
};
})();
components/scrollDivNext/scrollbar/_shared/enableDrag/enable.ls
(function(){
return function(p){
var x, y, mouseDown, mouseMove, mouseUp;
x = 0;
y = 0;
mouseDown = function(e){
p.div.dragEnabled = true;
x = e.clientX;
y = e.clientY;
body.bind("mousemove", mouseMove);
return body.bind("mouseup", mouseUp);
};
mouseMove = function(e){
var dx, dy;
e.stopPropagation();
e.preventDefault();
dx = e.clientX - x;
x = e.clientX;
dy = e.clientY - y;
y = e.clientY;
return p.onDrag({
x: dx,
y: dy
});
};
mouseUp = function(e){
body.unbind("mousemove", mouseMove);
body.unbind("mouseup", mouseUp);
p.div.dragEnabled = false;
if (!p.div.hoverEnabled) {
p.div.changeScrollbarSize(5);
p.div.setScrollbarInvisible();
}
return p.s.refresh("fakeEvent");
};
p.barDiv.bind("mousedown", mouseDown);
};
})();
components/scrollDivNext/scrollbar/_shared/enableHover/enable.ls
(function(){
return function(p){
var mouseEnter, mouseLeave;
mouseEnter = function(){
clearTimeout(p.div.resetTimeout);
clearTimeout(p.div.autoTimeout);
p.div.hoverEnabled = true;
p.div.setScrollbarVisible();
return p.div.changeScrollbarSize(9);
};
mouseLeave = function(e){
p.div.hoverEnabled = false;
if (!p.div.dragEnabled) {
p.div.changeScrollbarSize(5);
p.div.setScrollbarInvisible();
}
return p.s.refresh("fakeEvent");
};
p.div.bind("mouseenter", mouseEnter);
p.div.bind("mouseleave", mouseLeave);
};
})();
components/scrollDivNext/scrollbar/_shared/fadeOut/fadeOut.ls
(function(){
return function(div){
div.css({
opacity: 1
});
requestAnimationFrame(function(){
return div.css({
opacity: 0,
transition: "opacity 400ms"
});
});
};
})();
components/scrollDivNext/scrollbar/_shared/setScrollbarInvisible/set.ls
(function(){
return function(s, div){
if (s.scrollbarMode === "auto" && s.fadeInScrollbarOnHover) {
clearTimeout(div.resetTimeout);
div.resetTimeout = setTimeout(function(){
if (!s.fadeInScrollbarOnHover) {
div.firstChild.css({
pointerEvents: "none"
});
}
return div.customFadeOut();
}, 2000);
}
};
})();
components/scrollDivNext/scrollbar/_shared/setScrollbarVisible/set.ls
(function(){
return function(s, div){
var ref$;
if (((ref$ = s.scrollbarMode) === "show" || ref$ === "auto") && s.fadeInScrollbarOnHover) {
div.css({
opacity: 1,
transition: "200ms"
});
}
};
})();
components/scrollDivNext/scrollbar/x/onDrag/on.ls
(function(){
return function(s, delta){
var sc, factor;
sc = s.scrollContainerDiv;
factor = sc.scrollWidth / sc.offsetWidth;
return sc.scrollLeft += delta.x * factor;
};
})();
components/scrollDivNext/scrollbar/x/scrollbar.ls
(function(){
return function(s){
var div, barDiv;
div = Div({
position: "absolute",
left: 0,
right: 0,
bottom: 0,
height: "5px",
background: "rgba(0,0,200,0.05)",
pointerEvents: s.fadeInScrollbarOnHover ? "auto" : "none"
}).addClass("scrollbarWrapper").html(barDiv = Div({
position: "absolute",
bottom: 0,
height: "5px",
background: Color.grey[800],
opacity: 0.5,
borderRadius: "2px",
cursor: "pointer",
pointerEvents: s.fadeInScrollbarOnHover ? "auto" : "none"
}).html(Div({
position: "absolute",
top: "-10px",
left: "-10px",
bottom: "-10px",
right: 0,
background: "transparent"
})));
inc("../_shared/enableDrag/enable")({
div: div,
barDiv: barDiv,
onDrag: function(delta){
return inc("onDrag/on")(s, delta);
},
s: s
});
inc("../_shared/enableHover/enable")({
div: div,
barDiv: barDiv,
s: s
});
div.update = function(){
return inc("update/update")(s, barDiv);
};
div.changeScrollbarSize = function(size){
return inc("../_shared/changeScrollbarSize/change")(s, div, barDiv, size, "x");
};
div.setScrollbarVisible = function(){
return inc("../_shared/setScrollbarVisible/set")(s, div);
};
div.setScrollbarInvisible = function(){
return inc("../_shared/setScrollbarInvisible/set")(s, div);
};
div.customFadeOut = function(){
return inc("../_shared/fadeOut/fadeOut")(div);
};
return div;
};
})();
components/scrollDivNext/scrollbar/x/update/update.ls
(function(){
return function(s, barDiv){
var scrollLeft, wContainer, wContent, wBar, xBar;
scrollLeft = s.scrollContainerDiv.scrollLeft;
wContainer = s.cropDiv.offsetWidth;
wContent = s.scrollContainerDiv.scrollWidth;
if (s.enableScrollY) {
wContent -= 30;
}
wBar = _.round(wContainer / wContent * wContainer);
xBar = _.round(scrollLeft / wContent * wContainer);
return barDiv.css({
width: wBar + "px",
transform: "translateX(" + xBar + "px)"
});
};
})();
components/scrollDivNext/scrollbar/y/onDrag/on.ls
(function(){
return function(s, delta){
var sc, scrollHeight, ref$, factor;
sc = s.scrollContainerDiv;
scrollHeight = (ref$ = s.scrollHeightCustom) != null
? ref$
: sc.scrollHeight;
factor = scrollHeight / sc.offsetHeight;
return sc.scrollTop += delta.y * factor;
};
})();
components/scrollDivNext/scrollbar/y/scrollbar.ls
(function(){
return function(s){
var div, barDiv;
div = Div({
position: "absolute",
top: 0,
right: 0,
bottom: 0,
width: "5px",
background: "rgba(0,0,200,0.05)",
pointerEvents: s.fadeInScrollbarOnHover ? "auto" : "none"
}).addClass("scrollbarWrapper").html(barDiv = Div({
position: "absolute",
right: 0,
width: "5px",
background: Color.grey[800],
opacity: 0.4,
borderRadius: "2px",
cursor: "pointer",
pointerEvents: s.fadeInScrollbarOnHover ? "auto" : "none"
}).html(Div({
position: "absolute",
top: "-10px",
left: "-10px",
bottom: "-10px",
right: 0,
background: "transparent"
})));
inc("../_shared/enableDrag/enable")({
div: div,
barDiv: barDiv,
onDrag: function(delta){
return inc("onDrag/on")(s, delta);
},
s: s
});
inc("../_shared/enableHover/enable")({
div: div,
barDiv: barDiv,
s: s
});
div.update = function(){
return inc("update/update")(s, barDiv);
};
div.changeScrollbarSize = function(size){
return inc("../_shared/changeScrollbarSize/change")(s, div, barDiv, size, "y");
};
div.setScrollbarVisible = function(){
return inc("../_shared/setScrollbarVisible/set")(s, div);
};
div.setScrollbarInvisible = function(){
return inc("../_shared/setScrollbarInvisible/set")(s, div);
};
div.customFadeOut = function(){
return inc("../_shared/fadeOut/fadeOut")(div);
};
return div;
};
})();
components/scrollDivNext/scrollbar/y/update/calcScrollbarMarginFactor/calc.ls
(function(){
return function(s){
if (!s.customScrollbarMargins) {
return 1;
} else {
return s.scrollbarY.offsetHeight / s.cropDiv.offsetHeight;
}
};
})();
components/scrollDivNext/scrollbar/y/update/update.ls
(function(){
return function(s, barDiv){
var scrollTop, ref$, hContainer, hContent, marginFactor, hBar, yBar;
scrollTop = (ref$ = s.scrollTopCustom) != null
? ref$
: s.scrollContainerDiv.scrollTop;
hContainer = s.cropDiv.offsetHeight;
hContent = (ref$ = s.scrollHeightCustom) != null
? ref$
: s.scrollContainerDiv.scrollHeight;
if (s.enableScrollX) {
hContent -= 30;
}
marginFactor = inc("calcScrollbarMarginFactor/calc")(s);
hBar = _.round(hContainer / hContent * hContainer * marginFactor);
yBar = _.round(scrollTop / hContent * hContainer * marginFactor);
return barDiv.css({
height: hBar + "px",
transform: "translateY(" + yBar + "px)"
});
};
})();
components/scrollDivNext/setCenterContent/set.ls
(function(){
return function(s, enable){
var i$, ref$, len$, el;
for (i$ = 0, len$ = (ref$ = s.div.findAll(".centerSpacer")).length; i$ < len$; ++i$) {
el = ref$[i$];
if (enable) {
el.show();
} else {
el.hide();
}
}
return s.div;
};
})();
components/scrollDivNext/setEnableScroll/x/set.ls
(function(){
return function(s, enabled){
s.enableScrollX = enabled;
s.scrollContainerDiv.css(enabled
? {
overflowX: "scroll",
marginBottom: "-30px"
}
: {
overflowX: "hidden",
marginBottom: ""
});
s.contentDiv.css(enabled
? {
borderBottom: "30px solid transparent",
maxWidth: ""
}
: {
borderBottom: "",
maxWidth: "100%"
});
s.contentOutsideDiv.css({
maxWidth: enabled ? "" : "100%"
});
s.setScrollbarMode(s.scrollbarMode);
return s.div;
};
})();
components/scrollDivNext/setEnableScroll/y/set.ls
(function(){
return function(s, enabled){
s.enableScrollY = enabled;
s.scrollContainerDiv.css(enabled
? {
overflowY: "scroll",
marginRight: "-30px"
}
: {
overflowY: "hidden",
marginRight: ""
});
s.contentDiv.css(enabled
? {
borderRight: "30px solid transparent",
maxHeight: ""
}
: {
borderRight: "",
maxHeight: "100%"
});
s.setScrollbarMode(s.scrollbarMode);
return s.div;
};
})();
components/scrollDivNext/setEnableScrollDiagonal/fixChromeSvgFontSizeBug/fix.ls
(function(){
return function(s){
var div, div2;
div = s.contentDiv;
div2 = Div({
height: div.height() + "px",
width: div.width() + "px"
});
div.replaceWith(div2);
return div2.replaceWith(div);
};
})();
components/scrollDivNext/setEnableScrollDiagonal/onWheel/on.ls
(function(){
return function(s, e){
var cd;
e.preventDefault();
cd = s.scrollContainerDiv;
if (s.enableScrollY) {
cd.scrollTop += e.deltaY / 2;
}
if (s.enableScrollX) {
return cd.scrollLeft += e.deltaX / 2;
}
};
})();
components/scrollDivNext/setEnableScrollDiagonal/set.ls
(function(){
return function(s, enabled){
if (enabled && (!s.enableScrollX || !s.enableScrollY)) {
throw Error("enableScrollDiagonal requires enabled scrollbars");
}
if (enabled === s.enableScrollDiagonal) {
return s.div;
}
s.enableScrollDiagonal = enabled;
s.onWheel == null && (s.onWheel = function(e){
return inc("onWheel/on")(s, e);
});
if (enabled) {
s.scrollContainerDiv.bind("wheel", s.onWheel);
} else {
s.scrollContainerDiv.unbind("wheel", s.onWheel);
inc("fixChromeSvgFontSizeBug/fix")(s);
}
return s.div;
};
})();
components/scrollDivNext/setScopeRender/set.ls
(function(){
return function(s, params){
s.scopeRender = params;
s.refresh();
return s.div;
};
})();
components/scrollDivNext/setScrollHeightCustom/set.ls
(function(){
return function(s, scrollHeightCustom){
s.scrollHeightCustom = scrollHeightCustom;
s.refresh();
return s.div;
};
})();
components/scrollDivNext/setScrollTopCustom/set.ls
(function(){
return function(s, scrollTop){
s.scrollTopCustom = scrollTop;
s.refresh();
return s.div;
};
})();
components/scrollDivNext/setScrollbarMargins/set.ls
(function(){
return function(s, m){
if (!m) {
return;
}
s.customScrollbarMargins = m;
s.scrollbarY.css({
marginTop: m.top,
marginBottom: m.bottom
});
s.scrollbarX.css({
marginBottom: m.bottom
});
return s.div;
};
})();
components/scrollDivNext/setScrollbarMode/set.ls
(function(){
return function(s, mode){
var ref$;
s.scrollbarMode = mode;
if (s.enableScrollY && ((ref$ = s.scrollbarMode) === "show" || ref$ === "auto")) {
s.scrollbarY.appendTo(s.cropDiv);
} else {
s.scrollbarY.remove();
}
if (s.enableScrollX && ((ref$ = s.scrollbarMode) === "show" || ref$ === "auto")) {
s.scrollbarX.appendTo(s.cropDiv);
} else {
s.scrollbarX.remove();
}
s.refresh();
return s.div;
};
})();
components/svg/createElement/create.ls
(function(){
return function(o){
var elem, s, ref$, d, w, h;
if (_.isObject(o.svg)) {
elem = o.svg;
} else {
if (_.includes(o.svg, "<")) {
s = o.svg;
} else if (_.includes(o.svg, "/")) {
s = include(o.svg).trim();
} else {
if ((ref$ = window.log) != null) {
ref$.log({
event: "debugBrokenSvg",
value: {
o: o
}
});
}
throw Error("Svg: svg not found or invalid");
}
d = document.createElement("div");
d.innerHTML = s;
elem = d.getElementsByTagName("svg")[0];
}
if (!elem.getAttribute("viewBox")) {
w = elem.getAttribute("width").replace("px", "");
h = elem.getAttribute("height").replace("px", "");
s = "0 0 " + w + " " + h;
elem.setAttribute("viewBox", "0 0 " + w + " " + h);
}
return elem.css({
display: "block",
boxSizing: "content-box",
width: "100%",
height: "100%"
});
};
})();
components/svg/svg.ls
(function(){
return function(o){
var elem, initSize, setSize, setSvg, setColor, div;
if (_.isString(o)) {
o = {
svg: o
};
}
elem = inc("createElement/create")(o);
initSize = function(){
if (o.size) {
o.height = o.size;
return o.width = o.size;
} else if (!(o.width || o.height)) {
o.height = "1em";
return o.width = "1em";
} else {
o.width = o.width || o.height;
return o.height = o.height || o.width;
}
};
setSize = function(w, h){
delete o.size;
delete o.height;
delete o.width;
if (w && h) {
o.width = w;
o.height = h;
} else if (w) {
o.size = w;
}
initSize();
return div.css({
width: o.width,
height: o.height
});
};
setSvg = function(svg, w, h){
o.svg = svg;
elem.replaceWith(elem = inc("createElement/create")(o));
if (w) {
setSize(w, h);
}
return elem;
};
setColor = function(c){
var i$, ref$, len$, e;
if (!c) {
return;
}
elem.setAttribute("fill", c);
for (i$ = 0, len$ = (ref$ = elem.querySelectorAll("*")).length; i$ < len$; ++i$) {
e = ref$[i$];
e.setAttribute("fill", c);
}
return elem;
};
initSize();
setColor(o.color);
div = Div({
display: "inline-block",
width: o.width || o.height,
height: o.height || o.width,
boxSizing: "content-box"
}).html(elem);
div.setColor = setColor;
div.setSvg = setSvg;
div.setSize = setSize;
div.svgElement = elem;
return div;
};
})();
components/svgIcon/getSrcUrl/calcCacheId/calc.ls
(function(){
return function(p){
var id, that;
id = (that = p.svgCacheId)
? that
: _.isString(p.svg) && !_.startsWith(p.svg, "