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.1 to 0.2.0

css/ace-collab-ext.css

19

LICENSE.txt

@@ -1,7 +0,18 @@

Copyright 2016 Convergence Labs, Inc.
Copyright (c) 2016 Convergence Labs, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{
"name": "@convergence/ace-collab-ext",
"version": "0.1.1",
"version": "0.2.0",
"title": "Ace Editor Collaborative Extensions",

@@ -26,3 +26,4 @@ "description": "Collaborative Extensions for the Ace Editor",

"license": "MIT",
"main": "commonjs/ace-collab-ext.js",
"main": "lib/index.js",
"typings": "typings/index.d.ts",
"publishConfig": {

@@ -32,32 +33,36 @@ "registry": "https://registry.npmjs.org/",

},
"dependencies": {},
"dependencies": {
"brace": "0.11.1"
},
"devDependencies": {
"ace-builds": "1.2.5",
"babel-core": "6.21.0",
"babel-eslint": "6.1.2",
"babel-loader": "6.2.5",
"babel-plugin-add-module-exports": "0.2.1",
"babel-preset-es2015": "6.14.0",
"babel-preset-react": "6.11.1",
"@babel/cli": "7.0.0-beta.44",
"@babel/core": "7.0.0-beta.44",
"@babel/node": "7.0.0-beta.44",
"@babel/preset-env": "7.0.0-beta.44",
"@babel/preset-react": "7.0.0-beta.44",
"@babel/preset-stage-3": "7.0.0-beta.44",
"@babel/preset-typescript": "7.0.0-beta.44",
"@babel/register": "7.0.0-beta.44",
"babel-plugin-module-resolver": "3.1.1",
"del": "2.2.0",
"eslint": "1.7.2",
"eslint-loader": "1.1.0",
"gulp": "3.9.1",
"gulp-babel": "8.0.0-beta.2",
"gulp-bump": "2.4.0",
"gulp-clean-css": "2.0.12",
"gulp-header": "^1.8.8",
"gulp-header": "1.8.8",
"gulp-rename": "1.2.2",
"gulp-sourcemaps": "1.6.0",
"gulp-typescript": "4.0.2",
"gulp-uglify": "2.0.0",
"gulp-webpack": "1.5.0",
"lite-server": "2.2.0",
"mkdirp": "0.5.1",
"webpack": "1.14.0"
"tslint": "5.9.1",
"ts-loader": "4.2.0",
"typescript": "2.8.3",
"webpack": "4.6.0",
"webpack-stream": "4.0.3"
},
"scripts": {
"build": "gulp",
"dist": "gulp dist",
"clean": "gulp clean",
"example": "lite-server"
"clean": "gulp clean"
}
}

@@ -12,2 +12,5 @@ ## Ace Collaborative Extensions

## Demo
Go [here](https://examples.convergence.io/ace/index.html) to see a live demo of multiple cursors, multiple selections, and remote scrollbars (Visit on multiple browsers, or even better, point a friend to it too). This uses [Convergence](https://convergence.io) to handle the synchronization of data and user actions.
## Usage

@@ -14,0 +17,0 @@

/**!
© 2016 Convergence Labs, Inc.
@version 0.1.1
© 2016-2018 Convergence Labs, Inc.
@version 0.2.0
@license MIT

@@ -15,43 +15,72 @@ */

root["AceCollabExt"] = factory(root["ace"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_6__) {
})(window, function(__WEBPACK_EXTERNAL_MODULE__3__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ return __webpack_require__(__webpack_require__.s = 9);
/******/ })

@@ -61,982 +90,694 @@ /************************************************************************/

/* 0 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
'use strict';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.__esModule = true;
var AceViewportUtil = /** @class */ (function () {
function AceViewportUtil() {
}
AceViewportUtil.getVisibleIndexRange = function (editor) {
var firstRow = editor.getFirstVisibleRow();
var lastRow = editor.getLastVisibleRow();
if (!editor.isRowFullyVisible(firstRow)) {
firstRow++;
}
if (!editor.isRowFullyVisible(lastRow)) {
lastRow--;
}
var startPos = editor.getSession().getDocument().positionToIndex({ row: firstRow, column: 0 }, 0);
// todo, this should probably be the end of the row
var endPos = editor.getSession().getDocument().positionToIndex({ row: lastRow, column: 0 }, 0);
return {
start: startPos,
end: endPos
};
};
AceViewportUtil.indicesToRows = function (editor, startIndex, endIndex) {
var startRow = editor.getSession().getDocument().indexToPosition(startIndex, 0).row;
var endRow = editor.getSession().getDocument().indexToPosition(endIndex, 0).row;
return {
start: startRow,
end: endRow
};
};
return AceViewportUtil;
}());
exports.AceViewportUtil = AceViewportUtil;
var _AceMultiSelectionManager = __webpack_require__(1);
Object.defineProperty(exports, 'AceMultiSelectionManager', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_AceMultiSelectionManager).default;
}
});
var _AceMultiCursorManager = __webpack_require__(3);
Object.defineProperty(exports, 'AceMultiCursorManager', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_AceMultiCursorManager).default;
}
});
var _AceRangeUtil = __webpack_require__(5);
Object.defineProperty(exports, 'AceRangeUtil', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_AceRangeUtil).default;
}
});
var _AceRadarView = __webpack_require__(7);
Object.defineProperty(exports, 'AceRadarView', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_AceRadarView).default;
}
});
var _AceViewportUtil = __webpack_require__(9);
Object.defineProperty(exports, 'AceViewportUtil', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_AceViewportUtil).default;
}
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/***/ },
/***/ }),
/* 1 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
'use strict';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.__esModule = true;
var AceRadarViewIndicator = /** @class */ (function () {
function AceRadarViewIndicator(label, color, viewRows, cursorRow, editor) {
var _this = this;
this._label = label;
this._color = color;
this._viewRows = viewRows;
this._cursorRow = cursorRow;
this._editor = editor;
this._docLineCount = editor.getSession().getLength();
this._editorListener = function () {
var newLineCount = _this._editor.getSession().getLength();
if (newLineCount !== _this._docLineCount) {
_this._docLineCount = newLineCount;
_this.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;
// todo implement a custom tooltip for consistent presentation.
this._scrollElement.title = this._label;
this._scrollElement.addEventListener("click", function () {
var middle = ((_this._viewRows.end - _this._viewRows.start) / 2) + _this._viewRows.start;
_this._editor.scrollToLine(middle, true, false, function () { });
}, false);
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 () {
_this._editor.scrollToLine(_this._cursorRow, true, false, function () { });
}, false);
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);
}
AceRadarViewIndicator.prototype.element = function () {
return this._wrapper;
};
AceRadarViewIndicator.prototype.setCursorRow = function (cursorRow) {
this._cursorRow = cursorRow;
this.update();
};
AceRadarViewIndicator.prototype.setViewRows = function (viewRows) {
this._viewRows = viewRows;
this.update();
};
AceRadarViewIndicator.prototype.update = function () {
if (!_isSet(this._viewRows) && !_isSet(this._cursorRow)) {
this._wrapper.style.display = "none";
}
else {
this._wrapper.style.display = null;
var maxLine = this._docLineCount - 1;
if (!_isSet(this._viewRows)) {
this._scrollElement.style.display = "none";
}
else {
var topPercent = Math.min(maxLine, this._viewRows.start) / maxLine * 100;
var bottomPercent = 100 - (Math.min(maxLine, this._viewRows.end) / maxLine * 100);
this._scrollElement.style.top = topPercent + "%";
this._scrollElement.style.bottom = bottomPercent + "%";
this._scrollElement.style.display = null;
}
if (!_isSet(this._cursorRow)) {
this._cursorElement.style.display = "none";
}
else {
var cursorPercent = Math.min(this._cursorRow, maxLine) / maxLine;
var ratio = (this._wrapper.offsetHeight - this._cursorElement.offsetHeight) / this._wrapper.offsetHeight;
var cursorTop = cursorPercent * ratio * 100;
this._cursorElement.style.top = cursorTop + "%";
this._cursorElement.style.display = null;
}
}
};
AceRadarViewIndicator.prototype.dispose = function () {
this._wrapper.parentNode.removeChild(this._wrapper);
this._editor.off("change", this._editorListener);
};
return AceRadarViewIndicator;
}());
exports.AceRadarViewIndicator = AceRadarViewIndicator;
function _isSet(value) {
return value !== undefined && value !== null;
}
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _AceSelectionMarker = __webpack_require__(2);
var _AceSelectionMarker2 = _interopRequireDefault(_AceSelectionMarker);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* 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 () {
/**
* 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 = 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, [{
key: 'addSelection',
value: function addSelection(id, label, color, ranges) {
if (this._selections[id] !== undefined) {
throw new Error('Selection with id already defined: ' + id);
}
var marker = new _AceSelectionMarker2.default(this._session, id, label, color, ranges);
this._selections[id] = marker;
this._session.addDynamicMarker(marker, false);
}
/**
* 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.
*/
}, {
key: 'setSelection',
value: function setSelection(id, ranges) {
var selection = this._getSelection(id);
selection.setSelection(ranges);
}
/**
* Clears the selection (but does not remove it) for the specified user.
* @param id {string}
* The unique identifier for the user.
*/
}, {
key: 'clearSelection',
value: function clearSelection(id) {
var selection = this._getSelection(id);
selection.setSelection(null);
}
/**
* Removes the selection for the specified user.
* @param id {string}
* The unique identifier for the user.
*/
}, {
key: 'removeSelection',
value: function removeSelection(id) {
var selection = this._selections[id];
if (selection === undefined) {
throw new Error('Selection not found: ' + id);
}
this._session.removeMarker(selection.id);
delete this._selections[id];
}
/**
* Removes all selections.
*/
}, {
key: 'removeAll',
value: function removeAll() {
var _this = this;
Object.getOwnPropertyNames(this._selections).forEach(function (key) {
_this.removeSelection(_this._selections[key].selectionId());
});
}
}, {
key: '_getSelection',
value: function _getSelection(id) {
var selection = this._selections[id];
if (selection === undefined) {
throw new Error('Selection not found: ' + id);
}
return selection;
}
}]);
return AceMultiSelectionManager;
}();
exports.default = AceMultiSelectionManager;
/***/ },
/***/ }),
/* 2 */
/***/ function(module, exports) {
/***/ (function(module, exports, __webpack_require__) {
'use strict';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.__esModule = true;
var AceRadarViewIndicator_1 = __webpack_require__(1);
var AceRadarView = /** @class */ (function () {
function AceRadarView(element, editor) {
this._container = null;
if (typeof element === "string") {
this._container = document.getElementById(element);
}
else {
this._container = element;
}
this._container.style.position = "relative";
this._views = {};
this._editor = editor;
}
AceRadarView.prototype.addView = function (id, label, color, viewRows, cursorRow) {
var indicator = new AceRadarViewIndicator_1.AceRadarViewIndicator(label, color, viewRows, cursorRow, this._editor);
this._container.appendChild(indicator.element());
indicator.update();
this._views[id] = indicator;
};
AceRadarView.prototype.hasView = function (id) {
return this._views[id] !== undefined;
};
AceRadarView.prototype.setViewRows = function (id, rows) {
var indicator = this._views[id];
indicator.setViewRows(rows);
};
AceRadarView.prototype.setCursorRow = function (id, row) {
var indicator = this._views[id];
indicator.setCursorRow(row);
};
AceRadarView.prototype.removeView = function (id) {
var indicator = this._views[id];
indicator.dispose();
delete this._views[id];
};
return AceRadarView;
}());
exports.AceRadarView = AceRadarView;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var AceSelectionMarker = function () {
function AceSelectionMarker(session, selectionId, title, color, range) {
_classCallCheck(this, AceSelectionMarker);
this._session = session;
this._title = title;
this._color = color;
this._ranges = range || [];
this._selectionId = selectionId;
this._id = null;
}
_createClass(AceSelectionMarker, [{
key: 'update',
value: function update(html, markerLayer, session, layerConfig) {
var _this = this;
this._ranges.forEach(function (range) {
_this._renderRange(html, markerLayer, session, layerConfig, range);
});
}
}, {
key: '_renderRange',
value: function _renderRange(html, markerLayer, session, layerConfig, range) {
var screenRange = range.toScreenRange(session);
var height = layerConfig.lineHeight;
var top = markerLayer.$getTop(screenRange.start.row, layerConfig);
var left = markerLayer.$padding + screenRange.start.column * layerConfig.characterWidth;
var width = 0;
if (screenRange.isMultiLine()) {
// Render the start line
this._renderLine(html, { height: height, right: 0, top: top, left: left });
// from start of the last line to the selection end
top = markerLayer.$getTop(range.end.row, layerConfig);
width = screenRange.end.column * layerConfig.characterWidth;
this._renderLine(html, { height: height, width: width, top: top, left: markerLayer.$padding });
// all the complete lines
height = (range.end.row - range.start.row - 1) * layerConfig.lineHeight;
if (height < 0) {
return;
}
top = markerLayer.$getTop(range.start.row + 1, layerConfig);
this._renderLine(html, { height: height, right: 0, top: top, left: markerLayer.$padding });
} else {
width = (range.end.column - range.start.column) * layerConfig.characterWidth;
this._renderLine(html, { height: height, width: width, top: top, left: left });
}
}
}, {
key: '_renderLine',
value: function _renderLine(html, bounds) {
html.push('<div class="ace-multi-selection" style="');
if (typeof bounds.height === 'number') {
html.push(' height: ' + bounds.height + 'px;');
}
if (typeof bounds.width === 'number') {
html.push(' width: ' + bounds.width + 'px;');
}
if (typeof bounds.top === 'number') {
html.push(' top: ' + bounds.top + 'px;');
}
if (typeof bounds.left === 'number') {
html.push(' left: ' + bounds.left + 'px;');
}
if (typeof bounds.bottom === 'number') {
html.push(' bottom: ' + bounds.bottom + 'px;');
}
if (typeof bounds.right === 'number') {
html.push(' right: ' + bounds.right + 'px;');
}
html.push('background-color: ' + this._color + '">');
html.push('</div>');
}
}, {
key: 'setSelection',
value: function setSelection(ranges) {
if (ranges === undefined || ranges === null) {
this._ranges = [];
} else if (ranges instanceof Array) {
this._ranges = ranges;
} else {
this._ranges = [ranges];
}
this._forceSessionUpdate();
}
}, {
key: 'selectionId',
value: function selectionId() {
return this._selectionId;
}
}, {
key: 'markerId',
value: function markerId() {
return this._id;
}
}, {
key: '_forceSessionUpdate',
value: function _forceSessionUpdate() {
this._session._signal('changeBackMarker');
}
}]);
return AceSelectionMarker;
}();
exports.default = AceSelectionMarker;
/***/ },
/***/ }),
/* 3 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports) {
'use strict';
module.exports = __WEBPACK_EXTERNAL_MODULE__3__;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _AceCursorMarker = __webpack_require__(4);
var _AceCursorMarker2 = _interopRequireDefault(_AceCursorMarker);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* 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 () {
/**
* 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 = 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, label, color, position) {
if (this._cursors[id] !== undefined) {
throw new Error('Cursor with id already defined: ' + id);
}
var marker = new _AceCursorMarker2.default(this._session, id, label, color, position);
this._cursors[id] = marker;
this._session.addDynamicMarker(marker, true);
}
/**
* 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}
*/
}, {
key: 'setCursor',
value: function setCursor(id, position) {
var cursor = this._getCursor(id);
cursor.setPosition(position);
}
/**
* Clears the cursor (but does not remove it) for the specified user.
*
* @param id {string}
* The unique identifier for the user.
*/
}, {
key: 'clearCursor',
value: function clearCursor(id) {
var cursor = this._getCursor(id);
cursor.setPosition(null);
}
/**
* Removes the cursor for the specified user.
*
* @param id {string}
* The unique identifier for the user.
*/
}, {
key: 'removeCursor',
value: function removeCursor(id) {
var cursor = this._cursors[id];
if (cursor === undefined) {
throw new Error('Cursor not found: ' + id);
}
this._session.removeMarker(cursor.id);
delete this._cursors[id];
}
/**
* Removes all cursors.
*/
}, {
key: 'removeAll',
value: function removeAll() {
var _this = this;
Object.getOwnPropertyNames(this._cursors).forEach(function (key) {
_this.removeCursor(_this._cursors[key].cursorId());
});
}
}, {
key: '_getCursor',
value: function _getCursor(id) {
var cursor = this._cursors[id];
if (cursor === undefined) {
throw new Error('Cursor not found: ' + id);
}
return cursor;
}
}]);
return AceMultiCursorManager;
}();
exports.default = AceMultiCursorManager;
/***/ },
/***/ }),
/* 4 */
/***/ function(module, exports) {
/***/ (function(module, exports, __webpack_require__) {
'use strict';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.__esModule = true;
var ace = __webpack_require__(3);
var AceRange;
if (ace.acequire !== undefined) {
AceRange = ace.acequire("ace/range").Range;
}
else {
AceRange = ace.require("ace/range").Range;
}
var AceRangeUtil = /** @class */ (function () {
function AceRangeUtil() {
}
AceRangeUtil.rangeToJson = function (range) {
return {
start: {
row: range.start.row,
column: range.start.column
},
end: {
row: range.end.row,
column: range.end.column
}
};
};
AceRangeUtil.jsonToRange = function (range) {
return new AceRange(range.start.row, range.start.column, range.end.row, range.end.column);
};
AceRangeUtil.rangesToJson = function (ranges) {
return ranges.map(function (range) {
return AceRangeUtil.rangeToJson(range);
});
};
AceRangeUtil.jsonToRanges = function (ranges) {
return ranges.map(function (range) {
return AceRangeUtil.jsonToRange(range);
});
};
AceRangeUtil.toJson = function (value) {
if (Array.isArray(value)) {
return AceRangeUtil.rangesToJson(value);
}
return AceRangeUtil.rangeToJson(value);
};
AceRangeUtil.fromJson = function (value) {
if (Array.isArray(value)) {
return AceRangeUtil.jsonToRanges(value);
}
return AceRangeUtil.jsonToRange(value);
};
return AceRangeUtil;
}());
exports.AceRangeUtil = AceRangeUtil;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var AceCursorMarker = function () {
function AceCursorMarker(session, cursorId, title, color, position) {
_classCallCheck(this, AceCursorMarker);
this._session = session;
this._title = title;
this._color = color;
this._position = position ? this._convertPosition(position) : null;
this._cursorId = cursorId;
this._id = null;
}
_createClass(AceCursorMarker, [{
key: 'update',
value: function update(html, markerLayer, session, layerConfig) {
if (this._position === null) {
return;
}
var screenPosition = this._session.documentToScreenPosition(this._position.row, this._position.column);
var top = markerLayer.$getTop(screenPosition.row, layerConfig);
var left = markerLayer.$padding + screenPosition.column * layerConfig.characterWidth;
var height = layerConfig.lineHeight;
html.push('<div class="ace-multi-cursor ace_start" style="', 'height: ' + (height - 3) + 'px;', 'width: ' + 2 + 'px;', 'top: ' + (top + 2) + 'px;', 'left: ' + left + 'px;', 'background-color: ' + this._color + ';', '"></div>');
// Caret Top
html.push('<div class="ace-multi-cursor ace_start" style="', 'height: ' + 5 + 'px;', 'width: ' + 6 + 'px;', 'top: ' + (top - 2) + 'px;', 'left: ' + (left - 2) + 'px;', 'background-color: ' + this._color + ';', '"></div>');
}
}, {
key: 'setPosition',
value: function setPosition(position) {
this._position = this._convertPosition(position);
this._forceSessionUpdate();
}
}, {
key: 'setVisible',
value: function setVisible(visible) {
var old = this._visible;
this._visible = visible;
if (old !== this._visible) {
this._forceSessionUpdate();
}
}
}, {
key: 'isVisible',
value: function isVisible() {
return this._visible;
}
}, {
key: 'cursorId',
value: function cursorId() {
return this._cursorId;
}
}, {
key: 'markerId',
value: function markerId() {
return this._id;
}
}, {
key: '_forceSessionUpdate',
value: function _forceSessionUpdate() {
this._session._signal('changeFrontMarker');
}
}, {
key: '_convertPosition',
value: function _convertPosition(position) {
var type = typeof position === 'undefined' ? 'undefined' : _typeof(position);
if (position === null) {
return null;
} else if (type === 'number') {
return this._session.getDocument().indexToPosition(position, 0);
} else if (typeof position.row === 'number' && typeof position.column === 'number') {
return position;
}
throw new Error('Invalid position: ' + position);
}
}]);
return AceCursorMarker;
}();
exports.default = AceCursorMarker;
/***/ },
/***/ }),
/* 5 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
'use strict';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.__esModule = true;
/**
* Represents a marker of a remote users cursor.
*/
var AceCursorMarker = /** @class */ (function () {
/**
* Constructs a new AceCursorMarker
* @param session The Ace Editor Session to bind to.
* @param cursorId the unique id of this cursor.
* @param label The label to display over the cursor.
* @param color The css color of the cursor
* @param position The row / column coordinate of the cursor marker.
*/
function AceCursorMarker(session, cursorId, label, color, position) {
this._session = session;
this._label = label;
this._color = color;
this._position = position ? this._convertPosition(position) : null;
this._cursorId = cursorId;
this._id = null;
this._visible = false;
}
/**
* Called by Ace to update the rendering of the marker.
*
* @param html The html to render, represented by an array of strings.
* @param markerLayer The marker layer containing the cursor marker.
* @param _ Not used.
* @param layerConfig
*/
AceCursorMarker.prototype.update = function (html, markerLayer, _, layerConfig) {
if (this._position === null) {
return;
}
var screenPosition = this._session.documentToScreenPosition(this._position.row, this._position.column);
var top = markerLayer.$getTop(screenPosition.row, layerConfig);
var left = markerLayer.$padding + screenPosition.column * layerConfig.characterWidth;
var height = layerConfig.lineHeight;
html.push("<div class=\"ace-multi-cursor ace_start\" style=\"", "height: " + (height - 3) + "px;", "width: " + 2 + "px;", "top: " + (top + 2) + "px;", "left: " + left + "px;", "background-color: " + this._color + ";", "\"></div>");
// Caret Top
html.push("<div class=\"ace-multi-cursor ace_start\" style=\"", "height: " + 5 + "px;", "width: " + 6 + "px;", "top: " + (top - 2) + "px;", "left: " + (left - 2) + "px;", "background-color: " + this._color + ";", "\"></div>");
};
/**
* Sets the location of the cursor marker.
* @param position The row / column coordinate of the cursor marker.
*/
AceCursorMarker.prototype.setPosition = function (position) {
this._position = this._convertPosition(position);
this._forceSessionUpdate();
};
/**
* Sets the marker to visible / invisible.
*
* @param visible true if the marker should be displayed, false otherwise.
*/
AceCursorMarker.prototype.setVisible = function (visible) {
var old = this._visible;
this._visible = visible;
if (old !== this._visible) {
this._forceSessionUpdate();
}
};
/**
* Determines if the marker should be visible.
*
* @returns true if the cursor should be visible, false otherwise.
*/
AceCursorMarker.prototype.isVisible = function () {
return this._visible;
};
/**
* Gets the unique id of this cursor.
* @returns the unique id of this cursor.
*/
AceCursorMarker.prototype.cursorId = function () {
return this._cursorId;
};
/**
* Gets the id of the marker.
* @returns The marker id.
*/
AceCursorMarker.prototype.markerId = function () {
return this._id;
};
/**
* Gets the label of the marker.
* @returns The marker"s label.
*/
AceCursorMarker.prototype.getLabel = function () {
return this._label;
};
AceCursorMarker.prototype._forceSessionUpdate = function () {
this._session._signal("changeFrontMarker");
};
AceCursorMarker.prototype._convertPosition = function (position) {
var type = typeof position;
if (position === null) {
return null;
}
else if (type === "number") {
return this._session.getDocument().indexToPosition(position, 0);
}
else if (typeof position.row === "number" && typeof position.column === "number") {
return position;
}
throw new Error("Invalid position: " + position);
};
return AceCursorMarker;
}());
exports.AceCursorMarker = AceCursorMarker;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _ace = __webpack_require__(6);
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
var _ace2 = _interopRequireDefault(_ace);
"use strict";
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.__esModule = true;
var AceCursorMarker_1 = __webpack_require__(5);
/**
* 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 = /** @class */ (function () {
/**
* Constructs a new AceMultiCursorManager that is bound to a particular
* Ace EditSession instance.
*
* @param session
* The Ace EditSession to bind to.
*/
function AceMultiCursorManager(session) {
this._cursors = {};
this._session = session;
}
/**
* Adds a new collaborative selection.
*
* @param id
* The unique system identifier for the user associated with this selection.
* @param label
* A human readable / meaningful label / title that identifies the user.
* @param color
* 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}
*/
AceMultiCursorManager.prototype.addCursor = function (id, label, color, position) {
if (this._cursors[id] !== undefined) {
throw new Error("Cursor with id already defined: " + id);
}
var marker = new AceCursorMarker_1.AceCursorMarker(this._session, id, label, color, position);
this._cursors[id] = marker;
this._session.addDynamicMarker(marker, true);
};
/**
* Updates the selection for a particular user.
*
* @param id
* 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}
*/
AceMultiCursorManager.prototype.setCursor = function (id, position) {
var cursor = this._getCursor(id);
cursor.setPosition(position);
};
/**
* Clears the cursor (but does not remove it) for the specified user.
*
* @param id
* The unique identifier for the user.
*/
AceMultiCursorManager.prototype.clearCursor = function (id) {
var cursor = this._getCursor(id);
cursor.setPosition(null);
};
/**
* Removes the cursor for the specified user.
*
* @param id
* The unique identifier for the user.
*/
AceMultiCursorManager.prototype.removeCursor = function (id) {
var cursor = this._cursors[id];
if (cursor === undefined) {
throw new Error("Cursor not found: " + id);
}
// Note: ace adds an id field to all added markers.
this._session.removeMarker(cursor.id);
delete this._cursors[id];
};
/**
* Removes all cursors.
*/
AceMultiCursorManager.prototype.removeAll = function () {
var _this = this;
Object.getOwnPropertyNames(this._cursors).forEach(function (key) {
_this.removeCursor(_this._cursors[key].cursorId());
});
};
AceMultiCursorManager.prototype._getCursor = function (id) {
var cursor = this._cursors[id];
if (cursor === undefined) {
throw new Error("Cursor not found: " + id);
}
return cursor;
};
return AceMultiCursorManager;
}());
exports.AceMultiCursorManager = AceMultiCursorManager;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var AceRange = null;
if (_ace2.default.acequire !== undefined) {
AceRange = _ace2.default.acequire('ace/range').Range;
} else {
AceRange = _ace2.default.require('ace/range').Range;
}
var AceRangeUtil = function () {
function AceRangeUtil() {
_classCallCheck(this, AceRangeUtil);
}
_createClass(AceRangeUtil, null, [{
key: 'rangeToJson',
value: function rangeToJson(range) {
return {
'start': {
'row': range.start.row,
'column': range.start.column
},
'end': {
'row': range.end.row,
'column': range.end.column
}
};
}
}, {
key: 'jsonToRange',
value: function jsonToRange(range) {
return new AceRange(range.start.row, range.start.column, range.end.row, range.end.column);
}
}, {
key: 'rangesToJson',
value: function rangesToJson(ranges) {
return ranges.map(function (range) {
return AceRangeUtil.rangeToJson(range);
});
}
}, {
key: 'jsonToRanges',
value: function jsonToRanges(ranges) {
return ranges.map(function (range) {
return AceRangeUtil.jsonToRange(range);
});
}
}, {
key: 'toJson',
value: function toJson(value) {
if (value instanceof Array) {
return AceRangeUtil.rangesToJson(value);
}
return AceRangeUtil.rangeToJson(value);
}
}, {
key: 'fromJson',
value: function fromJson(value) {
if (value instanceof Array) {
return AceRangeUtil.jsonToRanges(value);
}
return AceRangeUtil.jsonToRange(value);
}
}]);
return AceRangeUtil;
}();
exports.default = AceRangeUtil;
/***/ },
/* 6 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_6__;
/***/ },
/***/ }),
/* 7 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
'use strict';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.__esModule = true;
var AceSelectionMarker = /** @class */ (function () {
function AceSelectionMarker(session, selectionId, label, color, ranges) {
this._session = session;
this._label = label;
this._color = color;
this._ranges = ranges || [];
this._selectionId = selectionId;
this._id = null;
}
AceSelectionMarker.prototype.update = function (html, markerLayer, session, layerConfig) {
var _this = this;
this._ranges.forEach(function (range) {
_this._renderRange(html, markerLayer, session, layerConfig, range);
});
};
AceSelectionMarker.prototype.setSelection = function (ranges) {
if (ranges === undefined || ranges === null) {
this._ranges = [];
}
else if (ranges instanceof Array) {
this._ranges = ranges;
}
else {
this._ranges = [ranges];
}
this._forceSessionUpdate();
};
AceSelectionMarker.prototype.selectionId = function () {
return this._selectionId;
};
AceSelectionMarker.prototype.markerId = function () {
return this._id;
};
AceSelectionMarker.prototype._renderRange = function (html, markerLayer, session, layerConfig, range) {
var screenRange = range.toScreenRange(session);
var height = layerConfig.lineHeight;
var top = markerLayer.$getTop(screenRange.start.row, layerConfig);
var width = 0;
var right = 0;
var left = markerLayer.$padding + screenRange.start.column * layerConfig.characterWidth;
if (screenRange.isMultiLine()) {
// Render the start line
this._renderLine(html, { height: height, right: right, top: top, left: left });
// from start of the last line to the selection end
top = markerLayer.$getTop(range.end.row, layerConfig);
width = screenRange.end.column * layerConfig.characterWidth;
this._renderLine(html, { height: height, width: width, top: top, left: markerLayer.$padding });
// all the complete lines
height = (range.end.row - range.start.row - 1) * layerConfig.lineHeight;
if (height < 0) {
return;
}
top = markerLayer.$getTop(range.start.row + 1, layerConfig);
this._renderLine(html, { height: height, right: right, top: top, left: markerLayer.$padding });
}
else {
width = (range.end.column - range.start.column) * layerConfig.characterWidth;
this._renderLine(html, { height: height, width: width, top: top, left: left });
}
};
AceSelectionMarker.prototype._renderLine = function (html, bounds) {
html.push("<div title=\"" + this._label + "\" class=\"ace-multi-selection\" style=\"");
if (typeof bounds.height === "number") {
html.push(" height: " + bounds.height + "px;");
}
if (typeof bounds.width === "number") {
html.push(" width: " + bounds.width + "px;");
}
if (typeof bounds.top === "number") {
html.push(" top: " + bounds.top + "px;");
}
if (typeof bounds.left === "number") {
html.push(" left: " + bounds.left + "px;");
}
if (typeof bounds.bottom === "number") {
html.push(" bottom: " + bounds.bottom + "px;");
}
if (typeof bounds.right === "number") {
html.push(" right: " + bounds.right + "px;");
}
html.push("background-color: " + this._color + "\">");
html.push("</div>");
};
AceSelectionMarker.prototype._forceSessionUpdate = function () {
this._session._signal("changeBackMarker");
};
return AceSelectionMarker;
}());
exports.AceSelectionMarker = AceSelectionMarker;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _AceRadarViewIndicator = __webpack_require__(8);
var _AceRadarViewIndicator2 = _interopRequireDefault(_AceRadarViewIndicator);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var AceRadarView = function () {
function AceRadarView(element, editor) {
_classCallCheck(this, AceRadarView);
this._container = null;
if (typeof element === 'string') {
this._container = document.getElementById(element);
} else {
this._container = element;
}
this._container.style.position = 'relative';
this._views = [];
this._editor = editor;
}
_createClass(AceRadarView, [{
key: 'addView',
value: function addView(id, label, color, viewRows, cursorRow) {
var indicator = new _AceRadarViewIndicator2.default(id, label, color, viewRows, cursorRow, this._editor);
this._container.appendChild(indicator.element());
indicator.update();
this._views[id] = indicator;
}
}, {
key: 'hasView',
value: function hasView(id) {
return this._views[id] !== undefined;
}
/**
*
* @param id
* @param rows {start: 0, end: 34}
*/
}, {
key: 'setViewRows',
value: function setViewRows(id, rows) {
var indicator = this._views[id];
indicator.setViewRows(rows);
}
}, {
key: 'setCursorRow',
value: function setCursorRow(id, row) {
var indicator = this._views[id];
indicator.setCursorRow(row);
}
}, {
key: 'clearView',
value: function clearView(id) {
// fixme implement
}
}, {
key: 'removeView',
value: function removeView(id) {
var indicator = this._views[id];
indicator.dispose();
delete this._views[id];
}
}]);
return AceRadarView;
}();
exports.default = AceRadarView;
/***/ },
/***/ }),
/* 8 */
/***/ function(module, exports) {
/***/ (function(module, exports, __webpack_require__) {
'use strict';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.__esModule = true;
var AceSelectionMarker_1 = __webpack_require__(7);
/**
* 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 = /** @class */ (function () {
/**
* Constructs a new AceMultiSelectionManager that is bound to a particular
* Ace EditSession instance.
*
* @param session
* The Ace EditSession to bind to.
*/
function AceMultiSelectionManager(session) {
this._selections = {};
this._session = session;
}
/**
* Adds a new collaborative selection.
*
* @param id
* The unique system identifier for the user associated with this selection.
* @param label
* A human readable / meaningful label / title that identifies the user.
* @param color
* A valid css color string.
* @param ranges
* An array of ace ranges that specify the initial selection.
*/
AceMultiSelectionManager.prototype.addSelection = function (id, label, color, ranges) {
if (this._selections[id] !== undefined) {
throw new Error("Selection with id already defined: " + id);
}
var marker = new AceSelectionMarker_1.AceSelectionMarker(this._session, id, label, color, ranges);
this._selections[id] = marker;
this._session.addDynamicMarker(marker, false);
};
/**
* Updates the selection for a particular user.
*
* @param id
* The unique identifier for the user.
* @param ranges
* The array of ranges that specify the selection.
*/
AceMultiSelectionManager.prototype.setSelection = function (id, ranges) {
var selection = this._getSelection(id);
selection.setSelection(ranges);
};
/**
* Clears the selection (but does not remove it) for the specified user.
* @param id
* The unique identifier for the user.
*/
AceMultiSelectionManager.prototype.clearSelection = function (id) {
var selection = this._getSelection(id);
selection.setSelection(null);
};
/**
* Removes the selection for the specified user.
* @param id
* The unique identifier for the user.
*/
AceMultiSelectionManager.prototype.removeSelection = function (id) {
var selection = this._selections[id];
if (selection === undefined) {
throw new Error("Selection not found: " + id);
}
// note: ace adds the id property to whatever marker you pass in.
this._session.removeMarker(selection.id);
delete this._selections[id];
};
/**
* Removes all selections.
*/
AceMultiSelectionManager.prototype.removeAll = function () {
var _this = this;
Object.getOwnPropertyNames(this._selections).forEach(function (key) {
_this.removeSelection(_this._selections[key].selectionId());
});
};
AceMultiSelectionManager.prototype._getSelection = function (id) {
var selection = this._selections[id];
if (selection === undefined) {
throw new Error("Selection not found: " + id);
}
return selection;
};
return AceMultiSelectionManager;
}());
exports.AceMultiSelectionManager = AceMultiSelectionManager;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var AceRadarViewIndicator = function () {
function AceRadarViewIndicator(id, label, color, viewRows, cursorRow, editor) {
var _this = this;
_classCallCheck(this, AceRadarViewIndicator);
this._id = id;
this._label = label;
this._color = color;
this._viewRows = viewRows;
this._cursorRow = cursorRow;
this._editor = editor;
this._docLineCount = editor.getSession().getLength();
this._editorListener = function () {
var newLineCount = _this._editor.getSession().getLength();
if (newLineCount !== _this._docLineCount) {
_this._docLineCount = newLineCount;
_this.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;
// todo implement a custom tooltip for consistent presentation.
this._scrollElement.title = this._label;
this._scrollElement.addEventListener('click', function (e) {
var middle = (_this._viewRows.end - _this._viewRows.start) / 2 + _this._viewRows.start;
_this._editor.scrollToLine(middle, true, false);
}, false);
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) {
_this._editor.scrollToLine(_this._cursorRow, true, false);
}, false);
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);
}
_createClass(AceRadarViewIndicator, [{
key: 'element',
value: function element() {
return this._wrapper;
}
}, {
key: 'setCursorRow',
value: function setCursorRow(cursorRow) {
this._cursorRow = cursorRow;
this.update();
}
}, {
key: 'setViewRows',
value: function setViewRows(viewRows) {
this._viewRows = viewRows;
this.update();
}
}, {
key: 'update',
value: function update() {
if (!this._isSet(this._viewRows) && !this._isSet(this._cursorRow)) {
this._wrapper.style.display = 'none';
} else {
this._wrapper.style.display = null;
var maxLine = this._docLineCount - 1;
if (!this._isSet(this._viewRows)) {
this._scrollElement.style.display = 'none';
} else {
var topPercent = Math.min(maxLine, this._viewRows.start) / maxLine * 100;
var bottomPercent = 100 - Math.min(maxLine, this._viewRows.end) / maxLine * 100;
this._scrollElement.style.top = topPercent + '%';
this._scrollElement.style.bottom = bottomPercent + '%';
this._scrollElement.style.display = null;
}
if (!this._isSet(this._cursorRow)) {
this._cursorElement.style.display = 'none';
} else {
var cursorPercent = Math.min(this._cursorRow, maxLine) / maxLine;
var ratio = (this._wrapper.offsetHeight - this._cursorElement.offsetHeight) / this._wrapper.offsetHeight;
var cursorTop = cursorPercent * ratio * 100;
this._cursorElement.style.top = cursorTop + '%';
this._cursorElement.style.display = null;
}
}
}
}, {
key: '_isSet',
value: function _isSet(value) {
return value !== undefined && value !== null;
}
}, {
key: 'dispose',
value: function dispose() {
this._wrapper.parentNode.removeChild(this._wrapper);
this._editor.off(this._editorListener);
}
}]);
return AceRadarViewIndicator;
}();
exports.default = AceRadarViewIndicator;
/***/ },
/***/ }),
/* 9 */
/***/ function(module, exports) {
/***/ (function(module, exports, __webpack_require__) {
"use strict";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
exports.__esModule = true;
__export(__webpack_require__(8));
__export(__webpack_require__(6));
__export(__webpack_require__(4));
__export(__webpack_require__(2));
__export(__webpack_require__(0));
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var AceViewportUtil = function () {
function AceViewportUtil() {
_classCallCheck(this, AceViewportUtil);
}
_createClass(AceViewportUtil, null, [{
key: "getVisibleIndexRange",
value: function getVisibleIndexRange(editor) {
var firstRow = editor.getFirstVisibleRow();
var lastRow = editor.getLastVisibleRow();
if (!editor.isRowFullyVisible(firstRow)) {
firstRow++;
}
if (!editor.isRowFullyVisible(lastRow)) {
lastRow--;
}
var startPos = editor.getSession().getDocument().positionToIndex({ row: firstRow, column: 0 });
// todo, this should probably be the end of the row
var endPos = editor.getSession().getDocument().positionToIndex({ row: lastRow, column: 0 });
return {
start: startPos,
end: endPos
};
}
}, {
key: "indicesToRows",
value: function indicesToRows(editor, startIndex, endIndex) {
var startRow = editor.getSession().getDocument().indexToPosition(startIndex).row;
var endRow = editor.getSession().getDocument().indexToPosition(endIndex).row;
return {
start: startRow,
end: endRow
};
}
}]);
return AceViewportUtil;
}();
exports.default = AceViewportUtil;
/***/ }
/******/ ])
});
;
/***/ })
/******/ ]);
});
/**!
© 2016 Convergence Labs, Inc.
@version 0.1.1
© 2016-2018 Convergence Labs, Inc.
@version 0.2.0
@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}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}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("ace")):"function"==typeof define&&define.amd?define("AceCollabExt",["ace"],e):"object"==typeof exports?exports.AceCollabExt=e(require("ace")):t.AceCollabExt=e(t.ace)}(window,function(t){return function(t){function e(i){if(o[i])return o[i].exports;var r=o[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var o={};return e.m=t,e.c=o,e.d=function(t,o,i){e.o(t,o)||Object.defineProperty(t,o,{configurable:!1,enumerable:!0,get:i})},e.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},e.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(o,"a",o),o},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=9)}([function(t,e,o){"use strict";e.__esModule=!0;var i=function(){function t(){}return t.getVisibleIndexRange=function(t){var e=t.getFirstVisibleRow(),o=t.getLastVisibleRow();t.isRowFullyVisible(e)||e++,t.isRowFullyVisible(o)||o--;var i=t.getSession().getDocument().positionToIndex({row:e,column:0},0),r=t.getSession().getDocument().positionToIndex({row:o,column:0},0);return{start:i,end:r}},t.indicesToRows=function(t,e,o){var i=t.getSession().getDocument().indexToPosition(e,0).row,r=t.getSession().getDocument().indexToPosition(o,0).row;return{start:i,end:r}},t}();e.AceViewportUtil=i},function(t,e,o){"use strict";function i(t){return void 0!==t&&null!==t}e.__esModule=!0;var r=function(){function t(t,e,o,i,r){var n=this;this._label=t,this._color=e,this._viewRows=o,this._cursorRow=i,this._editor=r,this._docLineCount=r.getSession().getLength(),this._editorListener=function(){var t=n._editor.getSession().getLength();t!==n._docLineCount&&(n._docLineCount=t,n.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(){var t=(n._viewRows.end-n._viewRows.start)/2+n._viewRows.start;n._editor.scrollToLine(t,!0,!1,function(){})},!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(){n._editor.scrollToLine(n._cursorRow,!0,!1,function(){})},!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 t.prototype.element=function(){return this._wrapper},t.prototype.setCursorRow=function(t){this._cursorRow=t,this.update()},t.prototype.setViewRows=function(t){this._viewRows=t,this.update()},t.prototype.update=function(){if(i(this._viewRows)||i(this._cursorRow)){this._wrapper.style.display=null;var t=this._docLineCount-1;if(i(this._viewRows)){var e=Math.min(t,this._viewRows.start)/t*100,o=100-Math.min(t,this._viewRows.end)/t*100;this._scrollElement.style.top=e+"%",this._scrollElement.style.bottom=o+"%",this._scrollElement.style.display=null}else this._scrollElement.style.display="none";if(i(this._cursorRow)){var r=Math.min(this._cursorRow,t)/t,n=(this._wrapper.offsetHeight-this._cursorElement.offsetHeight)/this._wrapper.offsetHeight,s=r*n*100;this._cursorElement.style.top=s+"%",this._cursorElement.style.display=null}else this._cursorElement.style.display="none"}else this._wrapper.style.display="none"},t.prototype.dispose=function(){this._wrapper.parentNode.removeChild(this._wrapper),this._editor.off("change",this._editorListener)},t}();e.AceRadarViewIndicator=r},function(t,e,o){"use strict";e.__esModule=!0;var i=o(1),r=function(){function t(t,e){this._container=null,"string"==typeof t?this._container=document.getElementById(t):this._container=t,this._container.style.position="relative",this._views={},this._editor=e}return t.prototype.addView=function(t,e,o,r,n){var s=new i.AceRadarViewIndicator(e,o,r,n,this._editor);this._container.appendChild(s.element()),s.update(),this._views[t]=s},t.prototype.hasView=function(t){return void 0!==this._views[t]},t.prototype.setViewRows=function(t,e){var o=this._views[t];o.setViewRows(e)},t.prototype.setCursorRow=function(t,e){var o=this._views[t];o.setCursorRow(e)},t.prototype.removeView=function(t){var e=this._views[t];e.dispose(),delete this._views[t]},t}();e.AceRadarView=r},function(e,o){e.exports=t},function(t,e,o){"use strict";e.__esModule=!0;var i,r=o(3);i=void 0!==r.acequire?r.acequire("ace/range").Range:r.require("ace/range").Range;var n=function(){function t(){}return t.rangeToJson=function(t){return{start:{row:t.start.row,column:t.start.column},end:{row:t.end.row,column:t.end.column}}},t.jsonToRange=function(t){return new i(t.start.row,t.start.column,t.end.row,t.end.column)},t.rangesToJson=function(e){return e.map(function(e){return t.rangeToJson(e)})},t.jsonToRanges=function(e){return e.map(function(e){return t.jsonToRange(e)})},t.toJson=function(e){return Array.isArray(e)?t.rangesToJson(e):t.rangeToJson(e)},t.fromJson=function(e){return Array.isArray(e)?t.jsonToRanges(e):t.jsonToRange(e)},t}();e.AceRangeUtil=n},function(t,e,o){"use strict";e.__esModule=!0;var i=function(){function t(t,e,o,i,r){this._session=t,this._label=o,this._color=i,this._position=r?this._convertPosition(r):null,this._cursorId=e,this._id=null,this._visible=!1}return t.prototype.update=function(t,e,o,i){if(null!==this._position){var r=this._session.documentToScreenPosition(this._position.row,this._position.column),n=e.$getTop(r.row,i),s=e.$padding+r.column*i.characterWidth,c=i.lineHeight;t.push('<div class="ace-multi-cursor ace_start" style="',"height: "+(c-3)+"px;","width: 2px;","top: "+(n+2)+"px;","left: "+s+"px;","background-color: "+this._color+";",'"></div>'),t.push('<div class="ace-multi-cursor ace_start" style="',"height: 5px;","width: 6px;","top: "+(n-2)+"px;","left: "+(s-2)+"px;","background-color: "+this._color+";",'"></div>')}},t.prototype.setPosition=function(t){this._position=this._convertPosition(t),this._forceSessionUpdate()},t.prototype.setVisible=function(t){var e=this._visible;this._visible=t,e!==this._visible&&this._forceSessionUpdate()},t.prototype.isVisible=function(){return this._visible},t.prototype.cursorId=function(){return this._cursorId},t.prototype.markerId=function(){return this._id},t.prototype.getLabel=function(){return this._label},t.prototype._forceSessionUpdate=function(){this._session._signal("changeFrontMarker")},t.prototype._convertPosition=function(t){var e=typeof t;if(null===t)return null;if("number"===e)return this._session.getDocument().indexToPosition(t,0);if("number"==typeof t.row&&"number"==typeof t.column)return t;throw new Error("Invalid position: "+t)},t}();e.AceCursorMarker=i},function(t,e,o){"use strict";e.__esModule=!0;var i=o(5),r=function(){function t(t){this._cursors={},this._session=t}return t.prototype.addCursor=function(t,e,o,r){if(void 0!==this._cursors[t])throw new Error("Cursor with id already defined: "+t);var n=new i.AceCursorMarker(this._session,t,e,o,r);this._cursors[t]=n,this._session.addDynamicMarker(n,!0)},t.prototype.setCursor=function(t,e){var o=this._getCursor(t);o.setPosition(e)},t.prototype.clearCursor=function(t){var e=this._getCursor(t);e.setPosition(null)},t.prototype.removeCursor=function(t){var e=this._cursors[t];if(void 0===e)throw new Error("Cursor not found: "+t);this._session.removeMarker(e.id),delete this._cursors[t]},t.prototype.removeAll=function(){var t=this;Object.getOwnPropertyNames(this._cursors).forEach(function(e){t.removeCursor(t._cursors[e].cursorId())})},t.prototype._getCursor=function(t){var e=this._cursors[t];if(void 0===e)throw new Error("Cursor not found: "+t);return e},t}();e.AceMultiCursorManager=r},function(t,e,o){"use strict";e.__esModule=!0;var i=function(){function t(t,e,o,i,r){this._session=t,this._label=o,this._color=i,this._ranges=r||[],this._selectionId=e,this._id=null}return t.prototype.update=function(t,e,o,i){var r=this;this._ranges.forEach(function(n){r._renderRange(t,e,o,i,n)})},t.prototype.setSelection=function(t){void 0===t||null===t?this._ranges=[]:t instanceof Array?this._ranges=t:this._ranges=[t],this._forceSessionUpdate()},t.prototype.selectionId=function(){return this._selectionId},t.prototype.markerId=function(){return this._id},t.prototype._renderRange=function(t,e,o,i,r){var n=r.toScreenRange(o),s=i.lineHeight,c=e.$getTop(n.start.row,i),u=0,l=0,a=e.$padding+n.start.column*i.characterWidth;if(n.isMultiLine()){if(this._renderLine(t,{height:s,right:l,top:c,left:a}),c=e.$getTop(r.end.row,i),u=n.end.column*i.characterWidth,this._renderLine(t,{height:s,width:u,top:c,left:e.$padding}),s=(r.end.row-r.start.row-1)*i.lineHeight,s<0)return;c=e.$getTop(r.start.row+1,i),this._renderLine(t,{height:s,right:l,top:c,left:e.$padding})}else u=(r.end.column-r.start.column)*i.characterWidth,this._renderLine(t,{height:s,width:u,top:c,left:a})},t.prototype._renderLine=function(t,e){t.push('<div title="'+this._label+'" class="ace-multi-selection" style="'),"number"==typeof e.height&&t.push(" height: "+e.height+"px;"),"number"==typeof e.width&&t.push(" width: "+e.width+"px;"),"number"==typeof e.top&&t.push(" top: "+e.top+"px;"),"number"==typeof e.left&&t.push(" left: "+e.left+"px;"),"number"==typeof e.bottom&&t.push(" bottom: "+e.bottom+"px;"),"number"==typeof e.right&&t.push(" right: "+e.right+"px;"),t.push("background-color: "+this._color+'">'),t.push("</div>")},t.prototype._forceSessionUpdate=function(){this._session._signal("changeBackMarker")},t}();e.AceSelectionMarker=i},function(t,e,o){"use strict";e.__esModule=!0;var i=o(7),r=function(){function t(t){this._selections={},this._session=t}return t.prototype.addSelection=function(t,e,o,r){if(void 0!==this._selections[t])throw new Error("Selection with id already defined: "+t);var n=new i.AceSelectionMarker(this._session,t,e,o,r);this._selections[t]=n,this._session.addDynamicMarker(n,!1)},t.prototype.setSelection=function(t,e){var o=this._getSelection(t);o.setSelection(e)},t.prototype.clearSelection=function(t){var e=this._getSelection(t);e.setSelection(null)},t.prototype.removeSelection=function(t){var e=this._selections[t];if(void 0===e)throw new Error("Selection not found: "+t);this._session.removeMarker(e.id),delete this._selections[t]},t.prototype.removeAll=function(){var t=this;Object.getOwnPropertyNames(this._selections).forEach(function(e){t.removeSelection(t._selections[e].selectionId())})},t.prototype._getSelection=function(t){var e=this._selections[t];if(void 0===e)throw new Error("Selection not found: "+t);return e},t}();e.AceMultiSelectionManager=r},function(t,e,o){"use strict";function i(t){for(var o in t)e.hasOwnProperty(o)||(e[o]=t[o])}e.__esModule=!0,i(o(8)),i(o(6)),i(o(4)),i(o(2)),i(o(0))}])});
//# sourceMappingURL=ace-collab-ext.min.js.map

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