@theia/notebook 1.41.0

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 (188) hide show
  1. package/README.md +30 -0
  2. package/lib/browser/contributions/notebook-actions-contribution.d.ts +27 -0
  3. package/lib/browser/contributions/notebook-actions-contribution.d.ts.map +1 -0
  4. package/lib/browser/contributions/notebook-actions-contribution.js +172 -0
  5. package/lib/browser/contributions/notebook-actions-contribution.js.map +1 -0
  6. package/lib/browser/contributions/notebook-cell-actions-contribution.d.ts +30 -0
  7. package/lib/browser/contributions/notebook-cell-actions-contribution.d.ts.map +1 -0
  8. package/lib/browser/contributions/notebook-cell-actions-contribution.js +200 -0
  9. package/lib/browser/contributions/notebook-cell-actions-contribution.js.map +1 -0
  10. package/lib/browser/contributions/notebook-color-contribution.d.ts +6 -0
  11. package/lib/browser/contributions/notebook-color-contribution.d.ts.map +1 -0
  12. package/lib/browser/contributions/notebook-color-contribution.js +252 -0
  13. package/lib/browser/contributions/notebook-color-contribution.js.map +1 -0
  14. package/lib/browser/contributions/notebook-context-keys.d.ts +38 -0
  15. package/lib/browser/contributions/notebook-context-keys.d.ts.map +1 -0
  16. package/lib/browser/contributions/notebook-context-keys.js +95 -0
  17. package/lib/browser/contributions/notebook-context-keys.js.map +1 -0
  18. package/lib/browser/index.d.ts +11 -0
  19. package/lib/browser/index.d.ts.map +1 -0
  20. package/lib/browser/index.js +38 -0
  21. package/lib/browser/index.js.map +1 -0
  22. package/lib/browser/notebook-cell-resource-resolver.d.ts +20 -0
  23. package/lib/browser/notebook-cell-resource-resolver.d.ts.map +1 -0
  24. package/lib/browser/notebook-cell-resource-resolver.js +75 -0
  25. package/lib/browser/notebook-cell-resource-resolver.js.map +1 -0
  26. package/lib/browser/notebook-editor-widget-factory.d.ts +17 -0
  27. package/lib/browser/notebook-editor-widget-factory.d.ts.map +1 -0
  28. package/lib/browser/notebook-editor-widget-factory.js +78 -0
  29. package/lib/browser/notebook-editor-widget-factory.js.map +1 -0
  30. package/lib/browser/notebook-editor-widget.d.ts +49 -0
  31. package/lib/browser/notebook-editor-widget.d.ts.map +1 -0
  32. package/lib/browser/notebook-editor-widget.js +150 -0
  33. package/lib/browser/notebook-editor-widget.js.map +1 -0
  34. package/lib/browser/notebook-frontend-module.d.ts +5 -0
  35. package/lib/browser/notebook-frontend-module.d.ts.map +1 -0
  36. package/lib/browser/notebook-frontend-module.js +81 -0
  37. package/lib/browser/notebook-frontend-module.js.map +1 -0
  38. package/lib/browser/notebook-open-handler.d.ts +18 -0
  39. package/lib/browser/notebook-open-handler.d.ts.map +1 -0
  40. package/lib/browser/notebook-open-handler.js +94 -0
  41. package/lib/browser/notebook-open-handler.js.map +1 -0
  42. package/lib/browser/notebook-renderer-registry.d.ts +17 -0
  43. package/lib/browser/notebook-renderer-registry.d.ts.map +1 -0
  44. package/lib/browser/notebook-renderer-registry.js +63 -0
  45. package/lib/browser/notebook-renderer-registry.js.map +1 -0
  46. package/lib/browser/notebook-type-registry.d.ts +7 -0
  47. package/lib/browser/notebook-type-registry.d.ts.map +1 -0
  48. package/lib/browser/notebook-type-registry.js +42 -0
  49. package/lib/browser/notebook-type-registry.js.map +1 -0
  50. package/lib/browser/renderers/cell-output-webview.d.ts +12 -0
  51. package/lib/browser/renderers/cell-output-webview.d.ts.map +1 -0
  52. package/lib/browser/renderers/cell-output-webview.js +20 -0
  53. package/lib/browser/renderers/cell-output-webview.js.map +1 -0
  54. package/lib/browser/service/notebook-cell-context-manager.d.ts +16 -0
  55. package/lib/browser/service/notebook-cell-context-manager.d.ts.map +1 -0
  56. package/lib/browser/service/notebook-cell-context-manager.js +83 -0
  57. package/lib/browser/service/notebook-cell-context-manager.js.map +1 -0
  58. package/lib/browser/service/notebook-editor-service.d.ts +22 -0
  59. package/lib/browser/service/notebook-editor-service.d.ts.map +1 -0
  60. package/lib/browser/service/notebook-editor-service.js +95 -0
  61. package/lib/browser/service/notebook-editor-service.js.map +1 -0
  62. package/lib/browser/service/notebook-execution-service.d.ts +25 -0
  63. package/lib/browser/service/notebook-execution-service.d.ts.map +1 -0
  64. package/lib/browser/service/notebook-execution-service.js +140 -0
  65. package/lib/browser/service/notebook-execution-service.js.map +1 -0
  66. package/lib/browser/service/notebook-execution-state-service.d.ts +94 -0
  67. package/lib/browser/service/notebook-execution-state-service.d.ts.map +1 -0
  68. package/lib/browser/service/notebook-execution-state-service.js +250 -0
  69. package/lib/browser/service/notebook-execution-state-service.js.map +1 -0
  70. package/lib/browser/service/notebook-kernel-history-service.d.ts +23 -0
  71. package/lib/browser/service/notebook-kernel-history-service.d.ts.map +1 -0
  72. package/lib/browser/service/notebook-kernel-history-service.js +109 -0
  73. package/lib/browser/service/notebook-kernel-history-service.js.map +1 -0
  74. package/lib/browser/service/notebook-kernel-quick-pick-service.d.ts +65 -0
  75. package/lib/browser/service/notebook-kernel-quick-pick-service.d.ts.map +1 -0
  76. package/lib/browser/service/notebook-kernel-quick-pick-service.js +430 -0
  77. package/lib/browser/service/notebook-kernel-quick-pick-service.js.map +1 -0
  78. package/lib/browser/service/notebook-kernel-service.d.ts +112 -0
  79. package/lib/browser/service/notebook-kernel-service.d.ts.map +1 -0
  80. package/lib/browser/service/notebook-kernel-service.js +274 -0
  81. package/lib/browser/service/notebook-kernel-service.js.map +1 -0
  82. package/lib/browser/service/notebook-model-resolver-service.d.ts +26 -0
  83. package/lib/browser/service/notebook-model-resolver-service.d.ts.map +1 -0
  84. package/lib/browser/service/notebook-model-resolver-service.js +139 -0
  85. package/lib/browser/service/notebook-model-resolver-service.js.map +1 -0
  86. package/lib/browser/service/notebook-renderer-messaging-service.d.ts +30 -0
  87. package/lib/browser/service/notebook-renderer-messaging-service.d.ts.map +1 -0
  88. package/lib/browser/service/notebook-renderer-messaging-service.js +94 -0
  89. package/lib/browser/service/notebook-renderer-messaging-service.js.map +1 -0
  90. package/lib/browser/service/notebook-service.d.ts +64 -0
  91. package/lib/browser/service/notebook-service.d.ts.map +1 -0
  92. package/lib/browser/service/notebook-service.js +162 -0
  93. package/lib/browser/service/notebook-service.js.map +1 -0
  94. package/lib/browser/view/notebook-cell-editor.d.ts +26 -0
  95. package/lib/browser/view/notebook-cell-editor.d.ts.map +1 -0
  96. package/lib/browser/view/notebook-cell-editor.js +79 -0
  97. package/lib/browser/view/notebook-cell-editor.js.map +1 -0
  98. package/lib/browser/view/notebook-cell-list-view.d.ts +43 -0
  99. package/lib/browser/view/notebook-cell-list-view.d.ts.map +1 -0
  100. package/lib/browser/view/notebook-cell-list-view.js +111 -0
  101. package/lib/browser/view/notebook-cell-list-view.js.map +1 -0
  102. package/lib/browser/view/notebook-cell-toolbar-factory.d.ts +25 -0
  103. package/lib/browser/view/notebook-cell-toolbar-factory.d.ts.map +1 -0
  104. package/lib/browser/view/notebook-cell-toolbar-factory.js +93 -0
  105. package/lib/browser/view/notebook-cell-toolbar-factory.js.map +1 -0
  106. package/lib/browser/view/notebook-cell-toolbar.d.ts +25 -0
  107. package/lib/browser/view/notebook-cell-toolbar.d.ts.map +1 -0
  108. package/lib/browser/view/notebook-cell-toolbar.js +50 -0
  109. package/lib/browser/view/notebook-cell-toolbar.js.map +1 -0
  110. package/lib/browser/view/notebook-code-cell-view.d.ts +47 -0
  111. package/lib/browser/view/notebook-code-cell-view.d.ts.map +1 -0
  112. package/lib/browser/view/notebook-code-cell-view.js +166 -0
  113. package/lib/browser/view/notebook-code-cell-view.js.map +1 -0
  114. package/lib/browser/view/notebook-main-toolbar.d.ts +31 -0
  115. package/lib/browser/view/notebook-main-toolbar.d.ts.map +1 -0
  116. package/lib/browser/view/notebook-main-toolbar.js +118 -0
  117. package/lib/browser/view/notebook-main-toolbar.js.map +1 -0
  118. package/lib/browser/view/notebook-markdown-cell-view.d.ts +12 -0
  119. package/lib/browser/view/notebook-markdown-cell-view.d.ts.map +1 -0
  120. package/lib/browser/view/notebook-markdown-cell-view.js +70 -0
  121. package/lib/browser/view/notebook-markdown-cell-view.js.map +1 -0
  122. package/lib/browser/view-model/notebook-cell-model.d.ts +74 -0
  123. package/lib/browser/view-model/notebook-cell-model.d.ts.map +1 -0
  124. package/lib/browser/view-model/notebook-cell-model.js +226 -0
  125. package/lib/browser/view-model/notebook-cell-model.js.map +1 -0
  126. package/lib/browser/view-model/notebook-cell-output-model.d.ts +19 -0
  127. package/lib/browser/view-model/notebook-cell-output-model.d.ts.map +1 -0
  128. package/lib/browser/view-model/notebook-cell-output-model.js +61 -0
  129. package/lib/browser/view-model/notebook-cell-output-model.js.map +1 -0
  130. package/lib/browser/view-model/notebook-model.d.ts +59 -0
  131. package/lib/browser/view-model/notebook-model.d.ts.map +1 -0
  132. package/lib/browser/view-model/notebook-model.js +315 -0
  133. package/lib/browser/view-model/notebook-model.js.map +1 -0
  134. package/lib/common/index.d.ts +3 -0
  135. package/lib/common/index.d.ts.map +1 -0
  136. package/lib/common/index.js +30 -0
  137. package/lib/common/index.js.map +1 -0
  138. package/lib/common/notebook-common.d.ts +344 -0
  139. package/lib/common/notebook-common.d.ts.map +1 -0
  140. package/lib/common/notebook-common.js +112 -0
  141. package/lib/common/notebook-common.js.map +1 -0
  142. package/lib/common/notebook-protocol.d.ts +21 -0
  143. package/lib/common/notebook-protocol.d.ts.map +1 -0
  144. package/lib/common/notebook-protocol.js +18 -0
  145. package/lib/common/notebook-protocol.js.map +1 -0
  146. package/lib/common/notebook-range.d.ts +14 -0
  147. package/lib/common/notebook-range.d.ts.map +1 -0
  148. package/lib/common/notebook-range.js +18 -0
  149. package/lib/common/notebook-range.js.map +1 -0
  150. package/package.json +52 -0
  151. package/src/browser/contributions/notebook-actions-contribution.ts +171 -0
  152. package/src/browser/contributions/notebook-cell-actions-contribution.ts +204 -0
  153. package/src/browser/contributions/notebook-color-contribution.ts +268 -0
  154. package/src/browser/contributions/notebook-context-keys.ts +99 -0
  155. package/src/browser/index.ts +26 -0
  156. package/src/browser/notebook-cell-resource-resolver.ts +79 -0
  157. package/src/browser/notebook-editor-widget-factory.ts +70 -0
  158. package/src/browser/notebook-editor-widget.tsx +157 -0
  159. package/src/browser/notebook-frontend-module.ts +95 -0
  160. package/src/browser/notebook-open-handler.ts +87 -0
  161. package/src/browser/notebook-renderer-registry.ts +62 -0
  162. package/src/browser/notebook-type-registry.ts +30 -0
  163. package/src/browser/renderers/cell-output-webview.ts +32 -0
  164. package/src/browser/service/notebook-cell-context-manager.ts +70 -0
  165. package/src/browser/service/notebook-editor-service.ts +86 -0
  166. package/src/browser/service/notebook-execution-service.ts +139 -0
  167. package/src/browser/service/notebook-execution-state-service.ts +322 -0
  168. package/src/browser/service/notebook-kernel-history-service.ts +109 -0
  169. package/src/browser/service/notebook-kernel-quick-pick-service.ts +494 -0
  170. package/src/browser/service/notebook-kernel-service.ts +357 -0
  171. package/src/browser/service/notebook-model-resolver-service.ts +141 -0
  172. package/src/browser/service/notebook-renderer-messaging-service.ts +111 -0
  173. package/src/browser/service/notebook-service.ts +178 -0
  174. package/src/browser/style/index.css +236 -0
  175. package/src/browser/view/notebook-cell-editor.tsx +97 -0
  176. package/src/browser/view/notebook-cell-list-view.tsx +171 -0
  177. package/src/browser/view/notebook-cell-toolbar-factory.tsx +91 -0
  178. package/src/browser/view/notebook-cell-toolbar.tsx +70 -0
  179. package/src/browser/view/notebook-code-cell-view.tsx +190 -0
  180. package/src/browser/view/notebook-main-toolbar.tsx +115 -0
  181. package/src/browser/view/notebook-markdown-cell-view.tsx +73 -0
  182. package/src/browser/view-model/notebook-cell-model.ts +271 -0
  183. package/src/browser/view-model/notebook-cell-output-model.ts +69 -0
  184. package/src/browser/view-model/notebook-model.ts +372 -0
  185. package/src/common/index.ts +18 -0
  186. package/src/common/notebook-common.ts +462 -0
  187. package/src/common/notebook-protocol.ts +35 -0
  188. package/src/common/notebook-range.ts +30 -0
@@ -0,0 +1,78 @@
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
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.NotebookEditorWidgetFactory = void 0;
28
+ const core_1 = require("@theia/core");
29
+ const browser_1 = require("@theia/core/lib/browser");
30
+ const inversify_1 = require("@theia/core/shared/inversify");
31
+ const notebook_editor_widget_1 = require("./notebook-editor-widget");
32
+ const notebook_service_1 = require("./service/notebook-service");
33
+ const notebook_model_resolver_service_1 = require("./service/notebook-model-resolver-service");
34
+ let NotebookEditorWidgetFactory = class NotebookEditorWidgetFactory {
35
+ constructor() {
36
+ this.id = notebook_editor_widget_1.NotebookEditorWidget.ID;
37
+ }
38
+ async createWidget(options) {
39
+ if (!options) {
40
+ throw new Error('no options found for widget. Need at least uri and notebookType');
41
+ }
42
+ const uri = new core_1.URI(options.uri);
43
+ await this.notebookService.willOpenNotebook(options.notebookType);
44
+ const editor = await this.createEditor(uri, options.notebookType);
45
+ const icon = this.labelProvider.getIcon(uri);
46
+ editor.title.label = this.labelProvider.getName(uri);
47
+ editor.title.iconClass = icon + ' file-icon';
48
+ return editor;
49
+ }
50
+ async createEditor(uri, notebookType) {
51
+ return this.createNotebookEditorWidget({
52
+ uri,
53
+ notebookType,
54
+ notebookData: this.notebookModelResolver.resolve(uri, notebookType),
55
+ });
56
+ }
57
+ };
58
+ __decorate([
59
+ (0, inversify_1.inject)(notebook_service_1.NotebookService),
60
+ __metadata("design:type", notebook_service_1.NotebookService)
61
+ ], NotebookEditorWidgetFactory.prototype, "notebookService", void 0);
62
+ __decorate([
63
+ (0, inversify_1.inject)(notebook_model_resolver_service_1.NotebookModelResolverService),
64
+ __metadata("design:type", notebook_model_resolver_service_1.NotebookModelResolverService)
65
+ ], NotebookEditorWidgetFactory.prototype, "notebookModelResolver", void 0);
66
+ __decorate([
67
+ (0, inversify_1.inject)(browser_1.LabelProvider),
68
+ __metadata("design:type", browser_1.LabelProvider)
69
+ ], NotebookEditorWidgetFactory.prototype, "labelProvider", void 0);
70
+ __decorate([
71
+ (0, inversify_1.inject)(notebook_editor_widget_1.NotebookEditorContainerFactory),
72
+ __metadata("design:type", Function)
73
+ ], NotebookEditorWidgetFactory.prototype, "createNotebookEditorWidget", void 0);
74
+ NotebookEditorWidgetFactory = __decorate([
75
+ (0, inversify_1.injectable)()
76
+ ], NotebookEditorWidgetFactory);
77
+ exports.NotebookEditorWidgetFactory = NotebookEditorWidgetFactory;
78
+ //# sourceMappingURL=notebook-editor-widget-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-editor-widget-factory.js","sourceRoot":"","sources":["../../src/browser/notebook-editor-widget-factory.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDA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AAA,kBAAM,EAAC,8DAA4B,CAAC;8BACK,8DAA4B;0EAAC;AAGvE;IADC,IAAA,kBAAM,EAAC,uBAAa,CAAC;8BACY,uBAAa;kEAAC;AAGhD;IADC,IAAA,kBAAM,EAAC,uDAA8B,CAAC;;+EAC6D;AAb3F,2BAA2B;IADvC,IAAA,sBAAU,GAAE;GACA,2BAA2B,CAyCvC;AAzCY,kEAA2B"}
@@ -0,0 +1,49 @@
1
+ /// <reference types="react" />
2
+ import { CommandRegistry, MenuModelRegistry, URI } from '@theia/core';
3
+ import { ReactWidget, Navigatable, SaveableSource, Message, SaveableDelegate } from '@theia/core/lib/browser';
4
+ import { ReactNode } from '@theia/core/shared/react';
5
+ import { CellKind } from '../common';
6
+ import { CellRenderer as CellRenderer } from './view/notebook-cell-list-view';
7
+ import { NotebookCodeCellRenderer } from './view/notebook-code-cell-view';
8
+ import { NotebookMarkdownCellRenderer } from './view/notebook-markdown-cell-view';
9
+ import { NotebookModel } from './view-model/notebook-model';
10
+ import { NotebookCellToolbarFactory } from './view/notebook-cell-toolbar-factory';
11
+ import { interfaces } from '@theia/core/shared/inversify';
12
+ import { Emitter } from '@theia/core/shared/vscode-languageserver-protocol';
13
+ import { NotebookEditorWidgetService } from './service/notebook-editor-service';
14
+ import { NotebookMainToolbarRenderer } from './view/notebook-main-toolbar';
15
+ export declare const NotebookEditorContainerFactory: unique symbol;
16
+ export declare function createNotebookEditorWidgetContainer(parent: interfaces.Container, props: NotebookEditorProps): interfaces.Container;
17
+ export interface NotebookEditorProps {
18
+ uri: URI;
19
+ readonly notebookType: string;
20
+ notebookData: Promise<NotebookModel>;
21
+ }
22
+ export declare const NOTEBOOK_EDITOR_ID_PREFIX = "notebook:";
23
+ export declare class NotebookEditorWidget extends ReactWidget implements Navigatable, SaveableSource {
24
+ private readonly props;
25
+ static readonly ID = "notebook";
26
+ readonly saveable: SaveableDelegate;
27
+ protected readonly cellToolbarFactory: NotebookCellToolbarFactory;
28
+ protected commandRegistry: CommandRegistry;
29
+ protected menuRegistry: MenuModelRegistry;
30
+ protected notebookEditorService: NotebookEditorWidgetService;
31
+ protected notebookMainToolbarRenderer: NotebookMainToolbarRenderer;
32
+ protected readonly onDidChangeModelEmitter: Emitter<void>;
33
+ readonly onDidChangeModel: import("vscode-jsonrpc/lib/common/events").Event<void>;
34
+ protected readonly renderers: Map<CellKind, CellRenderer>;
35
+ protected _model?: NotebookModel;
36
+ get notebookType(): string;
37
+ get model(): NotebookModel | undefined;
38
+ constructor(codeCellRenderer: NotebookCodeCellRenderer, markdownCellRenderer: NotebookMarkdownCellRenderer, props: NotebookEditorProps);
39
+ protected waitForData(): Promise<void>;
40
+ protected onActivateRequest(msg: Message): void;
41
+ getResourceUri(): URI | undefined;
42
+ createMoveToUri(resourceUri: URI): URI | undefined;
43
+ undo(): void;
44
+ redo(): void;
45
+ protected render(): ReactNode;
46
+ protected onAfterAttach(msg: Message): void;
47
+ protected onAfterDetach(msg: Message): void;
48
+ }
49
+ //# sourceMappingURL=notebook-editor-widget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-editor-widget.d.ts","sourceRoot":"","sources":["../../src/browser/notebook-editor-widget.tsx"],"names":[],"mappings":";AAiBA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC9G,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,YAAY,IAAI,YAAY,EAAwB,MAAM,gCAAgC,CAAC;AACpG,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM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C;IAEjC,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED,IAAI,KAAK,IAAI,aAAa,GAAG,SAAS,CAErC;gBAGqC,gBAAgB,EAAE,wBAAwB,EACtC,oBAAoB,EAAE,4BAA4B,EAC1C,KAAK,EAAE,mBAAmB;cAe5D,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;cASzB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAKxD,cAAc,IAAI,GAAG,GAAG,SAAS;IAIjC,eAAe,CAAC,WAAW,EAAE,GAAG,GAAG,GAAG,GAAG,SAAS;IAIlD,IAAI,IAAI,IAAI;IAIZ,IAAI,IAAI,IAAI;IAIZ,SAAS,CAAC,MAAM,IAAI,SAAS;cAcV,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;cAIjC,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;CAIvD"}
@@ -0,0 +1,150 @@
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
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
27
+ return function (target, key) { decorator(target, key, paramIndex); }
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.NotebookEditorWidget = exports.NOTEBOOK_EDITOR_ID_PREFIX = exports.createNotebookEditorWidgetContainer = exports.NotebookEditorContainerFactory = void 0;
31
+ const React = require("@theia/core/shared/react");
32
+ const core_1 = require("@theia/core");
33
+ const browser_1 = require("@theia/core/lib/browser");
34
+ const common_1 = require("../common");
35
+ const notebook_cell_list_view_1 = require("./view/notebook-cell-list-view");
36
+ const notebook_code_cell_view_1 = require("./view/notebook-code-cell-view");
37
+ const notebook_markdown_cell_view_1 = require("./view/notebook-markdown-cell-view");
38
+ const notebook_cell_toolbar_factory_1 = require("./view/notebook-cell-toolbar-factory");
39
+ const inversify_1 = require("@theia/core/shared/inversify");
40
+ const vscode_languageserver_protocol_1 = require("@theia/core/shared/vscode-languageserver-protocol");
41
+ const notebook_editor_service_1 = require("./service/notebook-editor-service");
42
+ const notebook_main_toolbar_1 = require("./view/notebook-main-toolbar");
43
+ exports.NotebookEditorContainerFactory = Symbol('NotebookModelFactory');
44
+ function createNotebookEditorWidgetContainer(parent, props) {
45
+ const child = parent.createChild();
46
+ child.bind(NotebookEditorProps).toConstantValue(props);
47
+ child.bind(NotebookEditorWidget).toSelf();
48
+ return child;
49
+ }
50
+ exports.createNotebookEditorWidgetContainer = createNotebookEditorWidgetContainer;
51
+ const NotebookEditorProps = Symbol('NotebookEditorProps');
52
+ exports.NOTEBOOK_EDITOR_ID_PREFIX = 'notebook:';
53
+ let NotebookEditorWidget = class NotebookEditorWidget extends browser_1.ReactWidget {
54
+ constructor(codeCellRenderer, markdownCellRenderer, props) {
55
+ super();
56
+ this.props = props;
57
+ this.saveable = new browser_1.SaveableDelegate();
58
+ this.onDidChangeModelEmitter = new vscode_languageserver_protocol_1.Emitter();
59
+ this.onDidChangeModel = this.onDidChangeModelEmitter.event;
60
+ this.renderers = new Map();
61
+ this.id = exports.NOTEBOOK_EDITOR_ID_PREFIX + this.props.uri.toString();
62
+ this.node.tabIndex = -1;
63
+ this.title.closable = true;
64
+ this.update();
65
+ this.toDispose.push(this.onDidChangeModelEmitter);
66
+ this.renderers.set(common_1.CellKind.Markup, markdownCellRenderer);
67
+ this.renderers.set(common_1.CellKind.Code, codeCellRenderer);
68
+ this.waitForData();
69
+ }
70
+ get notebookType() {
71
+ return this.props.notebookType;
72
+ }
73
+ get model() {
74
+ return this._model;
75
+ }
76
+ async waitForData() {
77
+ this._model = await this.props.notebookData;
78
+ this.saveable.set(this._model);
79
+ this.toDispose.push(this._model);
80
+ // Ensure that the model is loaded before adding the editor
81
+ this.notebookEditorService.addNotebookEditor(this);
82
+ this.update();
83
+ }
84
+ onActivateRequest(msg) {
85
+ super.onActivateRequest(msg);
86
+ this.node.focus();
87
+ }
88
+ getResourceUri() {
89
+ return this.props.uri;
90
+ }
91
+ createMoveToUri(resourceUri) {
92
+ return this.props.uri;
93
+ }
94
+ undo() {
95
+ var _a;
96
+ (_a = this.model) === null || _a === void 0 ? void 0 : _a.undo();
97
+ }
98
+ redo() {
99
+ var _a;
100
+ (_a = this.model) === null || _a === void 0 ? void 0 : _a.redo();
101
+ }
102
+ render() {
103
+ if (this._model) {
104
+ return React.createElement("div", null,
105
+ this.notebookMainToolbarRenderer.render(this._model),
106
+ React.createElement(notebook_cell_list_view_1.NotebookCellListView, { renderers: this.renderers, notebookModel: this._model, toolbarRenderer: this.cellToolbarFactory, commandRegistry: this.commandRegistry }));
107
+ }
108
+ else {
109
+ return React.createElement("div", null);
110
+ }
111
+ }
112
+ onAfterAttach(msg) {
113
+ super.onAfterAttach(msg);
114
+ }
115
+ onAfterDetach(msg) {
116
+ super.onAfterDetach(msg);
117
+ this.notebookEditorService.removeNotebookEditor(this);
118
+ }
119
+ };
120
+ NotebookEditorWidget.ID = 'notebook';
121
+ __decorate([
122
+ (0, inversify_1.inject)(notebook_cell_toolbar_factory_1.NotebookCellToolbarFactory),
123
+ __metadata("design:type", notebook_cell_toolbar_factory_1.NotebookCellToolbarFactory)
124
+ ], NotebookEditorWidget.prototype, "cellToolbarFactory", void 0);
125
+ __decorate([
126
+ (0, inversify_1.inject)(core_1.CommandRegistry),
127
+ __metadata("design:type", core_1.CommandRegistry)
128
+ ], NotebookEditorWidget.prototype, "commandRegistry", void 0);
129
+ __decorate([
130
+ (0, inversify_1.inject)(core_1.MenuModelRegistry),
131
+ __metadata("design:type", core_1.MenuModelRegistry)
132
+ ], NotebookEditorWidget.prototype, "menuRegistry", void 0);
133
+ __decorate([
134
+ (0, inversify_1.inject)(notebook_editor_service_1.NotebookEditorWidgetService),
135
+ __metadata("design:type", notebook_editor_service_1.NotebookEditorWidgetService)
136
+ ], NotebookEditorWidget.prototype, "notebookEditorService", void 0);
137
+ __decorate([
138
+ (0, inversify_1.inject)(notebook_main_toolbar_1.NotebookMainToolbarRenderer),
139
+ __metadata("design:type", notebook_main_toolbar_1.NotebookMainToolbarRenderer)
140
+ ], NotebookEditorWidget.prototype, "notebookMainToolbarRenderer", void 0);
141
+ NotebookEditorWidget = __decorate([
142
+ (0, inversify_1.injectable)(),
143
+ __param(0, (0, inversify_1.inject)(notebook_code_cell_view_1.NotebookCodeCellRenderer)),
144
+ __param(1, (0, inversify_1.inject)(notebook_markdown_cell_view_1.NotebookMarkdownCellRenderer)),
145
+ __param(2, (0, inversify_1.inject)(NotebookEditorProps)),
146
+ __metadata("design:paramtypes", [notebook_code_cell_view_1.NotebookCodeCellRenderer,
147
+ notebook_markdown_cell_view_1.NotebookMarkdownCellRenderer, Object])
148
+ ], NotebookEditorWidget);
149
+ exports.NotebookEditorWidget = NotebookEditorWidget;
150
+ //# sourceMappingURL=notebook-editor-widget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-editor-widget.js","sourceRoot":"","sources":["../../src/browser/notebook-editor-widget.tsx"],"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,kDAAkD;AAClD,sCAAsE;AACtE,qDAA8G;AAE9G,sCAAqC;AACrC,4EAAoG;AACpG,4EAA0E;AAC1E,oFAAkF;AAElF,wFAAkF;AAClF,4DAA8E;AAC9E,sGAA4E;AAC5E,+EAAgF;AAChF,wEAA2E;AAE9D,QAAA,8BAA8B,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAE7E,SAAgB,mCAAmC,CAAC,MAA4B,EAAE,KAA0B;IACxG,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IAEnC,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IACvD,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,MAAM,EAAE,CAAC;IAE1C,OAAO,KAAK,CAAC;AACjB,CAAC;AAPD,kFAOC;AAED,MAAM,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAO7C,QAAA,yBAAyB,GAAG,WAAW,CAAC;AAGrD,IAAa,oBAAoB,GAAjC,MAAa,oBAAqB,SAAQ,qBAAW;IAkCjD,YACsC,gBAA0C,EACtC,oBAAkD,EAC1C,KAA0B;QACxE,KAAK,EAAE,CAAC;QADsC,UAAK,GAAL,KAAK,CAAqB;QAlCnE,aAAQ,GAAG,IAAI,0BAAgB,EAAE,CAAC;QAiBxB,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3C;IADC,IAAA,kBAAM,EAAC,wBAAiB,CAAC;8BACF,wBAAiB;0DAAC;AAG1C;IADC,IAAA,kBAAM,EAAC,qDAA2B,CAAC;8BACH,qDAA2B;mEAAC;AAG7D;IADC,IAAA,kBAAM,EAAC,mDAA2B,CAAC;8BACG,mDAA2B;yEAAC;AAlB1D,oBAAoB;IADhC,IAAA,sBAAU,GAAE;IAoCJ,WAAA,IAAA,kBAAM,EAAC,kDAAwB,CAAC,CAAA;IAChC,WAAA,IAAA,kBAAM,EAAC,0DAA4B,CAAC,CAAA;IACpC,WAAA,IAAA,kBAAM,EAAC,mBAAmB,CAAC,CAAA;qCAFwB,kDAAwB;QAChB,0DAA4B;GApCnF,oBAAoB,CAwGhC;AAxGY,oDAAoB"}
@@ -0,0 +1,5 @@
1
+ import '../../src/browser/style/index.css';
2
+ import { ContainerModule } from '@theia/core/shared/inversify';
3
+ declare const _default: ContainerModule;
4
+ export default _default;
5
+ //# sourceMappingURL=notebook-frontend-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/notebook-frontend-module.ts"],"names":[],"mappings":"AAeA,OAAO,mCAAmC,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AA8B/D,wBA+CG"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // *****************************************************************************
4
+ // Copyright (C) 2023 TypeFox and others.
5
+ //
6
+ // This program and the accompanying materials are made available under the
7
+ // terms of the Eclipse Public License v. 2.0 which is available at
8
+ // http://www.eclipse.org/legal/epl-2.0.
9
+ //
10
+ // This Source Code may also be made available under the following Secondary
11
+ // Licenses when the conditions for such availability set forth in the Eclipse
12
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
13
+ // with the GNU Classpath Exception which is available at
14
+ // https://www.gnu.org/software/classpath/license.html.
15
+ //
16
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
17
+ // *****************************************************************************
18
+ require("../../src/browser/style/index.css");
19
+ const inversify_1 = require("@theia/core/shared/inversify");
20
+ const browser_1 = require("@theia/core/lib/browser");
21
+ const color_application_contribution_1 = require("@theia/core/lib/browser/color-application-contribution");
22
+ const notebook_open_handler_1 = require("./notebook-open-handler");
23
+ const core_1 = require("@theia/core");
24
+ const notebook_type_registry_1 = require("./notebook-type-registry");
25
+ const notebook_renderer_registry_1 = require("./notebook-renderer-registry");
26
+ const notebook_service_1 = require("./service/notebook-service");
27
+ const notebook_editor_widget_factory_1 = require("./notebook-editor-widget-factory");
28
+ const notebook_cell_resource_resolver_1 = require("./notebook-cell-resource-resolver");
29
+ const notebook_model_resolver_service_1 = require("./service/notebook-model-resolver-service");
30
+ const notebook_cell_actions_contribution_1 = require("./contributions/notebook-cell-actions-contribution");
31
+ const notebook_cell_toolbar_factory_1 = require("./view/notebook-cell-toolbar-factory");
32
+ const notebook_model_1 = require("./view-model/notebook-model");
33
+ const notebook_cell_model_1 = require("./view-model/notebook-cell-model");
34
+ const notebook_editor_widget_1 = require("./notebook-editor-widget");
35
+ const notebook_code_cell_view_1 = require("./view/notebook-code-cell-view");
36
+ const notebook_markdown_cell_view_1 = require("./view/notebook-markdown-cell-view");
37
+ const notebook_actions_contribution_1 = require("./contributions/notebook-actions-contribution");
38
+ const notebook_execution_service_1 = require("./service/notebook-execution-service");
39
+ const notebook_execution_state_service_1 = require("./service/notebook-execution-state-service");
40
+ const notebook_kernel_service_1 = require("./service/notebook-kernel-service");
41
+ const notebook_kernel_quick_pick_service_1 = require("./service/notebook-kernel-quick-pick-service");
42
+ const notebook_kernel_history_service_1 = require("./service/notebook-kernel-history-service");
43
+ const notebook_editor_service_1 = require("./service/notebook-editor-service");
44
+ const notebook_renderer_messaging_service_1 = require("./service/notebook-renderer-messaging-service");
45
+ const notebook_color_contribution_1 = require("./contributions/notebook-color-contribution");
46
+ const notebook_cell_context_manager_1 = require("./service/notebook-cell-context-manager");
47
+ const notebook_main_toolbar_1 = require("./view/notebook-main-toolbar");
48
+ exports.default = new inversify_1.ContainerModule(bind => {
49
+ bind(notebook_color_contribution_1.NotebookColorContribution).toSelf().inSingletonScope();
50
+ bind(color_application_contribution_1.ColorContribution).toService(notebook_color_contribution_1.NotebookColorContribution);
51
+ bind(notebook_open_handler_1.NotebookOpenHandler).toSelf().inSingletonScope();
52
+ bind(browser_1.OpenHandler).toService(notebook_open_handler_1.NotebookOpenHandler);
53
+ bind(notebook_type_registry_1.NotebookTypeRegistry).toSelf().inSingletonScope();
54
+ bind(notebook_renderer_registry_1.NotebookRendererRegistry).toSelf().inSingletonScope();
55
+ bind(browser_1.WidgetFactory).to(notebook_editor_widget_factory_1.NotebookEditorWidgetFactory).inSingletonScope();
56
+ bind(notebook_cell_toolbar_factory_1.NotebookCellToolbarFactory).toSelf().inSingletonScope();
57
+ bind(notebook_service_1.NotebookService).toSelf().inSingletonScope();
58
+ bind(notebook_editor_service_1.NotebookEditorWidgetService).toSelf().inSingletonScope();
59
+ bind(notebook_execution_service_1.NotebookExecutionService).toSelf().inSingletonScope();
60
+ bind(notebook_execution_state_service_1.NotebookExecutionStateService).toSelf().inSingletonScope();
61
+ bind(notebook_kernel_service_1.NotebookKernelService).toSelf().inSingletonScope();
62
+ bind(notebook_renderer_messaging_service_1.NotebookRendererMessagingService).toSelf().inSingletonScope();
63
+ bind(notebook_kernel_history_service_1.NotebookKernelHistoryService).toSelf().inSingletonScope();
64
+ bind(notebook_kernel_quick_pick_service_1.NotebookKernelQuickPickService).to(notebook_kernel_quick_pick_service_1.KernelPickerMRUStrategy).inSingletonScope();
65
+ bind(notebook_cell_resource_resolver_1.NotebookCellResourceResolver).toSelf().inSingletonScope();
66
+ bind(core_1.ResourceResolver).toService(notebook_cell_resource_resolver_1.NotebookCellResourceResolver);
67
+ bind(notebook_model_resolver_service_1.NotebookModelResolverService).toSelf().inSingletonScope();
68
+ bind(notebook_cell_actions_contribution_1.NotebookCellActionContribution).toSelf().inSingletonScope();
69
+ bind(core_1.MenuContribution).toService(notebook_cell_actions_contribution_1.NotebookCellActionContribution);
70
+ bind(core_1.CommandContribution).toService(notebook_cell_actions_contribution_1.NotebookCellActionContribution);
71
+ bind(notebook_actions_contribution_1.NotebookActionsContribution).toSelf().inSingletonScope();
72
+ bind(core_1.CommandContribution).toService(notebook_actions_contribution_1.NotebookActionsContribution);
73
+ bind(core_1.MenuContribution).toService(notebook_actions_contribution_1.NotebookActionsContribution);
74
+ bind(notebook_code_cell_view_1.NotebookCodeCellRenderer).toSelf().inSingletonScope();
75
+ bind(notebook_markdown_cell_view_1.NotebookMarkdownCellRenderer).toSelf().inSingletonScope();
76
+ bind(notebook_main_toolbar_1.NotebookMainToolbarRenderer).toSelf().inSingletonScope();
77
+ bind(notebook_editor_widget_1.NotebookEditorContainerFactory).toFactory(ctx => (props) => (0, notebook_editor_widget_1.createNotebookEditorWidgetContainer)(ctx.container, props).get(notebook_editor_widget_1.NotebookEditorWidget));
78
+ bind(notebook_model_1.NotebookModelFactory).toFactory(ctx => (props) => (0, notebook_model_1.createNotebookModelContainer)(ctx.container, props).get(notebook_model_1.NotebookModel));
79
+ bind(notebook_cell_model_1.NotebookCellModelFactory).toFactory(ctx => (props) => (0, notebook_cell_model_1.createNotebookCellModelContainer)(ctx.container, props, notebook_cell_context_manager_1.NotebookCellContextManager).get(notebook_cell_model_1.NotebookCellModel));
80
+ });
81
+ //# sourceMappingURL=notebook-frontend-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-frontend-module.js","sourceRoot":"","sources":["../../src/browser/notebook-frontend-module.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,g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C,kDAAwB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC3D,IAAI,CAAC,0DAA4B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC/D,IAAI,CAAC,mDAA2B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAE9D,IAAI,CAAC,uDAA8B,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,KAA0B,EAAE,EAAE,CACjF,IAAA,4DAAmC,EAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,6CAAoB,CAAC,CACtF,CAAC;IACF,IAAI,CAAC,qCAAoB,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,KAAyB,EAAE,EAAE,CACtE,IAAA,6CAA4B,EAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,8BAAa,CAAC,CACxE,CAAC;IACF,IAAI,CAAC,8CAAwB,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,KAA6B,EAAE,EAAE,CAC9E,IAAA,sDAAgC,EAAC,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,0DAA0B,CAAC,CAAC,GAAG,CAAC,uCAAiB,CAAC,CAC5G,CAAC;AACN,CAAC,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { URI, MaybePromise } from '@theia/core';
2
+ import { NavigatableWidgetOpenHandler, WidgetOpenerOptions } from '@theia/core/lib/browser';
3
+ import { NotebookFileSelector, NotebookTypeDescriptor } from '../common/notebook-protocol';
4
+ import { NotebookTypeRegistry } from './notebook-type-registry';
5
+ import { NotebookEditorWidget } from './notebook-editor-widget';
6
+ import { NotebookEditorWidgetOptions } from './notebook-editor-widget-factory';
7
+ export declare class NotebookOpenHandler extends NavigatableWidgetOpenHandler<NotebookEditorWidget> {
8
+ private notebookTypeRegistry;
9
+ id: string;
10
+ constructor(notebookTypeRegistry: NotebookTypeRegistry);
11
+ canHandle(uri: URI, options?: WidgetOpenerOptions | undefined): MaybePromise<number>;
12
+ protected findHighestPriorityType(uri: URI): NotebookTypeDescriptor | undefined;
13
+ protected calculatePriority(notebookType: NotebookTypeDescriptor | undefined): number;
14
+ protected createWidgetOptions(uri: URI, options?: WidgetOpenerOptions | undefined): NotebookEditorWidgetOptions;
15
+ matches(selectors: readonly NotebookFileSelector[], resource: URI): boolean;
16
+ selectorMatches(selector: NotebookFileSelector, resource: URI): boolean;
17
+ }
18
+ //# sourceMappingURL=notebook-open-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-open-handler.d.ts","sourceRoot":"","sources":["../../src/browser/notebook-open-handler.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE5F,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAE/E,qBACa,mBAAoB,SAAQ,4BAA4B,CAAC,oBAAoB,CAAC;IAI7C,OAAO,CAAC,oBAAoB;IAFtE,EAAE,EAAE,MAAM,CAAc;gBAE0B,oBAAoB,EAAE,oBAAoB;IAI5F,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,SAAS,GAAG,YAAY,CAAC,MAAM,CAAC;IAOpF,SAAS,CAAC,uBAAuB,CAAC,GAAG,EAAE,GAAG,GAAG,sBAAsB,GAAG,SAAS;IAkB/E,SAAS,CAAC,iBAAiB,CAAC,YAAY,EAAE,sBAAsB,GAAG,SAAS,GAAG,MAAM;cAOlE,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,SAAS,GAAG,2BAA2B;IAYxH,OAAO,CAAC,SAAS,EAAE,SAAS,oBAAoB,EAAE,EAAE,QAAQ,EAAE,GAAG,GAAG,OAAO;IAI3E,eAAe,CAAC,QAAQ,EAAE,oBAAoB,EAAE,QAAQ,EAAE,GAAG,GAAG,OAAO;CAI1E"}
@@ -0,0 +1,94 @@
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
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
27
+ return function (target, key) { decorator(target, key, paramIndex); }
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.NotebookOpenHandler = void 0;
31
+ const browser_1 = require("@theia/core/lib/browser");
32
+ const inversify_1 = require("@theia/core/shared/inversify");
33
+ const notebook_type_registry_1 = require("./notebook-type-registry");
34
+ const glob_1 = require("@theia/core/lib/common/glob");
35
+ let NotebookOpenHandler = class NotebookOpenHandler extends browser_1.NavigatableWidgetOpenHandler {
36
+ constructor(notebookTypeRegistry) {
37
+ super();
38
+ this.notebookTypeRegistry = notebookTypeRegistry;
39
+ this.id = 'notebook';
40
+ }
41
+ canHandle(uri, options) {
42
+ const priorities = this.notebookTypeRegistry.notebookTypes
43
+ .filter(notebook => notebook.selector && this.matches(notebook.selector, uri))
44
+ .map(notebook => this.calculatePriority(notebook));
45
+ return Math.max(...priorities);
46
+ }
47
+ findHighestPriorityType(uri) {
48
+ const matchingTypes = this.notebookTypeRegistry.notebookTypes
49
+ .filter(notebookType => notebookType.selector && this.matches(notebookType.selector, uri))
50
+ .map(notebookType => ({ descriptor: notebookType, priority: this.calculatePriority(notebookType) }));
51
+ if (matchingTypes.length === 0) {
52
+ return undefined;
53
+ }
54
+ let type = matchingTypes[0];
55
+ for (let i = 1; i < matchingTypes.length; i++) {
56
+ const notebookType = matchingTypes[i];
57
+ if (notebookType.priority > type.priority) {
58
+ type = notebookType;
59
+ }
60
+ }
61
+ return type.descriptor;
62
+ }
63
+ calculatePriority(notebookType) {
64
+ if (!notebookType) {
65
+ return -1;
66
+ }
67
+ return notebookType.priority === 'option' ? 100 : 200;
68
+ }
69
+ createWidgetOptions(uri, options) {
70
+ const widgetOptions = super.createWidgetOptions(uri, options);
71
+ const notebookType = this.findHighestPriorityType(uri);
72
+ if (!notebookType) {
73
+ throw new Error('No notebook types registered for uri: ' + uri.toString());
74
+ }
75
+ return {
76
+ notebookType: notebookType.type,
77
+ ...widgetOptions
78
+ };
79
+ }
80
+ matches(selectors, resource) {
81
+ return selectors.some(selector => this.selectorMatches(selector, resource));
82
+ }
83
+ selectorMatches(selector, resource) {
84
+ return !!selector.filenamePattern
85
+ && (0, glob_1.match)(selector.filenamePattern, resource.path.name + resource.path.ext);
86
+ }
87
+ };
88
+ NotebookOpenHandler = __decorate([
89
+ (0, inversify_1.injectable)(),
90
+ __param(0, (0, inversify_1.inject)(notebook_type_registry_1.NotebookTypeRegistry)),
91
+ __metadata("design:paramtypes", [notebook_type_registry_1.NotebookTypeRegistry])
92
+ ], NotebookOpenHandler);
93
+ exports.NotebookOpenHandler = NotebookOpenHandler;
94
+ //# sourceMappingURL=notebook-open-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-open-handler.js","sourceRoot":"","sources":["../../src/browser/notebook-open-handler.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;;;;;;;;;;;;;;;AAGhF,qDAA4F;AAC5F,4DAAkE;AAElE,qEAAgE;AAEhE,sDAAoD;AAIpD,IAAa,mBAAmB,GAAhC,MAAa,mBAAoB,SAAQ,sCAAkD;IAIvF,YAAkD,oBAA0C;QACxF,KAAK,EAAE,CAAC;QADsC,yBAAoB,GAApB,oBAAoB,CAAsB;QAF5F,OAAE,GAAW,UAAU,CAAC;IAIxB,CAAC;IAED,SAAS,CAAC,GAAQ,EAAE,OAAyC;QACzD,MAAM,UAAU,GAAG,IAAI,CAAC,oBAAoB,CAAC,aAAa;aACrD,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;aAC7E,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,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AG,EAAE,OAAO,CAAC,CAAC;QAC9D,MAAM,YAAY,GAAG,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,CAAC;QACvD,IAAI,CAAC,YAAY,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,wCAAwC,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;SAC9E;QACD,OAAO;YACH,YAAY,EAAE,YAAY,CAAC,IAAI;YAC/B,GAAG,aAAa;SACnB,CAAC;IACN,CAAC;IAED,OAAO,CAAC,SAA0C,EAAE,QAAa;QAC7D,OAAO,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IAChF,CAAC;IAED,eAAe,CAAC,QAA8B,EAAE,QAAa;QACzD,OAAO,CAAC,CAAC,QAAQ,CAAC,eAAe;eAC1B,IAAA,YAAK,EAAC,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnF,CAAC;CACJ,CAAA;AA5DY,mBAAmB;IAD/B,IAAA,sBAAU,GAAE;IAKI,WAAA,IAAA,kBAAM,EAAC,6CAAoB,CAAC,CAAA;qCAA+B,6CAAoB;GAJnF,mBAAmB,CA4D/B;AA5DY,kDAAmB"}
@@ -0,0 +1,17 @@
1
+ import { Disposable } from '@theia/core';
2
+ import { NotebookRendererDescriptor } from '../common/notebook-protocol';
3
+ export interface NotebookRendererInfo {
4
+ readonly id: string;
5
+ readonly displayName: string;
6
+ readonly mimeTypes: string[];
7
+ readonly entrypoint: {
8
+ readonly extends?: string;
9
+ readonly uri: string;
10
+ };
11
+ readonly requiresMessaging: boolean;
12
+ }
13
+ export declare class NotebookRendererRegistry {
14
+ readonly notebookRenderers: NotebookRendererInfo[];
15
+ registerNotebookRenderer(type: NotebookRendererDescriptor, basePath: string): Disposable;
16
+ }
17
+ //# sourceMappingURL=notebook-renderer-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-renderer-registry.d.ts","sourceRoot":"","sources":["../../src/browser/notebook-renderer-registry.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,UAAU,EAAQ,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAEzE,MAAM,WAAW,oBAAoB;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE;QAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACzE,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;CACvC;AAED,qBACa,wBAAwB;IAEjC,QAAQ,CAAC,iBAAiB,EAAE,oBAAoB,EAAE,CAAM;IAExD,wBAAwB,CAAC,IAAI,EAAE,0BAA0B,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU;CAuB3F"}
@@ -0,0 +1,63 @@
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
+ /*---------------------------------------------------------------------------------------------
18
+ * Copyright (c) Microsoft Corporation. All rights reserved.
19
+ * Licensed under the MIT License. See License.txt in the project root for license information.
20
+ *--------------------------------------------------------------------------------------------*/
21
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
22
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
23
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
24
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
25
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.NotebookRendererRegistry = void 0;
29
+ const core_1 = require("@theia/core");
30
+ const inversify_1 = require("@theia/core/shared/inversify");
31
+ let NotebookRendererRegistry = class NotebookRendererRegistry {
32
+ constructor() {
33
+ this.notebookRenderers = [];
34
+ }
35
+ registerNotebookRenderer(type, basePath) {
36
+ let entrypoint;
37
+ if (typeof type.entrypoint === 'string') {
38
+ entrypoint = {
39
+ uri: new core_1.Path(basePath).join(type.entrypoint).toString()
40
+ };
41
+ }
42
+ else {
43
+ entrypoint = {
44
+ uri: new core_1.Path(basePath).join(type.entrypoint.path).toString(),
45
+ extends: type.entrypoint.extends
46
+ };
47
+ }
48
+ this.notebookRenderers.push({
49
+ ...type,
50
+ mimeTypes: type.mimeTypes || [],
51
+ requiresMessaging: type.requiresMessaging === 'always' || type.requiresMessaging === 'optional',
52
+ entrypoint
53
+ });
54
+ return core_1.Disposable.create(() => {
55
+ this.notebookRenderers.splice(this.notebookRenderers.findIndex(renderer => renderer.id === type.id), 1);
56
+ });
57
+ }
58
+ };
59
+ NotebookRendererRegistry = __decorate([
60
+ (0, inversify_1.injectable)()
61
+ ], NotebookRendererRegistry);
62
+ exports.NotebookRendererRegistry = NotebookRendererRegistry;
63
+ //# sourceMappingURL=notebook-renderer-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-renderer-registry.js","sourceRoot":"","sources":["../../src/browser/notebook-renderer-registry.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;AAChF;;;gGAGgG;;;;;;;;;AAEhG,sCAA+C;AAC/C,4DAA0D;AAY1D,IAAa,wBAAwB,GAArC,MAAa,wBAAwB;IAArC;QAEa,sBAAiB,GAA2B,EAAE,CAAC;IAyB5D,CAAC;IAvBG,wBAAwB,CAAC,IAAgC,EAAE,QAAgB;QACvE,IAAI,UAAU,CAAC;QACf,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,QAAQ,EAAE;YACrC,UAAU,GAAG;gBACT,GAAG,EAAE,IAAI,WAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE;aAC3D,CAAC;SACL;aAAM;YACH,UAAU,GAAG;gBACT,GAAG,EAAE,IAAI,WAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;gBAC7D,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO;aACnC,CAAC;SACL;QAED,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC;YACxB,GAAG,IAAI;YACP,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,EAAE;YAC/B,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,KAAK,QAAQ,IAAI,IAAI,CAAC,iBAAiB,KAAK,UAAU;YAC/F,UAAU;SACb,CAAC,CAAC;QACH,OAAO,iBAAU,CAAC,MAAM,CAAC,GAAG,EAAE;YAC1B,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5G,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AA3BY,wBAAwB;IADpC,IAAA,sBAAU,GAAE;GACA,wBAAwB,CA2BpC;AA3BY,4DAAwB"}
@@ -0,0 +1,7 @@
1
+ import { Disposable } from '@theia/core';
2
+ import { NotebookTypeDescriptor } from '../common/notebook-protocol';
3
+ export declare class NotebookTypeRegistry {
4
+ readonly notebookTypes: NotebookTypeDescriptor[];
5
+ registerNotebookType(type: NotebookTypeDescriptor): Disposable;
6
+ }
7
+ //# sourceMappingURL=notebook-type-registry.d.ts.map