@difizen/libro-widget 0.1.33 → 0.1.34
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/es/index.d.ts +3 -4
- package/es/index.d.ts.map +1 -1
- package/es/index.js +3 -4
- package/es/module.d.ts +3 -0
- package/es/module.d.ts.map +1 -0
- package/es/module.js +5 -0
- package/es/slider/contribution.d.ts +10 -0
- package/es/slider/contribution.d.ts.map +1 -0
- package/es/{widgets/instances-progress-widget-view-contribution.js → slider/contribution.js} +15 -9
- package/es/slider/index.d.ts +3 -0
- package/es/slider/index.d.ts.map +1 -0
- package/es/slider/index.js +2 -0
- package/es/slider/index.less +3 -0
- package/es/slider/view.d.ts +23 -0
- package/es/slider/view.d.ts.map +1 -0
- package/es/{widgets/progress-widget-view.js → slider/view.js} +62 -68
- package/es/text/contribution.d.ts +10 -0
- package/es/text/contribution.d.ts.map +1 -0
- package/es/{widgets/text-widget-view-contribution.js → text/contribution.js} +3 -3
- package/es/text/index.d.ts +3 -0
- package/es/text/index.d.ts.map +1 -0
- package/es/text/index.js +2 -0
- package/es/{widgets/text-widget-view.d.ts → text/view.d.ts} +5 -6
- package/es/text/view.d.ts.map +1 -0
- package/es/{widgets/text-widget-view.js → text/view.js} +11 -12
- package/package.json +6 -5
- package/src/index.spec.ts +2 -3
- package/src/index.ts +3 -4
- package/src/module.ts +15 -0
- package/src/slider/contribution.ts +25 -0
- package/src/slider/index.less +3 -0
- package/src/slider/index.ts +2 -0
- package/src/slider/view.tsx +92 -0
- package/src/{widgets/text-widget-view-contribution.ts → text/contribution.ts} +4 -5
- package/src/text/index.ts +2 -0
- package/src/{widgets/text-widget-view.tsx → text/view.tsx} +7 -10
- package/es/base/comm.d.ts +0 -65
- package/es/base/comm.d.ts.map +0 -1
- package/es/base/comm.js +0 -151
- package/es/base/index.d.ts +0 -7
- package/es/base/index.d.ts.map +0 -1
- package/es/base/index.js +0 -6
- package/es/base/libro-widgets.d.ts +0 -79
- package/es/base/libro-widgets.d.ts.map +0 -1
- package/es/base/libro-widgets.js +0 -286
- package/es/base/protocal.d.ts +0 -171
- package/es/base/protocal.d.ts.map +0 -1
- package/es/base/protocal.js +0 -21
- package/es/base/utils.d.ts +0 -27
- package/es/base/utils.d.ts.map +0 -1
- package/es/base/utils.js +0 -59
- package/es/base/version.d.ts +0 -3
- package/es/base/version.d.ts.map +0 -1
- package/es/base/version.js +0 -2
- package/es/base/widget-manager.d.ts +0 -18
- package/es/base/widget-manager.d.ts.map +0 -1
- package/es/base/widget-manager.js +0 -68
- package/es/base/widget-view-contribution.d.ts +0 -10
- package/es/base/widget-view-contribution.d.ts.map +0 -1
- package/es/base/widget-view-contribution.js +0 -36
- package/es/base/widget-view.d.ts +0 -52
- package/es/base/widget-view.d.ts.map +0 -1
- package/es/base/widget-view.js +0 -137
- package/es/components/index.d.ts +0 -3
- package/es/components/index.d.ts.map +0 -1
- package/es/components/index.js +0 -2
- package/es/components/progressBar.d.ts +0 -15
- package/es/components/progressBar.d.ts.map +0 -1
- package/es/components/progressBar.js +0 -20
- package/es/components/progressCircle.d.ts +0 -11
- package/es/components/progressCircle.d.ts.map +0 -1
- package/es/components/progressCircle.js +0 -16
- package/es/widget-module.d.ts +0 -3
- package/es/widget-module.d.ts.map +0 -1
- package/es/widget-module.js +0 -39
- package/es/widgets/hbox-widget-view-contribution.d.ts +0 -10
- package/es/widgets/hbox-widget-view-contribution.d.ts.map +0 -1
- package/es/widgets/hbox-widget-view-contribution.js +0 -39
- package/es/widgets/hbox-widget-view.d.ts +0 -17
- package/es/widgets/hbox-widget-view.d.ts.map +0 -1
- package/es/widgets/hbox-widget-view.js +0 -69
- package/es/widgets/index.d.ts +0 -9
- package/es/widgets/index.d.ts.map +0 -1
- package/es/widgets/index.js +0 -8
- package/es/widgets/index.less +0 -3
- package/es/widgets/instances-progress-widget-view-contribution.d.ts +0 -10
- package/es/widgets/instances-progress-widget-view-contribution.d.ts.map +0 -1
- package/es/widgets/instances-progress-widget-view.d.ts +0 -31
- package/es/widgets/instances-progress-widget-view.d.ts.map +0 -1
- package/es/widgets/instances-progress-widget-view.js +0 -181
- package/es/widgets/progress-widget-view-contribution.d.ts +0 -10
- package/es/widgets/progress-widget-view-contribution.d.ts.map +0 -1
- package/es/widgets/progress-widget-view-contribution.js +0 -39
- package/es/widgets/progress-widget-view.d.ts +0 -25
- package/es/widgets/progress-widget-view.d.ts.map +0 -1
- package/es/widgets/text-widget-view-contribution.d.ts +0 -10
- package/es/widgets/text-widget-view-contribution.d.ts.map +0 -1
- package/es/widgets/text-widget-view.d.ts.map +0 -1
- package/src/base/comm.ts +0 -152
- package/src/base/index.ts +0 -6
- package/src/base/libro-widgets.ts +0 -207
- package/src/base/protocal.ts +0 -218
- package/src/base/utils.ts +0 -67
- package/src/base/version.ts +0 -2
- package/src/base/widget-manager.ts +0 -41
- package/src/base/widget-view-contribution.ts +0 -14
- package/src/base/widget-view.tsx +0 -146
- package/src/components/index.ts +0 -3
- package/src/components/progressBar.tsx +0 -29
- package/src/components/progressCircle.tsx +0 -18
- package/src/widget-module.ts +0 -68
- package/src/widgets/hbox-widget-view-contribution.ts +0 -20
- package/src/widgets/hbox-widget-view.tsx +0 -64
- package/src/widgets/index.less +0 -3
- package/src/widgets/index.ts +0 -8
- package/src/widgets/instances-progress-widget-view-contribution.ts +0 -20
- package/src/widgets/instances-progress-widget-view.tsx +0 -160
- package/src/widgets/progress-widget-view-contribution.ts +0 -24
- package/src/widgets/progress-widget-view.tsx +0 -85
package/es/base/libro-widgets.js
DELETED
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _dec, _dec2, _dec3, _class, _class2, _descriptor, _descriptor2;
|
|
3
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
11
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
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 { contrib, inject, Priority, prop, transient } from '@difizen/mana-app';
|
|
15
|
-
import { Emitter } from '@difizen/mana-app';
|
|
16
|
-
import { LibroWidgetCommFactory, WidgetsOption, WidgetViewContribution } from "./protocal.js";
|
|
17
|
-
import { put_buffers, reject } from "./utils.js";
|
|
18
|
-
import { PROTOCOL_VERSION } from "./version.js";
|
|
19
|
-
var PROTOCOL_MAJOR_VERSION = PROTOCOL_VERSION.split('.', 1)[0];
|
|
20
|
-
export var LibroWidgets = (_dec = transient(), _dec2 = contrib(WidgetViewContribution), _dec3 = prop(), _dec(_class = (_class2 = /*#__PURE__*/function () {
|
|
21
|
-
function LibroWidgets(options, widgetCommFactory) {
|
|
22
|
-
var _this = this;
|
|
23
|
-
_classCallCheck(this, LibroWidgets);
|
|
24
|
-
_initializerDefineProperty(this, "WidgetViewProvider", _descriptor, this);
|
|
25
|
-
this.widgetEmitter = new Emitter();
|
|
26
|
-
/**
|
|
27
|
-
* Dictionary of model ids and model instance promises
|
|
28
|
-
*/
|
|
29
|
-
_initializerDefineProperty(this, "models", _descriptor2, this);
|
|
30
|
-
this.commTargetName = 'jupyter.widget';
|
|
31
|
-
this.kernelConnection = options.kc;
|
|
32
|
-
this.id = options.id;
|
|
33
|
-
this.widgetCommFactory = widgetCommFactory;
|
|
34
|
-
this.kernelConnection.registerCommTarget(this.commTargetName, /*#__PURE__*/function () {
|
|
35
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(comm, msg) {
|
|
36
|
-
var widgetComm;
|
|
37
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
38
|
-
while (1) switch (_context.prev = _context.next) {
|
|
39
|
-
case 0:
|
|
40
|
-
widgetComm = _this.widgetCommFactory({
|
|
41
|
-
comm: comm
|
|
42
|
-
});
|
|
43
|
-
_context.next = 3;
|
|
44
|
-
return _this.handleCommOpen(widgetComm, msg);
|
|
45
|
-
case 3:
|
|
46
|
-
case "end":
|
|
47
|
-
return _context.stop();
|
|
48
|
-
}
|
|
49
|
-
}, _callee);
|
|
50
|
-
}));
|
|
51
|
-
return function (_x, _x2) {
|
|
52
|
-
return _ref.apply(this, arguments);
|
|
53
|
-
};
|
|
54
|
-
}());
|
|
55
|
-
}
|
|
56
|
-
LibroWidgets = inject(LibroWidgetCommFactory)(LibroWidgets, undefined, 1) || LibroWidgets;
|
|
57
|
-
LibroWidgets = inject(WidgetsOption)(LibroWidgets, undefined, 0) || LibroWidgets;
|
|
58
|
-
_createClass(LibroWidgets, [{
|
|
59
|
-
key: "onWidgetRender",
|
|
60
|
-
get: function get() {
|
|
61
|
-
return this.widgetEmitter.event;
|
|
62
|
-
}
|
|
63
|
-
}, {
|
|
64
|
-
key: "findProvider",
|
|
65
|
-
value: function findProvider(attributes) {
|
|
66
|
-
var prioritized = Priority.sortSync(this.WidgetViewProvider.getContributions(), function (contribution) {
|
|
67
|
-
return contribution.canHandle(attributes);
|
|
68
|
-
});
|
|
69
|
-
var sorted = prioritized.map(function (c) {
|
|
70
|
-
return c.value;
|
|
71
|
-
});
|
|
72
|
-
return sorted[0];
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Create a comm which can be used for communication for a widget.
|
|
77
|
-
*
|
|
78
|
-
* If the data/metadata is passed in, open the comm before returning (i.e.,
|
|
79
|
-
* send the comm_open message). If the data and metadata is undefined, we
|
|
80
|
-
* want to reconstruct a comm that already exists in the kernel, so do not
|
|
81
|
-
* open the comm by sending the comm_open message.
|
|
82
|
-
*
|
|
83
|
-
* @param comm_target_name Comm target name
|
|
84
|
-
* @param model_id The comm id
|
|
85
|
-
* @param data The initial data for the comm
|
|
86
|
-
* @param metadata The metadata in the open message
|
|
87
|
-
*/
|
|
88
|
-
}, {
|
|
89
|
-
key: "createComm",
|
|
90
|
-
value: (function () {
|
|
91
|
-
var _createComm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(comm_target_name, model_id, data, metadata, buffers) {
|
|
92
|
-
var kernel, comm;
|
|
93
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
94
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
95
|
-
case 0:
|
|
96
|
-
kernel = this.kernelConnection;
|
|
97
|
-
if (kernel) {
|
|
98
|
-
_context2.next = 3;
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
throw new Error('No current kernel');
|
|
102
|
-
case 3:
|
|
103
|
-
comm = kernel.createComm(comm_target_name, model_id);
|
|
104
|
-
if (data || metadata) {
|
|
105
|
-
comm.open(data, metadata, buffers);
|
|
106
|
-
}
|
|
107
|
-
return _context2.abrupt("return", this.widgetCommFactory({
|
|
108
|
-
comm: comm
|
|
109
|
-
}));
|
|
110
|
-
case 6:
|
|
111
|
-
case "end":
|
|
112
|
-
return _context2.stop();
|
|
113
|
-
}
|
|
114
|
-
}, _callee2, this);
|
|
115
|
-
}));
|
|
116
|
-
function createComm(_x3, _x4, _x5, _x6, _x7) {
|
|
117
|
-
return _createComm.apply(this, arguments);
|
|
118
|
-
}
|
|
119
|
-
return createComm;
|
|
120
|
-
}()
|
|
121
|
-
/**
|
|
122
|
-
* Get a model by model id.
|
|
123
|
-
*
|
|
124
|
-
* #### Notes
|
|
125
|
-
* If the model is not found, throw error.
|
|
126
|
-
*
|
|
127
|
-
* If you would like to synchronously test if a model exists, use .hasModel().
|
|
128
|
-
*/
|
|
129
|
-
)
|
|
130
|
-
}, {
|
|
131
|
-
key: "getModel",
|
|
132
|
-
value: function getModel(model_id) {
|
|
133
|
-
var model = this.models.get(model_id);
|
|
134
|
-
if (model === undefined) {
|
|
135
|
-
throw new Error('widget model not found');
|
|
136
|
-
}
|
|
137
|
-
return model;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Returns true if the given model is registered, otherwise false.
|
|
142
|
-
*
|
|
143
|
-
* #### Notes
|
|
144
|
-
* This is a synchronous way to check if a model is registered.
|
|
145
|
-
*/
|
|
146
|
-
}, {
|
|
147
|
-
key: "hasModel",
|
|
148
|
-
value: function hasModel(model_id) {
|
|
149
|
-
return this.models.get(model_id) !== undefined;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Handle when a comm is opened.
|
|
154
|
-
*/
|
|
155
|
-
}, {
|
|
156
|
-
key: "handleCommOpen",
|
|
157
|
-
value: (function () {
|
|
158
|
-
var _handleCommOpen = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(comm, msg) {
|
|
159
|
-
var protocolVersion, error, data, buffer_paths, buffers;
|
|
160
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
161
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
162
|
-
case 0:
|
|
163
|
-
protocolVersion = (msg.metadata || {})['version'] || '';
|
|
164
|
-
if (!(protocolVersion.split('.', 1)[0] !== PROTOCOL_MAJOR_VERSION)) {
|
|
165
|
-
_context3.next = 5;
|
|
166
|
-
break;
|
|
167
|
-
}
|
|
168
|
-
error = "Wrong widget protocol version: received protocol version '".concat(protocolVersion, "', but was expecting major version '").concat(PROTOCOL_MAJOR_VERSION, "'");
|
|
169
|
-
console.error(error);
|
|
170
|
-
return _context3.abrupt("return", Promise.reject(error));
|
|
171
|
-
case 5:
|
|
172
|
-
data = msg.content.data;
|
|
173
|
-
buffer_paths = data.buffer_paths || [];
|
|
174
|
-
buffers = msg.buffers || [];
|
|
175
|
-
put_buffers(data.state, buffer_paths, buffers);
|
|
176
|
-
// this.createComm(msg.content.target_name, msg.content.comm_id, msg.content.data, msg.metadata);
|
|
177
|
-
return _context3.abrupt("return", this.newWidgetView(data.state, {
|
|
178
|
-
model_id: msg.content.comm_id,
|
|
179
|
-
comm: comm
|
|
180
|
-
}).catch(reject('Could not create a model.', true)));
|
|
181
|
-
case 10:
|
|
182
|
-
case "end":
|
|
183
|
-
return _context3.stop();
|
|
184
|
-
}
|
|
185
|
-
}, _callee3, this);
|
|
186
|
-
}));
|
|
187
|
-
function handleCommOpen(_x8, _x9) {
|
|
188
|
-
return _handleCommOpen.apply(this, arguments);
|
|
189
|
-
}
|
|
190
|
-
return handleCommOpen;
|
|
191
|
-
}())
|
|
192
|
-
}, {
|
|
193
|
-
key: "registerWidgetView",
|
|
194
|
-
value: function registerWidgetView(model_id, model) {
|
|
195
|
-
var _this2 = this;
|
|
196
|
-
model.then(function (WidgetView) {
|
|
197
|
-
_this2.models.set(model_id, WidgetView);
|
|
198
|
-
_this2.widgetEmitter.fire({
|
|
199
|
-
WidgetViewName: WidgetView.model_name
|
|
200
|
-
});
|
|
201
|
-
return;
|
|
202
|
-
}).catch(function () {
|
|
203
|
-
//
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
}, {
|
|
207
|
-
key: "handleCommClose",
|
|
208
|
-
value: function handleCommClose(msg) {
|
|
209
|
-
var comm_id = msg.content.comm_id;
|
|
210
|
-
var model = this.getModel(comm_id);
|
|
211
|
-
model.isCommClosed = true;
|
|
212
|
-
}
|
|
213
|
-
}, {
|
|
214
|
-
key: "unregisterWidgetView",
|
|
215
|
-
value: function unregisterWidgetView(model_id) {
|
|
216
|
-
var model = this.models.get(model_id);
|
|
217
|
-
model === null || model === void 0 || model.dispose();
|
|
218
|
-
this.models.delete(model_id);
|
|
219
|
-
}
|
|
220
|
-
}, {
|
|
221
|
-
key: "newWidgetView",
|
|
222
|
-
value: function () {
|
|
223
|
-
var _newWidgetView = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(attributes, options) {
|
|
224
|
-
var model_id, provider, WidgetView;
|
|
225
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
226
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
227
|
-
case 0:
|
|
228
|
-
model_id = options.model_id;
|
|
229
|
-
if (model_id) {
|
|
230
|
-
_context4.next = 3;
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
233
|
-
throw new Error('Neither comm nor model_id provided in options object. At least one must exist.');
|
|
234
|
-
case 3:
|
|
235
|
-
options.model_id = model_id;
|
|
236
|
-
provider = this.findProvider(attributes);
|
|
237
|
-
WidgetView = provider.factory({
|
|
238
|
-
attributes: attributes,
|
|
239
|
-
options: options
|
|
240
|
-
});
|
|
241
|
-
this.registerWidgetView(model_id, WidgetView);
|
|
242
|
-
return _context4.abrupt("return", WidgetView);
|
|
243
|
-
case 8:
|
|
244
|
-
case "end":
|
|
245
|
-
return _context4.stop();
|
|
246
|
-
}
|
|
247
|
-
}, _callee4, this);
|
|
248
|
-
}));
|
|
249
|
-
function newWidgetView(_x10, _x11) {
|
|
250
|
-
return _newWidgetView.apply(this, arguments);
|
|
251
|
-
}
|
|
252
|
-
return newWidgetView;
|
|
253
|
-
}()
|
|
254
|
-
/**
|
|
255
|
-
* Close all widgets and empty the widget state.
|
|
256
|
-
* @return Promise that resolves when the widget state is cleared.
|
|
257
|
-
*/
|
|
258
|
-
}, {
|
|
259
|
-
key: "clearState",
|
|
260
|
-
value: function clearState() {
|
|
261
|
-
this.models.clear();
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Disconnect the widget manager from the kernel, setting each model's comm
|
|
265
|
-
* as dead.
|
|
266
|
-
*/
|
|
267
|
-
}, {
|
|
268
|
-
key: "disconnect",
|
|
269
|
-
value: function disconnect() {
|
|
270
|
-
// this.models.forEach(model => model.clear());
|
|
271
|
-
}
|
|
272
|
-
}]);
|
|
273
|
-
return LibroWidgets;
|
|
274
|
-
}(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "WidgetViewProvider", [_dec2], {
|
|
275
|
-
configurable: true,
|
|
276
|
-
enumerable: true,
|
|
277
|
-
writable: true,
|
|
278
|
-
initializer: null
|
|
279
|
-
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "models", [_dec3], {
|
|
280
|
-
configurable: true,
|
|
281
|
-
enumerable: true,
|
|
282
|
-
writable: true,
|
|
283
|
-
initializer: function initializer() {
|
|
284
|
-
return new Map();
|
|
285
|
-
}
|
|
286
|
-
})), _class2)) || _class);
|
package/es/base/protocal.d.ts
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import type { JSONObject, JSONValue } from '@difizen/libro-common';
|
|
2
|
-
import type { IComm, IKernelConnection, KernelMessage } from '@difizen/libro-kernel';
|
|
3
|
-
import { Syringe } from '@difizen/mana-app';
|
|
4
|
-
import type { WidgetView } from './widget-view.js';
|
|
5
|
-
export interface IWidgetViewOptions {
|
|
6
|
-
model_id: string;
|
|
7
|
-
comm: IClassicComm;
|
|
8
|
-
}
|
|
9
|
-
export interface IWidgetViewProps {
|
|
10
|
-
attributes: any;
|
|
11
|
-
options: IWidgetViewOptions;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* A simple dictionary type.
|
|
15
|
-
*/
|
|
16
|
-
export type Dict<T> = Record<string, T>;
|
|
17
|
-
export type BufferJSON = {
|
|
18
|
-
[property: string]: BufferJSON;
|
|
19
|
-
} | BufferJSON[] | string | number | boolean | null | ArrayBuffer | DataView;
|
|
20
|
-
export interface ISerializedState {
|
|
21
|
-
state: JSONObject;
|
|
22
|
-
buffers: ArrayBuffer[];
|
|
23
|
-
buffer_paths: (string | number)[][];
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* The widget manager interface exposed on the Widget instances
|
|
27
|
-
*/
|
|
28
|
-
export interface IWidgets {
|
|
29
|
-
getModel: (model_id: string) => WidgetView;
|
|
30
|
-
/**
|
|
31
|
-
* Returns true if the given model is registered, otherwise false.
|
|
32
|
-
*
|
|
33
|
-
* #### Notes
|
|
34
|
-
* This is a synchronous way to check if a model is registered.
|
|
35
|
-
*/
|
|
36
|
-
hasModel: (model_id: string) => boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Register a model instance promise with the manager.
|
|
39
|
-
*
|
|
40
|
-
* By registering the model, it can later be retrieved with `getModel`.
|
|
41
|
-
*/
|
|
42
|
-
registerWidgetView: (model_id: string, model: Promise<WidgetView>) => void;
|
|
43
|
-
newWidgetView: (attributes: any, options: IWidgetViewOptions) => Promise<WidgetView>;
|
|
44
|
-
}
|
|
45
|
-
export declare const LibroWidgetsFactory: unique symbol;
|
|
46
|
-
export type LibroWidgetsFactory = (options: WidgetsOption) => IWidgets;
|
|
47
|
-
export declare const WidgetsOption: unique symbol;
|
|
48
|
-
export interface WidgetsOption {
|
|
49
|
-
kc: IKernelConnection;
|
|
50
|
-
id: string;
|
|
51
|
-
}
|
|
52
|
-
export interface IWidgetView {
|
|
53
|
-
initialize: (props: IWidgetViewProps) => void;
|
|
54
|
-
toJSON: () => string;
|
|
55
|
-
set_state: (state: Dict<unknown>) => void;
|
|
56
|
-
handleCommMsg: (msg: KernelMessage.ICommMsgMsg) => Promise<void>;
|
|
57
|
-
model_id: string;
|
|
58
|
-
name: string;
|
|
59
|
-
module: string;
|
|
60
|
-
model_module: string;
|
|
61
|
-
model_name: string;
|
|
62
|
-
model_module_version: string;
|
|
63
|
-
view_module: string;
|
|
64
|
-
view_name: string | null;
|
|
65
|
-
view_module_version: string;
|
|
66
|
-
view_count: number | null;
|
|
67
|
-
}
|
|
68
|
-
export declare const IWidgetView: unique symbol;
|
|
69
|
-
export declare const WidgetViewContribution: Syringe.DefinedToken;
|
|
70
|
-
export interface WidgetViewContribution {
|
|
71
|
-
canHandle: (attributes: any) => number;
|
|
72
|
-
factory: (props: IWidgetViewProps) => Promise<WidgetView>;
|
|
73
|
-
}
|
|
74
|
-
export interface InstanceRecord {
|
|
75
|
-
startDate: number;
|
|
76
|
-
endDate: number;
|
|
77
|
-
}
|
|
78
|
-
interface Stage {
|
|
79
|
-
name: string;
|
|
80
|
-
backup_workers: number;
|
|
81
|
-
terminated_workers: number;
|
|
82
|
-
running_workers: number;
|
|
83
|
-
total_workers: number;
|
|
84
|
-
input_records: number;
|
|
85
|
-
output_records: number;
|
|
86
|
-
finished_percentage: number;
|
|
87
|
-
}
|
|
88
|
-
export interface Task {
|
|
89
|
-
name: string;
|
|
90
|
-
status: 'WAITING' | 'RUNNING' | 'SUCCESS' | 'FAILED' | 'SUSPENDED' | 'CANCELLED';
|
|
91
|
-
stages: Stage[];
|
|
92
|
-
}
|
|
93
|
-
export interface ProgressInstance {
|
|
94
|
-
id: string;
|
|
95
|
-
status: 'Running' | 'Suspended' | 'Terminated';
|
|
96
|
-
logview: string;
|
|
97
|
-
tasks: Task[];
|
|
98
|
-
}
|
|
99
|
-
export interface ProgressItem {
|
|
100
|
-
name: string;
|
|
101
|
-
key: string;
|
|
102
|
-
gen_time: string;
|
|
103
|
-
logView: string;
|
|
104
|
-
instances?: ProgressInstance[];
|
|
105
|
-
}
|
|
106
|
-
export type InstancesRecords = Record<string, InstanceRecord>;
|
|
107
|
-
/**
|
|
108
|
-
* Callbacks for services shim comms.
|
|
109
|
-
*/
|
|
110
|
-
export interface ICallbacks {
|
|
111
|
-
shell?: Record<string, (msg: KernelMessage.IShellMessage) => void>;
|
|
112
|
-
iopub?: Record<string, (msg: KernelMessage.IIOPubMessage) => void>;
|
|
113
|
-
input?: (msg: KernelMessage.IStdinMessage) => void;
|
|
114
|
-
}
|
|
115
|
-
export declare const LibroWidgetCommFactory: unique symbol;
|
|
116
|
-
export type LibroWidgetCommFactory = (options: WidgetCommOption) => IClassicComm;
|
|
117
|
-
export declare const WidgetCommOption: unique symbol;
|
|
118
|
-
export interface WidgetCommOption {
|
|
119
|
-
comm: IComm;
|
|
120
|
-
}
|
|
121
|
-
export interface IClassicComm {
|
|
122
|
-
/**
|
|
123
|
-
* Comm id
|
|
124
|
-
* @return {string}
|
|
125
|
-
*/
|
|
126
|
-
comm_id: string;
|
|
127
|
-
/**
|
|
128
|
-
* Target name
|
|
129
|
-
* @return {string}
|
|
130
|
-
*/
|
|
131
|
-
target_name: string;
|
|
132
|
-
/**
|
|
133
|
-
* Opens a sibling comm in the backend
|
|
134
|
-
* @param data
|
|
135
|
-
* @param callbacks
|
|
136
|
-
* @param metadata
|
|
137
|
-
* @param buffers
|
|
138
|
-
* @return msg id
|
|
139
|
-
*/
|
|
140
|
-
open(data: JSONValue, callbacks?: ICallbacks, metadata?: JSONObject, buffers?: ArrayBuffer[] | ArrayBufferView[]): string;
|
|
141
|
-
/**
|
|
142
|
-
* Sends a message to the sibling comm in the backend
|
|
143
|
-
* @param data
|
|
144
|
-
* @param callbacks
|
|
145
|
-
* @param metadata
|
|
146
|
-
* @param buffers
|
|
147
|
-
* @return message id
|
|
148
|
-
*/
|
|
149
|
-
send(data: JSONValue, callbacks?: ICallbacks, metadata?: JSONObject, buffers?: ArrayBuffer[] | ArrayBufferView[]): string;
|
|
150
|
-
/**
|
|
151
|
-
* Closes the sibling comm in the backend
|
|
152
|
-
* @param data
|
|
153
|
-
* @param callbacks
|
|
154
|
-
* @param metadata
|
|
155
|
-
* @param buffers
|
|
156
|
-
* @return msg id
|
|
157
|
-
*/
|
|
158
|
-
close(data?: JSONValue, callbacks?: ICallbacks, metadata?: JSONObject, buffers?: ArrayBuffer[] | ArrayBufferView[]): string;
|
|
159
|
-
/**
|
|
160
|
-
* Register a message handler
|
|
161
|
-
* @param callback, which is given a message
|
|
162
|
-
*/
|
|
163
|
-
on_msg(callback: (x: any) => void): void;
|
|
164
|
-
/**
|
|
165
|
-
* Register a handler for when the comm is closed by the backend
|
|
166
|
-
* @param callback, which is given a message
|
|
167
|
-
*/
|
|
168
|
-
on_close(callback: (x: any) => void): void;
|
|
169
|
-
}
|
|
170
|
-
export {};
|
|
171
|
-
//# sourceMappingURL=protocal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"protocal.d.ts","sourceRoot":"","sources":["../../src/base/protocal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,YAAY,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,GAAG,CAAC;IAChB,OAAO,EAAE,kBAAkB,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAExC,MAAM,MAAM,UAAU,GAClB;IAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,GAClC,UAAU,EAAE,GACZ,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,WAAW,GACX,QAAQ,CAAC;AAEb,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,YAAY,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,UAAU,CAAC;IAE3C;;;;;OAKG;IACH,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;IAExC;;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GG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAAC;CAC5C"}
|
package/es/base/protocal.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Syringe } from '@difizen/mana-app';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A simple dictionary type.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* The widget manager interface exposed on the Widget instances
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export var LibroWidgetsFactory = Symbol('LibroWidgetsFactory');
|
|
12
|
-
export var WidgetsOption = Symbol('WidgetsOption');
|
|
13
|
-
export var IWidgetView = Symbol('IWidgetView');
|
|
14
|
-
export var WidgetViewContribution = Syringe.defineToken('WidgetViewContribution');
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Callbacks for services shim comms.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
export var LibroWidgetCommFactory = Symbol('LibroWidgetCommFactory');
|
|
21
|
-
export var WidgetCommOption = Symbol('WidgetCommOption');
|
package/es/base/utils.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { BufferJSON, Dict } from './protocal.js';
|
|
2
|
-
/**
|
|
3
|
-
* Takes an object 'state' and fills in buffer[i] at 'path' buffer_paths[i]
|
|
4
|
-
* where buffer_paths[i] is a list indicating where in the object buffer[i] should
|
|
5
|
-
* be placed
|
|
6
|
-
* Example: state = {a: 1, b: {}, c: [0, null]}
|
|
7
|
-
* buffers = [array1, array2]
|
|
8
|
-
* buffer_paths = [['b', 'data'], ['c', 1]]
|
|
9
|
-
* Will lead to {a: 1, b: {data: array1}, c: [0, array2]}
|
|
10
|
-
*/
|
|
11
|
-
export declare function put_buffers(state: Dict<BufferJSON>, buffer_paths: (string | number)[][], buffers: (DataView | ArrayBuffer | ArrayBufferView | {
|
|
12
|
-
buffer: ArrayBuffer;
|
|
13
|
-
})[]): void;
|
|
14
|
-
/**
|
|
15
|
-
* Creates a wrappable Promise rejection function.
|
|
16
|
-
*
|
|
17
|
-
* Creates a function that logs an error message before rethrowing
|
|
18
|
-
* the original error that caused the promise to reject.
|
|
19
|
-
*/
|
|
20
|
-
export declare function reject(message: string, log: boolean): (error: Error) => never;
|
|
21
|
-
/**
|
|
22
|
-
* A polyfill for Object.assign
|
|
23
|
-
*
|
|
24
|
-
* This is from code that Typescript 2.4 generates for a polyfill.
|
|
25
|
-
*/
|
|
26
|
-
export declare const assign: any;
|
|
27
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/es/base/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/base/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEtD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,EACvB,YAAY,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,EACnC,OAAO,EAAE,CAAC,QAAQ,GAAG,WAAW,GAAG,eAAe,GAAG;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,CAAC,EAAE,GAC9E,IAAI,CAiBN;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,WACV,KAAK,KAAG,KAAK,CAMtD;AAED;;;;GAIG;AACH,eAAO,MAAM,MAAM,KAYhB,CAAC"}
|
package/es/base/utils.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Takes an object 'state' and fills in buffer[i] at 'path' buffer_paths[i]
|
|
3
|
-
* where buffer_paths[i] is a list indicating where in the object buffer[i] should
|
|
4
|
-
* be placed
|
|
5
|
-
* Example: state = {a: 1, b: {}, c: [0, null]}
|
|
6
|
-
* buffers = [array1, array2]
|
|
7
|
-
* buffer_paths = [['b', 'data'], ['c', 1]]
|
|
8
|
-
* Will lead to {a: 1, b: {data: array1}, c: [0, array2]}
|
|
9
|
-
*/
|
|
10
|
-
export function put_buffers(state, buffer_paths, buffers) {
|
|
11
|
-
for (var i = 0; i < buffer_paths.length; i++) {
|
|
12
|
-
var buffer_path = buffer_paths[i];
|
|
13
|
-
// make sure the buffers are DataViews
|
|
14
|
-
var buffer = buffers[i];
|
|
15
|
-
if (!(buffer instanceof DataView)) {
|
|
16
|
-
buffer = new DataView(buffer instanceof ArrayBuffer ? buffer : buffer.buffer);
|
|
17
|
-
}
|
|
18
|
-
// say we want to set state[x][y][z] = buffer
|
|
19
|
-
var obj = state;
|
|
20
|
-
// we first get obj = state[x][y]
|
|
21
|
-
for (var j = 0; j < buffer_path.length - 1; j++) {
|
|
22
|
-
obj = obj[buffer_path[j]];
|
|
23
|
-
}
|
|
24
|
-
// and then set: obj[z] = buffer
|
|
25
|
-
obj[buffer_path[buffer_path.length - 1]] = buffer;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Creates a wrappable Promise rejection function.
|
|
31
|
-
*
|
|
32
|
-
* Creates a function that logs an error message before rethrowing
|
|
33
|
-
* the original error that caused the promise to reject.
|
|
34
|
-
*/
|
|
35
|
-
export function reject(message, log) {
|
|
36
|
-
return function promiseRejection(error) {
|
|
37
|
-
if (log) {
|
|
38
|
-
console.error(new Error(message));
|
|
39
|
-
}
|
|
40
|
-
throw error;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* A polyfill for Object.assign
|
|
46
|
-
*
|
|
47
|
-
* This is from code that Typescript 2.4 generates for a polyfill.
|
|
48
|
-
*/
|
|
49
|
-
export var assign = Object.assign || function (t) {
|
|
50
|
-
for (var i = 1; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) {
|
|
51
|
-
var s = i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1];
|
|
52
|
-
for (var p in s) {
|
|
53
|
-
if (Object.prototype.hasOwnProperty.call(s, p)) {
|
|
54
|
-
t[p] = s[p];
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return t;
|
|
59
|
-
};
|
package/es/base/version.d.ts
DELETED
package/es/base/version.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/base/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,UAAU,CAAC;AAC7C,eAAO,MAAM,gBAAgB,UAAU,CAAC"}
|
package/es/base/version.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { LibroService } from '@difizen/libro-core';
|
|
2
|
-
import type { IKernelConnection } from '@difizen/libro-kernel';
|
|
3
|
-
import { LibroKernelManager } from '@difizen/libro-kernel';
|
|
4
|
-
import { ApplicationContribution } from '@difizen/mana-app';
|
|
5
|
-
import type { LibroWidgets } from './libro-widgets.js';
|
|
6
|
-
import type { WidgetsOption } from './protocal.js';
|
|
7
|
-
export declare class LibroWidgetManager implements ApplicationContribution {
|
|
8
|
-
widgetsFactory: (options: WidgetsOption) => LibroWidgets;
|
|
9
|
-
kernelManager: LibroKernelManager;
|
|
10
|
-
libroService: LibroService;
|
|
11
|
-
initialize: () => void;
|
|
12
|
-
getOrCreateWidgets: (kc: IKernelConnection) => LibroWidgets;
|
|
13
|
-
/**
|
|
14
|
-
* Dictionary of model ids and model instance promises
|
|
15
|
-
*/
|
|
16
|
-
protected widgets: Map<string, LibroWidgets>;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=widget-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"widget-manager.d.ts","sourceRoot":"","sources":["../../src/base/widget-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAoB,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAA2B,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAErF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,qBACa,kBAAmB,YAAW,uBAAuB;IACnC,cAAc,EAAG,CAC5C,OAAO,EAAE,aAAa,KACnB,YAAY,CAAC;IACU,aAAa,EAAE,kBAAkB,CAAC;IACxC,YAAY,EAAE,YAAY,CAAC;IAEjD,UAAU,aAMR;IAEF,kBAAkB,OAAQ,iBAAiB,kBAQzC;IAEF;;OAEG;IAEH,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAa;CAC1D"}
|