@difizen/libro-lab 0.0.2-alpha.0 → 0.1.1

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 (124) hide show
  1. package/es/common/icon.d.ts +14 -0
  2. package/es/common/icon.d.ts.map +1 -0
  3. package/es/common/icon.js +368 -0
  4. package/es/common/index.d.ts +2 -0
  5. package/es/common/index.d.ts.map +1 -0
  6. package/es/common/index.js +1 -0
  7. package/es/common/index.less +8 -0
  8. package/es/github-link/index.d.ts +9 -0
  9. package/es/github-link/index.d.ts.map +1 -0
  10. package/es/github-link/index.js +43 -0
  11. package/es/index.d.ts +1 -1
  12. package/es/index.d.ts.map +1 -1
  13. package/es/index.js +1 -0
  14. package/es/index.less +78 -0
  15. package/es/kernel-manager/index.d.ts +8 -0
  16. package/es/kernel-manager/index.d.ts.map +1 -0
  17. package/es/kernel-manager/index.js +40 -0
  18. package/es/lab-app.d.ts +15 -0
  19. package/es/lab-app.d.ts.map +1 -0
  20. package/es/lab-app.js +126 -0
  21. package/es/layout/brand/index.d.ts +8 -0
  22. package/es/layout/brand/index.d.ts.map +1 -0
  23. package/es/layout/brand/index.js +46 -0
  24. package/es/layout/brand/index.less +16 -0
  25. package/es/layout/container.d.ts +8 -0
  26. package/es/layout/container.d.ts.map +1 -0
  27. package/es/layout/container.js +54 -0
  28. package/es/layout/footer/current-file-footer-view.d.ts +10 -0
  29. package/es/layout/footer/current-file-footer-view.d.ts.map +1 -0
  30. package/es/layout/footer/current-file-footer-view.js +62 -0
  31. package/es/layout/footer/footer-view.d.ts +11 -0
  32. package/es/layout/footer/footer-view.d.ts.map +1 -0
  33. package/es/layout/footer/footer-view.js +60 -0
  34. package/es/layout/footer/index.less +20 -0
  35. package/es/layout/footer/status-footer-view.d.ts +10 -0
  36. package/es/layout/footer/status-footer-view.d.ts.map +1 -0
  37. package/es/layout/footer/status-footer-view.js +73 -0
  38. package/es/layout/index.d.ts +5 -0
  39. package/es/layout/index.d.ts.map +1 -0
  40. package/es/layout/index.js +4 -0
  41. package/es/layout/index.less +59 -0
  42. package/es/layout/layout-service.d.ts +15 -0
  43. package/es/layout/layout-service.d.ts.map +1 -0
  44. package/es/layout/layout-service.js +104 -0
  45. package/es/layout/layout.d.ts +12 -0
  46. package/es/layout/layout.d.ts.map +1 -0
  47. package/es/layout/layout.js +92 -0
  48. package/es/layout/main.d.ts +8 -0
  49. package/es/layout/main.d.ts.map +1 -0
  50. package/es/layout/main.js +79 -0
  51. package/es/layout/module.d.ts +3 -0
  52. package/es/layout/module.d.ts.map +1 -0
  53. package/es/layout/module.js +45 -0
  54. package/es/layout/protocol.d.ts +18 -0
  55. package/es/layout/protocol.d.ts.map +1 -0
  56. package/es/layout/protocol.js +10 -0
  57. package/es/layout/saveable-tab-view.d.ts +7 -0
  58. package/es/layout/saveable-tab-view.d.ts.map +1 -0
  59. package/es/layout/saveable-tab-view.js +77 -0
  60. package/es/menu/menu-bar-view.d.ts +9 -0
  61. package/es/menu/menu-bar-view.d.ts.map +1 -0
  62. package/es/menu/menu-bar-view.js +49 -0
  63. package/es/menu/menu-command.d.ts +139 -0
  64. package/es/menu/menu-command.d.ts.map +1 -0
  65. package/es/menu/menu-command.js +138 -0
  66. package/es/menu/menu-contribution.d.ts +18 -0
  67. package/es/menu/menu-contribution.d.ts.map +1 -0
  68. package/es/menu/menu-contribution.js +991 -0
  69. package/es/menu/module.d.ts +3 -0
  70. package/es/menu/module.d.ts.map +1 -0
  71. package/es/menu/module.js +7 -0
  72. package/es/module.d.ts +4 -0
  73. package/es/module.d.ts.map +1 -0
  74. package/es/module.js +57 -0
  75. package/es/toc/index.less +25 -0
  76. package/es/toc/libro-toc-panel-view.d.ts +18 -0
  77. package/es/toc/libro-toc-panel-view.d.ts.map +1 -0
  78. package/es/toc/libro-toc-panel-view.js +104 -0
  79. package/es/toc/module.d.ts +3 -0
  80. package/es/toc/module.d.ts.map +1 -0
  81. package/es/toc/module.js +13 -0
  82. package/es/welcome/entry-point-view.d.ts +8 -0
  83. package/es/welcome/entry-point-view.d.ts.map +1 -0
  84. package/es/welcome/entry-point-view.js +200 -0
  85. package/es/welcome/index.d.ts +13 -0
  86. package/es/welcome/index.d.ts.map +1 -0
  87. package/es/welcome/index.js +75 -0
  88. package/es/welcome/index.less +122 -0
  89. package/package.json +10 -3
  90. package/src/common/icon.tsx +300 -0
  91. package/src/common/index.less +8 -0
  92. package/src/common/index.tsx +1 -0
  93. package/src/github-link/index.tsx +27 -0
  94. package/src/index.less +78 -0
  95. package/src/index.spec.ts +10 -0
  96. package/src/index.ts +1 -0
  97. package/src/kernel-manager/index.tsx +22 -0
  98. package/src/lab-app.ts +61 -0
  99. package/src/layout/brand/index.less +16 -0
  100. package/src/layout/brand/index.tsx +22 -0
  101. package/src/layout/container.tsx +28 -0
  102. package/src/layout/footer/current-file-footer-view.tsx +40 -0
  103. package/src/layout/footer/footer-view.tsx +30 -0
  104. package/src/layout/footer/index.less +20 -0
  105. package/src/layout/footer/status-footer-view.tsx +45 -0
  106. package/src/layout/index.less +59 -0
  107. package/src/layout/index.tsx +4 -0
  108. package/src/layout/layout-service.ts +66 -0
  109. package/src/layout/layout.tsx +61 -0
  110. package/src/layout/main.tsx +67 -0
  111. package/src/layout/module.ts +68 -0
  112. package/src/layout/protocol.tsx +20 -0
  113. package/src/layout/saveable-tab-view.tsx +66 -0
  114. package/src/menu/menu-bar-view.tsx +28 -0
  115. package/src/menu/menu-command.ts +138 -0
  116. package/src/menu/menu-contribution.ts +658 -0
  117. package/src/menu/module.ts +13 -0
  118. package/src/module.tsx +92 -0
  119. package/src/toc/index.less +25 -0
  120. package/src/toc/libro-toc-panel-view.tsx +88 -0
  121. package/src/toc/module.ts +21 -0
  122. package/src/welcome/entry-point-view.tsx +169 -0
  123. package/src/welcome/index.less +122 -0
  124. package/src/welcome/index.tsx +68 -0
@@ -0,0 +1,991 @@
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, _class, _class2, _descriptor, _descriptor2;
3
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ 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); }
6
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
7
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
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 _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; }
10
+ 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); } }
11
+ 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); }); }; }
12
+ 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 }); }
13
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
+ 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); } }
15
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
16
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
17
+ 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); }
18
+ 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; }
19
+ 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.'); }
20
+ import { LibroJupyterView, LibroService, NotebookCommands } from '@difizen/libro-jupyter';
21
+ import { CommandContribution, CommandRegistry, inject, MAIN_MENU_BAR, MenuContribution, singleton } from '@difizen/mana-app';
22
+ import { MenuCommands } from "./menu-command.js";
23
+ export var HeaderMenus;
24
+ (function (_HeaderMenus) {
25
+ var FILE = _HeaderMenus.FILE = [].concat(_toConsumableArray(MAIN_MENU_BAR), ['1_file']);
26
+ var EDIT = _HeaderMenus.EDIT = [].concat(_toConsumableArray(MAIN_MENU_BAR), ['2_edit']);
27
+ var VIEW = _HeaderMenus.VIEW = [].concat(_toConsumableArray(MAIN_MENU_BAR), ['3_view']);
28
+ var RUN = _HeaderMenus.RUN = [].concat(_toConsumableArray(MAIN_MENU_BAR), ['4_run']);
29
+ var TERMINAL = _HeaderMenus.TERMINAL = [].concat(_toConsumableArray(MAIN_MENU_BAR), ['5_terminal']);
30
+ var HELP = _HeaderMenus.HELP = [].concat(_toConsumableArray(MAIN_MENU_BAR), ['6_help']);
31
+ })(HeaderMenus || (HeaderMenus = {}));
32
+ export var HeaderMenu = (_dec = singleton({
33
+ contrib: [MenuContribution, CommandContribution]
34
+ }), _dec2 = inject(CommandRegistry), _dec3 = inject(LibroService), _dec(_class = (_class2 = /*#__PURE__*/function () {
35
+ function HeaderMenu() {
36
+ _classCallCheck(this, HeaderMenu);
37
+ _initializerDefineProperty(this, "commandRegistry", _descriptor, this);
38
+ _initializerDefineProperty(this, "libroService", _descriptor2, this);
39
+ }
40
+ _createClass(HeaderMenu, [{
41
+ key: "registerMenus",
42
+ value: function registerMenus(menu) {
43
+ menu.registerSubmenu(HeaderMenus.FILE, {
44
+ label: '文件'
45
+ });
46
+ menu.registerSubmenu(HeaderMenus.EDIT, {
47
+ label: '编辑'
48
+ });
49
+ menu.registerSubmenu(HeaderMenus.VIEW, {
50
+ label: '视图'
51
+ });
52
+ menu.registerSubmenu(HeaderMenus.RUN, {
53
+ label: '运行'
54
+ });
55
+ menu.registerSubmenu(HeaderMenus.TERMINAL, {
56
+ label: '终端'
57
+ });
58
+ menu.registerSubmenu(HeaderMenus.HELP, {
59
+ label: '帮助'
60
+ });
61
+ menu.registerMenuAction(HeaderMenus.TERMINAL, {
62
+ id: MenuCommands.OpenTerminal.id,
63
+ command: MenuCommands.OpenTerminal.id,
64
+ label: MenuCommands.OpenTerminal.label
65
+ });
66
+ menu.registerMenuAction(HeaderMenus.HELP, {
67
+ id: MenuCommands.About.id,
68
+ command: MenuCommands.About.id,
69
+ label: MenuCommands.About.label
70
+ });
71
+ menu.registerMenuAction(HeaderMenus.FILE, {
72
+ id: MenuCommands.Save.id,
73
+ command: MenuCommands.Save.id,
74
+ label: MenuCommands.Save.label
75
+ });
76
+ menu.registerMenuAction(HeaderMenus.FILE, {
77
+ id: MenuCommands.CreateFile.id,
78
+ command: MenuCommands.CreateFile.id,
79
+ label: MenuCommands.CreateFile.label
80
+ });
81
+ menu.registerMenuAction(HeaderMenus.EDIT, {
82
+ id: MenuCommands.UndoCellAction.id,
83
+ command: MenuCommands.UndoCellAction.id,
84
+ label: MenuCommands.UndoCellAction.label
85
+ });
86
+ menu.registerMenuAction(HeaderMenus.EDIT, {
87
+ id: MenuCommands.RedoCellAction.id,
88
+ command: MenuCommands.RedoCellAction.id,
89
+ label: MenuCommands.RedoCellAction.label
90
+ });
91
+ menu.registerMenuAction(HeaderMenus.EDIT, {
92
+ id: MenuCommands.CutCell.id,
93
+ command: MenuCommands.CutCell.id,
94
+ label: MenuCommands.CutCell.label
95
+ });
96
+ menu.registerMenuAction(HeaderMenus.EDIT, {
97
+ id: MenuCommands.CopyCell.id,
98
+ command: MenuCommands.CopyCell.id,
99
+ label: MenuCommands.CopyCell.label
100
+ });
101
+ menu.registerMenuAction(HeaderMenus.EDIT, {
102
+ id: MenuCommands.PasteCellBelow.id,
103
+ command: MenuCommands.PasteCellBelow.id,
104
+ label: MenuCommands.PasteCellBelow.label
105
+ });
106
+ menu.registerMenuAction(HeaderMenus.EDIT, {
107
+ id: MenuCommands.PasteCellAbove.id,
108
+ command: MenuCommands.PasteCellAbove.id,
109
+ label: MenuCommands.PasteCellAbove.label
110
+ });
111
+ menu.registerMenuAction(HeaderMenus.EDIT, {
112
+ id: MenuCommands.PasteAndReplaceCell.id,
113
+ command: MenuCommands.PasteAndReplaceCell.id,
114
+ label: MenuCommands.PasteAndReplaceCell.label
115
+ });
116
+ menu.registerMenuAction(HeaderMenus.EDIT, {
117
+ id: MenuCommands.DeleteCell.id,
118
+ command: MenuCommands.DeleteCell.id,
119
+ label: MenuCommands.DeleteCell.label
120
+ });
121
+ menu.registerMenuAction(HeaderMenus.EDIT, {
122
+ id: MenuCommands.SelectAll.id,
123
+ command: MenuCommands.SelectAll.id,
124
+ label: MenuCommands.SelectAll.label
125
+ });
126
+ // menu.registerMenuAction(HeaderMenus.EDIT, {
127
+ // id: MenuCommands.DeselectAll.id,
128
+ // command: MenuCommands.DeselectAll.id,
129
+ // label: MenuCommands.DeselectAll.label,
130
+ // });
131
+ menu.registerMenuAction(HeaderMenus.EDIT, {
132
+ id: MenuCommands.MoveCellUp.id,
133
+ command: MenuCommands.MoveCellUp.id,
134
+ label: MenuCommands.MoveCellUp.label
135
+ });
136
+ menu.registerMenuAction(HeaderMenus.EDIT, {
137
+ id: MenuCommands.MoveCellDown.id,
138
+ command: MenuCommands.MoveCellDown.id,
139
+ label: MenuCommands.MoveCellDown.label
140
+ });
141
+ menu.registerMenuAction(HeaderMenus.EDIT, {
142
+ id: MenuCommands.SplitCellAntCursor.id,
143
+ command: MenuCommands.SplitCellAntCursor.id,
144
+ label: MenuCommands.SplitCellAntCursor.label
145
+ });
146
+ menu.registerMenuAction(HeaderMenus.EDIT, {
147
+ id: MenuCommands.MergeCells.id,
148
+ command: MenuCommands.MergeCells.id,
149
+ label: MenuCommands.MergeCells.label
150
+ });
151
+ menu.registerMenuAction(HeaderMenus.EDIT, {
152
+ id: MenuCommands.MergeCellAbove.id,
153
+ command: MenuCommands.MergeCellAbove.id,
154
+ label: MenuCommands.MergeCellAbove.label
155
+ });
156
+ menu.registerMenuAction(HeaderMenus.EDIT, {
157
+ id: MenuCommands.MergeCellBelow.id,
158
+ command: MenuCommands.MergeCellBelow.id,
159
+ label: MenuCommands.MergeCellBelow.label
160
+ });
161
+ menu.registerMenuAction(HeaderMenus.EDIT, {
162
+ id: MenuCommands.ClearCellOutput.id,
163
+ command: MenuCommands.ClearCellOutput.id,
164
+ label: MenuCommands.ClearCellOutput.label
165
+ });
166
+ menu.registerMenuAction(HeaderMenus.EDIT, {
167
+ id: MenuCommands.ClearAllCellOutput.id,
168
+ command: MenuCommands.ClearAllCellOutput.id,
169
+ label: MenuCommands.ClearAllCellOutput.label
170
+ });
171
+ menu.registerMenuAction(HeaderMenus.VIEW, {
172
+ id: MenuCommands.HideOrShowCellCode.id,
173
+ command: MenuCommands.HideOrShowCellCode.id,
174
+ label: MenuCommands.HideOrShowCellCode.label
175
+ });
176
+ menu.registerMenuAction(HeaderMenus.VIEW, {
177
+ id: MenuCommands.HideOrShowOutputs.id,
178
+ command: MenuCommands.HideOrShowOutputs.id,
179
+ label: MenuCommands.HideOrShowOutputs.label
180
+ });
181
+ menu.registerMenuAction(HeaderMenus.VIEW, {
182
+ id: MenuCommands.EnableOutputScrolling.id,
183
+ command: MenuCommands.EnableOutputScrolling.id,
184
+ label: MenuCommands.EnableOutputScrolling.label
185
+ });
186
+ menu.registerMenuAction(HeaderMenus.VIEW, {
187
+ id: MenuCommands.DisableOutputScrolling.id,
188
+ command: MenuCommands.DisableOutputScrolling.id,
189
+ label: MenuCommands.DisableOutputScrolling.label
190
+ });
191
+ menu.registerMenuAction(HeaderMenus.RUN, {
192
+ id: MenuCommands.RunCell.id,
193
+ command: MenuCommands.RunCell.id,
194
+ label: MenuCommands.RunCell.label
195
+ });
196
+ menu.registerMenuAction(HeaderMenus.RUN, {
197
+ id: MenuCommands.RunAllAbove.id,
198
+ command: MenuCommands.RunAllAbove.id,
199
+ label: MenuCommands.RunAllAbove.label
200
+ });
201
+ menu.registerMenuAction(HeaderMenus.RUN, {
202
+ id: MenuCommands.RunAllBelow.id,
203
+ command: MenuCommands.RunAllBelow.id,
204
+ label: MenuCommands.RunAllBelow.label
205
+ });
206
+ menu.registerMenuAction(HeaderMenus.RUN, {
207
+ id: MenuCommands.RunAllCells.id,
208
+ command: MenuCommands.RunAllCells.id,
209
+ label: MenuCommands.RunAllCells.label
210
+ });
211
+ menu.registerMenuAction(HeaderMenus.RUN, {
212
+ id: MenuCommands.RunCellAndSelectNext.id,
213
+ command: MenuCommands.RunCellAndSelectNext.id,
214
+ label: MenuCommands.RunCellAndSelectNext.label
215
+ });
216
+ menu.registerMenuAction(HeaderMenus.RUN, {
217
+ id: MenuCommands.RunCellAndInsertBelow.id,
218
+ command: MenuCommands.RunCellAndInsertBelow.id,
219
+ label: MenuCommands.RunCellAndInsertBelow.label
220
+ });
221
+ menu.registerMenuAction(HeaderMenus.RUN, {
222
+ id: MenuCommands.RestartRunAll.id,
223
+ command: MenuCommands.RestartRunAll.id,
224
+ label: MenuCommands.RestartRunAll.label
225
+ });
226
+ menu.registerMenuAction(HeaderMenus.RUN, {
227
+ id: MenuCommands.RestartAndRunToSelected.id,
228
+ command: MenuCommands.RestartAndRunToSelected.id,
229
+ label: MenuCommands.RestartAndRunToSelected.label
230
+ });
231
+ }
232
+ }, {
233
+ key: "registerCommands",
234
+ value: function registerCommands(commands) {
235
+ var _this = this;
236
+ commands.registerCommand(MenuCommands.OpenTerminal, {
237
+ execute: function execute() {
238
+ //TODO: 增加终端
239
+ }
240
+ });
241
+ commands.registerCommand(MenuCommands.About, {
242
+ execute: function () {
243
+ var _execute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
244
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
245
+ while (1) switch (_context.prev = _context.next) {
246
+ case 0:
247
+ case "end":
248
+ return _context.stop();
249
+ }
250
+ }, _callee);
251
+ }));
252
+ function execute() {
253
+ return _execute.apply(this, arguments);
254
+ }
255
+ return execute;
256
+ }()
257
+ });
258
+ commands.registerCommand(MenuCommands.Save, {
259
+ execute: function () {
260
+ var _execute2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
261
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
262
+ while (1) switch (_context2.prev = _context2.next) {
263
+ case 0:
264
+ case "end":
265
+ return _context2.stop();
266
+ }
267
+ }, _callee2);
268
+ }));
269
+ function execute() {
270
+ return _execute2.apply(this, arguments);
271
+ }
272
+ return execute;
273
+ }()
274
+ });
275
+ commands.registerCommand(MenuCommands.UndoCellAction, {
276
+ execute: function () {
277
+ var _execute3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
278
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
279
+ while (1) switch (_context3.prev = _context3.next) {
280
+ case 0:
281
+ if (_this.libroService.active) {
282
+ _this.commandRegistry.executeCommand(NotebookCommands['UndoCellAction'].id, _this.libroService.active.activeCell, _this.libroService.active);
283
+ }
284
+ case 1:
285
+ case "end":
286
+ return _context3.stop();
287
+ }
288
+ }, _callee3);
289
+ }));
290
+ function execute() {
291
+ return _execute3.apply(this, arguments);
292
+ }
293
+ return execute;
294
+ }()
295
+ });
296
+ commands.registerCommand(MenuCommands.RedoCellAction, {
297
+ execute: function () {
298
+ var _execute4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
299
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
300
+ while (1) switch (_context4.prev = _context4.next) {
301
+ case 0:
302
+ if (_this.libroService.active) {
303
+ _this.commandRegistry.executeCommand(NotebookCommands['RedoCellAction'].id, _this.libroService.active.activeCell, _this.libroService.active);
304
+ }
305
+ case 1:
306
+ case "end":
307
+ return _context4.stop();
308
+ }
309
+ }, _callee4);
310
+ }));
311
+ function execute() {
312
+ return _execute4.apply(this, arguments);
313
+ }
314
+ return execute;
315
+ }()
316
+ });
317
+ commands.registerCommand(MenuCommands.CutCell, {
318
+ execute: function () {
319
+ var _execute5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
320
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
321
+ while (1) switch (_context5.prev = _context5.next) {
322
+ case 0:
323
+ if (_this.libroService.active) {
324
+ _this.commandRegistry.executeCommand(NotebookCommands['CutCell'].id, _this.libroService.active.activeCell, _this.libroService.active);
325
+ }
326
+ case 1:
327
+ case "end":
328
+ return _context5.stop();
329
+ }
330
+ }, _callee5);
331
+ }));
332
+ function execute() {
333
+ return _execute5.apply(this, arguments);
334
+ }
335
+ return execute;
336
+ }()
337
+ });
338
+ commands.registerCommand(MenuCommands.CopyCell, {
339
+ execute: function () {
340
+ var _execute6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
341
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
342
+ while (1) switch (_context6.prev = _context6.next) {
343
+ case 0:
344
+ if (_this.libroService.active) {
345
+ _this.commandRegistry.executeCommand(NotebookCommands['CopyCell'].id, _this.libroService.active.activeCell, _this.libroService.active);
346
+ }
347
+ case 1:
348
+ case "end":
349
+ return _context6.stop();
350
+ }
351
+ }, _callee6);
352
+ }));
353
+ function execute() {
354
+ return _execute6.apply(this, arguments);
355
+ }
356
+ return execute;
357
+ }()
358
+ });
359
+ commands.registerCommand(MenuCommands.DeleteCell, {
360
+ execute: function () {
361
+ var _execute7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
362
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
363
+ while (1) switch (_context7.prev = _context7.next) {
364
+ case 0:
365
+ if (_this.libroService.active) {
366
+ _this.commandRegistry.executeCommand(NotebookCommands['DeleteCell'].id, _this.libroService.active.activeCell, _this.libroService.active);
367
+ }
368
+ case 1:
369
+ case "end":
370
+ return _context7.stop();
371
+ }
372
+ }, _callee7);
373
+ }));
374
+ function execute() {
375
+ return _execute7.apply(this, arguments);
376
+ }
377
+ return execute;
378
+ }()
379
+ });
380
+ commands.registerCommand(MenuCommands.PasteCellBelow, {
381
+ execute: function () {
382
+ var _execute8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
383
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
384
+ while (1) switch (_context8.prev = _context8.next) {
385
+ case 0:
386
+ if (_this.libroService.active) {
387
+ _this.commandRegistry.executeCommand(NotebookCommands['PasteCellBelow'].id, _this.libroService.active.activeCell, _this.libroService.active);
388
+ }
389
+ case 1:
390
+ case "end":
391
+ return _context8.stop();
392
+ }
393
+ }, _callee8);
394
+ }));
395
+ function execute() {
396
+ return _execute8.apply(this, arguments);
397
+ }
398
+ return execute;
399
+ }()
400
+ });
401
+ commands.registerCommand(MenuCommands.PasteCellAbove, {
402
+ execute: function () {
403
+ var _execute9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
404
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
405
+ while (1) switch (_context9.prev = _context9.next) {
406
+ case 0:
407
+ if (_this.libroService.active) {
408
+ _this.commandRegistry.executeCommand(NotebookCommands['PasteCellAbove'].id, _this.libroService.active.activeCell, _this.libroService.active);
409
+ }
410
+ case 1:
411
+ case "end":
412
+ return _context9.stop();
413
+ }
414
+ }, _callee9);
415
+ }));
416
+ function execute() {
417
+ return _execute9.apply(this, arguments);
418
+ }
419
+ return execute;
420
+ }()
421
+ });
422
+ commands.registerCommand(MenuCommands.PasteAndReplaceCell, {
423
+ execute: function () {
424
+ var _execute10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
425
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
426
+ while (1) switch (_context10.prev = _context10.next) {
427
+ case 0:
428
+ if (_this.libroService.active) {
429
+ _this.commandRegistry.executeCommand(NotebookCommands['PasteAndReplaceCell'].id, _this.libroService.active.activeCell, _this.libroService.active);
430
+ }
431
+ case 1:
432
+ case "end":
433
+ return _context10.stop();
434
+ }
435
+ }, _callee10);
436
+ }));
437
+ function execute() {
438
+ return _execute10.apply(this, arguments);
439
+ }
440
+ return execute;
441
+ }()
442
+ });
443
+ commands.registerCommand(MenuCommands.SelectAll, {
444
+ execute: function () {
445
+ var _execute11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
446
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
447
+ while (1) switch (_context11.prev = _context11.next) {
448
+ case 0:
449
+ if (_this.libroService.active) {
450
+ _this.commandRegistry.executeCommand(NotebookCommands['SelectAll'].id, _this.libroService.active.activeCell, _this.libroService.active);
451
+ }
452
+ case 1:
453
+ case "end":
454
+ return _context11.stop();
455
+ }
456
+ }, _callee11);
457
+ }));
458
+ function execute() {
459
+ return _execute11.apply(this, arguments);
460
+ }
461
+ return execute;
462
+ }()
463
+ });
464
+ // commands.registerCommand(MenuCommands.DeselectAll, {
465
+ // execute: async () => {
466
+ // if (this.libroService.active)
467
+ // this.commandRegistry.executeCommand(
468
+ // NotebookCommands.DeselectAll.id,
469
+ // this.libroService.active.activeCell,
470
+ // this.libroService.active,
471
+ // );
472
+ // },
473
+ // });
474
+ commands.registerCommand(MenuCommands.MoveCellUp, {
475
+ execute: function () {
476
+ var _execute12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
477
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
478
+ while (1) switch (_context12.prev = _context12.next) {
479
+ case 0:
480
+ if (_this.libroService.active) {
481
+ _this.commandRegistry.executeCommand(NotebookCommands['MoveCellUp'].id, _this.libroService.active.activeCell, _this.libroService.active);
482
+ }
483
+ case 1:
484
+ case "end":
485
+ return _context12.stop();
486
+ }
487
+ }, _callee12);
488
+ }));
489
+ function execute() {
490
+ return _execute12.apply(this, arguments);
491
+ }
492
+ return execute;
493
+ }()
494
+ });
495
+ commands.registerCommand(MenuCommands.MoveCellDown, {
496
+ execute: function () {
497
+ var _execute13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
498
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
499
+ while (1) switch (_context13.prev = _context13.next) {
500
+ case 0:
501
+ if (_this.libroService.active) {
502
+ _this.commandRegistry.executeCommand(NotebookCommands['MoveCellDown'].id, _this.libroService.active.activeCell, _this.libroService.active);
503
+ }
504
+ case 1:
505
+ case "end":
506
+ return _context13.stop();
507
+ }
508
+ }, _callee13);
509
+ }));
510
+ function execute() {
511
+ return _execute13.apply(this, arguments);
512
+ }
513
+ return execute;
514
+ }()
515
+ });
516
+ commands.registerCommand(MenuCommands.SplitCellAntCursor, {
517
+ execute: function () {
518
+ var _execute14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
519
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
520
+ while (1) switch (_context14.prev = _context14.next) {
521
+ case 0:
522
+ if (_this.libroService.active) {
523
+ _this.commandRegistry.executeCommand(NotebookCommands['SplitCellAntCursor'].id, _this.libroService.active.activeCell, _this.libroService.active);
524
+ }
525
+ case 1:
526
+ case "end":
527
+ return _context14.stop();
528
+ }
529
+ }, _callee14);
530
+ }));
531
+ function execute() {
532
+ return _execute14.apply(this, arguments);
533
+ }
534
+ return execute;
535
+ }()
536
+ });
537
+ commands.registerCommand(MenuCommands.MergeCells, {
538
+ execute: function () {
539
+ var _execute15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
540
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
541
+ while (1) switch (_context15.prev = _context15.next) {
542
+ case 0:
543
+ if (_this.libroService.active) {
544
+ _this.commandRegistry.executeCommand(NotebookCommands['MergeCells'].id, _this.libroService.active.activeCell, _this.libroService.active);
545
+ }
546
+ case 1:
547
+ case "end":
548
+ return _context15.stop();
549
+ }
550
+ }, _callee15);
551
+ }));
552
+ function execute() {
553
+ return _execute15.apply(this, arguments);
554
+ }
555
+ return execute;
556
+ }()
557
+ });
558
+ commands.registerCommand(MenuCommands.MergeCellAbove, {
559
+ execute: function () {
560
+ var _execute16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
561
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
562
+ while (1) switch (_context16.prev = _context16.next) {
563
+ case 0:
564
+ if (_this.libroService.active) {
565
+ _this.commandRegistry.executeCommand(NotebookCommands['MergeCellAbove'].id, _this.libroService.active.activeCell, _this.libroService.active);
566
+ }
567
+ case 1:
568
+ case "end":
569
+ return _context16.stop();
570
+ }
571
+ }, _callee16);
572
+ }));
573
+ function execute() {
574
+ return _execute16.apply(this, arguments);
575
+ }
576
+ return execute;
577
+ }()
578
+ });
579
+ commands.registerCommand(MenuCommands.MergeCellBelow, {
580
+ execute: function () {
581
+ var _execute17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
582
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
583
+ while (1) switch (_context17.prev = _context17.next) {
584
+ case 0:
585
+ if (_this.libroService.active) {
586
+ _this.commandRegistry.executeCommand(NotebookCommands['MergeCellBelow'].id, _this.libroService.active.activeCell, _this.libroService.active);
587
+ }
588
+ case 1:
589
+ case "end":
590
+ return _context17.stop();
591
+ }
592
+ }, _callee17);
593
+ }));
594
+ function execute() {
595
+ return _execute17.apply(this, arguments);
596
+ }
597
+ return execute;
598
+ }()
599
+ });
600
+ commands.registerCommand(MenuCommands.ClearCellOutput, {
601
+ execute: function () {
602
+ var _execute18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
603
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
604
+ while (1) switch (_context18.prev = _context18.next) {
605
+ case 0:
606
+ if (_this.libroService.active) {
607
+ _this.commandRegistry.executeCommand(NotebookCommands['ClearCellOutput'].id, _this.libroService.active.activeCell, _this.libroService.active);
608
+ }
609
+ case 1:
610
+ case "end":
611
+ return _context18.stop();
612
+ }
613
+ }, _callee18);
614
+ }));
615
+ function execute() {
616
+ return _execute18.apply(this, arguments);
617
+ }
618
+ return execute;
619
+ }()
620
+ });
621
+ commands.registerCommand(MenuCommands.ClearAllCellOutput, {
622
+ execute: function () {
623
+ var _execute19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
624
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
625
+ while (1) switch (_context19.prev = _context19.next) {
626
+ case 0:
627
+ if (_this.libroService.active) {
628
+ _this.commandRegistry.executeCommand(NotebookCommands['ClearAllCellOutput'].id, _this.libroService.active.activeCell, _this.libroService.active);
629
+ }
630
+ case 1:
631
+ case "end":
632
+ return _context19.stop();
633
+ }
634
+ }, _callee19);
635
+ }));
636
+ function execute() {
637
+ return _execute19.apply(this, arguments);
638
+ }
639
+ return execute;
640
+ }()
641
+ });
642
+ commands.registerCommand(MenuCommands.HideOrShowCellCode, {
643
+ execute: function () {
644
+ var _execute20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
645
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
646
+ while (1) switch (_context20.prev = _context20.next) {
647
+ case 0:
648
+ if (_this.libroService.active) {
649
+ _this.commandRegistry.executeCommand(NotebookCommands['HideOrShowCellCode'].id, _this.libroService.active.activeCell, _this.libroService.active);
650
+ }
651
+ case 1:
652
+ case "end":
653
+ return _context20.stop();
654
+ }
655
+ }, _callee20);
656
+ }));
657
+ function execute() {
658
+ return _execute20.apply(this, arguments);
659
+ }
660
+ return execute;
661
+ }()
662
+ });
663
+ commands.registerCommand(MenuCommands.HideOrShowOutputs, {
664
+ execute: function () {
665
+ var _execute21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
666
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
667
+ while (1) switch (_context21.prev = _context21.next) {
668
+ case 0:
669
+ if (_this.libroService.active) {
670
+ _this.commandRegistry.executeCommand(NotebookCommands['HideOrShowOutputs'].id, _this.libroService.active.activeCell, _this.libroService.active);
671
+ }
672
+ case 1:
673
+ case "end":
674
+ return _context21.stop();
675
+ }
676
+ }, _callee21);
677
+ }));
678
+ function execute() {
679
+ return _execute21.apply(this, arguments);
680
+ }
681
+ return execute;
682
+ }()
683
+ });
684
+ commands.registerCommand(MenuCommands.EnableOutputScrolling, {
685
+ execute: function () {
686
+ var _execute22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
687
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
688
+ while (1) switch (_context22.prev = _context22.next) {
689
+ case 0:
690
+ if (_this.libroService.active) {
691
+ _this.commandRegistry.executeCommand(NotebookCommands['EnableOutputScrolling'].id, _this.libroService.active.activeCell, _this.libroService.active);
692
+ }
693
+ case 1:
694
+ case "end":
695
+ return _context22.stop();
696
+ }
697
+ }, _callee22);
698
+ }));
699
+ function execute() {
700
+ return _execute22.apply(this, arguments);
701
+ }
702
+ return execute;
703
+ }()
704
+ });
705
+ commands.registerCommand(MenuCommands.DisableOutputScrolling, {
706
+ execute: function () {
707
+ var _execute23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
708
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
709
+ while (1) switch (_context23.prev = _context23.next) {
710
+ case 0:
711
+ if (_this.libroService.active) {
712
+ _this.commandRegistry.executeCommand(NotebookCommands['DisableOutputScrolling'].id, _this.libroService.active.activeCell, _this.libroService.active);
713
+ }
714
+ case 1:
715
+ case "end":
716
+ return _context23.stop();
717
+ }
718
+ }, _callee23);
719
+ }));
720
+ function execute() {
721
+ return _execute23.apply(this, arguments);
722
+ }
723
+ return execute;
724
+ }()
725
+ });
726
+ commands.registerCommandWithContext(MenuCommands.RunCell, this, {
727
+ execute: function () {
728
+ var _execute24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(ctx) {
729
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
730
+ while (1) switch (_context24.prev = _context24.next) {
731
+ case 0:
732
+ if (ctx.libroService.active) {
733
+ ctx.commandRegistry.executeCommand(NotebookCommands['RunCell'].id, ctx.libroService.active.activeCell, ctx.libroService.active);
734
+ }
735
+ case 1:
736
+ case "end":
737
+ return _context24.stop();
738
+ }
739
+ }, _callee24);
740
+ }));
741
+ function execute(_x) {
742
+ return _execute24.apply(this, arguments);
743
+ }
744
+ return execute;
745
+ }(),
746
+ isEnabled: function isEnabled(ctx) {
747
+ var libro = ctx.libroService.active;
748
+ if (!libro || !(libro instanceof LibroJupyterView)) {
749
+ return false;
750
+ }
751
+ return libro.model.kernelConnection !== undefined && libro.model.kernelConnecting === false;
752
+ }
753
+ });
754
+ commands.registerCommandWithContext(MenuCommands.RunAllAbove, this, {
755
+ execute: function () {
756
+ var _execute25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(ctx) {
757
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
758
+ while (1) switch (_context25.prev = _context25.next) {
759
+ case 0:
760
+ if (ctx.libroService.active) {
761
+ ctx.commandRegistry.executeCommand(NotebookCommands['RunAllAbove'].id, ctx.libroService.active.activeCell, ctx.libroService.active);
762
+ }
763
+ case 1:
764
+ case "end":
765
+ return _context25.stop();
766
+ }
767
+ }, _callee25);
768
+ }));
769
+ function execute(_x2) {
770
+ return _execute25.apply(this, arguments);
771
+ }
772
+ return execute;
773
+ }(),
774
+ isEnabled: function isEnabled(ctx) {
775
+ var libro = ctx.libroService.active;
776
+ if (!libro || !(libro instanceof LibroJupyterView)) {
777
+ return false;
778
+ }
779
+ return libro.model.kernelConnection !== undefined && libro.model.kernelConnecting === false;
780
+ }
781
+ });
782
+ commands.registerCommandWithContext(MenuCommands.RunAllBelow, this, {
783
+ execute: function () {
784
+ var _execute26 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(ctx) {
785
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
786
+ while (1) switch (_context26.prev = _context26.next) {
787
+ case 0:
788
+ if (ctx.libroService.active) {
789
+ ctx.commandRegistry.executeCommand(NotebookCommands['RunAllBelow'].id, ctx.libroService.active.activeCell, ctx.libroService.active);
790
+ }
791
+ case 1:
792
+ case "end":
793
+ return _context26.stop();
794
+ }
795
+ }, _callee26);
796
+ }));
797
+ function execute(_x3) {
798
+ return _execute26.apply(this, arguments);
799
+ }
800
+ return execute;
801
+ }(),
802
+ isEnabled: function isEnabled(ctx) {
803
+ var libro = ctx.libroService.active;
804
+ if (!libro || !(libro instanceof LibroJupyterView)) {
805
+ return false;
806
+ }
807
+ return libro.model.kernelConnection !== undefined && libro.model.kernelConnecting === false;
808
+ }
809
+ });
810
+ commands.registerCommandWithContext(MenuCommands.RunAllCells, this, {
811
+ execute: function () {
812
+ var _execute27 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(ctx) {
813
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
814
+ while (1) switch (_context27.prev = _context27.next) {
815
+ case 0:
816
+ if (ctx.libroService.active) {
817
+ ctx.commandRegistry.executeCommand(NotebookCommands['RunAllCells'].id, ctx.libroService.active.activeCell, ctx.libroService.active);
818
+ }
819
+ case 1:
820
+ case "end":
821
+ return _context27.stop();
822
+ }
823
+ }, _callee27);
824
+ }));
825
+ function execute(_x4) {
826
+ return _execute27.apply(this, arguments);
827
+ }
828
+ return execute;
829
+ }(),
830
+ isEnabled: function isEnabled(ctx) {
831
+ var libro = ctx.libroService.active;
832
+ if (!libro || !(libro instanceof LibroJupyterView)) {
833
+ return false;
834
+ }
835
+ return libro.model.kernelConnection !== undefined && libro.model.kernelConnecting === false;
836
+ }
837
+ });
838
+ commands.registerCommandWithContext(MenuCommands.RunCellAndInsertBelow, this, {
839
+ execute: function () {
840
+ var _execute28 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(ctx) {
841
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
842
+ while (1) switch (_context28.prev = _context28.next) {
843
+ case 0:
844
+ if (ctx.libroService.active) {
845
+ ctx.commandRegistry.executeCommand(NotebookCommands['RunCellAndInsertBelow'].id, ctx.libroService.active.activeCell, ctx.libroService.active);
846
+ }
847
+ case 1:
848
+ case "end":
849
+ return _context28.stop();
850
+ }
851
+ }, _callee28);
852
+ }));
853
+ function execute(_x5) {
854
+ return _execute28.apply(this, arguments);
855
+ }
856
+ return execute;
857
+ }(),
858
+ isEnabled: function isEnabled(ctx) {
859
+ var libro = ctx.libroService.active;
860
+ if (!libro || !(libro instanceof LibroJupyterView)) {
861
+ return false;
862
+ }
863
+ return libro.model.kernelConnection !== undefined && libro.model.kernelConnecting === false;
864
+ }
865
+ });
866
+ commands.registerCommandWithContext(MenuCommands.RunCellAndSelectNext, this, {
867
+ execute: function () {
868
+ var _execute29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(ctx) {
869
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
870
+ while (1) switch (_context29.prev = _context29.next) {
871
+ case 0:
872
+ if (ctx.libroService.active) {
873
+ ctx.commandRegistry.executeCommand(NotebookCommands['RunCellAndSelectNext'].id, ctx.libroService.active.activeCell, ctx.libroService.active);
874
+ }
875
+ case 1:
876
+ case "end":
877
+ return _context29.stop();
878
+ }
879
+ }, _callee29);
880
+ }));
881
+ function execute(_x6) {
882
+ return _execute29.apply(this, arguments);
883
+ }
884
+ return execute;
885
+ }(),
886
+ isEnabled: function isEnabled(ctx) {
887
+ var libro = ctx.libroService.active;
888
+ if (!libro || !(libro instanceof LibroJupyterView)) {
889
+ return false;
890
+ }
891
+ return libro.model.kernelConnection !== undefined && libro.model.kernelConnecting === false;
892
+ }
893
+ });
894
+ commands.registerCommandWithContext(MenuCommands.RestartRunAll, this, {
895
+ execute: function () {
896
+ var _execute30 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(ctx) {
897
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
898
+ while (1) switch (_context30.prev = _context30.next) {
899
+ case 0:
900
+ if (ctx.libroService.active) {
901
+ _this.commandRegistry.executeCommand(NotebookCommands['RestartRunAll'].id, ctx.libroService.active.activeCell, ctx.libroService.active);
902
+ }
903
+ case 1:
904
+ case "end":
905
+ return _context30.stop();
906
+ }
907
+ }, _callee30);
908
+ }));
909
+ function execute(_x7) {
910
+ return _execute30.apply(this, arguments);
911
+ }
912
+ return execute;
913
+ }(),
914
+ isEnabled: function isEnabled(ctx) {
915
+ var libro = ctx.libroService.active;
916
+ if (!libro || !(libro instanceof LibroJupyterView)) {
917
+ return false;
918
+ }
919
+ return libro.model.kernelConnection !== undefined && libro.model.kernelConnecting === false;
920
+ }
921
+ });
922
+ commands.registerCommandWithContext(MenuCommands.RestartRunAll, this, {
923
+ execute: function () {
924
+ var _execute31 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(ctx) {
925
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
926
+ while (1) switch (_context31.prev = _context31.next) {
927
+ case 0:
928
+ if (ctx.libroService.active) {
929
+ ctx.commandRegistry.executeCommand(NotebookCommands['RestartRunAll'].id, ctx.libroService.active.activeCell, ctx.libroService.active);
930
+ }
931
+ case 1:
932
+ case "end":
933
+ return _context31.stop();
934
+ }
935
+ }, _callee31);
936
+ }));
937
+ function execute(_x8) {
938
+ return _execute31.apply(this, arguments);
939
+ }
940
+ return execute;
941
+ }(),
942
+ isEnabled: function isEnabled(ctx) {
943
+ var libro = ctx.libroService.active;
944
+ if (!libro || !(libro instanceof LibroJupyterView)) {
945
+ return false;
946
+ }
947
+ return libro.model.kernelConnection !== undefined && libro.model.kernelConnecting === false;
948
+ }
949
+ });
950
+ commands.registerCommandWithContext(MenuCommands.RestartAndRunToSelected, this, {
951
+ execute: function () {
952
+ var _execute32 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(ctx) {
953
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
954
+ while (1) switch (_context32.prev = _context32.next) {
955
+ case 0:
956
+ if (ctx.libroService.active) {
957
+ _this.commandRegistry.executeCommand(NotebookCommands['RestartAndRunToSelected'].id, ctx.libroService.active.activeCell, ctx.libroService.active);
958
+ }
959
+ case 1:
960
+ case "end":
961
+ return _context32.stop();
962
+ }
963
+ }, _callee32);
964
+ }));
965
+ function execute(_x9) {
966
+ return _execute32.apply(this, arguments);
967
+ }
968
+ return execute;
969
+ }(),
970
+ isEnabled: function isEnabled(ctx) {
971
+ var libro = ctx.libroService.active;
972
+ if (!libro || !(libro instanceof LibroJupyterView)) {
973
+ return false;
974
+ }
975
+ return libro.model.kernelConnection !== undefined && libro.model.kernelConnecting === false;
976
+ }
977
+ });
978
+ }
979
+ }]);
980
+ return HeaderMenu;
981
+ }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "commandRegistry", [_dec2], {
982
+ configurable: true,
983
+ enumerable: true,
984
+ writable: true,
985
+ initializer: null
986
+ }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "libroService", [_dec3], {
987
+ configurable: true,
988
+ enumerable: true,
989
+ writable: true,
990
+ initializer: null
991
+ })), _class2)) || _class);