@difizen/libro-lab 0.1.15 → 0.1.16

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.
@@ -1 +1 @@
1
- {"version":3,"file":"collapse-content.d.ts","sourceRoot":"","sources":["../../../src/kernel-and-terminal-panel/collapse/collapse-content.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzD,eAAO,MAAM,OAAO,SAAU,0BAA0B,4CAWvD,CAAC;AAEF,UAAU,KAAK;IACb,IAAI,EAAE,0BAA0B,CAAC;IACjC,KAAK,EAAE,sBAAsB,EAAE,CAAC;CACjC;AAED,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAsChD,CAAC"}
1
+ {"version":3,"file":"collapse-content.d.ts","sourceRoot":"","sources":["../../../src/kernel-and-terminal-panel/collapse/collapse-content.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzD,eAAO,MAAM,OAAO,SAAU,0BAA0B,4CAWvD,CAAC;AAEF,UAAU,KAAK;IACb,IAAI,EAAE,0BAA0B,CAAC;IACjC,KAAK,EAAE,sBAAsB,EAAE,CAAC;CACjC;AAED,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAyChD,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { CloseOutlined } from '@ant-design/icons';
2
2
  import { TerminalCommands } from '@difizen/libro-terminal';
3
3
  import { CommandRegistry, useInject } from '@difizen/mana-app';
4
+ import { message } from 'antd';
4
5
  import React from 'react';
5
6
  import { existedLSP, openedPage, runningKernel, runningTerminal } from "../../common/icon.js";
6
7
  import { LibroPanelCollapseItemType } from "./index.js";
@@ -42,7 +43,10 @@ export var LibroCollapseContent = function LibroCollapseContent(props) {
42
43
  e.stopPropagation();
43
44
  e.preventDefault();
44
45
  if (item.shutdown) {
45
- item.shutdown();
46
+ item.shutdown().catch(function (error) {
47
+ message.error("shutdown ".concat(props.type, " failed"));
48
+ console.error(error);
49
+ });
46
50
  }
47
51
  },
48
52
  children: /*#__PURE__*/_jsx(CloseOutlined, {})
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/kernel-and-terminal-panel/collapse/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAItD,OAAO,cAAc,CAAC;AAItB,oBAAY,0BAA0B;IACpC,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,GAAG,QAAQ;CACZ;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,4BAA6B,SAAQ,sBAAsB;IAC1E,SAAS,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAChE;AAED,UAAU,KAAK;IACb,IAAI,EAAE,0BAA0B,CAAC;IACjC,KAAK,EAAE,sBAAsB,EAAE,GAAG,SAAS,CAAC;IAC5C,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAmDD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAwCzC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/kernel-and-terminal-panel/collapse/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAItD,OAAO,cAAc,CAAC;AAItB,oBAAY,0BAA0B;IACpC,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,GAAG,QAAQ;CACZ;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,4BAA6B,SAAQ,sBAAsB;IAC1E,SAAS,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAChE;AAED,UAAU,KAAK;IACb,IAAI,EAAE,0BAA0B,CAAC;IACjC,KAAK,EAAE,sBAAsB,EAAE,GAAG,SAAS,CAAC;IAC5C,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAmDD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA2CzC,CAAC"}
@@ -6,7 +6,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import { CaretDownOutlined, CaretRightOutlined } from '@ant-design/icons';
8
8
  import { ViewContext } from '@difizen/mana-app';
9
- import { Empty, Popconfirm } from 'antd';
9
+ import { Empty, message, Popconfirm } from 'antd';
10
10
  import React, { useState } from 'react';
11
11
  import { LibroCollapseContent } from "./collapse-content.js";
12
12
  import "./index.less";
@@ -89,7 +89,10 @@ export var LibroCollapse = function LibroCollapse(props) {
89
89
  cancelText: "\u53D6\u6D88",
90
90
  onConfirm: function onConfirm() {
91
91
  if (props.shutdownAll) {
92
- props.shutdownAll();
92
+ props.shutdownAll().catch(function (e) {
93
+ message.error("shutdown all ".concat(props.type, "s error"));
94
+ console.error(e);
95
+ });
93
96
  }
94
97
  },
95
98
  children: "\u5173\u95ED\u5168\u90E8"
@@ -1 +1 @@
1
- {"version":3,"file":"kernel-collapse-content-item.d.ts","sourceRoot":"","sources":["../../../src/kernel-and-terminal-panel/collapse/kernel-collapse-content-item.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAE/D,UAAU,KAAK;IACb,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAED,eAAO,MAAM,8BAA8B,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAsE1D,CAAC"}
1
+ {"version":3,"file":"kernel-collapse-content-item.d.ts","sourceRoot":"","sources":["../../../src/kernel-and-terminal-panel/collapse/kernel-collapse-content-item.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAE/D,UAAU,KAAK;IACb,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAED,eAAO,MAAM,8BAA8B,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAwE1D,CAAC"}
@@ -1,3 +1,7 @@
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); }); }; }
1
5
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
6
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
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); }
@@ -35,13 +39,28 @@ export var LibroKernelCollapseContentItem = function LibroKernelCollapseContentI
35
39
  children: item.name
36
40
  }), /*#__PURE__*/_jsx("div", {
37
41
  className: "libro-panel-collapse-item-close",
38
- onClick: function onClick(e) {
39
- if (item.shutdown) {
40
- item.shutdown();
41
- }
42
- e.preventDefault();
43
- e.stopPropagation();
44
- },
42
+ onClick: ( /*#__PURE__*/function () {
43
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
44
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
45
+ while (1) switch (_context.prev = _context.next) {
46
+ case 0:
47
+ if (item.shutdown) {
48
+ item.shutdown().catch(function (error) {
49
+ console.error(error);
50
+ });
51
+ }
52
+ e.preventDefault();
53
+ e.stopPropagation();
54
+ case 3:
55
+ case "end":
56
+ return _context.stop();
57
+ }
58
+ }, _callee);
59
+ }));
60
+ return function (_x) {
61
+ return _ref.apply(this, arguments);
62
+ };
63
+ }()),
45
64
  children: /*#__PURE__*/_jsx(CloseOutlined, {})
46
65
  })]
47
66
  }, item.id), open && /*#__PURE__*/_jsx("div", {
@@ -3,7 +3,7 @@ import { LibroKernelManager, LibroSessionManager } from '@difizen/libro-kernel';
3
3
  import type { ILanguageServerManager } from '@difizen/libro-lsp';
4
4
  import { ILSPDocumentConnectionManager } from '@difizen/libro-lsp';
5
5
  import { TerminalManager } from '@difizen/libro-terminal';
6
- import { BaseView, ViewManager } from '@difizen/mana-app';
6
+ import { BaseView, CommandRegistry, ViewManager } from '@difizen/mana-app';
7
7
  import type { SaveableTabView } from '../index.js';
8
8
  import { LayoutService } from '../layout/layout-service.js';
9
9
  import './index.less';
@@ -17,7 +17,8 @@ export declare class KernelAndTerminalPanelView extends BaseView {
17
17
  terminalManager: TerminalManager;
18
18
  lspConnectionManager: ILSPDocumentConnectionManager;
19
19
  lspManager: ILanguageServerManager;
20
- constructor(libroKernelManager: LibroKernelManager, libroSessionManager: LibroSessionManager, terminalManager: TerminalManager, lspDocumentConnectionManager: ILSPDocumentConnectionManager);
20
+ commandRegistry: CommandRegistry;
21
+ constructor(libroKernelManager: LibroKernelManager, libroSessionManager: LibroSessionManager, terminalManager: TerminalManager, lspDocumentConnectionManager: ILSPDocumentConnectionManager, commandRegistry: CommandRegistry);
21
22
  getAllOpenedTabView(): SaveableTabView;
22
23
  refresh(): void;
23
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"kernel-and-terminal-panel-view.d.ts","sourceRoot":"","sources":["../../src/kernel-and-terminal-panel/kernel-and-terminal-panel-view.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,KAAK,EAAE,sBAAsB,EAAqB,MAAM,oBAAoB,CAAC;AACpF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACL,QAAQ,EAMR,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAI3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAQ5D,OAAO,cAAc,CAAC;AAmJtB,eAAO,MAAM,4BAA4B,mCAAmC,CAAC;AAE7E,qBAEa,0BAA2B,SAAQ,QAAQ;IAC7C,IAAI,yBAAe;IACP,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IACjC,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IAE9D,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,eAAe,EAAE,eAAe,CAAC;IACjC,oBAAoB,EAAE,6BAA6B,CAAC;IACpD,UAAU,EAAE,sBAAsB,CAAC;gBAGL,kBAAkB,EAAE,kBAAkB,EACrC,mBAAmB,EAAE,mBAAmB,EAC5C,eAAe,EAAE,eAAe,EAEzD,4BAA4B,EAAE,6BAA6B;IAa7D,mBAAmB,IAAI,eAAe;IAMtC,OAAO;CAKR"}
1
+ {"version":3,"file":"kernel-and-terminal-panel-view.d.ts","sourceRoot":"","sources":["../../src/kernel-and-terminal-panel/kernel-and-terminal-panel-view.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,KAAK,EAAE,sBAAsB,EAAqB,MAAM,oBAAoB,CAAC;AACpF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAoB,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EACL,QAAQ,EACR,eAAe,EAMf,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAI3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAQ5D,OAAO,cAAc,CAAC;AA0JtB,eAAO,MAAM,4BAA4B,mCAAmC,CAAC;AAE7E,qBAEa,0BAA2B,SAAQ,QAAQ;IAC7C,IAAI,yBAAe;IACP,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IACjC,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IAE9D,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,eAAe,EAAE,eAAe,CAAC;IACjC,oBAAoB,EAAE,6BAA6B,CAAC;IACpD,UAAU,EAAE,sBAAsB,CAAC;IACnC,eAAe,EAAE,eAAe,CAAC;gBAGH,kBAAkB,EAAE,kBAAkB,EACrC,mBAAmB,EAAE,mBAAmB,EAC5C,eAAe,EAAE,eAAe,EAEzD,4BAA4B,EAAE,6BAA6B,EAClC,eAAe,EAAE,eAAe;IAc3D,mBAAmB,IAAI,eAAe;IAMtC,OAAO;CAKR"}
@@ -31,8 +31,8 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
31
31
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
32
32
  import { LibroKernelManager, LibroSessionManager } from '@difizen/libro-kernel';
33
33
  import { ILSPDocumentConnectionManager } from '@difizen/libro-lsp';
34
- import { TerminalManager } from '@difizen/libro-terminal';
35
- import { BaseView, inject, singleton, useInject, view, ViewInstance, ViewManager } from '@difizen/mana-app';
34
+ import { TerminalCommands, TerminalManager } from '@difizen/libro-terminal';
35
+ import { BaseView, CommandRegistry, inject, singleton, useInject, view, ViewInstance, ViewManager } from '@difizen/mana-app';
36
36
  import { useEffect, useState } from 'react';
37
37
  import { KernelAndTerminal } from "../common/index.js";
38
38
  import { LibroLabLayoutSlots } from "../index.js";
@@ -48,7 +48,8 @@ var PanelRender = function PanelRender() {
48
48
  libroSessionManager = instance.libroSessionManager,
49
49
  terminalManager = instance.terminalManager,
50
50
  lspManager = instance.lspManager,
51
- lspConnectionManager = instance.lspConnectionManager;
51
+ lspConnectionManager = instance.lspConnectionManager,
52
+ commandRegistry = instance.commandRegistry;
52
53
  var _useState = useState(),
53
54
  _useState2 = _slicedToArray(_useState, 2),
54
55
  kernelItems = _useState2[0],
@@ -78,8 +79,11 @@ var PanelRender = function PanelRender() {
78
79
  return _regeneratorRuntime().wrap(function _callee$(_context) {
79
80
  while (1) switch (_context.prev = _context.next) {
80
81
  case 0:
81
- return _context.abrupt("return", lspConnectionManager.disconnectServer(key));
82
- case 1:
82
+ _context.next = 2;
83
+ return lspConnectionManager.disconnectServer(key);
84
+ case 2:
85
+ return _context.abrupt("return", _context.sent);
86
+ case 3:
83
87
  case "end":
84
88
  return _context.stop();
85
89
  }
@@ -125,8 +129,11 @@ var PanelRender = function PanelRender() {
125
129
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
126
130
  while (1) switch (_context2.prev = _context2.next) {
127
131
  case 0:
128
- return _context2.abrupt("return", libroKernelManager.shutdown(kernel.id));
129
- case 1:
132
+ _context2.next = 2;
133
+ return libroKernelManager.shutdown(kernel.id);
134
+ case 2:
135
+ return _context2.abrupt("return", _context2.sent);
136
+ case 3:
130
137
  case "end":
131
138
  return _context2.stop();
132
139
  }
@@ -174,8 +181,11 @@ var PanelRender = function PanelRender() {
174
181
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
175
182
  while (1) switch (_context3.prev = _context3.next) {
176
183
  case 0:
177
- return _context3.abrupt("return", terminalManager.shutdown(terminal));
178
- case 1:
184
+ _context3.next = 2;
185
+ return terminalManager.shutdown(terminal);
186
+ case 2:
187
+ commandRegistry.executeCommand(TerminalCommands['CloseTerminal'].id, terminal);
188
+ case 3:
179
189
  case "end":
180
190
  return _context3.stop();
181
191
  }
@@ -239,8 +249,9 @@ var PanelRender = function PanelRender() {
239
249
  _context5.next = 2;
240
250
  return libroKernelManager.shutdownAll();
241
251
  case 2:
242
- libroSessionManager.refreshRunning();
243
- case 3:
252
+ _context5.next = 4;
253
+ return libroSessionManager.refreshRunning();
254
+ case 4:
244
255
  case "end":
245
256
  return _context5.stop();
246
257
  }
@@ -249,23 +260,37 @@ var PanelRender = function PanelRender() {
249
260
  }), /*#__PURE__*/_jsx(LibroCollapse, {
250
261
  type: LibroPanelCollapseItemType.TERMINAL,
251
262
  items: terminalItems,
252
- shutdownAll: function shutdownAll() {
253
- return terminalManager.shutdownAll();
254
- }
255
- }), /*#__PURE__*/_jsx(LibroCollapse, {
256
- type: LibroPanelCollapseItemType.LSP,
257
- items: lspItems,
258
263
  shutdownAll: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
259
264
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
260
265
  while (1) switch (_context6.prev = _context6.next) {
261
266
  case 0:
262
- return _context6.abrupt("return", lspConnectionManager.disconnectAllServers());
263
- case 1:
267
+ _context6.next = 2;
268
+ return terminalManager.shutdownAll();
269
+ case 2:
270
+ return _context6.abrupt("return", _context6.sent);
271
+ case 3:
264
272
  case "end":
265
273
  return _context6.stop();
266
274
  }
267
275
  }, _callee6);
268
276
  }))
277
+ }), /*#__PURE__*/_jsx(LibroCollapse, {
278
+ type: LibroPanelCollapseItemType.LSP,
279
+ items: lspItems,
280
+ shutdownAll: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
281
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
282
+ while (1) switch (_context7.prev = _context7.next) {
283
+ case 0:
284
+ _context7.next = 2;
285
+ return lspConnectionManager.disconnectAllServers();
286
+ case 2:
287
+ return _context7.abrupt("return", _context7.sent);
288
+ case 3:
289
+ case "end":
290
+ return _context7.stop();
291
+ }
292
+ }, _callee7);
293
+ }))
269
294
  })]
270
295
  });
271
296
  };
@@ -273,7 +298,7 @@ export var KernelAndTerminalPanelViewId = 'libro-kernel-and-terminal-view';
273
298
  export var KernelAndTerminalPanelView = (_dec = singleton(), _dec2 = view(KernelAndTerminalPanelViewId), _dec3 = inject(ViewManager), _dec4 = inject(LayoutService), _dec(_class = _dec2(_class = (_class2 = /*#__PURE__*/function (_BaseView) {
274
299
  _inherits(KernelAndTerminalPanelView, _BaseView);
275
300
  var _super = _createSuper(KernelAndTerminalPanelView);
276
- function KernelAndTerminalPanelView(libroKernelManager, libroSessionManager, terminalManager, lspDocumentConnectionManager) {
301
+ function KernelAndTerminalPanelView(libroKernelManager, libroSessionManager, terminalManager, lspDocumentConnectionManager, commandRegistry) {
277
302
  var _this;
278
303
  _classCallCheck(this, KernelAndTerminalPanelView);
279
304
  _this = _super.call(this);
@@ -287,8 +312,10 @@ export var KernelAndTerminalPanelView = (_dec = singleton(), _dec2 = view(Kernel
287
312
  _this.terminalManager = terminalManager;
288
313
  _this.lspConnectionManager = lspDocumentConnectionManager;
289
314
  _this.lspManager = lspDocumentConnectionManager.languageServerManager;
315
+ _this.commandRegistry = commandRegistry;
290
316
  return _this;
291
317
  }
318
+ KernelAndTerminalPanelView = inject(CommandRegistry)(KernelAndTerminalPanelView, undefined, 4) || KernelAndTerminalPanelView;
292
319
  KernelAndTerminalPanelView = inject(ILSPDocumentConnectionManager)(KernelAndTerminalPanelView, undefined, 3) || KernelAndTerminalPanelView;
293
320
  KernelAndTerminalPanelView = inject(TerminalManager)(KernelAndTerminalPanelView, undefined, 2) || KernelAndTerminalPanelView;
294
321
  KernelAndTerminalPanelView = inject(LibroSessionManager)(KernelAndTerminalPanelView, undefined, 1) || KernelAndTerminalPanelView;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@difizen/libro-lab",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "libro",
@@ -34,14 +34,14 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@ant-design/icons": "^5.1.0",
37
- "@difizen/libro-core": "^0.1.15",
38
- "@difizen/libro-jupyter": "^0.1.15",
39
- "@difizen/libro-kernel": "^0.1.15",
40
- "@difizen/libro-prompt-cell": "^0.1.15",
41
- "@difizen/libro-terminal": "^0.1.15",
42
- "@difizen/libro-lsp": "^0.1.15",
43
- "@difizen/libro-toc": "^0.1.15",
44
- "@difizen/libro-cofine-editor-core": "^0.1.15",
37
+ "@difizen/libro-core": "^0.1.16",
38
+ "@difizen/libro-jupyter": "^0.1.16",
39
+ "@difizen/libro-kernel": "^0.1.16",
40
+ "@difizen/libro-prompt-cell": "^0.1.16",
41
+ "@difizen/libro-terminal": "^0.1.16",
42
+ "@difizen/libro-lsp": "^0.1.16",
43
+ "@difizen/libro-toc": "^0.1.16",
44
+ "@difizen/libro-cofine-editor-core": "^0.1.16",
45
45
  "@difizen/mana-app": "latest",
46
46
  "@difizen/mana-react": "latest",
47
47
  "classnames": "^2.3.2",
@@ -1,6 +1,7 @@
1
1
  import { CloseOutlined } from '@ant-design/icons';
2
2
  import { TerminalCommands } from '@difizen/libro-terminal';
3
3
  import { CommandRegistry, useInject } from '@difizen/mana-app';
4
+ import { message } from 'antd';
4
5
  import React from 'react';
5
6
 
6
7
  import {
@@ -58,7 +59,10 @@ export const LibroCollapseContent: React.FC<Props> = (props: Props) => {
58
59
  e.stopPropagation();
59
60
  e.preventDefault();
60
61
  if (item.shutdown) {
61
- item.shutdown();
62
+ item.shutdown().catch((error) => {
63
+ message.error(`shutdown ${props.type} failed`);
64
+ console.error(error);
65
+ });
62
66
  }
63
67
  }}
64
68
  >
@@ -1,6 +1,6 @@
1
1
  import { CaretDownOutlined, CaretRightOutlined } from '@ant-design/icons';
2
2
  import { ViewContext } from '@difizen/mana-app';
3
- import { Empty, Popconfirm } from 'antd';
3
+ import { Empty, message, Popconfirm } from 'antd';
4
4
  import React, { useState } from 'react';
5
5
 
6
6
  import type { SaveableTabView } from '../../index.js';
@@ -110,7 +110,10 @@ export const LibroCollapse: React.FC<Props> = (props: Props) => {
110
110
  cancelText="取消"
111
111
  onConfirm={() => {
112
112
  if (props.shutdownAll) {
113
- props.shutdownAll();
113
+ props.shutdownAll().catch((e) => {
114
+ message.error(`shutdown all ${props.type}s error`);
115
+ console.error(e);
116
+ });
114
117
  }
115
118
  }}
116
119
  >
@@ -35,9 +35,11 @@ export const LibroKernelCollapseContentItem: React.FC<Props> = (props: Props) =>
35
35
  <div className="libro-panel-collapse-item-label">{item.name}</div>
36
36
  <div
37
37
  className="libro-panel-collapse-item-close"
38
- onClick={(e) => {
38
+ onClick={async (e) => {
39
39
  if (item.shutdown) {
40
- item.shutdown();
40
+ item.shutdown().catch((error) => {
41
+ console.error(error);
42
+ });
41
43
  }
42
44
  e.preventDefault();
43
45
  e.stopPropagation();
@@ -1,9 +1,10 @@
1
1
  import { LibroKernelManager, LibroSessionManager } from '@difizen/libro-kernel';
2
2
  import type { ILanguageServerManager, TLanguageServerId } from '@difizen/libro-lsp';
3
3
  import { ILSPDocumentConnectionManager } from '@difizen/libro-lsp';
4
- import { TerminalManager } from '@difizen/libro-terminal';
4
+ import { TerminalCommands, TerminalManager } from '@difizen/libro-terminal';
5
5
  import {
6
6
  BaseView,
7
+ CommandRegistry,
7
8
  inject,
8
9
  singleton,
9
10
  useInject,
@@ -36,6 +37,7 @@ const PanelRender: React.FC = () => {
36
37
  terminalManager,
37
38
  lspManager,
38
39
  lspConnectionManager,
40
+ commandRegistry,
39
41
  } = instance;
40
42
 
41
43
  const [kernelItems, setKernelItems] = useState<
@@ -62,7 +64,7 @@ const PanelRender: React.FC = () => {
62
64
  id: key,
63
65
  name: `${key} (${session.spec.languages.join('/')})`,
64
66
  shutdown: async () =>
65
- lspConnectionManager.disconnectServer(key as TLanguageServerId),
67
+ await lspConnectionManager.disconnectServer(key as TLanguageServerId),
66
68
  });
67
69
  });
68
70
 
@@ -95,7 +97,7 @@ const PanelRender: React.FC = () => {
95
97
  items.set(kernel.id, {
96
98
  id: kernel.id,
97
99
  name: kernel.name,
98
- shutdown: async () => libroKernelManager.shutdown(kernel.id),
100
+ shutdown: async () => await libroKernelManager.shutdown(kernel.id),
99
101
  notebooks: [
100
102
  { sessionId: session.id, name: session.name, path: session.path },
101
103
  ],
@@ -120,7 +122,13 @@ const PanelRender: React.FC = () => {
120
122
  items.push({
121
123
  id: 'terminal/' + terminal,
122
124
  name: terminal,
123
- shutdown: async () => terminalManager.shutdown(terminal),
125
+ shutdown: async () => {
126
+ await terminalManager.shutdown(terminal);
127
+ commandRegistry.executeCommand(
128
+ TerminalCommands['CloseTerminal'].id,
129
+ terminal,
130
+ );
131
+ },
124
132
  });
125
133
  }
126
134
 
@@ -154,18 +162,18 @@ const PanelRender: React.FC = () => {
154
162
  items={kernelItems}
155
163
  shutdownAll={async () => {
156
164
  await libroKernelManager.shutdownAll();
157
- libroSessionManager.refreshRunning();
165
+ await libroSessionManager.refreshRunning();
158
166
  }}
159
167
  />
160
168
  <LibroCollapse
161
169
  type={LibroPanelCollapseItemType.TERMINAL}
162
170
  items={terminalItems}
163
- shutdownAll={() => terminalManager.shutdownAll()}
171
+ shutdownAll={async () => await terminalManager.shutdownAll()}
164
172
  />
165
173
  <LibroCollapse
166
174
  type={LibroPanelCollapseItemType.LSP}
167
175
  items={lspItems}
168
- shutdownAll={async () => lspConnectionManager.disconnectAllServers()}
176
+ shutdownAll={async () => await lspConnectionManager.disconnectAllServers()}
169
177
  />
170
178
  </div>
171
179
  );
@@ -185,6 +193,7 @@ export class KernelAndTerminalPanelView extends BaseView {
185
193
  terminalManager: TerminalManager;
186
194
  lspConnectionManager: ILSPDocumentConnectionManager;
187
195
  lspManager: ILanguageServerManager;
196
+ commandRegistry: CommandRegistry;
188
197
 
189
198
  constructor(
190
199
  @inject(LibroKernelManager) libroKernelManager: LibroKernelManager,
@@ -192,6 +201,7 @@ export class KernelAndTerminalPanelView extends BaseView {
192
201
  @inject(TerminalManager) terminalManager: TerminalManager,
193
202
  @inject(ILSPDocumentConnectionManager)
194
203
  lspDocumentConnectionManager: ILSPDocumentConnectionManager,
204
+ @inject(CommandRegistry) commandRegistry: CommandRegistry,
195
205
  ) {
196
206
  super();
197
207
  this.title.icon = <KernelAndTerminal />;
@@ -202,6 +212,7 @@ export class KernelAndTerminalPanelView extends BaseView {
202
212
  this.terminalManager = terminalManager;
203
213
  this.lspConnectionManager = lspDocumentConnectionManager;
204
214
  this.lspManager = lspDocumentConnectionManager.languageServerManager;
215
+ this.commandRegistry = commandRegistry;
205
216
  }
206
217
 
207
218
  getAllOpenedTabView(): SaveableTabView {