Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • matefun/Frontend
  • felipe.parodi/Frontend
2 results
Show changes
Commits on Source (141)
Showing
with 8996 additions and 9346 deletions
File added
File mode changed from 100644 to 100755
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "cli-stable"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico",
".htaccess"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"../node_modules/font-awesome/css/font-awesome.css",
"styles/app.scss",
"styles/console.css",
"styles/hints.css",
"../node_modules/tippy.js/dist/tippy.css",
"../node_modules/codemirror/lib/codemirror.css",
"../node_modules/codemirror/addon/hint/show-hint.css",
"../node_modules/codemirror/addon/dialog/dialog.css",
"../node_modules/codemirror/addon/search/matchesonscrollbar.css"
],
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/jq-console/lib/jqconsole.js"
],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json"
},
{
"project": "src/tsconfig.spec.json"
},
{
"project": "e2e/tsconfig.e2e.json"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "scss",
"component": {}
}
}
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# You can see what browsers were selected by your queries by running:
# npx browserslist
> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.
\ No newline at end of file
......@@ -4,7 +4,7 @@ root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
......
/.angular/cache
.vscode
node_modules
\ No newline at end of file
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"cli-stable": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"allowedCommonJsDependencies": [
"codemirror",
"function-plot",
"nextafter"
],
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": ["src/assets", "src/favicon.ico", "src/.htaccess"],
"styles": [
"node_modules/font-awesome/css/font-awesome.css",
"node_modules/flag-icon-css/css/flag-icon.min.css",
"src/styles/app.scss",
"src/styles/console.css",
"src/styles/hints.css",
"node_modules/tippy.js/dist/tippy.css",
"node_modules/codemirror/lib/codemirror.css",
"node_modules/codemirror/addon/hint/show-hint.css",
"node_modules/codemirror/addon/dialog/dialog.css",
"node_modules/codemirror/addon/search/matchesonscrollbar.css"
],
"scripts": [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/jq-console/lib/jqconsole.js"
],
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true
},
"configurations": {
"production": {
"budgets": [
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
},
"defaultConfiguration": ""
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "cli-stable:build",
"proxyConfig": "proxy.conf.json"
},
"configurations": {
"production": {
"browserTarget": "cli-stable:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "cli-stable:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"scripts": [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/jq-console/lib/jqconsole.js"
],
"styles": [
"node_modules/font-awesome/css/font-awesome.css",
"node_modules/flag-icon-css/css/flag-icon.min.css",
"src/styles/app.scss",
"src/styles/console.css",
"src/styles/hints.css",
"node_modules/tippy.js/dist/tippy.css",
"node_modules/lt-codemirror/lib/lt-codemirror.css",
"node_modules/lt-codemirror/addon/hint/show-hint.css",
"node_modules/lt-codemirror/addon/dialog/dialog.css",
"node_modules/lt-codemirror/addon/search/matchesonscrollbar.css"
],
"assets": ["src/assets", "src/favicon.ico", "src/.htaccess"]
}
}
}
},
"cli-stable-e2e": {
"root": "e2e",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "cli-stable:serve"
}
}
}
}
},
"defaultProject": "cli-stable",
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"style": "scss"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}
}
......@@ -3,46 +3,55 @@
// Defines jumpToLine command. Uses dialog.js if present.
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
(function (mod) {
if (typeof exports == "object" && typeof module == "object")
// CommonJS
mod(require("../../lib/codemirror"), require("../dialog/dialog"));
else if (typeof define == "function" && define.amd) // AMD
else if (typeof define == "function" && define.amd)
// AMD
define(["../../lib/codemirror", "../dialog/dialog"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
// Plain browser env
else mod(CodeMirror);
})(function (CodeMirror) {
"use strict";
function dialog(cm, text, shortText, deflt, f) {
if (cm.openDialog) cm.openDialog(text, f, {value: deflt, selectValueOnOpen: true});
if (cm.openDialog)
cm.openDialog(text, f, { value: deflt, selectValueOnOpen: true });
else f(prompt(shortText, deflt));
}
var jumpDialog =
'Ir a la línea: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint"></span>';
'Ir a la línea: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint"></span>';
function interpretLine(cm, string) {
var num = Number(string)
if (/^[-+]/.test(string)) return cm.getCursor().line + num
else return num - 1
var num = Number(string);
if (/^[-+]/.test(string)) return cm.getCursor().line + num;
else return num - 1;
}
CodeMirror.commands.jumpToLine = function(cm) {
CodeMirror.commands.jumpToLine = function (cm) {
var cur = cm.getCursor();
dialog(cm, jumpDialog, "Jump to line:", (cur.line + 1) + ":" + cur.ch, function(posStr) {
if (!posStr) return;
var match;
if (match = /^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(posStr)) {
cm.setCursor(interpretLine(cm, match[1]), Number(match[2]))
} else if (match = /^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(posStr)) {
var line = Math.round(cm.lineCount() * Number(match[1]) / 100);
if (/^[-+]/.test(match[1])) line = cur.line + line + 1;
cm.setCursor(line - 1, cur.ch);
} else if (match = /^\s*\:?\s*([\+\-]?\d+)\s*/.exec(posStr)) {
cm.setCursor(interpretLine(cm, match[1]), cur.ch);
dialog(
cm,
jumpDialog,
"Jump to line:",
cur.line + 1 + ":" + cur.ch,
function (posStr) {
if (!posStr) return;
var match;
if ((match = /^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(posStr))) {
cm.setCursor(interpretLine(cm, match[1]), Number(match[2]));
} else if ((match = /^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(posStr))) {
var line = Math.round((cm.lineCount() * Number(match[1])) / 100);
if (/^[-+]/.test(match[1])) line = cur.line + line + 1;
cm.setCursor(line - 1, cur.ch);
} else if ((match = /^\s*\:?\s*([\+\-]?\d+)\s*/.exec(posStr))) {
cm.setCursor(interpretLine(cm, match[1]), cur.ch);
}
}
});
);
};
CodeMirror.keyMap["default"]["Alt-G"] = "jumpToLine";
......
......@@ -9,34 +9,45 @@
// replace by making sure the match is no longer selected when hitting
// Ctrl-G.
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"), require("./searchcursor"), require("../dialog/dialog"));
else if (typeof define == "function" && define.amd) // AMD
(function (mod) {
if (typeof exports == "object" && typeof module == "object")
// CommonJS
mod(
require("../../lib/codemirror"),
require("./searchcursor"),
require("../dialog/dialog")
);
else if (typeof define == "function" && define.amd)
// AMD
define(["../../lib/codemirror", "./searchcursor", "../dialog/dialog"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
// Plain browser env
else mod(CodeMirror);
})(function (CodeMirror) {
"use strict";
function searchOverlay(query, caseInsensitive) {
if (typeof query == "string")
query = new RegExp(query.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), caseInsensitive ? "gi" : "g");
query = new RegExp(
query.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"),
caseInsensitive ? "gi" : "g"
);
else if (!query.global)
query = new RegExp(query.source, query.ignoreCase ? "gi" : "g");
return {token: function(stream) {
query.lastIndex = stream.pos;
var match = query.exec(stream.string);
if (match && match.index == stream.pos) {
stream.pos += match[0].length || 1;
return "searching";
} else if (match) {
stream.pos = match.index;
} else {
stream.skipToEnd();
}
}};
return {
token: function (stream) {
query.lastIndex = stream.pos;
var match = query.exec(stream.string);
if (match && match.index == stream.pos) {
stream.pos += match[0].length || 1;
return "searching";
} else if (match) {
stream.pos = match.index;
} else {
stream.skipToEnd();
}
},
};
}
function SearchState() {
......@@ -54,7 +65,10 @@
function getSearchCursor(cm, query, pos) {
// Heuristic: if the query string is all lowercase, do a case insensitive search.
return cm.getSearchCursor(query, pos, {caseFold: queryCaseInsensitive(query), multiline: true});
return cm.getSearchCursor(query, pos, {
caseFold: queryCaseInsensitive(query),
multiline: true,
});
}
function persistentDialog(cm, text, deflt, onEnter, onKeyDown) {
......@@ -62,13 +76,16 @@
value: deflt,
selectValueOnOpen: true,
closeOnEnter: false,
onClose: function() { clearSearch(cm); },
onKeyDown: onKeyDown
onClose: function () {
clearSearch(cm);
},
onKeyDown: onKeyDown,
});
}
function dialog(cm, text, shortText, deflt, f) {
if (cm.openDialog) cm.openDialog(text, f, {value: deflt, selectValueOnOpen: true});
if (cm.openDialog)
cm.openDialog(text, f, { value: deflt, selectValueOnOpen: true });
else f(prompt(shortText, deflt));
}
......@@ -78,23 +95,23 @@
}
function parseString(string) {
return string.replace(/\\(.)/g, function(_, ch) {
if (ch == "n") return "\n"
if (ch == "r") return "\r"
return ch
})
return string.replace(/\\(.)/g, function (_, ch) {
if (ch == "n") return "\n";
if (ch == "r") return "\r";
return ch;
});
}
function parseQuery(query) {
var isRE = query.match(/^\/(.*)\/([a-z]*)$/);
if (isRE) {
try { query = new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i"); }
catch(e) {} // Not a regular expression after all, do a string search
try {
query = new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i");
} catch (e) {} // Not a regular expression after all, do a string search
} else {
query = parseString(query)
query = parseString(query);
}
if (typeof query == "string" ? query == "" : query.test(""))
query = /x^/;
if (typeof query == "string" ? query == "" : query.test("")) query = /x^/;
return query;
}
......@@ -105,11 +122,20 @@
state.queryText = query;
state.query = parseQuery(query);
cm.removeOverlay(state.overlay, queryCaseInsensitive(state.query));
state.overlay = searchOverlay(state.query, queryCaseInsensitive(state.query));
state.overlay = searchOverlay(
state.query,
queryCaseInsensitive(state.query)
);
cm.addOverlay(state.overlay);
if (cm.showMatchesOnScrollbar) {
if (state.annotate) { state.annotate.clear(); state.annotate = null; }
state.annotate = cm.showMatchesOnScrollbar(state.query, queryCaseInsensitive(state.query));
if (state.annotate) {
state.annotate.clear();
state.annotate = null;
}
state.annotate = cm.showMatchesOnScrollbar(
state.query,
queryCaseInsensitive(state.query)
);
}
}
......@@ -118,29 +144,37 @@
if (state.query) return findNext(cm, rev);
var q = cm.getSelection() || state.lastQuery;
if (persistent && cm.openDialog) {
var hiding = null
var searchNext = function(query, event) {
var hiding = null;
var searchNext = function (query, event) {
CodeMirror.e_stop(event);
if (!query) return;
if (query != state.queryText) {
startSearch(cm, state, query);
state.posFrom = state.posTo = cm.getCursor();
}
if (hiding) hiding.style.opacity = 1
findNext(cm, event.shiftKey, function(_, to) {
var dialog
if (to.line < 3 && document.querySelector &&
(dialog = cm.display.wrapper.querySelector(".CodeMirror-dialog")) &&
dialog.getBoundingClientRect().bottom - 4 > cm.cursorCoords(to, "window").top)
(hiding = dialog).style.opacity = .4
})
if (hiding) hiding.style.opacity = 1;
findNext(cm, event.shiftKey, function (_, to) {
var dialog;
if (
to.line < 3 &&
document.querySelector &&
(dialog = cm.display.wrapper.querySelector(".CodeMirror-dialog")) &&
dialog.getBoundingClientRect().bottom - 4 >
cm.cursorCoords(to, "window").top
)
(hiding = dialog).style.opacity = 0.4;
});
};
persistentDialog(cm, queryDialog, q, searchNext, function(event, query) {
var keyName = CodeMirror.keyName(event)
var cmd = CodeMirror.keyMap[cm.getOption("keyMap")][keyName]
if (!cmd) cmd = cm.getOption('extraKeys')[keyName]
if (cmd == "findNext" || cmd == "findPrev" ||
cmd == "findPersistentNext" || cmd == "findPersistentPrev") {
persistentDialog(cm, queryDialog, q, searchNext, function (event, query) {
var keyName = CodeMirror.keyName(event);
var cmd = CodeMirror.keyMap[cm.getOption("keyMap")][keyName];
if (!cmd) cmd = cm.getOption("extraKeys")[keyName];
if (
cmd == "findNext" ||
cmd == "findPrev" ||
cmd == "findPersistentNext" ||
cmd == "findPersistentPrev"
) {
CodeMirror.e_stop(event);
startSearch(cm, getSearchState(cm), query);
cm.execCommand(cmd);
......@@ -154,49 +188,74 @@
findNext(cm, rev);
}
} else {
dialog(cm, queryDialog, "Buscar por:", q, function(query) {
if (query && !state.query) cm.operation(function() {
startSearch(cm, state, query);
state.posFrom = state.posTo = cm.getCursor();
findNext(cm, rev);
});
dialog(cm, queryDialog, "Buscar por:", q, function (query) {
if (query && !state.query)
cm.operation(function () {
startSearch(cm, state, query);
state.posFrom = state.posTo = cm.getCursor();
findNext(cm, rev);
});
});
}
}
function findNext(cm, rev, callback) {cm.operation(function() {
var state = getSearchState(cm);
var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo);
if (!cursor.find(rev)) {
cursor = getSearchCursor(cm, state.query, rev ? CodeMirror.Pos(cm.lastLine()) : CodeMirror.Pos(cm.firstLine(), 0));
if (!cursor.find(rev)) return;
}
cm.setSelection(cursor.from(), cursor.to());
cm.scrollIntoView({from: cursor.from(), to: cursor.to()}, 20);
state.posFrom = cursor.from(); state.posTo = cursor.to();
if (callback) callback(cursor.from(), cursor.to())
});}
function findNext(cm, rev, callback) {
cm.operation(function () {
var state = getSearchState(cm);
var cursor = getSearchCursor(
cm,
state.query,
rev ? state.posFrom : state.posTo
);
if (!cursor.find(rev)) {
cursor = getSearchCursor(
cm,
state.query,
rev
? CodeMirror.Pos(cm.lastLine())
: CodeMirror.Pos(cm.firstLine(), 0)
);
if (!cursor.find(rev)) return;
}
cm.setSelection(cursor.from(), cursor.to());
cm.scrollIntoView({ from: cursor.from(), to: cursor.to() }, 20);
state.posFrom = cursor.from();
state.posTo = cursor.to();
if (callback) callback(cursor.from(), cursor.to());
});
}
function clearSearch(cm) {cm.operation(function() {
var state = getSearchState(cm);
state.lastQuery = state.query;
if (!state.query) return;
state.query = state.queryText = null;
cm.removeOverlay(state.overlay);
if (state.annotate) { state.annotate.clear(); state.annotate = null; }
});}
function clearSearch(cm) {
cm.operation(function () {
var state = getSearchState(cm);
state.lastQuery = state.query;
if (!state.query) return;
state.query = state.queryText = null;
cm.removeOverlay(state.overlay);
if (state.annotate) {
state.annotate.clear();
state.annotate = null;
}
});
}
var replaceQueryDialog =
' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint"></span>';
var replacementQueryDialog = '<span class="CodeMirror-search-label">Con:</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/>';
var doReplaceConfirm = '<span class="CodeMirror-search-label">Reemplazar?</span> <button>Si</button> <button>No</button> <button>Todos</button> <button>Cancelar</button>';
var replacementQueryDialog =
'<span class="CodeMirror-search-label">Con:</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/>';
var doReplaceConfirm =
'<span class="CodeMirror-search-label">Reemplazar?</span> <button>Si</button> <button>No</button> <button>Todos</button> <button>Cancelar</button>';
function replaceAll(cm, query, text) {
cm.operation(function() {
for (var cursor = getSearchCursor(cm, query); cursor.findNext();) {
cm.operation(function () {
for (var cursor = getSearchCursor(cm, query); cursor.findNext(); ) {
if (typeof query != "string") {
var match = cm.getRange(cursor.from(), cursor.to()).match(query);
cursor.replace(text.replace(/\$(\d)/g, function(_, i) {return match[i];}));
cursor.replace(
text.replace(/\$(\d)/g, function (_, i) {
return match[i];
})
);
} else cursor.replace(text);
}
});
......@@ -205,48 +264,94 @@
function replace(cm, all) {
if (cm.getOption("readOnly")) return;
var query = cm.getSelection() || getSearchState(cm).lastQuery;
var dialogText = '<span class="CodeMirror-search-label">' + (all ? 'Reemplazar todo:' : 'Reemplazar:') + '</span>';
dialog(cm, dialogText + replaceQueryDialog, dialogText, query, function(query) {
if (!query) return;
query = parseQuery(query);
dialog(cm, replacementQueryDialog, "Reemplazar con:", "", function(text) {
text = parseString(text)
if (all) {
replaceAll(cm, query, text)
} else {
clearSearch(cm);
var cursor = getSearchCursor(cm, query, cm.getCursor("from"));
var advance = function() {
var start = cursor.from(), match;
if (!(match = cursor.findNext())) {
cursor = getSearchCursor(cm, query);
if (!(match = cursor.findNext()) ||
(start && cursor.from().line == start.line && cursor.from().ch == start.ch)) return;
var dialogText =
'<span class="CodeMirror-search-label">' +
(all ? "Reemplazar todo:" : "Reemplazar:") +
"</span>";
dialog(
cm,
dialogText + replaceQueryDialog,
dialogText,
query,
function (query) {
if (!query) return;
query = parseQuery(query);
dialog(
cm,
replacementQueryDialog,
"Reemplazar con:",
"",
function (text) {
text = parseString(text);
if (all) {
replaceAll(cm, query, text);
} else {
clearSearch(cm);
var cursor = getSearchCursor(cm, query, cm.getCursor("from"));
var advance = function () {
var start = cursor.from(),
match;
if (!(match = cursor.findNext())) {
cursor = getSearchCursor(cm, query);
if (
!(match = cursor.findNext()) ||
(start &&
cursor.from().line == start.line &&
cursor.from().ch == start.ch)
)
return;
}
cm.setSelection(cursor.from(), cursor.to());
cm.scrollIntoView({ from: cursor.from(), to: cursor.to() });
confirmDialog(cm, doReplaceConfirm, "Reemplazar?", [
function () {
doReplace(match);
},
advance,
function () {
replaceAll(cm, query, text);
},
]);
};
var doReplace = function (match) {
cursor.replace(
typeof query == "string"
? text
: text.replace(/\$(\d)/g, function (_, i) {
return match[i];
})
);
advance();
};
advance();
}
cm.setSelection(cursor.from(), cursor.to());
cm.scrollIntoView({from: cursor.from(), to: cursor.to()});
confirmDialog(cm, doReplaceConfirm, "Reemplazar?",
[function() {doReplace(match);}, advance,
function() {replaceAll(cm, query, text)}]);
};
var doReplace = function(match) {
cursor.replace(typeof query == "string" ? text :
text.replace(/\$(\d)/g, function(_, i) {return match[i];}));
advance();
};
advance();
}
});
});
}
);
}
);
}
CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);};
CodeMirror.commands.findPersistent = function(cm) {clearSearch(cm); doSearch(cm, false, true);};
CodeMirror.commands.findPersistentNext = function(cm) {doSearch(cm, false, true, true);};
CodeMirror.commands.findPersistentPrev = function(cm) {doSearch(cm, true, true, true);};
CodeMirror.commands.find = function (cm) {
clearSearch(cm);
doSearch(cm);
};
CodeMirror.commands.findPersistent = function (cm) {
clearSearch(cm);
doSearch(cm, false, true);
};
CodeMirror.commands.findPersistentNext = function (cm) {
doSearch(cm, false, true, true);
};
CodeMirror.commands.findPersistentPrev = function (cm) {
doSearch(cm, true, true, true);
};
CodeMirror.commands.findNext = doSearch;
CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);};
CodeMirror.commands.findPrev = function (cm) {
doSearch(cm, true);
};
CodeMirror.commands.clearSearch = clearSearch;
CodeMirror.commands.replace = replace;
CodeMirror.commands.replaceAll = function(cm) {replace(cm, true);};
CodeMirror.commands.replaceAll = function (cm) {
replace(cm, true);
};
});
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
(function (mod) {
if (typeof exports == "object" && typeof module == "object")
// CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
else if (typeof define == "function" && define.amd)
// AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
// Plain browser env
else mod(CodeMirror);
})(function (CodeMirror) {
"use strict";
var HINT_ELEMENT_CLASS = "CodeMirror-hint";
var HINT_ELEMENT_CLASS = "CodeMirror-hint";
var ACTIVE_HINT_ELEMENT_CLASS = "CodeMirror-hint-active";
// This is the old interface, kept around for now to stay
// backwards-compatible.
CodeMirror.showHint = function(cm, getHints, options) {
CodeMirror.showHint = function (cm, getHints, options) {
if (!getHints) return cm.showHint(options);
if (options && options.async) getHints.async = true;
var newOpts = {hint: getHints};
var newOpts = { hint: getHints };
if (options) for (var prop in options) newOpts[prop] = options[prop];
return cm.showHint(newOpts);
};
CodeMirror.defineExtension("showHint", function(options) {
CodeMirror.defineExtension("showHint", function (options) {
options = parseOptions(this, this.getCursor("start"), options);
var selections = this.listSelections()
var selections = this.listSelections();
if (selections.length > 1) return;
// By default, don't allow completion when something is selected.
// A hint function can have a `supportsSelection` property to
......@@ -39,7 +41,10 @@
}
if (this.state.completionActive) this.state.completionActive.close();
var completion = this.state.completionActive = new Completion(this, options);
var completion = (this.state.completionActive = new Completion(
this,
options
));
if (!completion.options.hint) return;
CodeMirror.signal(this, "startCompletion", this);
......@@ -53,19 +58,28 @@
this.debounce = 0;
this.tick = 0;
this.startPos = this.cm.getCursor("start");
this.startLen = this.cm.getLine(this.startPos.line).length - this.cm.getSelection().length;
this.startLen =
this.cm.getLine(this.startPos.line).length -
this.cm.getSelection().length;
var self = this;
cm.on("cursorActivity", this.activityFunc = function() { self.cursorActivity(); });
cm.on(
"cursorActivity",
(this.activityFunc = function () {
self.cursorActivity();
})
);
}
var requestAnimationFrame = window.requestAnimationFrame || function(fn) {
return setTimeout(fn, 1000/60);
};
var requestAnimationFrame =
window.requestAnimationFrame ||
function (fn) {
return setTimeout(fn, 1000 / 60);
};
var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;
Completion.prototype = {
close: function() {
close: function () {
if (!this.active()) return;
this.cm.state.completionActive = null;
this.tick = null;
......@@ -76,49 +90,65 @@
CodeMirror.signal(this.cm, "endCompletion", this.cm);
},
active: function() {
active: function () {
return this.cm.state.completionActive == this;
},
pick: function(data, i) {
pick: function (data, i) {
var completion = data.list[i];
if (completion.hint) completion.hint(this.cm, data, completion);
else this.cm.replaceRange(getText(completion), completion.from || data.from,
completion.to || data.to, "complete");
else
this.cm.replaceRange(
getText(completion),
completion.from || data.from,
completion.to || data.to,
"complete"
);
CodeMirror.signal(data, "pick", completion);
this.close();
},
cursorActivity: function() {
cursorActivity: function () {
if (this.debounce) {
cancelAnimationFrame(this.debounce);
this.debounce = 0;
}
var pos = this.cm.getCursor(), line = this.cm.getLine(pos.line);
if (pos.line != this.startPos.line || line.length - pos.ch != this.startLen - this.startPos.ch ||
pos.ch < this.startPos.ch || this.cm.somethingSelected() ||
(!pos.ch || this.options.closeCharacters.test(line.charAt(pos.ch - 1)))) {
var pos = this.cm.getCursor(),
line = this.cm.getLine(pos.line);
if (
pos.line != this.startPos.line ||
line.length - pos.ch != this.startLen - this.startPos.ch ||
pos.ch < this.startPos.ch ||
this.cm.somethingSelected() ||
!pos.ch ||
this.options.closeCharacters.test(line.charAt(pos.ch - 1))
) {
this.close();
} else {
var self = this;
this.debounce = requestAnimationFrame(function() {self.update();});
this.debounce = requestAnimationFrame(function () {
self.update();
});
if (this.widget) this.widget.disable();
}
},
update: function(first) {
if (this.tick == null) return
var self = this, myTick = ++this.tick
fetchHints(this.options.hint, this.cm, this.options, function(data) {
if (self.tick == myTick) self.finishUpdate(data, first)
})
update: function (first) {
if (this.tick == null) return;
var self = this,
myTick = ++this.tick;
fetchHints(this.options.hint, this.cm, this.options, function (data) {
if (self.tick == myTick) self.finishUpdate(data, first);
});
},
finishUpdate: function(data, first) {
finishUpdate: function (data, first) {
if (this.data) CodeMirror.signal(this.data, "update");
var picked = (this.widget && this.widget.picked) || (first && this.options.completeSingle);
var picked =
(this.widget && this.widget.picked) ||
(first && this.options.completeSingle);
if (this.widget) this.widget.close();
this.data = data;
......@@ -131,18 +161,20 @@
CodeMirror.signal(data, "shown");
}
}
}
},
};
function parseOptions(cm, pos, options) {
var editor = cm.options.hintOptions;
var out = {};
for (var prop in defaultOptions) out[prop] = defaultOptions[prop];
if (editor) for (var prop in editor)
if (editor[prop] !== undefined) out[prop] = editor[prop];
if (options) for (var prop in options)
if (options[prop] !== undefined) out[prop] = options[prop];
if (out.hint.resolve) out.hint = out.hint.resolve(cm, pos)
if (editor)
for (var prop in editor)
if (editor[prop] !== undefined) out[prop] = editor[prop];
if (options)
for (var prop in options)
if (options[prop] !== undefined) out[prop] = options[prop];
if (out.hint.resolve) out.hint = out.hint.resolve(cm, pos);
return out;
}
......@@ -153,42 +185,55 @@
function buildKeyMap(completion, handle) {
var baseMap = {
Up: function() {handle.moveFocus(-1);},
Down: function() {handle.moveFocus(1);},
PageUp: function() {handle.moveFocus(-handle.menuSize() + 1, true);},
PageDown: function() {handle.moveFocus(handle.menuSize() - 1, true);},
Home: function() {handle.setFocus(0);},
End: function() {handle.setFocus(handle.length - 1);},
Up: function () {
handle.moveFocus(-1);
},
Down: function () {
handle.moveFocus(1);
},
PageUp: function () {
handle.moveFocus(-handle.menuSize() + 1, true);
},
PageDown: function () {
handle.moveFocus(handle.menuSize() - 1, true);
},
Home: function () {
handle.setFocus(0);
},
End: function () {
handle.setFocus(handle.length - 1);
},
Enter: handle.pick,
Tab: handle.pick,
Esc: handle.close
Esc: handle.close,
};
var custom = completion.options.customKeys;
var ourMap = custom ? {} : baseMap;
function addBinding(key, val) {
var bound;
if (typeof val != "string")
bound = function(cm) { return val(cm, handle); };
bound = function (cm) {
return val(cm, handle);
};
// This mechanism is deprecated
else if (baseMap.hasOwnProperty(val))
bound = baseMap[val];
else
bound = val;
else if (baseMap.hasOwnProperty(val)) bound = baseMap[val];
else bound = val;
ourMap[key] = bound;
}
if (custom)
for (var key in custom) if (custom.hasOwnProperty(key))
addBinding(key, custom[key]);
for (var key in custom)
if (custom.hasOwnProperty(key)) addBinding(key, custom[key]);
var extra = completion.options.extraKeys;
if (extra)
for (var key in extra) if (extra.hasOwnProperty(key))
addBinding(key, extra[key]);
for (var key in extra)
if (extra.hasOwnProperty(key)) addBinding(key, extra[key]);
return ourMap;
}
function getHintElement(hintsElement, el) {
while (el && el != hintsElement) {
if (el.nodeName.toUpperCase() === "LI" && el.parentNode == hintsElement) return el;
if (el.nodeName.toUpperCase() === "LI" && el.parentNode == hintsElement)
return el;
el = el.parentNode;
}
}
......@@ -197,45 +242,69 @@
this.completion = completion;
this.data = data;
this.picked = false;
var widget = this, cm = completion.cm;
var widget = this,
cm = completion.cm;
var ownerDocument = cm.getInputField().ownerDocument;
var parentWindow = ownerDocument.defaultView || ownerDocument.parentWindow;
var hints = this.hints = ownerDocument.createElement("ul");
var hints = (this.hints = ownerDocument.createElement("ul"));
var theme = completion.cm.options.theme;
hints.className = "CodeMirror-hints " + theme;
this.selectedHint = data.selectedHint || 0;
var completions = data.list;
for (var i = 0; i < completions.length; ++i) {
var elt = hints.appendChild(ownerDocument.createElement("li")), cur = completions[i];
var className = HINT_ELEMENT_CLASS + (i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS);
var elt = hints.appendChild(ownerDocument.createElement("li")),
cur = completions[i];
var className =
HINT_ELEMENT_CLASS +
(i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS);
if (cur.className != null) className = cur.className + " " + className;
elt.className = className;
if (cur.render) cur.render(elt, data, cur);
else elt.appendChild(ownerDocument.createTextNode(cur.displayText || getText(cur)));
else
elt.appendChild(
ownerDocument.createTextNode(cur.displayText || getText(cur))
);
elt.hintId = i;
}
var pos = cm.cursorCoords(completion.options.alignWithWord ? data.from : null);
var left = pos.left, top = pos.bottom, below = true;
var pos = cm.cursorCoords(
completion.options.alignWithWord ? data.from : null
);
var left = pos.left,
top = pos.bottom,
below = true;
hints.style.left = left + "px";
hints.style.top = top + "px";
// If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
var winW = parentWindow.innerWidth || Math.max(ownerDocument.body.offsetWidth, ownerDocument.documentElement.offsetWidth);
var winH = parentWindow.innerHeight || Math.max(ownerDocument.body.offsetHeight, ownerDocument.documentElement.offsetHeight);
var winW =
parentWindow.innerWidth ||
Math.max(
ownerDocument.body.offsetWidth,
ownerDocument.documentElement.offsetWidth
);
var winH =
parentWindow.innerHeight ||
Math.max(
ownerDocument.body.offsetHeight,
ownerDocument.documentElement.offsetHeight
);
(completion.options.container || ownerDocument.body).appendChild(hints);
var box = hints.getBoundingClientRect(), overlapY = box.bottom - winH;
var scrolls = hints.scrollHeight > hints.clientHeight + 1
var box = hints.getBoundingClientRect(),
overlapY = box.bottom - winH;
var scrolls = hints.scrollHeight > hints.clientHeight + 1;
var startScroll = cm.getScrollInfo();
if (overlapY > 0) {
var height = box.bottom - box.top, curTop = pos.top - (pos.bottom - box.top);
if (curTop - height > 0) { // Fits above cursor
var height = box.bottom - box.top,
curTop = pos.top - (pos.bottom - box.top);
if (curTop - height > 0) {
// Fits above cursor
hints.style.top = (top = pos.top - height) + "px";
below = false;
} else if (height > winH) {
hints.style.height = (winH - 5) + "px";
hints.style.height = winH - 5 + "px";
hints.style.top = (top = pos.bottom - box.top) + "px";
var cursor = cm.getCursor();
if (data.from.ch != cursor.ch) {
......@@ -248,46 +317,82 @@
var overlapX = box.right - winW;
if (overlapX > 0) {
if (box.right - box.left > winW) {
hints.style.width = (winW - 5) + "px";
overlapX -= (box.right - box.left) - winW;
hints.style.width = winW - 5 + "px";
overlapX -= box.right - box.left - winW;
}
hints.style.left = (left = pos.left - overlapX) + "px";
}
if (scrolls) for (var node = hints.firstChild; node; node = node.nextSibling)
node.style.paddingRight = cm.display.nativeBarWidth + "px"
cm.addKeyMap(this.keyMap = buildKeyMap(completion, {
moveFocus: function(n, avoidWrap) { widget.changeActive(widget.selectedHint + n, avoidWrap); },
setFocus: function(n) { widget.changeActive(n); },
menuSize: function() { return widget.screenAmount(); },
length: completions.length,
close: function() { completion.close(); },
pick: function() { widget.pick(); },
data: data
}));
if (scrolls)
for (var node = hints.firstChild; node; node = node.nextSibling)
node.style.paddingRight = cm.display.nativeBarWidth + "px";
cm.addKeyMap(
(this.keyMap = buildKeyMap(completion, {
moveFocus: function (n, avoidWrap) {
widget.changeActive(widget.selectedHint + n, avoidWrap);
},
setFocus: function (n) {
widget.changeActive(n);
},
menuSize: function () {
return widget.screenAmount();
},
length: completions.length,
close: function () {
completion.close();
},
pick: function () {
widget.pick();
},
data: data,
}))
);
if (completion.options.closeOnUnfocus) {
var closingOnBlur;
cm.on("blur", this.onBlur = function() { closingOnBlur = setTimeout(function() { completion.close(); }, 100); });
cm.on("focus", this.onFocus = function() { clearTimeout(closingOnBlur); });
cm.on(
"blur",
(this.onBlur = function () {
closingOnBlur = setTimeout(function () {
completion.close();
}, 100);
})
);
cm.on(
"focus",
(this.onFocus = function () {
clearTimeout(closingOnBlur);
})
);
}
cm.on("scroll", this.onScroll = function() {
var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect();
var newTop = top + startScroll.top - curScroll.top;
var point = newTop - (parentWindow.pageYOffset || (ownerDocument.documentElement || ownerDocument.body).scrollTop);
if (!below) point += hints.offsetHeight;
if (point <= editor.top || point >= editor.bottom) return completion.close();
hints.style.top = newTop + "px";
hints.style.left = (left + startScroll.left - curScroll.left) + "px";
});
cm.on(
"scroll",
(this.onScroll = function () {
var curScroll = cm.getScrollInfo(),
editor = cm.getWrapperElement().getBoundingClientRect();
var newTop = top + startScroll.top - curScroll.top;
var point =
newTop -
(parentWindow.pageYOffset ||
(ownerDocument.documentElement || ownerDocument.body).scrollTop);
if (!below) point += hints.offsetHeight;
if (point <= editor.top || point >= editor.bottom)
return completion.close();
hints.style.top = newTop + "px";
hints.style.left = left + startScroll.left - curScroll.left + "px";
})
);
CodeMirror.on(hints, "dblclick", function(e) {
CodeMirror.on(hints, "dblclick", function (e) {
var t = getHintElement(hints, e.target || e.srcElement);
if (t && t.hintId != null) {widget.changeActive(t.hintId); widget.pick();}
if (t && t.hintId != null) {
widget.changeActive(t.hintId);
widget.pick();
}
});
CodeMirror.on(hints, "click", function(e) {
CodeMirror.on(hints, "click", function (e) {
var t = getHintElement(hints, e.target || e.srcElement);
if (t && t.hintId != null) {
widget.changeActive(t.hintId);
......@@ -295,16 +400,23 @@
}
});
CodeMirror.on(hints, "mousedown", function() {
setTimeout(function(){cm.focus();}, 20);
CodeMirror.on(hints, "mousedown", function () {
setTimeout(function () {
cm.focus();
}, 20);
});
CodeMirror.signal(data, "select", completions[this.selectedHint], hints.childNodes[this.selectedHint]);
CodeMirror.signal(
data,
"select",
completions[this.selectedHint],
hints.childNodes[this.selectedHint]
);
return true;
}
Widget.prototype = {
close: function() {
close: function () {
if (this.completion.widget != this) return;
this.completion.widget = null;
this.hints.parentNode.removeChild(this.hints);
......@@ -318,104 +430,134 @@
cm.off("scroll", this.onScroll);
},
disable: function() {
disable: function () {
this.completion.cm.removeKeyMap(this.keyMap);
var widget = this;
this.keyMap = {Enter: function() { widget.picked = true; }};
this.keyMap = {
Enter: function () {
widget.picked = true;
},
};
this.completion.cm.addKeyMap(this.keyMap);
},
pick: function() {
pick: function () {
this.completion.pick(this.data, this.selectedHint);
},
changeActive: function(i, avoidWrap) {
changeActive: function (i, avoidWrap) {
if (i >= this.data.list.length)
i = avoidWrap ? this.data.list.length - 1 : 0;
else if (i < 0)
i = avoidWrap ? 0 : this.data.list.length - 1;
else if (i < 0) i = avoidWrap ? 0 : this.data.list.length - 1;
if (this.selectedHint == i) return;
var node = this.hints.childNodes[this.selectedHint];
if (node) node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, "");
node = this.hints.childNodes[this.selectedHint = i];
if (node)
node.className = node.className.replace(
" " + ACTIVE_HINT_ELEMENT_CLASS,
""
);
node = this.hints.childNodes[(this.selectedHint = i)];
node.className += " " + ACTIVE_HINT_ELEMENT_CLASS;
if (node.offsetTop < this.hints.scrollTop)
this.hints.scrollTop = node.offsetTop - 3;
else if (node.offsetTop + node.offsetHeight > this.hints.scrollTop + this.hints.clientHeight)
this.hints.scrollTop = node.offsetTop + node.offsetHeight - this.hints.clientHeight + 3;
CodeMirror.signal(this.data, "select", this.data.list[this.selectedHint], node);
else if (
node.offsetTop + node.offsetHeight >
this.hints.scrollTop + this.hints.clientHeight
)
this.hints.scrollTop =
node.offsetTop + node.offsetHeight - this.hints.clientHeight + 3;
CodeMirror.signal(
this.data,
"select",
this.data.list[this.selectedHint],
node
);
},
screenAmount: function() {
return Math.floor(this.hints.clientHeight / this.hints.firstChild.offsetHeight) || 1;
}
screenAmount: function () {
return (
Math.floor(
this.hints.clientHeight / this.hints.firstChild.offsetHeight
) || 1
);
},
};
function applicableHelpers(cm, helpers) {
if (!cm.somethingSelected()) return helpers
var result = []
if (!cm.somethingSelected()) return helpers;
var result = [];
for (var i = 0; i < helpers.length; i++)
if (helpers[i].supportsSelection) result.push(helpers[i])
return result
if (helpers[i].supportsSelection) result.push(helpers[i]);
return result;
}
function fetchHints(hint, cm, options, callback) {
if (hint.async) {
hint(cm, callback, options)
hint(cm, callback, options);
} else {
var result = hint(cm, options)
if (result && result.then) result.then(callback)
else callback(result)
var result = hint(cm, options);
if (result && result.then) result.then(callback);
else callback(result);
}
}
function resolveAutoHints(cm, pos) {
var helpers = cm.getHelpers(pos, "hint"), words
var helpers = cm.getHelpers(pos, "hint"),
words;
if (helpers.length) {
var resolved = function(cm, callback, options) {
var resolved = function (cm, callback, options) {
var app = applicableHelpers(cm, helpers);
function run(i) {
if (i == app.length) return callback(null)
fetchHints(app[i], cm, options, function(result) {
if (result && result.list.length > 0) callback(result)
else run(i + 1)
})
if (i == app.length) return callback(null);
fetchHints(app[i], cm, options, function (result) {
if (result && result.list.length > 0) callback(result);
else run(i + 1);
});
}
run(0)
}
resolved.async = true
resolved.supportsSelection = true
return resolved
} else if (words = cm.getHelper(cm.getCursor(), "hintWords")) {
return function(cm) { return CodeMirror.hint.fromList(cm, {words: words}) }
run(0);
};
resolved.async = true;
resolved.supportsSelection = true;
return resolved;
} else if ((words = cm.getHelper(cm.getCursor(), "hintWords"))) {
return function (cm) {
return CodeMirror.hint.fromList(cm, { words: words });
};
} else if (CodeMirror.hint.anyword) {
return function(cm, options) { return CodeMirror.hint.anyword(cm, options) }
return function (cm, options) {
return CodeMirror.hint.anyword(cm, options);
};
} else {
return function() {}
return function () {};
}
}
CodeMirror.registerHelper("hint", "auto", {
resolve: resolveAutoHints
resolve: resolveAutoHints,
});
CodeMirror.registerHelper("hint", "fromList", function(cm, options) {
var cur = cm.getCursor(), token = cm.getTokenAt(cur)
var term, from = CodeMirror.Pos(cur.line, token.start), to = cur
if (token.start < cur.ch && /\w/.test(token.string.charAt(cur.ch - token.start - 1))) {
term = token.string.substr(0, cur.ch - token.start)
CodeMirror.registerHelper("hint", "fromList", function (cm, options) {
var cur = cm.getCursor(),
token = cm.getTokenAt(cur);
var term,
from = CodeMirror.Pos(cur.line, token.start),
to = cur;
if (
token.start < cur.ch &&
/\w/.test(token.string.charAt(cur.ch - token.start - 1))
) {
term = token.string.substr(0, cur.ch - token.start);
} else {
term = ""
from = cur
term = "";
from = cur;
}
var found = [];
for (var i = 0; i < options.words.length; i++) {
var word = options.words[i];
if (word.slice(0, term.length) == term)
found.push(word);
if (word.slice(0, term.length) == term) found.push(word);
}
if (found.length) return {list: found, from: from, to: to};
if (found.length) return { list: found, from: from, to: to };
});
CodeMirror.commands.autocomplete = CodeMirror.showHint;
......@@ -429,7 +571,7 @@
completeOnSingleClick: true,
container: null,
customKeys: null,
extraKeys: null
extraKeys: null,
};
CodeMirror.defineOption("hintOptions", null);
......
import { CliStablePage } from './app.po';
import { CliStablePage } from "./app.po";
describe('cli-stable App', () => {
describe("cli-stable App", () => {
let page: CliStablePage;
beforeEach(() => {
page = new CliStablePage();
});
it('should display message saying app works', () => {
it("should display message saying app works", () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('app works!');
expect(page.getParagraphText()).toEqual("app works!");
});
});
import { browser, element, by } from 'protractor';
import { browser, element, by } from "protractor";
export class CliStablePage {
navigateTo() {
return browser.get('/');
return browser.get("/");
}
getParagraphText() {
return element(by.css('app-root h1')).getText();
return element(by.css("app-root h1")).getText();
}
}
......@@ -4,9 +4,6 @@
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es5",
"types":[
"jasmine",
"node"
]
"types": ["jasmine", "node"]
}
}
......@@ -4,33 +4,31 @@
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma')
require('@angular-devkit/build-angular/plugins/karma')
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
files: [
{ pattern: './src/test.ts', watched: false }
],
preprocessors: {
'./src/test.ts': ['@angular/cli']
},
mime: {
'text/x-typescript': ['ts','tsx']
},
coverageIstanbulReporter: {
reports: [ 'html', 'lcovonly' ],
dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
},
reporters: config.angularCli && config.angularCli.codeCoverage
? ['progress', 'coverage-istanbul']
: ['progress', 'kjhtml'],
......
source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -4,59 +4,64 @@
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"start": "ng serve -o --port 0",
"build": "ng build --configuration production",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.1.3",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"@ng-bootstrap/ng-bootstrap": "1.0.0-alpha.26",
"@ngx-translate/core": "^7.2.2",
"@ngx-translate/http-loader": "^0.1.0",
"@angular/common": "^13.3.11",
"@angular/compiler": "^13.3.11",
"@angular/core": "^13.3.11",
"@angular/forms": "^13.3.11",
"@angular/localize": "^13.3.11",
"@angular/platform-browser": "^13.3.11",
"@angular/platform-browser-dynamic": "^13.3.11",
"@angular/router": "^13.3.11",
"@ng-bootstrap/ng-bootstrap": "^11.0.0",
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^6.0.0",
"codemirror": "^5.65.9",
"core-js": "^2.4.1",
"d3": "^4.12.2",
"d3": "^7.6.1",
"flag-icon-css": "^3.2.1",
"font-awesome": "^4.7.0",
"function-plot": "git://github.com/diego-rey/function-plot.git#feature/integration-multigraf-shape",
"graph3D": "git://github.com/ifagian/graph3D#master",
"function-plot": "https://github.com/ncamera/function-plot",
"graph3D": "https://github.com/ncamera/graph3D",
"ionicons": "^3.0.0",
"jq-console": "^2.13.2",
"jquery": "^3.2.1",
"mathjs": "1.6.0",
"ng2-bootstrap-modal": "^1.0.1",
"ng2-codemirror": "^1.1.1",
"lt-codemirror": "^10.0.0",
"matefun-components": "^0.3.0",
"mathjs": "^11.3.3",
"ng2-slider-component": "^1.0.9",
"rxjs": "^5.1.0",
"rxjs": "6.6.7",
"tippy.js": "^1.2.0",
"zone.js": "^0.8.4"
"tslib": "^2.0.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular/cli": "1.2.6",
"@angular/compiler-cli": "^4.0.0",
"@types/jasmine": "2.5.38",
"@angular-devkit/build-angular": "~13.3.9",
"@angular/cli": "^13.3.9",
"@angular/compiler-cli": "^13.3.11",
"@types/jasmine": "~3.6.0",
"@types/jquery": "^2.0.45",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.0",
"@types/node": "^12.20.55",
"codelyzer": "^6.0.2",
"jasmine-core": "~3.8.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.4.1",
"karma-chrome-launcher": "~3.1.0",
"karma-cli": "~2.0.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"sass": "^1.55.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.2.0"
"tslint": "~6.1.0",
"typescript": "~4.6.4"
}
}
{
"/servicios/": {
"target": "http://localhost:8080/matefun",
"secure": false,
"changeOrigin": true,
"logLevel": "debug"
},
"/servicios/*": {
"target": "http://localhost:8080/matefun",
"secure": false,
"changeOrigin": true,
"logLevel": "debug",
"ws": true
}
}
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { NgModule } from "@angular/core";
import { Routes, RouterModule } from "@angular/router";
import { AuthGuard } from './shared/guards/auth.guard';
import { AuthGuard } from "./shared/guards/auth.guard";
const routes: Routes = [
{ path: '', loadChildren: './layout/layout.module#LayoutModule', canActivate: [AuthGuard] },
{ path: 'login', loadChildren: './login/login.module#LoginModule' },
{ path: 'not-found', loadChildren: './not-found/not-found.module#NotFoundModule' },
{ path: '**', redirectTo: 'not-found' }
{
path: "",
loadChildren: () =>
import("./layout/layout.module").then((m) => m.LayoutModule),
canActivate: [AuthGuard],
},
{
path: "login",
loadChildren: () =>
import("./login/login.module").then((m) => m.LoginModule),
data: {
language:
navigator.language &&
(navigator.language.split("-")[0] == "es" ||
navigator.language.split("-")[0] == "en")
? navigator.language.split("-")[0]
: "es",
},
},
{
path: "es/login",
loadChildren: () =>
import("./login/login.module").then((m) => m.LoginModule),
data: { language: "es" },
},
{
path: "en/login",
loadChildren: () =>
import("./login/login.module").then((m) => m.LoginModule),
data: { language: "en" },
},
{
path: "not-found",
loadChildren: () =>
import("./not-found/not-found.module").then((m) => m.NotFoundModule),
},
{ path: "**", redirectTo: "not-found" },
];
@NgModule({
imports: [RouterModule.forRoot(routes, { useHash: true })],
exports: [RouterModule]
imports: [
RouterModule.forRoot(routes, {
useHash: true,
relativeLinkResolution: "legacy",
}),
],
exports: [RouterModule],
})
export class AppRoutingModule { }
export class AppRoutingModule {}
<div>
<router-outlet></router-outlet>
<span class="translate">{{ "HELLO" | translate }}</span>
</div>
<router-outlet></router-outlet>
import { TestBed, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { TestBed, waitForAsync } from "@angular/core/testing";
import { RouterTestingModule } from "@angular/router/testing";
import { AppComponent } from './app.component';
import { AppComponent } from "./app.component";
describe('AppComponent', () => {
beforeEach(async(() => {
describe("AppComponent", () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule
],
declarations: [
AppComponent
],
imports: [RouterTestingModule],
declarations: [AppComponent],
}).compileComponents();
}));
it('should create the app', async(() => {
it("should create the app", waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it(`should have as title 'app works!'`, async(() => {
it(`should have as title 'app works!'`, waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app works!');
expect(app.title).toEqual("app works!");
}));
it('should render title in a h1 tag', async(() => {
it("should render title in a h1 tag", waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('app works!');
expect(compiled.querySelector("h1").textContent).toContain("app works!");
}));
});