Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@convergence/ace-collab-ext

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@convergence/ace-collab-ext - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

130

commonjs/ace-collab-ext.js
/**!
© 2016 Convergence Labs, Inc.
@version 0.1.0
@version 0.1.1
@license MIT

@@ -126,10 +126,38 @@ */

/**
* Implements multiple colored selections in the ace editor. Each selection is
* associated with a particular user. Each user is identified by a unique id
* and has a color associated with them. The selection manager supports block
* selection through multiple AceRanges.
*/
var AceMultiSelectionManager = function () {
function AceMultiSelectionManager(editor) {
/**
* Constructs a new AceMultiSelectionManager that is bound to a particular
* Ace EditSession instance.
*
* @param session {EditSession}
* The Ace EditSession to bind to.
*/
function AceMultiSelectionManager(session) {
_classCallCheck(this, AceMultiSelectionManager);
this._selections = {};
this._session = editor.getSession();
this._session = session;
}
/**
* Adds a new collaborative selection.
*
* @param id {string}
* The unique system identifier for the user associated with this selection.
* @param label {string}
* A human readable / meaningful label / title that identifies the user.
* @param color {string}
* A valid css color string.
* @param ranges {Array<AceRange>}
* An array of ace ranges that specify the initial selection.
*/
_createClass(AceMultiSelectionManager, [{

@@ -147,2 +175,12 @@ key: 'addSelection',

}
/**
* Updates the selection for a particular user.
*
* @param id {string}
* The unique identifier for the user.
* @param ranges {Array<AceRange>}
* The array of ranges that specify the selection.
*/
}, {

@@ -155,2 +193,9 @@ key: 'setSelection',

}
/**
* Clears the selection (but does not remove it) for the specified user.
* @param id {string}
* The unique identifier for the user.
*/
}, {

@@ -163,2 +208,9 @@ key: 'clearSelection',

}
/**
* Removes the selection for the specified user.
* @param id {string}
* The unique identifier for the user.
*/
}, {

@@ -175,2 +227,7 @@ key: 'removeSelection',

}
/**
* Removes all selections.
*/
}, {

@@ -355,13 +412,41 @@ key: 'removeAll',

/**
* Implements multiple colored cursors in the ace editor. Each cursor is
* associated with a particular user. Each user is identified by a unique id
* and has a color associated with them. Each cursor has a position in the
* editor which is specified by a 2-d row and column ({row: 0, column: 10}).
*/
var AceMultiCursorManager = function () {
function AceMultiCursorManager(editor) {
/**
* Constructs a new AceMultiCursorManager that is bound to a particular
* Ace EditSession instance.
*
* @param session {EditSession}
* The Ace EditSession to bind to.
*/
function AceMultiCursorManager(session) {
_classCallCheck(this, AceMultiCursorManager);
this._cursors = {};
this._session = editor.getSession();
this._session = session;
}
/**
* Adds a new collaborative selection.
*
* @param id {string}
* The unique system identifier for the user associated with this selection.
* @param label {string}
* A human readable / meaningful label / title that identifies the user.
* @param color {string}
* A valid css color string.
* @param position {*}
* A 2D-position indicating the location of the cusror in row column format e.g. {row: 0, column: 10}
*/
_createClass(AceMultiCursorManager, [{
key: 'addCursor',
value: function addCursor(id, title, color, position) {
value: function addCursor(id, label, color, position) {
if (this._cursors[id] !== undefined) {

@@ -371,3 +456,3 @@ throw new Error('Cursor with id already defined: ' + id);

var marker = new _AceCursorMarker2.default(this._session, id, title, color, position);
var marker = new _AceCursorMarker2.default(this._session, id, label, color, position);

@@ -377,2 +462,12 @@ this._cursors[id] = marker;

}
/**
* Updates the selection for a particular user.
*
* @param id {string}
* The unique identifier for the user.
* @param position {*}
* A 2-d position indicating the location of the cusror in row column format e.g. {row: 0, column: 10}
*/
}, {

@@ -385,2 +480,10 @@ key: 'setCursor',

}
/**
* Clears the cursor (but does not remove it) for the specified user.
*
* @param id {string}
* The unique identifier for the user.
*/
}, {

@@ -393,2 +496,10 @@ key: 'clearCursor',

}
/**
* Removes the cursor for the specified user.
*
* @param id {string}
* The unique identifier for the user.
*/
}, {

@@ -405,2 +516,7 @@ key: 'removeCursor',

}
/**
* Removes all cursors.
*/
}, {

@@ -407,0 +523,0 @@ key: 'removeAll',

4

commonjs/ace-collab-ext.min.js
/**!
© 2016 Convergence Labs, Inc.
@version 0.1.0
@version 0.1.1
@license MIT
*/
module.exports=function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1);Object.defineProperty(t,"AceMultiSelectionManager",{enumerable:!0,get:function(){return r(i).default}});var o=n(3);Object.defineProperty(t,"AceMultiCursorManager",{enumerable:!0,get:function(){return r(o).default}});var s=n(5);Object.defineProperty(t,"AceRangeUtil",{enumerable:!0,get:function(){return r(s).default}});var u=n(7);Object.defineProperty(t,"AceRadarView",{enumerable:!0,get:function(){return r(u).default}});var a=n(9);Object.defineProperty(t,"AceViewportUtil",{enumerable:!0,get:function(){return r(a).default}})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(2),u=r(s),a=function(){function e(t){i(this,e),this._selections={},this._session=t.getSession()}return o(e,[{key:"addSelection",value:function(e,t,n,r){if(void 0!==this._selections[e])throw new Error("Selection with id already defined: "+e);var i=new u.default(this._session,e,t,n,r);this._selections[e]=i,this._session.addDynamicMarker(i,!1)}},{key:"setSelection",value:function(e,t){var n=this._getSelection(e);n.setSelection(t)}},{key:"clearSelection",value:function(e){var t=this._getSelection(e);t.setSelection(null)}},{key:"removeSelection",value:function(e){var t=this._selections[e];if(void 0===t)throw new Error("Selection not found: "+e);this._session.removeMarker(t.id),delete this._selections[e]}},{key:"removeAll",value:function(){var e=this;Object.getOwnPropertyNames(this._selections).forEach(function(t){e.removeSelection(e._selections[t].selectionId())})}},{key:"_getSelection",value:function(e){var t=this._selections[e];if(void 0===t)throw new Error("Selection not found: "+e);return t}}]),e}();t.default=a},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,r,i,o,s){n(this,e),this._session=t,this._title=i,this._color=o,this._ranges=s||[],this._selectionId=r,this._id=null}return r(e,[{key:"update",value:function(e,t,n,r){var i=this;this._ranges.forEach(function(o){i._renderRange(e,t,n,r,o)})}},{key:"_renderRange",value:function(e,t,n,r,i){var o=i.toScreenRange(n),s=r.lineHeight,u=t.$getTop(o.start.row,r),a=t.$padding+o.start.column*r.characterWidth,l=0;if(o.isMultiLine()){if(this._renderLine(e,{height:s,right:0,top:u,left:a}),u=t.$getTop(i.end.row,r),l=o.end.column*r.characterWidth,this._renderLine(e,{height:s,width:l,top:u,left:t.$padding}),s=(i.end.row-i.start.row-1)*r.lineHeight,s<0)return;u=t.$getTop(i.start.row+1,r),this._renderLine(e,{height:s,right:0,top:u,left:t.$padding})}else l=(i.end.column-i.start.column)*r.characterWidth,this._renderLine(e,{height:s,width:l,top:u,left:a})}},{key:"_renderLine",value:function(e,t){e.push('<div class="ace-multi-selection" style="'),"number"==typeof t.height&&e.push(" height: "+t.height+"px;"),"number"==typeof t.width&&e.push(" width: "+t.width+"px;"),"number"==typeof t.top&&e.push(" top: "+t.top+"px;"),"number"==typeof t.left&&e.push(" left: "+t.left+"px;"),"number"==typeof t.bottom&&e.push(" bottom: "+t.bottom+"px;"),"number"==typeof t.right&&e.push(" right: "+t.right+"px;"),e.push("background-color: "+this._color+'">'),e.push("</div>")}},{key:"setSelection",value:function(e){void 0===e||null===e?this._ranges=[]:e instanceof Array?this._ranges=e:this._ranges=[e],this._forceSessionUpdate()}},{key:"selectionId",value:function(){return this._selectionId}},{key:"markerId",value:function(){return this._id}},{key:"_forceSessionUpdate",value:function(){this._session._signal("changeBackMarker")}}]),e}();t.default=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(4),u=r(s),a=function(){function e(t){i(this,e),this._cursors={},this._session=t.getSession()}return o(e,[{key:"addCursor",value:function(e,t,n,r){if(void 0!==this._cursors[e])throw new Error("Cursor with id already defined: "+e);var i=new u.default(this._session,e,t,n,r);this._cursors[e]=i,this._session.addDynamicMarker(i,!0)}},{key:"setCursor",value:function(e,t){var n=this._getCursor(e);n.setPosition(t)}},{key:"clearCursor",value:function(e){var t=this._getCursor(e);t.setPosition(null)}},{key:"removeCursor",value:function(e){var t=this._cursors[e];if(void 0===t)throw new Error("Cursor not found: "+e);this._session.removeMarker(t.id),delete this._cursors[e]}},{key:"removeAll",value:function(){var e=this;Object.getOwnPropertyNames(this._cursors).forEach(function(t){e.removeCursor(e._cursors[t].cursorId())})}},{key:"_getCursor",value:function(e){var t=this._cursors[e];if(void 0===t)throw new Error("Cursor not found: "+e);return t}}]),e}();t.default=a},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(t,r,i,o,s){n(this,e),this._session=t,this._title=i,this._color=o,this._position=s?this._convertPosition(s):null,this._cursorId=r,this._id=null}return i(e,[{key:"update",value:function(e,t,n,r){if(null!==this._position){var i=this._session.documentToScreenPosition(this._position.row,this._position.column),o=t.$getTop(i.row,r),s=t.$padding+i.column*r.characterWidth,u=r.lineHeight;e.push('<div class="ace-multi-cursor ace_start" style="',"height: "+(u-3)+"px;","width: 2px;","top: "+(o+2)+"px;","left: "+s+"px;","background-color: "+this._color+";",'"></div>'),e.push('<div class="ace-multi-cursor ace_start" style="',"height: 5px;","width: 6px;","top: "+(o-2)+"px;","left: "+(s-2)+"px;","background-color: "+this._color+";",'"></div>')}}},{key:"setPosition",value:function(e){this._position=this._convertPosition(e),this._forceSessionUpdate()}},{key:"setVisible",value:function(e){var t=this._visible;this._visible=e,t!==this._visible&&this._forceSessionUpdate()}},{key:"isVisible",value:function(){return this._visible}},{key:"cursorId",value:function(){return this._cursorId}},{key:"markerId",value:function(){return this._id}},{key:"_forceSessionUpdate",value:function(){this._session._signal("changeFrontMarker")}},{key:"_convertPosition",value:function(e){var t="undefined"==typeof e?"undefined":r(e);if(null===e)return null;if("number"===t)return this._session.getDocument().indexToPosition(e,0);if("number"==typeof e.row&&"number"==typeof e.column)return e;throw new Error("Invalid position: "+e)}}]),e}();t.default=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(6),u=r(s),a=null;a=void 0!==u.default.acequire?u.default.acequire("ace/range").Range:u.default.require("ace/range").Range;var l=function(){function e(){i(this,e)}return o(e,null,[{key:"rangeToJson",value:function(e){return{start:{row:e.start.row,column:e.start.column},end:{row:e.end.row,column:e.end.column}}}},{key:"jsonToRange",value:function(e){return new a(e.start.row,e.start.column,e.end.row,e.end.column)}},{key:"rangesToJson",value:function(t){return t.map(function(t){return e.rangeToJson(t)})}},{key:"jsonToRanges",value:function(t){return t.map(function(t){return e.jsonToRange(t)})}},{key:"toJson",value:function(t){return t instanceof Array?e.rangesToJson(t):e.rangeToJson(t)}},{key:"fromJson",value:function(t){return t instanceof Array?e.jsonToRanges(t):e.jsonToRange(t)}}]),e}();t.default=l},function(e,t){e.exports=require("ace")},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(8),u=r(s),a=function(){function e(t,n){i(this,e),this._container=null,"string"==typeof t?this._container=document.getElementById(t):this._container=t,this._container.style.position="relative",this._views=[],this._editor=n}return o(e,[{key:"addView",value:function(e,t,n,r,i){var o=new u.default(e,t,n,r,i,this._editor);this._container.appendChild(o.element()),o.update(),this._views[e]=o}},{key:"hasView",value:function(e){return void 0!==this._views[e]}},{key:"setViewRows",value:function(e,t){var n=this._views[e];n.setViewRows(t)}},{key:"setCursorRow",value:function(e,t){var n=this._views[e];n.setCursorRow(t)}},{key:"clearView",value:function(e){}},{key:"removeView",value:function(e){var t=this._views[e];t.dispose(),delete this._views[e]}}]),e}();t.default=a},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,r,i,o,s,u){var a=this;n(this,e),this._id=t,this._label=r,this._color=i,this._viewRows=o,this._cursorRow=s,this._editor=u,this._docLineCount=u.getSession().getLength(),this._editorListener=function(){var e=a._editor.getSession().getLength();e!==a._docLineCount&&(a._docLineCount=e,a.update())},this._editor.on("change",this._editorListener),this._scrollElement=document.createElement("div"),this._scrollElement.className="ace-radar-view-scroll-indicator",this._scrollElement.style.borderColor=this._color,this._scrollElement.style.background=this._color,this._scrollElement.title=this._label,this._scrollElement.addEventListener("click",function(e){var t=(a._viewRows.end-a._viewRows.start)/2+a._viewRows.start;a._editor.scrollToLine(t,!0,!1)},!1),this._cursorElement=document.createElement("div"),this._cursorElement.className="ace-radar-view-cursor-indicator",this._cursorElement.style.background=this._color,this._cursorElement.title=this._label,this._cursorElement.addEventListener("click",function(e){a._editor.scrollToLine(a._cursorRow,!0,!1)},!1),this._wrapper=document.createElement("div"),this._wrapper.className="ace-radar-view-wrapper",this._wrapper.style.display="none",this._wrapper.appendChild(this._scrollElement),this._wrapper.appendChild(this._cursorElement)}return r(e,[{key:"element",value:function(){return this._wrapper}},{key:"setCursorRow",value:function(e){this._cursorRow=e,this.update()}},{key:"setViewRows",value:function(e){this._viewRows=e,this.update()}},{key:"update",value:function(){if(this._isSet(this._viewRows)||this._isSet(this._cursorRow)){this._wrapper.style.display=null;var e=this._docLineCount-1;if(this._isSet(this._viewRows)){var t=Math.min(e,this._viewRows.start)/e*100,n=100-Math.min(e,this._viewRows.end)/e*100;this._scrollElement.style.top=t+"%",this._scrollElement.style.bottom=n+"%",this._scrollElement.style.display=null}else this._scrollElement.style.display="none";if(this._isSet(this._cursorRow)){var r=Math.min(this._cursorRow,e)/e,i=(this._wrapper.offsetHeight-this._cursorElement.offsetHeight)/this._wrapper.offsetHeight,o=r*i*100;this._cursorElement.style.top=o+"%",this._cursorElement.style.display=null}else this._cursorElement.style.display="none"}else this._wrapper.style.display="none"}},{key:"_isSet",value:function(e){return void 0!==e&&null!==e}},{key:"dispose",value:function(){this._wrapper.parentNode.removeChild(this._wrapper),this._editor.off(this._editorListener)}}]),e}();t.default=i},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(){n(this,e)}return r(e,null,[{key:"getVisibleIndexRange",value:function(e){var t=e.getFirstVisibleRow(),n=e.getLastVisibleRow();e.isRowFullyVisible(t)||t++,e.isRowFullyVisible(n)||n--;var r=e.getSession().getDocument().positionToIndex({row:t,column:0}),i=e.getSession().getDocument().positionToIndex({row:n,column:0});return{start:r,end:i}}},{key:"indicesToRows",value:function(e,t,n){var r=e.getSession().getDocument().indexToPosition(t).row,i=e.getSession().getDocument().indexToPosition(n).row;return{start:r,end:i}}}]),e}();t.default=i}]);
module.exports=function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1);Object.defineProperty(t,"AceMultiSelectionManager",{enumerable:!0,get:function(){return r(i).default}});var o=n(3);Object.defineProperty(t,"AceMultiCursorManager",{enumerable:!0,get:function(){return r(o).default}});var s=n(5);Object.defineProperty(t,"AceRangeUtil",{enumerable:!0,get:function(){return r(s).default}});var u=n(7);Object.defineProperty(t,"AceRadarView",{enumerable:!0,get:function(){return r(u).default}});var a=n(9);Object.defineProperty(t,"AceViewportUtil",{enumerable:!0,get:function(){return r(a).default}})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(2),u=r(s),a=function(){function e(t){i(this,e),this._selections={},this._session=t}return o(e,[{key:"addSelection",value:function(e,t,n,r){if(void 0!==this._selections[e])throw new Error("Selection with id already defined: "+e);var i=new u.default(this._session,e,t,n,r);this._selections[e]=i,this._session.addDynamicMarker(i,!1)}},{key:"setSelection",value:function(e,t){var n=this._getSelection(e);n.setSelection(t)}},{key:"clearSelection",value:function(e){var t=this._getSelection(e);t.setSelection(null)}},{key:"removeSelection",value:function(e){var t=this._selections[e];if(void 0===t)throw new Error("Selection not found: "+e);this._session.removeMarker(t.id),delete this._selections[e]}},{key:"removeAll",value:function(){var e=this;Object.getOwnPropertyNames(this._selections).forEach(function(t){e.removeSelection(e._selections[t].selectionId())})}},{key:"_getSelection",value:function(e){var t=this._selections[e];if(void 0===t)throw new Error("Selection not found: "+e);return t}}]),e}();t.default=a},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,r,i,o,s){n(this,e),this._session=t,this._title=i,this._color=o,this._ranges=s||[],this._selectionId=r,this._id=null}return r(e,[{key:"update",value:function(e,t,n,r){var i=this;this._ranges.forEach(function(o){i._renderRange(e,t,n,r,o)})}},{key:"_renderRange",value:function(e,t,n,r,i){var o=i.toScreenRange(n),s=r.lineHeight,u=t.$getTop(o.start.row,r),a=t.$padding+o.start.column*r.characterWidth,l=0;if(o.isMultiLine()){if(this._renderLine(e,{height:s,right:0,top:u,left:a}),u=t.$getTop(i.end.row,r),l=o.end.column*r.characterWidth,this._renderLine(e,{height:s,width:l,top:u,left:t.$padding}),s=(i.end.row-i.start.row-1)*r.lineHeight,s<0)return;u=t.$getTop(i.start.row+1,r),this._renderLine(e,{height:s,right:0,top:u,left:t.$padding})}else l=(i.end.column-i.start.column)*r.characterWidth,this._renderLine(e,{height:s,width:l,top:u,left:a})}},{key:"_renderLine",value:function(e,t){e.push('<div class="ace-multi-selection" style="'),"number"==typeof t.height&&e.push(" height: "+t.height+"px;"),"number"==typeof t.width&&e.push(" width: "+t.width+"px;"),"number"==typeof t.top&&e.push(" top: "+t.top+"px;"),"number"==typeof t.left&&e.push(" left: "+t.left+"px;"),"number"==typeof t.bottom&&e.push(" bottom: "+t.bottom+"px;"),"number"==typeof t.right&&e.push(" right: "+t.right+"px;"),e.push("background-color: "+this._color+'">'),e.push("</div>")}},{key:"setSelection",value:function(e){void 0===e||null===e?this._ranges=[]:e instanceof Array?this._ranges=e:this._ranges=[e],this._forceSessionUpdate()}},{key:"selectionId",value:function(){return this._selectionId}},{key:"markerId",value:function(){return this._id}},{key:"_forceSessionUpdate",value:function(){this._session._signal("changeBackMarker")}}]),e}();t.default=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(4),u=r(s),a=function(){function e(t){i(this,e),this._cursors={},this._session=t}return o(e,[{key:"addCursor",value:function(e,t,n,r){if(void 0!==this._cursors[e])throw new Error("Cursor with id already defined: "+e);var i=new u.default(this._session,e,t,n,r);this._cursors[e]=i,this._session.addDynamicMarker(i,!0)}},{key:"setCursor",value:function(e,t){var n=this._getCursor(e);n.setPosition(t)}},{key:"clearCursor",value:function(e){var t=this._getCursor(e);t.setPosition(null)}},{key:"removeCursor",value:function(e){var t=this._cursors[e];if(void 0===t)throw new Error("Cursor not found: "+e);this._session.removeMarker(t.id),delete this._cursors[e]}},{key:"removeAll",value:function(){var e=this;Object.getOwnPropertyNames(this._cursors).forEach(function(t){e.removeCursor(e._cursors[t].cursorId())})}},{key:"_getCursor",value:function(e){var t=this._cursors[e];if(void 0===t)throw new Error("Cursor not found: "+e);return t}}]),e}();t.default=a},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(t,r,i,o,s){n(this,e),this._session=t,this._title=i,this._color=o,this._position=s?this._convertPosition(s):null,this._cursorId=r,this._id=null}return i(e,[{key:"update",value:function(e,t,n,r){if(null!==this._position){var i=this._session.documentToScreenPosition(this._position.row,this._position.column),o=t.$getTop(i.row,r),s=t.$padding+i.column*r.characterWidth,u=r.lineHeight;e.push('<div class="ace-multi-cursor ace_start" style="',"height: "+(u-3)+"px;","width: 2px;","top: "+(o+2)+"px;","left: "+s+"px;","background-color: "+this._color+";",'"></div>'),e.push('<div class="ace-multi-cursor ace_start" style="',"height: 5px;","width: 6px;","top: "+(o-2)+"px;","left: "+(s-2)+"px;","background-color: "+this._color+";",'"></div>')}}},{key:"setPosition",value:function(e){this._position=this._convertPosition(e),this._forceSessionUpdate()}},{key:"setVisible",value:function(e){var t=this._visible;this._visible=e,t!==this._visible&&this._forceSessionUpdate()}},{key:"isVisible",value:function(){return this._visible}},{key:"cursorId",value:function(){return this._cursorId}},{key:"markerId",value:function(){return this._id}},{key:"_forceSessionUpdate",value:function(){this._session._signal("changeFrontMarker")}},{key:"_convertPosition",value:function(e){var t="undefined"==typeof e?"undefined":r(e);if(null===e)return null;if("number"===t)return this._session.getDocument().indexToPosition(e,0);if("number"==typeof e.row&&"number"==typeof e.column)return e;throw new Error("Invalid position: "+e)}}]),e}();t.default=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(6),u=r(s),a=null;a=void 0!==u.default.acequire?u.default.acequire("ace/range").Range:u.default.require("ace/range").Range;var l=function(){function e(){i(this,e)}return o(e,null,[{key:"rangeToJson",value:function(e){return{start:{row:e.start.row,column:e.start.column},end:{row:e.end.row,column:e.end.column}}}},{key:"jsonToRange",value:function(e){return new a(e.start.row,e.start.column,e.end.row,e.end.column)}},{key:"rangesToJson",value:function(t){return t.map(function(t){return e.rangeToJson(t)})}},{key:"jsonToRanges",value:function(t){return t.map(function(t){return e.jsonToRange(t)})}},{key:"toJson",value:function(t){return t instanceof Array?e.rangesToJson(t):e.rangeToJson(t)}},{key:"fromJson",value:function(t){return t instanceof Array?e.jsonToRanges(t):e.jsonToRange(t)}}]),e}();t.default=l},function(e,t){e.exports=require("ace")},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(8),u=r(s),a=function(){function e(t,n){i(this,e),this._container=null,"string"==typeof t?this._container=document.getElementById(t):this._container=t,this._container.style.position="relative",this._views=[],this._editor=n}return o(e,[{key:"addView",value:function(e,t,n,r,i){var o=new u.default(e,t,n,r,i,this._editor);this._container.appendChild(o.element()),o.update(),this._views[e]=o}},{key:"hasView",value:function(e){return void 0!==this._views[e]}},{key:"setViewRows",value:function(e,t){var n=this._views[e];n.setViewRows(t)}},{key:"setCursorRow",value:function(e,t){var n=this._views[e];n.setCursorRow(t)}},{key:"clearView",value:function(e){}},{key:"removeView",value:function(e){var t=this._views[e];t.dispose(),delete this._views[e]}}]),e}();t.default=a},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,r,i,o,s,u){var a=this;n(this,e),this._id=t,this._label=r,this._color=i,this._viewRows=o,this._cursorRow=s,this._editor=u,this._docLineCount=u.getSession().getLength(),this._editorListener=function(){var e=a._editor.getSession().getLength();e!==a._docLineCount&&(a._docLineCount=e,a.update())},this._editor.on("change",this._editorListener),this._scrollElement=document.createElement("div"),this._scrollElement.className="ace-radar-view-scroll-indicator",this._scrollElement.style.borderColor=this._color,this._scrollElement.style.background=this._color,this._scrollElement.title=this._label,this._scrollElement.addEventListener("click",function(e){var t=(a._viewRows.end-a._viewRows.start)/2+a._viewRows.start;a._editor.scrollToLine(t,!0,!1)},!1),this._cursorElement=document.createElement("div"),this._cursorElement.className="ace-radar-view-cursor-indicator",this._cursorElement.style.background=this._color,this._cursorElement.title=this._label,this._cursorElement.addEventListener("click",function(e){a._editor.scrollToLine(a._cursorRow,!0,!1)},!1),this._wrapper=document.createElement("div"),this._wrapper.className="ace-radar-view-wrapper",this._wrapper.style.display="none",this._wrapper.appendChild(this._scrollElement),this._wrapper.appendChild(this._cursorElement)}return r(e,[{key:"element",value:function(){return this._wrapper}},{key:"setCursorRow",value:function(e){this._cursorRow=e,this.update()}},{key:"setViewRows",value:function(e){this._viewRows=e,this.update()}},{key:"update",value:function(){if(this._isSet(this._viewRows)||this._isSet(this._cursorRow)){this._wrapper.style.display=null;var e=this._docLineCount-1;if(this._isSet(this._viewRows)){var t=Math.min(e,this._viewRows.start)/e*100,n=100-Math.min(e,this._viewRows.end)/e*100;this._scrollElement.style.top=t+"%",this._scrollElement.style.bottom=n+"%",this._scrollElement.style.display=null}else this._scrollElement.style.display="none";if(this._isSet(this._cursorRow)){var r=Math.min(this._cursorRow,e)/e,i=(this._wrapper.offsetHeight-this._cursorElement.offsetHeight)/this._wrapper.offsetHeight,o=r*i*100;this._cursorElement.style.top=o+"%",this._cursorElement.style.display=null}else this._cursorElement.style.display="none"}else this._wrapper.style.display="none"}},{key:"_isSet",value:function(e){return void 0!==e&&null!==e}},{key:"dispose",value:function(){this._wrapper.parentNode.removeChild(this._wrapper),this._editor.off(this._editorListener)}}]),e}();t.default=i},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(){n(this,e)}return r(e,null,[{key:"getVisibleIndexRange",value:function(e){var t=e.getFirstVisibleRow(),n=e.getLastVisibleRow();e.isRowFullyVisible(t)||t++,e.isRowFullyVisible(n)||n--;var r=e.getSession().getDocument().positionToIndex({row:t,column:0}),i=e.getSession().getDocument().positionToIndex({row:n,column:0});return{start:r,end:i}}},{key:"indicesToRows",value:function(e,t,n){var r=e.getSession().getDocument().indexToPosition(t).row,i=e.getSession().getDocument().indexToPosition(n).row;return{start:r,end:i}}}]),e}();t.default=i}]);
//# sourceMappingURL=ace-collab-ext.min.js.map
{
"name": "@convergence/ace-collab-ext",
"version": "0.1.0",
"version": "0.1.1",
"title": "Ace Editor Collaborative Extensions",

@@ -5,0 +5,0 @@ "description": "Collaborative Extensions for the Ace Editor",

## Ace Collaborative Extensions
[![Build Status](https://travis-ci.org/convergencelabs/ace-collab-ext.svg?branch=master)](https://travis-ci.org/convergencelabs/ace-collab-ext)
Enhances the [Ace Editor](https://github.com/ajaxorg/ace) by adding the ability to render cues about
what remote users are doing in the system.
Enhances the [Ace Editor](https://github.com/ajaxorg/ace) by adding the ability to render cues about what remote users are doing in the system.

@@ -11,3 +10,3 @@ ## Installation

```npm install --save-dev ace-collab-ext```
```npm install --save-dev @convergence/ace-collab-ext```

@@ -23,7 +22,7 @@ ## Usage

```javascript
var editor = ace.edit("editor");
var curMgr = new AceCollabExt.AceMultiSelectionManager(editor);
const editor = ace.edit("editor");
const curMgr = new AceCollabExt.AceMultiCursorManager(editor.getSession());
// Add a new remote cursor with an id of "uid1", and a color of orange.
curMgr.addCursor("uid1", "User 1", "orange", position);
curMgr.addCursor("uid1", "User 1", "orange", {row: 0, column: 10});

@@ -47,10 +46,18 @@ // Set cursor for "uid1" to index 10.

```javascript
var editor = ace.edit("editor");
var selMgr = new AceCollabExt.AceMultiSelectionManager(editor);
const AceRange = ace.require("ace/range");
const editor = ace.edit("editor");
const selMgr = new AceCollabExt.AceMultiSelectionManager(editor.getSession());
// A two-line block selection
const initialRanges = [
new AceRange(0, 0, 0, 10),
new AceRange(1, 0, 1, 10),
];
// Add a new remote view indicator with an id of "uid1", and a color of orange.
selMgr.addSelection("uid1", "User 1", "orange", ranges);
selMgr.addSelection("uid1", "User 1", "orange", initialRanges);
// Set the selection to a new range.
selMgr.setSelection("uid1", range);
selMgr.setSelection("uid1", new AceRange(10, 0, 11, 10));

@@ -69,4 +76,4 @@ // Nullify the selection without removing the marker.

```javascript
var editor = ace.edit("editor");
var radarView = new AceCollabExt.RadarView("radarView", editor);
const editor = ace.edit("editor");
const radarView = new AceCollabExt.RadarView("radarView", editor);

@@ -80,3 +87,3 @@ // Add a new remote view indicator with an id of "uid1", and a color of orange.

// Set the row location of the cursor to line 10.
radarView.setCursoRow("uid1", 10);
radarView.setCursorRow("uid1", 10);

@@ -83,0 +90,0 @@ // Remove the remote view indicator for "uid1".

/**!
© 2016 Convergence Labs, Inc.
@version 0.1.0
@version 0.1.1
@license MIT

@@ -135,10 +135,38 @@ */

/**
* Implements multiple colored selections in the ace editor. Each selection is
* associated with a particular user. Each user is identified by a unique id
* and has a color associated with them. The selection manager supports block
* selection through multiple AceRanges.
*/
var AceMultiSelectionManager = function () {
function AceMultiSelectionManager(editor) {
/**
* Constructs a new AceMultiSelectionManager that is bound to a particular
* Ace EditSession instance.
*
* @param session {EditSession}
* The Ace EditSession to bind to.
*/
function AceMultiSelectionManager(session) {
_classCallCheck(this, AceMultiSelectionManager);
this._selections = {};
this._session = editor.getSession();
this._session = session;
}
/**
* Adds a new collaborative selection.
*
* @param id {string}
* The unique system identifier for the user associated with this selection.
* @param label {string}
* A human readable / meaningful label / title that identifies the user.
* @param color {string}
* A valid css color string.
* @param ranges {Array<AceRange>}
* An array of ace ranges that specify the initial selection.
*/
_createClass(AceMultiSelectionManager, [{

@@ -156,2 +184,12 @@ key: 'addSelection',

}
/**
* Updates the selection for a particular user.
*
* @param id {string}
* The unique identifier for the user.
* @param ranges {Array<AceRange>}
* The array of ranges that specify the selection.
*/
}, {

@@ -164,2 +202,9 @@ key: 'setSelection',

}
/**
* Clears the selection (but does not remove it) for the specified user.
* @param id {string}
* The unique identifier for the user.
*/
}, {

@@ -172,2 +217,9 @@ key: 'clearSelection',

}
/**
* Removes the selection for the specified user.
* @param id {string}
* The unique identifier for the user.
*/
}, {

@@ -184,2 +236,7 @@ key: 'removeSelection',

}
/**
* Removes all selections.
*/
}, {

@@ -364,13 +421,41 @@ key: 'removeAll',

/**
* Implements multiple colored cursors in the ace editor. Each cursor is
* associated with a particular user. Each user is identified by a unique id
* and has a color associated with them. Each cursor has a position in the
* editor which is specified by a 2-d row and column ({row: 0, column: 10}).
*/
var AceMultiCursorManager = function () {
function AceMultiCursorManager(editor) {
/**
* Constructs a new AceMultiCursorManager that is bound to a particular
* Ace EditSession instance.
*
* @param session {EditSession}
* The Ace EditSession to bind to.
*/
function AceMultiCursorManager(session) {
_classCallCheck(this, AceMultiCursorManager);
this._cursors = {};
this._session = editor.getSession();
this._session = session;
}
/**
* Adds a new collaborative selection.
*
* @param id {string}
* The unique system identifier for the user associated with this selection.
* @param label {string}
* A human readable / meaningful label / title that identifies the user.
* @param color {string}
* A valid css color string.
* @param position {*}
* A 2D-position indicating the location of the cusror in row column format e.g. {row: 0, column: 10}
*/
_createClass(AceMultiCursorManager, [{
key: 'addCursor',
value: function addCursor(id, title, color, position) {
value: function addCursor(id, label, color, position) {
if (this._cursors[id] !== undefined) {

@@ -380,3 +465,3 @@ throw new Error('Cursor with id already defined: ' + id);

var marker = new _AceCursorMarker2.default(this._session, id, title, color, position);
var marker = new _AceCursorMarker2.default(this._session, id, label, color, position);

@@ -386,2 +471,12 @@ this._cursors[id] = marker;

}
/**
* Updates the selection for a particular user.
*
* @param id {string}
* The unique identifier for the user.
* @param position {*}
* A 2-d position indicating the location of the cusror in row column format e.g. {row: 0, column: 10}
*/
}, {

@@ -394,2 +489,10 @@ key: 'setCursor',

}
/**
* Clears the cursor (but does not remove it) for the specified user.
*
* @param id {string}
* The unique identifier for the user.
*/
}, {

@@ -402,2 +505,10 @@ key: 'clearCursor',

}
/**
* Removes the cursor for the specified user.
*
* @param id {string}
* The unique identifier for the user.
*/
}, {

@@ -414,2 +525,7 @@ key: 'removeCursor',

}
/**
* Removes all cursors.
*/
}, {

@@ -416,0 +532,0 @@ key: 'removeAll',

/**!
© 2016 Convergence Labs, Inc.
@version 0.1.0
@version 0.1.1
@license MIT
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ace")):"function"==typeof define&&define.amd?define("AceCollabExt",["ace"],t):"object"==typeof exports?exports.AceCollabExt=t(require("ace")):e.AceCollabExt=t(e.ace)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1);Object.defineProperty(t,"AceMultiSelectionManager",{enumerable:!0,get:function(){return r(i).default}});var o=n(3);Object.defineProperty(t,"AceMultiCursorManager",{enumerable:!0,get:function(){return r(o).default}});var s=n(5);Object.defineProperty(t,"AceRangeUtil",{enumerable:!0,get:function(){return r(s).default}});var u=n(7);Object.defineProperty(t,"AceRadarView",{enumerable:!0,get:function(){return r(u).default}});var a=n(9);Object.defineProperty(t,"AceViewportUtil",{enumerable:!0,get:function(){return r(a).default}})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(2),u=r(s),a=function(){function e(t){i(this,e),this._selections={},this._session=t.getSession()}return o(e,[{key:"addSelection",value:function(e,t,n,r){if(void 0!==this._selections[e])throw new Error("Selection with id already defined: "+e);var i=new u.default(this._session,e,t,n,r);this._selections[e]=i,this._session.addDynamicMarker(i,!1)}},{key:"setSelection",value:function(e,t){var n=this._getSelection(e);n.setSelection(t)}},{key:"clearSelection",value:function(e){var t=this._getSelection(e);t.setSelection(null)}},{key:"removeSelection",value:function(e){var t=this._selections[e];if(void 0===t)throw new Error("Selection not found: "+e);this._session.removeMarker(t.id),delete this._selections[e]}},{key:"removeAll",value:function(){var e=this;Object.getOwnPropertyNames(this._selections).forEach(function(t){e.removeSelection(e._selections[t].selectionId())})}},{key:"_getSelection",value:function(e){var t=this._selections[e];if(void 0===t)throw new Error("Selection not found: "+e);return t}}]),e}();t.default=a},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,r,i,o,s){n(this,e),this._session=t,this._title=i,this._color=o,this._ranges=s||[],this._selectionId=r,this._id=null}return r(e,[{key:"update",value:function(e,t,n,r){var i=this;this._ranges.forEach(function(o){i._renderRange(e,t,n,r,o)})}},{key:"_renderRange",value:function(e,t,n,r,i){var o=i.toScreenRange(n),s=r.lineHeight,u=t.$getTop(o.start.row,r),a=t.$padding+o.start.column*r.characterWidth,l=0;if(o.isMultiLine()){if(this._renderLine(e,{height:s,right:0,top:u,left:a}),u=t.$getTop(i.end.row,r),l=o.end.column*r.characterWidth,this._renderLine(e,{height:s,width:l,top:u,left:t.$padding}),s=(i.end.row-i.start.row-1)*r.lineHeight,s<0)return;u=t.$getTop(i.start.row+1,r),this._renderLine(e,{height:s,right:0,top:u,left:t.$padding})}else l=(i.end.column-i.start.column)*r.characterWidth,this._renderLine(e,{height:s,width:l,top:u,left:a})}},{key:"_renderLine",value:function(e,t){e.push('<div class="ace-multi-selection" style="'),"number"==typeof t.height&&e.push(" height: "+t.height+"px;"),"number"==typeof t.width&&e.push(" width: "+t.width+"px;"),"number"==typeof t.top&&e.push(" top: "+t.top+"px;"),"number"==typeof t.left&&e.push(" left: "+t.left+"px;"),"number"==typeof t.bottom&&e.push(" bottom: "+t.bottom+"px;"),"number"==typeof t.right&&e.push(" right: "+t.right+"px;"),e.push("background-color: "+this._color+'">'),e.push("</div>")}},{key:"setSelection",value:function(e){void 0===e||null===e?this._ranges=[]:e instanceof Array?this._ranges=e:this._ranges=[e],this._forceSessionUpdate()}},{key:"selectionId",value:function(){return this._selectionId}},{key:"markerId",value:function(){return this._id}},{key:"_forceSessionUpdate",value:function(){this._session._signal("changeBackMarker")}}]),e}();t.default=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(4),u=r(s),a=function(){function e(t){i(this,e),this._cursors={},this._session=t.getSession()}return o(e,[{key:"addCursor",value:function(e,t,n,r){if(void 0!==this._cursors[e])throw new Error("Cursor with id already defined: "+e);var i=new u.default(this._session,e,t,n,r);this._cursors[e]=i,this._session.addDynamicMarker(i,!0)}},{key:"setCursor",value:function(e,t){var n=this._getCursor(e);n.setPosition(t)}},{key:"clearCursor",value:function(e){var t=this._getCursor(e);t.setPosition(null)}},{key:"removeCursor",value:function(e){var t=this._cursors[e];if(void 0===t)throw new Error("Cursor not found: "+e);this._session.removeMarker(t.id),delete this._cursors[e]}},{key:"removeAll",value:function(){var e=this;Object.getOwnPropertyNames(this._cursors).forEach(function(t){e.removeCursor(e._cursors[t].cursorId())})}},{key:"_getCursor",value:function(e){var t=this._cursors[e];if(void 0===t)throw new Error("Cursor not found: "+e);return t}}]),e}();t.default=a},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(t,r,i,o,s){n(this,e),this._session=t,this._title=i,this._color=o,this._position=s?this._convertPosition(s):null,this._cursorId=r,this._id=null}return i(e,[{key:"update",value:function(e,t,n,r){if(null!==this._position){var i=this._session.documentToScreenPosition(this._position.row,this._position.column),o=t.$getTop(i.row,r),s=t.$padding+i.column*r.characterWidth,u=r.lineHeight;e.push('<div class="ace-multi-cursor ace_start" style="',"height: "+(u-3)+"px;","width: 2px;","top: "+(o+2)+"px;","left: "+s+"px;","background-color: "+this._color+";",'"></div>'),e.push('<div class="ace-multi-cursor ace_start" style="',"height: 5px;","width: 6px;","top: "+(o-2)+"px;","left: "+(s-2)+"px;","background-color: "+this._color+";",'"></div>')}}},{key:"setPosition",value:function(e){this._position=this._convertPosition(e),this._forceSessionUpdate()}},{key:"setVisible",value:function(e){var t=this._visible;this._visible=e,t!==this._visible&&this._forceSessionUpdate()}},{key:"isVisible",value:function(){return this._visible}},{key:"cursorId",value:function(){return this._cursorId}},{key:"markerId",value:function(){return this._id}},{key:"_forceSessionUpdate",value:function(){this._session._signal("changeFrontMarker")}},{key:"_convertPosition",value:function(e){var t="undefined"==typeof e?"undefined":r(e);if(null===e)return null;if("number"===t)return this._session.getDocument().indexToPosition(e,0);if("number"==typeof e.row&&"number"==typeof e.column)return e;throw new Error("Invalid position: "+e)}}]),e}();t.default=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(6),u=r(s),a=null;a=void 0!==u.default.acequire?u.default.acequire("ace/range").Range:u.default.require("ace/range").Range;var l=function(){function e(){i(this,e)}return o(e,null,[{key:"rangeToJson",value:function(e){return{start:{row:e.start.row,column:e.start.column},end:{row:e.end.row,column:e.end.column}}}},{key:"jsonToRange",value:function(e){return new a(e.start.row,e.start.column,e.end.row,e.end.column)}},{key:"rangesToJson",value:function(t){return t.map(function(t){return e.rangeToJson(t)})}},{key:"jsonToRanges",value:function(t){return t.map(function(t){return e.jsonToRange(t)})}},{key:"toJson",value:function(t){return t instanceof Array?e.rangesToJson(t):e.rangeToJson(t)}},{key:"fromJson",value:function(t){return t instanceof Array?e.jsonToRanges(t):e.jsonToRange(t)}}]),e}();t.default=l},function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(8),u=r(s),a=function(){function e(t,n){i(this,e),this._container=null,"string"==typeof t?this._container=document.getElementById(t):this._container=t,this._container.style.position="relative",this._views=[],this._editor=n}return o(e,[{key:"addView",value:function(e,t,n,r,i){var o=new u.default(e,t,n,r,i,this._editor);this._container.appendChild(o.element()),o.update(),this._views[e]=o}},{key:"hasView",value:function(e){return void 0!==this._views[e]}},{key:"setViewRows",value:function(e,t){var n=this._views[e];n.setViewRows(t)}},{key:"setCursorRow",value:function(e,t){var n=this._views[e];n.setCursorRow(t)}},{key:"clearView",value:function(e){}},{key:"removeView",value:function(e){var t=this._views[e];t.dispose(),delete this._views[e]}}]),e}();t.default=a},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,r,i,o,s,u){var a=this;n(this,e),this._id=t,this._label=r,this._color=i,this._viewRows=o,this._cursorRow=s,this._editor=u,this._docLineCount=u.getSession().getLength(),this._editorListener=function(){var e=a._editor.getSession().getLength();e!==a._docLineCount&&(a._docLineCount=e,a.update())},this._editor.on("change",this._editorListener),this._scrollElement=document.createElement("div"),this._scrollElement.className="ace-radar-view-scroll-indicator",this._scrollElement.style.borderColor=this._color,this._scrollElement.style.background=this._color,this._scrollElement.title=this._label,this._scrollElement.addEventListener("click",function(e){var t=(a._viewRows.end-a._viewRows.start)/2+a._viewRows.start;a._editor.scrollToLine(t,!0,!1)},!1),this._cursorElement=document.createElement("div"),this._cursorElement.className="ace-radar-view-cursor-indicator",this._cursorElement.style.background=this._color,this._cursorElement.title=this._label,this._cursorElement.addEventListener("click",function(e){a._editor.scrollToLine(a._cursorRow,!0,!1)},!1),this._wrapper=document.createElement("div"),this._wrapper.className="ace-radar-view-wrapper",this._wrapper.style.display="none",this._wrapper.appendChild(this._scrollElement),this._wrapper.appendChild(this._cursorElement)}return r(e,[{key:"element",value:function(){return this._wrapper}},{key:"setCursorRow",value:function(e){this._cursorRow=e,this.update()}},{key:"setViewRows",value:function(e){this._viewRows=e,this.update()}},{key:"update",value:function(){if(this._isSet(this._viewRows)||this._isSet(this._cursorRow)){this._wrapper.style.display=null;var e=this._docLineCount-1;if(this._isSet(this._viewRows)){var t=Math.min(e,this._viewRows.start)/e*100,n=100-Math.min(e,this._viewRows.end)/e*100;this._scrollElement.style.top=t+"%",this._scrollElement.style.bottom=n+"%",this._scrollElement.style.display=null}else this._scrollElement.style.display="none";if(this._isSet(this._cursorRow)){var r=Math.min(this._cursorRow,e)/e,i=(this._wrapper.offsetHeight-this._cursorElement.offsetHeight)/this._wrapper.offsetHeight,o=r*i*100;this._cursorElement.style.top=o+"%",this._cursorElement.style.display=null}else this._cursorElement.style.display="none"}else this._wrapper.style.display="none"}},{key:"_isSet",value:function(e){return void 0!==e&&null!==e}},{key:"dispose",value:function(){this._wrapper.parentNode.removeChild(this._wrapper),this._editor.off(this._editorListener)}}]),e}();t.default=i},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(){n(this,e)}return r(e,null,[{key:"getVisibleIndexRange",value:function(e){var t=e.getFirstVisibleRow(),n=e.getLastVisibleRow();e.isRowFullyVisible(t)||t++,e.isRowFullyVisible(n)||n--;var r=e.getSession().getDocument().positionToIndex({row:t,column:0}),i=e.getSession().getDocument().positionToIndex({row:n,column:0});return{start:r,end:i}}},{key:"indicesToRows",value:function(e,t,n){var r=e.getSession().getDocument().indexToPosition(t).row,i=e.getSession().getDocument().indexToPosition(n).row;return{start:r,end:i}}}]),e}();t.default=i}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ace")):"function"==typeof define&&define.amd?define("AceCollabExt",["ace"],t):"object"==typeof exports?exports.AceCollabExt=t(require("ace")):e.AceCollabExt=t(e.ace)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1);Object.defineProperty(t,"AceMultiSelectionManager",{enumerable:!0,get:function(){return r(i).default}});var o=n(3);Object.defineProperty(t,"AceMultiCursorManager",{enumerable:!0,get:function(){return r(o).default}});var s=n(5);Object.defineProperty(t,"AceRangeUtil",{enumerable:!0,get:function(){return r(s).default}});var u=n(7);Object.defineProperty(t,"AceRadarView",{enumerable:!0,get:function(){return r(u).default}});var a=n(9);Object.defineProperty(t,"AceViewportUtil",{enumerable:!0,get:function(){return r(a).default}})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(2),u=r(s),a=function(){function e(t){i(this,e),this._selections={},this._session=t}return o(e,[{key:"addSelection",value:function(e,t,n,r){if(void 0!==this._selections[e])throw new Error("Selection with id already defined: "+e);var i=new u.default(this._session,e,t,n,r);this._selections[e]=i,this._session.addDynamicMarker(i,!1)}},{key:"setSelection",value:function(e,t){var n=this._getSelection(e);n.setSelection(t)}},{key:"clearSelection",value:function(e){var t=this._getSelection(e);t.setSelection(null)}},{key:"removeSelection",value:function(e){var t=this._selections[e];if(void 0===t)throw new Error("Selection not found: "+e);this._session.removeMarker(t.id),delete this._selections[e]}},{key:"removeAll",value:function(){var e=this;Object.getOwnPropertyNames(this._selections).forEach(function(t){e.removeSelection(e._selections[t].selectionId())})}},{key:"_getSelection",value:function(e){var t=this._selections[e];if(void 0===t)throw new Error("Selection not found: "+e);return t}}]),e}();t.default=a},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,r,i,o,s){n(this,e),this._session=t,this._title=i,this._color=o,this._ranges=s||[],this._selectionId=r,this._id=null}return r(e,[{key:"update",value:function(e,t,n,r){var i=this;this._ranges.forEach(function(o){i._renderRange(e,t,n,r,o)})}},{key:"_renderRange",value:function(e,t,n,r,i){var o=i.toScreenRange(n),s=r.lineHeight,u=t.$getTop(o.start.row,r),a=t.$padding+o.start.column*r.characterWidth,l=0;if(o.isMultiLine()){if(this._renderLine(e,{height:s,right:0,top:u,left:a}),u=t.$getTop(i.end.row,r),l=o.end.column*r.characterWidth,this._renderLine(e,{height:s,width:l,top:u,left:t.$padding}),s=(i.end.row-i.start.row-1)*r.lineHeight,s<0)return;u=t.$getTop(i.start.row+1,r),this._renderLine(e,{height:s,right:0,top:u,left:t.$padding})}else l=(i.end.column-i.start.column)*r.characterWidth,this._renderLine(e,{height:s,width:l,top:u,left:a})}},{key:"_renderLine",value:function(e,t){e.push('<div class="ace-multi-selection" style="'),"number"==typeof t.height&&e.push(" height: "+t.height+"px;"),"number"==typeof t.width&&e.push(" width: "+t.width+"px;"),"number"==typeof t.top&&e.push(" top: "+t.top+"px;"),"number"==typeof t.left&&e.push(" left: "+t.left+"px;"),"number"==typeof t.bottom&&e.push(" bottom: "+t.bottom+"px;"),"number"==typeof t.right&&e.push(" right: "+t.right+"px;"),e.push("background-color: "+this._color+'">'),e.push("</div>")}},{key:"setSelection",value:function(e){void 0===e||null===e?this._ranges=[]:e instanceof Array?this._ranges=e:this._ranges=[e],this._forceSessionUpdate()}},{key:"selectionId",value:function(){return this._selectionId}},{key:"markerId",value:function(){return this._id}},{key:"_forceSessionUpdate",value:function(){this._session._signal("changeBackMarker")}}]),e}();t.default=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(4),u=r(s),a=function(){function e(t){i(this,e),this._cursors={},this._session=t}return o(e,[{key:"addCursor",value:function(e,t,n,r){if(void 0!==this._cursors[e])throw new Error("Cursor with id already defined: "+e);var i=new u.default(this._session,e,t,n,r);this._cursors[e]=i,this._session.addDynamicMarker(i,!0)}},{key:"setCursor",value:function(e,t){var n=this._getCursor(e);n.setPosition(t)}},{key:"clearCursor",value:function(e){var t=this._getCursor(e);t.setPosition(null)}},{key:"removeCursor",value:function(e){var t=this._cursors[e];if(void 0===t)throw new Error("Cursor not found: "+e);this._session.removeMarker(t.id),delete this._cursors[e]}},{key:"removeAll",value:function(){var e=this;Object.getOwnPropertyNames(this._cursors).forEach(function(t){e.removeCursor(e._cursors[t].cursorId())})}},{key:"_getCursor",value:function(e){var t=this._cursors[e];if(void 0===t)throw new Error("Cursor not found: "+e);return t}}]),e}();t.default=a},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(t,r,i,o,s){n(this,e),this._session=t,this._title=i,this._color=o,this._position=s?this._convertPosition(s):null,this._cursorId=r,this._id=null}return i(e,[{key:"update",value:function(e,t,n,r){if(null!==this._position){var i=this._session.documentToScreenPosition(this._position.row,this._position.column),o=t.$getTop(i.row,r),s=t.$padding+i.column*r.characterWidth,u=r.lineHeight;e.push('<div class="ace-multi-cursor ace_start" style="',"height: "+(u-3)+"px;","width: 2px;","top: "+(o+2)+"px;","left: "+s+"px;","background-color: "+this._color+";",'"></div>'),e.push('<div class="ace-multi-cursor ace_start" style="',"height: 5px;","width: 6px;","top: "+(o-2)+"px;","left: "+(s-2)+"px;","background-color: "+this._color+";",'"></div>')}}},{key:"setPosition",value:function(e){this._position=this._convertPosition(e),this._forceSessionUpdate()}},{key:"setVisible",value:function(e){var t=this._visible;this._visible=e,t!==this._visible&&this._forceSessionUpdate()}},{key:"isVisible",value:function(){return this._visible}},{key:"cursorId",value:function(){return this._cursorId}},{key:"markerId",value:function(){return this._id}},{key:"_forceSessionUpdate",value:function(){this._session._signal("changeFrontMarker")}},{key:"_convertPosition",value:function(e){var t="undefined"==typeof e?"undefined":r(e);if(null===e)return null;if("number"===t)return this._session.getDocument().indexToPosition(e,0);if("number"==typeof e.row&&"number"==typeof e.column)return e;throw new Error("Invalid position: "+e)}}]),e}();t.default=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(6),u=r(s),a=null;a=void 0!==u.default.acequire?u.default.acequire("ace/range").Range:u.default.require("ace/range").Range;var l=function(){function e(){i(this,e)}return o(e,null,[{key:"rangeToJson",value:function(e){return{start:{row:e.start.row,column:e.start.column},end:{row:e.end.row,column:e.end.column}}}},{key:"jsonToRange",value:function(e){return new a(e.start.row,e.start.column,e.end.row,e.end.column)}},{key:"rangesToJson",value:function(t){return t.map(function(t){return e.rangeToJson(t)})}},{key:"jsonToRanges",value:function(t){return t.map(function(t){return e.jsonToRange(t)})}},{key:"toJson",value:function(t){return t instanceof Array?e.rangesToJson(t):e.rangeToJson(t)}},{key:"fromJson",value:function(t){return t instanceof Array?e.jsonToRanges(t):e.jsonToRange(t)}}]),e}();t.default=l},function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(8),u=r(s),a=function(){function e(t,n){i(this,e),this._container=null,"string"==typeof t?this._container=document.getElementById(t):this._container=t,this._container.style.position="relative",this._views=[],this._editor=n}return o(e,[{key:"addView",value:function(e,t,n,r,i){var o=new u.default(e,t,n,r,i,this._editor);this._container.appendChild(o.element()),o.update(),this._views[e]=o}},{key:"hasView",value:function(e){return void 0!==this._views[e]}},{key:"setViewRows",value:function(e,t){var n=this._views[e];n.setViewRows(t)}},{key:"setCursorRow",value:function(e,t){var n=this._views[e];n.setCursorRow(t)}},{key:"clearView",value:function(e){}},{key:"removeView",value:function(e){var t=this._views[e];t.dispose(),delete this._views[e]}}]),e}();t.default=a},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,r,i,o,s,u){var a=this;n(this,e),this._id=t,this._label=r,this._color=i,this._viewRows=o,this._cursorRow=s,this._editor=u,this._docLineCount=u.getSession().getLength(),this._editorListener=function(){var e=a._editor.getSession().getLength();e!==a._docLineCount&&(a._docLineCount=e,a.update())},this._editor.on("change",this._editorListener),this._scrollElement=document.createElement("div"),this._scrollElement.className="ace-radar-view-scroll-indicator",this._scrollElement.style.borderColor=this._color,this._scrollElement.style.background=this._color,this._scrollElement.title=this._label,this._scrollElement.addEventListener("click",function(e){var t=(a._viewRows.end-a._viewRows.start)/2+a._viewRows.start;a._editor.scrollToLine(t,!0,!1)},!1),this._cursorElement=document.createElement("div"),this._cursorElement.className="ace-radar-view-cursor-indicator",this._cursorElement.style.background=this._color,this._cursorElement.title=this._label,this._cursorElement.addEventListener("click",function(e){a._editor.scrollToLine(a._cursorRow,!0,!1)},!1),this._wrapper=document.createElement("div"),this._wrapper.className="ace-radar-view-wrapper",this._wrapper.style.display="none",this._wrapper.appendChild(this._scrollElement),this._wrapper.appendChild(this._cursorElement)}return r(e,[{key:"element",value:function(){return this._wrapper}},{key:"setCursorRow",value:function(e){this._cursorRow=e,this.update()}},{key:"setViewRows",value:function(e){this._viewRows=e,this.update()}},{key:"update",value:function(){if(this._isSet(this._viewRows)||this._isSet(this._cursorRow)){this._wrapper.style.display=null;var e=this._docLineCount-1;if(this._isSet(this._viewRows)){var t=Math.min(e,this._viewRows.start)/e*100,n=100-Math.min(e,this._viewRows.end)/e*100;this._scrollElement.style.top=t+"%",this._scrollElement.style.bottom=n+"%",this._scrollElement.style.display=null}else this._scrollElement.style.display="none";if(this._isSet(this._cursorRow)){var r=Math.min(this._cursorRow,e)/e,i=(this._wrapper.offsetHeight-this._cursorElement.offsetHeight)/this._wrapper.offsetHeight,o=r*i*100;this._cursorElement.style.top=o+"%",this._cursorElement.style.display=null}else this._cursorElement.style.display="none"}else this._wrapper.style.display="none"}},{key:"_isSet",value:function(e){return void 0!==e&&null!==e}},{key:"dispose",value:function(){this._wrapper.parentNode.removeChild(this._wrapper),this._editor.off(this._editorListener)}}]),e}();t.default=i},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(){n(this,e)}return r(e,null,[{key:"getVisibleIndexRange",value:function(e){var t=e.getFirstVisibleRow(),n=e.getLastVisibleRow();e.isRowFullyVisible(t)||t++,e.isRowFullyVisible(n)||n--;var r=e.getSession().getDocument().positionToIndex({row:t,column:0}),i=e.getSession().getDocument().positionToIndex({row:n,column:0});return{start:r,end:i}}},{key:"indicesToRows",value:function(e,t,n){var r=e.getSession().getDocument().indexToPosition(t).row,i=e.getSession().getDocument().indexToPosition(n).row;return{start:r,end:i}}}]),e}();t.default=i}])});
//# sourceMappingURL=ace-collab-ext.min.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc