@theia/notebook 1.47.1 → 1.48.2

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 (112) hide show
  1. package/lib/browser/contributions/cell-operations.d.ts +8 -0
  2. package/lib/browser/contributions/cell-operations.d.ts.map +1 -0
  3. package/lib/browser/contributions/cell-operations.js +37 -0
  4. package/lib/browser/contributions/cell-operations.js.map +1 -0
  5. package/lib/browser/contributions/notebook-actions-contribution.d.ts +10 -2
  6. package/lib/browser/contributions/notebook-actions-contribution.d.ts.map +1 -1
  7. package/lib/browser/contributions/notebook-actions-contribution.js +61 -7
  8. package/lib/browser/contributions/notebook-actions-contribution.js.map +1 -1
  9. package/lib/browser/contributions/notebook-cell-actions-contribution.d.ts +16 -1
  10. package/lib/browser/contributions/notebook-cell-actions-contribution.d.ts.map +1 -1
  11. package/lib/browser/contributions/notebook-cell-actions-contribution.js +154 -17
  12. package/lib/browser/contributions/notebook-cell-actions-contribution.js.map +1 -1
  13. package/lib/browser/notebook-editor-widget.d.ts +8 -2
  14. package/lib/browser/notebook-editor-widget.d.ts.map +1 -1
  15. package/lib/browser/notebook-editor-widget.js +38 -13
  16. package/lib/browser/notebook-editor-widget.js.map +1 -1
  17. package/lib/browser/notebook-frontend-module.d.ts.map +1 -1
  18. package/lib/browser/notebook-frontend-module.js +6 -9
  19. package/lib/browser/notebook-frontend-module.js.map +1 -1
  20. package/lib/browser/notebook-types.d.ts +10 -2
  21. package/lib/browser/notebook-types.d.ts.map +1 -1
  22. package/lib/browser/notebook-types.js.map +1 -1
  23. package/lib/browser/service/notebook-context-manager.d.ts +24 -0
  24. package/lib/browser/service/notebook-context-manager.d.ts.map +1 -0
  25. package/lib/browser/service/notebook-context-manager.js +112 -0
  26. package/lib/browser/service/notebook-context-manager.js.map +1 -0
  27. package/lib/browser/service/notebook-editor-widget-service.d.ts +3 -0
  28. package/lib/browser/service/notebook-editor-widget-service.d.ts.map +1 -1
  29. package/lib/browser/service/notebook-editor-widget-service.js +21 -11
  30. package/lib/browser/service/notebook-editor-widget-service.js.map +1 -1
  31. package/lib/browser/service/notebook-kernel-service.d.ts +1 -0
  32. package/lib/browser/service/notebook-kernel-service.d.ts.map +1 -1
  33. package/lib/browser/service/notebook-kernel-service.js +6 -3
  34. package/lib/browser/service/notebook-kernel-service.js.map +1 -1
  35. package/lib/browser/service/notebook-monaco-text-model-service.d.ts +16 -0
  36. package/lib/browser/service/notebook-monaco-text-model-service.d.ts.map +1 -0
  37. package/lib/browser/service/notebook-monaco-text-model-service.js +49 -0
  38. package/lib/browser/service/notebook-monaco-text-model-service.js.map +1 -0
  39. package/lib/browser/service/notebook-service.d.ts +10 -2
  40. package/lib/browser/service/notebook-service.d.ts.map +1 -1
  41. package/lib/browser/service/notebook-service.js +19 -6
  42. package/lib/browser/service/notebook-service.js.map +1 -1
  43. package/lib/browser/view/notebook-cell-editor.d.ts +7 -0
  44. package/lib/browser/view/notebook-cell-editor.d.ts.map +1 -1
  45. package/lib/browser/view/notebook-cell-editor.js +43 -3
  46. package/lib/browser/view/notebook-cell-editor.js.map +1 -1
  47. package/lib/browser/view/notebook-cell-list-view.d.ts.map +1 -1
  48. package/lib/browser/view/notebook-cell-list-view.js +6 -3
  49. package/lib/browser/view/notebook-cell-list-view.js.map +1 -1
  50. package/lib/browser/view/notebook-cell-toolbar-factory.d.ts +2 -0
  51. package/lib/browser/view/notebook-cell-toolbar-factory.d.ts.map +1 -1
  52. package/lib/browser/view/notebook-cell-toolbar-factory.js +12 -6
  53. package/lib/browser/view/notebook-cell-toolbar-factory.js.map +1 -1
  54. package/lib/browser/view/notebook-cell-toolbar.js +1 -1
  55. package/lib/browser/view/notebook-cell-toolbar.js.map +1 -1
  56. package/lib/browser/view/notebook-code-cell-view.d.ts +11 -0
  57. package/lib/browser/view/notebook-code-cell-view.d.ts.map +1 -1
  58. package/lib/browser/view/notebook-code-cell-view.js +52 -4
  59. package/lib/browser/view/notebook-code-cell-view.js.map +1 -1
  60. package/lib/browser/view/notebook-main-toolbar.d.ts +6 -1
  61. package/lib/browser/view/notebook-main-toolbar.d.ts.map +1 -1
  62. package/lib/browser/view/notebook-main-toolbar.js +23 -5
  63. package/lib/browser/view/notebook-main-toolbar.js.map +1 -1
  64. package/lib/browser/view/notebook-markdown-cell-view.d.ts +2 -0
  65. package/lib/browser/view/notebook-markdown-cell-view.d.ts.map +1 -1
  66. package/lib/browser/view/notebook-markdown-cell-view.js +9 -4
  67. package/lib/browser/view/notebook-markdown-cell-view.js.map +1 -1
  68. package/lib/browser/view/notebook-viewport-service.d.ts +17 -0
  69. package/lib/browser/view/notebook-viewport-service.d.ts.map +1 -0
  70. package/lib/browser/view/notebook-viewport-service.js +60 -0
  71. package/lib/browser/view/notebook-viewport-service.js.map +1 -0
  72. package/lib/browser/view-model/notebook-cell-model.d.ts +9 -15
  73. package/lib/browser/view-model/notebook-cell-model.d.ts.map +1 -1
  74. package/lib/browser/view-model/notebook-cell-model.js +22 -23
  75. package/lib/browser/view-model/notebook-cell-model.js.map +1 -1
  76. package/lib/browser/view-model/notebook-model.d.ts +7 -4
  77. package/lib/browser/view-model/notebook-model.d.ts.map +1 -1
  78. package/lib/browser/view-model/notebook-model.js +50 -6
  79. package/lib/browser/view-model/notebook-model.js.map +1 -1
  80. package/lib/common/notebook-common.d.ts +7 -0
  81. package/lib/common/notebook-common.d.ts.map +1 -1
  82. package/lib/common/notebook-common.js +12 -1
  83. package/lib/common/notebook-common.js.map +1 -1
  84. package/package.json +8 -7
  85. package/src/browser/contributions/cell-operations.ts +38 -0
  86. package/src/browser/contributions/notebook-actions-contribution.ts +66 -6
  87. package/src/browser/contributions/notebook-cell-actions-contribution.ts +194 -22
  88. package/src/browser/notebook-editor-widget.tsx +43 -17
  89. package/src/browser/notebook-frontend-module.ts +8 -11
  90. package/src/browser/notebook-types.ts +13 -1
  91. package/src/browser/service/notebook-context-manager.ts +127 -0
  92. package/src/browser/service/notebook-editor-widget-service.ts +20 -10
  93. package/src/browser/service/notebook-kernel-service.ts +6 -2
  94. package/src/browser/service/notebook-monaco-text-model-service.ts +48 -0
  95. package/src/browser/service/notebook-service.ts +26 -5
  96. package/src/browser/style/index.css +25 -8
  97. package/src/browser/view/notebook-cell-editor.tsx +52 -10
  98. package/src/browser/view/notebook-cell-list-view.tsx +8 -4
  99. package/src/browser/view/notebook-cell-toolbar-factory.tsx +9 -4
  100. package/src/browser/view/notebook-cell-toolbar.tsx +1 -1
  101. package/src/browser/view/notebook-code-cell-view.tsx +64 -8
  102. package/src/browser/view/notebook-main-toolbar.tsx +26 -5
  103. package/src/browser/view/notebook-markdown-cell-view.tsx +9 -4
  104. package/src/browser/view/notebook-viewport-service.ts +61 -0
  105. package/src/browser/view-model/notebook-cell-model.ts +26 -33
  106. package/src/browser/view-model/notebook-model.ts +70 -7
  107. package/src/common/notebook-common.ts +13 -0
  108. package/lib/browser/service/notebook-cell-context-manager.d.ts +0 -16
  109. package/lib/browser/service/notebook-cell-context-manager.d.ts.map +0 -1
  110. package/lib/browser/service/notebook-cell-context-manager.js +0 -74
  111. package/lib/browser/service/notebook-cell-context-manager.js.map +0 -1
  112. package/src/browser/service/notebook-cell-context-manager.ts +0 -72
@@ -1,74 +0,0 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2023 TypeFox and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.NotebookCellContextManager = void 0;
19
- const tslib_1 = require("tslib");
20
- const inversify_1 = require("@theia/core/shared/inversify");
21
- const context_key_service_1 = require("@theia/core/lib/browser/context-key-service");
22
- const notebook_context_keys_1 = require("../contributions/notebook-context-keys");
23
- const core_1 = require("@theia/core");
24
- const common_1 = require("../../common");
25
- const notebook_execution_state_service_1 = require("../service/notebook-execution-state-service");
26
- let NotebookCellContextManager = class NotebookCellContextManager {
27
- constructor() {
28
- this.toDispose = new core_1.DisposableCollection();
29
- this.onDidChangeContextEmitter = new core_1.Emitter();
30
- this.onDidChangeContext = this.onDidChangeContextEmitter.event;
31
- }
32
- updateCellContext(cell, newHtmlContext) {
33
- if (newHtmlContext !== this.currentContext) {
34
- this.toDispose.dispose();
35
- this.currentContext = newHtmlContext;
36
- this.currentStore = this.contextKeyService.createScoped(newHtmlContext);
37
- this.currentStore.setContext(notebook_context_keys_1.NOTEBOOK_CELL_TYPE, cell.cellKind === common_1.CellKind.Code ? 'code' : 'markdown');
38
- this.toDispose.push(this.contextKeyService.onDidChange(e => {
39
- this.onDidChangeContextEmitter.fire(e);
40
- }));
41
- this.toDispose.push(cell.onDidRequestCellEditChange(cellEdit => {
42
- var _a;
43
- (_a = this.currentStore) === null || _a === void 0 ? void 0 : _a.setContext(notebook_context_keys_1.NOTEBOOK_CELL_MARKDOWN_EDIT_MODE, cellEdit);
44
- this.onDidChangeContextEmitter.fire({ affects: keys => keys.has(notebook_context_keys_1.NOTEBOOK_CELL_MARKDOWN_EDIT_MODE) });
45
- }));
46
- this.toDispose.push(this.executionStateService.onDidChangeExecution(e => {
47
- var _a, _b, _c, _d;
48
- if (e.affectsCell(cell.uri)) {
49
- (_a = this.currentStore) === null || _a === void 0 ? void 0 : _a.setContext(notebook_context_keys_1.NOTEBOOK_CELL_EXECUTING, !!e.changed);
50
- (_b = this.currentStore) === null || _b === void 0 ? void 0 : _b.setContext(notebook_context_keys_1.NOTEBOOK_CELL_EXECUTION_STATE, (_d = (_c = e.changed) === null || _c === void 0 ? void 0 : _c.state) !== null && _d !== void 0 ? _d : 'idle');
51
- this.onDidChangeContextEmitter.fire({ affects: keys => keys.has(notebook_context_keys_1.NOTEBOOK_CELL_EXECUTING) || keys.has(notebook_context_keys_1.NOTEBOOK_CELL_EXECUTION_STATE) });
52
- }
53
- }));
54
- this.onDidChangeContextEmitter.fire({ affects: keys => true });
55
- }
56
- }
57
- dispose() {
58
- this.toDispose.dispose();
59
- this.onDidChangeContextEmitter.dispose();
60
- }
61
- };
62
- (0, tslib_1.__decorate)([
63
- (0, inversify_1.inject)(context_key_service_1.ContextKeyService),
64
- (0, tslib_1.__metadata)("design:type", Object)
65
- ], NotebookCellContextManager.prototype, "contextKeyService", void 0);
66
- (0, tslib_1.__decorate)([
67
- (0, inversify_1.inject)(notebook_execution_state_service_1.NotebookExecutionStateService),
68
- (0, tslib_1.__metadata)("design:type", notebook_execution_state_service_1.NotebookExecutionStateService)
69
- ], NotebookCellContextManager.prototype, "executionStateService", void 0);
70
- NotebookCellContextManager = (0, tslib_1.__decorate)([
71
- (0, inversify_1.injectable)()
72
- ], NotebookCellContextManager);
73
- exports.NotebookCellContextManager = NotebookCellContextManager;
74
- //# sourceMappingURL=notebook-cell-context-manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notebook-cell-context-manager.js","sourceRoot":"","sources":["../../../src/browser/service/notebook-cell-context-manager.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4DAAkE;AAClE,qFAAyH;AAEzH,kFAAsK;AACtK,sCAAwE;AACxE,yCAAwC;AACxC,kGAA4F;AAG5F,IAAa,0BAA0B,GAAvC,MAAa,0BAA0B;IAAvC;QAMuB,cAAS,GAAG,IAAI,2BAAoB,EAAE,CAA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,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;oBACzB,MAAA,IAAI,CAAC,YAAY,0CAAE,UAAU,CAAC,+CAAuB,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;oBACpE,MAAA,IAAI,CAAC,YAAY,0CAAE,UAAU,CAAC,qDAA6B,EAAE,MAAA,MAAA,CAAC,CAAC,OAAO,0CAAE,KAAK,mCAAI,MAAM,CAAC,CAAC;oBACzF,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,+CAAuB,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,qDAA6B,CAAC,EAAE,CAAC,CAAC;iBAC1I;YACL,CAAC,CAAC,CAAC,CAAC;YACJ,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;SAClE;IACL,CAAC;IAED,OAAO;QACH,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QACzB,IAAI,CAAC,yBAAyB,CAAC,OAAO,EAAE,CAAC;IAC7C,CAAC;CACJ,CAAA;AA7C8B;IAA1B,IAAA,kBAAM,EAAC,uCAAiB,CAAC;;qEAAgD;AAG1E;IADC,IAAA,kBAAM,EAAC,gEAA6B,CAAC;2CACI,gEAA6B;yEAAC;AAJ/D,0BAA0B;IADtC,IAAA,sBAAU,GAAE;GACA,0BAA0B,CA8CtC;AA9CY,gEAA0B"}
@@ -1,72 +0,0 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2023 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { inject, injectable } from '@theia/core/shared/inversify';
18
- import { ContextKeyChangeEvent, ContextKeyService, ScopedValueStore } from '@theia/core/lib/browser/context-key-service';
19
- import { NotebookCellModel } from '../view-model/notebook-cell-model';
20
- import { NOTEBOOK_CELL_EXECUTING, NOTEBOOK_CELL_EXECUTION_STATE, NOTEBOOK_CELL_MARKDOWN_EDIT_MODE, NOTEBOOK_CELL_TYPE } from '../contributions/notebook-context-keys';
21
- import { Disposable, DisposableCollection, Emitter } from '@theia/core';
22
- import { CellKind } from '../../common';
23
- import { NotebookExecutionStateService } from '../service/notebook-execution-state-service';
24
-
25
- @injectable()
26
- export class NotebookCellContextManager implements NotebookCellContextManager, Disposable {
27
- @inject(ContextKeyService) protected contextKeyService: ContextKeyService;
28
-
29
- @inject(NotebookExecutionStateService)
30
- protected readonly executionStateService: NotebookExecutionStateService;
31
-
32
- protected readonly toDispose = new DisposableCollection();
33
-
34
- protected currentStore: ScopedValueStore;
35
- protected currentContext: HTMLLIElement;
36
-
37
- protected readonly onDidChangeContextEmitter = new Emitter<ContextKeyChangeEvent>();
38
- readonly onDidChangeContext = this.onDidChangeContextEmitter.event;
39
-
40
- updateCellContext(cell: NotebookCellModel, newHtmlContext: HTMLLIElement): void {
41
- if (newHtmlContext !== this.currentContext) {
42
- this.toDispose.dispose();
43
-
44
- this.currentContext = newHtmlContext;
45
- this.currentStore = this.contextKeyService.createScoped(newHtmlContext);
46
-
47
- this.currentStore.setContext(NOTEBOOK_CELL_TYPE, cell.cellKind === CellKind.Code ? 'code' : 'markdown');
48
-
49
- this.toDispose.push(this.contextKeyService.onDidChange(e => {
50
- this.onDidChangeContextEmitter.fire(e);
51
- }));
52
-
53
- this.toDispose.push(cell.onDidRequestCellEditChange(cellEdit => {
54
- this.currentStore?.setContext(NOTEBOOK_CELL_MARKDOWN_EDIT_MODE, cellEdit);
55
- this.onDidChangeContextEmitter.fire({ affects: keys => keys.has(NOTEBOOK_CELL_MARKDOWN_EDIT_MODE) });
56
- }));
57
- this.toDispose.push(this.executionStateService.onDidChangeExecution(e => {
58
- if (e.affectsCell(cell.uri)) {
59
- this.currentStore?.setContext(NOTEBOOK_CELL_EXECUTING, !!e.changed);
60
- this.currentStore?.setContext(NOTEBOOK_CELL_EXECUTION_STATE, e.changed?.state ?? 'idle');
61
- this.onDidChangeContextEmitter.fire({ affects: keys => keys.has(NOTEBOOK_CELL_EXECUTING) || keys.has(NOTEBOOK_CELL_EXECUTION_STATE) });
62
- }
63
- }));
64
- this.onDidChangeContextEmitter.fire({ affects: keys => true });
65
- }
66
- }
67
-
68
- dispose(): void {
69
- this.toDispose.dispose();
70
- this.onDidChangeContextEmitter.dispose();
71
- }
72
- }