@difizen/libro-core 0.1.32 → 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/cell/libro-cell-view.d.ts +6 -1
- package/es/cell/libro-cell-view.d.ts.map +1 -1
- package/es/cell/libro-cell-view.js +17 -1
- package/es/index.d.ts +1 -0
- package/es/index.d.ts.map +1 -1
- package/es/index.js +2 -1
- package/es/index.less +5 -3
- package/es/material-from-designer.js +2 -2
- package/es/output/output-area.d.ts +1 -0
- package/es/output/output-area.d.ts.map +1 -1
- package/es/output/output-area.js +70 -24
- package/es/output/output-model.d.ts +1 -0
- package/es/output/output-model.d.ts.map +1 -1
- package/es/output/output-model.js +17 -7
- package/es/output/output-protocol.d.ts +4 -0
- package/es/output/output-protocol.d.ts.map +1 -1
- package/es/theme/libro-color-registry.js +1 -1
- package/es/toolbar/change-cell-to-selector.d.ts.map +1 -1
- package/es/toolbar/change-cell-to-selector.js +7 -4
- package/package.json +5 -5
- package/src/cell/libro-cell-view.tsx +17 -1
- package/src/index.less +5 -3
- package/src/index.tsx +1 -0
- package/src/material-from-designer.tsx +2 -2
- package/src/output/output-area.tsx +34 -9
- package/src/output/output-model.tsx +5 -1
- package/src/output/output-protocol.ts +5 -0
- package/src/theme/libro-color-registry.ts +1 -1
- package/src/toolbar/change-cell-to-selector.tsx +12 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ViewComponent } from '@difizen/mana-app';
|
|
2
|
+
import { Deferred } from '@difizen/mana-app';
|
|
2
3
|
import { BaseView } from '@difizen/mana-app';
|
|
3
4
|
import { DisposableCollection } from '@difizen/mana-app';
|
|
4
5
|
import React from 'react';
|
|
@@ -16,7 +17,11 @@ export declare class LibroCellView extends BaseView implements CellView {
|
|
|
16
17
|
model: CellModel;
|
|
17
18
|
protected cellService: CellService;
|
|
18
19
|
view: ViewComponent;
|
|
19
|
-
|
|
20
|
+
protected _parent: NotebookView;
|
|
21
|
+
get parent(): NotebookView;
|
|
22
|
+
set parent(value: NotebookView);
|
|
23
|
+
protected parentDefer: Deferred<import("../libro-view.js").LibroView>;
|
|
24
|
+
get parentReady(): Promise<import("../libro-view.js").LibroView>;
|
|
20
25
|
className?: string | undefined;
|
|
21
26
|
hasInputHidden: boolean;
|
|
22
27
|
collapsedHidden: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-cell-view.d.ts","sourceRoot":"","sources":["../../src/cell/libro-cell-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"libro-cell-view.d.ts","sourceRoot":"","sources":["../../src/cell/libro-cell-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,QAAQ,EAAkC,MAAM,mBAAmB,CAAC;AAE7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAG1D,eAAO,MAAM,kBAAkB,+DAG7B,CAAC;AAEH,qBACa,aAAc,SAAQ,QAAS,YAAW,QAAQ;IAC7D,UAAmB,SAAS,uBAA8B;IAC1D,OAAO,EAAE,eAAe,CAAC;IAGzB,kBAAkB,SAAK;IAGvB,cAAc,SAAK;IAGnB,2BAA2B,UAAS;IAGpC,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IAC1B,IAAI,EAAE,aAAa,CAAsB;IAElD,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC;IAEhC,IAAI,MAAM,IAGQ,YAAY,CAD7B;IACD,IAAI,MAAM,CAAC,KAAK,EAAE,YAAY,EAG7B;IAED,SAAS,CAAC,WAAW,iDAAgC;IAErD,IAAI,WAAW,kDAEd;IAGQ,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAA+B;IAGtE,cAAc,EAAE,OAAO,CAAC;IAGxB,eAAe,UAAS;IAGxB,QAAQ,UAAS;gBAGK,OAAO,EAAE,eAAe,EACvB,WAAW,EAAE,WAAW;IAe/C,SAAS;IAuBT,gBAAgB;IAIhB,aAAa;IAIP,GAAG;IAKT,qBAAqB,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC;IAItD,IAAI;IAIJ,KAAK,CAAC,MAAM,EAAE,OAAO;IAIrB,QAAQ,UAAS;IACR,OAAO;IAIhB,MAAM,IAAI,SAAS;IAUnB,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAMb;CACH"}
|
|
@@ -23,6 +23,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
23
23
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
24
24
|
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; }
|
|
25
25
|
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.'); }
|
|
26
|
+
import { Deferred } from '@difizen/mana-app';
|
|
26
27
|
import { useInject, watch } from '@difizen/mana-app';
|
|
27
28
|
import { BaseView, view, ViewInstance, ViewOption } from '@difizen/mana-app';
|
|
28
29
|
import { inject } from '@difizen/mana-app';
|
|
@@ -54,7 +55,8 @@ export var LibroCellView = (_dec = view('libro-cell-view'), _dec2 = prop(), _dec
|
|
|
54
55
|
_initializerDefineProperty(_this, "model", _descriptor4, _assertThisInitialized(_this));
|
|
55
56
|
_this.cellService = void 0;
|
|
56
57
|
_this.view = LibroCellComponent;
|
|
57
|
-
_this.
|
|
58
|
+
_this._parent = void 0;
|
|
59
|
+
_this.parentDefer = new Deferred();
|
|
58
60
|
_initializerDefineProperty(_this, "className", _descriptor5, _assertThisInitialized(_this));
|
|
59
61
|
_initializerDefineProperty(_this, "hasInputHidden", _descriptor6, _assertThisInitialized(_this));
|
|
60
62
|
_initializerDefineProperty(_this, "collapsedHidden", _descriptor7, _assertThisInitialized(_this));
|
|
@@ -80,6 +82,20 @@ export var LibroCellView = (_dec = view('libro-cell-view'), _dec2 = prop(), _dec
|
|
|
80
82
|
LibroCellView = inject(CellService)(LibroCellView, undefined, 1) || LibroCellView;
|
|
81
83
|
LibroCellView = inject(ViewOption)(LibroCellView, undefined, 0) || LibroCellView;
|
|
82
84
|
_createClass(LibroCellView, [{
|
|
85
|
+
key: "parent",
|
|
86
|
+
get: function get() {
|
|
87
|
+
return this._parent;
|
|
88
|
+
},
|
|
89
|
+
set: function set(value) {
|
|
90
|
+
this._parent = value;
|
|
91
|
+
this.parentDefer.resolve(this.parent);
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
key: "parentReady",
|
|
95
|
+
get: function get() {
|
|
96
|
+
return this.parentDefer.promise;
|
|
97
|
+
}
|
|
98
|
+
}, {
|
|
83
99
|
key: "cellWatch",
|
|
84
100
|
value: function cellWatch() {
|
|
85
101
|
var _this2 = this;
|
package/es/index.d.ts
CHANGED
package/es/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC"}
|
package/es/index.js
CHANGED
|
@@ -21,4 +21,5 @@ export * from "./libro-setting.js";
|
|
|
21
21
|
export * from "./settings/index.js";
|
|
22
22
|
export * from "./virtualized-manager.js";
|
|
23
23
|
export * from "./virtualized-manager-helper.js";
|
|
24
|
-
export * from "./libro-workspace-service.js";
|
|
24
|
+
export * from "./libro-workspace-service.js";
|
|
25
|
+
export * from "./libro-context-key.js";
|
package/es/index.less
CHANGED
|
@@ -56,13 +56,15 @@
|
|
|
56
56
|
.libro-view-top {
|
|
57
57
|
display: flex;
|
|
58
58
|
align-items: center;
|
|
59
|
+
justify-content: space-between;
|
|
59
60
|
width: 100%;
|
|
60
61
|
height: 44px;
|
|
61
62
|
// background-color: var(--mana-color-bg-elevated);
|
|
62
63
|
border-bottom: 1px solid var(--mana-libro-toptoolbar-border-color);
|
|
63
64
|
|
|
64
65
|
.libro-header-left {
|
|
65
|
-
width:
|
|
66
|
+
width: 240px;
|
|
67
|
+
flex-shrink: 0;
|
|
66
68
|
|
|
67
69
|
.mana-toolbar {
|
|
68
70
|
justify-content: left;
|
|
@@ -71,13 +73,12 @@
|
|
|
71
73
|
|
|
72
74
|
.libro-header-center {
|
|
73
75
|
.mana-toolbar {
|
|
74
|
-
justify-content:
|
|
76
|
+
justify-content: flex-start;
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
.libro-header-center,
|
|
79
81
|
.libro-header-right {
|
|
80
|
-
flex: 1;
|
|
81
82
|
overflow: hidden;
|
|
82
83
|
|
|
83
84
|
.mana-toolbar {
|
|
@@ -122,6 +123,7 @@
|
|
|
122
123
|
|
|
123
124
|
.libro-header-right {
|
|
124
125
|
color: unset;
|
|
126
|
+
flex: 0 0 auto;
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
.libro-keybind-instructions-icon {
|
|
@@ -57,7 +57,7 @@ export var PauseCircleOutlined = function PauseCircleOutlined() {
|
|
|
57
57
|
children: /*#__PURE__*/_jsxs("g", {
|
|
58
58
|
id: "time-out",
|
|
59
59
|
fillRule: "nonzero",
|
|
60
|
-
fill: "
|
|
60
|
+
fill: "currentColor",
|
|
61
61
|
children: [/*#__PURE__*/_jsx("rect", {
|
|
62
62
|
id: "\u77E9\u5F62",
|
|
63
63
|
fill: "#000000",
|
|
@@ -91,7 +91,7 @@ export var Reload = function Reload() {
|
|
|
91
91
|
children: /*#__PURE__*/_jsx("g", {
|
|
92
92
|
id: "2.1-kernel-\u72B6\u6001\u5C55\u793A",
|
|
93
93
|
transform: "translate(-776.000000, -80.000000)",
|
|
94
|
-
fill: "
|
|
94
|
+
fill: "currentColor",
|
|
95
95
|
fillRule: "nonzero",
|
|
96
96
|
children: /*#__PURE__*/_jsx("g", {
|
|
97
97
|
id: "\u7F16\u7EC4-24",
|
|
@@ -24,6 +24,7 @@ export declare class LibroOutputArea extends BaseView implements BaseOutputArea
|
|
|
24
24
|
get(index: number): BaseOutputView;
|
|
25
25
|
protected doCreateOutput(options: IOutput): Promise<BaseOutputView>;
|
|
26
26
|
add: (output: IOutput) => Promise<number>;
|
|
27
|
+
protected remove(model: BaseOutputView): void;
|
|
27
28
|
set: (index: number, output: IOutput) => Promise<void>;
|
|
28
29
|
clear(wait?: boolean | undefined): void;
|
|
29
30
|
fromJSON: (values: IOutput[]) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-area.d.ts","sourceRoot":"","sources":["../../src/output/output-area.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAIL,QAAQ,EAKT,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAoC,MAAM,mBAAmB,CAAC;AAK9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"output-area.d.ts","sourceRoot":"","sources":["../../src/output/output-area.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAIL,QAAQ,EAKT,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAoC,MAAM,mBAAmB,CAAC;AAK9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAuC1D,qBAEa,eAAgB,SAAQ,QAAS,YAAW,cAAc;IAC5D,IAAI,EAAE,aAAa,CAAyB;IAErD,cAAc,EAAE,YAAY,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAC1D,IAAI,EAAE,QAAQ,CAAC;IAEf,OAAO,EAAE,cAAc,EAAE,CAAM;gBAIC,MAAM,EAAE,iBAAiB;IAIzD,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eof = "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
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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
3
7
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
8
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
9
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
7
|
-
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); }
|
|
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
10
|
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; }
|
|
10
11
|
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); } }
|
|
11
12
|
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); }); }; }
|
|
@@ -24,6 +25,9 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
24
25
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
25
26
|
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; }
|
|
26
27
|
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.'); }
|
|
28
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
29
|
+
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); }
|
|
30
|
+
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; }
|
|
27
31
|
import { isError, isStream } from '@difizen/libro-common';
|
|
28
32
|
import { ViewOption, getOrigin, ViewRender, BaseView, Priority, useInject, view, ViewInstance } from '@difizen/mana-app';
|
|
29
33
|
import { Emitter, prop, contrib, inject, transient } from '@difizen/mana-app';
|
|
@@ -32,6 +36,7 @@ import { v4 } from 'uuid';
|
|
|
32
36
|
import { ExecutableCellView } from "../cell/index.js";
|
|
33
37
|
import { OutputContribution } from "./output-protocol.js";
|
|
34
38
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
39
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
35
40
|
var LibroOutputAreaRender = /*#__PURE__*/forwardRef(function LibroOutputAreaRender(props, ref) {
|
|
36
41
|
var outputArea = useInject(ViewInstance);
|
|
37
42
|
|
|
@@ -41,17 +46,39 @@ var LibroOutputAreaRender = /*#__PURE__*/forwardRef(function LibroOutputAreaRend
|
|
|
41
46
|
useEffect(function () {
|
|
42
47
|
outputArea.onUpdateEmitter.fire();
|
|
43
48
|
}, [outputArea.onUpdateEmitter, outputArea.outputs]);
|
|
44
|
-
|
|
49
|
+
var childrenCannotClear = [];
|
|
50
|
+
var children = [];
|
|
51
|
+
var _iterator = _createForOfIteratorHelper(outputArea.outputs),
|
|
52
|
+
_step;
|
|
53
|
+
try {
|
|
54
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
55
|
+
var output = _step.value;
|
|
56
|
+
if (output.allowClear === false) {
|
|
57
|
+
childrenCannotClear.push(output);
|
|
58
|
+
} else {
|
|
59
|
+
children.push(output);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
} catch (err) {
|
|
63
|
+
_iterator.e(err);
|
|
64
|
+
} finally {
|
|
65
|
+
_iterator.f();
|
|
66
|
+
}
|
|
67
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
45
68
|
className: "libro-output-area",
|
|
46
69
|
ref: ref
|
|
47
70
|
//设置最小高度,用于优化长文本输出再次执行时的页面的滚动控制
|
|
48
71
|
// style={{ minHeight: `${executing ? outputArea.lastOutputContainerHeight + 'px' : 'unset'}` }}
|
|
49
72
|
,
|
|
50
|
-
children:
|
|
73
|
+
children: [childrenCannotClear.map(function (output) {
|
|
51
74
|
return /*#__PURE__*/_jsx(ViewRender, {
|
|
52
75
|
view: output
|
|
53
76
|
}, output.id);
|
|
54
|
-
})
|
|
77
|
+
}), children.map(function (output) {
|
|
78
|
+
return /*#__PURE__*/_jsx(ViewRender, {
|
|
79
|
+
view: output
|
|
80
|
+
}, output.id);
|
|
81
|
+
})]
|
|
55
82
|
});
|
|
56
83
|
});
|
|
57
84
|
export var LibroOutputArea = (_dec = transient(), _dec2 = view('libro-output-area'), _dec3 = contrib(OutputContribution), _dec4 = prop(), _dec(_class = _dec2(_class = (_class2 = /*#__PURE__*/function (_BaseView) {
|
|
@@ -77,15 +104,20 @@ export var LibroOutputArea = (_dec = transient(), _dec2 = view('libro-output-are
|
|
|
77
104
|
_this.onUpdateEmitter = new Emitter();
|
|
78
105
|
_this.add = /*#__PURE__*/function () {
|
|
79
106
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(output) {
|
|
80
|
-
var index, outputModel;
|
|
107
|
+
var index, outputModel, model;
|
|
81
108
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
82
109
|
while (1) switch (_context.prev = _context.next) {
|
|
83
110
|
case 0:
|
|
111
|
+
if (_this.clearNext) {
|
|
112
|
+
_this.clear();
|
|
113
|
+
_this.clearNext = false;
|
|
114
|
+
}
|
|
115
|
+
// Consolidate outputs if they are stream outputs of the same kind.
|
|
84
116
|
if (!(isStream(output) && _this.lastStream && output.name === _this.lastName && _this.shouldCombine({
|
|
85
117
|
output: output,
|
|
86
118
|
lastModel: _this.outputs[_this.length - 1]
|
|
87
119
|
}))) {
|
|
88
|
-
_context.next =
|
|
120
|
+
_context.next = 8;
|
|
89
121
|
break;
|
|
90
122
|
}
|
|
91
123
|
// In order to get a list change event, we add the previous
|
|
@@ -97,7 +129,7 @@ export var LibroOutputArea = (_dec = transient(), _dec2 = view('libro-output-are
|
|
|
97
129
|
index = _this.length - 1;
|
|
98
130
|
_this.set(index, output);
|
|
99
131
|
return _context.abrupt("return", _this.length);
|
|
100
|
-
case
|
|
132
|
+
case 8:
|
|
101
133
|
if (isStream(output)) {
|
|
102
134
|
output.text = removeOverwrittenChars(normalize(output.text));
|
|
103
135
|
}
|
|
@@ -108,13 +140,15 @@ export var LibroOutputArea = (_dec = transient(), _dec2 = view('libro-output-are
|
|
|
108
140
|
} else {
|
|
109
141
|
_this.lastStream = '';
|
|
110
142
|
}
|
|
111
|
-
_context.t0 = _this.outputs;
|
|
112
143
|
_context.next = 13;
|
|
113
144
|
return outputModel;
|
|
114
145
|
case 13:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
146
|
+
model = _context.sent;
|
|
147
|
+
model.onDisposed(function () {
|
|
148
|
+
_this.remove(model);
|
|
149
|
+
});
|
|
150
|
+
return _context.abrupt("return", _this.outputs.push(model));
|
|
151
|
+
case 16:
|
|
118
152
|
case "end":
|
|
119
153
|
return _context.stop();
|
|
120
154
|
}
|
|
@@ -126,7 +160,7 @@ export var LibroOutputArea = (_dec = transient(), _dec2 = view('libro-output-are
|
|
|
126
160
|
}();
|
|
127
161
|
_this.set = /*#__PURE__*/function () {
|
|
128
162
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(index, output) {
|
|
129
|
-
var outputModel, current;
|
|
163
|
+
var outputModel, current, model;
|
|
130
164
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
131
165
|
while (1) switch (_context2.prev = _context2.next) {
|
|
132
166
|
case 0:
|
|
@@ -136,8 +170,12 @@ export var LibroOutputArea = (_dec = transient(), _dec2 = view('libro-output-are
|
|
|
136
170
|
_context2.next = 5;
|
|
137
171
|
return outputModel;
|
|
138
172
|
case 5:
|
|
139
|
-
|
|
140
|
-
|
|
173
|
+
model = _context2.sent;
|
|
174
|
+
model.onDisposed(function () {
|
|
175
|
+
_this.remove(model);
|
|
176
|
+
});
|
|
177
|
+
_this.outputs[index] = model;
|
|
178
|
+
case 8:
|
|
141
179
|
case "end":
|
|
142
180
|
return _context2.stop();
|
|
143
181
|
}
|
|
@@ -149,7 +187,7 @@ export var LibroOutputArea = (_dec = transient(), _dec2 = view('libro-output-are
|
|
|
149
187
|
}();
|
|
150
188
|
_this.fromJSON = /*#__PURE__*/function () {
|
|
151
189
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(values) {
|
|
152
|
-
var
|
|
190
|
+
var _iterator2, _step2, value;
|
|
153
191
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
154
192
|
while (1) switch (_context3.prev = _context3.next) {
|
|
155
193
|
case 0:
|
|
@@ -160,15 +198,15 @@ export var LibroOutputArea = (_dec = transient(), _dec2 = view('libro-output-are
|
|
|
160
198
|
return _context3.abrupt("return");
|
|
161
199
|
case 2:
|
|
162
200
|
// this.clear();
|
|
163
|
-
|
|
201
|
+
_iterator2 = _createForOfIteratorHelper(values);
|
|
164
202
|
_context3.prev = 3;
|
|
165
|
-
|
|
203
|
+
_iterator2.s();
|
|
166
204
|
case 5:
|
|
167
|
-
if ((
|
|
205
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
168
206
|
_context3.next = 11;
|
|
169
207
|
break;
|
|
170
208
|
}
|
|
171
|
-
value =
|
|
209
|
+
value = _step2.value;
|
|
172
210
|
_context3.next = 9;
|
|
173
211
|
return _this.add(value);
|
|
174
212
|
case 9:
|
|
@@ -180,10 +218,10 @@ export var LibroOutputArea = (_dec = transient(), _dec2 = view('libro-output-are
|
|
|
180
218
|
case 13:
|
|
181
219
|
_context3.prev = 13;
|
|
182
220
|
_context3.t0 = _context3["catch"](3);
|
|
183
|
-
|
|
221
|
+
_iterator2.e(_context3.t0);
|
|
184
222
|
case 16:
|
|
185
223
|
_context3.prev = 16;
|
|
186
|
-
|
|
224
|
+
_iterator2.f();
|
|
187
225
|
return _context3.finish(16);
|
|
188
226
|
case 19:
|
|
189
227
|
case "end":
|
|
@@ -234,6 +272,15 @@ export var LibroOutputArea = (_dec = transient(), _dec2 = view('libro-output-are
|
|
|
234
272
|
cell: this.cell
|
|
235
273
|
});
|
|
236
274
|
}
|
|
275
|
+
}, {
|
|
276
|
+
key: "remove",
|
|
277
|
+
value: function remove(model) {
|
|
278
|
+
var outputs = _toConsumableArray(this.outputs);
|
|
279
|
+
outputs = outputs.filter(function (item) {
|
|
280
|
+
return item !== model;
|
|
281
|
+
});
|
|
282
|
+
this.outputs = outputs;
|
|
283
|
+
}
|
|
237
284
|
}, {
|
|
238
285
|
key: "clear",
|
|
239
286
|
value: function clear(wait) {
|
|
@@ -245,7 +292,6 @@ export var LibroOutputArea = (_dec = transient(), _dec2 = view('libro-output-are
|
|
|
245
292
|
this.outputs.forEach(function (output) {
|
|
246
293
|
output.dispose();
|
|
247
294
|
});
|
|
248
|
-
this.outputs = [];
|
|
249
295
|
}
|
|
250
296
|
}, {
|
|
251
297
|
key: "setupCellView",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-model.d.ts","sourceRoot":"","sources":["../../src/output/output-model.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EAAE,QAAQ,EAA0B,MAAM,mBAAmB,CAAC;AAErE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,K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+1,13 @@
|
|
|
1
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, _dec5, _class, _class2, _descriptor, _descriptor2, _descriptor3;
|
|
2
|
+
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4;
|
|
3
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
4
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
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
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
7
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
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 _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
10
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
9
11
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
10
12
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
11
13
|
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); }; }
|
|
@@ -25,7 +27,7 @@ var LibroOutputModelRender = function LibroOutputModelRender(props) {
|
|
|
25
27
|
children: JSON.stringify(output.toJSON(), null, 2)
|
|
26
28
|
});
|
|
27
29
|
};
|
|
28
|
-
export var LibroOutputView = (_dec = transient(), _dec2 = view('libro-output-model'), _dec3 = prop(), _dec4 = prop(), _dec5 = prop(), _dec(_class = _dec2(_class = (_class2 = /*#__PURE__*/function (_BaseView) {
|
|
30
|
+
export var LibroOutputView = (_dec = transient(), _dec2 = view('libro-output-model'), _dec3 = prop(), _dec4 = prop(), _dec5 = prop(), _dec6 = prop(), _dec(_class = _dec2(_class = (_class2 = /*#__PURE__*/function (_BaseView) {
|
|
29
31
|
_inherits(LibroOutputView, _BaseView);
|
|
30
32
|
var _super = _createSuper(LibroOutputView);
|
|
31
33
|
function LibroOutputView(options) {
|
|
@@ -36,8 +38,9 @@ export var LibroOutputView = (_dec = transient(), _dec2 = view('libro-output-mod
|
|
|
36
38
|
// 增加cell属性,使得通过output可以找到Cell
|
|
37
39
|
_this.cell = void 0;
|
|
38
40
|
_initializerDefineProperty(_this, "raw", _descriptor, _assertThisInitialized(_this));
|
|
39
|
-
_initializerDefineProperty(_this, "
|
|
40
|
-
_initializerDefineProperty(_this, "
|
|
41
|
+
_initializerDefineProperty(_this, "allowClear", _descriptor2, _assertThisInitialized(_this));
|
|
42
|
+
_initializerDefineProperty(_this, "data", _descriptor3, _assertThisInitialized(_this));
|
|
43
|
+
_initializerDefineProperty(_this, "metadata", _descriptor4, _assertThisInitialized(_this));
|
|
41
44
|
_this.type = void 0;
|
|
42
45
|
_this.trusted = void 0;
|
|
43
46
|
_this.render = LibroOutputModelRender;
|
|
@@ -53,7 +56,7 @@ export var LibroOutputView = (_dec = transient(), _dec2 = view('libro-output-mod
|
|
|
53
56
|
_createClass(LibroOutputView, [{
|
|
54
57
|
key: "dispose",
|
|
55
58
|
value: function dispose() {
|
|
56
|
-
|
|
59
|
+
_get(_getPrototypeOf(LibroOutputView.prototype), "dispose", this).call(this);
|
|
57
60
|
}
|
|
58
61
|
}, {
|
|
59
62
|
key: "toJSON",
|
|
@@ -77,12 +80,19 @@ export var LibroOutputView = (_dec = transient(), _dec2 = view('libro-output-mod
|
|
|
77
80
|
enumerable: true,
|
|
78
81
|
writable: true,
|
|
79
82
|
initializer: null
|
|
80
|
-
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "
|
|
83
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "allowClear", [_dec4], {
|
|
84
|
+
configurable: true,
|
|
85
|
+
enumerable: true,
|
|
86
|
+
writable: true,
|
|
87
|
+
initializer: function initializer() {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
}), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "data", [_dec5], {
|
|
81
91
|
configurable: true,
|
|
82
92
|
enumerable: true,
|
|
83
93
|
writable: true,
|
|
84
94
|
initializer: null
|
|
85
|
-
}),
|
|
95
|
+
}), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "metadata", [_dec6], {
|
|
86
96
|
configurable: true,
|
|
87
97
|
enumerable: true,
|
|
88
98
|
writable: true,
|
|
@@ -98,6 +98,10 @@ export interface BaseOutputView extends View {
|
|
|
98
98
|
* Depending on the implementation of the mime model,
|
|
99
99
|
*/
|
|
100
100
|
setData(options: ISetDataOptions): void;
|
|
101
|
+
/**
|
|
102
|
+
* undefined is considered allowed
|
|
103
|
+
*/
|
|
104
|
+
allowClear?: boolean;
|
|
101
105
|
}
|
|
102
106
|
/**
|
|
103
107
|
* @deprecated use BaseOutputView instead
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-protocol.d.ts","sourceRoot":"","sources":["../../src/output/output-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,yBAAyB,EACzB,UAAU,EACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,eAAO,MAAM,UAAU,eAAuB,CAAC;AAE/C,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,MAAM,WAAW,cAAe,SAAQ,IAAI;IAC1C;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAA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BAAkB;IACjC,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,MAAM,CAAC;IACvC,OAAO,EAAE,kBAAkB,CAAC;CAC7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change-cell-to-selector.d.ts","sourceRoot":"","sources":["../../src/toolbar/change-cell-to-selector.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"change-cell-to-selector.d.ts","sourceRoot":"","sources":["../../src/toolbar/change-cell-to-selector.tsx"],"names":[],"mappings":";AAgBA,OAAO,cAAc,CAAC;AAQtB,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAwCvC,CAAC;AAEF,eAAO,MAAM,cAAc,0CAA4B,CAAC"}
|
|
@@ -4,14 +4,13 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
4
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
5
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
6
|
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; }
|
|
7
|
-
import { useInject, ToolbarInstance, getOrigin, CommandRegistry } from '@difizen/mana-app';
|
|
8
|
-
import { Select } from 'antd';
|
|
7
|
+
import { useInject, ToolbarInstance, getOrigin, CommandRegistry, ThemeService } from '@difizen/mana-app';
|
|
8
|
+
import { ConfigProvider, Select, theme } from 'antd';
|
|
9
9
|
import { memo } from 'react';
|
|
10
10
|
import { LibroCellService } from "../cell/index.js";
|
|
11
11
|
import { NotebookCommands } from "../command/index.js";
|
|
12
12
|
import "./index.less";
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
15
14
|
var Option = Select.Option;
|
|
16
15
|
var widthStyle = {
|
|
17
16
|
width: 110
|
|
@@ -24,11 +23,15 @@ export var ToolItemSelectInner = function ToolItemSelectInner() {
|
|
|
24
23
|
var data = toolbar.currentArgs;
|
|
25
24
|
var command = useInject(CommandRegistry);
|
|
26
25
|
var curCell = data === null || data === void 0 ? void 0 : data[0];
|
|
26
|
+
var themeService = useInject(ThemeService);
|
|
27
27
|
var handleChange = function handleChange(value) {
|
|
28
28
|
var args = getOrigin(data) || [];
|
|
29
29
|
command.executeCommand.apply(command, [NotebookCommands['ChangeCellTo'].id].concat(_toConsumableArray(args), [value]));
|
|
30
30
|
};
|
|
31
|
-
return /*#__PURE__*/_jsx(
|
|
31
|
+
return /*#__PURE__*/_jsx(ConfigProvider, {
|
|
32
|
+
theme: {
|
|
33
|
+
algorithm: themeService.getCurrentTheme().type === 'dark' ? theme.darkAlgorithm : theme.defaultAlgorithm
|
|
34
|
+
},
|
|
32
35
|
children: /*#__PURE__*/_jsx(Select, {
|
|
33
36
|
value: curCell === null || curCell === void 0 || (_curCell$model = curCell.model) === null || _curCell$model === void 0 ? void 0 : _curCell$model.type,
|
|
34
37
|
size: 'small',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.34",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@ant-design/icons": "^5.1.0",
|
|
37
|
-
"@difizen/libro-code-editor": "^0.1.
|
|
38
|
-
"@difizen/libro-common": "^0.1.
|
|
39
|
-
"@difizen/libro-shared-model": "^0.1.
|
|
40
|
-
"@difizen/libro-virtualized": "^0.1.
|
|
37
|
+
"@difizen/libro-code-editor": "^0.1.34",
|
|
38
|
+
"@difizen/libro-common": "^0.1.34",
|
|
39
|
+
"@difizen/libro-shared-model": "^0.1.34",
|
|
40
|
+
"@difizen/libro-virtualized": "^0.1.34",
|
|
41
41
|
"@difizen/mana-app": "latest",
|
|
42
42
|
"@difizen/mana-l10n": "latest",
|
|
43
43
|
"@difizen/mana-react": "latest",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ViewComponent } from '@difizen/mana-app';
|
|
2
|
+
import { Deferred } from '@difizen/mana-app';
|
|
2
3
|
import { useInject, watch } from '@difizen/mana-app';
|
|
3
4
|
import { BaseView, view, ViewInstance, ViewOption } from '@difizen/mana-app';
|
|
4
5
|
import { inject } from '@difizen/mana-app';
|
|
@@ -36,7 +37,22 @@ export class LibroCellView extends BaseView implements CellView {
|
|
|
36
37
|
model: CellModel;
|
|
37
38
|
protected cellService: CellService;
|
|
38
39
|
override view: ViewComponent = LibroCellComponent;
|
|
39
|
-
|
|
40
|
+
|
|
41
|
+
protected _parent: NotebookView;
|
|
42
|
+
|
|
43
|
+
get parent() {
|
|
44
|
+
return this._parent;
|
|
45
|
+
}
|
|
46
|
+
set parent(value: NotebookView) {
|
|
47
|
+
this._parent = value;
|
|
48
|
+
this.parentDefer.resolve(this.parent);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
protected parentDefer = new Deferred<NotebookView>();
|
|
52
|
+
|
|
53
|
+
get parentReady() {
|
|
54
|
+
return this.parentDefer.promise;
|
|
55
|
+
}
|
|
40
56
|
|
|
41
57
|
@prop()
|
|
42
58
|
override className?: string | undefined = 'libro-cell-view-container';
|
package/src/index.less
CHANGED
|
@@ -56,13 +56,15 @@
|
|
|
56
56
|
.libro-view-top {
|
|
57
57
|
display: flex;
|
|
58
58
|
align-items: center;
|
|
59
|
+
justify-content: space-between;
|
|
59
60
|
width: 100%;
|
|
60
61
|
height: 44px;
|
|
61
62
|
// background-color: var(--mana-color-bg-elevated);
|
|
62
63
|
border-bottom: 1px solid var(--mana-libro-toptoolbar-border-color);
|
|
63
64
|
|
|
64
65
|
.libro-header-left {
|
|
65
|
-
width:
|
|
66
|
+
width: 240px;
|
|
67
|
+
flex-shrink: 0;
|
|
66
68
|
|
|
67
69
|
.mana-toolbar {
|
|
68
70
|
justify-content: left;
|
|
@@ -71,13 +73,12 @@
|
|
|
71
73
|
|
|
72
74
|
.libro-header-center {
|
|
73
75
|
.mana-toolbar {
|
|
74
|
-
justify-content:
|
|
76
|
+
justify-content: flex-start;
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
.libro-header-center,
|
|
79
81
|
.libro-header-right {
|
|
80
|
-
flex: 1;
|
|
81
82
|
overflow: hidden;
|
|
82
83
|
|
|
83
84
|
.mana-toolbar {
|
|
@@ -122,6 +123,7 @@
|
|
|
122
123
|
|
|
123
124
|
.libro-header-right {
|
|
124
125
|
color: unset;
|
|
126
|
+
flex: 0 0 auto;
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
.libro-keybind-instructions-icon {
|
package/src/index.tsx
CHANGED
|
@@ -41,7 +41,7 @@ export const PauseCircleOutlined: React.FC = () => (
|
|
|
41
41
|
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
42
42
|
>
|
|
43
43
|
<g id="原色" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
|
|
44
|
-
<g id="time-out" fillRule="nonzero" fill="
|
|
44
|
+
<g id="time-out" fillRule="nonzero" fill="currentColor">
|
|
45
45
|
<rect id="矩形" fill="#000000" opacity="0" x="0" y="0" width="20" height="20" />
|
|
46
46
|
<path
|
|
47
47
|
d="M10,1.25 C5.16796875,1.25 1.25,5.16796875 1.25,10 C1.25,14.8320312 5.16796875,18.75 10,18.75 C14.8320312,18.75 18.75,14.8320312 18.75,10 C18.75,5.16796875 14.8320312,1.25 10,1.25 Z M10,17.265625 C5.98828125,17.265625 2.734375,14.0117187 2.734375,10 C2.734375,5.98828125 5.98828125,2.734375 10,2.734375 C14.0117187,2.734375 17.265625,5.98828125 17.265625,10 C17.265625,14.0117187 14.0117187,17.265625 10,17.265625 Z M8.28125,6.875 L7.34375,6.875 C7.2578125,6.875 7.1875,6.9453125 7.1875,7.03125 L7.1875,12.96875 C7.1875,13.0546875 7.2578125,13.125 7.34375,13.125 L8.28125,13.125 C8.3671875,13.125 8.4375,13.0546875 8.4375,12.96875 L8.4375,7.03125 C8.4375,6.9453125 8.3671875,6.875 8.28125,6.875 Z M12.65625,6.875 L11.71875,6.875 C11.6328125,6.875 11.5625,6.9453125 11.5625,7.03125 L11.5625,12.96875 C11.5625,13.0546875 11.6328125,13.125 11.71875,13.125 L12.65625,13.125 C12.7421875,13.125 12.8125,13.0546875 12.8125,12.96875 L12.8125,7.03125 C12.8125,6.9453125 12.7421875,6.875 12.65625,6.875 Z"
|
|
@@ -65,7 +65,7 @@ export const Reload: React.FC = () => (
|
|
|
65
65
|
<g
|
|
66
66
|
id="2.1-kernel-状态展示"
|
|
67
67
|
transform="translate(-776.000000, -80.000000)"
|
|
68
|
-
fill="
|
|
68
|
+
fill="currentColor"
|
|
69
69
|
fillRule="nonzero"
|
|
70
70
|
>
|
|
71
71
|
<g id="编组-24" transform="translate(637.000000, 80.000000)">
|
|
@@ -35,7 +35,15 @@ const LibroOutputAreaRender = forwardRef<HTMLDivElement>(
|
|
|
35
35
|
useEffect(() => {
|
|
36
36
|
outputArea.onUpdateEmitter.fire();
|
|
37
37
|
}, [outputArea.onUpdateEmitter, outputArea.outputs]);
|
|
38
|
-
|
|
38
|
+
const childrenCannotClear = [];
|
|
39
|
+
const children = [];
|
|
40
|
+
for (const output of outputArea.outputs) {
|
|
41
|
+
if (output.allowClear === false) {
|
|
42
|
+
childrenCannotClear.push(output);
|
|
43
|
+
} else {
|
|
44
|
+
children.push(output);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
39
47
|
return (
|
|
40
48
|
<div
|
|
41
49
|
className="libro-output-area"
|
|
@@ -43,7 +51,10 @@ const LibroOutputAreaRender = forwardRef<HTMLDivElement>(
|
|
|
43
51
|
//设置最小高度,用于优化长文本输出再次执行时的页面的滚动控制
|
|
44
52
|
// style={{ minHeight: `${executing ? outputArea.lastOutputContainerHeight + 'px' : 'unset'}` }}
|
|
45
53
|
>
|
|
46
|
-
{
|
|
54
|
+
{childrenCannotClear.map((output) => {
|
|
55
|
+
return <ViewRender view={output} key={output.id} />;
|
|
56
|
+
})}
|
|
57
|
+
{children.map((output) => {
|
|
47
58
|
return <ViewRender view={output} key={output.id} />;
|
|
48
59
|
})}
|
|
49
60
|
</div>
|
|
@@ -103,10 +114,10 @@ export class LibroOutputArea extends BaseView implements BaseOutputArea {
|
|
|
103
114
|
});
|
|
104
115
|
}
|
|
105
116
|
add = async (output: IOutput): Promise<number> => {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
117
|
+
if (this.clearNext) {
|
|
118
|
+
this.clear();
|
|
119
|
+
this.clearNext = false;
|
|
120
|
+
}
|
|
110
121
|
// Consolidate outputs if they are stream outputs of the same kind.
|
|
111
122
|
if (
|
|
112
123
|
isStream(output) &&
|
|
@@ -141,13 +152,28 @@ export class LibroOutputArea extends BaseView implements BaseOutputArea {
|
|
|
141
152
|
} else {
|
|
142
153
|
this.lastStream = '';
|
|
143
154
|
}
|
|
144
|
-
|
|
155
|
+
const model = await outputModel;
|
|
156
|
+
model.onDisposed(() => {
|
|
157
|
+
this.remove(model);
|
|
158
|
+
});
|
|
159
|
+
return this.outputs.push(model);
|
|
145
160
|
};
|
|
161
|
+
|
|
162
|
+
protected remove(model: BaseOutputView) {
|
|
163
|
+
let outputs = [...this.outputs];
|
|
164
|
+
outputs = outputs.filter((item) => item !== model);
|
|
165
|
+
this.outputs = outputs;
|
|
166
|
+
}
|
|
167
|
+
|
|
146
168
|
set = async (index: number, output: IOutput) => {
|
|
147
169
|
const outputModel = this.doCreateOutput(output);
|
|
148
170
|
const current = this.outputs[index];
|
|
149
171
|
current.dispose();
|
|
150
|
-
|
|
172
|
+
const model = await outputModel;
|
|
173
|
+
model.onDisposed(() => {
|
|
174
|
+
this.remove(model);
|
|
175
|
+
});
|
|
176
|
+
this.outputs[index] = model;
|
|
151
177
|
};
|
|
152
178
|
clear(wait?: boolean | undefined) {
|
|
153
179
|
this.lastStream = '';
|
|
@@ -158,7 +184,6 @@ export class LibroOutputArea extends BaseView implements BaseOutputArea {
|
|
|
158
184
|
this.outputs.forEach((output) => {
|
|
159
185
|
output.dispose();
|
|
160
186
|
});
|
|
161
|
-
this.outputs = [];
|
|
162
187
|
}
|
|
163
188
|
fromJSON = async (values: IOutput[]) => {
|
|
164
189
|
if (!values) {
|
|
@@ -26,6 +26,10 @@ export class LibroOutputView extends BaseView implements BaseOutputView {
|
|
|
26
26
|
|
|
27
27
|
@prop()
|
|
28
28
|
raw: IOutput;
|
|
29
|
+
|
|
30
|
+
@prop()
|
|
31
|
+
allowClear = true;
|
|
32
|
+
|
|
29
33
|
@prop()
|
|
30
34
|
data: JSONObject;
|
|
31
35
|
@prop()
|
|
@@ -45,7 +49,7 @@ export class LibroOutputView extends BaseView implements BaseOutputView {
|
|
|
45
49
|
render: FC<{ output: BaseOutputView }> = LibroOutputModelRender;
|
|
46
50
|
|
|
47
51
|
override dispose() {
|
|
48
|
-
|
|
52
|
+
super.dispose();
|
|
49
53
|
}
|
|
50
54
|
toJSON() {
|
|
51
55
|
return this.raw;
|
|
@@ -126,6 +126,11 @@ export interface BaseOutputView extends View {
|
|
|
126
126
|
* Depending on the implementation of the mime model,
|
|
127
127
|
*/
|
|
128
128
|
setData(options: ISetDataOptions): void;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* undefined is considered allowed
|
|
132
|
+
*/
|
|
133
|
+
allowClear?: boolean;
|
|
129
134
|
}
|
|
130
135
|
|
|
131
136
|
/**
|
|
@@ -343,7 +343,7 @@ export class LibroColorRegistry implements ColorContribution {
|
|
|
343
343
|
},
|
|
344
344
|
{
|
|
345
345
|
id: 'libro.editor.gutter.number.color',
|
|
346
|
-
defaults: { dark: '#
|
|
346
|
+
defaults: { dark: '#A8AEBF', light: '#A4AECB' },
|
|
347
347
|
description: '',
|
|
348
348
|
},
|
|
349
349
|
{
|
|
@@ -3,9 +3,10 @@ import {
|
|
|
3
3
|
ToolbarInstance,
|
|
4
4
|
getOrigin,
|
|
5
5
|
CommandRegistry,
|
|
6
|
+
ThemeService,
|
|
6
7
|
} from '@difizen/mana-app';
|
|
7
8
|
import type { Toolbar } from '@difizen/mana-app';
|
|
8
|
-
import { Select } from 'antd';
|
|
9
|
+
import { ConfigProvider, Select, theme } from 'antd';
|
|
9
10
|
import { memo } from 'react';
|
|
10
11
|
|
|
11
12
|
import type { CellMeta } from '../cell/index.js';
|
|
@@ -28,13 +29,21 @@ export const ToolItemSelectInner: React.FC = () => {
|
|
|
28
29
|
const data = toolbar.currentArgs as LibroToolbarArags;
|
|
29
30
|
const command = useInject(CommandRegistry);
|
|
30
31
|
const curCell = data?.[0];
|
|
32
|
+
const themeService = useInject(ThemeService);
|
|
31
33
|
|
|
32
34
|
const handleChange = (value: string) => {
|
|
33
35
|
const args = getOrigin(data) || [];
|
|
34
36
|
command.executeCommand(NotebookCommands['ChangeCellTo'].id, ...args, value);
|
|
35
37
|
};
|
|
36
38
|
return (
|
|
37
|
-
|
|
39
|
+
<ConfigProvider
|
|
40
|
+
theme={{
|
|
41
|
+
algorithm:
|
|
42
|
+
themeService.getCurrentTheme().type === 'dark'
|
|
43
|
+
? theme.darkAlgorithm
|
|
44
|
+
: theme.defaultAlgorithm,
|
|
45
|
+
}}
|
|
46
|
+
>
|
|
38
47
|
<Select
|
|
39
48
|
value={curCell?.model?.type}
|
|
40
49
|
size={'small'}
|
|
@@ -51,7 +60,7 @@ export const ToolItemSelectInner: React.FC = () => {
|
|
|
51
60
|
);
|
|
52
61
|
})}
|
|
53
62
|
</Select>
|
|
54
|
-
|
|
63
|
+
</ConfigProvider>
|
|
55
64
|
);
|
|
56
65
|
};
|
|
57
66
|
|