@difizen/libro-cofine-textmate 0.1.2

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.
Files changed (68) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -0
  3. package/es/data/monaco-themes/vscode/dark_defaults.json +23 -0
  4. package/es/data/monaco-themes/vscode/dark_editor.json +116 -0
  5. package/es/data/monaco-themes/vscode/dark_plus.json +180 -0
  6. package/es/data/monaco-themes/vscode/dark_vs.json +358 -0
  7. package/es/data/monaco-themes/vscode/hc_black.json +120 -0
  8. package/es/data/monaco-themes/vscode/hc_black_defaults.json +335 -0
  9. package/es/data/monaco-themes/vscode/hc_editor.json +7 -0
  10. package/es/data/monaco-themes/vscode/light_defaults.json +22 -0
  11. package/es/data/monaco-themes/vscode/light_editor.json +11 -0
  12. package/es/data/monaco-themes/vscode/light_plus.json +180 -0
  13. package/es/data/monaco-themes/vscode/light_vs.json +380 -0
  14. package/es/global.d.ts +7 -0
  15. package/es/index.d.ts +7 -0
  16. package/es/index.d.ts.map +1 -0
  17. package/es/index.js +6 -0
  18. package/es/monaco-grammar-registry.d.ts +15 -0
  19. package/es/monaco-grammar-registry.d.ts.map +1 -0
  20. package/es/monaco-grammar-registry.js +130 -0
  21. package/es/monaco-module.d.ts +4 -0
  22. package/es/monaco-module.d.ts.map +1 -0
  23. package/es/monaco-module.js +78 -0
  24. package/es/monaco-textmate-service.d.ts +29 -0
  25. package/es/monaco-textmate-service.d.ts.map +1 -0
  26. package/es/monaco-textmate-service.js +284 -0
  27. package/es/monaco-theme-registry.d.ts +33 -0
  28. package/es/monaco-theme-registry.d.ts.map +1 -0
  29. package/es/monaco-theme-registry.js +227 -0
  30. package/es/monaco-theme-types.d.ts +5 -0
  31. package/es/monaco-theme-types.d.ts.map +1 -0
  32. package/es/monaco-theme-types.js +1 -0
  33. package/es/textmate-contribution.d.ts +9 -0
  34. package/es/textmate-contribution.d.ts.map +1 -0
  35. package/es/textmate-contribution.js +6 -0
  36. package/es/textmate-registry.d.ts +32 -0
  37. package/es/textmate-registry.d.ts.map +1 -0
  38. package/es/textmate-registry.js +130 -0
  39. package/es/textmate-theme-contribution.d.ts +6 -0
  40. package/es/textmate-theme-contribution.d.ts.map +1 -0
  41. package/es/textmate-theme-contribution.js +50 -0
  42. package/es/textmate-tokenizer.d.ts +25 -0
  43. package/es/textmate-tokenizer.d.ts.map +1 -0
  44. package/es/textmate-tokenizer.js +32 -0
  45. package/package.json +59 -0
  46. package/src/data/monaco-themes/vscode/dark_defaults.json +23 -0
  47. package/src/data/monaco-themes/vscode/dark_editor.json +116 -0
  48. package/src/data/monaco-themes/vscode/dark_plus.json +180 -0
  49. package/src/data/monaco-themes/vscode/dark_vs.json +358 -0
  50. package/src/data/monaco-themes/vscode/hc_black.json +120 -0
  51. package/src/data/monaco-themes/vscode/hc_black_defaults.json +335 -0
  52. package/src/data/monaco-themes/vscode/hc_editor.json +7 -0
  53. package/src/data/monaco-themes/vscode/light_defaults.json +22 -0
  54. package/src/data/monaco-themes/vscode/light_editor.json +11 -0
  55. package/src/data/monaco-themes/vscode/light_plus.json +180 -0
  56. package/src/data/monaco-themes/vscode/light_vs.json +380 -0
  57. package/src/global.d.ts +7 -0
  58. package/src/index.spec.ts +8 -0
  59. package/src/index.ts +8 -0
  60. package/src/monaco-grammar-registry.ts +88 -0
  61. package/src/monaco-module.ts +59 -0
  62. package/src/monaco-textmate-service.ts +220 -0
  63. package/src/monaco-theme-registry.ts +201 -0
  64. package/src/monaco-theme-types.ts +5 -0
  65. package/src/textmate-contribution.ts +15 -0
  66. package/src/textmate-registry.ts +134 -0
  67. package/src/textmate-theme-contribution.ts +39 -0
  68. package/src/textmate-tokenizer.ts +55 -0
@@ -0,0 +1,78 @@
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 func-names */
6
+ /* eslint-disable global-require */
7
+
8
+ import { Module } from '@difizen/mana-app';
9
+ import * as oniguruma from 'vscode-oniguruma';
10
+ import * as onig from 'vscode-oniguruma/release/onig.wasm';
11
+ import { isBasicWasmSupported, MonacoGrammarRegistry, OnigurumaPromise } from "./monaco-grammar-registry.js";
12
+ import { MonacoTextmateService } from "./monaco-textmate-service.js";
13
+ import { MonacoThemeRegistry } from "./monaco-theme-registry.js";
14
+ import { LanguageGrammarDefinitionContribution } from "./textmate-contribution.js";
15
+ import { TextmateRegistry } from "./textmate-registry.js";
16
+ import { TextmateThemeContribution } from "./textmate-theme-contribution.js";
17
+ export function fetchOniguruma() {
18
+ return _fetchOniguruma.apply(this, arguments);
19
+ }
20
+ function _fetchOniguruma() {
21
+ _fetchOniguruma = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
22
+ var onigurumaPath, onigurumaUrl, response, contentType;
23
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
24
+ while (1) switch (_context2.prev = _context2.next) {
25
+ case 0:
26
+ // const onigurumaPath = 'https://unpkg.com/vscode-oniguruma@2.0.1/release/onig.wasm'; // webpack doing its magic here
27
+ onigurumaPath = onig;
28
+ onigurumaUrl = onigurumaPath;
29
+ if (typeof onigurumaPath !== 'string' && onigurumaPath.default) {
30
+ onigurumaUrl = onigurumaPath.default;
31
+ }
32
+ _context2.next = 5;
33
+ return fetch(onigurumaUrl);
34
+ case 5:
35
+ response = _context2.sent;
36
+ contentType = response.headers.get('content-type');
37
+ if (!(contentType === 'application/wasm')) {
38
+ _context2.next = 9;
39
+ break;
40
+ }
41
+ return _context2.abrupt("return", response);
42
+ case 9:
43
+ _context2.next = 11;
44
+ return response.arrayBuffer();
45
+ case 11:
46
+ return _context2.abrupt("return", _context2.sent);
47
+ case 12:
48
+ case "end":
49
+ return _context2.stop();
50
+ }
51
+ }, _callee2);
52
+ }));
53
+ return _fetchOniguruma.apply(this, arguments);
54
+ }
55
+ var vscodeOnigurumaLib = fetchOniguruma().then( /*#__PURE__*/function () {
56
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(buffer) {
57
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
58
+ while (1) switch (_context.prev = _context.next) {
59
+ case 0:
60
+ _context.next = 2;
61
+ return oniguruma.loadWASM(buffer);
62
+ case 2:
63
+ return _context.abrupt("return", oniguruma);
64
+ case 3:
65
+ case "end":
66
+ return _context.stop();
67
+ }
68
+ }, _callee);
69
+ }));
70
+ return function (_x) {
71
+ return _ref.apply(this, arguments);
72
+ };
73
+ }());
74
+ export var TextmateModule = Module().register({
75
+ token: OnigurumaPromise,
76
+ useValue: isBasicWasmSupported ? vscodeOnigurumaLib : Promise.reject(new Error('wasm not supported'))
77
+ }, MonacoTextmateService, TextmateRegistry, MonacoThemeRegistry, TextmateThemeContribution, MonacoGrammarRegistry).contribution(LanguageGrammarDefinitionContribution);
78
+ export default TextmateModule;
@@ -0,0 +1,29 @@
1
+ import { EditorHandlerContribution } from '@difizen/libro-cofine-editor-core';
2
+ import type { Contribution } from '@difizen/mana-app';
3
+ import { Disposable, DisposableCollection } from '@difizen/mana-app';
4
+ import { MonacoGrammarRegistry, OnigurumaPromise } from './monaco-grammar-registry.js';
5
+ import { MonacoThemeRegistry } from './monaco-theme-registry.js';
6
+ import { LanguageGrammarDefinitionContribution } from './textmate-contribution.js';
7
+ import { TextmateRegistry } from './textmate-registry.js';
8
+ import type { TokenizerOption } from './textmate-tokenizer.js';
9
+ export declare class MonacoTextmateService implements EditorHandlerContribution {
10
+ protected readonly tokenizerOption: TokenizerOption;
11
+ protected readonly _activatedLanguages: Set<string>;
12
+ protected readonly grammarProviders: Contribution.Provider<LanguageGrammarDefinitionContribution>;
13
+ protected readonly textmateRegistry: TextmateRegistry;
14
+ protected readonly grammarRegistry: MonacoGrammarRegistry;
15
+ protected readonly onigasmPromise: OnigurumaPromise;
16
+ protected readonly monacoThemeRegistry: MonacoThemeRegistry;
17
+ beforeCreate(): void;
18
+ afterCreate(): void;
19
+ canHandle(): boolean;
20
+ dispose(): void;
21
+ initialize(): void;
22
+ protected readonly toDisposeOnUpdateTheme: DisposableCollection;
23
+ protected updateTheme: () => void;
24
+ protected get currentEditorTheme(): string;
25
+ activateLanguage(language: string): Disposable;
26
+ protected doActivateLanguage(languageId: string, toDispose: DisposableCollection): Promise<void>;
27
+ protected waitForLanguage(language: string, cb: () => {}): Disposable;
28
+ }
29
+ //# sourceMappingURL=monaco-textmate-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monaco-textmate-service.d.ts","sourceRoot":"","sources":["../src/monaco-textmate-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,UAAU,EACV,oBAAoB,EAIrB,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,EAEL,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAEL,qCAAqC,EACtC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,qBACa,qBAAsB,YAAW,yBAAyB;IACrE,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAEjD;IAEF,SAAS,CAAC,QAAQ,CAAC,mBAAmB,cAAqB;IAG3D,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,YAAY,CAAC,QAAQ,CAAC,qCAAqC,CAAC,CAAC;IAGlG,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAEtD,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,qBAAqB,CAAC;IAG1D,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,gBAAgB,CAAC;IAGpD,SAAS,CAAC,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAE5D,YAAY;IAGZ,WAAW;IAGX,SAAS;IAGT,OAAO;IAIP,UAAU,IAAI,IAAI;IA0BlB,SAAS,CAAC,QAAQ,CAAC,sBAAsB,uBAA8B;IAEvE,SAAS,CAAC,WAAW,QAAO,IAAI,CAiB9B;IAEF,SAAS,KAAK,kBAAkB,IAAI,MAAM,CAEzC;IAED,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU;cAc9B,kBAAkB,CAChC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,oBAAoB,GAC9B,OAAO,CAAC,IAAI,CAAC;IAoEhB,SAAS,CAAC,eAAe,CACvB,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,EAET,GACA,UAAU;CAad"}
@@ -0,0 +1,284 @@
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
+ var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5;
3
+ 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; }
4
+ 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); } }
5
+ 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); }); }; }
6
+ 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; } } }; }
7
+ 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); }
8
+ 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; }
9
+ function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
10
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11
+ 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); } }
12
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
14
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
15
+ function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
16
+ function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
17
+ import { EditorHandlerContribution } from '@difizen/libro-cofine-editor-core';
18
+ import { Disposable, DisposableCollection, contrib, inject, singleton } from '@difizen/mana-app';
19
+ import * as monaco from '@difizen/monaco-editor-core';
20
+ import { TokenizationRegistry } from '@difizen/monaco-editor-core/esm/vs/editor/common/languages';
21
+ import { ILanguageService } from '@difizen/monaco-editor-core/esm/vs/editor/common/languages/language';
22
+ import { TokenizationSupportAdapter } from '@difizen/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneLanguages';
23
+ import { StandaloneServices } from '@difizen/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
24
+ import { IStandaloneThemeService } from '@difizen/monaco-editor-core/esm/vs/editor/standalone/common/standaloneTheme';
25
+ import { isBasicWasmSupported, MonacoGrammarRegistry, OnigurumaPromise } from "./monaco-grammar-registry.js";
26
+ import { MonacoThemeRegistry } from "./monaco-theme-registry.js";
27
+ import { getEncodedLanguageId, LanguageGrammarDefinitionContribution } from "./textmate-contribution.js";
28
+ import { TextmateRegistry } from "./textmate-registry.js";
29
+ import { createTextmateTokenizer } from "./textmate-tokenizer.js";
30
+ export var MonacoTextmateService = (_dec = singleton({
31
+ contrib: EditorHandlerContribution
32
+ }), _dec2 = contrib(LanguageGrammarDefinitionContribution), _dec3 = inject(TextmateRegistry), _dec4 = inject(MonacoGrammarRegistry), _dec5 = inject(OnigurumaPromise), _dec6 = inject(MonacoThemeRegistry), _dec(_class = (_class2 = /*#__PURE__*/function () {
33
+ function MonacoTextmateService() {
34
+ var _this = this;
35
+ _classCallCheck(this, MonacoTextmateService);
36
+ this.tokenizerOption = {
37
+ lineLimit: 400
38
+ };
39
+ this._activatedLanguages = new Set();
40
+ _initializerDefineProperty(this, "grammarProviders", _descriptor, this);
41
+ _initializerDefineProperty(this, "textmateRegistry", _descriptor2, this);
42
+ _initializerDefineProperty(this, "grammarRegistry", _descriptor3, this);
43
+ _initializerDefineProperty(this, "onigasmPromise", _descriptor4, this);
44
+ _initializerDefineProperty(this, "monacoThemeRegistry", _descriptor5, this);
45
+ this.toDisposeOnUpdateTheme = new DisposableCollection();
46
+ this.updateTheme = function () {
47
+ _this.toDisposeOnUpdateTheme.dispose();
48
+ var currentEditorTheme = _this.currentEditorTheme;
49
+ document.body.classList.add(currentEditorTheme);
50
+ _this.toDisposeOnUpdateTheme.push(Disposable.create(function () {
51
+ return document.body.classList.remove(currentEditorTheme);
52
+ }));
53
+
54
+ // first update registry to run tokenization with the proper theme
55
+ var theme = _this.monacoThemeRegistry.getThemeData(currentEditorTheme);
56
+ if (theme) {
57
+ _this.grammarRegistry.setupRegistry(theme);
58
+ }
59
+
60
+ // then trigger tokenization by setting monaco theme
61
+ monaco.editor.setTheme(currentEditorTheme);
62
+ };
63
+ }
64
+ _createClass(MonacoTextmateService, [{
65
+ key: "beforeCreate",
66
+ value: function beforeCreate() {
67
+ this.initialize();
68
+ }
69
+ }, {
70
+ key: "afterCreate",
71
+ value: function afterCreate() {
72
+ //
73
+ }
74
+ }, {
75
+ key: "canHandle",
76
+ value: function canHandle() {
77
+ return true;
78
+ }
79
+ }, {
80
+ key: "dispose",
81
+ value: function dispose() {
82
+ //
83
+ }
84
+ }, {
85
+ key: "initialize",
86
+ value: function initialize() {
87
+ var _this2 = this;
88
+ if (!isBasicWasmSupported) {
89
+ console.warn('Textmate support deactivated because WebAssembly is not detected.');
90
+ return;
91
+ }
92
+ var _iterator = _createForOfIteratorHelper(this.grammarProviders.getContributions()),
93
+ _step;
94
+ try {
95
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
96
+ var grammarProvider = _step.value;
97
+ try {
98
+ grammarProvider.registerTextmateLanguage(this.textmateRegistry);
99
+ } catch (err) {
100
+ console.error(err);
101
+ }
102
+ }
103
+ } catch (err) {
104
+ _iterator.e(err);
105
+ } finally {
106
+ _iterator.f();
107
+ }
108
+ var _iterator2 = _createForOfIteratorHelper(this.textmateRegistry.languages),
109
+ _step2;
110
+ try {
111
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
112
+ var id = _step2.value;
113
+ this.activateLanguage(id);
114
+ }
115
+ // const theme = this.monacoThemeRegistry.getThemeData(this.currentEditorTheme);
116
+ // if (!theme) {
117
+ // return;
118
+ // }
119
+ // this.grammarRegistry.setupRegistry(theme);
120
+ } catch (err) {
121
+ _iterator2.e(err);
122
+ } finally {
123
+ _iterator2.f();
124
+ }
125
+ this.monacoThemeRegistry.onThemeChanged(function () {
126
+ _this2.updateTheme();
127
+ });
128
+ }
129
+ }, {
130
+ key: "currentEditorTheme",
131
+ get: function get() {
132
+ return this.monacoThemeRegistry.getMonacoThemeName();
133
+ }
134
+ }, {
135
+ key: "activateLanguage",
136
+ value: function activateLanguage(language) {
137
+ var _this3 = this;
138
+ var toDispose = new DisposableCollection(Disposable.create(function () {
139
+ /* mark as not disposed */
140
+ }));
141
+ toDispose.push(this.waitForLanguage(language, function () {
142
+ return _this3.doActivateLanguage(language, toDispose);
143
+ }));
144
+ return toDispose;
145
+ }
146
+ }, {
147
+ key: "doActivateLanguage",
148
+ value: function () {
149
+ var _doActivateLanguage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(languageId, toDispose) {
150
+ var _this4 = this;
151
+ var scopeName, provider, configuration, initialLanguage, grammar, options, tokenizer, support, themeService, adapter;
152
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
153
+ while (1) switch (_context.prev = _context.next) {
154
+ case 0:
155
+ if (!this._activatedLanguages.has(languageId)) {
156
+ _context.next = 2;
157
+ break;
158
+ }
159
+ return _context.abrupt("return");
160
+ case 2:
161
+ this._activatedLanguages.add(languageId);
162
+ toDispose.push(Disposable.create(function () {
163
+ return _this4._activatedLanguages.delete(languageId);
164
+ }));
165
+ scopeName = this.textmateRegistry.getScope(languageId);
166
+ if (scopeName) {
167
+ _context.next = 7;
168
+ break;
169
+ }
170
+ return _context.abrupt("return");
171
+ case 7:
172
+ provider = this.textmateRegistry.getProvider(scopeName);
173
+ if (provider) {
174
+ _context.next = 10;
175
+ break;
176
+ }
177
+ return _context.abrupt("return");
178
+ case 10:
179
+ configuration = this.textmateRegistry.getGrammarConfiguration(languageId);
180
+ initialLanguage = getEncodedLanguageId(languageId);
181
+ _context.next = 14;
182
+ return this.onigasmPromise;
183
+ case 14:
184
+ if (!toDispose.disposed) {
185
+ _context.next = 16;
186
+ break;
187
+ }
188
+ return _context.abrupt("return");
189
+ case 16:
190
+ if (this.grammarRegistry.registry) {
191
+ _context.next = 18;
192
+ break;
193
+ }
194
+ return _context.abrupt("return");
195
+ case 18:
196
+ _context.prev = 18;
197
+ _context.next = 21;
198
+ return this.grammarRegistry.registry.loadGrammarWithConfiguration(scopeName, initialLanguage, configuration);
199
+ case 21:
200
+ grammar = _context.sent;
201
+ if (!toDispose.disposed) {
202
+ _context.next = 24;
203
+ break;
204
+ }
205
+ return _context.abrupt("return");
206
+ case 24:
207
+ if (grammar) {
208
+ _context.next = 26;
209
+ break;
210
+ }
211
+ throw new Error("no grammar for ".concat(scopeName, ", ").concat(initialLanguage, ", ").concat(JSON.stringify(configuration)));
212
+ case 26:
213
+ options = configuration.tokenizerOption ? configuration.tokenizerOption : this.tokenizerOption;
214
+ tokenizer = createTextmateTokenizer(grammar, options);
215
+ toDispose.push(monaco.languages.setTokensProvider(languageId, tokenizer));
216
+ support = TokenizationRegistry.get(languageId);
217
+ themeService = StandaloneServices.get(IStandaloneThemeService);
218
+ adapter = new TokenizationSupportAdapter(themeService, {
219
+ language: languageId,
220
+ id: StandaloneServices.get(ILanguageService)._registry.languageIdCodec._languageToLanguageId.get(languageId)
221
+ }, tokenizer);
222
+ support.tokenize = adapter.tokenize.bind(adapter);
223
+ this.updateTheme();
224
+ _context.next = 39;
225
+ break;
226
+ case 36:
227
+ _context.prev = 36;
228
+ _context.t0 = _context["catch"](18);
229
+ console.warn('No grammar for this language id', languageId, _context.t0);
230
+ case 39:
231
+ case "end":
232
+ return _context.stop();
233
+ }
234
+ }, _callee, this, [[18, 36]]);
235
+ }));
236
+ function doActivateLanguage(_x, _x2) {
237
+ return _doActivateLanguage.apply(this, arguments);
238
+ }
239
+ return doActivateLanguage;
240
+ }()
241
+ }, {
242
+ key: "waitForLanguage",
243
+ value: function waitForLanguage(language, cb) {
244
+ var modeService = StandaloneServices.get(ILanguageService);
245
+ for (var _i = 0, _Object$keys = Object.keys(modeService._instantiatedModes || {}); _i < _Object$keys.length; _i++) {
246
+ var modeId = _Object$keys[_i];
247
+ var mode = modeService._instantiatedModes[modeId];
248
+ if (mode.getId() === language) {
249
+ cb();
250
+ return Disposable.create(function () {
251
+ //
252
+ });
253
+ }
254
+ }
255
+ return monaco.languages.onLanguage(language, cb);
256
+ }
257
+ }]);
258
+ return MonacoTextmateService;
259
+ }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "grammarProviders", [_dec2], {
260
+ configurable: true,
261
+ enumerable: true,
262
+ writable: true,
263
+ initializer: null
264
+ }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "textmateRegistry", [_dec3], {
265
+ configurable: true,
266
+ enumerable: true,
267
+ writable: true,
268
+ initializer: null
269
+ }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "grammarRegistry", [_dec4], {
270
+ configurable: true,
271
+ enumerable: true,
272
+ writable: true,
273
+ initializer: null
274
+ }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "onigasmPromise", [_dec5], {
275
+ configurable: true,
276
+ enumerable: true,
277
+ writable: true,
278
+ initializer: null
279
+ }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "monacoThemeRegistry", [_dec6], {
280
+ configurable: true,
281
+ enumerable: true,
282
+ writable: true,
283
+ initializer: null
284
+ })), _class2)) || _class);
@@ -0,0 +1,33 @@
1
+ import type { MixedTheme, ITextmateThemeSetting } from '@difizen/libro-cofine-editor-core';
2
+ import { MixedThemeRegistry, InitializeContribution } from '@difizen/libro-cofine-editor-core';
3
+ import type { Color } from '@difizen/mana-app';
4
+ import { Emitter } from '@difizen/mana-app';
5
+ import * as monaco from '@difizen/monaco-editor-core';
6
+ import { MonacoGrammarRegistry } from './monaco-grammar-registry.js';
7
+ export interface MixStandaloneTheme {
8
+ themeData: MixedTheme;
9
+ }
10
+ export declare class MonacoThemeRegistry implements MixedThemeRegistry, InitializeContribution {
11
+ protected readonly grammarRegistry: MonacoGrammarRegistry;
12
+ protected registedTheme: string[];
13
+ onInitialize(): void;
14
+ protected themeChangedEmitter: Emitter<void>;
15
+ onThemeChanged: import("@difizen/mana-app").Event<void>;
16
+ getThemeData(): MixedTheme;
17
+ getThemeData(name: string): MixedTheme | undefined;
18
+ getTheme(): MixStandaloneTheme;
19
+ getTheme(name: string): MixStandaloneTheme | undefined;
20
+ getMonacoThemeName(): string;
21
+ protected doGetTheme(name: string | undefined): MixStandaloneTheme | undefined;
22
+ setTheme(name: string, data: MixedTheme): void;
23
+ registerThemes(themeOptions: Record<string, ITextmateThemeSetting>, setTheme: (name: string, data: monaco.editor.IStandaloneThemeData) => void): void;
24
+ doRegisterThemes(option: ITextmateThemeSetting, themeOptions: Record<string, ITextmateThemeSetting>, setTheme: (name: string, data: monaco.editor.IStandaloneThemeData) => void): MixedTheme;
25
+ protected transform(tokenColor: any, acceptor: (rule: monaco.editor.ITokenThemeRule) => void): void;
26
+ protected normalizeColor(color: string | Color | undefined): string | undefined;
27
+ }
28
+ export declare namespace MonacoThemeRegistry {
29
+ const DARK_DEFAULT_THEME = "e2-dark";
30
+ const LIGHT_DEFAULT_THEME = "e2-light";
31
+ const HC_DEFAULT_THEME = "e2-hc";
32
+ }
33
+ //# sourceMappingURL=monaco-theme-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monaco-theme-registry.d.ts","sourceRoot":"","sources":["../src/monaco-theme-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,qBAAqB,EACtB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAqB,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AAItD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,UAAU,CAAC;CACvB;AAED,qBACa,mBAAoB,YAAW,kBAAkB,EAAE,sBAAsB;IAEpF,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,qBAAqB,CAAC;IAE1D,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,CAAM;IAEvC,YAAY;IAOZ,SAAS,CAAC,mBAAmB,gBAAuB;IAEpD,cAAc,0CAAkC;IAEhD,YAAY,IAAI,UAAU;IAC1B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAMlD,QAAQ,IAAI,kBAAkB;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAKtD,kBAAkB;IAKlB,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,kBAAkB,GAAG,SAAS;IAQ9E,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI;IAK9C,cAAc,CACZ,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,EACnD,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,oBAAoB,KAAK,IAAI,GACzE,IAAI;IAKP,gBAAgB,CACd,MAAM,EAAE,qBAAqB,EAC7B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,EACnD,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,oBAAoB,KAAK,IAAI,GACzE,UAAU;IA+Eb,SAAS,CAAC,SAAS,CACjB,UAAU,EAAE,GAAG,EACf,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,KAAK,IAAI,GACtD,IAAI;IAiBP,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS;CAchF;AAED,yBAAiB,mBAAmB,CAAC;IAC5B,MAAM,kBAAkB,YAAY,CAAC;IACrC,MAAM,mBAAmB,aAAa,CAAC;IACvC,MAAM,gBAAgB,UAAU,CAAC;CACzC"}