@difizen/libro-jupyter 0.1.37 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -234,7 +234,7 @@ export var LibroWrappedBetweenCellContent = function LibroWrappedBetweenCellCont
234
234
  addCell = props.addCell;
235
235
  var instance = useInject(ViewInstance);
236
236
  return /*#__PURE__*/_jsx(DisplayWrapComponent, {
237
- mode: instance.model.readOnly,
237
+ mode: instance.model.cellsEditable,
238
238
  children: /*#__PURE__*/_jsx(LibroCommonBetweenCellContent, {
239
239
  index: index,
240
240
  addCell: addCell
@@ -1 +1 @@
1
- {"version":3,"file":"command-contribution.d.ts","sourceRoot":"","sources":["../../src/command/command-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,oBAAoB,EACpB,YAAY,EAMb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EACL,mBAAmB,EAEnB,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAK3B,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;CA2IjD"}
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,mBAAmB,CAAC;AACzD,OAAO,EACL,mBAAmB,EAEnB,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAK3B,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;CA2IjD"}
@@ -53,7 +53,7 @@ export var LibroJupyterCommandContribution = (_dec = singleton({
53
53
  if (!libro || !(libro instanceof LibroView)) {
54
54
  return false;
55
55
  }
56
- return !(libro !== null && libro !== void 0 && libro.model.quickEditMode) && !(libro !== null && libro !== void 0 && libro.model.readOnly) && path === LibroToolbarArea.HeaderLeft;
56
+ return (libro === null || libro === void 0 ? void 0 : libro.model).executable && path === LibroToolbarArea.HeaderLeft;
57
57
  },
58
58
  isEnabled: function isEnabled(cell, libro) {
59
59
  if (!libro || !(libro instanceof LibroView)) {
@@ -70,7 +70,7 @@ export var LibroJupyterCommandContribution = (_dec = singleton({
70
70
  if (!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView)) {
71
71
  return false;
72
72
  }
73
- if (path !== LibroToolbarArea.HeaderCenter || libro.model.quickEditMode || libro.model.readOnly) {
73
+ if (path !== LibroToolbarArea.HeaderCenter || !(libro === null || libro === void 0 ? void 0 : libro.model).executable) {
74
74
  return false;
75
75
  }
76
76
  return !!cell;
@@ -90,7 +90,7 @@ export var LibroJupyterCommandContribution = (_dec = singleton({
90
90
  if (!cell || !libro || !ExecutableCellView.is(cell) || !(libro instanceof LibroView)) {
91
91
  return false;
92
92
  }
93
- return !(libro !== null && libro !== void 0 && libro.model.quickEditMode) && !(libro !== null && libro !== void 0 && libro.model.readOnly) && path === LibroToolbarArea.CellRight;
93
+ return (libro === null || libro === void 0 ? void 0 : libro.model).executable && path === LibroToolbarArea.CellRight;
94
94
  },
95
95
  isEnabled: function isEnabled(cell, libro) {
96
96
  if (!libro || !(libro instanceof LibroView)) {
@@ -129,10 +129,10 @@ export var LibroJupyterCommandContribution = (_dec = singleton({
129
129
  if (!libro || !(libro instanceof LibroView)) {
130
130
  return false;
131
131
  }
132
- return !(libro !== null && libro !== void 0 && libro.model.quickEditMode) && path === LibroToolbarArea.HeaderCenter && !libro.model.readOnly;
132
+ return (libro === null || libro === void 0 ? void 0 : libro.model).executable && path === LibroToolbarArea.HeaderCenter;
133
133
  },
134
134
  isEnabled: function isEnabled(cell, libro) {
135
- if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
135
+ if (!libro || !(libro instanceof LibroView) || !(libro === null || libro === void 0 ? void 0 : libro.model).executable) {
136
136
  return false;
137
137
  }
138
138
  return libro.model.getCells().findIndex(function (item) {
@@ -43,7 +43,7 @@ export var LibroJupyterContentContribution = (_dec = singleton({
43
43
  jupyterModel.currentFileContents = currentFileContents;
44
44
  jupyterModel.filePath = currentFileContents.path;
45
45
  jupyterModel.lastModified = jupyterModel.currentFileContents.last_modified;
46
- if (!jupyterModel.quickEditMode && !jupyterModel.readOnly) {
46
+ if (jupyterModel.executable) {
47
47
  jupyterModel.startKernelConnection();
48
48
  }
49
49
  return _context.abrupt("return", jupyterModel.currentFileContents.content);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@difizen/libro-jupyter",
3
- "version": "0.1.37",
3
+ "version": "0.2.1",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "libro"
@@ -31,22 +31,22 @@
31
31
  "src"
32
32
  ],
33
33
  "dependencies": {
34
- "@difizen/libro-cofine-editor": "^0.1.37",
35
- "@difizen/libro-code-editor": "^0.1.37",
36
- "@difizen/libro-code-cell": "^0.1.37",
37
- "@difizen/libro-codemirror": "^0.1.37",
38
- "@difizen/libro-rendermime": "^0.1.37",
39
- "@difizen/libro-common": "^0.1.37",
40
- "@difizen/libro-core": "^0.1.37",
41
- "@difizen/libro-kernel": "^0.1.37",
42
- "@difizen/libro-l10n": "^0.1.37",
43
- "@difizen/libro-output": "^0.1.37",
44
- "@difizen/libro-search": "^0.1.37",
45
- "@difizen/libro-search-code-cell": "^0.1.37",
46
- "@difizen/libro-lsp": "^0.1.37",
47
- "@difizen/libro-markdown-cell": "^0.1.37",
48
- "@difizen/libro-raw-cell": "^0.1.37",
49
- "@difizen/libro-language-client": "^0.1.37",
34
+ "@difizen/libro-cofine-editor": "^0.2.1",
35
+ "@difizen/libro-code-editor": "^0.2.1",
36
+ "@difizen/libro-code-cell": "^0.2.1",
37
+ "@difizen/libro-codemirror": "^0.2.1",
38
+ "@difizen/libro-rendermime": "^0.2.1",
39
+ "@difizen/libro-common": "^0.2.1",
40
+ "@difizen/libro-core": "^0.2.1",
41
+ "@difizen/libro-kernel": "^0.2.1",
42
+ "@difizen/libro-l10n": "^0.2.1",
43
+ "@difizen/libro-output": "^0.2.1",
44
+ "@difizen/libro-search": "^0.2.1",
45
+ "@difizen/libro-search-code-cell": "^0.2.1",
46
+ "@difizen/libro-lsp": "^0.2.1",
47
+ "@difizen/libro-markdown-cell": "^0.2.1",
48
+ "@difizen/libro-raw-cell": "^0.2.1",
49
+ "@difizen/libro-language-client": "^0.2.1",
50
50
  "@difizen/mana-app": "latest",
51
51
  "@difizen/mana-l10n": "latest",
52
52
  "@ant-design/colors": "^7.0.0",
@@ -203,7 +203,7 @@ export const LibroWrappedBetweenCellContent: BetweenCellProvider = (props: {
203
203
  const { index, addCell } = props;
204
204
  const instance = useInject<LibroView>(ViewInstance);
205
205
  return (
206
- <DisplayWrapComponent mode={instance.model.readOnly}>
206
+ <DisplayWrapComponent mode={instance.model.cellsEditable}>
207
207
  <LibroCommonBetweenCellContent index={index} addCell={addCell} />
208
208
  </DisplayWrapComponent>
209
209
  );
@@ -1,3 +1,4 @@
1
+ import type { LibroModel } from '@difizen/libro-core';
1
2
  import {
2
3
  KernelCommands,
3
4
  LibroCommandRegister,
@@ -40,8 +41,7 @@ export class LibroJupyterCommandContribution implements CommandContribution {
40
41
  return false;
41
42
  }
42
43
  return (
43
- !libro?.model.quickEditMode &&
44
- !libro?.model.readOnly &&
44
+ (libro?.model as LibroModel).executable &&
45
45
  path === LibroToolbarArea.HeaderLeft
46
46
  );
47
47
  },
@@ -72,8 +72,7 @@ export class LibroJupyterCommandContribution implements CommandContribution {
72
72
  }
73
73
  if (
74
74
  path !== LibroToolbarArea.HeaderCenter ||
75
- libro.model.quickEditMode ||
76
- libro.model.readOnly
75
+ !(libro?.model as LibroModel).executable
77
76
  ) {
78
77
  return false;
79
78
  }
@@ -108,8 +107,7 @@ export class LibroJupyterCommandContribution implements CommandContribution {
108
107
  return false;
109
108
  }
110
109
  return (
111
- !libro?.model.quickEditMode &&
112
- !libro?.model.readOnly &&
110
+ (libro?.model as LibroModel).executable &&
113
111
  path === LibroToolbarArea.CellRight
114
112
  );
115
113
  },
@@ -142,13 +140,16 @@ export class LibroJupyterCommandContribution implements CommandContribution {
142
140
  return false;
143
141
  }
144
142
  return (
145
- !libro?.model.quickEditMode &&
146
- path === LibroToolbarArea.HeaderCenter &&
147
- !libro.model.readOnly
143
+ (libro?.model as LibroJupyterModel).executable &&
144
+ path === LibroToolbarArea.HeaderCenter
148
145
  );
149
146
  },
150
147
  isEnabled: (cell, libro) => {
151
- if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
148
+ if (
149
+ !libro ||
150
+ !(libro instanceof LibroView) ||
151
+ !(libro?.model as LibroJupyterModel).executable
152
+ ) {
152
153
  return false;
153
154
  }
154
155
  return (
@@ -22,7 +22,7 @@ export class LibroJupyterContentContribution implements ContentContribution {
22
22
  jupyterModel.filePath = currentFileContents.path;
23
23
  jupyterModel.lastModified = jupyterModel.currentFileContents.last_modified;
24
24
 
25
- if (!jupyterModel.quickEditMode && !jupyterModel.readOnly) {
25
+ if (jupyterModel.executable) {
26
26
  jupyterModel.startKernelConnection();
27
27
  }
28
28