view release on metacpan or search on metacpan
public/javascripts/ace/ace.js view on Meta::CPAN
return _self;
};
});
define("ace/clipboard",["require","exports","module"], function(require, exports, module) {
"use strict";
var $cancelT;
module.exports = {
lineMode: false,
pasteCancelled: function() {
if ($cancelT && $cancelT > Date.now() - 50)
return true;
return $cancelT = false;
},
cancel: function() {
$cancelT = Date.now();
}
};
});
define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/dom","ace/lib/lang","ace/clipboard","ace/lib/keys"], function(require, exports, module) {
"use strict";
var event = require("../lib/event");
var useragent = require("../lib/useragent");
var dom = require("../lib/dom");
var lang = require("../lib/lang");
var clipboard = require("../clipboard");
var BROKEN_SETDATA = useragent.isChrome < 18;
var USE_IE_MIME_TYPE = useragent.isIE;
var HAS_FOCUS_ARGS = useragent.isChrome > 63;
var MAX_LINE_LENGTH = 400;
var KEYS = require("../lib/keys");
var MODS = KEYS.KEY_MODS;
var isIOS = useragent.isIOS;
var valueResetRegex = isIOS ? /\s/ : /\n/;
var isMobile = useragent.isMobile;
var TextInput = function(parentNode, host) {
var text = dom.createElement("textarea");
text.className = "ace_text-input";
text.setAttribute("wrap", "off");
text.setAttribute("autocorrect", "off");
text.setAttribute("autocapitalize", "off");
text.setAttribute("spellcheck", false);
text.style.opacity = "0";
parentNode.insertBefore(text, parentNode.firstChild);
var copied = false;
var pasted = false;
var inComposition = false;
var sendingText = false;
var tempStyle = '';
if (!isMobile)
text.style.fontSize = "1px";
var commandMode = false;
var ignoreFocusEvents = false;
var lastValue = "";
var lastSelectionStart = 0;
var lastSelectionEnd = 0;
var lastRestoreEnd = 0;
try { var isFocused = document.activeElement === text; } catch(e) {}
event.addListener(text, "blur", function(e) {
if (ignoreFocusEvents) return;
host.onBlur(e);
isFocused = false;
});
event.addListener(text, "focus", function(e) {
if (ignoreFocusEvents) return;
isFocused = true;
if (useragent.isEdge) {
try {
if (!document.hasFocus())
return;
} catch(e) {}
}
host.onFocus(e);
if (useragent.isEdge)
setTimeout(resetSelection);
else
resetSelection();
});
this.$focusScroll = false;
this.focus = function() {
if (tempStyle || HAS_FOCUS_ARGS || this.$focusScroll == "browser")
return text.focus({ preventScroll: true });
var top = text.style.top;
text.style.position = "fixed";
text.style.top = "0px";
try {
var isTransformed = text.getBoundingClientRect().top != 0;
} catch(e) {
return;
}
var ancestors = [];
if (isTransformed) {
var t = text.parentElement;
while (t && t.nodeType == 1) {
ancestors.push(t);
t.setAttribute("ace_nocontext", true);
if (!t.parentElement && t.getRootNode)
t = t.getRootNode().host;
else
t = t.parentElement;
}
}
text.focus({ preventScroll: true });
if (isTransformed) {
ancestors.forEach(function(p) {
p.removeAttribute("ace_nocontext");
});
public/javascripts/ace/ace.js view on Meta::CPAN
} else if (levels[i] === R && ((textCharTypes[i] > AL && textCharTypes[i] < LRE)
|| textCharTypes[i] === ON || textCharTypes[i] === BN)) {
levels[i] = exports.ON_R;
} else if ((i > 0 && chars[i - 1] === '\u0644') && /\u0622|\u0623|\u0625|\u0627/.test(chars[i])) {
levels[i - 1] = levels[i] = exports.R_H;
i++;
}
}
if (chars[chars.length - 1] === exports.DOT)
levels[chars.length - 1] = exports.B;
if (chars[0] === '\u202B')
levels[0] = exports.RLE;
for (var i = 0; i < logicalFromVisual.length; i++) {
bidiLevels[i] = levels[logicalFromVisual[i]];
}
return {'logicalFromVisual': logicalFromVisual, 'bidiLevels': bidiLevels};
};
exports.hasBidiCharacters = function(text, textCharTypes){
var ret = false;
for (var i = 0; i < text.length; i++){
textCharTypes[i] = _getCharacterType(text.charAt(i));
if (!ret && (textCharTypes[i] == R || textCharTypes[i] == AL || textCharTypes[i] == AN))
ret = true;
}
return ret;
};
exports.getVisualFromLogicalIdx = function(logIdx, rowMap) {
for (var i = 0; i < rowMap.logicalFromVisual.length; i++) {
if (rowMap.logicalFromVisual[i] == logIdx)
return i;
}
return 0;
};
});
define("ace/bidihandler",["require","exports","module","ace/lib/bidiutil","ace/lib/lang"], function(require, exports, module) {
"use strict";
var bidiUtil = require("./lib/bidiutil");
var lang = require("./lib/lang");
var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\u202B]/;
var BidiHandler = function(session) {
this.session = session;
this.bidiMap = {};
this.currentRow = null;
this.bidiUtil = bidiUtil;
this.charWidths = [];
this.EOL = "\xAC";
this.showInvisibles = true;
this.isRtlDir = false;
this.$isRtl = false;
this.line = "";
this.wrapIndent = 0;
this.EOF = "\xB6";
this.RLE = "\u202B";
this.contentWidth = 0;
this.fontMetrics = null;
this.rtlLineOffset = 0;
this.wrapOffset = 0;
this.isMoveLeftOperation = false;
this.seenBidi = bidiRE.test(session.getValue());
};
(function() {
this.isBidiRow = function(screenRow, docRow, splitIndex) {
if (!this.seenBidi)
return false;
if (screenRow !== this.currentRow) {
this.currentRow = screenRow;
this.updateRowLine(docRow, splitIndex);
this.updateBidiMap();
}
return this.bidiMap.bidiLevels;
};
this.onChange = function(delta) {
if (!this.seenBidi) {
if (delta.action == "insert" && bidiRE.test(delta.lines.join("\n"))) {
this.seenBidi = true;
this.currentRow = null;
}
}
else {
this.currentRow = null;
}
};
this.getDocumentRow = function() {
var docRow = 0;
var rowCache = this.session.$screenRowCache;
if (rowCache.length) {
var index = this.session.$getRowCacheIndex(rowCache, this.currentRow);
if (index >= 0)
docRow = this.session.$docRowCache[index];
}
return docRow;
};
this.getSplitIndex = function() {
var splitIndex = 0;
var rowCache = this.session.$screenRowCache;
if (rowCache.length) {
var currentIndex, prevIndex = this.session.$getRowCacheIndex(rowCache, this.currentRow);
while (this.currentRow - splitIndex > 0) {
currentIndex = this.session.$getRowCacheIndex(rowCache, this.currentRow - splitIndex - 1);
if (currentIndex !== prevIndex)
break;
prevIndex = currentIndex;
splitIndex++;
}
} else {
splitIndex = this.currentRow;
}
return splitIndex;
};
this.updateRowLine = function(docRow, splitIndex) {
if (docRow === undefined)
docRow = this.getDocumentRow();
var isLastRow = (docRow === this.session.getLength() - 1),
endOfLine = isLastRow ? this.EOF : this.EOL;
this.wrapIndent = 0;
this.line = this.session.getLine(docRow);
this.isRtlDir = this.$isRtl || this.line.charAt(0) === this.RLE;
if (this.session.$useWrapMode) {
var splits = this.session.$wrapData[docRow];
if (splits) {
if (splitIndex === undefined)
splitIndex = this.getSplitIndex();
if(splitIndex > 0 && splits.length) {
this.wrapIndent = splits.indent;
this.wrapOffset = this.wrapIndent * this.charWidths[bidiUtil.L];
this.line = (splitIndex < splits.length) ?
this.line.substring(splits[splitIndex - 1], splits[splitIndex]) :
this.line.substring(splits[splits.length - 1]);
} else {
this.line = this.line.substring(0, splits[splitIndex]);
}
}
if (splitIndex == splits.length)
this.line += (this.showInvisibles) ? endOfLine : bidiUtil.DOT;
} else {
this.line += this.showInvisibles ? endOfLine : bidiUtil.DOT;
}
var session = this.session, shift = 0, size;
this.line = this.line.replace(/\t|[\u1100-\u2029, \u202F-\uFFE6]/g, function(ch, i){
if (ch === '\t' || session.isFullWidth(ch.charCodeAt(0))) {
size = (ch === '\t') ? session.getScreenTabSize(i + shift) : 2;
shift += size - 1;
return lang.stringRepeat(bidiUtil.DOT, size);
}
return ch;
});
if (this.isRtlDir) {
this.fontMetrics.$main.textContent = (this.line.charAt(this.line.length - 1) == bidiUtil.DOT) ? this.line.substr(0, this.line.length - 1) : this.line;
this.rtlLineOffset = this.contentWidth - this.fontMetrics.$main.getBoundingClientRect().width;
}
};
this.updateBidiMap = function() {
var textCharTypes = [];
if (bidiUtil.hasBidiCharacters(this.line, textCharTypes) || this.isRtlDir) {
this.bidiMap = bidiUtil.doBidiReorder(this.line, textCharTypes, this.isRtlDir);
} else {
this.bidiMap = {};
}
};
this.markAsDirty = function() {
this.currentRow = null;
};
this.updateCharacterWidths = function(fontMetrics) {
if (this.characterWidth === fontMetrics.$characterSize.width)
return;
this.fontMetrics = fontMetrics;
var characterWidth = this.characterWidth = fontMetrics.$characterSize.width;
var bidiCharWidth = fontMetrics.$measureCharWidth("\u05d4");
this.charWidths[bidiUtil.L] = this.charWidths[bidiUtil.EN] = this.charWidths[bidiUtil.ON_R] = characterWidth;
this.charWidths[bidiUtil.R] = this.charWidths[bidiUtil.AN] = bidiCharWidth;
this.charWidths[bidiUtil.R_H] = bidiCharWidth * 0.45;
this.charWidths[bidiUtil.B] = this.charWidths[bidiUtil.RLE] = 0;
this.currentRow = null;
};
this.setShowInvisibles = function(showInvisibles) {
this.showInvisibles = showInvisibles;
this.currentRow = null;
};
this.setEolChar = function(eolChar) {
this.EOL = eolChar;
};
this.setContentWidth = function(width) {
this.contentWidth = width;
};
this.isRtlLine = function(row) {
if (this.$isRtl) return true;
if (row != undefined)
return (this.session.getLine(row).charAt(0) == this.RLE);
else
return this.isRtlDir;
};
this.setRtlDirection = function(editor, isRtlDir) {
var cursor = editor.getCursorPosition();
for (var row = editor.selection.getSelectionAnchor().row; row <= cursor.row; row++) {
if (!isRtlDir && editor.session.getLine(row).charAt(0) === editor.session.$bidiHandler.RLE)
editor.session.doc.removeInLine(row, 0, 1);
else if (isRtlDir && editor.session.getLine(row).charAt(0) !== editor.session.$bidiHandler.RLE)
editor.session.doc.insert({column: 0, row: row}, editor.session.$bidiHandler.RLE);
}
};
this.getPosLeft = function(col) {
col -= this.wrapIndent;
var leftBoundary = (this.line.charAt(0) === this.RLE) ? 1 : 0;
var logicalIdx = (col > leftBoundary) ? (this.session.getOverwrite() ? col : col - 1) : leftBoundary;
var visualIdx = bidiUtil.getVisualFromLogicalIdx(logicalIdx, this.bidiMap),
levels = this.bidiMap.bidiLevels, left = 0;
if (!this.session.getOverwrite() && col <= leftBoundary && levels[visualIdx] % 2 !== 0)
visualIdx++;
for (var i = 0; i < visualIdx; i++) {
left += this.charWidths[levels[i]];
}
if (!this.session.getOverwrite() && (col > leftBoundary) && (levels[visualIdx] % 2 === 0))
left += this.charWidths[levels[visualIdx]];
if (this.wrapIndent)
left += this.isRtlDir ? (-1 * this.wrapOffset) : this.wrapOffset;
if (this.isRtlDir)
public/javascripts/ace/ace.js view on Meta::CPAN
this.onChangeBackMarker();
this.onChangeBreakpoint();
this.onChangeAnnotation();
this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
this.renderer.updateFull();
} else {
this.selection = null;
this.renderer.setSession(session);
}
this._signal("changeSession", {
session: session,
oldSession: oldSession
});
this.curOp = null;
oldSession && oldSession._signal("changeEditor", {oldEditor: this});
session && session._signal("changeEditor", {editor: this});
if (session && session.bgTokenizer)
session.bgTokenizer.scheduleStart();
};
this.getSession = function() {
return this.session;
};
this.setValue = function(val, cursorPos) {
this.session.doc.setValue(val);
if (!cursorPos)
this.selectAll();
else if (cursorPos == 1)
this.navigateFileEnd();
else if (cursorPos == -1)
this.navigateFileStart();
return val;
};
this.getValue = function() {
return this.session.getValue();
};
this.getSelection = function() {
return this.selection;
};
this.resize = function(force) {
this.renderer.onResize(force);
};
this.setTheme = function(theme, cb) {
this.renderer.setTheme(theme, cb);
};
this.getTheme = function() {
return this.renderer.getTheme();
};
this.setStyle = function(style) {
this.renderer.setStyle(style);
};
this.unsetStyle = function(style) {
this.renderer.unsetStyle(style);
};
this.getFontSize = function () {
return this.getOption("fontSize") ||
dom.computedStyle(this.container).fontSize;
};
this.setFontSize = function(size) {
this.setOption("fontSize", size);
};
this.$highlightBrackets = function() {
if (this.$highlightPending) {
return;
}
var self = this;
this.$highlightPending = true;
setTimeout(function () {
self.$highlightPending = false;
var session = self.session;
if (!session || !session.bgTokenizer) return;
if (session.$bracketHighlight) {
session.$bracketHighlight.markerIds.forEach(function(id) {
session.removeMarker(id);
});
session.$bracketHighlight = null;
}
var ranges = session.getMatchingBracketRanges(self.getCursorPosition());
if (!ranges && session.$mode.getMatching)
ranges = session.$mode.getMatching(self.session);
if (!ranges)
return;
var markerType = "ace_bracket";
if (!Array.isArray(ranges)) {
ranges = [ranges];
} else if (ranges.length == 1) {
markerType = "ace_error_bracket";
}
if (ranges.length == 2) {
if (Range.comparePoints(ranges[0].end, ranges[1].start) == 0)
ranges = [Range.fromPoints(ranges[0].start, ranges[1].end)];
else if (Range.comparePoints(ranges[0].start, ranges[1].end) == 0)
ranges = [Range.fromPoints(ranges[1].start, ranges[0].end)];
}
session.$bracketHighlight = {
ranges: ranges,
markerIds: ranges.map(function(range) {
return session.addMarker(range, markerType, "text");
})
};
}, 50);
};
this.$highlightTags = function() {
if (this.$highlightTagPending)
return;
var self = this;
this.$highlightTagPending = true;
setTimeout(function() {
self.$highlightTagPending = false;
var session = self.session;
if (!session || !session.bgTokenizer) return;
var pos = self.getCursorPosition();
var iterator = new TokenIterator(self.session, pos.row, pos.column);
var token = iterator.getCurrentToken();
public/javascripts/ace/ace.js view on Meta::CPAN
showLineNumbers: {
set: function(show) {
this.renderer.$gutterLayer.setShowLineNumbers(show);
this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER);
if (show && this.$relativeLineNumbers)
relativeNumberRenderer.attach(this);
else
relativeNumberRenderer.detach(this);
},
initialValue: true
},
relativeLineNumbers: {
set: function(value) {
if (this.$showLineNumbers && value)
relativeNumberRenderer.attach(this);
else
relativeNumberRenderer.detach(this);
}
},
placeholder: {
set: function(message) {
if (!this.$updatePlaceholder) {
this.$updatePlaceholder = function() {
var value = this.session && (this.renderer.$composition || this.getValue());
if (value && this.renderer.placeholderNode) {
this.renderer.off("afterRender", this.$updatePlaceholder);
dom.removeCssClass(this.container, "ace_hasPlaceholder");
this.renderer.placeholderNode.remove();
this.renderer.placeholderNode = null;
} else if (!value && !this.renderer.placeholderNode) {
this.renderer.on("afterRender", this.$updatePlaceholder);
dom.addCssClass(this.container, "ace_hasPlaceholder");
var el = dom.createElement("div");
el.className = "ace_placeholder";
el.textContent = this.$placeholder || "";
this.renderer.placeholderNode = el;
this.renderer.content.appendChild(this.renderer.placeholderNode);
} else if (!value && this.renderer.placeholderNode) {
this.renderer.placeholderNode.textContent = this.$placeholder || "";
}
}.bind(this);
this.on("input", this.$updatePlaceholder);
}
this.$updatePlaceholder();
}
},
hScrollBarAlwaysVisible: "renderer",
vScrollBarAlwaysVisible: "renderer",
highlightGutterLine: "renderer",
animatedScroll: "renderer",
showInvisibles: "renderer",
showPrintMargin: "renderer",
printMarginColumn: "renderer",
printMargin: "renderer",
fadeFoldWidgets: "renderer",
showFoldWidgets: "renderer",
displayIndentGuides: "renderer",
showGutter: "renderer",
fontSize: "renderer",
fontFamily: "renderer",
maxLines: "renderer",
minLines: "renderer",
scrollPastEnd: "renderer",
fixedWidthGutter: "renderer",
theme: "renderer",
hasCssTransforms: "renderer",
maxPixelHeight: "renderer",
useTextareaForIME: "renderer",
scrollSpeed: "$mouseHandler",
dragDelay: "$mouseHandler",
dragEnabled: "$mouseHandler",
focusTimeout: "$mouseHandler",
tooltipFollowsMouse: "$mouseHandler",
firstLineNumber: "session",
overwrite: "session",
newLineMode: "session",
useWorker: "session",
useSoftTabs: "session",
navigateWithinSoftTabs: "session",
tabSize: "session",
wrap: "session",
indentedSoftWrap: "session",
foldStyle: "session",
mode: "session"
});
var relativeNumberRenderer = {
getText: function(session, row) {
return (Math.abs(session.selection.lead.row - row) || (row + 1 + (row < 9 ? "\xb7" : ""))) + "";
},
getWidth: function(session, lastLineNumber, config) {
return Math.max(
lastLineNumber.toString().length,
(config.lastRow + 1).toString().length,
2
) * config.characterWidth;
},
update: function(e, editor) {
editor.renderer.$loop.schedule(editor.renderer.CHANGE_GUTTER);
},
attach: function(editor) {
editor.renderer.$gutterLayer.$renderer = this;
editor.on("changeSelection", this.update);
this.update(null, editor);
},
detach: function(editor) {
if (editor.renderer.$gutterLayer.$renderer == this)
editor.renderer.$gutterLayer.$renderer = null;
editor.off("changeSelection", this.update);
this.update(null, editor);
}
};
exports.Editor = Editor;
});
define("ace/undomanager",["require","exports","module","ace/range"], function(require, exports, module) {
public/javascripts/ace/ace.js view on Meta::CPAN
clazz,
"height:"+ height+ "px;"+
"top:"+ top+ "px;"+
"left:0;right:0;"+ (extraStyle || "")
);
};
}).call(Marker.prototype);
exports.Marker = Marker;
});
define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/layer/lines","ace/lib/event_emitter"], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var dom = require("../lib/dom");
var lang = require("../lib/lang");
var Lines = require("./lines").Lines;
var EventEmitter = require("../lib/event_emitter").EventEmitter;
var Text = function(parentEl) {
this.dom = dom;
this.element = this.dom.createElement("div");
this.element.className = "ace_layer ace_text-layer";
parentEl.appendChild(this.element);
this.$updateEolChar = this.$updateEolChar.bind(this);
this.$lines = new Lines(this.element);
};
(function() {
oop.implement(this, EventEmitter);
this.EOF_CHAR = "\xB6";
this.EOL_CHAR_LF = "\xAC";
this.EOL_CHAR_CRLF = "\xa4";
this.EOL_CHAR = this.EOL_CHAR_LF;
this.TAB_CHAR = "\u2014"; //"\u21E5";
this.SPACE_CHAR = "\xB7";
this.$padding = 0;
this.MAX_LINE_LENGTH = 10000;
this.$updateEolChar = function() {
var doc = this.session.doc;
var unixMode = doc.getNewLineCharacter() == "\n" && doc.getNewLineMode() != "windows";
var EOL_CHAR = unixMode ? this.EOL_CHAR_LF : this.EOL_CHAR_CRLF;
if (this.EOL_CHAR != EOL_CHAR) {
this.EOL_CHAR = EOL_CHAR;
return true;
}
};
this.setPadding = function(padding) {
this.$padding = padding;
this.element.style.margin = "0 " + padding + "px";
};
this.getLineHeight = function() {
return this.$fontMetrics.$characterSize.height || 0;
};
this.getCharacterWidth = function() {
return this.$fontMetrics.$characterSize.width || 0;
};
this.$setFontMetrics = function(measure) {
this.$fontMetrics = measure;
this.$fontMetrics.on("changeCharacterSize", function(e) {
this._signal("changeCharacterSize", e);
}.bind(this));
this.$pollSizeChanges();
};
this.checkForSizeChanges = function() {
this.$fontMetrics.checkForSizeChanges();
};
this.$pollSizeChanges = function() {
return this.$pollSizeChangesTimer = this.$fontMetrics.$pollSizeChanges();
};
this.setSession = function(session) {
this.session = session;
if (session)
this.$computeTabString();
};
this.showInvisibles = false;
this.showSpaces = false;
this.showTabs = false;
this.showEOL = false;
this.setShowInvisibles = function(showInvisibles) {
if (this.showInvisibles == showInvisibles)
return false;
this.showInvisibles = showInvisibles;
if (typeof showInvisibles == "string") {
this.showSpaces = /tab/i.test(showInvisibles);
this.showTabs = /space/i.test(showInvisibles);
this.showEOL = /eol/i.test(showInvisibles);
} else {
this.showSpaces = this.showTabs = this.showEOL = showInvisibles;
}
this.$computeTabString();
return true;
};
this.displayIndentGuides = true;
this.setDisplayIndentGuides = function(display) {
if (this.displayIndentGuides == display)
return false;
this.displayIndentGuides = display;
this.$computeTabString();
return true;
};
this.$tabStrings = [];
this.onChangeTabSize =
this.$computeTabString = function() {
var tabSize = this.session.getTabSize();
this.tabSize = tabSize;
var tabStr = this.$tabStrings = [0];
for (var i = 1; i < tabSize + 1; i++) {
if (this.showTabs) {
var span = this.dom.createElement("span");
span.className = "ace_invisible ace_invisible_tab";
span.textContent = lang.stringRepeat(this.TAB_CHAR, i);
tabStr.push(span);
} else {
tabStr.push(this.dom.createTextNode(lang.stringRepeat(" ", i), this.element));
}
}
if (this.displayIndentGuides) {
this.$indentGuideRe = /\s\S| \t|\t |\s$/;
var className = "ace_indent-guide";
var spaceClass = this.showSpaces ? " ace_invisible ace_invisible_space" : "";
var spaceContent = this.showSpaces
? lang.stringRepeat(this.SPACE_CHAR, this.tabSize)
: lang.stringRepeat(" ", this.tabSize);
public/javascripts/ace/ace.js view on Meta::CPAN
exports.ScrollBarV = VScrollBar; // backward compatibility
exports.ScrollBarH = HScrollBar; // backward compatibility
exports.VScrollBar = VScrollBar;
exports.HScrollBar = HScrollBar;
});
define("ace/renderloop",["require","exports","module","ace/lib/event"], function(require, exports, module) {
"use strict";
var event = require("./lib/event");
var RenderLoop = function(onRender, win) {
this.onRender = onRender;
this.pending = false;
this.changes = 0;
this.$recursionLimit = 2;
this.window = win || window;
var _self = this;
this._flush = function(ts) {
_self.pending = false;
var changes = _self.changes;
if (changes) {
event.blockIdle(100);
_self.changes = 0;
_self.onRender(changes);
}
if (_self.changes) {
if (_self.$recursionLimit-- < 0) return;
_self.schedule();
} else {
_self.$recursionLimit = 2;
}
};
};
(function() {
this.schedule = function(change) {
this.changes = this.changes | change;
if (this.changes && !this.pending) {
event.nextFrame(this._flush);
this.pending = true;
}
};
this.clear = function(change) {
var changes = this.changes;
this.changes = 0;
return changes;
};
}).call(RenderLoop.prototype);
exports.RenderLoop = RenderLoop;
});
define("ace/layer/font_metrics",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/lib/useragent","ace/lib/event_emitter"], function(require, exports, module) {
var oop = require("../lib/oop");
var dom = require("../lib/dom");
var lang = require("../lib/lang");
var event = require("../lib/event");
var useragent = require("../lib/useragent");
var EventEmitter = require("../lib/event_emitter").EventEmitter;
var CHAR_COUNT = 256;
var USE_OBSERVER = typeof ResizeObserver == "function";
var L = 200;
var FontMetrics = exports.FontMetrics = function(parentEl) {
this.el = dom.createElement("div");
this.$setMeasureNodeStyles(this.el.style, true);
this.$main = dom.createElement("div");
this.$setMeasureNodeStyles(this.$main.style);
this.$measureNode = dom.createElement("div");
this.$setMeasureNodeStyles(this.$measureNode.style);
this.el.appendChild(this.$main);
this.el.appendChild(this.$measureNode);
parentEl.appendChild(this.el);
this.$measureNode.textContent = lang.stringRepeat("X", CHAR_COUNT);
this.$characterSize = {width: 0, height: 0};
if (USE_OBSERVER)
this.$addObserver();
else
this.checkForSizeChanges();
};
(function() {
oop.implement(this, EventEmitter);
this.$characterSize = {width: 0, height: 0};
this.$setMeasureNodeStyles = function(style, isRoot) {
style.width = style.height = "auto";
style.left = style.top = "0px";
style.visibility = "hidden";
style.position = "absolute";
style.whiteSpace = "pre";
if (useragent.isIE < 8) {
style["font-family"] = "inherit";
} else {
style.font = "inherit";
}
style.overflow = isRoot ? "hidden" : "visible";
};
this.checkForSizeChanges = function(size) {
if (size === undefined)
size = this.$measureSizes();
if (size && (this.$characterSize.width !== size.width || this.$characterSize.height !== size.height)) {
this.$measureNode.style.fontWeight = "bold";
var boldSize = this.$measureSizes();
this.$measureNode.style.fontWeight = "";
this.$characterSize = size;
this.charSizes = Object.create(null);
this.allowBoldFonts = boldSize && boldSize.width === size.width && boldSize.height === size.height;
this._emit("changeCharacterSize", {data: size});
}
};
this.$addObserver = function() {
var self = this;
this.$observer = new window.ResizeObserver(function(e) {
var rect = e[0].contentRect;
self.checkForSizeChanges({
height: rect.height,
width: rect.width / CHAR_COUNT
});
});
this.$observer.observe(this.$measureNode);
};
this.$pollSizeChanges = function() {
if (this.$pollSizeChangesTimer || this.$observer)
return this.$pollSizeChangesTimer;
var self = this;
return this.$pollSizeChangesTimer = event.onIdle(function cb() {
self.checkForSizeChanges();
event.onIdle(cb, 500);
}, 500);
};
this.setPolling = function(val) {
if (val) {
this.$pollSizeChanges();
} else if (this.$pollSizeChangesTimer) {
clearInterval(this.$pollSizeChangesTimer);
this.$pollSizeChangesTimer = 0;
}
};
this.$measureSizes = function(node) {
var size = {
height: (node || this.$measureNode).clientHeight,
width: (node || this.$measureNode).clientWidth / CHAR_COUNT
};
if (size.width === 0 || size.height === 0)
return null;
return size;
};
this.$measureCharWidth = function(ch) {
this.$main.textContent = lang.stringRepeat(ch, CHAR_COUNT);
var rect = this.$main.getBoundingClientRect();
return rect.width / CHAR_COUNT;
};
this.getCharacterWidth = function(ch) {
var w = this.charSizes[ch];
if (w === undefined) {
w = this.charSizes[ch] = this.$measureCharWidth(ch) / this.$characterSize.width;
}
public/javascripts/ace/ace.js view on Meta::CPAN
if (!element) return 1;
return (window.getComputedStyle(element).zoom || 1) * getZoom(element.parentElement);
};
this.$initTransformMeasureNodes = function() {
var t = function(t, l) {
return ["div", {
style: "position: absolute;top:" + t + "px;left:" + l + "px;"
}];
};
this.els = dom.buildDom([t(0, 0), t(L, 0), t(0, L), t(L, L)], this.el);
};
this.transformCoordinates = function(clientPos, elPos) {
if (clientPos) {
var zoom = this.$getZoom(this.el);
clientPos = mul(1 / zoom, clientPos);
}
function solve(l1, l2, r) {
var det = l1[1] * l2[0] - l1[0] * l2[1];
return [
(-l2[1] * r[0] + l2[0] * r[1]) / det,
(+l1[1] * r[0] - l1[0] * r[1]) / det
];
}
function sub(a, b) { return [a[0] - b[0], a[1] - b[1]]; }
function add(a, b) { return [a[0] + b[0], a[1] + b[1]]; }
function mul(a, b) { return [a * b[0], a * b[1]]; }
if (!this.els)
this.$initTransformMeasureNodes();
function p(el) {
var r = el.getBoundingClientRect();
return [r.left, r.top];
}
var a = p(this.els[0]);
var b = p(this.els[1]);
var c = p(this.els[2]);
var d = p(this.els[3]);
var h = solve(sub(d, b), sub(d, c), sub(add(b, c), add(d, a)));
var m1 = mul(1 + h[0], sub(b, a));
var m2 = mul(1 + h[1], sub(c, a));
if (elPos) {
var x = elPos;
var k = h[0] * x[0] / L + h[1] * x[1] / L + 1;
var ut = add(mul(x[0], m1), mul(x[1], m2));
return add(mul(1 / k / L, ut), a);
}
var u = sub(clientPos, a);
var f = solve(sub(m1, mul(h[0], u)), sub(m2, mul(h[1], u)), u);
return mul(L, f);
};
}).call(FontMetrics.prototype);
});
define("ace/virtual_renderer",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/config","ace/layer/gutter","ace/layer/marker","ace/layer/text","ace/layer/cursor","ace/scrollbar","ace/scrollbar","ace/renderloop","ace/layer/font_metrics","...
"use strict";
var oop = require("./lib/oop");
var dom = require("./lib/dom");
var config = require("./config");
var GutterLayer = require("./layer/gutter").Gutter;
var MarkerLayer = require("./layer/marker").Marker;
var TextLayer = require("./layer/text").Text;
var CursorLayer = require("./layer/cursor").Cursor;
var HScrollBar = require("./scrollbar").HScrollBar;
var VScrollBar = require("./scrollbar").VScrollBar;
var RenderLoop = require("./renderloop").RenderLoop;
var FontMetrics = require("./layer/font_metrics").FontMetrics;
var EventEmitter = require("./lib/event_emitter").EventEmitter;
var editorCss = "\
.ace_br1 {border-top-left-radius : 3px;}\
.ace_br2 {border-top-right-radius : 3px;}\
.ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;}\
.ace_br4 {border-bottom-right-radius: 3px;}\
.ace_br5 {border-top-left-radius : 3px; border-bottom-right-radius: 3px;}\
.ace_br6 {border-top-right-radius : 3px; border-bottom-right-radius: 3px;}\
.ace_br7 {border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;}\
.ace_br8 {border-bottom-left-radius : 3px;}\
.ace_br9 {border-top-left-radius : 3px; border-bottom-left-radius: 3px;}\
.ace_br10{border-top-right-radius : 3px; border-bottom-left-radius: 3px;}\
.ace_br11{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-left-radius: 3px;}\
.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\
.ace_br13{border-top-left-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\
.ace_br14{border-top-right-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\
.ace_br15{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\
.ace_editor {\
position: relative;\
overflow: hidden;\
padding: 0;\
font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;\
direction: ltr;\
text-align: left;\
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);\
}\
.ace_scroller {\
position: absolute;\
overflow: hidden;\
top: 0;\
bottom: 0;\
background-color: inherit;\
-ms-user-select: none;\
-moz-user-select: none;\
-webkit-user-select: none;\
user-select: none;\
cursor: text;\
}\
.ace_content {\
position: absolute;\
box-sizing: border-box;\
min-width: 100%;\
contain: style size layout;\
font-variant-ligatures: no-common-ligatures;\
}\
.ace_dragging .ace_scroller:before{\
position: absolute;\
top: 0;\
left: 0;\
right: 0;\
bottom: 0;\
content: '';\
background: rgba(250, 250, 250, 0.01);\
z-index: 1000;\
}\
.ace_dragging.ace_dark .ace_scroller:before{\
background: rgba(0, 0, 0, 0.01);\
}\
.ace_selecting, .ace_selecting * {\
cursor: text !important;\
}\
.ace_gutter {\
position: absolute;\
overflow : hidden;\
width: auto;\
top: 0;\
bottom: 0;\
left: 0;\
cursor: default;\
z-index: 4;\
-ms-user-select: none;\
-moz-user-select: none;\
-webkit-user-select: none;\
user-select: none;\
contain: style size layout;\
}\
.ace_gutter-active-line {\
position: absolute;\
left: 0;\
right: 0;\
}\
.ace_scroller.ace_scroll-left {\
box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;\
}\
.ace_gutter-cell {\
position: absolute;\
top: 0;\
left: 0;\
right: 0;\
padding-left: 19px;\
padding-right: 6px;\
background-repeat: no-repeat;\
}\
.ace_gutter-cell.ace_error {\
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbb...
background-repeat: no-repeat;\
background-position: 2px center;\
}\
.ace_gutter-cell.ace_warning {\
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064...
background-position: 2px center;\
}\
.ace_gutter-cell.ace_info {\
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkR...
background-position: 2px center;\
}\
.ace_dark .ace_gutter-cell.ace_info {\
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElF...
}\
.ace_scrollbar {\
contain: strict;\
position: absolute;\
right: 0;\
bottom: 0;\
z-index: 6;\
}\
.ace_scrollbar-inner {\
position: absolute;\
cursor: text;\
left: 0;\
top: 0;\
}\
.ace_scrollbar-v{\
overflow-x: hidden;\
overflow-y: scroll;\
top: 0;\
}\
.ace_scrollbar-h {\
overflow-x: scroll;\
overflow-y: hidden;\
left: 0;\
}\
.ace_print-margin {\
position: absolute;\
height: 100%;\
}\
.ace_text-input {\
position: absolute;\
z-index: 0;\
width: 0.5em;\
height: 1em;\
opacity: 0;\
background: transparent;\
-moz-appearance: none;\
appearance: none;\
border: none;\
resize: none;\
outline: none;\
overflow: hidden;\
font: inherit;\
padding: 0 1px;\
margin: 0 -1px;\
contain: strict;\
-ms-user-select: text;\
-moz-user-select: text;\
-webkit-user-select: text;\
user-select: text;\
white-space: pre!important;\
}\
.ace_text-input.ace_composition {\
background: transparent;\
color: inherit;\
z-index: 1000;\
opacity: 1;\
}\
.ace_composition_placeholder { color: transparent }\
.ace_composition_marker { \
border-bottom: 1px solid;\
position: absolute;\
border-radius: 0;\
margin-top: 1px;\
}\
[ace_nocontext=true] {\
transform: none!important;\
filter: none!important;\
clip-path: none!important;\
mask : none!important;\
contain: none!important;\
perspective: none!important;\
mix-blend-mode: initial!important;\
z-index: auto;\
}\
.ace_layer {\
z-index: 1;\
position: absolute;\
overflow: hidden;\
word-wrap: normal;\
white-space: pre;\
height: 100%;\
width: 100%;\
box-sizing: border-box;\
pointer-events: none;\
}\
.ace_gutter-layer {\
position: relative;\
width: auto;\
text-align: right;\
pointer-events: auto;\
height: 1000000px;\
contain: style size layout;\
}\
.ace_text-layer {\
font: inherit !important;\
position: absolute;\
height: 1000000px;\
width: 1000000px;\
contain: style size layout;\
}\
.ace_text-layer > .ace_line, .ace_text-layer > .ace_line_group {\
contain: style size layout;\
position: absolute;\
top: 0;\
left: 0;\
right: 0;\
}\
.ace_hidpi .ace_text-layer,\
.ace_hidpi .ace_gutter-layer,\
.ace_hidpi .ace_content,\
.ace_hidpi .ace_gutter {\
contain: strict;\
will-change: transform;\
}\
.ace_hidpi .ace_text-layer > .ace_line, \
.ace_hidpi .ace_text-layer > .ace_line_group {\
contain: strict;\
}\
.ace_cjk {\
display: inline-block;\
text-align: center;\
}\
.ace_cursor-layer {\
z-index: 4;\
}\
.ace_cursor {\
z-index: 4;\
position: absolute;\
box-sizing: border-box;\
border-left: 2px solid;\
transform: translatez(0);\
}\
.ace_multiselect .ace_cursor {\
border-left-width: 1px;\
}\
.ace_slim-cursors .ace_cursor {\
border-left-width: 1px;\
}\
.ace_overwrite-cursors .ace_cursor {\
border-left-width: 0;\
border-bottom: 1px solid;\
}\
.ace_hidden-cursors .ace_cursor {\
opacity: 0.2;\
}\
.ace_hasPlaceholder .ace_hidden-cursors .ace_cursor {\
opacity: 0;\
}\
.ace_smooth-blinking .ace_cursor {\
transition: opacity 0.18s;\
}\
.ace_animate-blinking .ace_cursor {\
animation-duration: 1000ms;\
animation-timing-function: step-end;\
animation-name: blink-ace-animate;\
public/javascripts/ace/ace.js view on Meta::CPAN
z-index: 5;\
}\
.ace_marker-layer .ace_bracket {\
position: absolute;\
z-index: 6;\
}\
.ace_marker-layer .ace_error_bracket {\
position: absolute;\
border-bottom: 1px solid #DE5555;\
border-radius: 0;\
}\
.ace_marker-layer .ace_active-line {\
position: absolute;\
z-index: 2;\
}\
.ace_marker-layer .ace_selected-word {\
position: absolute;\
z-index: 4;\
box-sizing: border-box;\
}\
.ace_line .ace_fold {\
box-sizing: border-box;\
display: inline-block;\
height: 11px;\
margin-top: -2px;\
vertical-align: middle;\
background-image:\
url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadA...
url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=\");\
background-repeat: no-repeat, repeat-x;\
background-position: center center, top left;\
color: transparent;\
border: 1px solid black;\
border-radius: 2px;\
cursor: pointer;\
pointer-events: auto;\
}\
.ace_dark .ace_fold {\
}\
.ace_fold:hover{\
background-image:\
url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadA...
url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC\");\
}\
.ace_tooltip {\
background-color: #FFF;\
background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));\
border: 1px solid gray;\
border-radius: 1px;\
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);\
color: black;\
max-width: 100%;\
padding: 3px 4px;\
position: fixed;\
z-index: 999999;\
box-sizing: border-box;\
cursor: default;\
white-space: pre;\
word-wrap: break-word;\
line-height: normal;\
font-style: normal;\
font-weight: normal;\
letter-spacing: normal;\
pointer-events: none;\
}\
.ace_folding-enabled > .ace_gutter-cell {\
padding-right: 13px;\
}\
.ace_fold-widget {\
box-sizing: border-box;\
margin: 0 -12px 0 1px;\
display: none;\
width: 11px;\
vertical-align: top;\
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==\");\
background-repeat: no-repeat;\
background-position: center;\
border-radius: 3px;\
border: 1px solid transparent;\
cursor: pointer;\
}\
.ace_folding-enabled .ace_fold-widget {\
display: inline-block; \
}\
.ace_fold-widget.ace_end {\
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==\");\
}\
.ace_fold-widget.ace_closed {\
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==\");\
}\
.ace_fold-widget:hover {\
border: 1px solid rgba(0, 0, 0, 0.3);\
background-color: rgba(255, 255, 255, 0.2);\
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\
}\
.ace_fold-widget:active {\
border: 1px solid rgba(0, 0, 0, 0.4);\
background-color: rgba(0, 0, 0, 0.05);\
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\
}\
.ace_dark .ace_fold-widget {\
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC\");\
}\
.ace_dark .ace_fold-widget.ace_end {\
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==\");\
}\
.ace_dark .ace_fold-widget.ace_closed {\
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==\");\
}\
.ace_dark .ace_fold-widget:hover {\
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\
background-color: rgba(255, 255, 255, 0.1);\
}\
.ace_dark .ace_fold-widget:active {\
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\
}\
.ace_inline_button {\
border: 1px solid lightgray;\
display: inline-block;\
margin: -1px 8px;\
padding: 0 5px;\
pointer-events: auto;\
cursor: pointer;\
}\
.ace_inline_button:hover {\
border-color: gray;\
background: rgba(200,200,200,0.2);\
display: inline-block;\
pointer-events: auto;\
}\
.ace_fold-widget.ace_invalid {\
background-color: #FFB4B4;\
border-color: #DE5555;\
}\
.ace_fade-fold-widgets .ace_fold-widget {\
transition: opacity 0.4s ease 0.05s;\
opacity: 0;\
}\
.ace_fade-fold-widgets:hover .ace_fold-widget {\
transition: opacity 0.05s ease 0.05s;\
opacity:1;\
}\
.ace_underline {\
text-decoration: underline;\
}\
.ace_bold {\
font-weight: bold;\
}\
.ace_nobold .ace_bold {\
font-weight: normal;\
}\
.ace_italic {\
font-style: italic;\
}\
.ace_error-marker {\
background-color: rgba(255, 0, 0,0.2);\
position: absolute;\
z-index: 9;\
}\
.ace_highlight-marker {\
background-color: rgba(255, 255, 0,0.2);\
position: absolute;\
z-index: 8;\
}\
.ace_mobile-menu {\
position: absolute;\
line-height: 1.5;\
border-radius: 4px;\
-ms-user-select: none;\
-moz-user-select: none;\
-webkit-user-select: none;\
user-select: none;\
background: white;\
box-shadow: 1px 3px 2px grey;\
border: 1px solid #dcdcdc;\
color: black;\
}\
.ace_dark > .ace_mobile-menu {\
background: #333;\
color: #ccc;\
box-shadow: 1px 3px 2px grey;\
border: 1px solid #444;\
}\
.ace_mobile-button {\
padding: 2px;\
cursor: pointer;\
overflow: hidden;\
}\
.ace_mobile-button:hover {\
background-color: #eee;\
opacity:1;\
}\
.ace_mobile-button:active {\
background-color: #ddd;\
}\
.ace_placeholder {\
font-family: arial;\
transform: scale(0.9);\
transform-origin: left;\
white-space: pre;\
opacity: 0.7;\
margin: 0 10px;\
}";
var useragent = require("./lib/useragent");
var HIDE_TEXTAREA = useragent.isIE;
dom.importCssString(editorCss, "ace_editor.css");
var VirtualRenderer = function(container, theme) {
var _self = this;
this.container = container || dom.createElement("div");
dom.addCssClass(this.container, "ace_editor");
if (dom.HI_DPI) dom.addCssClass(this.container, "ace_hidpi");
this.setTheme(theme);
this.$gutter = dom.createElement("div");
this.$gutter.className = "ace_gutter";
this.container.appendChild(this.$gutter);
this.$gutter.setAttribute("aria-hidden", true);
this.scroller = dom.createElement("div");
this.scroller.className = "ace_scroller";
this.container.appendChild(this.scroller);
this.content = dom.createElement("div");
this.content.className = "ace_content";
this.scroller.appendChild(this.content);
this.$gutterLayer = new GutterLayer(this.$gutter);
this.$gutterLayer.on("changeGutterWidth", this.onGutterResize.bind(this));
this.$markerBack = new MarkerLayer(this.content);
var textLayer = this.$textLayer = new TextLayer(this.content);
this.canvas = textLayer.element;
this.$markerFront = new MarkerLayer(this.content);
this.$cursorLayer = new CursorLayer(this.content);
this.$horizScroll = false;
this.$vScroll = false;
this.scrollBar =
this.scrollBarV = new VScrollBar(this.container, this);
this.scrollBarH = new HScrollBar(this.container, this);
this.scrollBarV.addEventListener("scroll", function(e) {
if (!_self.$scrollAnimation)
_self.session.setScrollTop(e.data - _self.scrollMargin.top);
});
this.scrollBarH.addEventListener("scroll", function(e) {
if (!_self.$scrollAnimation)
_self.session.setScrollLeft(e.data - _self.scrollMargin.left);
});
this.scrollTop = 0;
this.scrollLeft = 0;
this.cursorPos = {
row : 0,
column : 0
};
this.$fontMetrics = new FontMetrics(this.container);
this.$textLayer.$setFontMetrics(this.$fontMetrics);
this.$textLayer.addEventListener("changeCharacterSize", function(e) {
_self.updateCharacterSize();
_self.onResize(true, _self.gutterWidth, _self.$size.width, _self.$size.height);
_self._signal("changeCharacterSize", e);
});
this.$size = {
width: 0,
height: 0,
scrollerHeight: 0,
scrollerWidth: 0,
$dirty: true
};
this.layerConfig = {
width : 1,
padding : 0,
firstRow : 0,
firstRowScreen: 0,
lastRow : 0,
lineHeight : 0,
characterWidth : 0,
minHeight : 1,
maxHeight : 1,
offset : 0,
height : 1,
gutterOffset: 1
};
this.scrollMargin = {
left: 0,
right: 0,
top: 0,
bottom: 0,
v: 0,
h: 0
};
this.margin = {
left: 0,
right: 0,
top: 0,
bottom: 0,
v: 0,
h: 0
};
this.$keepTextAreaAtCursor = !useragent.isIOS;
this.$loop = new RenderLoop(
this.$renderChanges.bind(this),
this.container.ownerDocument.defaultView
);
this.$loop.schedule(this.CHANGE_FULL);
this.updateCharacterSize();
this.setPadding(4);
config.resetOptions(this);
config._signal("renderer", this);
};
(function() {
this.CHANGE_CURSOR = 1;
this.CHANGE_MARKER = 2;
this.CHANGE_GUTTER = 4;
this.CHANGE_SCROLL = 8;
this.CHANGE_LINES = 16;
this.CHANGE_TEXT = 32;
this.CHANGE_SIZE = 64;
this.CHANGE_MARKER_BACK = 128;
this.CHANGE_MARKER_FRONT = 256;
this.CHANGE_FULL = 512;
this.CHANGE_H_SCROLL = 1024;
oop.implement(this, EventEmitter);
this.updateCharacterSize = function() {
if (this.$textLayer.allowBoldFonts != this.$allowBoldFonts) {
this.$allowBoldFonts = this.$textLayer.allowBoldFonts;
this.setStyle("ace_nobold", !this.$allowBoldFonts);
}
this.layerConfig.characterWidth =
this.characterWidth = this.$textLayer.getCharacterWidth();
this.layerConfig.lineHeight =
this.lineHeight = this.$textLayer.getLineHeight();
this.$updatePrintMargin();
dom.setStyle(this.scroller.style, "line-height", this.lineHeight + "px");
};
this.setSession = function(session) {
if (this.session)
this.session.doc.off("changeNewLineMode", this.onChangeNewLineMode);
this.session = session;
if (session && this.scrollMargin.top && session.getScrollTop() <= 0)
session.setScrollTop(-this.scrollMargin.top);
this.$cursorLayer.setSession(session);
this.$markerBack.setSession(session);
this.$markerFront.setSession(session);
this.$gutterLayer.setSession(session);
this.$textLayer.setSession(session);
if (!session)
return;
this.$loop.schedule(this.CHANGE_FULL);
this.session.$setFontMetrics(this.$fontMetrics);
this.scrollBarH.scrollLeft = this.scrollBarV.scrollTop = null;
this.onChangeNewLineMode = this.onChangeNewLineMode.bind(this);
this.onChangeNewLineMode();
this.session.doc.on("changeNewLineMode", this.onChangeNewLineMode);
};
this.updateLines = function(firstRow, lastRow, force) {
if (lastRow === undefined)
lastRow = Infinity;
if (!this.$changedLines) {
this.$changedLines = {
firstRow: firstRow,
lastRow: lastRow
};
}
else {
if (this.$changedLines.firstRow > firstRow)
this.$changedLines.firstRow = firstRow;
if (this.$changedLines.lastRow < lastRow)
this.$changedLines.lastRow = lastRow;
}
if (this.$changedLines.lastRow < this.layerConfig.firstRow) {
if (force)
this.$changedLines.lastRow = this.layerConfig.lastRow;
else
return;
}
if (this.$changedLines.firstRow > this.layerConfig.lastRow)
return;
this.$loop.schedule(this.CHANGE_LINES);
};
this.onChangeNewLineMode = function() {
this.$loop.schedule(this.CHANGE_TEXT);
this.$textLayer.$updateEolChar();
this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR);
};
this.onChangeTabSize = function() {
this.$loop.schedule(this.CHANGE_TEXT | this.CHANGE_MARKER);
this.$textLayer.onChangeTabSize();
};
this.updateText = function() {
this.$loop.schedule(this.CHANGE_TEXT);
};
this.updateFull = function(force) {
if (force)
this.$renderChanges(this.CHANGE_FULL, true);
else
this.$loop.schedule(this.CHANGE_FULL);
};
this.updateFontSize = function() {
this.$textLayer.checkForSizeChanges();
};
this.$changes = 0;
this.$updateSizeAsync = function() {
if (this.$loop.pending)
public/javascripts/ace/ace.js view on Meta::CPAN
this.getHScrollBarAlwaysVisible = function() {
return this.$hScrollBarAlwaysVisible;
};
this.setHScrollBarAlwaysVisible = function(alwaysVisible) {
this.setOption("hScrollBarAlwaysVisible", alwaysVisible);
};
this.getVScrollBarAlwaysVisible = function() {
return this.$vScrollBarAlwaysVisible;
};
this.setVScrollBarAlwaysVisible = function(alwaysVisible) {
this.setOption("vScrollBarAlwaysVisible", alwaysVisible);
};
this.$updateScrollBarV = function() {
var scrollHeight = this.layerConfig.maxHeight;
var scrollerHeight = this.$size.scrollerHeight;
if (!this.$maxLines && this.$scrollPastEnd) {
scrollHeight -= (scrollerHeight - this.lineHeight) * this.$scrollPastEnd;
if (this.scrollTop > scrollHeight - scrollerHeight) {
scrollHeight = this.scrollTop + scrollerHeight;
this.scrollBarV.scrollTop = null;
}
}
this.scrollBarV.setScrollHeight(scrollHeight + this.scrollMargin.v);
this.scrollBarV.setScrollTop(this.scrollTop + this.scrollMargin.top);
};
this.$updateScrollBarH = function() {
this.scrollBarH.setScrollWidth(this.layerConfig.width + 2 * this.$padding + this.scrollMargin.h);
this.scrollBarH.setScrollLeft(this.scrollLeft + this.scrollMargin.left);
};
this.$frozen = false;
this.freeze = function() {
this.$frozen = true;
};
this.unfreeze = function() {
this.$frozen = false;
};
this.$renderChanges = function(changes, force) {
if (this.$changes) {
changes |= this.$changes;
this.$changes = 0;
}
if ((!this.session || !this.container.offsetWidth || this.$frozen) || (!changes && !force)) {
this.$changes |= changes;
return;
}
if (this.$size.$dirty) {
this.$changes |= changes;
return this.onResize(true);
}
if (!this.lineHeight) {
this.$textLayer.checkForSizeChanges();
}
this._signal("beforeRender", changes);
if (this.session && this.session.$bidiHandler)
this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);
var config = this.layerConfig;
if (changes & this.CHANGE_FULL ||
changes & this.CHANGE_SIZE ||
changes & this.CHANGE_TEXT ||
changes & this.CHANGE_LINES ||
changes & this.CHANGE_SCROLL ||
changes & this.CHANGE_H_SCROLL
) {
changes |= this.$computeLayerConfig() | this.$loop.clear();
if (config.firstRow != this.layerConfig.firstRow && config.firstRowScreen == this.layerConfig.firstRowScreen) {
var st = this.scrollTop + (config.firstRow - this.layerConfig.firstRow) * this.lineHeight;
if (st > 0) {
this.scrollTop = st;
changes = changes | this.CHANGE_SCROLL;
changes |= this.$computeLayerConfig() | this.$loop.clear();
}
}
config = this.layerConfig;
this.$updateScrollBarV();
if (changes & this.CHANGE_H_SCROLL)
this.$updateScrollBarH();
dom.translate(this.content, -this.scrollLeft, -config.offset);
var width = config.width + 2 * this.$padding + "px";
var height = config.minHeight + "px";
dom.setStyle(this.content.style, "width", width);
dom.setStyle(this.content.style, "height", height);
}
if (changes & this.CHANGE_H_SCROLL) {
dom.translate(this.content, -this.scrollLeft, -config.offset);
this.scroller.className = this.scrollLeft <= 0 ? "ace_scroller" : "ace_scroller ace_scroll-left";
}
if (changes & this.CHANGE_FULL) {
this.$changedLines = null;
this.$textLayer.update(config);
if (this.$showGutter)
this.$gutterLayer.update(config);
this.$markerBack.update(config);
this.$markerFront.update(config);
this.$cursorLayer.update(config);
this.$moveTextAreaToCursor();
this._signal("afterRender", changes);
return;
}
if (changes & this.CHANGE_SCROLL) {
this.$changedLines = null;
if (changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES)
this.$textLayer.update(config);
else
this.$textLayer.scrollLines(config);
if (this.$showGutter) {
if (changes & this.CHANGE_GUTTER || changes & this.CHANGE_LINES)
this.$gutterLayer.update(config);
else
this.$gutterLayer.scrollLines(config);
}
public/javascripts/ace/ace.js view on Meta::CPAN
}
var steps = _self.$calcSteps(fromValue, toValue);
this.$scrollAnimation = {from: fromValue, to: toValue, steps: steps};
clearInterval(this.$timer);
_self.session.setScrollTop(steps.shift());
_self.session.$scrollTop = toValue;
this.$timer = setInterval(function() {
if (steps.length) {
_self.session.setScrollTop(steps.shift());
_self.session.$scrollTop = toValue;
} else if (toValue != null) {
_self.session.$scrollTop = -1;
_self.session.setScrollTop(toValue);
toValue = null;
} else {
_self.$timer = clearInterval(_self.$timer);
_self.$scrollAnimation = null;
callback && callback();
}
}, 10);
};
this.scrollToY = function(scrollTop) {
if (this.scrollTop !== scrollTop) {
this.$loop.schedule(this.CHANGE_SCROLL);
this.scrollTop = scrollTop;
}
};
this.scrollToX = function(scrollLeft) {
if (this.scrollLeft !== scrollLeft)
this.scrollLeft = scrollLeft;
this.$loop.schedule(this.CHANGE_H_SCROLL);
};
this.scrollTo = function(x, y) {
this.session.setScrollTop(y);
this.session.setScrollLeft(y);
};
this.scrollBy = function(deltaX, deltaY) {
deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY);
deltaX && this.session.setScrollLeft(this.session.getScrollLeft() + deltaX);
};
this.isScrollableBy = function(deltaX, deltaY) {
if (deltaY < 0 && this.session.getScrollTop() >= 1 - this.scrollMargin.top)
return true;
if (deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight
- this.layerConfig.maxHeight < -1 + this.scrollMargin.bottom)
return true;
if (deltaX < 0 && this.session.getScrollLeft() >= 1 - this.scrollMargin.left)
return true;
if (deltaX > 0 && this.session.getScrollLeft() + this.$size.scrollerWidth
- this.layerConfig.width < -1 + this.scrollMargin.right)
return true;
};
this.pixelToScreenCoordinates = function(x, y) {
var canvasPos;
if (this.$hasCssTransforms) {
canvasPos = {top:0, left: 0};
var p = this.$fontMetrics.transformCoordinates([x, y]);
x = p[1] - this.gutterWidth - this.margin.left;
y = p[0];
} else {
canvasPos = this.scroller.getBoundingClientRect();
}
var offsetX = x + this.scrollLeft - canvasPos.left - this.$padding;
var offset = offsetX / this.characterWidth;
var row = Math.floor((y + this.scrollTop - canvasPos.top) / this.lineHeight);
var col = this.$blockCursor ? Math.floor(offset) : Math.round(offset);
return {row: row, column: col, side: offset - col > 0 ? 1 : -1, offsetX: offsetX};
};
this.screenToTextCoordinates = function(x, y) {
var canvasPos;
if (this.$hasCssTransforms) {
canvasPos = {top:0, left: 0};
var p = this.$fontMetrics.transformCoordinates([x, y]);
x = p[1] - this.gutterWidth - this.margin.left;
y = p[0];
} else {
canvasPos = this.scroller.getBoundingClientRect();
}
var offsetX = x + this.scrollLeft - canvasPos.left - this.$padding;
var offset = offsetX / this.characterWidth;
var col = this.$blockCursor ? Math.floor(offset) : Math.round(offset);
var row = Math.floor((y + this.scrollTop - canvasPos.top) / this.lineHeight);
return this.session.screenToDocumentPosition(row, Math.max(col, 0), offsetX);
};
this.textToScreenCoordinates = function(row, column) {
var canvasPos = this.scroller.getBoundingClientRect();
var pos = this.session.documentToScreenPosition(row, column);
var x = this.$padding + (this.session.$bidiHandler.isBidiRow(pos.row, row)
? this.session.$bidiHandler.getPosLeft(pos.column)
: Math.round(pos.column * this.characterWidth));
var y = pos.row * this.lineHeight;
return {
pageX: canvasPos.left + x - this.scrollLeft,
pageY: canvasPos.top + y - this.scrollTop
};
};
this.visualizeFocus = function() {
dom.addCssClass(this.container, "ace_focus");
};
this.visualizeBlur = function() {
dom.removeCssClass(this.container, "ace_focus");
};
this.showComposition = function(composition) {
this.$composition = composition;
if (!composition.cssText) {
composition.cssText = this.textarea.style.cssText;
}
composition.useTextareaForIME = this.$useTextareaForIME;
if (this.$useTextareaForIME) {
dom.addCssClass(this.textarea, "ace_composition");
this.textarea.style.cssText = "";
this.$moveTextAreaToCursor();
this.$cursorLayer.element.style.display = "none";
}
else {
composition.markerId = this.session.addMarker(composition.markerRange, "ace_composition_marker", "text");
}
};
this.setCompositionText = function(text) {
var cursor = this.session.selection.cursor;
this.addToken(text, "composition_placeholder", cursor.row, cursor.column);
this.$moveTextAreaToCursor();
};
this.hideComposition = function() {
if (!this.$composition)
return;
public/javascripts/ace/ace.js view on Meta::CPAN
} else {
afterLoad(theme);
}
function afterLoad(module) {
if (_self.$themeId != theme)
return cb && cb();
if (!module || !module.cssClass)
throw new Error("couldn't load module " + theme + " or it didn't call define");
if (module.$id)
_self.$themeId = module.$id;
dom.importCssString(
module.cssText,
module.cssClass,
_self.container
);
if (_self.theme)
dom.removeCssClass(_self.container, _self.theme.cssClass);
var padding = "padding" in module ? module.padding
: "padding" in (_self.theme || {}) ? 4 : _self.$padding;
if (_self.$padding && padding != _self.$padding)
_self.setPadding(padding);
_self.$theme = module.cssClass;
_self.theme = module;
dom.addCssClass(_self.container, module.cssClass);
dom.setCssClass(_self.container, "ace_dark", module.isDark);
if (_self.$size) {
_self.$size.width = 0;
_self.$updateSizeAsync();
}
_self._dispatchEvent('themeLoaded', {theme:module});
cb && cb();
}
};
this.getTheme = function() {
return this.$themeId;
};
this.setStyle = function(style, include) {
dom.setCssClass(this.container, style, include !== false);
};
this.unsetStyle = function(style) {
dom.removeCssClass(this.container, style);
};
this.setCursorStyle = function(style) {
dom.setStyle(this.scroller.style, "cursor", style);
};
this.setMouseCursor = function(cursorStyle) {
dom.setStyle(this.scroller.style, "cursor", cursorStyle);
};
this.attachToShadowRoot = function() {
dom.importCssString(editorCss, "ace_editor.css", this.container);
};
this.destroy = function() {
this.freeze();
this.$fontMetrics.destroy();
this.$cursorLayer.destroy();
};
}).call(VirtualRenderer.prototype);
config.defineOptions(VirtualRenderer.prototype, "renderer", {
animatedScroll: {initialValue: false},
showInvisibles: {
set: function(value) {
if (this.$textLayer.setShowInvisibles(value))
this.$loop.schedule(this.CHANGE_TEXT);
},
initialValue: false
},
showPrintMargin: {
set: function() { this.$updatePrintMargin(); },
initialValue: true
},
printMarginColumn: {
set: function() { this.$updatePrintMargin(); },
initialValue: 80
},
printMargin: {
set: function(val) {
if (typeof val == "number")
this.$printMarginColumn = val;
this.$showPrintMargin = !!val;
this.$updatePrintMargin();
},
get: function() {
return this.$showPrintMargin && this.$printMarginColumn;
}
},
showGutter: {
set: function(show){
this.$gutter.style.display = show ? "block" : "none";
this.$loop.schedule(this.CHANGE_FULL);
this.onGutterResize();
},
initialValue: true
},
fadeFoldWidgets: {
set: function(show) {
dom.setCssClass(this.$gutter, "ace_fade-fold-widgets", show);
},
initialValue: false
},
showFoldWidgets: {
set: function(show) {
this.$gutterLayer.setShowFoldWidgets(show);
this.$loop.schedule(this.CHANGE_GUTTER);
},
initialValue: true
},
displayIndentGuides: {
set: function(show) {
if (this.$textLayer.setDisplayIndentGuides(show))
this.$loop.schedule(this.CHANGE_TEXT);
},
initialValue: true
},
highlightGutterLine: {
set: function(shouldHighlight) {
this.$gutterLayer.setHighlightGutterLine(shouldHighlight);
this.$loop.schedule(this.CHANGE_GUTTER);
},
initialValue: true
},
hScrollBarAlwaysVisible: {
set: function(val) {
if (!this.$hScrollBarAlwaysVisible || !this.$horizScroll)
this.$loop.schedule(this.CHANGE_SCROLL);
},
initialValue: false
},
vScrollBarAlwaysVisible: {
set: function(val) {
if (!this.$vScrollBarAlwaysVisible || !this.$vScroll)
this.$loop.schedule(this.CHANGE_SCROLL);
},
initialValue: false
},
fontSize: {
set: function(size) {
if (typeof size == "number")
size = size + "px";
this.container.style.fontSize = size;
this.updateFontSize();
},
initialValue: 12
},
fontFamily: {
set: function(name) {
this.container.style.fontFamily = name;
this.updateFontSize();
}
},
maxLines: {
set: function(val) {
this.updateFull();
}
},
minLines: {
set: function(val) {
if (!(this.$minLines < 0x1ffffffffffff))
this.$minLines = 0;
this.updateFull();
}
},
maxPixelHeight: {
set: function(val) {
this.updateFull();
},
initialValue: 0
},
scrollPastEnd: {
set: function(val) {
val = +val || 0;
if (this.$scrollPastEnd == val)
return;
this.$scrollPastEnd = val;
this.$loop.schedule(this.CHANGE_SCROLL);
},
initialValue: 0,
handlesSet: true
},
fixedWidthGutter: {
set: function(val) {
this.$gutterLayer.$fixedWidth = !!val;
this.$loop.schedule(this.CHANGE_GUTTER);
}
},
theme: {
set: function(val) { this.setTheme(val); },
get: function() { return this.$themeId || this.theme; },
initialValue: "./theme/textmate",
handlesSet: true
},
hasCssTransforms: {
},
useTextareaForIME: {
initialValue: !useragent.isMobile && !useragent.isIE
}
});
exports.VirtualRenderer = VirtualRenderer;
});
define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var net = require("../lib/net");
var EventEmitter = require("../lib/event_emitter").EventEmitter;