@difizen/libro-jupyter 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"add-between-cell-command-contribution.d.ts","sourceRoot":"","sources":["../../src/add-between-cell/add-between-cell-command-contribution.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAa,MAAM,2BAA2B,CAAC;AAE3E,eAAO,MAAM,0BAA0B;;;;;;;CAOtC,CAAC;AAEF,qBACa,sCAAuC,YAAW,mBAAmB;IAChF,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;CA+CjD"}
1
+ {"version":3,"file":"add-between-cell-command-contribution.d.ts","sourceRoot":"","sources":["../../src/add-between-cell/add-between-cell-command-contribution.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAa,MAAM,2BAA2B,CAAC;AAG3E,eAAO,MAAM,0BAA0B;;;;;;;CAOtC,CAAC;AAEF,qBACa,sCAAuC,YAAW,mBAAmB;IAChF,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;CA8CjD"}
@@ -9,6 +9,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
9
9
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
10
10
  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); }
11
11
  import { CommandContribution, singleton } from '@difizen/libro-common/app';
12
+ import { v4 } from 'uuid';
12
13
  export var LibroAddBetweenCellCommand = {
13
14
  AddBetweenCell: {
14
15
  id: 'notebook:libro-add-between-cell'
@@ -29,6 +30,7 @@ export var LibroAddBetweenCellCommandContribution = (_dec = singleton({
29
30
  command.registerCommand(LibroAddBetweenCellCommand.AddBetweenCell, {
30
31
  execute: function () {
31
32
  var _execute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(type, addCell, index) {
33
+ var cellOptions;
32
34
  return _regeneratorRuntime().wrap(function _callee$(_context) {
33
35
  while (1) switch (_context.prev = _context.next) {
34
36
  case 0:
@@ -38,15 +40,17 @@ export var LibroAddBetweenCellCommandContribution = (_dec = singleton({
38
40
  }
39
41
  return _context.abrupt("return");
40
42
  case 2:
41
- _context.next = 4;
42
- return addCell({
43
+ cellOptions = {
44
+ id: v4(),
43
45
  cell: {
44
46
  cell_type: type,
45
47
  metadata: {},
46
48
  source: ''
47
49
  }
48
- }, index);
49
- case 4:
50
+ };
51
+ _context.next = 5;
52
+ return addCell(cellOptions, index);
53
+ case 5:
50
54
  case "end":
51
55
  return _context.stop();
52
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"command-contribution.d.ts","sourceRoot":"","sources":["../../src/command/command-contribution.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,oBAAoB,EACpB,YAAY,EAKb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACL,mBAAmB,EAEnB,YAAY,EAEb,MAAM,2BAA2B,CAAC;AAKnC,qBACa,+BAAgC,YAAW,mBAAmB;IACnD,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACtC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,oBAAoB,CAAC;IAC9D,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAEpE,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;CAoIjD"}
1
+ {"version":3,"file":"command-contribution.d.ts","sourceRoot":"","sources":["../../src/command/command-contribution.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,oBAAoB,EACpB,YAAY,EAMb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACL,mBAAmB,EAEnB,YAAY,EAEb,MAAM,2BAA2B,CAAC;AAKnC,qBACa,+BAAgC,YAAW,mBAAmB;IACnD,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACtC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,oBAAoB,CAAC;IAC9D,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAEpE,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;CAoIjD"}
@@ -80,9 +80,21 @@ export var LibroJupyterCommandContribution = (_dec = singleton({
80
80
  }
81
81
  });
82
82
  this.libroCommand.registerLibroCommand(command, NotebookCommands['SideToolbarRunSelect'], {
83
- execute: function execute() {
84
- //
85
- },
83
+ execute: function () {
84
+ var _execute2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
85
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
86
+ while (1) switch (_context2.prev = _context2.next) {
87
+ case 0:
88
+ case "end":
89
+ return _context2.stop();
90
+ }
91
+ }, _callee2);
92
+ }));
93
+ function execute() {
94
+ return _execute2.apply(this, arguments);
95
+ }
96
+ return execute;
97
+ }(),
86
98
  isVisible: function isVisible(cell, libro, path) {
87
99
  if (!cell || !libro || !ExecutableCellView.is(cell) || !(libro instanceof LibroView)) {
88
100
  return false;
@@ -98,27 +110,27 @@ export var LibroJupyterCommandContribution = (_dec = singleton({
98
110
  });
99
111
  this.libroCommand.registerLibroCommand(command, NotebookCommands['SelectLastRunCell'], {
100
112
  execute: function () {
101
- var _execute2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(cell, libro) {
102
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
103
- while (1) switch (_context2.prev = _context2.next) {
113
+ var _execute3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(cell, libro) {
114
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
115
+ while (1) switch (_context3.prev = _context3.next) {
104
116
  case 0:
105
117
  if (!(!libro || !(libro instanceof LibroView))) {
106
- _context2.next = 2;
118
+ _context3.next = 2;
107
119
  break;
108
120
  }
109
- return _context2.abrupt("return");
121
+ return _context3.abrupt("return");
110
122
  case 2:
111
123
  if (libro.model instanceof LibroJupyterModel) {
112
124
  libro.model.findRunningCell();
113
125
  }
114
126
  case 3:
115
127
  case "end":
116
- return _context2.stop();
128
+ return _context3.stop();
117
129
  }
118
- }, _callee2);
130
+ }, _callee3);
119
131
  }));
120
132
  function execute(_x3, _x4) {
121
- return _execute2.apply(this, arguments);
133
+ return _execute3.apply(this, arguments);
122
134
  }
123
135
  return execute;
124
136
  }(),
@@ -100,8 +100,8 @@ export var FileView = (_dec = singleton(), _dec2 = view(FileTreeViewFactory, Fil
100
100
  if (opener) {
101
101
  opener.open(treeNode.uri, {
102
102
  viewOptions: {
103
- name: treeNode.fileStat.name
104
- // fileSize: treeNode.fileStat.size,
103
+ name: treeNode.fileStat.name,
104
+ fileSize: treeNode.fileStat.size
105
105
  }
106
106
  });
107
107
  }
@@ -18,12 +18,14 @@ export declare class LibroNavigatableView extends BaseView implements Navigatabl
18
18
  autoSaveDelay: number;
19
19
  get onDirtyChanged(): import("@difizen/libro-common/app").Event<void>;
20
20
  autoSave: 'on' | 'off';
21
+ fileSize?: number;
21
22
  dirty: boolean;
22
23
  libroView?: LibroView;
23
24
  protected defer: Deferred<void>;
24
25
  get ready(): Promise<void>;
25
26
  constructor(options: {
26
27
  path: string;
28
+ [key: string]: any;
27
29
  }, labelProvider: LabelProvider, configurationService: ConfigurationService);
28
30
  onViewMount(): Promise<void>;
29
31
  save: () => void;
@@ -1 +1 @@
1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AAI,KAAK,kBAER;gBAGqB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,EAC1C,aAAa,EAAE,aAAa,EACrB,oBAAoB,EAAE,oBAAoB;IA4B3D,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3C,IAAI,aAQF;IAEF,SAAS,CAAC,UAAU,IAAI,IAAI;cAYZ,oBAAoB;IA0BpC,cAAc,IAAI,GAAG,GAAG,SAAS;IAIjC,eAAe,CAAC,WAAW,EAAE,GAAG,GAAG,GAAG,GAAG,SAAS;CAKnD"}
@@ -51,6 +51,7 @@ export var LibroNavigatableView = (_dec = transient(), _dec2 = view(LibroNavigat
51
51
  _this.dirtyEmitter = new Emitter();
52
52
  _this.autoSaveDelay = 1000;
53
53
  _this.autoSave = 'off';
54
+ _this.fileSize = void 0;
54
55
  _initializerDefineProperty(_this, "dirty", _descriptor4, _assertThisInitialized(_this));
55
56
  _initializerDefineProperty(_this, "libroView", _descriptor5, _assertThisInitialized(_this));
56
57
  _this.defer = new Deferred();
@@ -62,6 +63,7 @@ export var LibroNavigatableView = (_dec = transient(), _dec2 = view(LibroNavigat
62
63
  _this.filePath = options.path;
63
64
  _this.dirty = false;
64
65
  _this.title.caption = options.path;
66
+ _this.fileSize = options['fileSize'];
65
67
  var uri = new URI(options.path);
66
68
  var uriRef = URIIconReference.create('file', new VScodeURI(options.path));
67
69
  var iconClass = labelProvider.getIcon(uriRef);
@@ -141,7 +143,8 @@ export var LibroNavigatableView = (_dec = transient(), _dec2 = view(LibroNavigat
141
143
  _context2.next = 2;
142
144
  return this.libroService.getOrCreateView({
143
145
  id: this.filePath,
144
- resource: this.filePath
146
+ resource: this.filePath,
147
+ fileSize: this.fileSize
145
148
  });
146
149
  case 2:
147
150
  libroView = _context2.sent;
@@ -88,6 +88,6 @@ export var kernelStatus = {
88
88
  category: 'Kernel',
89
89
  color: statusToColor.error,
90
90
  text: 'dead',
91
- text_zh: '死亡'
91
+ text_zh: '终止'
92
92
  }
93
93
  };
@@ -8,6 +8,5 @@ export declare class LibroJupyterView extends LibroView {
8
8
  uri: URI;
9
9
  model: LibroJupyterModel;
10
10
  constructor(options: NotebookOption, collapseServiceFactory: CollapseServiceFactory, notebookService: NotebookService, virtualizedManagerHelper: VirtualizedManagerHelper);
11
- get options(): NotebookOption;
12
11
  }
13
12
  //# sourceMappingURL=libro-jupyter-view.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"libro-jupyter-view.d.ts","sourceRoot":"","sources":["../src/libro-jupyter-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAyB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,GAAG,EAAoB,MAAM,2BAA2B,CAAC;AAGlE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,qBAEa,gBAAiB,SAAQ,SAAS;IAC7C,GAAG,EAAE,GAAG,CAAC;IACD,KAAK,EAAE,iBAAiB,CAAC;gBAEX,OAAO,EAAE,cAAc,EACX,sBAAsB,EAAE,sBAAsB,EACrD,eAAe,EAAE,eAAe,EAEzD,wBAAwB,EAAE,wBAAwB;IAOpD,IAAI,OAAO,mBAEV;CACF"}
1
+ {"version":3,"file":"libro-jupyter-view.d.ts","sourceRoot":"","sources":["../src/libro-jupyter-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAyB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,GAAG,EAAoB,MAAM,2BAA2B,CAAC;AAGlE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,qBAEa,gBAAiB,SAAQ,SAAS;IAC7C,GAAG,EAAE,GAAG,CAAC;IACD,KAAK,EAAE,iBAAiB,CAAC;gBAEX,OAAO,EAAE,cAAc,EACX,sBAAsB,EAAE,sBAAsB,EACrD,eAAe,EAAE,eAAe,EAEzD,wBAAwB,EAAE,wBAAwB;CAOrD"}
@@ -1,10 +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, _class;
3
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
3
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
5
4
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
6
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
6
  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); }
7
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
8
  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); }
9
9
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
10
10
  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); }; }
@@ -34,11 +34,5 @@ export var LibroJupyterView = (_dec = transient(), _dec2 = view(notebookViewFact
34
34
  LibroJupyterView = inject(NotebookService)(LibroJupyterView, undefined, 2) || LibroJupyterView;
35
35
  LibroJupyterView = inject(CollapseServiceFactory)(LibroJupyterView, undefined, 1) || LibroJupyterView;
36
36
  LibroJupyterView = inject(ViewOption)(LibroJupyterView, undefined, 0) || LibroJupyterView;
37
- _createClass(LibroJupyterView, [{
38
- key: "options",
39
- get: function get() {
40
- return this.model.options;
41
- }
42
- }]);
43
- return LibroJupyterView;
37
+ return _createClass(LibroJupyterView);
44
38
  }(LibroView)) || _class) || _class);
@@ -1 +1 @@
1
- {"version":3,"file":"side-toolbar-run-selector.d.ts","sourceRoot":"","sources":["../../src/toolbar/side-toolbar-run-selector.tsx"],"names":[],"mappings":";AAiBA,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAmF1C,CAAC"}
1
+ {"version":3,"file":"side-toolbar-run-selector.d.ts","sourceRoot":"","sources":["../../src/toolbar/side-toolbar-run-selector.tsx"],"names":[],"mappings":";AAyBA,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EA2F1C,CAAC"}
@@ -1,3 +1,7 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+ 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."); }
3
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
4
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1
5
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
6
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
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); }
@@ -7,7 +11,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
11
  import { PlayCircleOutlined } from '@ant-design/icons';
8
12
  import { NotebookCommands, LibroSideToolbarMenu } from '@difizen/libro-core';
9
13
  import { ServerManager } from '@difizen/libro-kernel';
10
- import { ConfigurationService, useInject, ViewInstance } from '@difizen/libro-common/app';
14
+ import { ConfigurationService, useInject, ViewInstance, CommandRegistry, ToolbarInstance, getOrigin } from '@difizen/libro-common/app';
11
15
  import { l10n } from '@difizen/libro-common/l10n';
12
16
  import { Popover, Tooltip } from 'antd';
13
17
  import { useEffect, useState } from 'react';
@@ -21,6 +25,10 @@ export var SideToolbarRunSelector = function SideToolbarRunSelector() {
21
25
  var libroServerManager = useInject(ServerManager);
22
26
  var configService = useInject(ConfigurationService);
23
27
  var libroModel = libroView ? libroView.model : undefined;
28
+ var command = useInject(CommandRegistry);
29
+ var toolbar = useInject(ToolbarInstance);
30
+ var data = toolbar.currentArgs;
31
+ var args = getOrigin(data) || [];
24
32
  var items = [{
25
33
  id: NotebookCommands['RunCell'].id,
26
34
  label: /*#__PURE__*/_jsxs(_Fragment, {
@@ -79,7 +87,11 @@ export var SideToolbarRunSelector = function SideToolbarRunSelector() {
79
87
  }),
80
88
  trigger: "hover",
81
89
  overlayClassName: "libro-popover-side-toolbar-menu libro-side-toolbar-run-select-menu",
82
- children: /*#__PURE__*/_jsx(PlayCircleOutlined, {})
90
+ children: /*#__PURE__*/_jsx(PlayCircleOutlined, {
91
+ onClick: function onClick() {
92
+ command.executeCommand.apply(command, [NotebookCommands['RunCell'].id].concat(_toConsumableArray(args)));
93
+ }
94
+ })
83
95
  });
84
96
  }
85
97
  return /*#__PURE__*/_jsx(Tooltip, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@difizen/libro-jupyter",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "libro"
@@ -37,22 +37,23 @@
37
37
  "dependencies": {
38
38
  "@ant-design/colors": "^7.0.0",
39
39
  "@ant-design/icons": "^5.1.0",
40
- "@difizen/libro-code-cell": "^1.0.0",
41
- "@difizen/libro-code-editor": "^1.0.0",
42
- "@difizen/libro-codemirror": "^1.0.0",
43
- "@difizen/libro-cofine-editor": "^1.0.0",
44
- "@difizen/libro-common": "^1.0.0",
45
- "@difizen/libro-core": "^1.0.0",
46
- "@difizen/libro-kernel": "^1.0.0",
47
- "@difizen/libro-l10n": "^1.0.0",
48
- "@difizen/libro-language-client": "^1.0.0",
49
- "@difizen/libro-lsp": "^1.0.0",
50
- "@difizen/libro-markdown-cell": "^1.0.0",
51
- "@difizen/libro-output": "^1.0.0",
52
- "@difizen/libro-raw-cell": "^1.0.0",
53
- "@difizen/libro-rendermime": "^1.0.0",
54
- "@difizen/libro-search": "^1.0.0",
55
- "@difizen/libro-search-code-cell": "^1.0.0",
40
+ "@difizen/libro-code-cell": "^1.0.1",
41
+ "@difizen/libro-code-editor": "^1.0.1",
42
+ "@difizen/libro-codemirror": "^1.0.1",
43
+ "@difizen/libro-cofine-editor": "^1.0.1",
44
+ "@difizen/libro-common": "^1.0.1",
45
+ "@difizen/libro-core": "^1.0.1",
46
+ "@difizen/libro-kernel": "^1.0.1",
47
+ "@difizen/libro-l10n": "^1.0.1",
48
+ "@difizen/libro-language-client": "^1.0.1",
49
+ "@difizen/libro-lsp": "^1.0.1",
50
+ "@difizen/libro-markdown-cell": "^1.0.1",
51
+ "@difizen/libro-output": "^1.0.1",
52
+ "@difizen/libro-raw-cell": "^1.0.1",
53
+ "@difizen/libro-rendermime": "^1.0.1",
54
+ "@difizen/libro-search": "^1.0.1",
55
+ "@difizen/libro-search-code-cell": "^1.0.1",
56
+ "uuid": "^9.0.0",
56
57
  "classnames": "^2.3.2",
57
58
  "moment": "^2.29.4",
58
59
  "plotly.js": "^2.35.0"
@@ -1,6 +1,7 @@
1
1
  import type { CellOptions } from '@difizen/libro-core';
2
2
  import type { CommandRegistry } from '@difizen/libro-common/app';
3
3
  import { CommandContribution, singleton } from '@difizen/libro-common/app';
4
+ import { v4 } from 'uuid';
4
5
 
5
6
  export const LibroAddBetweenCellCommand = {
6
7
  AddBetweenCell: {
@@ -23,16 +24,15 @@ export class LibroAddBetweenCellCommandContribution implements CommandContributi
23
24
  if (!type || typeof addCell !== 'function') {
24
25
  return;
25
26
  }
26
- await addCell(
27
- {
28
- cell: {
29
- cell_type: type,
30
- metadata: {},
31
- source: '',
32
- },
27
+ const cellOptions = {
28
+ id: v4(),
29
+ cell: {
30
+ cell_type: type,
31
+ metadata: {},
32
+ source: '',
33
33
  },
34
- index,
35
- );
34
+ };
35
+ await addCell(cellOptions, index);
36
36
  },
37
37
  });
38
38
 
@@ -7,6 +7,7 @@ import {
7
7
  LibroView,
8
8
  NotebookCommands,
9
9
  ExecutableCellView,
10
+ LibroCellView,
10
11
  } from '@difizen/libro-core';
11
12
  import type { CommandRegistry } from '@difizen/libro-common/app';
12
13
  import {
@@ -86,7 +87,7 @@ export class LibroJupyterCommandContribution implements CommandContribution {
86
87
  command,
87
88
  NotebookCommands['SideToolbarRunSelect'],
88
89
  {
89
- execute: () => {
90
+ execute: async () => {
90
91
  //
91
92
  },
92
93
  isVisible: (cell, libro, path) => {
@@ -168,7 +168,7 @@ export class FileView extends FileTreeView {
168
168
  opener.open(treeNode.uri, {
169
169
  viewOptions: {
170
170
  name: treeNode.fileStat.name,
171
- // fileSize: treeNode.fileStat.size,
171
+ fileSize: treeNode.fileStat.size,
172
172
  },
173
173
  });
174
174
  }
@@ -63,6 +63,7 @@ export class LibroNavigatableView
63
63
  }
64
64
 
65
65
  autoSave: 'on' | 'off' = 'off';
66
+ fileSize?: number;
66
67
 
67
68
  @prop()
68
69
  dirty: boolean;
@@ -77,7 +78,7 @@ export class LibroNavigatableView
77
78
  }
78
79
 
79
80
  constructor(
80
- @inject(ViewOption) options: { path: string },
81
+ @inject(ViewOption) options: { path: string; [key: string]: any },
81
82
  @inject(LabelProvider) labelProvider: LabelProvider,
82
83
  @inject(ConfigurationService) configurationService: ConfigurationService,
83
84
  ) {
@@ -85,6 +86,7 @@ export class LibroNavigatableView
85
86
  this.filePath = options.path;
86
87
  this.dirty = false;
87
88
  this.title.caption = options.path;
89
+ this.fileSize = options['fileSize'];
88
90
  const uri = new URI(options.path);
89
91
  const uriRef = URIIconReference.create('file', new VScodeURI(options.path));
90
92
  const iconClass = labelProvider.getIcon(uriRef);
@@ -136,6 +138,7 @@ export class LibroNavigatableView
136
138
  const libroView = await this.libroService.getOrCreateView({
137
139
  id: this.filePath,
138
140
  resource: this.filePath,
141
+ fileSize: this.fileSize,
139
142
  });
140
143
  if (!libroView) {
141
144
  return;
@@ -149,6 +149,6 @@ export const kernelStatus: Record<string, ServerStatus> = {
149
149
  category: 'Kernel',
150
150
  color: statusToColor.error,
151
151
  text: 'dead',
152
- text_zh: '死亡',
152
+ text_zh: '终止',
153
153
  },
154
154
  };
@@ -24,7 +24,4 @@ export class LibroJupyterView extends LibroView {
24
24
  this.uri = uri;
25
25
  this.title.label = uri.displayName;
26
26
  }
27
- get options() {
28
- return this.model.options;
29
- }
30
27
  }
@@ -1,11 +1,19 @@
1
1
  import { PlayCircleOutlined } from '@ant-design/icons';
2
- import type { LibroSideToolbarMenuItemType, LibroView } from '@difizen/libro-core';
2
+ import type {
3
+ LibroSideToolbarMenuItemType,
4
+ LibroToolbarArags,
5
+ LibroView,
6
+ } from '@difizen/libro-core';
3
7
  import { NotebookCommands, LibroSideToolbarMenu } from '@difizen/libro-core';
4
8
  import { ServerManager } from '@difizen/libro-kernel';
9
+ import type { Toolbar } from '@difizen/libro-common/app';
5
10
  import {
6
11
  ConfigurationService,
7
12
  useInject,
8
13
  ViewInstance,
14
+ CommandRegistry,
15
+ ToolbarInstance,
16
+ getOrigin,
9
17
  } from '@difizen/libro-common/app';
10
18
  import { l10n } from '@difizen/libro-common/l10n';
11
19
  import { Popover, Tooltip } from 'antd';
@@ -20,6 +28,10 @@ export const SideToolbarRunSelector: React.FC = () => {
20
28
  const libroServerManager = useInject(ServerManager);
21
29
  const configService = useInject<ConfigurationService>(ConfigurationService);
22
30
  const libroModel = libroView ? libroView.model : undefined;
31
+ const command = useInject(CommandRegistry);
32
+ const toolbar = useInject<Toolbar>(ToolbarInstance);
33
+ const data = toolbar.currentArgs as LibroToolbarArags;
34
+ const args = getOrigin(data) || [];
23
35
  const items: LibroSideToolbarMenuItemType[] = [
24
36
  {
25
37
  id: NotebookCommands['RunCell'].id,
@@ -84,7 +96,11 @@ export const SideToolbarRunSelector: React.FC = () => {
84
96
  trigger="hover"
85
97
  overlayClassName="libro-popover-side-toolbar-menu libro-side-toolbar-run-select-menu"
86
98
  >
87
- <PlayCircleOutlined />
99
+ <PlayCircleOutlined
100
+ onClick={() => {
101
+ command.executeCommand(NotebookCommands['RunCell'].id, ...args);
102
+ }}
103
+ />
88
104
  </Popover>
89
105
  );
90
106
  }