@difizen/libro-codemirror 0.0.0-snapshot-20241017072317
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +0 -0
- package/es/auto-complete/closebrackets.d.ts +12 -0
- package/es/auto-complete/closebrackets.d.ts.map +1 -0
- package/es/auto-complete/closebrackets.js +409 -0
- package/es/auto-complete/completion.d.ts +57 -0
- package/es/auto-complete/completion.d.ts.map +1 -0
- package/es/auto-complete/completion.js +267 -0
- package/es/auto-complete/config.d.ts +22 -0
- package/es/auto-complete/config.d.ts.map +1 -0
- package/es/auto-complete/config.js +44 -0
- package/es/auto-complete/filter.d.ts +13 -0
- package/es/auto-complete/filter.d.ts.map +1 -0
- package/es/auto-complete/filter.js +190 -0
- package/es/auto-complete/index.d.ts +17 -0
- package/es/auto-complete/index.d.ts.map +1 -0
- package/es/auto-complete/index.js +107 -0
- package/es/auto-complete/snippet.d.ts +14 -0
- package/es/auto-complete/snippet.d.ts.map +1 -0
- package/es/auto-complete/snippet.js +445 -0
- package/es/auto-complete/state.d.ts +63 -0
- package/es/auto-complete/state.d.ts.map +1 -0
- package/es/auto-complete/state.js +448 -0
- package/es/auto-complete/theme.d.ts +6 -0
- package/es/auto-complete/theme.d.ts.map +1 -0
- package/es/auto-complete/theme.js +150 -0
- package/es/auto-complete/tooltip.d.ts +5 -0
- package/es/auto-complete/tooltip.d.ts.map +1 -0
- package/es/auto-complete/tooltip.js +365 -0
- package/es/auto-complete/view.d.ts +38 -0
- package/es/auto-complete/view.d.ts.map +1 -0
- package/es/auto-complete/view.js +368 -0
- package/es/auto-complete/word.d.ts +3 -0
- package/es/auto-complete/word.d.ts.map +1 -0
- package/es/auto-complete/word.js +119 -0
- package/es/completion.d.ts +6 -0
- package/es/completion.d.ts.map +1 -0
- package/es/completion.js +84 -0
- package/es/config.d.ts +189 -0
- package/es/config.d.ts.map +1 -0
- package/es/config.js +482 -0
- package/es/editor-contribution.d.ts +9 -0
- package/es/editor-contribution.d.ts.map +1 -0
- package/es/editor-contribution.js +35 -0
- package/es/editor.d.ts +397 -0
- package/es/editor.d.ts.map +1 -0
- package/es/editor.js +1338 -0
- package/es/factory.d.ts +4 -0
- package/es/factory.d.ts.map +1 -0
- package/es/factory.js +24 -0
- package/es/hyperlink.d.ts +15 -0
- package/es/hyperlink.d.ts.map +1 -0
- package/es/hyperlink.js +120 -0
- package/es/indent.d.ts +8 -0
- package/es/indent.d.ts.map +1 -0
- package/es/indent.js +58 -0
- package/es/indentation-markers/config.d.ts +17 -0
- package/es/indentation-markers/config.d.ts.map +1 -0
- package/es/indentation-markers/config.js +10 -0
- package/es/indentation-markers/index.d.ts +3 -0
- package/es/indentation-markers/index.d.ts.map +1 -0
- package/es/indentation-markers/index.js +160 -0
- package/es/indentation-markers/map.d.ts +77 -0
- package/es/indentation-markers/map.d.ts.map +1 -0
- package/es/indentation-markers/map.js +265 -0
- package/es/indentation-markers/utils.d.ts +27 -0
- package/es/indentation-markers/utils.d.ts.map +1 -0
- package/es/indentation-markers/utils.js +91 -0
- package/es/index.d.ts +13 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +12 -0
- package/es/libro-icon.d.ts +3 -0
- package/es/libro-icon.d.ts.map +1 -0
- package/es/libro-icon.js +2 -0
- package/es/lsp/completion.d.ts +5 -0
- package/es/lsp/completion.d.ts.map +1 -0
- package/es/lsp/completion.js +245 -0
- package/es/lsp/format.d.ts +7 -0
- package/es/lsp/format.d.ts.map +1 -0
- package/es/lsp/format.js +193 -0
- package/es/lsp/index.d.ts +7 -0
- package/es/lsp/index.d.ts.map +1 -0
- package/es/lsp/index.js +6 -0
- package/es/lsp/lint.d.ts +3 -0
- package/es/lsp/lint.d.ts.map +1 -0
- package/es/lsp/lint.js +113 -0
- package/es/lsp/protocol.d.ts +7 -0
- package/es/lsp/protocol.d.ts.map +1 -0
- package/es/lsp/protocol.js +1 -0
- package/es/lsp/tooltip.d.ts +3 -0
- package/es/lsp/tooltip.d.ts.map +1 -0
- package/es/lsp/tooltip.js +113 -0
- package/es/lsp/util.d.ts +15 -0
- package/es/lsp/util.d.ts.map +1 -0
- package/es/lsp/util.js +57 -0
- package/es/mimetype.d.ts +22 -0
- package/es/mimetype.d.ts.map +1 -0
- package/es/mimetype.js +59 -0
- package/es/mode.d.ts +86 -0
- package/es/mode.d.ts.map +1 -0
- package/es/mode.js +280 -0
- package/es/module.d.ts +3 -0
- package/es/module.d.ts.map +1 -0
- package/es/module.js +4 -0
- package/es/monitor.d.ts +32 -0
- package/es/monitor.d.ts.map +1 -0
- package/es/monitor.js +129 -0
- package/es/python-lang.d.ts +3 -0
- package/es/python-lang.d.ts.map +1 -0
- package/es/python-lang.js +7 -0
- package/es/style/base.css +129 -0
- package/es/style/theme.css +12 -0
- package/es/style/variables.css +405 -0
- package/es/theme.d.ts +35 -0
- package/es/theme.d.ts.map +1 -0
- package/es/theme.js +223 -0
- package/es/tooltip.d.ts +10 -0
- package/es/tooltip.d.ts.map +1 -0
- package/es/tooltip.js +168 -0
- package/package.json +74 -0
- package/src/auto-complete/README.md +71 -0
- package/src/auto-complete/closebrackets.ts +423 -0
- package/src/auto-complete/completion.ts +345 -0
- package/src/auto-complete/config.ts +101 -0
- package/src/auto-complete/filter.ts +214 -0
- package/src/auto-complete/index.ts +112 -0
- package/src/auto-complete/snippet.ts +392 -0
- package/src/auto-complete/state.ts +465 -0
- package/src/auto-complete/theme.ts +127 -0
- package/src/auto-complete/tooltip.ts +386 -0
- package/src/auto-complete/view.ts +339 -0
- package/src/auto-complete/word.ts +118 -0
- package/src/completion.ts +61 -0
- package/src/config.ts +701 -0
- package/src/editor-contribution.ts +22 -0
- package/src/editor.ts +1287 -0
- package/src/factory.ts +31 -0
- package/src/hyperlink.ts +95 -0
- package/src/indent.ts +69 -0
- package/src/indentation-markers/config.ts +31 -0
- package/src/indentation-markers/index.ts +192 -0
- package/src/indentation-markers/map.ts +273 -0
- package/src/indentation-markers/utils.ts +84 -0
- package/src/index.spec.ts +12 -0
- package/src/index.ts +14 -0
- package/src/libro-icon.tsx +4 -0
- package/src/lsp/completion.ts +175 -0
- package/src/lsp/format.ts +144 -0
- package/src/lsp/index.ts +6 -0
- package/src/lsp/lint.ts +125 -0
- package/src/lsp/protocol.ts +8 -0
- package/src/lsp/tooltip.ts +76 -0
- package/src/lsp/util.ts +69 -0
- package/src/mimetype.ts +49 -0
- package/src/mode.ts +265 -0
- package/src/module.ts +8 -0
- package/src/monitor.ts +105 -0
- package/src/python-lang.ts +7 -0
- package/src/style/base.css +129 -0
- package/src/style/theme.css +12 -0
- package/src/style/variables.css +405 -0
- package/src/theme.ts +231 -0
- package/src/tooltip.ts +143 -0
package/es/mode.js
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
6
|
+
import { markdown } from '@codemirror/lang-markdown';
|
|
7
|
+
import { LanguageDescription } from '@codemirror/language';
|
|
8
|
+
import { defaultMimeType } from '@difizen/libro-code-editor';
|
|
9
|
+
import { PathExt } from '@difizen/libro-common';
|
|
10
|
+
import { highlightTree } from '@lezer/highlight';
|
|
11
|
+
import { python } from "./python-lang.js";
|
|
12
|
+
import { jupyterHighlightStyle } from "./theme.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The interface of a codemirror language spec.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
// Code mirror uses two similar structures, a plain object with optional fields,
|
|
19
|
+
// and a class with the same fields but all mandatory. Maybe adopting the same
|
|
20
|
+
// pattern would be less confusing (although far more verbose)
|
|
21
|
+
function makeSpec(spec) {
|
|
22
|
+
var res = LanguageDescription.of(spec);
|
|
23
|
+
res.mime = spec.mime;
|
|
24
|
+
return res;
|
|
25
|
+
}
|
|
26
|
+
var modeList = [makeSpec({
|
|
27
|
+
name: 'Python',
|
|
28
|
+
mime: 'text/x-python',
|
|
29
|
+
extensions: ['BUILD', 'bzl', 'py', 'pyw'],
|
|
30
|
+
filename: /^(BUCK|BUILD)$/,
|
|
31
|
+
load: function load() {
|
|
32
|
+
return Promise.resolve(python());
|
|
33
|
+
}
|
|
34
|
+
}), makeSpec({
|
|
35
|
+
name: 'Markdown',
|
|
36
|
+
mime: 'text/x-markdown',
|
|
37
|
+
extensions: ['md', 'markdown', 'mkd'],
|
|
38
|
+
load: function load() {
|
|
39
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
40
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
41
|
+
while (1) switch (_context.prev = _context.next) {
|
|
42
|
+
case 0:
|
|
43
|
+
return _context.abrupt("return", Promise.resolve(markdown()));
|
|
44
|
+
case 1:
|
|
45
|
+
case "end":
|
|
46
|
+
return _context.stop();
|
|
47
|
+
}
|
|
48
|
+
}, _callee);
|
|
49
|
+
}))();
|
|
50
|
+
}
|
|
51
|
+
})];
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Get the raw list of available modes specs.
|
|
55
|
+
*
|
|
56
|
+
* @alpha
|
|
57
|
+
* @returns The available modes
|
|
58
|
+
*/
|
|
59
|
+
export function getModeInfo() {
|
|
60
|
+
return modeList;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Find a codemirror mode by MIME.
|
|
65
|
+
*
|
|
66
|
+
* @alpha
|
|
67
|
+
* @param mime Mime type to look for
|
|
68
|
+
* @returns The mode or null
|
|
69
|
+
*/
|
|
70
|
+
export function findByMIME(mime) {
|
|
71
|
+
if (Array.isArray(mime)) {
|
|
72
|
+
for (var i = 0; i < mime.length; i++) {
|
|
73
|
+
var spec = findByMIME(mime[i]);
|
|
74
|
+
if (spec) {
|
|
75
|
+
return spec;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
var _mime = mime.toLowerCase();
|
|
81
|
+
for (var _i = 0; _i < modeList.length; _i++) {
|
|
82
|
+
var info = modeList[_i];
|
|
83
|
+
if (Array.isArray(info.mime)) {
|
|
84
|
+
for (var j = 0; j < info.mime.length; j++) {
|
|
85
|
+
if (info.mime[j] === _mime) {
|
|
86
|
+
return info;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
} else if (info.mime === _mime) {
|
|
90
|
+
return info;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (/\+xml$/.test(_mime)) {
|
|
94
|
+
return findByMIME('application/xml');
|
|
95
|
+
}
|
|
96
|
+
if (/\+json$/.test(_mime)) {
|
|
97
|
+
return findByMIME('application/json');
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Find a codemirror mode by name.
|
|
104
|
+
*
|
|
105
|
+
* @alpha
|
|
106
|
+
* @param name The mode name
|
|
107
|
+
* @returns The mode or null
|
|
108
|
+
*/
|
|
109
|
+
export function findByName(name) {
|
|
110
|
+
var _name = name.toLowerCase();
|
|
111
|
+
for (var i = 0; i < modeList.length; i++) {
|
|
112
|
+
var info = modeList[i];
|
|
113
|
+
if (info.name.toLowerCase() === _name) {
|
|
114
|
+
return info;
|
|
115
|
+
}
|
|
116
|
+
if (info.alias) {
|
|
117
|
+
for (var j = 0; j < info.alias.length; j++) {
|
|
118
|
+
if (info.alias[j].toLowerCase() === _name) {
|
|
119
|
+
return info;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Find a codemirror mode by extension.
|
|
129
|
+
*
|
|
130
|
+
* @alpha
|
|
131
|
+
* @param ext The extension name
|
|
132
|
+
* @returns The mode or null
|
|
133
|
+
*/
|
|
134
|
+
export function findByExtension(ext) {
|
|
135
|
+
if (Array.isArray(ext)) {
|
|
136
|
+
for (var i = 0; i < ext.length; i++) {
|
|
137
|
+
var spec = findByExtension(ext[i]);
|
|
138
|
+
if (spec) {
|
|
139
|
+
return spec;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
var _ext = ext.toLowerCase();
|
|
145
|
+
for (var _i2 = 0; _i2 < modeList.length; _i2++) {
|
|
146
|
+
var info = modeList[_i2];
|
|
147
|
+
for (var j = 0; j < info.extensions.length; j++) {
|
|
148
|
+
if (info.extensions[j].toLowerCase() === _ext) {
|
|
149
|
+
return info;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Find a codemirror mode by filename.
|
|
158
|
+
*
|
|
159
|
+
* @param name File name
|
|
160
|
+
* @returns The mode or null
|
|
161
|
+
*/
|
|
162
|
+
export function findByFileName(name) {
|
|
163
|
+
var basename = PathExt.basename(name);
|
|
164
|
+
for (var i = 0; i < modeList.length; i++) {
|
|
165
|
+
var info = modeList[i];
|
|
166
|
+
if (info.filename && info.filename.test(basename)) {
|
|
167
|
+
return info;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
var dot = basename.lastIndexOf('.');
|
|
171
|
+
var ext = dot > -1 && basename.substring(dot + 1, basename.length);
|
|
172
|
+
if (ext) {
|
|
173
|
+
return findByExtension(ext);
|
|
174
|
+
}
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Find a codemirror mode by name or CodeMirror spec.
|
|
180
|
+
*
|
|
181
|
+
* @alpha
|
|
182
|
+
* @param mode The CodeMirror mode
|
|
183
|
+
* @param fallback Whether to fallback to default mimetype spec or not
|
|
184
|
+
* @returns The mode or null
|
|
185
|
+
*/
|
|
186
|
+
export function findBest(mode) {
|
|
187
|
+
var _mode$extensions, _ref, _ref2, _ref3;
|
|
188
|
+
var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
189
|
+
var modename = typeof mode === 'string' ? mode : mode.name;
|
|
190
|
+
var mimetype = typeof mode !== 'string' ? mode.mime : modename;
|
|
191
|
+
var ext = typeof mode !== 'string' ? (_mode$extensions = mode.extensions) !== null && _mode$extensions !== void 0 ? _mode$extensions : [] : [];
|
|
192
|
+
return (_ref = (_ref2 = (_ref3 = modename ? findByName(modename) : null) !== null && _ref3 !== void 0 ? _ref3 : mimetype ? findByMIME(mimetype) : null) !== null && _ref2 !== void 0 ? _ref2 : findByExtension(ext)) !== null && _ref !== void 0 ? _ref : fallback ? findByMIME(defaultMimeType) : null;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Ensure a codemirror mode is available by name or Codemirror spec.
|
|
197
|
+
*
|
|
198
|
+
* @param mode - The mode to ensure. If it is a string, uses [findBest]
|
|
199
|
+
* to get the appropriate spec.
|
|
200
|
+
*
|
|
201
|
+
* @returns A promise that resolves when the mode is available.
|
|
202
|
+
*/
|
|
203
|
+
export function ensure(_x) {
|
|
204
|
+
return _ensure.apply(this, arguments);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Register a new mode for CodeMirror
|
|
209
|
+
*
|
|
210
|
+
* @alpha
|
|
211
|
+
* @param mode Mode to register
|
|
212
|
+
*/
|
|
213
|
+
function _ensure() {
|
|
214
|
+
_ensure = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(mode) {
|
|
215
|
+
var spec;
|
|
216
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
217
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
218
|
+
case 0:
|
|
219
|
+
spec = findBest(mode);
|
|
220
|
+
if (!spec) {
|
|
221
|
+
_context2.next = 6;
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
_context2.next = 4;
|
|
225
|
+
return spec.load();
|
|
226
|
+
case 4:
|
|
227
|
+
spec.support = _context2.sent;
|
|
228
|
+
return _context2.abrupt("return", spec);
|
|
229
|
+
case 6:
|
|
230
|
+
return _context2.abrupt("return", null);
|
|
231
|
+
case 7:
|
|
232
|
+
case "end":
|
|
233
|
+
return _context2.stop();
|
|
234
|
+
}
|
|
235
|
+
}, _callee2);
|
|
236
|
+
}));
|
|
237
|
+
return _ensure.apply(this, arguments);
|
|
238
|
+
}
|
|
239
|
+
export function registerModeInfo(mode) {
|
|
240
|
+
var info = findBest(mode, false);
|
|
241
|
+
if (info) {
|
|
242
|
+
throw new Error("".concat(mode.mime, " already registered"));
|
|
243
|
+
}
|
|
244
|
+
modeList.push(makeSpec(mode));
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Parse and style a string.
|
|
249
|
+
*
|
|
250
|
+
* @alpha
|
|
251
|
+
* @param code Code to highlight
|
|
252
|
+
* @param mode Code mode
|
|
253
|
+
* @param el HTML element into which the highlighted code will be inserted
|
|
254
|
+
*/
|
|
255
|
+
export function run(code, mode, el) {
|
|
256
|
+
var _mode$support;
|
|
257
|
+
var language = (_mode$support = mode.support) === null || _mode$support === void 0 ? void 0 : _mode$support.language;
|
|
258
|
+
if (!language) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
var tree = language.parser.parse(code);
|
|
262
|
+
// position state required because unstyled tokens are not emitted
|
|
263
|
+
// in highlightTree
|
|
264
|
+
var pos = 0;
|
|
265
|
+
highlightTree(tree, jupyterHighlightStyle, function (from, to, classes) {
|
|
266
|
+
if (from > pos) {
|
|
267
|
+
// No style applied to the token between pos and from
|
|
268
|
+
el.appendChild(document.createTextNode(code.slice(pos, from)));
|
|
269
|
+
}
|
|
270
|
+
var sp = el.appendChild(document.createElement('span'));
|
|
271
|
+
sp.className = classes;
|
|
272
|
+
sp.appendChild(document.createTextNode(code.slice(from, to)));
|
|
273
|
+
pos = to;
|
|
274
|
+
});
|
|
275
|
+
if (pos < tree.length - 1) {
|
|
276
|
+
// No style applied on the trailing text
|
|
277
|
+
el.appendChild(document.createTextNode(code.slice(pos, tree.length)));
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
// }
|
package/es/module.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI/C,eAAO,MAAM,sBAAsB,YAEN,CAAC"}
|
package/es/module.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CodeEditorModule } from '@difizen/libro-code-editor';
|
|
2
|
+
import { ManaModule } from '@difizen/mana-app';
|
|
3
|
+
import { CodeMirrorEditorContribution } from "./editor-contribution.js";
|
|
4
|
+
export var CodeMirrorEditorModule = ManaModule.create().register(CodeMirrorEditorContribution).dependOn(CodeEditorModule);
|
package/es/monitor.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Emitter } from '@difizen/mana-app';
|
|
2
|
+
interface DocStatus {
|
|
3
|
+
source: string[];
|
|
4
|
+
cursor: number;
|
|
5
|
+
changes?: string;
|
|
6
|
+
}
|
|
7
|
+
interface CompletionChange {
|
|
8
|
+
start?: DocStatus;
|
|
9
|
+
accept?: DocStatus;
|
|
10
|
+
close?: DocStatus;
|
|
11
|
+
selectIndex?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare class CompletionMonitor {
|
|
14
|
+
protected static instance: CompletionMonitor;
|
|
15
|
+
static getInstance(): CompletionMonitor;
|
|
16
|
+
protected completionChangeEmitter: Emitter<CompletionChange>;
|
|
17
|
+
get compeltionChange(): import("@difizen/mana-app").Event<CompletionChange>;
|
|
18
|
+
protected tooltipChangeEmitter: Emitter<boolean>;
|
|
19
|
+
get onTooltipChange(): import("@difizen/mana-app").Event<boolean>;
|
|
20
|
+
protected currentChange: CompletionChange | undefined;
|
|
21
|
+
start(doc: DocStatus): void;
|
|
22
|
+
accept(doc: DocStatus): void;
|
|
23
|
+
close(doc: DocStatus): void;
|
|
24
|
+
updateIndex(index: number): void;
|
|
25
|
+
emitChange(change: CompletionChange): void;
|
|
26
|
+
}
|
|
27
|
+
export interface MonitorPluginOptions {
|
|
28
|
+
onTooltipChange?: (visible: boolean) => void;
|
|
29
|
+
}
|
|
30
|
+
export declare const monitorPlugin: (options: MonitorPluginOptions) => import("@codemirror/state").Extension;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=monitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monitor.d.ts","sourceRoot":"","sources":["../src/monitor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAQ5C,UAAU,SAAS;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,iBAAiB;IAC5B,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IAE7C,MAAM,CAAC,WAAW;IAOlB,SAAS,CAAC,uBAAuB,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAiB;IAE7E,IAAI,gBAAgB,wDAEnB;IAED,SAAS,CAAC,oBAAoB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAiB;IAEjE,IAAI,eAAe,+CAElB;IAED,SAAS,CAAC,aAAa,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAEtD,KAAK,CAAC,GAAG,EAAE,SAAS;IAIpB,MAAM,CAAC,GAAG,EAAE,SAAS;IAKrB,KAAK,CAAC,GAAG,EAAE,SAAS;IAKpB,WAAW,CAAC,KAAK,EAAE,MAAM;IAIzB,UAAU,CAAC,MAAM,EAAE,gBAAgB;CAGpC;AAED,MAAM,WAAW,oBAAoB;IACnC,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C;AAED,eAAO,MAAM,aAAa,YAAa,oBAAoB,0CA+BvD,CAAC"}
|
package/es/monitor.js
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
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, _toPropertyKey(descriptor.key), descriptor); } }
|
|
10
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
12
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
|
+
import { EditorView, hasHoverTooltips } from '@codemirror/view';
|
|
14
|
+
import { Emitter } from '@difizen/mana-app';
|
|
15
|
+
import { closeCompletionEffect, setSelectedEffect, startCompletionEffect } from "./auto-complete/state.js";
|
|
16
|
+
export var CompletionMonitor = /*#__PURE__*/function () {
|
|
17
|
+
function CompletionMonitor() {
|
|
18
|
+
_classCallCheck(this, CompletionMonitor);
|
|
19
|
+
this.completionChangeEmitter = new Emitter();
|
|
20
|
+
this.tooltipChangeEmitter = new Emitter();
|
|
21
|
+
}
|
|
22
|
+
_createClass(CompletionMonitor, [{
|
|
23
|
+
key: "compeltionChange",
|
|
24
|
+
get: function get() {
|
|
25
|
+
return this.completionChangeEmitter.event;
|
|
26
|
+
}
|
|
27
|
+
}, {
|
|
28
|
+
key: "onTooltipChange",
|
|
29
|
+
get: function get() {
|
|
30
|
+
return this.tooltipChangeEmitter.event;
|
|
31
|
+
}
|
|
32
|
+
}, {
|
|
33
|
+
key: "start",
|
|
34
|
+
value: function start(doc) {
|
|
35
|
+
this.currentChange = {
|
|
36
|
+
start: doc,
|
|
37
|
+
selectIndex: 0
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
key: "accept",
|
|
42
|
+
value: function accept(doc) {
|
|
43
|
+
this.currentChange = _objectSpread(_objectSpread({}, this.currentChange), {
|
|
44
|
+
accept: doc
|
|
45
|
+
});
|
|
46
|
+
this.emitChange(this.currentChange);
|
|
47
|
+
}
|
|
48
|
+
}, {
|
|
49
|
+
key: "close",
|
|
50
|
+
value: function close(doc) {
|
|
51
|
+
this.currentChange = _objectSpread(_objectSpread({}, this.currentChange), {
|
|
52
|
+
close: doc,
|
|
53
|
+
selectIndex: -1
|
|
54
|
+
});
|
|
55
|
+
this.emitChange(this.currentChange);
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
key: "updateIndex",
|
|
59
|
+
value: function updateIndex(index) {
|
|
60
|
+
this.currentChange = _objectSpread(_objectSpread({}, this.currentChange), {
|
|
61
|
+
selectIndex: index
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}, {
|
|
65
|
+
key: "emitChange",
|
|
66
|
+
value: function emitChange(change) {
|
|
67
|
+
this.completionChangeEmitter.fire(change);
|
|
68
|
+
}
|
|
69
|
+
}], [{
|
|
70
|
+
key: "getInstance",
|
|
71
|
+
value: function getInstance() {
|
|
72
|
+
if (!CompletionMonitor.instance) {
|
|
73
|
+
CompletionMonitor.instance = new CompletionMonitor();
|
|
74
|
+
}
|
|
75
|
+
return CompletionMonitor.instance;
|
|
76
|
+
}
|
|
77
|
+
}]);
|
|
78
|
+
return CompletionMonitor;
|
|
79
|
+
}();
|
|
80
|
+
export var monitorPlugin = function monitorPlugin(options) {
|
|
81
|
+
return EditorView.updateListener.of(function (update) {
|
|
82
|
+
var _iterator = _createForOfIteratorHelper(update.transactions),
|
|
83
|
+
_step;
|
|
84
|
+
try {
|
|
85
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
86
|
+
var _options$onTooltipCha;
|
|
87
|
+
var trans = _step.value;
|
|
88
|
+
var effects = trans.effects;
|
|
89
|
+
options === null || options === void 0 || (_options$onTooltipCha = options.onTooltipChange) === null || _options$onTooltipCha === void 0 || _options$onTooltipCha.call(options, hasHoverTooltips(update.state));
|
|
90
|
+
if (trans.isUserEvent('input.complete')) {
|
|
91
|
+
CompletionMonitor.getInstance().accept({
|
|
92
|
+
changes: JSON.stringify(trans.changes.toJSON()),
|
|
93
|
+
cursor: update.state.selection.main.head,
|
|
94
|
+
source: update.state.doc.toJSON()
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
var _iterator2 = _createForOfIteratorHelper(effects),
|
|
98
|
+
_step2;
|
|
99
|
+
try {
|
|
100
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
101
|
+
var effect = _step2.value;
|
|
102
|
+
if (effect.is(startCompletionEffect)) {
|
|
103
|
+
CompletionMonitor.getInstance().start({
|
|
104
|
+
cursor: update.state.selection.main.head,
|
|
105
|
+
source: update.state.doc.toJSON()
|
|
106
|
+
});
|
|
107
|
+
} else if (effect.is(closeCompletionEffect)) {
|
|
108
|
+
CompletionMonitor.getInstance().close({
|
|
109
|
+
cursor: update.state.selection.main.head,
|
|
110
|
+
source: update.state.doc.toJSON()
|
|
111
|
+
});
|
|
112
|
+
} else if (effect.is(setSelectedEffect)) {
|
|
113
|
+
CompletionMonitor.getInstance().updateIndex(effect.value);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
} catch (err) {
|
|
117
|
+
_iterator2.e(err);
|
|
118
|
+
} finally {
|
|
119
|
+
_iterator2.f();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
} catch (err) {
|
|
123
|
+
_iterator.e(err);
|
|
124
|
+
} finally {
|
|
125
|
+
_iterator.f();
|
|
126
|
+
}
|
|
127
|
+
return null;
|
|
128
|
+
});
|
|
129
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python-lang.d.ts","sourceRoot":"","sources":["../src/python-lang.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,wBAAgB,MAAM,oBAErB"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/* stylelint-disable function-url-quotes */
|
|
2
|
+
.cm-editor {
|
|
3
|
+
line-height: var(--jp-code-line-height);
|
|
4
|
+
font-size: var(--jp-code-font-size);
|
|
5
|
+
font-family: var(--jp-code-font-family);
|
|
6
|
+
border: 0;
|
|
7
|
+
border-radius: 4px;
|
|
8
|
+
height: auto;
|
|
9
|
+
background: var(--mana-libro-input-background);
|
|
10
|
+
padding: 12px 0 18px;
|
|
11
|
+
|
|
12
|
+
/* Changed to auto to autogrow */
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.cm-editor pre {
|
|
16
|
+
padding: 0 var(--jp-code-padding);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.cm-selectionMatch {
|
|
20
|
+
background-color: #e3ebff !important;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.jp-CodeMirrorEditor[data-type='inline'] .cm-dialog {
|
|
24
|
+
background-color: var(--jp-layout-color0);
|
|
25
|
+
color: var(--jp-content-font-color1);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.jp-CodeMirrorEditor {
|
|
29
|
+
cursor: text;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* When zoomed out 67% and 33% on a screen of 1440 width x 900 height */
|
|
33
|
+
@media screen and (min-width: 2138px) and (max-width: 4319px) {
|
|
34
|
+
.jp-CodeMirrorEditor[data-type='inline'] .cm-cursor {
|
|
35
|
+
border-left: var(--jp-code-cursor-width1) solid var(--jp-editor-cursor-color);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* When zoomed out less than 33% */
|
|
40
|
+
@media screen and (min-width: 4320px) {
|
|
41
|
+
.jp-CodeMirrorEditor[data-type='inline'] .cm-cursor {
|
|
42
|
+
border-left: var(--jp-code-cursor-width2) solid var(--jp-editor-cursor-color);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.cm-editor.jp-mod-readOnly .cm-cursor {
|
|
47
|
+
display: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.jp-CollaboratorCursor {
|
|
51
|
+
border-left: 5px solid transparent;
|
|
52
|
+
border-right: 5px solid transparent;
|
|
53
|
+
border-top: none;
|
|
54
|
+
border-bottom: 3px solid;
|
|
55
|
+
background-clip: content-box;
|
|
56
|
+
margin-left: -5px;
|
|
57
|
+
margin-right: -5px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.cm-searching,
|
|
61
|
+
.cm-searching span {
|
|
62
|
+
background-color: var(--jp-search-unselected-match-background-color);
|
|
63
|
+
color: var(--jp-search-unselected-match-color);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.cm-searching span::selection {
|
|
67
|
+
background-color: var(--jp-search-selected-match-background-color) !important;
|
|
68
|
+
color: var(--jp-search-selected-match-color) !important;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.cm-trailingspace {
|
|
72
|
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAsElEQVQIHQGlAFr/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7+r3zKmT0/+pk9P/7+r3zAAAAAAAAAAABAAAAAAAAAAA6OPzM+/q9wAAAAAA6OPzMwAAAAAAAAAAAgAAAAAAAAAAGR8NiRQaCgAZIA0AGR8NiQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQyoYJ/SY80UAAAAASUVORK5CYII=);
|
|
73
|
+
background-position: center left;
|
|
74
|
+
background-repeat: repeat-x;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.jp-CollaboratorCursor-hover {
|
|
78
|
+
position: absolute;
|
|
79
|
+
z-index: 1;
|
|
80
|
+
transform: translateX(-50%);
|
|
81
|
+
color: white;
|
|
82
|
+
border-radius: 3px;
|
|
83
|
+
padding: 1px 4px;
|
|
84
|
+
text-align: center;
|
|
85
|
+
font-size: var(--jp-ui-font-size1);
|
|
86
|
+
white-space: nowrap;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.jp-CodeMirror-ruler {
|
|
90
|
+
border-left: 1px dashed var(--jp-border-color2);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* Styles for shared cursors (remote cursor locations and selected ranges) */
|
|
94
|
+
.jp-CodeMirrorEditor .remote-caret {
|
|
95
|
+
position: relative;
|
|
96
|
+
border-left: 2px solid black;
|
|
97
|
+
margin-left: -1px;
|
|
98
|
+
margin-right: -1px;
|
|
99
|
+
box-sizing: border-box;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.jp-CodeMirrorEditor .remote-caret > div {
|
|
103
|
+
white-space: nowrap;
|
|
104
|
+
position: absolute;
|
|
105
|
+
top: -1.15em;
|
|
106
|
+
padding-bottom: 0.05em;
|
|
107
|
+
left: -2px;
|
|
108
|
+
font-size: 0.95em;
|
|
109
|
+
background-color: rgb(250, 129, 0);
|
|
110
|
+
font-family: var(--jp-ui-font-family);
|
|
111
|
+
font-weight: bold;
|
|
112
|
+
line-height: normal;
|
|
113
|
+
user-select: none;
|
|
114
|
+
color: white;
|
|
115
|
+
padding-left: 2px;
|
|
116
|
+
padding-right: 2px;
|
|
117
|
+
z-index: 3;
|
|
118
|
+
transition: opacity 0.3s ease-in-out;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.jp-CodeMirrorEditor .remote-caret.hide-name > div {
|
|
122
|
+
transition-delay: 0.7s;
|
|
123
|
+
opacity: 0;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.jp-CodeMirrorEditor .remote-caret:hover > div {
|
|
127
|
+
opacity: 1;
|
|
128
|
+
transition-delay: 0s;
|
|
129
|
+
}
|