@theia/notebook 1.67.0-next.56 → 1.67.0-next.59

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 (229) 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 +45 -0
  4. package/lib/browser/contributions/cell-operations.js.map +1 -0
  5. package/lib/browser/contributions/notebook-actions-contribution.d.ts +48 -0
  6. package/lib/browser/contributions/notebook-actions-contribution.d.ts.map +1 -0
  7. package/lib/browser/contributions/notebook-actions-contribution.js +344 -0
  8. package/lib/browser/contributions/notebook-actions-contribution.js.map +1 -0
  9. package/lib/browser/contributions/notebook-cell-actions-contribution.d.ts +66 -0
  10. package/lib/browser/contributions/notebook-cell-actions-contribution.d.ts.map +1 -0
  11. package/lib/browser/contributions/notebook-cell-actions-contribution.js +526 -0
  12. package/lib/browser/contributions/notebook-cell-actions-contribution.js.map +1 -0
  13. package/lib/browser/contributions/notebook-color-contribution.d.ts +6 -0
  14. package/lib/browser/contributions/notebook-color-contribution.d.ts.map +1 -0
  15. package/lib/browser/contributions/notebook-color-contribution.js +247 -0
  16. package/lib/browser/contributions/notebook-color-contribution.js.map +1 -0
  17. package/lib/browser/contributions/notebook-context-keys.d.ts +44 -0
  18. package/lib/browser/contributions/notebook-context-keys.d.ts.map +1 -0
  19. package/lib/browser/contributions/notebook-context-keys.js +108 -0
  20. package/lib/browser/contributions/notebook-context-keys.js.map +1 -0
  21. package/lib/browser/contributions/notebook-label-provider-contribution.d.ts +19 -0
  22. package/lib/browser/contributions/notebook-label-provider-contribution.d.ts.map +1 -0
  23. package/lib/browser/contributions/notebook-label-provider-contribution.js +86 -0
  24. package/lib/browser/contributions/notebook-label-provider-contribution.js.map +1 -0
  25. package/lib/browser/contributions/notebook-outline-contribution.d.ts +29 -0
  26. package/lib/browser/contributions/notebook-outline-contribution.d.ts.map +1 -0
  27. package/lib/browser/contributions/notebook-outline-contribution.js +115 -0
  28. package/lib/browser/contributions/notebook-outline-contribution.js.map +1 -0
  29. package/lib/browser/contributions/notebook-output-action-contribution.d.ts +16 -0
  30. package/lib/browser/contributions/notebook-output-action-contribution.d.ts.map +1 -0
  31. package/lib/browser/contributions/notebook-output-action-contribution.js +83 -0
  32. package/lib/browser/contributions/notebook-output-action-contribution.js.map +1 -0
  33. package/lib/browser/contributions/notebook-status-bar-contribution.d.ts +12 -0
  34. package/lib/browser/contributions/notebook-status-bar-contribution.d.ts.map +1 -0
  35. package/lib/browser/contributions/notebook-status-bar-contribution.js +61 -0
  36. package/lib/browser/contributions/notebook-status-bar-contribution.js.map +1 -0
  37. package/lib/browser/contributions/notebook-undo-redo-handler.d.ts +10 -0
  38. package/lib/browser/contributions/notebook-undo-redo-handler.d.ts.map +1 -0
  39. package/lib/browser/contributions/notebook-undo-redo-handler.js +49 -0
  40. package/lib/browser/contributions/notebook-undo-redo-handler.js.map +1 -0
  41. package/lib/browser/index.d.ts +14 -0
  42. package/lib/browser/index.d.ts.map +1 -0
  43. package/lib/browser/index.js +32 -0
  44. package/lib/browser/index.js.map +1 -0
  45. package/lib/browser/notebook-cell-open-handler.d.ts +10 -0
  46. package/lib/browser/notebook-cell-open-handler.d.ts.map +1 -0
  47. package/lib/browser/notebook-cell-open-handler.js +52 -0
  48. package/lib/browser/notebook-cell-open-handler.js.map +1 -0
  49. package/lib/browser/notebook-cell-resource-resolver.d.ts +26 -0
  50. package/lib/browser/notebook-cell-resource-resolver.d.ts.map +1 -0
  51. package/lib/browser/notebook-cell-resource-resolver.js +109 -0
  52. package/lib/browser/notebook-cell-resource-resolver.js.map +1 -0
  53. package/lib/browser/notebook-editor-split-contribution.d.ts +14 -0
  54. package/lib/browser/notebook-editor-split-contribution.d.ts.map +1 -0
  55. package/lib/browser/notebook-editor-split-contribution.js +51 -0
  56. package/lib/browser/notebook-editor-split-contribution.js.map +1 -0
  57. package/lib/browser/notebook-editor-widget-factory.d.ts +20 -0
  58. package/lib/browser/notebook-editor-widget-factory.d.ts.map +1 -0
  59. package/lib/browser/notebook-editor-widget-factory.js +101 -0
  60. package/lib/browser/notebook-editor-widget-factory.js.map +1 -0
  61. package/lib/browser/notebook-editor-widget.d.ts +102 -0
  62. package/lib/browser/notebook-editor-widget.d.ts.map +1 -0
  63. package/lib/browser/notebook-editor-widget.js +336 -0
  64. package/lib/browser/notebook-editor-widget.js.map +1 -0
  65. package/lib/browser/notebook-frontend-module.d.ts +5 -0
  66. package/lib/browser/notebook-frontend-module.d.ts.map +1 -0
  67. package/lib/browser/notebook-frontend-module.js +116 -0
  68. package/lib/browser/notebook-frontend-module.js.map +1 -0
  69. package/lib/browser/notebook-open-handler.d.ts +29 -0
  70. package/lib/browser/notebook-open-handler.d.ts.map +1 -0
  71. package/lib/browser/notebook-open-handler.js +119 -0
  72. package/lib/browser/notebook-open-handler.js.map +1 -0
  73. package/lib/browser/notebook-output-utils.d.ts +13 -0
  74. package/lib/browser/notebook-output-utils.d.ts.map +1 -0
  75. package/lib/browser/notebook-output-utils.js +112 -0
  76. package/lib/browser/notebook-output-utils.js.map +1 -0
  77. package/lib/browser/notebook-renderer-registry.d.ts +25 -0
  78. package/lib/browser/notebook-renderer-registry.d.ts.map +1 -0
  79. package/lib/browser/notebook-renderer-registry.js +72 -0
  80. package/lib/browser/notebook-renderer-registry.js.map +1 -0
  81. package/lib/browser/notebook-type-registry.d.ts +12 -0
  82. package/lib/browser/notebook-type-registry.d.ts.map +1 -0
  83. package/lib/browser/notebook-type-registry.js +60 -0
  84. package/lib/browser/notebook-type-registry.js.map +1 -0
  85. package/lib/browser/notebook-types.d.ts +131 -0
  86. package/lib/browser/notebook-types.d.ts.map +1 -0
  87. package/lib/browser/notebook-types.js +28 -0
  88. package/lib/browser/notebook-types.js.map +1 -0
  89. package/lib/browser/renderers/cell-output-webview.d.ts +26 -0
  90. package/lib/browser/renderers/cell-output-webview.d.ts.map +1 -0
  91. package/lib/browser/renderers/cell-output-webview.js +21 -0
  92. package/lib/browser/renderers/cell-output-webview.js.map +1 -0
  93. package/lib/browser/service/notebook-cell-editor-service.d.ts +23 -0
  94. package/lib/browser/service/notebook-cell-editor-service.d.ts.map +1 -0
  95. package/lib/browser/service/notebook-cell-editor-service.js +89 -0
  96. package/lib/browser/service/notebook-cell-editor-service.js.map +1 -0
  97. package/lib/browser/service/notebook-cell-status-bar-service.d.ts +39 -0
  98. package/lib/browser/service/notebook-cell-status-bar-service.d.ts.map +1 -0
  99. package/lib/browser/service/notebook-cell-status-bar-service.js +69 -0
  100. package/lib/browser/service/notebook-cell-status-bar-service.js.map +1 -0
  101. package/lib/browser/service/notebook-clipboard-service.d.ts +10 -0
  102. package/lib/browser/service/notebook-clipboard-service.d.ts.map +1 -0
  103. package/lib/browser/service/notebook-clipboard-service.js +42 -0
  104. package/lib/browser/service/notebook-clipboard-service.js.map +1 -0
  105. package/lib/browser/service/notebook-context-manager.d.ts +28 -0
  106. package/lib/browser/service/notebook-context-manager.d.ts.map +1 -0
  107. package/lib/browser/service/notebook-context-manager.js +135 -0
  108. package/lib/browser/service/notebook-context-manager.js.map +1 -0
  109. package/lib/browser/service/notebook-editor-widget-service.d.ts +27 -0
  110. package/lib/browser/service/notebook-editor-widget-service.d.ts.map +1 -0
  111. package/lib/browser/service/notebook-editor-widget-service.js +124 -0
  112. package/lib/browser/service/notebook-editor-widget-service.js.map +1 -0
  113. package/lib/browser/service/notebook-execution-service.d.ts +25 -0
  114. package/lib/browser/service/notebook-execution-service.d.ts.map +1 -0
  115. package/lib/browser/service/notebook-execution-service.js +150 -0
  116. package/lib/browser/service/notebook-execution-service.js.map +1 -0
  117. package/lib/browser/service/notebook-execution-state-service.d.ts +78 -0
  118. package/lib/browser/service/notebook-execution-state-service.d.ts.map +1 -0
  119. package/lib/browser/service/notebook-execution-state-service.js +247 -0
  120. package/lib/browser/service/notebook-execution-state-service.js.map +1 -0
  121. package/lib/browser/service/notebook-kernel-history-service.d.ts +28 -0
  122. package/lib/browser/service/notebook-kernel-history-service.d.ts.map +1 -0
  123. package/lib/browser/service/notebook-kernel-history-service.js +116 -0
  124. package/lib/browser/service/notebook-kernel-history-service.js.map +1 -0
  125. package/lib/browser/service/notebook-kernel-quick-pick-service.d.ts +61 -0
  126. package/lib/browser/service/notebook-kernel-quick-pick-service.d.ts.map +1 -0
  127. package/lib/browser/service/notebook-kernel-quick-pick-service.js +425 -0
  128. package/lib/browser/service/notebook-kernel-quick-pick-service.js.map +1 -0
  129. package/lib/browser/service/notebook-kernel-service.d.ts +125 -0
  130. package/lib/browser/service/notebook-kernel-service.d.ts.map +1 -0
  131. package/lib/browser/service/notebook-kernel-service.js +268 -0
  132. package/lib/browser/service/notebook-kernel-service.js.map +1 -0
  133. package/lib/browser/service/notebook-model-resolver-service.d.ts +28 -0
  134. package/lib/browser/service/notebook-model-resolver-service.d.ts.map +1 -0
  135. package/lib/browser/service/notebook-model-resolver-service.js +157 -0
  136. package/lib/browser/service/notebook-model-resolver-service.js.map +1 -0
  137. package/lib/browser/service/notebook-monaco-text-model-service.d.ts +21 -0
  138. package/lib/browser/service/notebook-monaco-text-model-service.d.ts.map +1 -0
  139. package/lib/browser/service/notebook-monaco-text-model-service.js +73 -0
  140. package/lib/browser/service/notebook-monaco-text-model-service.js.map +1 -0
  141. package/lib/browser/service/notebook-options.d.ts +30 -0
  142. package/lib/browser/service/notebook-options.d.ts.map +1 -0
  143. package/lib/browser/service/notebook-options.js +130 -0
  144. package/lib/browser/service/notebook-options.js.map +1 -0
  145. package/lib/browser/service/notebook-renderer-messaging-service.d.ts +35 -0
  146. package/lib/browser/service/notebook-renderer-messaging-service.d.ts.map +1 -0
  147. package/lib/browser/service/notebook-renderer-messaging-service.js +100 -0
  148. package/lib/browser/service/notebook-renderer-messaging-service.js.map +1 -0
  149. package/lib/browser/service/notebook-service.d.ts +68 -0
  150. package/lib/browser/service/notebook-service.d.ts.map +1 -0
  151. package/lib/browser/service/notebook-service.js +184 -0
  152. package/lib/browser/service/notebook-service.js.map +1 -0
  153. package/lib/browser/view/notebook-cell-editor.d.ts +46 -0
  154. package/lib/browser/view/notebook-cell-editor.d.ts.map +1 -0
  155. package/lib/browser/view/notebook-cell-editor.js +271 -0
  156. package/lib/browser/view/notebook-cell-editor.js.map +1 -0
  157. package/lib/browser/view/notebook-cell-list-view.d.ts +58 -0
  158. package/lib/browser/view/notebook-cell-list-view.d.ts.map +1 -0
  159. package/lib/browser/view/notebook-cell-list-view.js +225 -0
  160. package/lib/browser/view/notebook-cell-list-view.js.map +1 -0
  161. package/lib/browser/view/notebook-cell-toolbar-factory.d.ts +33 -0
  162. package/lib/browser/view/notebook-cell-toolbar-factory.d.ts.map +1 -0
  163. package/lib/browser/view/notebook-cell-toolbar-factory.js +110 -0
  164. package/lib/browser/view/notebook-cell-toolbar-factory.js.map +1 -0
  165. package/lib/browser/view/notebook-cell-toolbar.d.ts +25 -0
  166. package/lib/browser/view/notebook-cell-toolbar.d.ts.map +1 -0
  167. package/lib/browser/view/notebook-cell-toolbar.js +51 -0
  168. package/lib/browser/view/notebook-cell-toolbar.js.map +1 -0
  169. package/lib/browser/view/notebook-code-cell-view.d.ts +93 -0
  170. package/lib/browser/view/notebook-code-cell-view.d.ts.map +1 -0
  171. package/lib/browser/view/notebook-code-cell-view.js +338 -0
  172. package/lib/browser/view/notebook-code-cell-view.js.map +1 -0
  173. package/lib/browser/view/notebook-find-widget.d.ts +63 -0
  174. package/lib/browser/view/notebook-find-widget.d.ts.map +1 -0
  175. package/lib/browser/view/notebook-find-widget.js +225 -0
  176. package/lib/browser/view/notebook-find-widget.js.map +1 -0
  177. package/lib/browser/view/notebook-main-toolbar.d.ts +53 -0
  178. package/lib/browser/view/notebook-main-toolbar.d.ts.map +1 -0
  179. package/lib/browser/view/notebook-main-toolbar.js +184 -0
  180. package/lib/browser/view/notebook-main-toolbar.js.map +1 -0
  181. package/lib/browser/view/notebook-markdown-cell-view.d.ts +28 -0
  182. package/lib/browser/view/notebook-markdown-cell-view.d.ts.map +1 -0
  183. package/lib/browser/view/notebook-markdown-cell-view.js +216 -0
  184. package/lib/browser/view/notebook-markdown-cell-view.js.map +1 -0
  185. package/lib/browser/view/notebook-viewport-service.d.ts +17 -0
  186. package/lib/browser/view/notebook-viewport-service.d.ts.map +1 -0
  187. package/lib/browser/view/notebook-viewport-service.js +61 -0
  188. package/lib/browser/view/notebook-viewport-service.js.map +1 -0
  189. package/lib/browser/view-model/notebook-cell-model.d.ts +137 -0
  190. package/lib/browser/view-model/notebook-cell-model.d.ts.map +1 -0
  191. package/lib/browser/view-model/notebook-cell-model.js +367 -0
  192. package/lib/browser/view-model/notebook-cell-model.js.map +1 -0
  193. package/lib/browser/view-model/notebook-cell-output-model.d.ts +17 -0
  194. package/lib/browser/view-model/notebook-cell-output-model.d.ts.map +1 -0
  195. package/lib/browser/view-model/notebook-cell-output-model.js +87 -0
  196. package/lib/browser/view-model/notebook-cell-output-model.js.map +1 -0
  197. package/lib/browser/view-model/notebook-model.d.ts +85 -0
  198. package/lib/browser/view-model/notebook-model.d.ts.map +1 -0
  199. package/lib/browser/view-model/notebook-model.js +446 -0
  200. package/lib/browser/view-model/notebook-model.js.map +1 -0
  201. package/lib/browser/view-model/notebook-view-model.d.ts +40 -0
  202. package/lib/browser/view-model/notebook-view-model.d.ts.map +1 -0
  203. package/lib/browser/view-model/notebook-view-model.js +120 -0
  204. package/lib/browser/view-model/notebook-view-model.js.map +1 -0
  205. package/lib/common/index.d.ts +3 -0
  206. package/lib/common/index.d.ts.map +1 -0
  207. package/lib/common/index.js +21 -0
  208. package/lib/common/index.js.map +1 -0
  209. package/lib/common/notebook-common.d.ts +227 -0
  210. package/lib/common/notebook-common.d.ts.map +1 -0
  211. package/lib/common/notebook-common.js +151 -0
  212. package/lib/common/notebook-common.js.map +1 -0
  213. package/lib/common/notebook-preferences.d.ts +15 -0
  214. package/lib/common/notebook-preferences.d.ts.map +1 -0
  215. package/lib/common/notebook-preferences.js +89 -0
  216. package/lib/common/notebook-preferences.js.map +1 -0
  217. package/lib/common/notebook-protocol.d.ts +21 -0
  218. package/lib/common/notebook-protocol.d.ts.map +1 -0
  219. package/lib/common/notebook-protocol.js +18 -0
  220. package/lib/common/notebook-protocol.js.map +1 -0
  221. package/lib/common/notebook-range.d.ts +14 -0
  222. package/lib/common/notebook-range.d.ts.map +1 -0
  223. package/lib/common/notebook-range.js +18 -0
  224. package/lib/common/notebook-range.js.map +1 -0
  225. package/lib/node/notebook-backend-module.d.ts +4 -0
  226. package/lib/node/notebook-backend-module.d.ts.map +1 -0
  227. package/lib/node/notebook-backend-module.js +23 -0
  228. package/lib/node/notebook-backend-module.js.map +1 -0
  229. package/package.json +7 -7
@@ -0,0 +1,338 @@
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.NotebookCodeCellOutputs = exports.NotebookCodeCellStatus = exports.NotebookCodeCellSidebar = exports.NotebookCodeCellRenderer = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const inversify_1 = require("@theia/core/shared/inversify");
21
+ const React = require("@theia/core/shared/react");
22
+ const monaco_editor_1 = require("@theia/monaco/lib/browser/monaco-editor");
23
+ const notebook_renderer_registry_1 = require("../notebook-renderer-registry");
24
+ const notebook_cell_editor_1 = require("./notebook-cell-editor");
25
+ const notebook_cell_list_view_1 = require("./notebook-cell-list-view");
26
+ const notebook_cell_toolbar_factory_1 = require("./notebook-cell-toolbar-factory");
27
+ const notebook_cell_actions_contribution_1 = require("../contributions/notebook-cell-actions-contribution");
28
+ const notebook_execution_state_service_1 = require("../service/notebook-execution-state-service");
29
+ const browser_1 = require("@theia/core/lib/browser");
30
+ const common_1 = require("../../common");
31
+ const core_1 = require("@theia/core");
32
+ const notebook_context_manager_1 = require("../service/notebook-context-manager");
33
+ const notebook_viewport_service_1 = require("./notebook-viewport-service");
34
+ const editor_preferences_1 = require("@theia/editor/lib/common/editor-preferences");
35
+ const notebook_options_1 = require("../service/notebook-options");
36
+ const markdown_renderer_1 = require("@theia/core/lib/browser/markdown-rendering/markdown-renderer");
37
+ const htmlContent_1 = require("@theia/monaco-editor-core/esm/vs/base/common/htmlContent");
38
+ const notebook_cell_editor_service_1 = require("../service/notebook-cell-editor-service");
39
+ const cell_output_webview_1 = require("../renderers/cell-output-webview");
40
+ const notebook_cell_status_bar_service_1 = require("../service/notebook-cell-status-bar-service");
41
+ const label_parser_1 = require("@theia/core/lib/browser/label-parser");
42
+ const notebook_view_model_1 = require("../view-model/notebook-view-model");
43
+ let NotebookCodeCellRenderer = class NotebookCodeCellRenderer {
44
+ render(notebookModel, cell, handle) {
45
+ return React.createElement("div", { className: 'theia-notebook-cell-with-sidebar', ref: ref => (0, notebook_cell_list_view_1.observeCellHeight)(ref, cell) },
46
+ React.createElement("div", { className: 'theia-notebook-cell-editor-container' },
47
+ React.createElement(notebook_cell_editor_1.CellEditor, { notebookModel: notebookModel, cell: cell, notebookViewModel: this.notebookViewModel, monacoServices: this.monacoServices, notebookContextManager: this.notebookContextManager, notebookViewportService: this.notebookViewportService, notebookCellEditorService: this.notebookCellEditorService, fontInfo: this.notebookOptionsService.editorFontInfo }),
48
+ React.createElement(NotebookCodeCellStatus, { cell: cell, notebook: notebookModel, commandRegistry: this.commandRegistry, executionStateService: this.executionStateService, cellStatusBarService: this.notebookCellStatusBarService, labelParser: this.labelParser, onClick: () => { var _a; return (_a = this.notebookViewModel.cellViewModels.get(cell.handle)) === null || _a === void 0 ? void 0 : _a.requestFocusEditor(); } })));
49
+ }
50
+ renderSidebar(notebookModel, cell) {
51
+ return React.createElement("div", null,
52
+ React.createElement(NotebookCodeCellSidebar, { cell: cell, notebook: notebookModel, notebookCellToolbarFactory: this.notebookCellToolbarFactory }),
53
+ React.createElement(NotebookCodeCellOutputs, { cell: cell, notebook: notebookModel, outputWebview: this.outputWebview, renderSidebar: () => this.notebookCellToolbarFactory.renderSidebar(notebook_cell_actions_contribution_1.NotebookCellActionContribution.OUTPUT_SIDEBAR_MENU, cell, {
54
+ contextMenuArgs: () => [notebookModel, cell, cell.outputs[0]]
55
+ }) }));
56
+ }
57
+ renderDragImage(cell) {
58
+ var _a;
59
+ const dragImage = document.createElement('div');
60
+ dragImage.className = 'theia-notebook-drag-image';
61
+ dragImage.style.width = ((_a = this.notebookContextManager.context) === null || _a === void 0 ? void 0 : _a.clientWidth) + 'px';
62
+ dragImage.style.height = '100px';
63
+ dragImage.style.display = 'flex';
64
+ const fakeRunButton = document.createElement('span');
65
+ fakeRunButton.className = `${(0, browser_1.codicon)('play')} theia-notebook-cell-status-item`;
66
+ dragImage.appendChild(fakeRunButton);
67
+ const fakeEditor = document.createElement('div');
68
+ dragImage.appendChild(fakeEditor);
69
+ const lines = cell.source.split('\n').slice(0, 5).join('\n');
70
+ const codeSequence = this.getMarkdownCodeSequence(lines);
71
+ const firstLine = new htmlContent_1.MarkdownString(`${codeSequence}${cell.language}\n${lines}\n${codeSequence}`, { supportHtml: true, isTrusted: false });
72
+ fakeEditor.appendChild(this.markdownRenderer.render(firstLine).element);
73
+ fakeEditor.classList.add('theia-notebook-cell-editor-container');
74
+ fakeEditor.style.padding = '10px';
75
+ return dragImage;
76
+ }
77
+ getMarkdownCodeSequence(input) {
78
+ // We need a minimum of 3 backticks to start a code block.
79
+ let longest = 2;
80
+ let current = 0;
81
+ for (let i = 0; i < input.length; i++) {
82
+ const char = input.charAt(i);
83
+ if (char === '`') {
84
+ current++;
85
+ if (current > longest) {
86
+ longest = current;
87
+ }
88
+ }
89
+ else {
90
+ current = 0;
91
+ }
92
+ }
93
+ return Array(longest + 1).fill('`').join('');
94
+ }
95
+ };
96
+ exports.NotebookCodeCellRenderer = NotebookCodeCellRenderer;
97
+ tslib_1.__decorate([
98
+ (0, inversify_1.inject)(monaco_editor_1.MonacoEditorServices),
99
+ tslib_1.__metadata("design:type", monaco_editor_1.MonacoEditorServices)
100
+ ], NotebookCodeCellRenderer.prototype, "monacoServices", void 0);
101
+ tslib_1.__decorate([
102
+ (0, inversify_1.inject)(notebook_renderer_registry_1.NotebookRendererRegistry),
103
+ tslib_1.__metadata("design:type", notebook_renderer_registry_1.NotebookRendererRegistry)
104
+ ], NotebookCodeCellRenderer.prototype, "notebookRendererRegistry", void 0);
105
+ tslib_1.__decorate([
106
+ (0, inversify_1.inject)(notebook_cell_toolbar_factory_1.NotebookCellToolbarFactory),
107
+ tslib_1.__metadata("design:type", notebook_cell_toolbar_factory_1.NotebookCellToolbarFactory)
108
+ ], NotebookCodeCellRenderer.prototype, "notebookCellToolbarFactory", void 0);
109
+ tslib_1.__decorate([
110
+ (0, inversify_1.inject)(notebook_execution_state_service_1.NotebookExecutionStateService),
111
+ tslib_1.__metadata("design:type", notebook_execution_state_service_1.NotebookExecutionStateService)
112
+ ], NotebookCodeCellRenderer.prototype, "executionStateService", void 0);
113
+ tslib_1.__decorate([
114
+ (0, inversify_1.inject)(notebook_context_manager_1.NotebookContextManager),
115
+ tslib_1.__metadata("design:type", notebook_context_manager_1.NotebookContextManager)
116
+ ], NotebookCodeCellRenderer.prototype, "notebookContextManager", void 0);
117
+ tslib_1.__decorate([
118
+ (0, inversify_1.inject)(notebook_viewport_service_1.NotebookViewportService),
119
+ tslib_1.__metadata("design:type", notebook_viewport_service_1.NotebookViewportService)
120
+ ], NotebookCodeCellRenderer.prototype, "notebookViewportService", void 0);
121
+ tslib_1.__decorate([
122
+ (0, inversify_1.inject)(editor_preferences_1.EditorPreferences),
123
+ tslib_1.__metadata("design:type", Object)
124
+ ], NotebookCodeCellRenderer.prototype, "editorPreferences", void 0);
125
+ tslib_1.__decorate([
126
+ (0, inversify_1.inject)(notebook_cell_editor_service_1.NotebookCellEditorService),
127
+ tslib_1.__metadata("design:type", notebook_cell_editor_service_1.NotebookCellEditorService)
128
+ ], NotebookCodeCellRenderer.prototype, "notebookCellEditorService", void 0);
129
+ tslib_1.__decorate([
130
+ (0, inversify_1.inject)(core_1.CommandRegistry),
131
+ tslib_1.__metadata("design:type", core_1.CommandRegistry)
132
+ ], NotebookCodeCellRenderer.prototype, "commandRegistry", void 0);
133
+ tslib_1.__decorate([
134
+ (0, inversify_1.inject)(notebook_options_1.NotebookOptionsService),
135
+ tslib_1.__metadata("design:type", notebook_options_1.NotebookOptionsService)
136
+ ], NotebookCodeCellRenderer.prototype, "notebookOptionsService", void 0);
137
+ tslib_1.__decorate([
138
+ (0, inversify_1.inject)(markdown_renderer_1.MarkdownRenderer),
139
+ tslib_1.__metadata("design:type", Object)
140
+ ], NotebookCodeCellRenderer.prototype, "markdownRenderer", void 0);
141
+ tslib_1.__decorate([
142
+ (0, inversify_1.inject)(cell_output_webview_1.CellOutputWebview),
143
+ tslib_1.__metadata("design:type", Object)
144
+ ], NotebookCodeCellRenderer.prototype, "outputWebview", void 0);
145
+ tslib_1.__decorate([
146
+ (0, inversify_1.inject)(notebook_cell_status_bar_service_1.NotebookCellStatusBarService),
147
+ tslib_1.__metadata("design:type", notebook_cell_status_bar_service_1.NotebookCellStatusBarService)
148
+ ], NotebookCodeCellRenderer.prototype, "notebookCellStatusBarService", void 0);
149
+ tslib_1.__decorate([
150
+ (0, inversify_1.inject)(label_parser_1.LabelParser),
151
+ tslib_1.__metadata("design:type", label_parser_1.LabelParser)
152
+ ], NotebookCodeCellRenderer.prototype, "labelParser", void 0);
153
+ tslib_1.__decorate([
154
+ (0, inversify_1.inject)(notebook_view_model_1.NotebookViewModel),
155
+ tslib_1.__metadata("design:type", notebook_view_model_1.NotebookViewModel)
156
+ ], NotebookCodeCellRenderer.prototype, "notebookViewModel", void 0);
157
+ exports.NotebookCodeCellRenderer = NotebookCodeCellRenderer = tslib_1.__decorate([
158
+ (0, inversify_1.injectable)()
159
+ ], NotebookCodeCellRenderer);
160
+ class NotebookCodeCellSidebar extends React.Component {
161
+ constructor(props) {
162
+ super(props);
163
+ this.toDispose = new core_1.DisposableCollection();
164
+ this.toDispose.push(props.cell.onDidCellHeightChange(() => this.forceUpdate()));
165
+ }
166
+ componentWillUnmount() {
167
+ this.toDispose.dispose();
168
+ }
169
+ render() {
170
+ return React.createElement("div", { className: 'theia-notebook-cell-sidebar-actions', style: { height: `${this.props.cell.cellHeight}px` } },
171
+ this.props.notebookCellToolbarFactory.renderSidebar(notebook_cell_actions_contribution_1.NotebookCellActionContribution.CODE_CELL_SIDEBAR_MENU, this.props.cell, {
172
+ contextMenuArgs: () => [this.props.cell], commandArgs: () => [this.props.notebook, this.props.cell]
173
+ }),
174
+ React.createElement(CodeCellExecutionOrder, { cell: this.props.cell }));
175
+ }
176
+ }
177
+ exports.NotebookCodeCellSidebar = NotebookCodeCellSidebar;
178
+ class NotebookCodeCellStatus extends React.Component {
179
+ constructor(props) {
180
+ super(props);
181
+ this.toDispose = new core_1.DisposableCollection();
182
+ this.statusBarItems = [];
183
+ this.state = {
184
+ executionTime: 0
185
+ };
186
+ let currentInterval;
187
+ if (props.executionStateService) {
188
+ this.toDispose.push(props.executionStateService.onDidChangeExecution(event => {
189
+ var _a;
190
+ if (event.affectsCell(this.props.cell.uri)) {
191
+ this.setState({ currentExecution: event.changed, executionTime: 0 });
192
+ clearInterval(currentInterval);
193
+ if (((_a = event.changed) === null || _a === void 0 ? void 0 : _a.state) === common_1.NotebookCellExecutionState.Executing) {
194
+ const startTime = Date.now();
195
+ // The resolution of the time display is only a single digit after the decimal point.
196
+ // Therefore, we only need to update the display every 100ms.
197
+ currentInterval = setInterval(() => {
198
+ this.setState({
199
+ executionTime: Date.now() - startTime
200
+ });
201
+ }, 100);
202
+ }
203
+ }
204
+ }));
205
+ }
206
+ this.toDispose.push(props.cell.onDidChangeLanguage(() => {
207
+ this.forceUpdate();
208
+ }));
209
+ this.updateStatusBarItems();
210
+ this.props.cellStatusBarService.onDidChangeItems(() => this.updateStatusBarItems());
211
+ this.props.notebook.onContentChanged(() => this.updateStatusBarItems());
212
+ }
213
+ async updateStatusBarItems() {
214
+ this.statusBarItems = await this.props.cellStatusBarService.getStatusBarItemsForCell(this.props.notebook.uri, this.props.notebook.cells.indexOf(this.props.cell), this.props.notebook.viewType, core_1.CancellationToken.None);
215
+ this.forceUpdate();
216
+ }
217
+ componentWillUnmount() {
218
+ this.toDispose.dispose();
219
+ }
220
+ render() {
221
+ var _a;
222
+ return React.createElement("div", { className: 'notebook-cell-status', onClick: () => this.props.onClick() },
223
+ React.createElement("div", { className: 'notebook-cell-status-left' },
224
+ this.props.executionStateService && this.renderExecutionState(),
225
+ ((_a = this.statusBarItems) === null || _a === void 0 ? void 0 : _a.length) && this.renderStatusBarItems()),
226
+ React.createElement("div", { className: 'notebook-cell-status-right' },
227
+ React.createElement("span", { className: 'notebook-cell-language-label', onClick: () => {
228
+ this.props.commandRegistry.executeCommand(notebook_cell_actions_contribution_1.NotebookCellCommands.CHANGE_CELL_LANGUAGE.id, this.props.notebook, this.props.cell);
229
+ } }, this.props.cell.languageName)));
230
+ }
231
+ renderExecutionState() {
232
+ var _a;
233
+ const state = (_a = this.state.currentExecution) === null || _a === void 0 ? void 0 : _a.state;
234
+ const { lastRunSuccess } = this.props.cell.internalMetadata;
235
+ let iconClasses = undefined;
236
+ let color = undefined;
237
+ if (!state && lastRunSuccess) {
238
+ iconClasses = (0, browser_1.codicon)('check');
239
+ color = 'green';
240
+ }
241
+ else if (!state && lastRunSuccess === false) {
242
+ iconClasses = (0, browser_1.codicon)('error');
243
+ color = 'red';
244
+ }
245
+ else if (state === common_1.NotebookCellExecutionState.Pending || state === common_1.NotebookCellExecutionState.Unconfirmed) {
246
+ iconClasses = (0, browser_1.codicon)('clock');
247
+ }
248
+ else if (state === common_1.NotebookCellExecutionState.Executing) {
249
+ iconClasses = `${(0, browser_1.codicon)('sync')} theia-animation-spin`;
250
+ }
251
+ return React.createElement(React.Fragment, null, iconClasses &&
252
+ React.createElement(React.Fragment, null,
253
+ React.createElement("span", { className: `${iconClasses} notebook-cell-status-item`, style: { color } }),
254
+ React.createElement("div", { className: 'notebook-cell-status-item' }, this.renderTime(this.getExecutionTime()))));
255
+ }
256
+ getExecutionTime() {
257
+ const { runStartTime, runEndTime } = this.props.cell.internalMetadata;
258
+ const { executionTime } = this.state;
259
+ if (runStartTime !== undefined && runEndTime !== undefined) {
260
+ return runEndTime - runStartTime;
261
+ }
262
+ return executionTime;
263
+ }
264
+ renderTime(ms) {
265
+ return `${(ms / 1000).toLocaleString(undefined, { maximumFractionDigits: 1, minimumFractionDigits: 1 })}s`;
266
+ }
267
+ renderStatusBarItems() {
268
+ return React.createElement(React.Fragment, null, this.statusBarItems.flatMap((itemList, listIndex) => itemList.items.map((item, index) => this.renderStatusBarItem(item, `${listIndex}-${index}`))));
269
+ }
270
+ renderStatusBarItem(item, key) {
271
+ const content = this.props.labelParser.parse(item.text).map(part => {
272
+ if (typeof part === 'string') {
273
+ return part;
274
+ }
275
+ else {
276
+ return React.createElement("span", { key: part.name, className: `codicon codicon-${part.name}` });
277
+ }
278
+ });
279
+ return React.createElement("div", { key: key, className: `cell-status-bar-item ${item.command ? 'cell-status-item-has-command' : ''}`, onClick: async () => {
280
+ var _a;
281
+ if (item.command) {
282
+ if (typeof item.command === 'string') {
283
+ this.props.commandRegistry.executeCommand(item.command);
284
+ }
285
+ else {
286
+ this.props.commandRegistry.executeCommand(item.command.id, ...((_a = item.command.arguments) !== null && _a !== void 0 ? _a : []));
287
+ }
288
+ }
289
+ } }, content);
290
+ }
291
+ }
292
+ exports.NotebookCodeCellStatus = NotebookCodeCellStatus;
293
+ class NotebookCodeCellOutputs extends React.Component {
294
+ constructor() {
295
+ super(...arguments);
296
+ this.toDispose = new core_1.DisposableCollection();
297
+ this.outputHeight = 0;
298
+ }
299
+ async componentDidMount() {
300
+ const { cell } = this.props;
301
+ this.toDispose.push(cell.onDidChangeOutputs(() => this.forceUpdate()));
302
+ this.toDispose.push(this.props.cell.onDidChangeOutputVisibility(() => this.forceUpdate()));
303
+ this.toDispose.push(this.props.outputWebview.onDidRenderOutput(event => {
304
+ if (event.cellHandle === this.props.cell.handle) {
305
+ this.outputHeight = event.outputHeight;
306
+ this.forceUpdate();
307
+ }
308
+ }));
309
+ }
310
+ componentWillUnmount() {
311
+ this.toDispose.dispose();
312
+ }
313
+ render() {
314
+ var _a;
315
+ if (!((_a = this.props.cell.outputs) === null || _a === void 0 ? void 0 : _a.length)) {
316
+ return React.createElement(React.Fragment, null);
317
+ }
318
+ if (this.props.cell.outputVisible) {
319
+ return React.createElement("div", { style: { minHeight: this.outputHeight } }, this.props.renderSidebar());
320
+ }
321
+ return React.createElement("div", { className: 'theia-notebook-collapsed-output-container' },
322
+ React.createElement("i", { className: 'theia-notebook-collapsed-output' }, core_1.nls.localizeByDefault('Outputs are collapsed')));
323
+ }
324
+ }
325
+ exports.NotebookCodeCellOutputs = NotebookCodeCellOutputs;
326
+ function CodeCellExecutionOrder({ cell }) {
327
+ var _a;
328
+ const [executionOrder, setExecutionOrder] = React.useState((_a = cell.internalMetadata.executionOrder) !== null && _a !== void 0 ? _a : ' ');
329
+ React.useEffect(() => {
330
+ const listener = cell.onDidChangeInternalMetadata(e => {
331
+ var _a;
332
+ setExecutionOrder((_a = cell.internalMetadata.executionOrder) !== null && _a !== void 0 ? _a : ' ');
333
+ });
334
+ return () => listener.dispose();
335
+ }, []);
336
+ return React.createElement("span", { className: 'theia-notebook-code-cell-execution-order' }, `[${executionOrder}]`);
337
+ }
338
+ //# sourceMappingURL=notebook-code-cell-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-code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IAAI,CAAC,gBAAgB,CAAC,cAAc,mCAAI,GAAG,CAAC,CAAC;IAExG,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,MAAM,QAAQ,GAAG,IAAI,CAAC,2BAA2B,CAAC,CAAC,CAAC,EAAE;;YAClD,iBAAiB,CAAC,MAAA,IAAI,CAAC,gBAAgB,CAAC,cAAc,mCAAI,GAAG,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;IACpC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,8BAAM,SAAS,EAAC,0CAA0C,IAAE,IAAI,cAAc,GAAG,CAAQ,CAAC;AACrG,CAAC"}
@@ -0,0 +1,63 @@
1
+ /// <reference types="react" />
2
+ import * as React from '@theia/core/shared/react';
3
+ export interface NotebookEditorFindMatch {
4
+ selected: boolean;
5
+ show(): void;
6
+ replace?(value: string): void;
7
+ }
8
+ export interface NotebookEditorFindMatchOptions {
9
+ search: string;
10
+ matchCase: boolean;
11
+ wholeWord: boolean;
12
+ regex: boolean;
13
+ activeFilters: string[];
14
+ }
15
+ export interface NotebookEditorFindFilter {
16
+ id: string;
17
+ label: string;
18
+ active: boolean;
19
+ }
20
+ export interface NotebookEditorFindOptions {
21
+ search?: string;
22
+ jumpToMatch?: boolean;
23
+ matchCase?: boolean;
24
+ wholeWord?: boolean;
25
+ regex?: boolean;
26
+ modifyIndex?: (matches: NotebookEditorFindMatch[], index: number) => number;
27
+ }
28
+ export interface NotebookFindWidgetProps {
29
+ hidden?: boolean;
30
+ filters?: NotebookEditorFindFilter[];
31
+ onClose(): void;
32
+ onSearch(options: NotebookEditorFindMatchOptions): NotebookEditorFindMatch[];
33
+ onReplace(matches: NotebookEditorFindMatch[], value: string): void;
34
+ }
35
+ export interface NotebookFindWidgetState {
36
+ search: string;
37
+ replace: string;
38
+ expanded: boolean;
39
+ matchCase: boolean;
40
+ wholeWord: boolean;
41
+ regex: boolean;
42
+ activeFilters: string[];
43
+ currentMatch: number;
44
+ matches: NotebookEditorFindMatch[];
45
+ }
46
+ export declare class NotebookFindWidget extends React.Component<NotebookFindWidgetProps, NotebookFindWidgetState> {
47
+ private searchRef;
48
+ private debounceSearch;
49
+ constructor(props: NotebookFindWidgetProps);
50
+ render(): React.ReactNode;
51
+ private hasMatches;
52
+ private canReplace;
53
+ private canReplaceAll;
54
+ private getMatchesCount;
55
+ private gotoNextMatch;
56
+ private gotoPreviousMatch;
57
+ private replaceOne;
58
+ private replaceAll;
59
+ componentDidUpdate(prevProps: Readonly<NotebookFindWidgetProps>, prevState: Readonly<NotebookFindWidgetState>): void;
60
+ focusSearch(content?: string): void;
61
+ search(options: NotebookEditorFindOptions): void;
62
+ }
63
+ //# sourceMappingURL=notebook-find-widget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-find-widget.d.ts","sourceRoot":"","sources":["../../../src/browser/view/notebook-find-widget.tsx"],"names":[],"mappings":";AAiBA,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAIlD,MAAM,WAAW,uBAAuB;IACpC,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,IAAI,IAAI,CAAC;IACb,OAAO,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,8BAA8B;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,aAAa,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAwB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,yBAAyB;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IAC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AAU;IAKT,kBAAkB,CAAC,SAAS,EAAE,QAAQ,CAAC,uBAAuB,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,uBAAuB,CAAC,GAAG,IAAI;IAO7H,WAAW,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAUnC,MAAM,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI;CAiCnD"}
@@ -0,0 +1,225 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2024 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.NotebookFindWidget = void 0;
19
+ const core_1 = require("@theia/core");
20
+ const React = require("@theia/core/shared/react");
21
+ const browser_1 = require("@theia/core/lib/browser");
22
+ const debounce = require("@theia/core/shared/lodash.debounce");
23
+ class NotebookFindWidget extends React.Component {
24
+ constructor(props) {
25
+ var _a;
26
+ super(props);
27
+ this.searchRef = React.createRef();
28
+ this.debounceSearch = debounce(this.search.bind(this), 50);
29
+ this.state = {
30
+ search: '',
31
+ replace: '',
32
+ currentMatch: 0,
33
+ matches: [],
34
+ expanded: false,
35
+ matchCase: false,
36
+ regex: false,
37
+ wholeWord: false,
38
+ activeFilters: ((_a = props.filters) === null || _a === void 0 ? void 0 : _a.filter(filter => filter.active).map(filter => filter.id)) || []
39
+ };
40
+ }
41
+ render() {
42
+ const hasMatches = this.hasMatches();
43
+ const canReplace = this.canReplace();
44
+ const canReplaceAll = this.canReplaceAll();
45
+ return (React.createElement("div", { onKeyUp: event => {
46
+ if (event.key === 'Escape') {
47
+ this.props.onClose();
48
+ }
49
+ }, className: `theia-notebook-find-widget ${!this.state.expanded ? 'search-mode' : ''} ${this.props.hidden ? 'hidden' : ''}` },
50
+ React.createElement("div", { className: 'theia-notebook-find-widget-expand', title: core_1.nls.localizeByDefault('Toggle Replace'), onClick: () => {
51
+ this.setState({
52
+ expanded: !this.state.expanded
53
+ });
54
+ } },
55
+ React.createElement("div", { className: (0, browser_1.codicon)(`chevron-${this.state.expanded ? 'down' : 'right'}`) })),
56
+ React.createElement("div", { className: 'theia-notebook-find-widget-inputs' },
57
+ React.createElement("div", { className: 'theia-notebook-find-widget-input-wrapper' },
58
+ React.createElement("input", { ref: this.searchRef, type: 'text', className: 'theia-input theia-notebook-find-widget-input', placeholder: core_1.nls.localizeByDefault('Find'), value: this.state.search, onChange: event => {
59
+ this.setState({
60
+ search: event.target.value
61
+ });
62
+ this.debounceSearch({});
63
+ }, onKeyDown: event => {
64
+ if (event.key === 'Enter') {
65
+ if (event.shiftKey) {
66
+ this.gotoPreviousMatch();
67
+ }
68
+ else {
69
+ this.gotoNextMatch();
70
+ }
71
+ event.preventDefault();
72
+ }
73
+ } }),
74
+ React.createElement("div", { className: `${(0, browser_1.codicon)('case-sensitive', true)} option ${this.state.matchCase ? 'enabled' : ''}`, title: core_1.nls.localizeByDefault('Match Case'), onClick: () => {
75
+ this.search({
76
+ matchCase: !this.state.matchCase
77
+ });
78
+ } }),
79
+ React.createElement("div", { className: `${(0, browser_1.codicon)('whole-word', true)} option ${this.state.wholeWord ? 'enabled' : ''}`, title: core_1.nls.localizeByDefault('Match Whole Word'), onClick: () => {
80
+ this.search({
81
+ wholeWord: !this.state.wholeWord
82
+ });
83
+ } }),
84
+ React.createElement("div", { className: `${(0, browser_1.codicon)('regex', true)} option ${this.state.regex ? 'enabled' : ''}`, title: core_1.nls.localizeByDefault('Use Regular Expression'), onClick: () => {
85
+ this.search({
86
+ regex: !this.state.regex
87
+ });
88
+ } })),
89
+ React.createElement("input", { type: 'text', className: 'theia-input theia-notebook-find-widget-replace', placeholder: core_1.nls.localizeByDefault('Replace'), value: this.state.replace, onChange: event => {
90
+ this.setState({
91
+ replace: event.target.value
92
+ });
93
+ }, onKeyDown: event => {
94
+ if (event.key === 'Enter') {
95
+ this.replaceOne();
96
+ event.preventDefault();
97
+ }
98
+ } })),
99
+ React.createElement("div", { className: 'theia-notebook-find-widget-buttons' },
100
+ React.createElement("div", { className: 'theia-notebook-find-widget-buttons-first' },
101
+ React.createElement("div", { className: 'theia-notebook-find-widget-matches-count' }, this.getMatchesCount()),
102
+ React.createElement("div", { className: `${(0, browser_1.codicon)('arrow-up', hasMatches)} ${hasMatches ? '' : 'disabled'}`, title: core_1.nls.localizeByDefault('Previous Match'), onClick: () => {
103
+ this.gotoPreviousMatch();
104
+ } }),
105
+ React.createElement("div", { className: `${(0, browser_1.codicon)('arrow-down', hasMatches)} ${hasMatches ? '' : 'disabled'}`, title: core_1.nls.localizeByDefault('Next Match'), onClick: () => {
106
+ this.gotoNextMatch();
107
+ } }),
108
+ React.createElement("div", { className: (0, browser_1.codicon)('close', true), title: core_1.nls.localizeByDefault('Close'), onClick: () => {
109
+ this.props.onClose();
110
+ } })),
111
+ React.createElement("div", { className: 'theia-notebook-find-widget-buttons-second' },
112
+ React.createElement("div", { className: `${(0, browser_1.codicon)('replace', canReplace)} ${canReplace ? '' : 'disabled'}`, title: core_1.nls.localizeByDefault('Replace'), onClick: () => {
113
+ this.replaceOne();
114
+ } }),
115
+ React.createElement("div", { className: `${(0, browser_1.codicon)('replace-all', canReplaceAll)} ${canReplaceAll ? '' : 'disabled'}`, title: core_1.nls.localizeByDefault('Replace All'), onClick: () => {
116
+ this.replaceAll();
117
+ } })))));
118
+ }
119
+ hasMatches() {
120
+ return this.state.matches.length > 0;
121
+ }
122
+ canReplace() {
123
+ var _a;
124
+ return Boolean((_a = this.state.matches[this.state.currentMatch]) === null || _a === void 0 ? void 0 : _a.replace);
125
+ }
126
+ canReplaceAll() {
127
+ return this.state.matches.some(match => Boolean(match.replace));
128
+ }
129
+ getMatchesCount() {
130
+ if (this.hasMatches()) {
131
+ return core_1.nls.localizeByDefault('{0} of {1}', this.state.currentMatch + 1, this.state.matches.length);
132
+ }
133
+ else {
134
+ return core_1.nls.localizeByDefault('No results');
135
+ }
136
+ }
137
+ gotoNextMatch() {
138
+ this.search({
139
+ modifyIndex: (matches, index) => (index + 1) % matches.length,
140
+ jumpToMatch: true
141
+ });
142
+ }
143
+ gotoPreviousMatch() {
144
+ this.search({
145
+ modifyIndex: (matches, index) => (index === 0 ? matches.length : index) - 1,
146
+ jumpToMatch: true
147
+ });
148
+ }
149
+ replaceOne() {
150
+ var _a;
151
+ const existingMatches = this.state.matches;
152
+ const match = existingMatches[this.state.currentMatch];
153
+ if (match) {
154
+ (_a = match.replace) === null || _a === void 0 ? void 0 : _a.call(match, this.state.replace);
155
+ this.search({
156
+ jumpToMatch: true,
157
+ modifyIndex: (matches, index) => {
158
+ if (matches.length < existingMatches.length) {
159
+ return index % matches.length;
160
+ }
161
+ else {
162
+ const diff = matches.length - existingMatches.length;
163
+ return (index + diff + 1) % matches.length;
164
+ }
165
+ }
166
+ });
167
+ }
168
+ }
169
+ replaceAll() {
170
+ this.props.onReplace(this.state.matches, this.state.replace);
171
+ this.search({});
172
+ }
173
+ componentDidUpdate(prevProps, prevState) {
174
+ var _a;
175
+ if (!this.props.hidden && prevProps.hidden) {
176
+ // Focus the search input when the widget switches from hidden to visible.
177
+ (_a = this.searchRef.current) === null || _a === void 0 ? void 0 : _a.focus();
178
+ }
179
+ }
180
+ focusSearch(content) {
181
+ var _a;
182
+ (_a = this.searchRef.current) === null || _a === void 0 ? void 0 : _a.focus();
183
+ if (content) {
184
+ this.search({
185
+ search: content,
186
+ jumpToMatch: false
187
+ });
188
+ }
189
+ }
190
+ search(options) {
191
+ var _a, _b, _c, _d;
192
+ const matchCase = (_a = options.matchCase) !== null && _a !== void 0 ? _a : this.state.matchCase;
193
+ const wholeWord = (_b = options.wholeWord) !== null && _b !== void 0 ? _b : this.state.wholeWord;
194
+ const regex = (_c = options.regex) !== null && _c !== void 0 ? _c : this.state.regex;
195
+ const search = (_d = options.search) !== null && _d !== void 0 ? _d : this.state.search;
196
+ const matches = this.props.onSearch({
197
+ search,
198
+ matchCase,
199
+ wholeWord,
200
+ regex,
201
+ activeFilters: this.state.activeFilters
202
+ });
203
+ let currentMatch = Math.max(0, Math.min(this.state.currentMatch, matches.length - 1));
204
+ if (options.modifyIndex && matches.length > 0) {
205
+ currentMatch = options.modifyIndex(matches, currentMatch);
206
+ }
207
+ const selectedMatch = matches[currentMatch];
208
+ if (selectedMatch) {
209
+ selectedMatch.selected = true;
210
+ if (options.jumpToMatch) {
211
+ selectedMatch.show();
212
+ }
213
+ }
214
+ this.setState({
215
+ search,
216
+ matches,
217
+ currentMatch,
218
+ matchCase,
219
+ wholeWord,
220
+ regex
221
+ });
222
+ }
223
+ }
224
+ exports.NotebookFindWidget = NotebookFindWidget;
225
+ //# sourceMappingURL=notebook-find-widget.js.map