@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,505 @@
|
|
|
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, _dec5, _dec6, _dec7, _dec8, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7;
|
|
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 _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); }
|
|
13
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
14
|
+
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); }; }
|
|
15
|
+
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); }
|
|
16
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
17
|
+
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; } }
|
|
18
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
19
|
+
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; }
|
|
20
|
+
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.'); }
|
|
21
|
+
import { LibroModel } from '@difizen/libro-core';
|
|
22
|
+
import { LibroKernelConnectionManager, ServerManager, ContentsManager, ServerConnection } from '@difizen/libro-kernel';
|
|
23
|
+
import { prop, ModalService, getOrigin } from '@difizen/mana-app';
|
|
24
|
+
import { inject, transient } from '@difizen/mana-app';
|
|
25
|
+
import { Deferred } from '@difizen/mana-app';
|
|
26
|
+
import { l10n } from '@difizen/mana-l10n';
|
|
27
|
+
import { LibroFileService, ExecutedWithKernelCellModel } from "./libro-jupyter-protocol.js";
|
|
28
|
+
import { SaveFileErrorModal } from "./toolbar/save-file-error.js";
|
|
29
|
+
import { getDefaultKernel } from "./utils/index.js";
|
|
30
|
+
export var LibroJupyterModel = (_dec = transient(), _dec2 = prop(), _dec3 = prop(), _dec4 = prop(), _dec5 = prop(), _dec6 = prop(), _dec7 = prop(), _dec8 = prop(), _dec(_class = (_class2 = /*#__PURE__*/function (_LibroModel) {
|
|
31
|
+
_inherits(LibroJupyterModel, _LibroModel);
|
|
32
|
+
var _super = _createSuper(LibroJupyterModel);
|
|
33
|
+
function LibroJupyterModel(libroFileService, kernelConnectionManager, serverManager, serverConnection, contentsManager, modalService) {
|
|
34
|
+
var _this;
|
|
35
|
+
_classCallCheck(this, LibroJupyterModel);
|
|
36
|
+
_this = _super.call(this);
|
|
37
|
+
_this.libroFileService = void 0;
|
|
38
|
+
_initializerDefineProperty(_this, "currentFileContents", _descriptor, _assertThisInitialized(_this));
|
|
39
|
+
_initializerDefineProperty(_this, "kernelSelect", _descriptor2, _assertThisInitialized(_this));
|
|
40
|
+
_initializerDefineProperty(_this, "kernelStatus", _descriptor3, _assertThisInitialized(_this));
|
|
41
|
+
_initializerDefineProperty(_this, "kernelConnection", _descriptor4, _assertThisInitialized(_this));
|
|
42
|
+
_initializerDefineProperty(_this, "lspEnabled", _descriptor5, _assertThisInitialized(_this));
|
|
43
|
+
_this.kernelConnectionManager = void 0;
|
|
44
|
+
_this.serverManager = void 0;
|
|
45
|
+
_this.serverConnection = void 0;
|
|
46
|
+
_this.contentsManager = void 0;
|
|
47
|
+
_this.modalService = void 0;
|
|
48
|
+
_this.kcDeferred = new Deferred();
|
|
49
|
+
_initializerDefineProperty(_this, "kernelConnecting", _descriptor6, _assertThisInitialized(_this));
|
|
50
|
+
_initializerDefineProperty(_this, "filePath", _descriptor7, _assertThisInitialized(_this));
|
|
51
|
+
_this.last_modified = '';
|
|
52
|
+
_this.latestCheckPointModel = void 0;
|
|
53
|
+
_this.kernelSelection = getDefaultKernel();
|
|
54
|
+
_this.libroFileService = libroFileService;
|
|
55
|
+
_this.kernelConnectionManager = kernelConnectionManager;
|
|
56
|
+
_this.serverManager = serverManager;
|
|
57
|
+
_this.serverConnection = serverConnection;
|
|
58
|
+
_this.contentsManager = contentsManager;
|
|
59
|
+
_this.modalService = modalService;
|
|
60
|
+
_this.dndAreaNullEnable = true;
|
|
61
|
+
return _this;
|
|
62
|
+
}
|
|
63
|
+
LibroJupyterModel = inject(ModalService)(LibroJupyterModel, undefined, 5) || LibroJupyterModel;
|
|
64
|
+
LibroJupyterModel = inject(ContentsManager)(LibroJupyterModel, undefined, 4) || LibroJupyterModel;
|
|
65
|
+
LibroJupyterModel = inject(ServerConnection)(LibroJupyterModel, undefined, 3) || LibroJupyterModel;
|
|
66
|
+
LibroJupyterModel = inject(ServerManager)(LibroJupyterModel, undefined, 2) || LibroJupyterModel;
|
|
67
|
+
LibroJupyterModel = inject(LibroKernelConnectionManager)(LibroJupyterModel, undefined, 1) || LibroJupyterModel;
|
|
68
|
+
LibroJupyterModel = inject(LibroFileService)(LibroJupyterModel, undefined, 0) || LibroJupyterModel;
|
|
69
|
+
_createClass(LibroJupyterModel, [{
|
|
70
|
+
key: "fileService",
|
|
71
|
+
get: function get() {
|
|
72
|
+
return this.libroFileService;
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
key: "isKernelIdle",
|
|
76
|
+
get: function get() {
|
|
77
|
+
return this.kernelConnection && this.kernelConnection.status === 'idle';
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
key: "kernelSelection",
|
|
81
|
+
get: function get() {
|
|
82
|
+
return this.kernelSelect;
|
|
83
|
+
},
|
|
84
|
+
set: function set(value) {
|
|
85
|
+
this.kernelSelect = value;
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
key: "currentKernelStatus",
|
|
89
|
+
get: function get() {
|
|
90
|
+
return this.kernelStatus;
|
|
91
|
+
},
|
|
92
|
+
set: function set(value) {
|
|
93
|
+
this.kernelStatus = value;
|
|
94
|
+
}
|
|
95
|
+
}, {
|
|
96
|
+
key: "kcReady",
|
|
97
|
+
get: function get() {
|
|
98
|
+
return this.kcDeferred.promise;
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
key: "lastModified",
|
|
102
|
+
get: function get() {
|
|
103
|
+
return this.last_modified;
|
|
104
|
+
},
|
|
105
|
+
set: function set(value) {
|
|
106
|
+
this.last_modified = value;
|
|
107
|
+
}
|
|
108
|
+
}, {
|
|
109
|
+
key: "createCheckpoint",
|
|
110
|
+
value: function () {
|
|
111
|
+
var _createCheckpoint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
112
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
113
|
+
while (1) switch (_context.prev = _context.next) {
|
|
114
|
+
case 0:
|
|
115
|
+
_context.next = 2;
|
|
116
|
+
return this.contentsManager.createCheckpoint(this.filePath);
|
|
117
|
+
case 2:
|
|
118
|
+
this.latestCheckPointModel = _context.sent;
|
|
119
|
+
case 3:
|
|
120
|
+
case "end":
|
|
121
|
+
return _context.stop();
|
|
122
|
+
}
|
|
123
|
+
}, _callee, this);
|
|
124
|
+
}));
|
|
125
|
+
function createCheckpoint() {
|
|
126
|
+
return _createCheckpoint.apply(this, arguments);
|
|
127
|
+
}
|
|
128
|
+
return createCheckpoint;
|
|
129
|
+
}()
|
|
130
|
+
}, {
|
|
131
|
+
key: "listCheckpoints",
|
|
132
|
+
value: function () {
|
|
133
|
+
var _listCheckpoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
134
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
135
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
136
|
+
case 0:
|
|
137
|
+
_context2.next = 2;
|
|
138
|
+
return this.contentsManager.listCheckpoints(this.filePath);
|
|
139
|
+
case 2:
|
|
140
|
+
case "end":
|
|
141
|
+
return _context2.stop();
|
|
142
|
+
}
|
|
143
|
+
}, _callee2, this);
|
|
144
|
+
}));
|
|
145
|
+
function listCheckpoints() {
|
|
146
|
+
return _listCheckpoints.apply(this, arguments);
|
|
147
|
+
}
|
|
148
|
+
return listCheckpoints;
|
|
149
|
+
}()
|
|
150
|
+
}, {
|
|
151
|
+
key: "restoreCheckpoint",
|
|
152
|
+
value: function () {
|
|
153
|
+
var _restoreCheckpoint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(checkpointID) {
|
|
154
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
155
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
156
|
+
case 0:
|
|
157
|
+
_context3.next = 2;
|
|
158
|
+
return this.contentsManager.restoreCheckpoint(this.filePath, checkpointID);
|
|
159
|
+
case 2:
|
|
160
|
+
case "end":
|
|
161
|
+
return _context3.stop();
|
|
162
|
+
}
|
|
163
|
+
}, _callee3, this);
|
|
164
|
+
}));
|
|
165
|
+
function restoreCheckpoint(_x) {
|
|
166
|
+
return _restoreCheckpoint.apply(this, arguments);
|
|
167
|
+
}
|
|
168
|
+
return restoreCheckpoint;
|
|
169
|
+
}()
|
|
170
|
+
}, {
|
|
171
|
+
key: "deleteCheckpoint",
|
|
172
|
+
value: function () {
|
|
173
|
+
var _deleteCheckpoint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(checkpointID) {
|
|
174
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
175
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
176
|
+
case 0:
|
|
177
|
+
_context4.next = 2;
|
|
178
|
+
return this.contentsManager.deleteCheckpoint(this.filePath, checkpointID);
|
|
179
|
+
case 2:
|
|
180
|
+
case "end":
|
|
181
|
+
return _context4.stop();
|
|
182
|
+
}
|
|
183
|
+
}, _callee4, this);
|
|
184
|
+
}));
|
|
185
|
+
function deleteCheckpoint(_x2) {
|
|
186
|
+
return _deleteCheckpoint.apply(this, arguments);
|
|
187
|
+
}
|
|
188
|
+
return deleteCheckpoint;
|
|
189
|
+
}()
|
|
190
|
+
}, {
|
|
191
|
+
key: "startKernelConnection",
|
|
192
|
+
value: function startKernelConnection() {
|
|
193
|
+
var _this2 = this;
|
|
194
|
+
this.kernelConnecting = true;
|
|
195
|
+
var fileInfo = this.currentFileContents;
|
|
196
|
+
this.serverManager.ready.then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
197
|
+
var kernelConnection, kc;
|
|
198
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
199
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
200
|
+
case 0:
|
|
201
|
+
kernelConnection = _this2.kernelConnectionManager.getKernelConnection(fileInfo);
|
|
202
|
+
if (!kernelConnection) {
|
|
203
|
+
_context5.next = 7;
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
_this2.kernelConnection = kernelConnection;
|
|
207
|
+
_this2.kcDeferred.resolve(_this2.kernelConnection);
|
|
208
|
+
_this2.kernelConnecting = false;
|
|
209
|
+
_context5.next = 15;
|
|
210
|
+
break;
|
|
211
|
+
case 7:
|
|
212
|
+
_context5.next = 9;
|
|
213
|
+
return _this2.kernelConnectionManager.startNew(_this2.currentFileContents);
|
|
214
|
+
case 9:
|
|
215
|
+
kc = _context5.sent;
|
|
216
|
+
if (kc) {
|
|
217
|
+
_context5.next = 12;
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
return _context5.abrupt("return");
|
|
221
|
+
case 12:
|
|
222
|
+
_this2.kernelConnection = kc;
|
|
223
|
+
_this2.kcDeferred.resolve(kc);
|
|
224
|
+
_this2.kernelConnecting = false;
|
|
225
|
+
case 15:
|
|
226
|
+
return _context5.abrupt("return");
|
|
227
|
+
case 16:
|
|
228
|
+
case "end":
|
|
229
|
+
return _context5.stop();
|
|
230
|
+
}
|
|
231
|
+
}, _callee5);
|
|
232
|
+
}))).catch(function () {
|
|
233
|
+
//
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}, {
|
|
237
|
+
key: "saveNotebookContent",
|
|
238
|
+
value: function () {
|
|
239
|
+
var _saveNotebookContent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
240
|
+
var notebookContent, res, _res, errorMsg;
|
|
241
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
242
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
243
|
+
case 0:
|
|
244
|
+
notebookContent = this.toJSON();
|
|
245
|
+
if (this.currentFileContents) {
|
|
246
|
+
_context6.next = 3;
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
throw new Error('currentFileContents is undefined');
|
|
250
|
+
case 3:
|
|
251
|
+
res = {};
|
|
252
|
+
_context6.prev = 4;
|
|
253
|
+
_context6.next = 7;
|
|
254
|
+
return this.libroFileService.write(notebookContent, this.currentFileContents);
|
|
255
|
+
case 7:
|
|
256
|
+
res = _context6.sent;
|
|
257
|
+
if (res) {
|
|
258
|
+
_context6.next = 10;
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
return _context6.abrupt("return");
|
|
262
|
+
case 10:
|
|
263
|
+
if (!(res.last_modified === this.last_modified || res.size === 0)) {
|
|
264
|
+
_context6.next = 15;
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
errorMsg = "File Save Error: ".concat((_res = res) === null || _res === void 0 ? void 0 : _res.message, " ");
|
|
268
|
+
this.libroFileService.fileSaveErrorEmitter.fire({
|
|
269
|
+
cause: res.message,
|
|
270
|
+
msg: errorMsg,
|
|
271
|
+
name: res.name,
|
|
272
|
+
path: res.path,
|
|
273
|
+
created: res.created,
|
|
274
|
+
last_modified: res.last_modified,
|
|
275
|
+
size: res.size,
|
|
276
|
+
type: res.type
|
|
277
|
+
});
|
|
278
|
+
this.modalService.openModal(SaveFileErrorModal);
|
|
279
|
+
throw new Error(errorMsg);
|
|
280
|
+
case 15:
|
|
281
|
+
_context6.next = 24;
|
|
282
|
+
break;
|
|
283
|
+
case 17:
|
|
284
|
+
_context6.prev = 17;
|
|
285
|
+
_context6.t0 = _context6["catch"](4);
|
|
286
|
+
if (res) {
|
|
287
|
+
_context6.next = 21;
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
return _context6.abrupt("return");
|
|
291
|
+
case 21:
|
|
292
|
+
this.libroFileService.fileSaveErrorEmitter.fire({
|
|
293
|
+
cause: _context6.t0.errorCause,
|
|
294
|
+
msg: _context6.t0.message,
|
|
295
|
+
name: res.name || this.currentFileContents.name,
|
|
296
|
+
path: res.path || this.currentFileContents.path,
|
|
297
|
+
created: res.created || this.currentFileContents.created,
|
|
298
|
+
last_modified: res.last_modified || this.currentFileContents.last_modified,
|
|
299
|
+
size: res.size || this.currentFileContents.size,
|
|
300
|
+
type: res.type || this.currentFileContents.type
|
|
301
|
+
});
|
|
302
|
+
this.modalService.openModal(SaveFileErrorModal);
|
|
303
|
+
throw new Error('File Save Error');
|
|
304
|
+
case 24:
|
|
305
|
+
_context6.next = 26;
|
|
306
|
+
return this.createCheckpoint();
|
|
307
|
+
case 26:
|
|
308
|
+
case "end":
|
|
309
|
+
return _context6.stop();
|
|
310
|
+
}
|
|
311
|
+
}, _callee6, this, [[4, 17]]);
|
|
312
|
+
}));
|
|
313
|
+
function saveNotebookContent() {
|
|
314
|
+
return _saveNotebookContent.apply(this, arguments);
|
|
315
|
+
}
|
|
316
|
+
return saveNotebookContent;
|
|
317
|
+
}()
|
|
318
|
+
}, {
|
|
319
|
+
key: "canRun",
|
|
320
|
+
value: function canRun() {
|
|
321
|
+
if (!this.kernelConnection) {
|
|
322
|
+
alert(l10n.t('Kernel Connection 还没有建立'));
|
|
323
|
+
return false;
|
|
324
|
+
}
|
|
325
|
+
if (this.kernelConnection.isDisposed) {
|
|
326
|
+
alert('Kernel Connection disposed');
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
return true;
|
|
330
|
+
}
|
|
331
|
+
}, {
|
|
332
|
+
key: "interrupt",
|
|
333
|
+
value: function () {
|
|
334
|
+
var _interrupt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
335
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
336
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
337
|
+
case 0:
|
|
338
|
+
if (this.kernelConnection) {
|
|
339
|
+
_context7.next = 3;
|
|
340
|
+
break;
|
|
341
|
+
}
|
|
342
|
+
alert(l10n.t('Kernel Connection 还没有建立'));
|
|
343
|
+
return _context7.abrupt("return");
|
|
344
|
+
case 3:
|
|
345
|
+
_context7.next = 5;
|
|
346
|
+
return this.kernelConnection.interrupt();
|
|
347
|
+
case 5:
|
|
348
|
+
case "end":
|
|
349
|
+
return _context7.stop();
|
|
350
|
+
}
|
|
351
|
+
}, _callee7, this);
|
|
352
|
+
}));
|
|
353
|
+
function interrupt() {
|
|
354
|
+
return _interrupt.apply(this, arguments);
|
|
355
|
+
}
|
|
356
|
+
return interrupt;
|
|
357
|
+
}()
|
|
358
|
+
}, {
|
|
359
|
+
key: "shutdown",
|
|
360
|
+
value: function () {
|
|
361
|
+
var _shutdown = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
362
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
363
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
364
|
+
case 0:
|
|
365
|
+
if (this.kernelConnection) {
|
|
366
|
+
_context8.next = 3;
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
alert(l10n.t('Kernel Connection 还没有建立'));
|
|
370
|
+
return _context8.abrupt("return");
|
|
371
|
+
case 3:
|
|
372
|
+
_context8.next = 5;
|
|
373
|
+
return this.kernelConnectionManager.shutdownKC(this.currentFileContents);
|
|
374
|
+
case 5:
|
|
375
|
+
this.kernelConnection = undefined;
|
|
376
|
+
case 6:
|
|
377
|
+
case "end":
|
|
378
|
+
return _context8.stop();
|
|
379
|
+
}
|
|
380
|
+
}, _callee8, this);
|
|
381
|
+
}));
|
|
382
|
+
function shutdown() {
|
|
383
|
+
return _shutdown.apply(this, arguments);
|
|
384
|
+
}
|
|
385
|
+
return shutdown;
|
|
386
|
+
}()
|
|
387
|
+
}, {
|
|
388
|
+
key: "restart",
|
|
389
|
+
value: function () {
|
|
390
|
+
var _restart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
391
|
+
var _this3 = this;
|
|
392
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
393
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
394
|
+
case 0:
|
|
395
|
+
if (!(!this.kernelConnection || this.kernelConnection.isDisposed)) {
|
|
396
|
+
_context9.next = 4;
|
|
397
|
+
break;
|
|
398
|
+
}
|
|
399
|
+
this.startKernelConnection();
|
|
400
|
+
getOrigin(this.kcReady).then(function () {
|
|
401
|
+
if (!_this3.kernelConnection) {
|
|
402
|
+
alert(l10n.t('Kernel Connection 还没有建立'));
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
return;
|
|
406
|
+
}).catch(function () {
|
|
407
|
+
//
|
|
408
|
+
});
|
|
409
|
+
return _context9.abrupt("return");
|
|
410
|
+
case 4:
|
|
411
|
+
this.kernelConnection.restart();
|
|
412
|
+
case 5:
|
|
413
|
+
case "end":
|
|
414
|
+
return _context9.stop();
|
|
415
|
+
}
|
|
416
|
+
}, _callee9, this);
|
|
417
|
+
}));
|
|
418
|
+
function restart() {
|
|
419
|
+
return _restart.apply(this, arguments);
|
|
420
|
+
}
|
|
421
|
+
return restart;
|
|
422
|
+
}()
|
|
423
|
+
}, {
|
|
424
|
+
key: "reconnect",
|
|
425
|
+
value: function () {
|
|
426
|
+
var _reconnect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
427
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
428
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
429
|
+
case 0:
|
|
430
|
+
if (this.kernelConnection) {
|
|
431
|
+
_context10.next = 3;
|
|
432
|
+
break;
|
|
433
|
+
}
|
|
434
|
+
alert(l10n.t('Kernel Connection 还没有建立'));
|
|
435
|
+
return _context10.abrupt("return");
|
|
436
|
+
case 3:
|
|
437
|
+
_context10.next = 5;
|
|
438
|
+
return this.kernelConnection.reconnect();
|
|
439
|
+
case 5:
|
|
440
|
+
case "end":
|
|
441
|
+
return _context10.stop();
|
|
442
|
+
}
|
|
443
|
+
}, _callee10, this);
|
|
444
|
+
}));
|
|
445
|
+
function reconnect() {
|
|
446
|
+
return _reconnect.apply(this, arguments);
|
|
447
|
+
}
|
|
448
|
+
return reconnect;
|
|
449
|
+
}()
|
|
450
|
+
}, {
|
|
451
|
+
key: "findRunningCell",
|
|
452
|
+
value: function findRunningCell() {
|
|
453
|
+
var runningCellIndex = this.cells.findIndex(function (item) {
|
|
454
|
+
if (ExecutedWithKernelCellModel.is(item.model)) {
|
|
455
|
+
return item.model.kernelExecuting === true;
|
|
456
|
+
}
|
|
457
|
+
return false;
|
|
458
|
+
});
|
|
459
|
+
if (runningCellIndex > -1) {
|
|
460
|
+
this.selectCell(this.cells[runningCellIndex]);
|
|
461
|
+
this.scrollToView(this.cells[runningCellIndex]);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}]);
|
|
465
|
+
return LibroJupyterModel;
|
|
466
|
+
}(LibroModel), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "currentFileContents", [_dec2], {
|
|
467
|
+
configurable: true,
|
|
468
|
+
enumerable: true,
|
|
469
|
+
writable: true,
|
|
470
|
+
initializer: null
|
|
471
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "kernelSelect", [_dec3], {
|
|
472
|
+
configurable: true,
|
|
473
|
+
enumerable: true,
|
|
474
|
+
writable: true,
|
|
475
|
+
initializer: null
|
|
476
|
+
}), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "kernelStatus", [_dec4], {
|
|
477
|
+
configurable: true,
|
|
478
|
+
enumerable: true,
|
|
479
|
+
writable: true,
|
|
480
|
+
initializer: null
|
|
481
|
+
}), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "kernelConnection", [_dec5], {
|
|
482
|
+
configurable: true,
|
|
483
|
+
enumerable: true,
|
|
484
|
+
writable: true,
|
|
485
|
+
initializer: null
|
|
486
|
+
}), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "lspEnabled", [_dec6], {
|
|
487
|
+
configurable: true,
|
|
488
|
+
enumerable: true,
|
|
489
|
+
writable: true,
|
|
490
|
+
initializer: function initializer() {
|
|
491
|
+
return false;
|
|
492
|
+
}
|
|
493
|
+
}), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "kernelConnecting", [_dec7], {
|
|
494
|
+
configurable: true,
|
|
495
|
+
enumerable: true,
|
|
496
|
+
writable: true,
|
|
497
|
+
initializer: null
|
|
498
|
+
}), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "filePath", [_dec8], {
|
|
499
|
+
configurable: true,
|
|
500
|
+
enumerable: true,
|
|
501
|
+
writable: true,
|
|
502
|
+
initializer: function initializer() {
|
|
503
|
+
return '';
|
|
504
|
+
}
|
|
505
|
+
})), _class2)) || _class);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference types="react" resolution-mode="require"/>
|
|
2
|
+
import type { ICellMetadata, ICodeCellMetadata, PartialJSONObject, INotebookContent } from '@difizen/libro-common';
|
|
3
|
+
import { ExecutableCellModel } from '@difizen/libro-core';
|
|
4
|
+
import type { IContentsModel } from '@difizen/libro-kernel';
|
|
5
|
+
import type { Event as ManaEvent, Emitter } from '@difizen/mana-app';
|
|
6
|
+
export interface ExecutionMeta extends PartialJSONObject {
|
|
7
|
+
'shell.execute_reply.started': string;
|
|
8
|
+
'shell.execute_reply.end': string;
|
|
9
|
+
to_execute: string;
|
|
10
|
+
}
|
|
11
|
+
export interface CodeCellMetadata extends ICodeCellMetadata {
|
|
12
|
+
execution: ExecutionMeta;
|
|
13
|
+
}
|
|
14
|
+
export type ExecutedWithKernelCellMeta = Partial<CodeCellMetadata | ICellMetadata>;
|
|
15
|
+
export interface ExecutedWithKernelCellModel extends ExecutableCellModel {
|
|
16
|
+
metadata: ExecutedWithKernelCellMeta;
|
|
17
|
+
kernelExecuting: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const ExecutedWithKernelCellModel: {
|
|
20
|
+
is: (arg: Record<any, any> | undefined) => arg is ExecutedWithKernelCellModel;
|
|
21
|
+
};
|
|
22
|
+
export type KernelStatusAndSelectorProvider = React.FC;
|
|
23
|
+
export declare const KernelStatusAndSelectorProvider: unique symbol;
|
|
24
|
+
export declare const LibroFileService: unique symbol;
|
|
25
|
+
export interface LibroFileService {
|
|
26
|
+
fileSaveError: ManaEvent<Partial<IContentsModel>>;
|
|
27
|
+
fileSaveErrorEmitter: Emitter<Partial<IContentsModel> & {
|
|
28
|
+
msg?: string;
|
|
29
|
+
cause?: string;
|
|
30
|
+
}>;
|
|
31
|
+
read: (path: string) => Promise<IContentsModel | undefined>;
|
|
32
|
+
write: (notebookContent: INotebookContent, currentFileContents: IContentsModel) => Promise<IContentsModel | undefined>;
|
|
33
|
+
}
|
|
34
|
+
export declare const ServerLaunchManager: unique symbol;
|
|
35
|
+
export interface ServerLaunchManager {
|
|
36
|
+
launch: () => Promise<any>;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=libro-jupyter-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"libro-jupyter-protocol.d.ts","sourceRoot":"","sources":["../src/libro-jupyter-protocol.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAErE,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD,6BAA6B,EAAE,MAAM,CAAC;IACtC,yBAAyB,EAAE,MAAM,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD,SAAS,EAAE,aAAa,CAAC;CAC1B;AAED,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAAC,gBAAgB,GAAG,aAAa,CAAC,CAAC;AAEnF,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACtE,QAAQ,EAAE,0BAA0B,CAAC;IACrC,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,2BAA2B;cAC5B,OAAO,GAAG,EAAE,GAAG,CAAC,GAAG,SAAS;CAOvC,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,KAAK,CAAC,EAAE,CAAC;AACvD,eAAO,MAAM,+BAA+B,eAE3C,CAAC;AAEF,eAAO,MAAM,gBAAgB,eAA6B,CAAC;AAC3D,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,SAAS,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC;IAClD,oBAAoB,EAAE,OAAO,CAC3B,OAAO,CAAC,cAAc,CAAC,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAC3D,CAAC;IACF,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAC5D,KAAK,EAAE,CACL,eAAe,EAAE,gBAAgB,EACjC,mBAAmB,EAAE,cAAc,KAChC,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;CAC1C;AAED,eAAO,MAAM,mBAAmB,eAAgC,CAAC;AACjE,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;CAC5B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ExecutableCellModel } from '@difizen/libro-core';
|
|
2
|
+
export var ExecutedWithKernelCellModel = {
|
|
3
|
+
is: function is(arg) {
|
|
4
|
+
return ExecutableCellModel.is(arg) && 'kernelExecuting' in arg && typeof arg.kernelExecuting === 'boolean';
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
export var KernelStatusAndSelectorProvider = Symbol('KernelStatusAndSelectorProvider');
|
|
8
|
+
export var LibroFileService = Symbol('LibroFileService');
|
|
9
|
+
export var ServerLaunchManager = Symbol('ServerLaunchManager');
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ServerManager, ServerConnection } from '@difizen/libro-kernel';
|
|
2
|
+
import { ApplicationContribution } from '@difizen/mana-app';
|
|
3
|
+
import { ServerLaunchManager } from './libro-jupyter-protocol.js';
|
|
4
|
+
export declare class JupyterServerLaunchManager implements ServerLaunchManager, ApplicationContribution {
|
|
5
|
+
protected serverManager: ServerManager;
|
|
6
|
+
protected serverConnection: ServerConnection;
|
|
7
|
+
constructor(serverManager: ServerManager, serverConnection: ServerConnection);
|
|
8
|
+
onStart(): Promise<void>;
|
|
9
|
+
launch(): Promise<import("@difizen/libro-kernel").ISpecModels>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=libro-jupyter-server-launch-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"libro-jupyter-server-launch-manager.d.ts","sourceRoot":"","sources":["../src/libro-jupyter-server-launch-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAExE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,qBACa,0BACX,YAAW,mBAAmB,EAAE,uBAAuB;IAEvD,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IACvC,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;gBAI3C,aAAa,EAAE,aAAa,EAE5B,gBAAgB,EAAE,gBAAgB;IAM9B,OAAO;IASb,MAAM;CAGP"}
|