@difizen/libro-lab 0.1.13 → 0.1.15

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 (55) hide show
  1. package/es/common/icon.d.ts +6 -0
  2. package/es/common/icon.d.ts.map +1 -1
  3. package/es/common/icon.js +326 -0
  4. package/es/kernel-and-terminal-panel/collapse/collapse-content.d.ts +11 -0
  5. package/es/kernel-and-terminal-panel/collapse/collapse-content.d.ts.map +1 -0
  6. package/es/kernel-and-terminal-panel/collapse/collapse-content.js +53 -0
  7. package/es/kernel-and-terminal-panel/collapse/index.d.ts +31 -0
  8. package/es/kernel-and-terminal-panel/collapse/index.d.ts.map +1 -0
  9. package/es/kernel-and-terminal-panel/collapse/index.js +103 -0
  10. package/es/kernel-and-terminal-panel/collapse/index.less +89 -0
  11. package/es/kernel-and-terminal-panel/collapse/kernel-collapse-content-item.d.ts +8 -0
  12. package/es/kernel-and-terminal-panel/collapse/kernel-collapse-content-item.d.ts.map +1 -0
  13. package/es/kernel-and-terminal-panel/collapse/kernel-collapse-content-item.js +79 -0
  14. package/es/kernel-and-terminal-panel/collapse/kernel-collapse-content.d.ts +9 -0
  15. package/es/kernel-and-terminal-panel/collapse/kernel-collapse-content.d.ts.map +1 -0
  16. package/es/kernel-and-terminal-panel/collapse/kernel-collapse-content.js +13 -0
  17. package/es/kernel-and-terminal-panel/collapse/page-collapse-content.d.ts +3 -0
  18. package/es/kernel-and-terminal-panel/collapse/page-collapse-content.d.ts.map +1 -0
  19. package/es/kernel-and-terminal-panel/collapse/page-collapse-content.js +38 -0
  20. package/es/kernel-and-terminal-panel/index.d.ts +2 -0
  21. package/es/kernel-and-terminal-panel/index.d.ts.map +1 -0
  22. package/es/kernel-and-terminal-panel/index.js +1 -0
  23. package/es/kernel-and-terminal-panel/index.less +5 -0
  24. package/es/kernel-and-terminal-panel/kernel-and-terminal-panel-view.d.ts +24 -0
  25. package/es/kernel-and-terminal-panel/kernel-and-terminal-panel-view.d.ts.map +1 -0
  26. package/es/kernel-and-terminal-panel/kernel-and-terminal-panel-view.js +320 -0
  27. package/es/kernel-and-terminal-panel/module.d.ts +3 -0
  28. package/es/kernel-and-terminal-panel/module.d.ts.map +1 -0
  29. package/es/kernel-and-terminal-panel/module.js +13 -0
  30. package/es/kernel-and-terminal-panel/panel-command.d.ts +18 -0
  31. package/es/kernel-and-terminal-panel/panel-command.d.ts.map +1 -0
  32. package/es/kernel-and-terminal-panel/panel-command.js +80 -0
  33. package/es/layout/layout-service.d.ts +2 -0
  34. package/es/layout/layout-service.d.ts.map +1 -1
  35. package/es/layout/layout-service.js +18 -0
  36. package/es/layout/main.d.ts.map +1 -1
  37. package/es/layout/main.js +20 -7
  38. package/es/module.d.ts.map +1 -1
  39. package/es/module.js +4 -2
  40. package/package.json +9 -8
  41. package/src/common/icon.tsx +298 -0
  42. package/src/kernel-and-terminal-panel/collapse/collapse-content.tsx +72 -0
  43. package/src/kernel-and-terminal-panel/collapse/index.less +89 -0
  44. package/src/kernel-and-terminal-panel/collapse/index.tsx +128 -0
  45. package/src/kernel-and-terminal-panel/collapse/kernel-collapse-content-item.tsx +87 -0
  46. package/src/kernel-and-terminal-panel/collapse/kernel-collapse-content.tsx +23 -0
  47. package/src/kernel-and-terminal-panel/collapse/page-collapse-content.tsx +49 -0
  48. package/src/kernel-and-terminal-panel/index.less +5 -0
  49. package/src/kernel-and-terminal-panel/index.ts +1 -0
  50. package/src/kernel-and-terminal-panel/kernel-and-terminal-panel-view.tsx +218 -0
  51. package/src/kernel-and-terminal-panel/module.ts +20 -0
  52. package/src/kernel-and-terminal-panel/panel-command.tsx +57 -0
  53. package/src/layout/layout-service.ts +17 -0
  54. package/src/layout/main.tsx +13 -1
  55. package/src/module.tsx +3 -0
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { LibroPanelCollapseKernelItem } from './index.js';
3
+ interface Props {
4
+ item: LibroPanelCollapseKernelItem;
5
+ }
6
+ export declare const LibroKernelCollapseContentItem: React.FC<Props>;
7
+ export {};
8
+ //# sourceMappingURL=kernel-collapse-content-item.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,79 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ 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
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { CaretDownOutlined, CaretRightOutlined, CloseOutlined } from '@ant-design/icons';
8
+ import { OpenerService, URI, useInject } from '@difizen/mana-app';
9
+ import React, { useState } from 'react';
10
+ import { fileUnderKernel, runningKernel } from "../../common/icon.js";
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { Fragment as _Fragment } from "react/jsx-runtime";
14
+ export var LibroKernelCollapseContentItem = function LibroKernelCollapseContentItem(props) {
15
+ var item = props.item;
16
+ var _useState = useState(true),
17
+ _useState2 = _slicedToArray(_useState, 2),
18
+ open = _useState2[0],
19
+ setOpen = _useState2[1];
20
+ var openService = useInject(OpenerService);
21
+ return /*#__PURE__*/_jsxs(_Fragment, {
22
+ children: [/*#__PURE__*/_jsxs("div", {
23
+ className: "libro-panel-collapse-item",
24
+ onClick: function onClick() {
25
+ setOpen(!open);
26
+ },
27
+ children: [/*#__PURE__*/_jsx("div", {
28
+ className: "libro-panel-collapse-item-toggle",
29
+ children: open ? /*#__PURE__*/_jsx(CaretDownOutlined, {}) : /*#__PURE__*/_jsx(CaretRightOutlined, {})
30
+ }), /*#__PURE__*/_jsx("div", {
31
+ className: "libro-panel-collapse-item-icon",
32
+ children: runningKernel()
33
+ }), /*#__PURE__*/_jsx("div", {
34
+ className: "libro-panel-collapse-item-label",
35
+ children: item.name
36
+ }), /*#__PURE__*/_jsx("div", {
37
+ 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
+ },
45
+ children: /*#__PURE__*/_jsx(CloseOutlined, {})
46
+ })]
47
+ }, item.id), open && /*#__PURE__*/_jsx("div", {
48
+ className: "libro-panel-collapse-kernel-item-container",
49
+ children: item.notebooks.map(function (notebook) {
50
+ return /*#__PURE__*/_jsxs("div", {
51
+ className: "libro-panel-collapse-kernel-item",
52
+ onClick: function onClick() {
53
+ var uri = new URI(notebook.path);
54
+ var name = notebook.name;
55
+ openService.getOpener(uri).then(function (opener) {
56
+ if (opener) {
57
+ opener.open(uri, {
58
+ viewOptions: {
59
+ name: name
60
+ }
61
+ });
62
+ }
63
+ return;
64
+ }).catch(function (e) {
65
+ console.error(e);
66
+ });
67
+ },
68
+ children: [/*#__PURE__*/_jsx("div", {
69
+ className: "libro-panel-collapse-kernel-item-icon",
70
+ children: fileUnderKernel()
71
+ }), /*#__PURE__*/_jsx("div", {
72
+ className: "libro-panel-collapse-kernel-item-name",
73
+ children: notebook.name
74
+ })]
75
+ }, notebook.sessionId);
76
+ })
77
+ })]
78
+ });
79
+ };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { LibroPanelCollapseItemType, LibroPanelCollapseKernelItem } from './index.js';
3
+ interface Props {
4
+ type: LibroPanelCollapseItemType;
5
+ items: LibroPanelCollapseKernelItem[];
6
+ }
7
+ export declare const LibroKernelCollapseContent: React.FC<Props>;
8
+ export {};
9
+ //# sourceMappingURL=kernel-collapse-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kernel-collapse-content.d.ts","sourceRoot":"","sources":["../../../src/kernel-and-terminal-panel/collapse/kernel-collapse-content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EACV,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,YAAY,CAAC;AAEpB,UAAU,KAAK;IACb,IAAI,EAAE,0BAA0B,CAAC;IACjC,KAAK,EAAE,4BAA4B,EAAE,CAAC;CACvC;AAED,eAAO,MAAM,0BAA0B,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAQtD,CAAC"}
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { LibroKernelCollapseContentItem } from "./kernel-collapse-content-item.js";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { Fragment as _Fragment } from "react/jsx-runtime";
5
+ export var LibroKernelCollapseContent = function LibroKernelCollapseContent(props) {
6
+ return /*#__PURE__*/_jsx(_Fragment, {
7
+ children: props.items.map(function (item) {
8
+ return /*#__PURE__*/_jsx(LibroKernelCollapseContentItem, {
9
+ item: item
10
+ }, item.id);
11
+ })
12
+ });
13
+ };
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" resolution-mode="require"/>
2
+ export declare const OpenedTabs: React.FC;
3
+ //# sourceMappingURL=page-collapse-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-collapse-content.d.ts","sourceRoot":"","sources":["../../../src/kernel-and-terminal-panel/collapse/page-collapse-content.tsx"],"names":[],"mappings":";AAKA,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EA2C9B,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { CloseOutlined } from '@ant-design/icons';
2
+ import { renderNode, useInject, ViewContext, ViewInstance } from '@difizen/mana-app';
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ import { Fragment as _Fragment } from "react/jsx-runtime";
6
+ export var OpenedTabs = function OpenedTabs() {
7
+ var tabs = useInject(ViewInstance);
8
+ var renderTitleIcon = renderNode;
9
+ var renderTitleLabel = renderNode;
10
+ return /*#__PURE__*/_jsx(_Fragment, {
11
+ children: tabs.children.map(function (item) {
12
+ return /*#__PURE__*/_jsx(ViewContext, {
13
+ view: item,
14
+ children: /*#__PURE__*/_jsxs("div", {
15
+ title: item.title.caption,
16
+ className: "libro-panel-collapse-item",
17
+ onClick: function onClick() {
18
+ tabs.onChange(item.id);
19
+ },
20
+ children: [item.title.icon && /*#__PURE__*/_jsx("span", {
21
+ className: "libro-panel-collapse-item-icon",
22
+ children: renderTitleIcon(item.title.icon)
23
+ }), /*#__PURE__*/_jsx("div", {
24
+ className: "libro-panel-collapse-item-label",
25
+ children: renderTitleLabel(item.title.label)
26
+ }), item.title.closable && /*#__PURE__*/_jsx("div", {
27
+ className: "libro-panel-collapse-item-close",
28
+ onClick: function onClick(e) {
29
+ e.stopPropagation();
30
+ item.dispose();
31
+ },
32
+ children: /*#__PURE__*/_jsx(CloseOutlined, {})
33
+ })]
34
+ })
35
+ }, item.id);
36
+ })
37
+ });
38
+ };
@@ -0,0 +1,2 @@
1
+ export * from './module.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/kernel-and-terminal-panel/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -0,0 +1 @@
1
+ export * from "./module.js";
@@ -0,0 +1,5 @@
1
+ .kernel-and-terminal-panel {
2
+ height: 100%;
3
+ padding: 0 10px;
4
+ overflow-y: scroll;
5
+ }
@@ -0,0 +1,24 @@
1
+ /// <reference types="react" resolution-mode="require"/>
2
+ import { LibroKernelManager, LibroSessionManager } from '@difizen/libro-kernel';
3
+ import type { ILanguageServerManager } from '@difizen/libro-lsp';
4
+ import { ILSPDocumentConnectionManager } from '@difizen/libro-lsp';
5
+ import { TerminalManager } from '@difizen/libro-terminal';
6
+ import { BaseView, ViewManager } from '@difizen/mana-app';
7
+ import type { SaveableTabView } from '../index.js';
8
+ import { LayoutService } from '../layout/layout-service.js';
9
+ import './index.less';
10
+ export declare const KernelAndTerminalPanelViewId = "libro-kernel-and-terminal-view";
11
+ export declare class KernelAndTerminalPanelView extends BaseView {
12
+ view: import("react").FC<{}>;
13
+ protected viewManager: ViewManager;
14
+ protected layoutService: LayoutService;
15
+ libroKernelManager: LibroKernelManager;
16
+ libroSessionManager: LibroSessionManager;
17
+ terminalManager: TerminalManager;
18
+ lspConnectionManager: ILSPDocumentConnectionManager;
19
+ lspManager: ILanguageServerManager;
20
+ constructor(libroKernelManager: LibroKernelManager, libroSessionManager: LibroSessionManager, terminalManager: TerminalManager, lspDocumentConnectionManager: ILSPDocumentConnectionManager);
21
+ getAllOpenedTabView(): SaveableTabView;
22
+ refresh(): void;
23
+ }
24
+ //# sourceMappingURL=kernel-and-terminal-panel-view.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,320 @@
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, _class, _class2, _descriptor, _descriptor2;
3
+ 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 }); }
4
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
+ 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); } }
6
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
8
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
10
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
11
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
13
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
14
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
15
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
16
+ 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; }
17
+ 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.'); }
18
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
19
+ 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."); }
20
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
21
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
22
+ 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; } } }; }
23
+ 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; }
24
+ 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); } }
25
+ 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); }); }; }
26
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
27
+ 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."); }
28
+ 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); }
29
+ 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; }
30
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
31
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
32
+ import { LibroKernelManager, LibroSessionManager } from '@difizen/libro-kernel';
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';
36
+ import { useEffect, useState } from 'react';
37
+ import { KernelAndTerminal } from "../common/index.js";
38
+ import { LibroLabLayoutSlots } from "../index.js";
39
+ import { LayoutService } from "../layout/layout-service.js";
40
+ import { LibroPanelCollapseItemType, LibroCollapse } from "./collapse/index.js";
41
+ import "./index.less";
42
+ import { jsx as _jsx } from "react/jsx-runtime";
43
+ import { jsxs as _jsxs } from "react/jsx-runtime";
44
+ var PanelRender = function PanelRender() {
45
+ var instance = useInject(ViewInstance);
46
+ var openedTabView = instance.getAllOpenedTabView();
47
+ var libroKernelManager = instance.libroKernelManager,
48
+ libroSessionManager = instance.libroSessionManager,
49
+ terminalManager = instance.terminalManager,
50
+ lspManager = instance.lspManager,
51
+ lspConnectionManager = instance.lspConnectionManager;
52
+ var _useState = useState(),
53
+ _useState2 = _slicedToArray(_useState, 2),
54
+ kernelItems = _useState2[0],
55
+ setKernelItems = _useState2[1];
56
+ var _useState3 = useState(),
57
+ _useState4 = _slicedToArray(_useState3, 2),
58
+ terminalItems = _useState4[0],
59
+ setTerminalItems = _useState4[1];
60
+
61
+ // const lspManager = useInject<ILSPDocumentConnectionManager>(
62
+ // DocumentConnectionManager,
63
+ // ).languageServerManager;
64
+
65
+ var _useState5 = useState(),
66
+ _useState6 = _slicedToArray(_useState5, 2),
67
+ lspItems = _useState6[0],
68
+ setLSPItems = _useState6[1];
69
+ lspManager.sessionsChanged(function () {
70
+ var sessions = lspManager.sessions;
71
+ var items = [];
72
+ sessions.forEach(function (session, key) {
73
+ items.push({
74
+ id: key,
75
+ name: "".concat(key, " (").concat(session.spec.languages.join('/'), ")"),
76
+ shutdown: function () {
77
+ var _shutdown = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
78
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
79
+ while (1) switch (_context.prev = _context.next) {
80
+ case 0:
81
+ return _context.abrupt("return", lspConnectionManager.disconnectServer(key));
82
+ case 1:
83
+ case "end":
84
+ return _context.stop();
85
+ }
86
+ }, _callee);
87
+ }));
88
+ function shutdown() {
89
+ return _shutdown.apply(this, arguments);
90
+ }
91
+ return shutdown;
92
+ }()
93
+ });
94
+ });
95
+ setLSPItems(items);
96
+ });
97
+ useEffect(function () {
98
+ if (!libroSessionManager.running || libroSessionManager.running && libroSessionManager.running.size === 0) {
99
+ setKernelItems(undefined);
100
+ return;
101
+ }
102
+
103
+ // kernelId -> item
104
+ var items = new Map();
105
+ var runningSessions = libroSessionManager.running.values();
106
+ var _iterator = _createForOfIteratorHelper(runningSessions),
107
+ _step;
108
+ try {
109
+ var _loop = function _loop() {
110
+ var session = _step.value;
111
+ var kernel = session.kernel;
112
+ if (items.has(kernel.id)) {
113
+ var _items$get;
114
+ (_items$get = items.get(kernel.id)) === null || _items$get === void 0 || _items$get.notebooks.push({
115
+ sessionId: session.id,
116
+ name: session.name,
117
+ path: session.path
118
+ });
119
+ } else {
120
+ items.set(kernel.id, {
121
+ id: kernel.id,
122
+ name: kernel.name,
123
+ shutdown: function () {
124
+ var _shutdown2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
125
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
126
+ while (1) switch (_context2.prev = _context2.next) {
127
+ case 0:
128
+ return _context2.abrupt("return", libroKernelManager.shutdown(kernel.id));
129
+ case 1:
130
+ case "end":
131
+ return _context2.stop();
132
+ }
133
+ }, _callee2);
134
+ }));
135
+ function shutdown() {
136
+ return _shutdown2.apply(this, arguments);
137
+ }
138
+ return shutdown;
139
+ }(),
140
+ notebooks: [{
141
+ sessionId: session.id,
142
+ name: session.name,
143
+ path: session.path
144
+ }]
145
+ });
146
+ }
147
+ };
148
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
149
+ _loop();
150
+ }
151
+ } catch (err) {
152
+ _iterator.e(err);
153
+ } finally {
154
+ _iterator.f();
155
+ }
156
+ setKernelItems(Array.from(items.values()));
157
+ }, [libroKernelManager, libroSessionManager.running]);
158
+ useEffect(function () {
159
+ if (!terminalManager.runningModels || terminalManager.runningModels && terminalManager.runningModels.length === 0) {
160
+ setTerminalItems(undefined);
161
+ return;
162
+ }
163
+ var items = [];
164
+ var _iterator2 = _createForOfIteratorHelper(terminalManager.runningModels),
165
+ _step2;
166
+ try {
167
+ var _loop2 = function _loop2() {
168
+ var terminal = _step2.value;
169
+ items.push({
170
+ id: 'terminal/' + terminal,
171
+ name: terminal,
172
+ shutdown: function () {
173
+ var _shutdown3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
174
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
175
+ while (1) switch (_context3.prev = _context3.next) {
176
+ case 0:
177
+ return _context3.abrupt("return", terminalManager.shutdown(terminal));
178
+ case 1:
179
+ case "end":
180
+ return _context3.stop();
181
+ }
182
+ }, _callee3);
183
+ }));
184
+ function shutdown() {
185
+ return _shutdown3.apply(this, arguments);
186
+ }
187
+ return shutdown;
188
+ }()
189
+ });
190
+ };
191
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
192
+ _loop2();
193
+ }
194
+ } catch (err) {
195
+ _iterator2.e(err);
196
+ } finally {
197
+ _iterator2.f();
198
+ }
199
+ setTerminalItems(items);
200
+
201
+ // eslint-disable-next-line react-hooks/exhaustive-deps
202
+ }, [terminalManager.runningModels]);
203
+ return /*#__PURE__*/_jsxs("div", {
204
+ className: "kernel-and-terminal-panel",
205
+ children: [/*#__PURE__*/_jsx(LibroCollapse, {
206
+ type: LibroPanelCollapseItemType.PAGE,
207
+ items: openedTabView.children.map(function (item) {
208
+ return {
209
+ id: item.id + '',
210
+ name: item.title.label
211
+ };
212
+ }),
213
+ tabView: openedTabView,
214
+ shutdownAll: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
215
+ var _i, _arr, item;
216
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
217
+ while (1) switch (_context4.prev = _context4.next) {
218
+ case 0:
219
+ // dispose会影响原始数组,这里使用解构赋值copy一份数组。
220
+ for (_i = 0, _arr = _toConsumableArray(openedTabView.children); _i < _arr.length; _i++) {
221
+ item = _arr[_i];
222
+ if (item.title.closable) {
223
+ item.dispose();
224
+ }
225
+ }
226
+ case 1:
227
+ case "end":
228
+ return _context4.stop();
229
+ }
230
+ }, _callee4);
231
+ }))
232
+ }), /*#__PURE__*/_jsx(LibroCollapse, {
233
+ type: LibroPanelCollapseItemType.KERNEL,
234
+ items: kernelItems,
235
+ shutdownAll: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
236
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
237
+ while (1) switch (_context5.prev = _context5.next) {
238
+ case 0:
239
+ _context5.next = 2;
240
+ return libroKernelManager.shutdownAll();
241
+ case 2:
242
+ libroSessionManager.refreshRunning();
243
+ case 3:
244
+ case "end":
245
+ return _context5.stop();
246
+ }
247
+ }, _callee5);
248
+ }))
249
+ }), /*#__PURE__*/_jsx(LibroCollapse, {
250
+ type: LibroPanelCollapseItemType.TERMINAL,
251
+ items: terminalItems,
252
+ shutdownAll: function shutdownAll() {
253
+ return terminalManager.shutdownAll();
254
+ }
255
+ }), /*#__PURE__*/_jsx(LibroCollapse, {
256
+ type: LibroPanelCollapseItemType.LSP,
257
+ items: lspItems,
258
+ shutdownAll: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
259
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
260
+ while (1) switch (_context6.prev = _context6.next) {
261
+ case 0:
262
+ return _context6.abrupt("return", lspConnectionManager.disconnectAllServers());
263
+ case 1:
264
+ case "end":
265
+ return _context6.stop();
266
+ }
267
+ }, _callee6);
268
+ }))
269
+ })]
270
+ });
271
+ };
272
+ export var KernelAndTerminalPanelViewId = 'libro-kernel-and-terminal-view';
273
+ export var KernelAndTerminalPanelView = (_dec = singleton(), _dec2 = view(KernelAndTerminalPanelViewId), _dec3 = inject(ViewManager), _dec4 = inject(LayoutService), _dec(_class = _dec2(_class = (_class2 = /*#__PURE__*/function (_BaseView) {
274
+ _inherits(KernelAndTerminalPanelView, _BaseView);
275
+ var _super = _createSuper(KernelAndTerminalPanelView);
276
+ function KernelAndTerminalPanelView(libroKernelManager, libroSessionManager, terminalManager, lspDocumentConnectionManager) {
277
+ var _this;
278
+ _classCallCheck(this, KernelAndTerminalPanelView);
279
+ _this = _super.call(this);
280
+ _this.view = PanelRender;
281
+ _initializerDefineProperty(_this, "viewManager", _descriptor, _assertThisInitialized(_this));
282
+ _initializerDefineProperty(_this, "layoutService", _descriptor2, _assertThisInitialized(_this));
283
+ _this.title.icon = /*#__PURE__*/_jsx(KernelAndTerminal, {});
284
+ _this.title.label = '运行的终端和内核';
285
+ _this.libroKernelManager = libroKernelManager;
286
+ _this.libroSessionManager = libroSessionManager;
287
+ _this.terminalManager = terminalManager;
288
+ _this.lspConnectionManager = lspDocumentConnectionManager;
289
+ _this.lspManager = lspDocumentConnectionManager.languageServerManager;
290
+ return _this;
291
+ }
292
+ KernelAndTerminalPanelView = inject(ILSPDocumentConnectionManager)(KernelAndTerminalPanelView, undefined, 3) || KernelAndTerminalPanelView;
293
+ KernelAndTerminalPanelView = inject(TerminalManager)(KernelAndTerminalPanelView, undefined, 2) || KernelAndTerminalPanelView;
294
+ KernelAndTerminalPanelView = inject(LibroSessionManager)(KernelAndTerminalPanelView, undefined, 1) || KernelAndTerminalPanelView;
295
+ KernelAndTerminalPanelView = inject(LibroKernelManager)(KernelAndTerminalPanelView, undefined, 0) || KernelAndTerminalPanelView;
296
+ _createClass(KernelAndTerminalPanelView, [{
297
+ key: "getAllOpenedTabView",
298
+ value: function getAllOpenedTabView() {
299
+ return this.layoutService.getAllSlotView(LibroLabLayoutSlots.content);
300
+ }
301
+ }, {
302
+ key: "refresh",
303
+ value: function refresh() {
304
+ this.libroSessionManager.refreshRunning();
305
+ this.terminalManager.refreshRunning();
306
+ this.lspManager.refreshRunning();
307
+ }
308
+ }]);
309
+ return KernelAndTerminalPanelView;
310
+ }(BaseView), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "viewManager", [_dec3], {
311
+ configurable: true,
312
+ enumerable: true,
313
+ writable: true,
314
+ initializer: null
315
+ }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "layoutService", [_dec4], {
316
+ configurable: true,
317
+ enumerable: true,
318
+ writable: true,
319
+ initializer: null
320
+ })), _class2)) || _class) || _class);
@@ -0,0 +1,3 @@
1
+ import { ManaModule } from '@difizen/mana-app';
2
+ export declare const LibroKernelAndTerminalPanelModule: ManaModule;
3
+ //# sourceMappingURL=module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/kernel-and-terminal-panel/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAOrE,eAAO,MAAM,iCAAiC,YAY7C,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { createViewPreference, ManaModule } from '@difizen/mana-app';
2
+ import { LibroLabLayoutSlots } from "../layout/protocol.js";
3
+ import { KernelAndTerminalPanelView } from "./kernel-and-terminal-panel-view.js";
4
+ import { PanelCommandContribution } from "./panel-command.js";
5
+ export var LibroKernelAndTerminalPanelModule = ManaModule.create().register(PanelCommandContribution, KernelAndTerminalPanelView, createViewPreference({
6
+ view: KernelAndTerminalPanelView,
7
+ slot: LibroLabLayoutSlots.navigator,
8
+ autoCreate: true,
9
+ openOptions: {
10
+ reveal: true,
11
+ order: 'kernel'
12
+ }
13
+ }));
@@ -0,0 +1,18 @@
1
+ import type { CommandRegistry, ToolbarRegistry } from '@difizen/mana-app';
2
+ import { ViewManager } from '@difizen/mana-app';
3
+ import { CommandContribution, ToolbarContribution } from '@difizen/mana-app';
4
+ import { KernelAndTerminalPanelView } from './kernel-and-terminal-panel-view.js';
5
+ export declare const PanelCommand: {
6
+ REFRESH: {
7
+ id: string;
8
+ label: string;
9
+ };
10
+ };
11
+ export declare class PanelCommandContribution implements CommandContribution, ToolbarContribution {
12
+ protected viewManager: ViewManager;
13
+ kernelAndTerminalPanelView: KernelAndTerminalPanelView;
14
+ constructor(viewManager: ViewManager);
15
+ registerCommands(command: CommandRegistry): void;
16
+ registerToolbarItems(toolbarRegistry: ToolbarRegistry): void;
17
+ }
18
+ //# sourceMappingURL=panel-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panel-command.d.ts","sourceRoot":"","sources":["../../src/kernel-and-terminal-panel/panel-command.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,mBAAmB,EAInB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEjF,eAAO,MAAM,YAAY;;;;;CAKxB,CAAC;AAEF,qBAGa,wBACX,YAAW,mBAAmB,EAAE,mBAAmB;IAEnD,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IAGnC,0BAA0B,EAAE,0BAA0B,CAAC;gBAEtB,WAAW,EAAE,WAAW;IAIzD,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAahD,oBAAoB,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI;CAQ7D"}