@difizen/libro-core 1.0.2 → 1.0.3

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.
Files changed (38) hide show
  1. package/es/cell/libro-executable-cell-view.d.ts +4 -3
  2. package/es/cell/libro-executable-cell-view.d.ts.map +1 -1
  3. package/es/cell/libro-executable-cell-view.js +17 -2
  4. package/es/index.less +1 -0
  5. package/es/libro-model.d.ts +2 -1
  6. package/es/libro-model.d.ts.map +1 -1
  7. package/es/libro-model.js +53 -45
  8. package/es/libro-protocol.d.ts +2 -0
  9. package/es/libro-protocol.d.ts.map +1 -1
  10. package/es/libro-setting-contribution.d.ts.map +1 -1
  11. package/es/libro-setting-contribution.js +2 -2
  12. package/es/libro-setting.d.ts +1 -0
  13. package/es/libro-setting.d.ts.map +1 -1
  14. package/es/libro-setting.js +10 -0
  15. package/es/libro-view.d.ts +10 -0
  16. package/es/libro-view.d.ts.map +1 -1
  17. package/es/libro-view.js +46 -12
  18. package/es/output/output-area.d.ts +3 -1
  19. package/es/output/output-area.d.ts.map +1 -1
  20. package/es/output/output-area.js +83 -30
  21. package/es/output/output-model.d.ts +3 -1
  22. package/es/output/output-model.d.ts.map +1 -1
  23. package/es/output/output-model.js +11 -1
  24. package/es/output/output-protocol.d.ts +5 -2
  25. package/es/output/output-protocol.d.ts.map +1 -1
  26. package/es/toolbar/index.less +10 -10
  27. package/package.json +5 -5
  28. package/src/cell/libro-executable-cell-view.ts +25 -2
  29. package/src/index.less +1 -0
  30. package/src/libro-model.ts +8 -5
  31. package/src/libro-protocol.ts +3 -0
  32. package/src/libro-setting-contribution.ts +2 -0
  33. package/src/libro-setting.ts +11 -0
  34. package/src/libro-view.tsx +61 -10
  35. package/src/output/output-area.tsx +80 -21
  36. package/src/output/output-model.tsx +11 -1
  37. package/src/output/output-protocol.ts +8 -2
  38. package/src/toolbar/index.less +10 -10
package/es/libro-view.js CHANGED
@@ -33,8 +33,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
33
33
  import { ToTopOutlined } from '@ant-design/icons';
34
34
  import { concatMultilineString, copy2clipboard, readFromClipboard } from '@difizen/libro-common';
35
35
  import { equals, useInject, inject, transient, BaseView, Slot, view, ViewInstance, ViewManager, ViewOption, Deferred, Disposable, DisposableCollection, Emitter, getOrigin, prop, watch, ConfigurationService, useConfigurationValue } from '@difizen/libro-common/app';
36
- import { l10n } from '@difizen/libro-common/l10n';
37
- import { FloatButton, Button, Spin, message } from 'antd';
36
+ import { FloatButton, Button, Spin } from 'antd';
38
37
  import { forwardRef, memo, useCallback, useEffect, useRef } from 'react';
39
38
  import { v4 } from 'uuid';
40
39
  import { CellService, EditorCellView, ExecutableCellModel, ExecutableCellView } from "./cell/index.js";
@@ -263,8 +262,40 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
263
262
  _this.onCellContentChangedEmitter = new Emitter();
264
263
  _this.runCellEmitter = new Emitter();
265
264
  _this.cellScrollEmitter = new Emitter();
265
+ _this.outputRenderTabEmitter = new Emitter();
266
266
  _this.initializedDefer = new Deferred();
267
267
  _this.view = LibroRender;
268
+ _this.addLargeFileWarning = function () {
269
+ var skipWarning = localStorage.getItem('largefile' + "".concat(_this.options.modelId || _this.options.id)) === 'true';
270
+ if (!skipWarning) {
271
+ var _warningBox$querySele;
272
+ var warningBox = document.createElement('div');
273
+ warningBox.style.position = 'fixed';
274
+ warningBox.style.top = '20px';
275
+ warningBox.style.left = '50%';
276
+ warningBox.style.display = 'flex';
277
+ warningBox.style.alignItems = 'center';
278
+ warningBox.style.color = '#000000E0';
279
+ warningBox.style.transform = 'translateX(-50%)';
280
+ warningBox.style.fontSize = '14px';
281
+ warningBox.style.background = '#ffffff';
282
+ warningBox.style.padding = '9px 12px';
283
+ warningBox.style.zIndex = '9999';
284
+ warningBox.style.borderRadius = '8px';
285
+ warningBox.style.boxShadow = '0 6px 16px 0 rgba(0, 0, 0, 0.08),0 3px 6px -4px rgba(0, 0, 0, 0.12),0 9px 28px 8px rgba(0, 0, 0, 0.05)';
286
+ warningBox.innerHTML = "\n <svg style=\"display: inline-block; margin-right: 8px\" viewBox=\"64 64 896 896\" focusable=\"false\" data-icon=\"exclamation-circle\" width=\"1em\" height=\"1em\" fill=\"#faad14\" aria-hidden=\"true\" data-macaca-recorder-select-tag=\"true\"><path d=\"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z\"></path></svg>\n <span style =\"line-height: 32px\">\u5373\u5C06\u6253\u5F00\u7684\u6587\u4EF6(\u5185\u5BB9\u8FC7\u5927 / cell \u8FC7\u591A)\uFF0C\u53EF\u80FD\u4F1A\u5BFC\u81F4\u64CD\u4F5C\u5361\u987F\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85\uFF5E</span>\n <a style=\"margin-left: 8px; color: #1677ff;\">\u6211\u77E5\u9053\u4E86</a>\n ";
287
+ (_warningBox$querySele = warningBox.querySelector('a')) === null || _warningBox$querySele === void 0 || _warningBox$querySele.addEventListener('click', function () {
288
+ // 将用户偏好保存到 localStorage
289
+ localStorage.setItem('largefile' + "".concat(_this.options.modelId || _this.options.id), 'true');
290
+ document.body.removeChild(warningBox);
291
+ });
292
+ document.body.appendChild(warningBox);
293
+ // 可选:自动移除提示框
294
+ setTimeout(function () {
295
+ document.body.removeChild(warningBox);
296
+ }, 2000);
297
+ }
298
+ };
268
299
  _this.onViewMount = function () {
269
300
  _this.libroService.active = _assertThisInitialized(_this);
270
301
  _this.libroSlotManager.setup(_assertThisInitialized(_this));
@@ -273,13 +304,8 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
273
304
  id: _this.options.modelId || _this.options.id
274
305
  });
275
306
  }
276
- if (_this.model.cells.length > 30 || (_this.options['fileSize'] || 0) / (1024 * 1024) >= 5) {
277
- message.warning( /*#__PURE__*/_jsxs("div", {
278
- children: [l10n.t('即将打开的文件(内容过大 / cell 过多),可能会导致操作卡顿,请耐心等待~'), /*#__PURE__*/_jsx(Button, {
279
- type: "link",
280
- children: l10n.t('我知道了')
281
- })]
282
- }));
307
+ if (_this.model.isInitialized && (_this.model.cells.length > 30 || (_this.model.options['fileSize'] || 0) / (1024 * 1024) >= 5)) {
308
+ _this.addLargeFileWarning();
283
309
  }
284
310
  // this.libroService.libroPerformanceStatistics.setRenderEnd(new Date());
285
311
 
@@ -1780,6 +1806,11 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1780
1806
  get: function get() {
1781
1807
  return this.cellScrollEmitter.event;
1782
1808
  }
1809
+ }, {
1810
+ key: "onOutputRenderTab",
1811
+ get: function get() {
1812
+ return this.outputRenderTabEmitter.event;
1813
+ }
1783
1814
  }, {
1784
1815
  key: "initialized",
1785
1816
  get: function get() {
@@ -1814,6 +1845,9 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1814
1845
  return this.model.initialize();
1815
1846
  case 3:
1816
1847
  options = _context22.sent;
1848
+ if (options.length > 30 || (this.model.options['fileSize'] || 0) / (1024 * 1024) >= 5) {
1849
+ this.addLargeFileWarning();
1850
+ }
1817
1851
  this.configurationService.get(AutoInsertWhenNoCell).then(function (value) {
1818
1852
  var isAutoInsertWhenNoCell = value;
1819
1853
  if (isAutoInsertWhenNoCell && options.length === 0) {
@@ -1830,9 +1864,9 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1830
1864
  }).catch(function (e) {
1831
1865
  //
1832
1866
  });
1833
- _context22.next = 7;
1867
+ _context22.next = 8;
1834
1868
  return this.insertCells(options);
1835
- case 7:
1869
+ case 8:
1836
1870
  // 第一次insert不需要历史
1837
1871
  setTimeout(function () {
1838
1872
  _this2.model.sharedModel.clearUndoHistory();
@@ -1854,7 +1888,7 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1854
1888
  }));
1855
1889
  _this2.initializedDefer.resolve();
1856
1890
  }, 0);
1857
- case 8:
1891
+ case 9:
1858
1892
  case "end":
1859
1893
  return _context22.stop();
1860
1894
  }
@@ -15,6 +15,8 @@ export declare class LibroOutputArea extends BaseView implements BaseOutputArea
15
15
  get length(): number;
16
16
  protected clearNext: boolean;
17
17
  protected lastStream: string;
18
+ protected lastDisplayStream: string[];
19
+ protected isFirstLastOverHeight: boolean;
18
20
  protected lastName?: 'stdout' | 'stderr';
19
21
  /**
20
22
  * @internal
@@ -25,7 +27,7 @@ export declare class LibroOutputArea extends BaseView implements BaseOutputArea
25
27
  protected doCreateOutput(options: IOutput): Promise<BaseOutputView>;
26
28
  add: (output: IOutput) => Promise<number>;
27
29
  protected remove(model: BaseOutputView): void;
28
- set: (index: number, output: IOutput) => Promise<void>;
30
+ set: (index: number, output: IOutput, shouldReplace?: boolean) => Promise<void>;
29
31
  clear(wait?: boolean | undefined): void;
30
32
  fromJSON: (values: IOutput[]) => Promise<void>;
31
33
  toJSON: () => IOutput[];
@@ -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,2BAA2B,CAAC;AAC7E,OAAO,EAIL,QAAQ,EAKT,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,OAAO,EAAoC,MAAM,2BAA2B,CAAC;AAKtF,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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AAC,KAAK,EAAE,MAAM,GAAG,cAAc;IAMlC,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC;IASnE,GAAG,WAAkB,OAAO,KAAG,QAAQ,MAAM,CAAC,CA0E5C;IAEF,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,cAAc;IAMtC,GAAG,UAAiB,MAAM,UAAU,OAAO,kBAAkB,OAAO,mBAkBlE;IACF,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS;IAYhC,QAAQ,WAAkB,OAAO,EAAE,mBAQjC;IACF,MAAM,QAAO,OAAO,EAAE,CAEpB;IAEF,aAAa,CAAC,IAAI,EAAE,QAAQ;IAI5B,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,kBAAkB;IAS5D;;;;;OAKG;IAEH,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE;QAC/B,MAAM,EAAE,OAAO,CAAC;QAChB,SAAS,EAAE,cAAc,CAAC;KAC3B,GAAG,OAAO;CAGZ;AAoCD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3D;AAoBD;;GAEG;AAEH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,MAAM,CAK1D;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAQtD"}
@@ -1,13 +1,10 @@
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
2
  var _dec, _dec2, _dec3, _dec4, _class, _class2, _descriptor, _descriptor2;
3
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
4
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
5
  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
6
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
7
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
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; }
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; }
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; }
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; }
11
8
  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); } }
12
9
  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); }); }; }
13
10
  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 }); }
@@ -28,18 +25,18 @@ function _initializerWarningHelper(descriptor, context) { throw new Error('Decor
28
25
  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
26
  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
27
  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; }
28
+ import { concatMultilineString } from '@difizen/libro-common';
29
+ import { getBundleOptions } from '@difizen/libro-common';
31
30
  import { isError, isStream } from '@difizen/libro-common';
32
31
  import { ViewOption, getOrigin, ViewRender, BaseView, Priority, useInject, view, ViewInstance } from '@difizen/libro-common/app';
33
32
  import { Emitter, prop, contrib, inject, transient } from '@difizen/libro-common/app';
34
33
  import { useEffect, forwardRef } from 'react';
35
- import { v4 } from 'uuid';
36
34
  import { ExecutableCellView } from "../cell/index.js";
37
35
  import { OutputContribution } from "./output-protocol.js";
38
36
  import { jsx as _jsx } from "react/jsx-runtime";
39
37
  import { jsxs as _jsxs } from "react/jsx-runtime";
40
38
  var LibroOutputAreaRender = /*#__PURE__*/forwardRef(function LibroOutputAreaRender(props, ref) {
41
39
  var outputArea = useInject(ViewInstance);
42
-
43
40
  // const cellModel = outputArea.cell.model;
44
41
  // const executing = ExecutableCellModel.is(cellModel) && cellModel.executing;
45
42
 
@@ -84,8 +81,6 @@ var LibroOutputAreaRender = /*#__PURE__*/forwardRef(function LibroOutputAreaRend
84
81
  export var LibroOutputArea = (_dec = transient(), _dec2 = view('libro-output-area'), _dec3 = contrib(OutputContribution), _dec4 = prop(), _dec(_class = _dec2(_class = (_class2 = /*#__PURE__*/function (_BaseView) {
85
82
  _inherits(LibroOutputArea, _BaseView);
86
83
  var _super = _createSuper(LibroOutputArea);
87
- // lastOutputContainerHeight?: number;
88
-
89
84
  function LibroOutputArea(option) {
90
85
  var _this;
91
86
  _classCallCheck(this, LibroOutputArea);
@@ -97,6 +92,8 @@ export var LibroOutputArea = (_dec = transient(), _dec2 = view('libro-output-are
97
92
  _this.disposed = void 0;
98
93
  _this.clearNext = false;
99
94
  _this.lastStream = '';
95
+ _this.lastDisplayStream = [];
96
+ _this.isFirstLastOverHeight = true;
100
97
  _this.lastName = void 0;
101
98
  /**
102
99
  * @internal
@@ -104,7 +101,7 @@ export var LibroOutputArea = (_dec = transient(), _dec2 = view('libro-output-are
104
101
  _this.onUpdateEmitter = new Emitter();
105
102
  _this.add = /*#__PURE__*/function () {
106
103
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(output) {
107
- var index, outputModel, model;
104
+ var _outputModel$containe, normalizeOutput, index, _outputModel, containerRec, text, split_text, outputModel, normalizedOutput, model;
108
105
  return _regeneratorRuntime().wrap(function _callee$(_context) {
109
106
  while (1) switch (_context.prev = _context.next) {
110
107
  case 0:
@@ -117,38 +114,66 @@ export var LibroOutputArea = (_dec = transient(), _dec2 = view('libro-output-are
117
114
  output: output,
118
115
  lastModel: _this.outputs[_this.length - 1]
119
116
  }))) {
120
- _context.next = 8;
117
+ _context.next = 12;
121
118
  break;
122
119
  }
123
120
  // In order to get a list change event, we add the previous
124
121
  // text to the current item and replace the previous item.
125
122
  // This also replaces the metadata of the last item.
126
- _this.lastStream += normalize(output.text);
123
+ normalizeOutput = normalize(output.text);
124
+ _this.lastStream += normalizeOutput;
127
125
  _this.lastStream = removeOverwrittenChars(_this.lastStream);
128
126
  output.text = _this.lastStream;
129
127
  index = _this.length - 1;
130
- _this.set(index, output);
128
+ _outputModel = _this.outputs[index];
129
+ containerRec = (_outputModel$containe = _outputModel.container) === null || _outputModel$containe === void 0 || (_outputModel$containe = _outputModel$containe.current) === null || _outputModel$containe === void 0 ? void 0 : _outputModel$containe.getBoundingClientRect();
130
+ if (((containerRec === null || containerRec === void 0 ? void 0 : containerRec.height) || 0) > 240) {
131
+ if (_this.isFirstLastOverHeight) {
132
+ _this.lastDisplayStream = [concatMultilineString(_this.lastStream)];
133
+ _this.lastDisplayStream.push('\n...\n');
134
+ _this.isFirstLastOverHeight = false;
135
+ } else {
136
+ _this.lastDisplayStream = [].concat(_toConsumableArray(_this.lastDisplayStream), _toConsumableArray(splitWithNewline(normalizeOutput)));
137
+ }
138
+ output['is_over_height'] = true;
139
+ output['display_text'] = _this.lastDisplayStream;
140
+ }
141
+ _this.set(index, output, true);
131
142
  return _context.abrupt("return", _this.length);
132
- case 8:
143
+ case 12:
144
+ _this.isFirstLastOverHeight = true;
133
145
  if (isStream(output)) {
134
- output.text = removeOverwrittenChars(normalize(output.text));
146
+ text = removeOverwrittenChars(normalize(output.text));
147
+ output.text = text;
148
+ split_text = splitWithNewline(text);
149
+ if (_this.isFirstLastOverHeight && split_text.length > 15) {
150
+ _this.lastDisplayStream = [concatMultilineString(split_text.slice(0, 15))];
151
+ _this.lastDisplayStream.push('\n...\n');
152
+ _this.lastDisplayStream = [].concat(_toConsumableArray(_this.lastDisplayStream), _toConsumableArray(split_text.slice(15)));
153
+ _this.isFirstLastOverHeight = false;
154
+ output['is_over_height'] = true;
155
+ output['display_text'] = _this.lastDisplayStream;
156
+ }
135
157
  }
136
158
  outputModel = _this.doCreateOutput(output); // Update the stream information.
137
159
  if (isStream(output)) {
138
- _this.lastStream = normalize(output.text);
160
+ normalizedOutput = normalize(output.text);
161
+ _this.lastStream = normalizedOutput;
139
162
  _this.lastName = output.name;
140
163
  } else {
141
164
  _this.lastStream = '';
165
+ _this.lastDisplayStream = [];
166
+ _this.isFirstLastOverHeight = true;
142
167
  }
143
- _context.next = 13;
168
+ _context.next = 18;
144
169
  return outputModel;
145
- case 13:
170
+ case 18:
146
171
  model = _context.sent;
147
172
  model.onDisposed(function () {
148
173
  _this.remove(model);
149
174
  });
150
175
  return _context.abrupt("return", _this.outputs.push(model));
151
- case 16:
176
+ case 21:
152
177
  case "end":
153
178
  return _context.stop();
154
179
  }
@@ -159,29 +184,42 @@ export var LibroOutputArea = (_dec = transient(), _dec2 = view('libro-output-are
159
184
  };
160
185
  }();
161
186
  _this.set = /*#__PURE__*/function () {
162
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(index, output) {
163
- var outputModel, current, model;
187
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(index, output, shouldReplace) {
188
+ var outputModel, _getBundleOptions, data, _outputModel2, current, model;
164
189
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
165
190
  while (1) switch (_context2.prev = _context2.next) {
166
191
  case 0:
167
- outputModel = _this.doCreateOutput(output);
192
+ if (!shouldReplace) {
193
+ _context2.next = 8;
194
+ break;
195
+ }
196
+ outputModel = _this.outputs[index];
197
+ _getBundleOptions = getBundleOptions(output), data = _getBundleOptions.data;
198
+ outputModel.raw = output;
199
+ outputModel.data = data;
200
+ outputModel.onUpdateEmitter.fire();
201
+ // outputModel.data
202
+ _context2.next = 16;
203
+ break;
204
+ case 8:
205
+ _outputModel2 = _this.doCreateOutput(output);
168
206
  current = _this.outputs[index];
169
207
  current.dispose();
170
- _context2.next = 5;
171
- return outputModel;
172
- case 5:
208
+ _context2.next = 13;
209
+ return _outputModel2;
210
+ case 13:
173
211
  model = _context2.sent;
174
212
  model.onDisposed(function () {
175
213
  _this.remove(model);
176
214
  });
177
215
  _this.outputs[index] = model;
178
- case 8:
216
+ case 16:
179
217
  case "end":
180
218
  return _context2.stop();
181
219
  }
182
220
  }, _callee2);
183
221
  }));
184
- return function (_x2, _x3) {
222
+ return function (_x2, _x3, _x4) {
185
223
  return _ref2.apply(this, arguments);
186
224
  };
187
225
  }();
@@ -229,7 +267,7 @@ export var LibroOutputArea = (_dec = transient(), _dec2 = view('libro-output-are
229
267
  }
230
268
  }, _callee3, null, [[3, 13, 16, 19]]);
231
269
  }));
232
- return function (_x4) {
270
+ return function (_x5) {
233
271
  return _ref3.apply(this, arguments);
234
272
  };
235
273
  }();
@@ -265,9 +303,7 @@ export var LibroOutputArea = (_dec = transient(), _dec2 = view('libro-output-are
265
303
  value: function doCreateOutput(options) {
266
304
  var provider = this.findProvider(options);
267
305
  return provider.factory({
268
- output: _objectSpread({
269
- _librOutputId: v4()
270
- }, options),
306
+ output: options,
271
307
  trusted: this.cell.model.trusted,
272
308
  cell: this.cell
273
309
  });
@@ -285,6 +321,8 @@ export var LibroOutputArea = (_dec = transient(), _dec2 = view('libro-output-are
285
321
  key: "clear",
286
322
  value: function clear(wait) {
287
323
  this.lastStream = '';
324
+ this.lastDisplayStream = [];
325
+ this.isFirstLastOverHeight = true;
288
326
  if (wait) {
289
327
  this.clearNext = true;
290
328
  return;
@@ -375,6 +413,21 @@ function fixCarriageReturn(txt) {
375
413
  export function removeOverwrittenChars(text) {
376
414
  return fixCarriageReturn(fixBackspace(text));
377
415
  }
416
+ function splitWithNewline(input) {
417
+ var parts = input.split(/(\n)/);
418
+ var result = [];
419
+ for (var i = 0; i < parts.length; i += 2) {
420
+ var text = parts[i];
421
+ var newline = parts[i + 1] || '';
422
+ var combined = text + newline;
423
+
424
+ // 仅保留非空项
425
+ if (text || newline) {
426
+ result.push(combined);
427
+ }
428
+ }
429
+ return result;
430
+ }
378
431
 
379
432
  /**
380
433
  * Normalize an output.
@@ -1,5 +1,5 @@
1
1
  import type { IOutput, JSONObject, PartialJSONObject } from '@difizen/libro-common';
2
- import { BaseView } from '@difizen/libro-common/app';
2
+ import { BaseView, Emitter } from '@difizen/libro-common/app';
3
3
  import type { FC } from 'react';
4
4
  import type { CellView } from '../libro-protocol.js';
5
5
  import type { IOutputOptions } from './output-protocol.js';
@@ -10,6 +10,8 @@ export declare class LibroOutputView extends BaseView implements BaseOutputView
10
10
  raw: IOutput;
11
11
  allowClear: boolean;
12
12
  data: JSONObject;
13
+ onUpdateEmitter: Emitter<void>;
14
+ get onUpdate(): import("@difizen/libro-common/app").Event<void>;
13
15
  metadata: PartialJSONObject;
14
16
  type: string;
15
17
  trusted: boolean;
@@ -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,2BAA2B,CAAC;AAE7E,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAS5E,qBAEa,eAAgB,SAAQ,QAAS,YAAW,cAAc;IAC5D,EAAE,SAAQ;IAGnB,IAAI,EAAE,QAAQ,CAAC;IAGf,GAAG,EAAE,OAAO,CAAC;IAGb,UAAU,UAAQ;IAGlB,IAAI,EAAE,UAAU,CA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EvD,OAAO;IAGhB,MAAM;IAGN,OAAO,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;CAQxC;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,wBAAkB,CAAC"}
@@ -17,7 +17,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
17
17
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
18
18
  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; }
19
19
  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.'); }
20
- import { BaseView, prop, view, ViewOption } from '@difizen/libro-common/app';
20
+ import { BaseView, Emitter, prop, view, ViewOption } from '@difizen/libro-common/app';
21
21
  import { inject, transient } from '@difizen/libro-common/app';
22
22
  import { v4 } from 'uuid';
23
23
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -40,6 +40,7 @@ export var LibroOutputView = (_dec = transient(), _dec2 = view('libro-output-mod
40
40
  _initializerDefineProperty(_this, "raw", _descriptor, _assertThisInitialized(_this));
41
41
  _initializerDefineProperty(_this, "allowClear", _descriptor2, _assertThisInitialized(_this));
42
42
  _initializerDefineProperty(_this, "data", _descriptor3, _assertThisInitialized(_this));
43
+ _this.onUpdateEmitter = new Emitter();
43
44
  _initializerDefineProperty(_this, "metadata", _descriptor4, _assertThisInitialized(_this));
44
45
  _this.type = void 0;
45
46
  _this.trusted = void 0;
@@ -50,10 +51,19 @@ export var LibroOutputView = (_dec = transient(), _dec2 = view('libro-output-mod
50
51
  _this.type = 'libro-default-output';
51
52
  _this.data = {};
52
53
  _this.metadata = {};
54
+ _this.onUpdate(function () {
55
+ var _this$cell$parent$mod, _this$cell$parent$mod2;
56
+ (_this$cell$parent$mod = (_this$cell$parent$mod2 = _this.cell.parent.model).onChange) === null || _this$cell$parent$mod === void 0 || _this$cell$parent$mod.call(_this$cell$parent$mod2);
57
+ });
53
58
  return _this;
54
59
  }
55
60
  LibroOutputView = inject(ViewOption)(LibroOutputView, undefined, 0) || LibroOutputView;
56
61
  _createClass(LibroOutputView, [{
62
+ key: "onUpdate",
63
+ get: function get() {
64
+ return this.onUpdateEmitter.event;
65
+ }
66
+ }, {
57
67
  key: "dispose",
58
68
  value: function dispose() {
59
69
  _get(_getPrototypeOf(LibroOutputView.prototype), "dispose", this).call(this);
@@ -1,5 +1,5 @@
1
1
  import type { IOutput, ReadonlyPartialJSONObject, JSONObject } from '@difizen/libro-common';
2
- import type { Event } from '@difizen/libro-common/app';
2
+ import type { Emitter, Event } from '@difizen/libro-common/app';
3
3
  import type { View } from '@difizen/libro-common/app';
4
4
  import { Syringe } from '@difizen/libro-common/app';
5
5
  import type { CellView } from '../libro-protocol.js';
@@ -75,7 +75,10 @@ export interface BaseOutputView extends View {
75
75
  /**
76
76
  * The data associated with the model.
77
77
  */
78
- readonly data: JSONObject;
78
+ data: JSONObject;
79
+ onUpdateEmitter: Emitter<void>;
80
+ onUpdate: Event<void>;
81
+ isTabRender?: boolean;
79
82
  /**
80
83
  * The metadata associated with the model.
81
84
  *
@@ -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,C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MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,MAAM,CAAC;IACvC,OAAO,EAAE,kBAAkB,CAAC;CAC7B"}
@@ -4,16 +4,16 @@
4
4
  .libro-hide-selector-menu {
5
5
  .@{ant-prefix}-dropdown-menu {
6
6
  background-color: var(--mana-libro-popover-background-color);
7
- }
8
- .@{ant-prefix}-dropdown-menu-item {
9
- color: var(--mana-libro-toolbar-menu-label-color);
10
- }
11
- .@{ant-prefix}-dropdown-menu-item-disabled {
12
- color: var(--mana-libro-toolbar-menu-disabled-label-color) !important;
13
- }
14
- .@{ant-prefix}-dropdown-menu-item.@{ant-prefix}-dropdown-menu-item-disabled:hover,
15
- .@{ant-prefix}-dropdown-menu-item:hover {
16
- background-color: var(--mana-libro-menu-hover-color);
7
+ .@{ant-prefix}-dropdown-menu-item {
8
+ color: var(--mana-libro-toolbar-menu-label-color);
9
+ }
10
+ .@{ant-prefix}-dropdown-menu-item-disabled {
11
+ color: var(--mana-libro-toolbar-menu-disabled-label-color);
12
+ }
13
+ .@{ant-prefix}-dropdown-menu-item.@{ant-prefix}-dropdown-menu-item-disabled:hover,
14
+ .@{ant-prefix}-dropdown-menu-item:hover {
15
+ background-color: var(--mana-libro-menu-hover-color);
16
+ }
17
17
  }
18
18
  }
19
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@difizen/libro-core",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
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": "^1.0.2",
38
- "@difizen/libro-common": "^1.0.2",
39
- "@difizen/libro-shared-model": "^1.0.2",
40
- "@difizen/libro-virtualized": "^1.0.2",
37
+ "@difizen/libro-code-editor": "^1.0.3",
38
+ "@difizen/libro-common": "^1.0.3",
39
+ "@difizen/libro-shared-model": "^1.0.3",
40
+ "@difizen/libro-virtualized": "^1.0.3",
41
41
  "classnames": "^2.3.2",
42
42
  "dayjs": "^1.11.10",
43
43
  "dnd-core": "^16.0.1",
@@ -1,10 +1,11 @@
1
1
  import type { ICodeCell } from '@difizen/libro-common';
2
- import { watch } from '@difizen/libro-common/app';
2
+ import { watch, ConfigurationService } from '@difizen/libro-common/app';
3
3
  import { ViewOption } from '@difizen/libro-common/app';
4
4
  import { inject } from '@difizen/libro-common/app';
5
5
 
6
6
  import type { CellModel } from '../libro-protocol.js';
7
7
  import type { CellViewOptions } from '../libro-protocol.js';
8
+ import { LargeOutputDisplay } from '../libro-setting.js';
8
9
  import type { BaseOutputArea } from '../output/index.js';
9
10
 
10
11
  import type { LibroCell } from './libro-cell-protocol.js';
@@ -12,7 +13,7 @@ import { CellService } from './libro-cell-protocol.js';
12
13
  import { EditorCellView, LibroEditorCellView } from './libro-edit-cell-view.js';
13
14
  import { ExecutableCellModel } from './libro-executable-cell-model.js';
14
15
 
15
- interface ExecutableCellView extends EditorCellView {
16
+ export interface ExecutableCellView extends EditorCellView {
16
17
  run: () => Promise<boolean>;
17
18
  clearExecution: () => void;
18
19
 
@@ -50,11 +51,30 @@ export abstract class LibroEditableExecutableCellView
50
51
 
51
52
  declare noEditorAreaHeight: number;
52
53
 
54
+ isLargeOutputDisplay?: boolean;
55
+
53
56
  constructor(
54
57
  @inject(ViewOption) options: CellViewOptions,
55
58
  @inject(CellService) cellService: CellService,
59
+ @inject(ConfigurationService) configurationService: ConfigurationService,
56
60
  ) {
57
61
  super(options, cellService);
62
+ const localIsLargeOutputDisplay = localStorage.getItem(
63
+ 'is-libro-large-output-display',
64
+ );
65
+ configurationService
66
+ .get(LargeOutputDisplay)
67
+ .then((value) => {
68
+ this.isLargeOutputDisplay =
69
+ localIsLargeOutputDisplay !== null
70
+ ? localIsLargeOutputDisplay === 'true'
71
+ : ((this.options.cell.metadata['isLargeOutputDisplay'] ?? true) as boolean);
72
+ this.isLargeOutputDisplay = this.isLargeOutputDisplay && value;
73
+ return;
74
+ })
75
+ .catch(() => {
76
+ //
77
+ });
58
78
  this.outputWatch();
59
79
  }
60
80
 
@@ -83,6 +103,9 @@ export abstract class LibroEditableExecutableCellView
83
103
 
84
104
  override toJSON(): LibroCell {
85
105
  const meta = super.toJSON();
106
+ if (this.isLargeOutputDisplay !== undefined) {
107
+ meta.metadata['isLargeOutputDisplay'] = this.isLargeOutputDisplay;
108
+ }
86
109
  return {
87
110
  ...meta,
88
111
  source: meta.source ?? this.options.cell.source,