@difizen/libro-jupyter 0.2.0 → 0.2.1
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/add-between-cell/add-between-cell.js +1 -1
- package/es/cell/jupyter-code-cell-view.d.ts +3 -1
- package/es/cell/jupyter-code-cell-view.d.ts.map +1 -1
- package/es/cell/jupyter-code-cell-view.js +12 -5
- package/es/command/command-contribution.d.ts.map +1 -1
- package/es/command/command-contribution.js +5 -5
- package/es/components/icons.js +1 -1
- package/es/contents/content-contribution.js +1 -1
- package/es/contents/save-content-contribution.d.ts +10 -0
- package/es/contents/save-content-contribution.d.ts.map +1 -0
- package/es/contents/save-content-contribution.js +110 -0
- package/es/file/file-create-modal.d.ts.map +1 -1
- package/es/file/file-create-modal.js +16 -5
- package/es/file/file-service.js +1 -1
- package/es/file/index.d.ts +1 -0
- package/es/file/index.d.ts.map +1 -1
- package/es/file/index.js +2 -1
- package/es/index.d.ts +1 -0
- package/es/index.d.ts.map +1 -1
- package/es/index.js +2 -1
- package/es/keybind-instructions/index.less +9 -9
- package/es/keybind-instructions/keybind-instructions-view.d.ts +2 -2
- package/es/keybind-instructions/keybind-instructions-view.d.ts.map +1 -1
- package/es/keybind-instructions/keybind-instructions-view.js +69 -63
- package/es/libro-jupyter-model.d.ts +2 -4
- package/es/libro-jupyter-model.d.ts.map +1 -1
- package/es/libro-jupyter-model.js +35 -120
- package/es/libro-jupyter-workspace.d.ts +18 -0
- package/es/libro-jupyter-workspace.d.ts.map +1 -0
- package/es/libro-jupyter-workspace.js +108 -0
- package/es/module.d.ts.map +1 -1
- package/es/module.js +5 -2
- package/es/output/libro-jupyter-outputarea.d.ts.map +1 -1
- package/es/output/libro-jupyter-outputarea.js +60 -56
- package/es/toolbar/save-file-error.d.ts.map +1 -1
- package/es/toolbar/save-file-error.js +20 -13
- package/es/widget/box/contribution.d.ts +10 -0
- package/es/widget/box/contribution.d.ts.map +1 -0
- package/es/widget/box/contribution.js +48 -0
- package/es/widget/box/index.d.ts +3 -0
- package/es/widget/box/index.d.ts.map +1 -0
- package/es/widget/box/index.js +2 -0
- package/es/widget/box/index.less +3 -0
- package/es/widget/box/view.d.ts +19 -0
- package/es/widget/box/view.d.ts.map +1 -0
- package/es/widget/box/view.js +114 -0
- package/es/widget/comm.d.ts +65 -0
- package/es/widget/comm.d.ts.map +1 -0
- package/es/widget/comm.js +153 -0
- package/es/widget/index.d.ts +10 -0
- package/es/widget/index.d.ts.map +1 -0
- package/es/widget/index.js +9 -0
- package/es/widget/index.less +7 -0
- package/es/widget/instance-progress/contribution.d.ts +10 -0
- package/es/widget/instance-progress/contribution.d.ts.map +1 -0
- package/es/widget/instance-progress/contribution.js +39 -0
- package/es/widget/instance-progress/index.d.ts +3 -0
- package/es/widget/instance-progress/index.d.ts.map +1 -0
- package/es/widget/instance-progress/index.js +2 -0
- package/es/widget/instance-progress/view.d.ts +30 -0
- package/es/widget/instance-progress/view.d.ts.map +1 -0
- package/es/widget/instance-progress/view.js +180 -0
- package/es/widget/libro-widgets.d.ts +84 -0
- package/es/widget/libro-widgets.d.ts.map +1 -0
- package/es/widget/libro-widgets.js +307 -0
- package/es/widget/module.d.ts +4 -0
- package/es/widget/module.d.ts.map +1 -0
- package/es/widget/module.js +38 -0
- package/es/widget/progress/contribution.d.ts +10 -0
- package/es/widget/progress/contribution.d.ts.map +1 -0
- package/es/widget/progress/contribution.js +39 -0
- package/es/widget/progress/index.d.ts +3 -0
- package/es/widget/progress/index.d.ts.map +1 -0
- package/es/widget/progress/index.js +2 -0
- package/es/widget/progress/progressBar.d.ts +15 -0
- package/es/widget/progress/progressBar.d.ts.map +1 -0
- package/es/widget/progress/progressBar.js +20 -0
- package/es/widget/progress/view.d.ts +19 -0
- package/es/widget/progress/view.d.ts.map +1 -0
- package/es/widget/progress/view.js +74 -0
- package/es/widget/protocol.d.ts +193 -0
- package/es/widget/protocol.d.ts.map +1 -0
- package/es/widget/protocol.js +33 -0
- package/es/widget/utils.d.ts +27 -0
- package/es/widget/utils.d.ts.map +1 -0
- package/es/widget/utils.js +59 -0
- package/es/widget/version.d.ts +3 -0
- package/es/widget/version.d.ts.map +1 -0
- package/es/widget/version.js +2 -0
- package/es/widget/widget-manager.d.ts +19 -0
- package/es/widget/widget-manager.d.ts.map +1 -0
- package/es/widget/widget-manager.js +77 -0
- package/es/widget/widget-render.d.ts +7 -0
- package/es/widget/widget-render.d.ts.map +1 -0
- package/es/widget/widget-render.js +46 -0
- package/es/widget/widget-rendermime-contribution.d.ts +16 -0
- package/es/widget/widget-rendermime-contribution.d.ts.map +1 -0
- package/es/widget/widget-rendermime-contribution.js +50 -0
- package/es/widget/widget-view-contribution.d.ts +10 -0
- package/es/widget/widget-view-contribution.d.ts.map +1 -0
- package/es/widget/widget-view-contribution.js +36 -0
- package/es/widget/widget-view.d.ts +71 -0
- package/es/widget/widget-view.d.ts.map +1 -0
- package/es/widget/widget-view.js +273 -0
- package/package.json +18 -18
- package/src/add-between-cell/add-between-cell.tsx +1 -1
- package/src/cell/jupyter-code-cell-view.tsx +14 -6
- package/src/command/command-contribution.ts +11 -10
- package/src/components/icons.tsx +1 -1
- package/src/contents/content-contribution.ts +1 -1
- package/src/contents/save-content-contribution.ts +67 -0
- package/src/file/file-create-modal.tsx +10 -1
- package/src/file/file-service.ts +1 -1
- package/src/file/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/keybind-instructions/index.less +9 -9
- package/src/keybind-instructions/keybind-instructions-view.tsx +72 -62
- package/src/libro-jupyter-model.ts +1 -69
- package/src/libro-jupyter-workspace.ts +49 -0
- package/src/module.ts +6 -0
- package/src/output/libro-jupyter-outputarea.tsx +56 -49
- package/src/toolbar/save-file-error.tsx +25 -15
- package/src/widget/box/contribution.ts +29 -0
- package/src/widget/box/index.less +3 -0
- package/src/widget/box/index.ts +2 -0
- package/src/widget/box/view.tsx +112 -0
- package/src/widget/comm.ts +152 -0
- package/src/widget/index.less +7 -0
- package/src/widget/index.ts +9 -0
- package/src/widget/instance-progress/contribution.ts +20 -0
- package/src/widget/instance-progress/index.ts +2 -0
- package/src/widget/instance-progress/view.tsx +155 -0
- package/src/widget/libro-widgets.ts +223 -0
- package/src/widget/module.ts +73 -0
- package/src/widget/progress/contribution.ts +24 -0
- package/src/widget/progress/index.ts +2 -0
- package/src/widget/progress/progressBar.tsx +29 -0
- package/src/widget/progress/view.tsx +70 -0
- package/src/widget/protocol.ts +255 -0
- package/src/widget/utils.ts +67 -0
- package/src/widget/version.ts +2 -0
- package/src/widget/widget-manager.ts +45 -0
- package/src/widget/widget-render.tsx +52 -0
- package/src/widget/widget-rendermime-contribution.ts +36 -0
- package/src/widget/widget-view-contribution.ts +14 -0
- package/src/widget/widget-view.tsx +259 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { JSONObject } from '@difizen/libro-common';
|
|
2
|
+
import type { IComm, IKernelConnection, IShellFuture } from '@difizen/libro-kernel';
|
|
3
|
+
import type { ICallbacks, IClassicComm } from './protocol.js';
|
|
4
|
+
import { WidgetCommOption } from './protocol.js';
|
|
5
|
+
/**
|
|
6
|
+
* Public constructor
|
|
7
|
+
* @param {IComm} jsServicesComm - @jupyterlab/services IComm instance
|
|
8
|
+
*/
|
|
9
|
+
export declare class Comm implements IClassicComm {
|
|
10
|
+
constructor(options: WidgetCommOption);
|
|
11
|
+
/**
|
|
12
|
+
* Comm id
|
|
13
|
+
* @return {string}
|
|
14
|
+
*/
|
|
15
|
+
get comm_id(): string;
|
|
16
|
+
/**
|
|
17
|
+
* Target name
|
|
18
|
+
* @return {string}
|
|
19
|
+
*/
|
|
20
|
+
get target_name(): string;
|
|
21
|
+
/**
|
|
22
|
+
* Opens a sibling comm in the backend
|
|
23
|
+
* @param data
|
|
24
|
+
* @param callbacks
|
|
25
|
+
* @param metadata
|
|
26
|
+
* @return msg id
|
|
27
|
+
*/
|
|
28
|
+
open(data: JSONObject, callbacks?: ICallbacks, metadata?: JSONObject, buffers?: ArrayBuffer[] | ArrayBufferView[]): string;
|
|
29
|
+
/**
|
|
30
|
+
* Sends a message to the sibling comm in the backend
|
|
31
|
+
* @param data
|
|
32
|
+
* @param callbacks
|
|
33
|
+
* @param metadata
|
|
34
|
+
* @param buffers
|
|
35
|
+
* @return message id
|
|
36
|
+
*/
|
|
37
|
+
send(data: JSONObject, callbacks?: ICallbacks, metadata?: JSONObject, buffers?: ArrayBuffer[] | ArrayBufferView[]): string;
|
|
38
|
+
/**
|
|
39
|
+
* Closes the sibling comm in the backend
|
|
40
|
+
* @param data
|
|
41
|
+
* @param callbacks
|
|
42
|
+
* @param metadata
|
|
43
|
+
* @return msg id
|
|
44
|
+
*/
|
|
45
|
+
close(data?: JSONObject, callbacks?: ICallbacks, metadata?: JSONObject, buffers?: ArrayBuffer[] | ArrayBufferView[]): string;
|
|
46
|
+
/**
|
|
47
|
+
* Register a message handler
|
|
48
|
+
* @param callback, which is given a message
|
|
49
|
+
*/
|
|
50
|
+
onMsg(callback: (x: any) => void): void;
|
|
51
|
+
/**
|
|
52
|
+
* Register a handler for when the comm is closed by the backend
|
|
53
|
+
* @param callback, which is given a message
|
|
54
|
+
*/
|
|
55
|
+
onClose(callback: (x: any) => void): void;
|
|
56
|
+
/**
|
|
57
|
+
* Hooks callback object up with @jupyterlab/services IKernelFuture
|
|
58
|
+
* @param @jupyterlab/services IKernelFuture instance
|
|
59
|
+
* @param callbacks
|
|
60
|
+
*/
|
|
61
|
+
_hookupCallbacks(future: IShellFuture, callbacks?: ICallbacks): void;
|
|
62
|
+
jsServicesComm: IComm;
|
|
63
|
+
kernel: IKernelConnection;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=comm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comm.d.ts","sourceRoot":"","sources":["../../src/widget/comm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGpF,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD;;;GAGG;AACH,qBACa,IAAK,YAAW,YAAY;gBACD,OAAO,EAAE,gBAAgB;IAI/D;;;OAGG;IACH,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED;;;OAGG;IACH,IAAI,WAAW,IAAI,MAAM,CAExB;IAED;;;;;;OAMG;IACH,IAAI,CACF,IAAI,EAAE,UAAU,EAChB,SAAS,CAAC,EAAE,UAAU,EACtB,QAAQ,CAAC,EAAE,UAAU,EACrB,OAAO,CAAC,EAAE,WAAW,EAAE,GAAG,eAAe,EAAE,GAC1C,MAAM;IAMT;;;;;;;OAOG;IACH,IAAI,CACF,IAAI,EAAE,UAAU,EAChB,SAAS,CAAC,EAAE,UAAU,EACtB,QAAQ,CAAC,EAAE,UAAU,EACrB,OAAO,CAAC,EAAE,WAAW,EAAE,GAAG,eAAe,EAAE,GAC1C,MAAM;IAMT;;;;;;OAMG;IACH,KAAK,CACH,IAAI,CAAC,EAAE,UAAU,EACjB,SAAS,CAAC,EAAE,UAAU,EACtB,QAAQ,CAAC,EAAE,UAAU,EACrB,OAAO,CAAC,EAAE,WAAW,EAAE,GAAG,eAAe,EAAE,GAC1C,MAAM;IAMT;;;OAGG;IACH,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;IAIvC;;;OAGG;IACH,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;IAIzC;;;;OAIG;IACH,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI;IAwCpE,cAAc,EAAE,KAAK,CAAC;IACtB,MAAM,EAAE,iBAAiB,CAAC;CAC3B"}
|
|
@@ -0,0 +1,153 @@
|
|
|
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, _class;
|
|
3
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
5
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
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); }
|
|
8
|
+
import { inject, transient } from '@difizen/mana-app';
|
|
9
|
+
import { WidgetCommOption } from "./protocol.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Public constructor
|
|
13
|
+
* @param {IComm} jsServicesComm - @jupyterlab/services IComm instance
|
|
14
|
+
*/
|
|
15
|
+
export var Comm = (_dec = transient(), _dec(_class = /*#__PURE__*/function () {
|
|
16
|
+
function Comm(options) {
|
|
17
|
+
_classCallCheck(this, Comm);
|
|
18
|
+
this.jsServicesComm = void 0;
|
|
19
|
+
this.kernel = void 0;
|
|
20
|
+
this.jsServicesComm = options.comm;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Comm id
|
|
25
|
+
* @return {string}
|
|
26
|
+
*/
|
|
27
|
+
Comm = inject(WidgetCommOption)(Comm, undefined, 0) || Comm;
|
|
28
|
+
_createClass(Comm, [{
|
|
29
|
+
key: "comm_id",
|
|
30
|
+
get: function get() {
|
|
31
|
+
return this.jsServicesComm.commId;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Target name
|
|
36
|
+
* @return {string}
|
|
37
|
+
*/
|
|
38
|
+
}, {
|
|
39
|
+
key: "target_name",
|
|
40
|
+
get: function get() {
|
|
41
|
+
return this.jsServicesComm.targetName;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Opens a sibling comm in the backend
|
|
46
|
+
* @param data
|
|
47
|
+
* @param callbacks
|
|
48
|
+
* @param metadata
|
|
49
|
+
* @return msg id
|
|
50
|
+
*/
|
|
51
|
+
}, {
|
|
52
|
+
key: "open",
|
|
53
|
+
value: function open(data, callbacks, metadata, buffers) {
|
|
54
|
+
var future = this.jsServicesComm.open(data, metadata, buffers);
|
|
55
|
+
this._hookupCallbacks(future, callbacks);
|
|
56
|
+
return future.msg.header.msg_id;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Sends a message to the sibling comm in the backend
|
|
61
|
+
* @param data
|
|
62
|
+
* @param callbacks
|
|
63
|
+
* @param metadata
|
|
64
|
+
* @param buffers
|
|
65
|
+
* @return message id
|
|
66
|
+
*/
|
|
67
|
+
}, {
|
|
68
|
+
key: "send",
|
|
69
|
+
value: function send(data, callbacks, metadata, buffers) {
|
|
70
|
+
var future = this.jsServicesComm.send(data, metadata, buffers);
|
|
71
|
+
this._hookupCallbacks(future, callbacks);
|
|
72
|
+
return future.msg.header.msg_id;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Closes the sibling comm in the backend
|
|
77
|
+
* @param data
|
|
78
|
+
* @param callbacks
|
|
79
|
+
* @param metadata
|
|
80
|
+
* @return msg id
|
|
81
|
+
*/
|
|
82
|
+
}, {
|
|
83
|
+
key: "close",
|
|
84
|
+
value: function close(data, callbacks, metadata, buffers) {
|
|
85
|
+
var future = this.jsServicesComm.close(data, metadata, buffers);
|
|
86
|
+
this._hookupCallbacks(future, callbacks);
|
|
87
|
+
return future.msg.header.msg_id;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Register a message handler
|
|
92
|
+
* @param callback, which is given a message
|
|
93
|
+
*/
|
|
94
|
+
}, {
|
|
95
|
+
key: "onMsg",
|
|
96
|
+
value: function onMsg(callback) {
|
|
97
|
+
this.jsServicesComm.onMsg = callback.bind(this);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Register a handler for when the comm is closed by the backend
|
|
102
|
+
* @param callback, which is given a message
|
|
103
|
+
*/
|
|
104
|
+
}, {
|
|
105
|
+
key: "onClose",
|
|
106
|
+
value: function onClose(callback) {
|
|
107
|
+
this.jsServicesComm.onClose = callback.bind(this);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Hooks callback object up with @jupyterlab/services IKernelFuture
|
|
112
|
+
* @param @jupyterlab/services IKernelFuture instance
|
|
113
|
+
* @param callbacks
|
|
114
|
+
*/
|
|
115
|
+
}, {
|
|
116
|
+
key: "_hookupCallbacks",
|
|
117
|
+
value: function _hookupCallbacks(future, callbacks) {
|
|
118
|
+
if (callbacks) {
|
|
119
|
+
future.onReply = function (msg) {
|
|
120
|
+
if (callbacks.shell && callbacks.shell['reply']) {
|
|
121
|
+
callbacks.shell['reply'](msg);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
future.onStdin = function (msg) {
|
|
125
|
+
if (callbacks.input) {
|
|
126
|
+
callbacks.input(msg);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
future.onIOPub = function (msg) {
|
|
130
|
+
if (callbacks.iopub) {
|
|
131
|
+
if (callbacks.iopub['status'] && msg.header.msg_type === 'status') {
|
|
132
|
+
callbacks.iopub['status'](msg);
|
|
133
|
+
} else if (callbacks.iopub['clear_output'] && msg.header.msg_type === 'clear_output') {
|
|
134
|
+
callbacks.iopub['clear_output'](msg);
|
|
135
|
+
} else if (callbacks.iopub['output']) {
|
|
136
|
+
switch (msg.header.msg_type) {
|
|
137
|
+
case 'display_data':
|
|
138
|
+
case 'execute_result':
|
|
139
|
+
case 'stream':
|
|
140
|
+
case 'error':
|
|
141
|
+
callbacks.iopub['output'](msg);
|
|
142
|
+
break;
|
|
143
|
+
default:
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}]);
|
|
152
|
+
return Comm;
|
|
153
|
+
}()) || _class);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './widget-render.js';
|
|
2
|
+
export * from './widget-rendermime-contribution.js';
|
|
3
|
+
export * from './libro-widgets.js';
|
|
4
|
+
export * from './widget-view.js';
|
|
5
|
+
export * from './widget-manager.js';
|
|
6
|
+
export * from './comm.js';
|
|
7
|
+
export * from './widget-view-contribution.js';
|
|
8
|
+
export * from './module.js';
|
|
9
|
+
export * from './protocol.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/widget/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,qCAAqC,CAAC;AACpD,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./widget-render.js";
|
|
2
|
+
export * from "./widget-rendermime-contribution.js";
|
|
3
|
+
export * from "./libro-widgets.js";
|
|
4
|
+
export * from "./widget-view.js";
|
|
5
|
+
export * from "./widget-manager.js";
|
|
6
|
+
export * from "./comm.js";
|
|
7
|
+
export * from "./widget-view-contribution.js";
|
|
8
|
+
export * from "./module.js";
|
|
9
|
+
export * from "./protocol.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ViewManager } from '@difizen/mana-app';
|
|
2
|
+
import type { IWidgetViewProps } from '../protocol.js';
|
|
3
|
+
import { WidgetViewContribution } from '../protocol.js';
|
|
4
|
+
import { InstancesProgressWidget } from './view.js';
|
|
5
|
+
export declare class InstancesProgressWidgetViewContribution implements WidgetViewContribution {
|
|
6
|
+
viewManager: ViewManager;
|
|
7
|
+
canHandle: (attributes: any) => 1 | 100;
|
|
8
|
+
factory(props: IWidgetViewProps): Promise<InstancesProgressWidget>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=contribution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contribution.d.ts","sourceRoot":"","sources":["../../../src/widget/instance-progress/contribution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,MAAM,mBAAmB,CAAC;AAEnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEpD,qBACa,uCAAwC,YAAW,sBAAsB;IAC/D,WAAW,EAAE,WAAW,CAAC;IAC9C,SAAS,eAAgB,GAAG,aAK1B;IACF,OAAO,CAAC,KAAK,EAAE,gBAAgB;CAGhC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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, _class, _class2, _descriptor;
|
|
3
|
+
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
|
|
4
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
6
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
+
function _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; }
|
|
10
|
+
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.'); }
|
|
11
|
+
import { ViewManager, inject, singleton } from '@difizen/mana-app';
|
|
12
|
+
import { WidgetViewContribution } from "../protocol.js";
|
|
13
|
+
import { InstancesProgressWidget } from "./view.js";
|
|
14
|
+
export var InstancesProgressWidgetViewContribution = (_dec = singleton({
|
|
15
|
+
contrib: WidgetViewContribution
|
|
16
|
+
}), _dec2 = inject(ViewManager), _dec(_class = (_class2 = /*#__PURE__*/function () {
|
|
17
|
+
function InstancesProgressWidgetViewContribution() {
|
|
18
|
+
_classCallCheck(this, InstancesProgressWidgetViewContribution);
|
|
19
|
+
_initializerDefineProperty(this, "viewManager", _descriptor, this);
|
|
20
|
+
this.canHandle = function (attributes) {
|
|
21
|
+
if (attributes._model_name === 'InstancesProgressModel') {
|
|
22
|
+
return 100;
|
|
23
|
+
}
|
|
24
|
+
return 1;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
_createClass(InstancesProgressWidgetViewContribution, [{
|
|
28
|
+
key: "factory",
|
|
29
|
+
value: function factory(props) {
|
|
30
|
+
return this.viewManager.getOrCreateView(InstancesProgressWidget, props);
|
|
31
|
+
}
|
|
32
|
+
}]);
|
|
33
|
+
return InstancesProgressWidgetViewContribution;
|
|
34
|
+
}(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "viewManager", [_dec2], {
|
|
35
|
+
configurable: true,
|
|
36
|
+
enumerable: true,
|
|
37
|
+
writable: true,
|
|
38
|
+
initializer: null
|
|
39
|
+
})), _class2)) || _class);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/widget/instance-progress/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="react" resolution-mode="require"/>
|
|
2
|
+
import { LibroContextKey } from '@difizen/libro-core';
|
|
3
|
+
import type { KernelMessage } from '@difizen/libro-kernel';
|
|
4
|
+
import type { IWidgetViewProps } from '../protocol.js';
|
|
5
|
+
import type { InstancesRecords, ProgressItem } from '../protocol.js';
|
|
6
|
+
import { WidgetView } from '../widget-view.js';
|
|
7
|
+
export interface ProgressOverviewProps {
|
|
8
|
+
progressMap: Record<string, ProgressItem>;
|
|
9
|
+
workingProgressKeys: string[];
|
|
10
|
+
prefix: string;
|
|
11
|
+
suffix: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const LibroInstancesProgressWidgetViewComponent: import("react").ForwardRefExoticComponent<import("react").RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export declare class InstancesProgressWidget extends WidgetView {
|
|
15
|
+
view: import("react").ForwardRefExoticComponent<import("react").RefAttributes<HTMLDivElement>>;
|
|
16
|
+
prefix: string;
|
|
17
|
+
suffix: string;
|
|
18
|
+
progressMap: Record<string, ProgressItem>;
|
|
19
|
+
workingProgressKeys: string[];
|
|
20
|
+
instanceRecords: InstancesRecords;
|
|
21
|
+
modalVisible: boolean;
|
|
22
|
+
modalProgressItemKey: string;
|
|
23
|
+
constructor(props: IWidgetViewProps, libroContextKey: LibroContextKey);
|
|
24
|
+
updateRecords(progressKey: string): void;
|
|
25
|
+
/**
|
|
26
|
+
* Handle incoming comm msg.
|
|
27
|
+
*/
|
|
28
|
+
handleCommMsg(msg: KernelMessage.ICommMsgMsg): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../src/widget/instance-progress/view.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAY3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAkB,gBAAgB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC1C,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,yCAAyC,0FA2BrD,CAAC;AACF,qBAEa,uBAAwB,SAAQ,UAAU;IAC5C,IAAI,2FAA6C;IAE1D,MAAM,EAAE,MAAM,CAAC;IAEf,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAM;IAC/C,mBAAmB,EAAE,MAAM,EAAE,CAAM;IACnC,eAAe,EAAE,gBAAgB,CAAM;IACvC,YAAY,UAAS;IACrB,oBAAoB,SAAM;gBAEJ,KAAK,EAAE,gBAAgB,EAClB,eAAe,EAAE,eAAe;IAM3D,aAAa,CAAC,WAAW,EAAE,MAAM;IAmBjC;;OAEG;IACM,aAAa,CAAC,GAAG,EAAE,aAAa,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CA2DtE"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _dec, _dec2, _dec3, _dec4, _class, _class2, _descriptor, _descriptor2;
|
|
3
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
7
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
+
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 }); }
|
|
10
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11
|
+
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); } }
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
14
|
+
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); }
|
|
15
|
+
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); }
|
|
16
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
17
|
+
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); }; }
|
|
18
|
+
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); }
|
|
19
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
20
|
+
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; } }
|
|
21
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
+
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; }
|
|
23
|
+
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.'); }
|
|
24
|
+
import { LibroContextKey } from '@difizen/libro-core';
|
|
25
|
+
import { useInject, view, ViewInstance, ViewOption, transient, inject, prop } from '@difizen/mana-app';
|
|
26
|
+
import { forwardRef } from 'react';
|
|
27
|
+
import { WidgetView } from "../widget-view.js";
|
|
28
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
29
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
30
|
+
export var LibroInstancesProgressWidgetViewComponent = /*#__PURE__*/forwardRef(function LibroInstancesProgressWidgetViewComponent(_props, ref) {
|
|
31
|
+
var widgetView = useInject(ViewInstance);
|
|
32
|
+
if (widgetView.isCommClosed) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
36
|
+
ref: ref,
|
|
37
|
+
className: "libro-instances-progress-widget",
|
|
38
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
39
|
+
style: {
|
|
40
|
+
paddingRight: 5
|
|
41
|
+
},
|
|
42
|
+
children: widgetView.prefix
|
|
43
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
44
|
+
children: widgetView.workingProgressKeys.map(function (progressKey) {
|
|
45
|
+
var progressItem = widgetView.progressMap[progressKey];
|
|
46
|
+
return /*#__PURE__*/_jsx("a", {
|
|
47
|
+
className: "pyodps-progress-launcher",
|
|
48
|
+
style: {
|
|
49
|
+
marginRight: 5
|
|
50
|
+
},
|
|
51
|
+
children: progressItem && progressItem.name
|
|
52
|
+
}, progressKey);
|
|
53
|
+
})
|
|
54
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
55
|
+
children: widgetView.suffix
|
|
56
|
+
})]
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
export var InstancesProgressWidget = (_dec = transient(), _dec2 = view('libro-widget-instances-progress-view'), _dec3 = prop(), _dec4 = prop(), _dec(_class = _dec2(_class = (_class2 = /*#__PURE__*/function (_WidgetView) {
|
|
60
|
+
_inherits(InstancesProgressWidget, _WidgetView);
|
|
61
|
+
var _super = _createSuper(InstancesProgressWidget);
|
|
62
|
+
function InstancesProgressWidget(props, libroContextKey) {
|
|
63
|
+
var _this;
|
|
64
|
+
_classCallCheck(this, InstancesProgressWidget);
|
|
65
|
+
_this = _super.call(this, props, libroContextKey);
|
|
66
|
+
_this.view = LibroInstancesProgressWidgetViewComponent;
|
|
67
|
+
_initializerDefineProperty(_this, "prefix", _descriptor, _assertThisInitialized(_this));
|
|
68
|
+
_initializerDefineProperty(_this, "suffix", _descriptor2, _assertThisInitialized(_this));
|
|
69
|
+
_this.progressMap = {};
|
|
70
|
+
_this.workingProgressKeys = [];
|
|
71
|
+
// Order of groups by time of insertion
|
|
72
|
+
_this.instanceRecords = {};
|
|
73
|
+
_this.modalVisible = false;
|
|
74
|
+
_this.modalProgressItemKey = '';
|
|
75
|
+
_this.prefix = props.attributes.prefix;
|
|
76
|
+
_this.suffix = props.attributes.suffix;
|
|
77
|
+
return _this;
|
|
78
|
+
}
|
|
79
|
+
InstancesProgressWidget = inject(LibroContextKey)(InstancesProgressWidget, undefined, 1) || InstancesProgressWidget;
|
|
80
|
+
InstancesProgressWidget = inject(ViewOption)(InstancesProgressWidget, undefined, 0) || InstancesProgressWidget;
|
|
81
|
+
_createClass(InstancesProgressWidget, [{
|
|
82
|
+
key: "updateRecords",
|
|
83
|
+
value: function updateRecords(progressKey) {
|
|
84
|
+
var _this2 = this;
|
|
85
|
+
var progressItem = this.progressMap[progressKey];
|
|
86
|
+
if (progressItem) {
|
|
87
|
+
var _progressItem$instanc = progressItem.instances,
|
|
88
|
+
instances = _progressItem$instanc === void 0 ? [] : _progressItem$instanc;
|
|
89
|
+
instances.forEach(function (instance) {
|
|
90
|
+
var id = instance.id,
|
|
91
|
+
status = instance.status;
|
|
92
|
+
if (!_this2.instanceRecords[id]) {
|
|
93
|
+
_this2.instanceRecords[id] = {
|
|
94
|
+
startDate: Date.now()
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
if (status === 'Terminated') {
|
|
98
|
+
if (!_this2.instanceRecords[id].endDate) {
|
|
99
|
+
_this2.instanceRecords[id].endDate = Date.now();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Handle incoming comm msg.
|
|
107
|
+
*/
|
|
108
|
+
}, {
|
|
109
|
+
key: "handleCommMsg",
|
|
110
|
+
value: function handleCommMsg(msg) {
|
|
111
|
+
var _this3 = this;
|
|
112
|
+
var data = msg.content.data;
|
|
113
|
+
var method = data.method;
|
|
114
|
+
switch (method) {
|
|
115
|
+
case 'update':
|
|
116
|
+
if (data.state.prefix) {
|
|
117
|
+
this.prefix = data.state.prefix;
|
|
118
|
+
}
|
|
119
|
+
if (data.state.suffix) {
|
|
120
|
+
this.suffix = data.state.suffix;
|
|
121
|
+
}
|
|
122
|
+
// eslint-disable-next-line no-fallthrough
|
|
123
|
+
case 'custom':
|
|
124
|
+
// eslint-disable-next-line no-case-declarations
|
|
125
|
+
var customMsg = data.content;
|
|
126
|
+
if (customMsg) {
|
|
127
|
+
// message format: '{"action": "action", content: ["content1", "content2"]}'
|
|
128
|
+
var msgObj = JSON.parse(customMsg);
|
|
129
|
+
var action = msgObj.action;
|
|
130
|
+
var content = [];
|
|
131
|
+
if (msgObj.content) {
|
|
132
|
+
content.push.apply(content, _toConsumableArray(msgObj.content));
|
|
133
|
+
}
|
|
134
|
+
switch (action) {
|
|
135
|
+
case 'update':
|
|
136
|
+
content.forEach(function (groupJson) {
|
|
137
|
+
var parsedProgressItem = JSON.parse(groupJson);
|
|
138
|
+
if (!_this3.progressMap[parsedProgressItem.key]) {
|
|
139
|
+
_this3.workingProgressKeys.push(parsedProgressItem.key);
|
|
140
|
+
}
|
|
141
|
+
_this3.progressMap[parsedProgressItem.key] = parsedProgressItem;
|
|
142
|
+
_this3.updateRecords(parsedProgressItem.key);
|
|
143
|
+
});
|
|
144
|
+
// ? TODO: 发出一个更新 modal signal 的信号,这里需要取到之前的 key
|
|
145
|
+
break;
|
|
146
|
+
case 'delete':
|
|
147
|
+
content.forEach(function (groupKey) {
|
|
148
|
+
if (!_this3.progressMap[groupKey]) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
var i = _this3.workingProgressKeys.indexOf(groupKey);
|
|
152
|
+
if (i >= 0) {
|
|
153
|
+
_this3.workingProgressKeys.splice(i, 1);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
break;
|
|
157
|
+
case 'clear':
|
|
158
|
+
this.progressMap = {};
|
|
159
|
+
this.workingProgressKeys = [];
|
|
160
|
+
// ? TODO: 发出更新 overview 以及 modal 的 signal
|
|
161
|
+
break;
|
|
162
|
+
default:
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return Promise.resolve();
|
|
167
|
+
}
|
|
168
|
+
}]);
|
|
169
|
+
return InstancesProgressWidget;
|
|
170
|
+
}(WidgetView), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "prefix", [_dec3], {
|
|
171
|
+
configurable: true,
|
|
172
|
+
enumerable: true,
|
|
173
|
+
writable: true,
|
|
174
|
+
initializer: null
|
|
175
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "suffix", [_dec4], {
|
|
176
|
+
configurable: true,
|
|
177
|
+
enumerable: true,
|
|
178
|
+
writable: true,
|
|
179
|
+
initializer: null
|
|
180
|
+
})), _class2)) || _class) || _class);
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { JSONObject } from '@difizen/libro-common';
|
|
2
|
+
import type { IKernelConnection, KernelMessage } from '@difizen/libro-kernel';
|
|
3
|
+
import type { Contribution } from '@difizen/mana-app';
|
|
4
|
+
import { Emitter } from '@difizen/mana-app';
|
|
5
|
+
import type { Comm } from './comm.js';
|
|
6
|
+
import type { IWidgets, IWidgetViewOptions, IClassicComm, WidgetCommOption } from './protocol.js';
|
|
7
|
+
import { WidgetsOption, WidgetViewContribution } from './protocol.js';
|
|
8
|
+
import type { WidgetView } from './widget-view.js';
|
|
9
|
+
export declare class LibroWidgets implements IWidgets {
|
|
10
|
+
WidgetViewProvider: Contribution.Provider<WidgetViewContribution>;
|
|
11
|
+
widgetEmitter: Emitter<{
|
|
12
|
+
WidgetViewName: string;
|
|
13
|
+
}>;
|
|
14
|
+
widgetCommFactory: (options: WidgetCommOption) => Comm;
|
|
15
|
+
kernelConnection: IKernelConnection;
|
|
16
|
+
constructor(options: WidgetsOption, widgetCommFactory: (options: WidgetCommOption) => Comm);
|
|
17
|
+
get onWidgetRender(): import("@difizen/mana-app").Event<{
|
|
18
|
+
WidgetViewName: string;
|
|
19
|
+
}>;
|
|
20
|
+
protected findProvider(attributes: any): WidgetViewContribution;
|
|
21
|
+
/**
|
|
22
|
+
* Create a comm which can be used for communication for a widget.
|
|
23
|
+
*
|
|
24
|
+
* If the data/metadata is passed in, open the comm before returning (i.e.,
|
|
25
|
+
* send the comm_open message). If the data and metadata is undefined, we
|
|
26
|
+
* want to reconstruct a comm that already exists in the kernel, so do not
|
|
27
|
+
* open the comm by sending the comm_open message.
|
|
28
|
+
*
|
|
29
|
+
* @param comm_target_name Comm target name
|
|
30
|
+
* @param model_id The comm id
|
|
31
|
+
* @param data The initial data for the comm
|
|
32
|
+
* @param metadata The metadata in the open message
|
|
33
|
+
*/
|
|
34
|
+
createComm(comm_target_name: string, model_id?: string, data?: JSONObject, metadata?: JSONObject, buffers?: ArrayBuffer[] | ArrayBufferView[]): Promise<IClassicComm>;
|
|
35
|
+
/**
|
|
36
|
+
* Get a model by model id.
|
|
37
|
+
*
|
|
38
|
+
* #### Notes
|
|
39
|
+
* If the model is not found, throw error.
|
|
40
|
+
*
|
|
41
|
+
* If you would like to synchronously test if a model exists, use .hasModel().
|
|
42
|
+
*/
|
|
43
|
+
getModel(model_id: string): WidgetView;
|
|
44
|
+
/**
|
|
45
|
+
* Returns true if the given model is registered, otherwise false.
|
|
46
|
+
*
|
|
47
|
+
* #### Notes
|
|
48
|
+
* This is a synchronous way to check if a model is registered.
|
|
49
|
+
*/
|
|
50
|
+
hasModel(model_id: string): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Handle when a comm is opened.
|
|
53
|
+
*/
|
|
54
|
+
handleCommOpen(comm: IClassicComm, msg: KernelMessage.ICommOpenMsg): Promise<WidgetView>;
|
|
55
|
+
registerWidgetView(model_id: string, model: Promise<WidgetView>): void;
|
|
56
|
+
handleCommClose(msg: KernelMessage.ICommCloseMsg): void;
|
|
57
|
+
unregisterWidgetView(model_id: string): void;
|
|
58
|
+
newWidgetView(attributes: any, options: IWidgetViewOptions): Promise<WidgetView>;
|
|
59
|
+
/**
|
|
60
|
+
* Close all widgets and empty the widget state.
|
|
61
|
+
* @return Promise that resolves when the widget state is cleared.
|
|
62
|
+
*/
|
|
63
|
+
clearState(): void;
|
|
64
|
+
/**
|
|
65
|
+
* Disconnect the widget manager from the kernel, setting each model's comm
|
|
66
|
+
* as dead.
|
|
67
|
+
*/
|
|
68
|
+
disconnect(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Dictionary of model ids and model instance promises
|
|
71
|
+
*/
|
|
72
|
+
protected models: Map<string, WidgetView>;
|
|
73
|
+
/**
|
|
74
|
+
* The comm target name to register
|
|
75
|
+
*/
|
|
76
|
+
id: string;
|
|
77
|
+
readonly commTargetName = "jupyter.widget";
|
|
78
|
+
/**
|
|
79
|
+
* Serialize the model. See the deserialization function at the top of this file
|
|
80
|
+
* and the kernel-side serializer/deserializer.
|
|
81
|
+
*/
|
|
82
|
+
toJSON(): string;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=libro-widgets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"libro-widgets.d.ts","sourceRoot":"","sources":["../../src/widget/libro-widgets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAEV,QAAQ,EACR,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,aAAa,EACb,sBAAsB,EACvB,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAInD,qBACa,YAAa,YAAW,QAAQ;IAE3C,kBAAkB,EAAE,YAAY,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC;IAClE,aAAa,EAAE,OAAO,CAAC;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC,CAAiB;IACnE,iBAAiB,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACvD,gBAAgB,EAAE,iBAAiB,CAAC;gBAGX,OAAO,EAAE,aAAa,EAE7C,iBAAiB,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI;IAUxD,IAAI,cAAc;;OAEjB;IAED,SAAS,CAAC,YAAY,CAAC,UAAU,EAAE,GAAG,GAAG,sBAAsB;IAS/D;;;;;;;;;;;;OAYG;IACG,UAAU,CACd,gBAAgB,EAAE,MAAM,EACxB,QAAQ,CAAC,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,UAAU,EACjB,QAAQ,CAAC,EAAE,UAAU,EACrB,OAAO,CAAC,EAAE,WAAW,EAAE,GAAG,eAAe,EAAE,GAC1C,OAAO,CAAC,YAAY,CAAC;IAYxB;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU;IAQtC;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAInC;;OAEG;IACG,cAAc,CAClB,IAAI,EAAE,YAAY,EAClB,GAAG,EAAE,aAAa,CAAC,YAAY,GAC9B,OAAO,CAAC,UAAU,CAAC;IAkBtB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI;IAatE,eAAe,CAAC,GAAG,EAAE,aAAa,CAAC,aAAa;IAMhD,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAMtC,aAAa,CACjB,UAAU,EAAE,GAAG,EACf,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,UAAU,CAAC;IAkBtB;;;OAGG;IACH,UAAU;IAGV;;;OAGG;IACH,UAAU,IAAI,IAAI;IAGlB;;OAEG;IAEH,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAa;IAEtD;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,cAAc,oBAAoB;IAE3C;;;OAGG;IACH,MAAM,IAAI,MAAM;CAMjB"}
|