@difizen/libro-jupyter 0.0.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/es/add-between-cell/add-between-cell-command-contribution.d.ts +14 -0
- package/es/add-between-cell/add-between-cell-command-contribution.d.ts.map +1 -0
- package/es/add-between-cell/add-between-cell-command-contribution.js +97 -0
- package/es/add-between-cell/add-between-cell.d.ts +5 -0
- package/es/add-between-cell/add-between-cell.d.ts.map +1 -0
- package/es/add-between-cell/add-between-cell.js +243 -0
- package/es/add-between-cell/index.d.ts +3 -0
- package/es/add-between-cell/index.d.ts.map +1 -0
- package/es/add-between-cell/index.js +2 -0
- package/es/add-between-cell/index.less +103 -0
- package/es/add-between-cell/module.d.ts +3 -0
- package/es/add-between-cell/module.d.ts.map +1 -0
- package/es/add-between-cell/module.js +8 -0
- package/es/cell/index.d.ts +3 -0
- package/es/cell/index.d.ts.map +1 -0
- package/es/cell/index.js +2 -0
- package/es/cell/jupyter-code-cell-model.d.ts +12 -0
- package/es/cell/jupyter-code-cell-model.d.ts.map +1 -0
- package/es/cell/jupyter-code-cell-model.js +56 -0
- package/es/cell/jupyter-code-cell-view.d.ts +18 -0
- package/es/cell/jupyter-code-cell-view.d.ts.map +1 -0
- package/es/cell/jupyter-code-cell-view.js +280 -0
- package/es/command/command-contribution.d.ts +10 -0
- package/es/command/command-contribution.d.ts.map +1 -0
- package/es/command/command-contribution.js +161 -0
- package/es/command/index.d.ts +3 -0
- package/es/command/index.d.ts.map +1 -0
- package/es/command/index.js +2 -0
- package/es/command/keybinding-contribution.d.ts +8 -0
- package/es/command/keybinding-contribution.d.ts.map +1 -0
- package/es/command/keybinding-contribution.js +37 -0
- package/es/components/cell-execution-tip.d.ts +6 -0
- package/es/components/cell-execution-tip.d.ts.map +1 -0
- package/es/components/cell-execution-tip.js +69 -0
- package/es/components/cell-input-bottom-blank.d.ts +5 -0
- package/es/components/cell-input-bottom-blank.d.ts.map +1 -0
- package/es/components/cell-input-bottom-blank.js +21 -0
- package/es/components/icons.d.ts +5 -0
- package/es/components/icons.d.ts.map +1 -0
- package/es/components/icons.js +154 -0
- package/es/components/index.d.ts +4 -0
- package/es/components/index.d.ts.map +1 -0
- package/es/components/index.js +3 -0
- package/es/components/index.less +82 -0
- package/es/config/config-contribution.d.ts +10 -0
- package/es/config/config-contribution.d.ts.map +1 -0
- package/es/config/config-contribution.js +50 -0
- package/es/config/config.d.ts +3 -0
- package/es/config/config.d.ts.map +1 -0
- package/es/config/config.js +11 -0
- package/es/config/index.d.ts +2 -0
- package/es/config/index.d.ts.map +1 -0
- package/es/config/index.js +1 -0
- package/es/configuration/index.d.ts +3 -0
- package/es/configuration/index.d.ts.map +1 -0
- package/es/configuration/index.js +2 -0
- package/es/configuration/libro-configuration-contribution.d.ts +5 -0
- package/es/configuration/libro-configuration-contribution.d.ts.map +1 -0
- package/es/configuration/libro-configuration-contribution.js +24 -0
- package/es/configuration/libro-configuration.d.ts +3 -0
- package/es/configuration/libro-configuration.d.ts.map +1 -0
- package/es/configuration/libro-configuration.js +12 -0
- package/es/contents/content-contribution.d.ts +7 -0
- package/es/contents/content-contribution.d.ts.map +1 -0
- package/es/contents/content-contribution.js +63 -0
- package/es/contents/index.d.ts +2 -0
- package/es/contents/index.d.ts.map +1 -0
- package/es/contents/index.js +1 -0
- package/es/file/file-name-alias.d.ts +7 -0
- package/es/file/file-name-alias.d.ts.map +1 -0
- package/es/file/file-name-alias.js +26 -0
- package/es/file/file-protocol.d.ts +8 -0
- package/es/file/file-protocol.d.ts.map +1 -0
- package/es/file/file-protocol.js +7 -0
- package/es/file/file-service.d.ts +31 -0
- package/es/file/file-service.d.ts.map +1 -0
- package/es/file/file-service.js +329 -0
- package/es/file/file-tree-label-provider.d.ts +13 -0
- package/es/file/file-tree-label-provider.d.ts.map +1 -0
- package/es/file/file-tree-label-provider.js +62 -0
- package/es/file/file-view/index.d.ts +14 -0
- package/es/file/file-view/index.d.ts.map +1 -0
- package/es/file/file-view/index.js +101 -0
- package/es/file/file-view/index.less +5 -0
- package/es/file/index.d.ts +7 -0
- package/es/file/index.d.ts.map +1 -0
- package/es/file/index.js +6 -0
- package/es/file/module.d.ts +3 -0
- package/es/file/module.d.ts.map +1 -0
- package/es/file/module.js +8 -0
- package/es/file/navigatable-view.d.ts +24 -0
- package/es/file/navigatable-view.d.ts.map +1 -0
- package/es/file/navigatable-view.js +151 -0
- package/es/file/open-handler-contribution.d.ts +11 -0
- package/es/file/open-handler-contribution.d.ts.map +1 -0
- package/es/file/open-handler-contribution.js +102 -0
- package/es/index.d.ts +32 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +31 -0
- package/es/keybind-instructions/index.d.ts +6 -0
- package/es/keybind-instructions/index.d.ts.map +1 -0
- package/es/keybind-instructions/index.js +5 -0
- package/es/keybind-instructions/index.less +177 -0
- package/es/keybind-instructions/keybind-instructions-contribution.d.ts +11 -0
- package/es/keybind-instructions/keybind-instructions-contribution.d.ts.map +1 -0
- package/es/keybind-instructions/keybind-instructions-contribution.js +84 -0
- package/es/keybind-instructions/keybind-instructions-icon.d.ts +3 -0
- package/es/keybind-instructions/keybind-instructions-icon.d.ts.map +1 -0
- package/es/keybind-instructions/keybind-instructions-icon.js +23 -0
- package/es/keybind-instructions/keybind-instructions-items.d.ts +14 -0
- package/es/keybind-instructions/keybind-instructions-items.d.ts.map +1 -0
- package/es/keybind-instructions/keybind-instructions-items.js +589 -0
- package/es/keybind-instructions/keybind-instructions-view.d.ts +16 -0
- package/es/keybind-instructions/keybind-instructions-view.d.ts.map +1 -0
- package/es/keybind-instructions/keybind-instructions-view.js +224 -0
- package/es/keybind-instructions/module.d.ts +3 -0
- package/es/keybind-instructions/module.d.ts.map +1 -0
- package/es/keybind-instructions/module.js +5 -0
- package/es/libro-jupyter-file-service.d.ts +106 -0
- package/es/libro-jupyter-file-service.d.ts.map +1 -0
- package/es/libro-jupyter-file-service.js +127 -0
- package/es/libro-jupyter-model.d.ts +49 -0
- package/es/libro-jupyter-model.d.ts.map +1 -0
- package/es/libro-jupyter-model.js +505 -0
- package/es/libro-jupyter-protocol.d.ts +38 -0
- package/es/libro-jupyter-protocol.d.ts.map +1 -0
- package/es/libro-jupyter-protocol.js +9 -0
- package/es/libro-jupyter-server-launch-manager.d.ts +11 -0
- package/es/libro-jupyter-server-launch-manager.d.ts.map +1 -0
- package/es/libro-jupyter-server-launch-manager.js +59 -0
- package/es/libro-jupyter-view.d.ts +10 -0
- package/es/libro-jupyter-view.d.ts.map +1 -0
- package/es/libro-jupyter-view.js +42 -0
- package/es/module.d.ts +3 -0
- package/es/module.d.ts.map +1 -0
- package/es/module.js +48 -0
- package/es/output/index.d.ts +2 -0
- package/es/output/index.d.ts.map +1 -0
- package/es/output/index.js +1 -0
- package/es/output/libro-jupyter-outputarea.d.ts +8 -0
- package/es/output/libro-jupyter-outputarea.d.ts.map +1 -0
- package/es/output/libro-jupyter-outputarea.js +77 -0
- package/es/rendermime/assets/plotly.svg +31 -0
- package/es/rendermime/index.d.ts +5 -0
- package/es/rendermime/index.d.ts.map +1 -0
- package/es/rendermime/index.js +4 -0
- package/es/rendermime/index.less +22 -0
- package/es/rendermime/module.d.ts +3 -0
- package/es/rendermime/module.d.ts.map +1 -0
- package/es/rendermime/module.js +3 -0
- package/es/rendermime/plotly-render.d.ts +7 -0
- package/es/rendermime/plotly-render.d.ts.map +1 -0
- package/es/rendermime/plotly-render.js +30 -0
- package/es/rendermime/plotly-renderers.d.ts +58 -0
- package/es/rendermime/plotly-renderers.d.ts.map +1 -0
- package/es/rendermime/plotly-renderers.js +211 -0
- package/es/rendermime/plotly-rendermime-contribution.d.ts +12 -0
- package/es/rendermime/plotly-rendermime-contribution.d.ts.map +1 -0
- package/es/rendermime/plotly-rendermime-contribution.js +22 -0
- package/es/theme/color-registry.d.ts +6 -0
- package/es/theme/color-registry.d.ts.map +1 -0
- package/es/theme/color-registry.js +393 -0
- package/es/theme/index.d.ts +2 -0
- package/es/theme/index.d.ts.map +1 -0
- package/es/theme/index.js +1 -0
- package/es/toolbar/index.d.ts +6 -0
- package/es/toolbar/index.d.ts.map +1 -0
- package/es/toolbar/index.js +5 -0
- package/es/toolbar/index.less +194 -0
- package/es/toolbar/kernel-selector-dropdown.d.ts +13 -0
- package/es/toolbar/kernel-selector-dropdown.d.ts.map +1 -0
- package/es/toolbar/kernel-selector-dropdown.js +165 -0
- package/es/toolbar/kernel-status-and-selector.d.ts +18 -0
- package/es/toolbar/kernel-status-and-selector.d.ts.map +1 -0
- package/es/toolbar/kernel-status-and-selector.js +164 -0
- package/es/toolbar/run-selector.d.ts +3 -0
- package/es/toolbar/run-selector.d.ts.map +1 -0
- package/es/toolbar/run-selector.js +98 -0
- package/es/toolbar/save-file-error-contribution.d.ts +5 -0
- package/es/toolbar/save-file-error-contribution.d.ts.map +1 -0
- package/es/toolbar/save-file-error-contribution.js +23 -0
- package/es/toolbar/save-file-error.d.ts +5 -0
- package/es/toolbar/save-file-error.d.ts.map +1 -0
- package/es/toolbar/save-file-error.js +27 -0
- package/es/toolbar/side-toolbar-run-selector.d.ts +3 -0
- package/es/toolbar/side-toolbar-run-selector.d.ts.map +1 -0
- package/es/toolbar/side-toolbar-run-selector.js +67 -0
- package/es/toolbar/toolbar-contribution.d.ts +9 -0
- package/es/toolbar/toolbar-contribution.d.ts.map +1 -0
- package/es/toolbar/toolbar-contribution.js +67 -0
- package/es/typings/index.d.ts +31 -0
- package/es/utils/index.d.ts +11 -0
- package/es/utils/index.d.ts.map +1 -0
- package/es/utils/index.js +47 -0
- package/package.json +75 -0
- package/src/add-between-cell/add-between-cell-command-contribution.ts +63 -0
- package/src/add-between-cell/add-between-cell.tsx +201 -0
- package/src/add-between-cell/index.less +103 -0
- package/src/add-between-cell/index.ts +2 -0
- package/src/add-between-cell/module.ts +13 -0
- package/src/cell/index.ts +2 -0
- package/src/cell/jupyter-code-cell-model.ts +36 -0
- package/src/cell/jupyter-code-cell-view.tsx +221 -0
- package/src/command/command-contribution.ts +163 -0
- package/src/command/index.ts +2 -0
- package/src/command/keybinding-contribution.ts +25 -0
- package/src/components/cell-execution-tip.tsx +107 -0
- package/src/components/cell-input-bottom-blank.tsx +24 -0
- package/src/components/icons.tsx +117 -0
- package/src/components/index.less +82 -0
- package/src/components/index.ts +3 -0
- package/src/config/config-contribution.ts +21 -0
- package/src/config/config.ts +14 -0
- package/src/config/index.ts +1 -0
- package/src/configuration/index.ts +2 -0
- package/src/configuration/libro-configuration-contribution.ts +11 -0
- package/src/configuration/libro-configuration.ts +14 -0
- package/src/contents/content-contribution.ts +32 -0
- package/src/contents/index.ts +1 -0
- package/src/file/file-name-alias.ts +15 -0
- package/src/file/file-protocol.ts +7 -0
- package/src/file/file-service.ts +179 -0
- package/src/file/file-tree-label-provider.ts +42 -0
- package/src/file/file-view/index.less +5 -0
- package/src/file/file-view/index.tsx +90 -0
- package/src/file/index.ts +6 -0
- package/src/file/module.ts +19 -0
- package/src/file/navigatable-view.tsx +93 -0
- package/src/file/open-handler-contribution.ts +44 -0
- package/src/index.ts +32 -0
- package/src/keybind-instructions/index.less +177 -0
- package/src/keybind-instructions/index.ts +5 -0
- package/src/keybind-instructions/keybind-instructions-contribution.ts +47 -0
- package/src/keybind-instructions/keybind-instructions-icon.tsx +28 -0
- package/src/keybind-instructions/keybind-instructions-items.tsx +597 -0
- package/src/keybind-instructions/keybind-instructions-view.tsx +239 -0
- package/src/keybind-instructions/module.ts +11 -0
- package/src/libro-jupyter-file-service.ts +158 -0
- package/src/libro-jupyter-model.ts +289 -0
- package/src/libro-jupyter-protocol.ts +59 -0
- package/src/libro-jupyter-server-launch-manager.ts +36 -0
- package/src/libro-jupyter-view.tsx +24 -0
- package/src/module.ts +105 -0
- package/src/output/index.ts +1 -0
- package/src/output/libro-jupyter-outputarea.tsx +71 -0
- package/src/rendermime/assets/plotly.svg +31 -0
- package/src/rendermime/index.less +13 -0
- package/src/rendermime/index.ts +4 -0
- package/src/rendermime/module.ts +7 -0
- package/src/rendermime/plotly-render.tsx +35 -0
- package/src/rendermime/plotly-renderers.ts +191 -0
- package/src/rendermime/plotly-rendermime-contribution.ts +15 -0
- package/src/theme/color-registry.ts +301 -0
- package/src/theme/index.ts +1 -0
- package/src/toolbar/index.less +194 -0
- package/src/toolbar/index.ts +5 -0
- package/src/toolbar/kernel-selector-dropdown.tsx +204 -0
- package/src/toolbar/kernel-status-and-selector.tsx +195 -0
- package/src/toolbar/run-selector.tsx +110 -0
- package/src/toolbar/save-file-error-contribution.ts +10 -0
- package/src/toolbar/save-file-error.tsx +35 -0
- package/src/toolbar/side-toolbar-run-selector.tsx +77 -0
- package/src/toolbar/toolbar-contribution.tsx +62 -0
- package/src/typings/index.d.ts +31 -0
- package/src/utils/index.ts +65 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _dec, _dec2, _dec3, _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 _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); } }
|
|
5
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
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); }
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
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
|
+
import { LibroCodeCellModel } from '@difizen/libro-codemirror-code-cell';
|
|
19
|
+
import { CellOptions } from '@difizen/libro-core';
|
|
20
|
+
import { inject, transient } from '@difizen/mana-app';
|
|
21
|
+
import { prop, ViewManager } from '@difizen/mana-app';
|
|
22
|
+
export var JupyterCodeCellModel = (_dec = transient(), _dec2 = prop(), _dec3 = prop(), _dec(_class = (_class2 = /*#__PURE__*/function (_LibroCodeCellModel) {
|
|
23
|
+
_inherits(JupyterCodeCellModel, _LibroCodeCellModel);
|
|
24
|
+
var _super = _createSuper(JupyterCodeCellModel);
|
|
25
|
+
function JupyterCodeCellModel(options, viewManager) {
|
|
26
|
+
var _options$cell;
|
|
27
|
+
var _this;
|
|
28
|
+
_classCallCheck(this, JupyterCodeCellModel);
|
|
29
|
+
_this = _super.call(this, options, viewManager);
|
|
30
|
+
_initializerDefineProperty(_this, "metadata", _descriptor, _assertThisInitialized(_this));
|
|
31
|
+
_initializerDefineProperty(_this, "kernelExecuting", _descriptor2, _assertThisInitialized(_this));
|
|
32
|
+
_this.clearExecution = function () {
|
|
33
|
+
_this.executeCount = null;
|
|
34
|
+
_this.executing = false;
|
|
35
|
+
_this.kernelExecuting = false;
|
|
36
|
+
_this.metadata.execution = {};
|
|
37
|
+
};
|
|
38
|
+
_this.metadata = ((_options$cell = options.cell) === null || _options$cell === void 0 ? void 0 : _options$cell.metadata) || {};
|
|
39
|
+
return _this;
|
|
40
|
+
}
|
|
41
|
+
JupyterCodeCellModel = inject(ViewManager)(JupyterCodeCellModel, undefined, 1) || JupyterCodeCellModel;
|
|
42
|
+
JupyterCodeCellModel = inject(CellOptions)(JupyterCodeCellModel, undefined, 0) || JupyterCodeCellModel;
|
|
43
|
+
return _createClass(JupyterCodeCellModel);
|
|
44
|
+
}(LibroCodeCellModel), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "metadata", [_dec2], {
|
|
45
|
+
configurable: true,
|
|
46
|
+
enumerable: true,
|
|
47
|
+
writable: true,
|
|
48
|
+
initializer: null
|
|
49
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "kernelExecuting", [_dec3], {
|
|
50
|
+
configurable: true,
|
|
51
|
+
enumerable: true,
|
|
52
|
+
writable: true,
|
|
53
|
+
initializer: function initializer() {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
})), _class2)) || _class);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" resolution-mode="require"/>
|
|
2
|
+
import type { CompletionProvider, TooltipProvider } from '@difizen/libro-code-editor';
|
|
3
|
+
import { LibroCodeCellView } from '@difizen/libro-codemirror-code-cell';
|
|
4
|
+
import type { CellViewOptions } from '@difizen/libro-core';
|
|
5
|
+
import { CellService } from '@difizen/libro-core';
|
|
6
|
+
import { ViewManager } from '@difizen/mana-app';
|
|
7
|
+
import type { JupyterCodeCellModel } from './jupyter-code-cell-model.js';
|
|
8
|
+
export declare class JupyterCodeCellView extends LibroCodeCellView {
|
|
9
|
+
view: import("react").ForwardRefExoticComponent<import("react").RefAttributes<HTMLDivElement>>;
|
|
10
|
+
model: JupyterCodeCellModel;
|
|
11
|
+
constructor(options: CellViewOptions, cellService: CellService, viewManager: ViewManager);
|
|
12
|
+
clearExecution: () => void;
|
|
13
|
+
onViewMount(): void;
|
|
14
|
+
tooltipProvider: TooltipProvider;
|
|
15
|
+
completionProvider: CompletionProvider;
|
|
16
|
+
run(): Promise<boolean>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=jupyter-code-cell-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jupyter-code-cell-view.d.ts","sourceRoot":"","sources":["../../src/cell/jupyter-code-cell-view.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAEV,kBAAkB,EAElB,eAAe,EAEhB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAkB,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,EAAsB,WAAW,EAAc,MAAM,mBAAmB,CAAC;AAQhF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAkBzE,qBAEa,mBAAoB,SAAQ,iBAAiB;IAC/C,IAAI,2FAA4B;IACjC,KAAK,EAAE,oBAAoB,CAAC;gBAGd,OAAO,EAAE,eAAe,EACvB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW;IAKtC,cAAc,aAGrB;IAEO,WAAW;IAgCpB,eAAe,EAAE,eAAe,CAqB9B;IAEF,kBAAkB,EAAE,kBAAkB,CA8BpC;IAEa,GAAG;CA0EnB"}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _dec, _dec2, _class;
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
7
|
+
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); } }
|
|
8
|
+
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); }); }; }
|
|
9
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
10
|
+
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); } }
|
|
11
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
|
+
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); }
|
|
14
|
+
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); }
|
|
15
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
16
|
+
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); }; }
|
|
17
|
+
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); }
|
|
18
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
19
|
+
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; } }
|
|
20
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
21
|
+
import { CodeEditorView } from '@difizen/libro-code-editor';
|
|
22
|
+
import { codeMirrorEditorFactory } from '@difizen/libro-codemirror';
|
|
23
|
+
import { CellEditorMemo, LibroCodeCellView } from '@difizen/libro-codemirror-code-cell';
|
|
24
|
+
import { CellService } from '@difizen/libro-core';
|
|
25
|
+
import { KernelError } from '@difizen/libro-kernel';
|
|
26
|
+
import { inject, transient } from '@difizen/mana-app';
|
|
27
|
+
import { view, ViewInstance, ViewManager, ViewOption } from '@difizen/mana-app';
|
|
28
|
+
import { getOrigin, useInject, watch } from '@difizen/mana-app';
|
|
29
|
+
import { l10n } from '@difizen/mana-l10n';
|
|
30
|
+
import { forwardRef } from 'react';
|
|
31
|
+
import { LibroJupyterModel } from "../libro-jupyter-model.js";
|
|
32
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
33
|
+
var JupyterCodeCellComponent = /*#__PURE__*/forwardRef(function JupyterCodeCellComponent(_props, ref) {
|
|
34
|
+
var instance = useInject(ViewInstance);
|
|
35
|
+
return /*#__PURE__*/_jsx("div", {
|
|
36
|
+
className: instance.className,
|
|
37
|
+
ref: ref,
|
|
38
|
+
tabIndex: 10,
|
|
39
|
+
onBlur: instance.blur,
|
|
40
|
+
children: /*#__PURE__*/_jsx(CellEditorMemo, {})
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
export var JupyterCodeCellView = (_dec = transient(), _dec2 = view('jupyter-code-cell-view'), _dec(_class = _dec2(_class = /*#__PURE__*/function (_LibroCodeCellView) {
|
|
44
|
+
_inherits(JupyterCodeCellView, _LibroCodeCellView);
|
|
45
|
+
var _super = _createSuper(JupyterCodeCellView);
|
|
46
|
+
function JupyterCodeCellView(options, cellService, viewManager) {
|
|
47
|
+
var _this;
|
|
48
|
+
_classCallCheck(this, JupyterCodeCellView);
|
|
49
|
+
_this = _super.call(this, options, cellService, viewManager);
|
|
50
|
+
_this.view = JupyterCodeCellComponent;
|
|
51
|
+
_this.clearExecution = function () {
|
|
52
|
+
_this.model.clearExecution();
|
|
53
|
+
_this.outputArea.clear();
|
|
54
|
+
};
|
|
55
|
+
_this.tooltipProvider = /*#__PURE__*/function () {
|
|
56
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(option) {
|
|
57
|
+
var cellContent, kernelConnection, reply, value;
|
|
58
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
59
|
+
while (1) switch (_context.prev = _context.next) {
|
|
60
|
+
case 0:
|
|
61
|
+
cellContent = _this.model.value;
|
|
62
|
+
kernelConnection = getOrigin(_this.parent.model.kernelConnection);
|
|
63
|
+
if (kernelConnection) {
|
|
64
|
+
_context.next = 5;
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
alert(l10n.t('Kernel Connection 还没有建立'));
|
|
68
|
+
return _context.abrupt("return", null);
|
|
69
|
+
case 5:
|
|
70
|
+
_context.next = 7;
|
|
71
|
+
return kernelConnection.requestInspect({
|
|
72
|
+
code: cellContent,
|
|
73
|
+
cursor_pos: option.cursorPosition,
|
|
74
|
+
detail_level: 1
|
|
75
|
+
});
|
|
76
|
+
case 7:
|
|
77
|
+
reply = _context.sent;
|
|
78
|
+
value = reply.content;
|
|
79
|
+
if (!(value.status !== 'ok' || !value.found)) {
|
|
80
|
+
_context.next = 11;
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
return _context.abrupt("return", null);
|
|
84
|
+
case 11:
|
|
85
|
+
return _context.abrupt("return", value.data['text/plain']);
|
|
86
|
+
case 12:
|
|
87
|
+
case "end":
|
|
88
|
+
return _context.stop();
|
|
89
|
+
}
|
|
90
|
+
}, _callee);
|
|
91
|
+
}));
|
|
92
|
+
return function (_x) {
|
|
93
|
+
return _ref.apply(this, arguments);
|
|
94
|
+
};
|
|
95
|
+
}();
|
|
96
|
+
_this.completionProvider = /*#__PURE__*/function () {
|
|
97
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(option) {
|
|
98
|
+
var cellContent, kernelConnection, reply, value;
|
|
99
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
100
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
101
|
+
case 0:
|
|
102
|
+
cellContent = _this.model.value;
|
|
103
|
+
kernelConnection = getOrigin(_this.parent.model.kernelConnection);
|
|
104
|
+
if (kernelConnection) {
|
|
105
|
+
_context2.next = 5;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
alert(l10n.t('Kernel Connection 还没有建立'));
|
|
109
|
+
throw new Error(l10n.t('Kernel Connection 还没有建立'));
|
|
110
|
+
case 5:
|
|
111
|
+
_context2.next = 7;
|
|
112
|
+
return kernelConnection.requestComplete({
|
|
113
|
+
code: cellContent,
|
|
114
|
+
cursor_pos: option.cursorPosition
|
|
115
|
+
});
|
|
116
|
+
case 7:
|
|
117
|
+
reply = _context2.sent;
|
|
118
|
+
value = reply.content;
|
|
119
|
+
if (!(value.status === 'abort')) {
|
|
120
|
+
_context2.next = 11;
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
throw new Error('abort');
|
|
124
|
+
case 11:
|
|
125
|
+
if (!(value.status === 'error')) {
|
|
126
|
+
_context2.next = 13;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
throw new Error(value.ename);
|
|
130
|
+
case 13:
|
|
131
|
+
return _context2.abrupt("return", {
|
|
132
|
+
matches: value.matches,
|
|
133
|
+
cursor_start: value.cursor_start,
|
|
134
|
+
cursor_end: value.cursor_end,
|
|
135
|
+
metadata: value.metadata
|
|
136
|
+
});
|
|
137
|
+
case 14:
|
|
138
|
+
case "end":
|
|
139
|
+
return _context2.stop();
|
|
140
|
+
}
|
|
141
|
+
}, _callee2);
|
|
142
|
+
}));
|
|
143
|
+
return function (_x2) {
|
|
144
|
+
return _ref2.apply(this, arguments);
|
|
145
|
+
};
|
|
146
|
+
}();
|
|
147
|
+
return _this;
|
|
148
|
+
}
|
|
149
|
+
JupyterCodeCellView = inject(ViewManager)(JupyterCodeCellView, undefined, 2) || JupyterCodeCellView;
|
|
150
|
+
JupyterCodeCellView = inject(CellService)(JupyterCodeCellView, undefined, 1) || JupyterCodeCellView;
|
|
151
|
+
JupyterCodeCellView = inject(ViewOption)(JupyterCodeCellView, undefined, 0) || JupyterCodeCellView;
|
|
152
|
+
_createClass(JupyterCodeCellView, [{
|
|
153
|
+
key: "onViewMount",
|
|
154
|
+
value: function onViewMount() {
|
|
155
|
+
var _this2 = this;
|
|
156
|
+
var option = _objectSpread(_objectSpread({}, this.options), {}, {
|
|
157
|
+
factory: function factory(editorOption) {
|
|
158
|
+
return codeMirrorEditorFactory(_objectSpread(_objectSpread({}, editorOption), {}, {
|
|
159
|
+
config: _objectSpread(_objectSpread({}, editorOption.config), {
|
|
160
|
+
readOnly: _this2.parent.model.readOnly
|
|
161
|
+
})
|
|
162
|
+
}));
|
|
163
|
+
},
|
|
164
|
+
model: this.model,
|
|
165
|
+
tooltipProvider: this.tooltipProvider,
|
|
166
|
+
completionProvider: this.completionProvider,
|
|
167
|
+
lspProvider: undefined
|
|
168
|
+
});
|
|
169
|
+
this.viewManager.getOrCreateView(CodeEditorView, option).then(function (editorView) {
|
|
170
|
+
_this2.editorView = editorView;
|
|
171
|
+
_this2.editorViewReadyDeferred.resolve();
|
|
172
|
+
watch(_this2.parent.model, 'readOnly', function () {
|
|
173
|
+
var _this2$editorView, _this2$editorView$edi;
|
|
174
|
+
(_this2$editorView = _this2.editorView) === null || _this2$editorView === void 0 ? void 0 : (_this2$editorView$edi = _this2$editorView.editor) === null || _this2$editorView$edi === void 0 ? void 0 : _this2$editorView$edi.setOption('readOnly', _this2.parent.model.readOnly);
|
|
175
|
+
});
|
|
176
|
+
_this2.editorView.onModalChange(function (val) {
|
|
177
|
+
return _this2.hasModal = val;
|
|
178
|
+
});
|
|
179
|
+
return;
|
|
180
|
+
}).catch(function () {
|
|
181
|
+
//
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}, {
|
|
185
|
+
key: "run",
|
|
186
|
+
value: function () {
|
|
187
|
+
var _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
188
|
+
var libroModel, kernelConnection, cellContent, cellModel, future, startTimeStr, msgPromise, endTimeStr;
|
|
189
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
190
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
191
|
+
case 0:
|
|
192
|
+
libroModel = this.parent.model;
|
|
193
|
+
if (!(!libroModel || !(libroModel instanceof LibroJupyterModel) || !libroModel.kernelConnection || libroModel.kernelConnection.isDisposed)) {
|
|
194
|
+
_context3.next = 3;
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
return _context3.abrupt("return", false);
|
|
198
|
+
case 3:
|
|
199
|
+
kernelConnection = getOrigin(libroModel.kernelConnection);
|
|
200
|
+
cellContent = this.model.value;
|
|
201
|
+
cellModel = this.model;
|
|
202
|
+
_context3.prev = 6;
|
|
203
|
+
this.clearExecution();
|
|
204
|
+
future = kernelConnection.requestExecute({
|
|
205
|
+
code: cellContent
|
|
206
|
+
});
|
|
207
|
+
startTimeStr = '';
|
|
208
|
+
cellModel.executing = true;
|
|
209
|
+
cellModel.metadata['execution'] = {
|
|
210
|
+
'shell.execute_reply.started': '',
|
|
211
|
+
'shell.execute_reply.end': '',
|
|
212
|
+
to_execute: new Date().toISOString()
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
// Handle iopub messages
|
|
216
|
+
future.onIOPub = function (msg) {
|
|
217
|
+
cellModel.msgChangeEmitter.fire(msg);
|
|
218
|
+
if (msg.header.msg_type === 'execute_input') {
|
|
219
|
+
cellModel.kernelExecuting = true;
|
|
220
|
+
startTimeStr = msg.header.date;
|
|
221
|
+
var meta = cellModel.metadata['execution'];
|
|
222
|
+
if (meta) {
|
|
223
|
+
meta['shell.execute_reply.started'] = startTimeStr;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
// Handle the execute reply.
|
|
228
|
+
future.onReply = function (msg) {
|
|
229
|
+
cellModel.msgChangeEmitter.fire(msg);
|
|
230
|
+
};
|
|
231
|
+
_context3.next = 16;
|
|
232
|
+
return future.done;
|
|
233
|
+
case 16:
|
|
234
|
+
msgPromise = _context3.sent;
|
|
235
|
+
cellModel.executing = false;
|
|
236
|
+
cellModel.kernelExecuting = false;
|
|
237
|
+
startTimeStr = msgPromise.metadata['started'];
|
|
238
|
+
endTimeStr = msgPromise.header.date;
|
|
239
|
+
cellModel.metadata['execution']['shell.execute_reply.started'] = startTimeStr;
|
|
240
|
+
cellModel.metadata['execution']['shell.execute_reply.end'] = endTimeStr;
|
|
241
|
+
if (msgPromise) {
|
|
242
|
+
_context3.next = 25;
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
return _context3.abrupt("return", true);
|
|
246
|
+
case 25:
|
|
247
|
+
if (!(msgPromise.content.status === 'ok')) {
|
|
248
|
+
_context3.next = 29;
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
return _context3.abrupt("return", true);
|
|
252
|
+
case 29:
|
|
253
|
+
throw new KernelError(msgPromise.content);
|
|
254
|
+
case 30:
|
|
255
|
+
_context3.next = 37;
|
|
256
|
+
break;
|
|
257
|
+
case 32:
|
|
258
|
+
_context3.prev = 32;
|
|
259
|
+
_context3.t0 = _context3["catch"](6);
|
|
260
|
+
if (!_context3.t0.message.startsWith('Canceled')) {
|
|
261
|
+
_context3.next = 36;
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
return _context3.abrupt("return", false);
|
|
265
|
+
case 36:
|
|
266
|
+
throw _context3.t0;
|
|
267
|
+
case 37:
|
|
268
|
+
case "end":
|
|
269
|
+
return _context3.stop();
|
|
270
|
+
}
|
|
271
|
+
}, _callee3, this, [[6, 32]]);
|
|
272
|
+
}));
|
|
273
|
+
function run() {
|
|
274
|
+
return _run.apply(this, arguments);
|
|
275
|
+
}
|
|
276
|
+
return run;
|
|
277
|
+
}()
|
|
278
|
+
}]);
|
|
279
|
+
return JupyterCodeCellView;
|
|
280
|
+
}(LibroCodeCellView)) || _class) || _class);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LibroCommandRegister, LibroService } from '@difizen/libro-core';
|
|
2
|
+
import type { CommandRegistry } from '@difizen/mana-app';
|
|
3
|
+
import { CommandContribution, ModalService } from '@difizen/mana-app';
|
|
4
|
+
export declare class LibroJupyterCommandContribution implements CommandContribution {
|
|
5
|
+
protected readonly modalService: ModalService;
|
|
6
|
+
protected readonly libroCommand: LibroCommandRegister;
|
|
7
|
+
protected readonly libroService: LibroService;
|
|
8
|
+
registerCommands(command: CommandRegistry): void;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=command-contribution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-contribution.d.ts","sourceRoot":"","sources":["../../src/command/command-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,oBAAoB,EACpB,YAAY,EAMb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EACL,mBAAmB,EAEnB,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAK3B,qBACa,+BAAgC,YAAW,mBAAmB;IACnD,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACtC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,oBAAoB,CAAC;IAC9D,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAEpE,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;CAuIjD"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _dec, _dec2, _dec3, _dec4, _class, _class2, _descriptor, _descriptor2, _descriptor3;
|
|
3
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
4
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
5
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
6
|
+
function _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 }); }
|
|
7
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
8
|
+
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); } }
|
|
9
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
10
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
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.'); }
|
|
14
|
+
import { KernelCommands, LibroCommandRegister, LibroService, LibroToolbarArea, LibroView, NotebookCommands, LibroCellView, ExecutableCellView } from '@difizen/libro-core';
|
|
15
|
+
import { CommandContribution, inject, ModalService, singleton } from '@difizen/mana-app';
|
|
16
|
+
import { LibroJupyterModel } from "../libro-jupyter-model.js";
|
|
17
|
+
import { ExecutedWithKernelCellModel } from "../libro-jupyter-protocol.js";
|
|
18
|
+
export var LibroJupyterCommandContribution = (_dec = singleton({
|
|
19
|
+
contrib: CommandContribution
|
|
20
|
+
}), _dec2 = inject(ModalService), _dec3 = inject(LibroCommandRegister), _dec4 = inject(LibroService), _dec(_class = (_class2 = /*#__PURE__*/function () {
|
|
21
|
+
function LibroJupyterCommandContribution() {
|
|
22
|
+
_classCallCheck(this, LibroJupyterCommandContribution);
|
|
23
|
+
_initializerDefineProperty(this, "modalService", _descriptor, this);
|
|
24
|
+
_initializerDefineProperty(this, "libroCommand", _descriptor2, this);
|
|
25
|
+
_initializerDefineProperty(this, "libroService", _descriptor3, this);
|
|
26
|
+
}
|
|
27
|
+
_createClass(LibroJupyterCommandContribution, [{
|
|
28
|
+
key: "registerCommands",
|
|
29
|
+
value: function registerCommands(command) {
|
|
30
|
+
this.libroCommand.registerLibroCommand(command, KernelCommands['ShowKernelStatusAndSelector'], {
|
|
31
|
+
execute: function () {
|
|
32
|
+
var _execute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_cell, libro) {
|
|
33
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
34
|
+
while (1) switch (_context.prev = _context.next) {
|
|
35
|
+
case 0:
|
|
36
|
+
if (!(!libro || !(libro instanceof LibroView))) {
|
|
37
|
+
_context.next = 2;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
return _context.abrupt("return");
|
|
41
|
+
case 2:
|
|
42
|
+
case "end":
|
|
43
|
+
return _context.stop();
|
|
44
|
+
}
|
|
45
|
+
}, _callee);
|
|
46
|
+
}));
|
|
47
|
+
function execute(_x, _x2) {
|
|
48
|
+
return _execute.apply(this, arguments);
|
|
49
|
+
}
|
|
50
|
+
return execute;
|
|
51
|
+
}(),
|
|
52
|
+
isVisible: function isVisible(_cell, libro, path) {
|
|
53
|
+
if (!libro || !(libro instanceof LibroView)) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return !(libro !== null && libro !== void 0 && libro.model.quickEditMode) && !(libro !== null && libro !== void 0 && libro.model.readOnly) && path === LibroToolbarArea.HeaderLeft;
|
|
57
|
+
},
|
|
58
|
+
isEnabled: function isEnabled(_cell, libro) {
|
|
59
|
+
if (!libro || !(libro instanceof LibroView)) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
this.libroCommand.registerLibroCommand(command, NotebookCommands['TopToolbarRunSelect'], {
|
|
66
|
+
execute: function execute() {
|
|
67
|
+
//
|
|
68
|
+
},
|
|
69
|
+
isVisible: function isVisible(cell, libro, path) {
|
|
70
|
+
if (!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView)) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (path !== LibroToolbarArea.HeaderCenter || libro.model.quickEditMode || libro.model.readOnly) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
return !!cell;
|
|
77
|
+
},
|
|
78
|
+
isEnabled: function isEnabled(_cell, libro) {
|
|
79
|
+
if (!libro || !(libro instanceof LibroView)) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
return libro.model.kernelConnection !== undefined && libro.model.kernelConnecting === false;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
this.libroCommand.registerLibroCommand(command, NotebookCommands['SideToolbarRunSelect'], {
|
|
86
|
+
execute: function execute() {
|
|
87
|
+
//
|
|
88
|
+
},
|
|
89
|
+
isVisible: function isVisible(cell, libro, path) {
|
|
90
|
+
if (!cell || !libro || !ExecutableCellView.is(cell) || !(libro instanceof LibroView)) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
return !(libro !== null && libro !== void 0 && libro.model.quickEditMode) && !(libro !== null && libro !== void 0 && libro.model.readOnly) && path === LibroToolbarArea.CellRight;
|
|
94
|
+
},
|
|
95
|
+
isEnabled: function isEnabled(_cell, libro) {
|
|
96
|
+
if (!libro || !(libro instanceof LibroView)) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
return libro.model.kernelConnection !== undefined && libro.model.kernelConnecting === false;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
this.libroCommand.registerLibroCommand(command, NotebookCommands['SelectLastRunCell'], {
|
|
103
|
+
execute: function () {
|
|
104
|
+
var _execute2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_cell, libro) {
|
|
105
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
106
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
107
|
+
case 0:
|
|
108
|
+
if (!(!libro || !(libro instanceof LibroView))) {
|
|
109
|
+
_context2.next = 2;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
return _context2.abrupt("return");
|
|
113
|
+
case 2:
|
|
114
|
+
if (libro.model instanceof LibroJupyterModel) {
|
|
115
|
+
libro.model.findRunningCell();
|
|
116
|
+
}
|
|
117
|
+
case 3:
|
|
118
|
+
case "end":
|
|
119
|
+
return _context2.stop();
|
|
120
|
+
}
|
|
121
|
+
}, _callee2);
|
|
122
|
+
}));
|
|
123
|
+
function execute(_x3, _x4) {
|
|
124
|
+
return _execute2.apply(this, arguments);
|
|
125
|
+
}
|
|
126
|
+
return execute;
|
|
127
|
+
}(),
|
|
128
|
+
isVisible: function isVisible(_cell, libro, path) {
|
|
129
|
+
if (!libro || !(libro instanceof LibroView)) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
return path === LibroToolbarArea.HeaderCenter && !libro.model.readOnly;
|
|
133
|
+
},
|
|
134
|
+
isEnabled: function isEnabled(_cell, libro) {
|
|
135
|
+
if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
return libro.model.getCells().findIndex(function (item) {
|
|
139
|
+
return ExecutedWithKernelCellModel.is(item.model) && item.model.kernelExecuting;
|
|
140
|
+
}) >= 0;
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}]);
|
|
145
|
+
return LibroJupyterCommandContribution;
|
|
146
|
+
}(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "modalService", [_dec2], {
|
|
147
|
+
configurable: true,
|
|
148
|
+
enumerable: true,
|
|
149
|
+
writable: true,
|
|
150
|
+
initializer: null
|
|
151
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "libroCommand", [_dec3], {
|
|
152
|
+
configurable: true,
|
|
153
|
+
enumerable: true,
|
|
154
|
+
writable: true,
|
|
155
|
+
initializer: null
|
|
156
|
+
}), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "libroService", [_dec4], {
|
|
157
|
+
configurable: true,
|
|
158
|
+
enumerable: true,
|
|
159
|
+
writable: true,
|
|
160
|
+
initializer: null
|
|
161
|
+
})), _class2)) || _class);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LibroCommandRegister } from '@difizen/libro-core';
|
|
2
|
+
import { KeybindingRegistry, KeybindingContribution } from '@difizen/mana-app';
|
|
3
|
+
export declare class LibroJupyterKeybindingContribution implements KeybindingContribution {
|
|
4
|
+
protected readonly libroCommand: LibroCommandRegister;
|
|
5
|
+
constructor(keybindRegistry: KeybindingRegistry);
|
|
6
|
+
registerKeybindings(keybindings: KeybindingRegistry): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=keybinding-contribution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keybinding-contribution.d.ts","sourceRoot":"","sources":["../../src/command/keybinding-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,kBAAkB,EAElB,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,qBACa,kCAAmC,YAAW,sBAAsB;IACjD,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,oBAAoB,CAAC;gBAC5C,eAAe,EAAE,kBAAkB;IAK3E,mBAAmB,CAAC,WAAW,EAAE,kBAAkB;CAIpD"}
|