@theia/plugin-ext 1.40.1 → 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 (292) hide show
  1. package/lib/common/collections.d.ts +4 -0
  2. package/lib/common/collections.d.ts.map +1 -1
  3. package/lib/common/collections.js +17 -1
  4. package/lib/common/collections.js.map +1 -1
  5. package/lib/common/errors.d.ts +14 -0
  6. package/lib/common/errors.d.ts.map +1 -1
  7. package/lib/common/errors.js +17 -1
  8. package/lib/common/errors.js.map +1 -1
  9. package/lib/common/plugin-api-rpc.d.ts +286 -6
  10. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  11. package/lib/common/plugin-api-rpc.js +20 -1
  12. package/lib/common/plugin-api-rpc.js.map +1 -1
  13. package/lib/common/plugin-protocol.d.ts +27 -5
  14. package/lib/common/plugin-protocol.d.ts.map +1 -1
  15. package/lib/common/plugin-protocol.js.map +1 -1
  16. package/lib/hosted/browser/hosted-plugin.d.ts +5 -2
  17. package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
  18. package/lib/hosted/browser/hosted-plugin.js +21 -12
  19. package/lib/hosted/browser/hosted-plugin.js.map +1 -1
  20. package/lib/hosted/node/hosted-plugin-deployer-handler.js +1 -1
  21. package/lib/hosted/node/hosted-plugin-deployer-handler.js.map +1 -1
  22. package/lib/hosted/node/plugin-reader.d.ts +1 -1
  23. package/lib/hosted/node/plugin-reader.d.ts.map +1 -1
  24. package/lib/hosted/node/plugin-reader.js +1 -1
  25. package/lib/hosted/node/plugin-reader.js.map +1 -1
  26. package/lib/hosted/node/scanners/grammars-reader.d.ts +1 -1
  27. package/lib/hosted/node/scanners/grammars-reader.d.ts.map +1 -1
  28. package/lib/hosted/node/scanners/grammars-reader.js +5 -5
  29. package/lib/hosted/node/scanners/grammars-reader.js.map +1 -1
  30. package/lib/hosted/node/scanners/scanner-theia.d.ts +6 -6
  31. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  32. package/lib/hosted/node/scanners/scanner-theia.js +54 -41
  33. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  34. package/lib/main/browser/custom-editors/custom-editor-widget.d.ts +1 -1
  35. package/lib/main/browser/custom-editors/custom-editor-widget.d.ts.map +1 -1
  36. package/lib/main/browser/custom-editors/custom-editor-widget.js +1 -1
  37. package/lib/main/browser/custom-editors/custom-editor-widget.js.map +1 -1
  38. package/lib/main/browser/custom-editors/custom-editors-main.d.ts +1 -1
  39. package/lib/main/browser/custom-editors/custom-editors-main.d.ts.map +1 -1
  40. package/lib/main/browser/custom-editors/custom-editors-main.js +1 -1
  41. package/lib/main/browser/custom-editors/custom-editors-main.js.map +1 -1
  42. package/lib/main/browser/editors-and-documents-main.d.ts.map +1 -1
  43. package/lib/main/browser/editors-and-documents-main.js +1 -0
  44. package/lib/main/browser/editors-and-documents-main.js.map +1 -1
  45. package/lib/main/browser/languages-main.d.ts.map +1 -1
  46. package/lib/main/browser/languages-main.js +6 -4
  47. package/lib/main/browser/languages-main.js.map +1 -1
  48. package/lib/main/browser/main-context.d.ts.map +1 -1
  49. package/lib/main/browser/main-context.js +18 -0
  50. package/lib/main/browser/main-context.js.map +1 -1
  51. package/lib/main/browser/menus/menus-contribution-handler.d.ts.map +1 -1
  52. package/lib/main/browser/menus/menus-contribution-handler.js +6 -3
  53. package/lib/main/browser/menus/menus-contribution-handler.js.map +1 -1
  54. package/lib/main/browser/notebooks/notebook-documents-and-editors-main.d.ts +50 -0
  55. package/lib/main/browser/notebooks/notebook-documents-and-editors-main.d.ts.map +1 -0
  56. package/lib/main/browser/notebooks/notebook-documents-and-editors-main.js +189 -0
  57. package/lib/main/browser/notebooks/notebook-documents-and-editors-main.js.map +1 -0
  58. package/lib/main/browser/notebooks/notebook-documents-main.d.ts +22 -0
  59. package/lib/main/browser/notebooks/notebook-documents-main.d.ts.map +1 -0
  60. package/lib/main/browser/notebooks/notebook-documents-main.js +133 -0
  61. package/lib/main/browser/notebooks/notebook-documents-main.js.map +1 -0
  62. package/lib/main/browser/notebooks/notebook-dto.d.ts +15 -0
  63. package/lib/main/browser/notebooks/notebook-dto.d.ts.map +1 -0
  64. package/lib/main/browser/notebooks/notebook-dto.js +138 -0
  65. package/lib/main/browser/notebooks/notebook-dto.js.map +1 -0
  66. package/lib/main/browser/notebooks/notebook-editors-main.d.ts +20 -0
  67. package/lib/main/browser/notebooks/notebook-editors-main.d.ts.map +1 -0
  68. package/lib/main/browser/notebooks/notebook-editors-main.js +58 -0
  69. package/lib/main/browser/notebooks/notebook-editors-main.js.map +1 -0
  70. package/lib/main/browser/notebooks/notebook-kernels-main.d.ts +42 -0
  71. package/lib/main/browser/notebooks/notebook-kernels-main.d.ts.map +1 -0
  72. package/lib/main/browser/notebooks/notebook-kernels-main.js +230 -0
  73. package/lib/main/browser/notebooks/notebook-kernels-main.js.map +1 -0
  74. package/lib/main/browser/notebooks/notebook-renderers-main.d.ts +12 -0
  75. package/lib/main/browser/notebooks/notebook-renderers-main.d.ts.map +1 -0
  76. package/lib/main/browser/notebooks/notebook-renderers-main.js +39 -0
  77. package/lib/main/browser/notebooks/notebook-renderers-main.js.map +1 -0
  78. package/lib/main/browser/notebooks/notebooks-main.d.ts +20 -0
  79. package/lib/main/browser/notebooks/notebooks-main.d.ts.map +1 -0
  80. package/lib/main/browser/notebooks/notebooks-main.js +103 -0
  81. package/lib/main/browser/notebooks/notebooks-main.js.map +1 -0
  82. package/lib/main/browser/notebooks/renderers/cell-output-webview.d.ts +35 -0
  83. package/lib/main/browser/notebooks/renderers/cell-output-webview.d.ts.map +1 -0
  84. package/lib/main/browser/notebooks/renderers/cell-output-webview.js +204 -0
  85. package/lib/main/browser/notebooks/renderers/cell-output-webview.js.map +1 -0
  86. package/lib/main/browser/notebooks/renderers/output-webview-internal.d.ts +13 -0
  87. package/lib/main/browser/notebooks/renderers/output-webview-internal.d.ts.map +1 -0
  88. package/lib/main/browser/notebooks/renderers/output-webview-internal.js +375 -0
  89. package/lib/main/browser/notebooks/renderers/output-webview-internal.js.map +1 -0
  90. package/lib/main/browser/notebooks/renderers/webview-communication.d.ts +52 -0
  91. package/lib/main/browser/notebooks/renderers/webview-communication.d.ts.map +1 -0
  92. package/{src/typings/index.d.ts → lib/main/browser/notebooks/renderers/webview-communication.js} +8 -11
  93. package/lib/main/browser/notebooks/renderers/webview-communication.js.map +1 -0
  94. package/lib/main/browser/plugin-contribution-handler.d.ts +3 -0
  95. package/lib/main/browser/plugin-contribution-handler.d.ts.map +1 -1
  96. package/lib/main/browser/plugin-contribution-handler.js +31 -3
  97. package/lib/main/browser/plugin-contribution-handler.js.map +1 -1
  98. package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
  99. package/lib/main/browser/plugin-ext-frontend-module.js +3 -2
  100. package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
  101. package/lib/main/browser/plugin-icon-theme-service.d.ts.map +1 -1
  102. package/lib/main/browser/plugin-icon-theme-service.js +6 -0
  103. package/lib/main/browser/plugin-icon-theme-service.js.map +1 -1
  104. package/lib/main/browser/plugin-shared-style.d.ts.map +1 -1
  105. package/lib/main/browser/plugin-shared-style.js +2 -1
  106. package/lib/main/browser/plugin-shared-style.js.map +1 -1
  107. package/lib/main/browser/tasks-main.js +2 -2
  108. package/lib/main/browser/tasks-main.js.map +1 -1
  109. package/lib/main/browser/terminal-main.d.ts +2 -2
  110. package/lib/main/browser/terminal-main.d.ts.map +1 -1
  111. package/lib/main/browser/terminal-main.js +4 -4
  112. package/lib/main/browser/terminal-main.js.map +1 -1
  113. package/lib/main/browser/view/tree-view-widget.d.ts +3 -1
  114. package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
  115. package/lib/main/browser/view/tree-view-widget.js +32 -1
  116. package/lib/main/browser/view/tree-view-widget.js.map +1 -1
  117. package/lib/main/browser/view/tree-views-main.d.ts +2 -1
  118. package/lib/main/browser/view/tree-views-main.d.ts.map +1 -1
  119. package/lib/main/browser/view/tree-views-main.js +10 -0
  120. package/lib/main/browser/view/tree-views-main.js.map +1 -1
  121. package/lib/main/browser/webview/webview.d.ts +1 -0
  122. package/lib/main/browser/webview/webview.d.ts.map +1 -1
  123. package/lib/main/browser/webview/webview.js +5 -0
  124. package/lib/main/browser/webview/webview.js.map +1 -1
  125. package/lib/main/node/errors.spec.d.ts +2 -0
  126. package/lib/main/node/errors.spec.d.ts.map +1 -0
  127. package/lib/main/node/errors.spec.js +36 -0
  128. package/lib/main/node/errors.spec.js.map +1 -0
  129. package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts +5 -2
  130. package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts.map +1 -1
  131. package/lib/main/node/handlers/plugin-theia-directory-handler.js +14 -8
  132. package/lib/main/node/handlers/plugin-theia-directory-handler.js.map +1 -1
  133. package/lib/main/node/handlers/plugin-theia-file-handler.d.ts +2 -1
  134. package/lib/main/node/handlers/plugin-theia-file-handler.d.ts.map +1 -1
  135. package/lib/main/node/handlers/plugin-theia-file-handler.js +13 -5
  136. package/lib/main/node/handlers/plugin-theia-file-handler.js.map +1 -1
  137. package/lib/main/node/paths/plugin-paths-service.d.ts.map +1 -1
  138. package/lib/main/node/paths/plugin-paths-service.js +4 -9
  139. package/lib/main/node/paths/plugin-paths-service.js.map +1 -1
  140. package/lib/main/node/plugin-deployer-directory-handler-context-impl.js +8 -8
  141. package/lib/main/node/plugin-deployer-directory-handler-context-impl.js.map +1 -1
  142. package/lib/main/node/plugin-deployer-entry-impl.d.ts +2 -2
  143. package/lib/main/node/plugin-deployer-entry-impl.d.ts.map +1 -1
  144. package/lib/main/node/plugin-deployer-entry-impl.js +9 -7
  145. package/lib/main/node/plugin-deployer-entry-impl.js.map +1 -1
  146. package/lib/main/node/plugin-deployer-impl.d.ts +2 -2
  147. package/lib/main/node/plugin-deployer-impl.d.ts.map +1 -1
  148. package/lib/main/node/plugin-deployer-impl.js +16 -24
  149. package/lib/main/node/plugin-deployer-impl.js.map +1 -1
  150. package/lib/main/node/plugin-deployer-proxy-entry-impl.d.ts +2 -2
  151. package/lib/main/node/plugin-deployer-proxy-entry-impl.d.ts.map +1 -1
  152. package/lib/main/node/plugin-github-resolver.d.ts.map +1 -1
  153. package/lib/main/node/plugin-github-resolver.js +14 -6
  154. package/lib/main/node/plugin-github-resolver.js.map +1 -1
  155. package/lib/main/node/plugin-http-resolver.d.ts.map +1 -1
  156. package/lib/main/node/plugin-http-resolver.js +14 -6
  157. package/lib/main/node/plugin-http-resolver.js.map +1 -1
  158. package/lib/main/node/temp-dir-util.d.ts +1 -0
  159. package/lib/main/node/temp-dir-util.d.ts.map +1 -1
  160. package/lib/main/node/temp-dir-util.js +12 -3
  161. package/lib/main/node/temp-dir-util.js.map +1 -1
  162. package/lib/plugin/editors-and-documents.d.ts +1 -1
  163. package/lib/plugin/editors-and-documents.d.ts.map +1 -1
  164. package/lib/plugin/editors-and-documents.js +1 -1
  165. package/lib/plugin/editors-and-documents.js.map +1 -1
  166. package/lib/plugin/notebook/notebook-document.d.ts +62 -0
  167. package/lib/plugin/notebook/notebook-document.d.ts.map +1 -0
  168. package/lib/plugin/notebook/notebook-document.js +373 -0
  169. package/lib/plugin/notebook/notebook-document.js.map +1 -0
  170. package/lib/plugin/notebook/notebook-documents.d.ts +17 -0
  171. package/lib/plugin/notebook/notebook-documents.d.ts.map +1 -0
  172. package/lib/plugin/notebook/notebook-documents.js +48 -0
  173. package/lib/plugin/notebook/notebook-documents.js.map +1 -0
  174. package/lib/plugin/notebook/notebook-editor.d.ts +21 -0
  175. package/lib/plugin/notebook/notebook-editor.d.ts.map +1 -0
  176. package/lib/plugin/notebook/notebook-editor.js +99 -0
  177. package/lib/plugin/notebook/notebook-editor.js.map +1 -0
  178. package/lib/plugin/notebook/notebook-editors.d.ts +14 -0
  179. package/lib/plugin/notebook/notebook-editors.d.ts.map +1 -0
  180. package/lib/plugin/notebook/notebook-editors.js +65 -0
  181. package/lib/plugin/notebook/notebook-editors.js.map +1 -0
  182. package/lib/plugin/notebook/notebook-kernels.d.ts +37 -0
  183. package/lib/plugin/notebook/notebook-kernels.d.ts.map +1 -0
  184. package/lib/plugin/notebook/notebook-kernels.js +516 -0
  185. package/lib/plugin/notebook/notebook-kernels.js.map +1 -0
  186. package/lib/plugin/notebook/notebook-renderers.d.ts +14 -0
  187. package/lib/plugin/notebook/notebook-renderers.d.ts.map +1 -0
  188. package/lib/plugin/notebook/notebook-renderers.js +63 -0
  189. package/lib/plugin/notebook/notebook-renderers.js.map +1 -0
  190. package/lib/plugin/notebook/notebooks.d.ts +57 -0
  191. package/lib/plugin/notebook/notebooks.d.ts.map +1 -0
  192. package/lib/plugin/notebook/notebooks.js +295 -0
  193. package/lib/plugin/notebook/notebooks.js.map +1 -0
  194. package/lib/plugin/plugin-context.d.ts +2 -2
  195. package/lib/plugin/plugin-context.d.ts.map +1 -1
  196. package/lib/plugin/plugin-context.js +79 -59
  197. package/lib/plugin/plugin-context.js.map +1 -1
  198. package/lib/plugin/plugin-manager.d.ts +2 -0
  199. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  200. package/lib/plugin/plugin-manager.js +9 -1
  201. package/lib/plugin/plugin-manager.js.map +1 -1
  202. package/lib/plugin/tasks/task-provider.d.ts +2 -2
  203. package/lib/plugin/tasks/task-provider.d.ts.map +1 -1
  204. package/lib/plugin/tasks/task-provider.js +7 -10
  205. package/lib/plugin/tasks/task-provider.js.map +1 -1
  206. package/lib/plugin/tasks/tasks.d.ts +3 -2
  207. package/lib/plugin/tasks/tasks.d.ts.map +1 -1
  208. package/lib/plugin/tasks/tasks.js +18 -13
  209. package/lib/plugin/tasks/tasks.js.map +1 -1
  210. package/lib/plugin/terminal-ext.d.ts +3 -0
  211. package/lib/plugin/terminal-ext.d.ts.map +1 -1
  212. package/lib/plugin/terminal-ext.js +11 -1
  213. package/lib/plugin/terminal-ext.js.map +1 -1
  214. package/lib/plugin/tree/tree-views.d.ts +15 -5
  215. package/lib/plugin/tree/tree-views.d.ts.map +1 -1
  216. package/lib/plugin/tree/tree-views.js +52 -3
  217. package/lib/plugin/tree/tree-views.js.map +1 -1
  218. package/lib/plugin/type-converters.d.ts +60 -0
  219. package/lib/plugin/type-converters.d.ts.map +1 -1
  220. package/lib/plugin/type-converters.js +372 -13
  221. package/lib/plugin/type-converters.js.map +1 -1
  222. package/lib/plugin/types-impl.d.ts +68 -29
  223. package/lib/plugin/types-impl.d.ts.map +1 -1
  224. package/lib/plugin/types-impl.js +123 -44
  225. package/lib/plugin/types-impl.js.map +1 -1
  226. package/package.json +31 -29
  227. package/src/common/collections.ts +17 -0
  228. package/src/common/errors.ts +26 -0
  229. package/src/common/plugin-api-rpc.ts +340 -5
  230. package/src/common/plugin-protocol.ts +23 -5
  231. package/src/hosted/browser/hosted-plugin.ts +21 -14
  232. package/src/hosted/node/hosted-plugin-deployer-handler.ts +1 -1
  233. package/src/hosted/node/plugin-reader.ts +1 -1
  234. package/src/hosted/node/scanners/grammars-reader.ts +6 -5
  235. package/src/hosted/node/scanners/scanner-theia.ts +55 -41
  236. package/src/main/browser/custom-editors/custom-editor-widget.ts +1 -1
  237. package/src/main/browser/custom-editors/custom-editors-main.ts +1 -1
  238. package/src/main/browser/editors-and-documents-main.ts +1 -0
  239. package/src/main/browser/languages-main.ts +7 -4
  240. package/src/main/browser/main-context.ts +19 -0
  241. package/src/main/browser/menus/menus-contribution-handler.ts +7 -4
  242. package/src/main/browser/notebooks/notebook-documents-and-editors-main.ts +238 -0
  243. package/src/main/browser/notebooks/notebook-documents-main.ts +166 -0
  244. package/src/main/browser/notebooks/notebook-dto.ts +141 -0
  245. package/src/main/browser/notebooks/notebook-editors-main.ts +70 -0
  246. package/src/main/browser/notebooks/notebook-kernels-main.ts +291 -0
  247. package/src/main/browser/notebooks/notebook-renderers-main.ts +47 -0
  248. package/src/main/browser/notebooks/notebooks-main.ts +124 -0
  249. package/src/main/browser/notebooks/renderers/cell-output-webview.tsx +198 -0
  250. package/src/main/browser/notebooks/renderers/output-webview-internal.ts +476 -0
  251. package/src/main/browser/notebooks/renderers/webview-communication.ts +79 -0
  252. package/src/main/browser/plugin-contribution-handler.ts +36 -3
  253. package/src/main/browser/plugin-ext-frontend-module.ts +7 -3
  254. package/src/main/browser/plugin-icon-theme-service.ts +6 -0
  255. package/src/main/browser/plugin-shared-style.ts +2 -1
  256. package/src/main/browser/tasks-main.ts +4 -4
  257. package/src/main/browser/terminal-main.ts +5 -5
  258. package/src/main/browser/view/tree-view-widget.tsx +36 -2
  259. package/src/main/browser/view/tree-views-main.ts +8 -0
  260. package/src/main/browser/webview/webview.ts +6 -0
  261. package/src/main/node/errors.spec.ts +37 -0
  262. package/src/main/node/handlers/plugin-theia-directory-handler.ts +18 -8
  263. package/src/main/node/handlers/plugin-theia-file-handler.ts +18 -6
  264. package/src/main/node/paths/plugin-paths-service.ts +5 -10
  265. package/src/main/node/plugin-deployer-directory-handler-context-impl.ts +8 -8
  266. package/src/main/node/plugin-deployer-entry-impl.ts +9 -7
  267. package/src/main/node/plugin-deployer-impl.ts +20 -28
  268. package/src/main/node/plugin-deployer-proxy-entry-impl.ts +2 -2
  269. package/src/main/node/plugin-github-resolver.ts +15 -8
  270. package/src/main/node/plugin-http-resolver.ts +15 -8
  271. package/src/main/node/temp-dir-util.ts +11 -2
  272. package/src/plugin/editors-and-documents.ts +1 -1
  273. package/src/plugin/notebook/notebook-document.ts +438 -0
  274. package/src/plugin/notebook/notebook-documents.ts +58 -0
  275. package/src/plugin/notebook/notebook-editor.ts +116 -0
  276. package/src/plugin/notebook/notebook-editors.ts +71 -0
  277. package/src/plugin/notebook/notebook-kernels.ts +616 -0
  278. package/src/plugin/notebook/notebook-renderers.ts +72 -0
  279. package/src/plugin/notebook/notebooks.ts +385 -0
  280. package/src/plugin/plugin-context.ts +77 -70
  281. package/src/plugin/plugin-manager.ts +9 -1
  282. package/src/plugin/tasks/task-provider.ts +9 -12
  283. package/src/plugin/tasks/tasks.ts +18 -13
  284. package/src/plugin/terminal-ext.ts +13 -1
  285. package/src/plugin/tree/tree-views.ts +57 -7
  286. package/src/plugin/type-converters.ts +370 -12
  287. package/src/plugin/types-impl.ts +162 -58
  288. package/lib/main/browser/custom-editors/undo-redo-service.d.ts +0 -24
  289. package/lib/main/browser/custom-editors/undo-redo-service.d.ts.map +0 -1
  290. package/lib/main/browser/custom-editors/undo-redo-service.js +0 -111
  291. package/lib/main/browser/custom-editors/undo-redo-service.js.map +0 -1
  292. package/src/main/browser/custom-editors/undo-redo-service.ts +0 -120
@@ -0,0 +1,204 @@
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
+ var __metadata = (this && this.__metadata) || function (k, v) {
28
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
29
+ };
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ exports.CellOutputWebviewImpl = exports.createCellOutputWebviewContainer = void 0;
32
+ const React = require("@theia/core/shared/react");
33
+ const inversify_1 = require("@theia/core/shared/inversify");
34
+ const browser_1 = require("@theia/notebook/lib/browser");
35
+ const uuid_1 = require("uuid");
36
+ const notebook_cell_model_1 = require("@theia/notebook/lib/browser/view-model/notebook-cell-model");
37
+ const webview_1 = require("../../webview/webview");
38
+ const browser_2 = require("@theia/core/lib/browser");
39
+ const output_webview_internal_1 = require("./output-webview-internal");
40
+ const browser_3 = require("@theia/workspace/lib/browser");
41
+ const common_1 = require("@theia/notebook/lib/common");
42
+ const core_1 = require("@theia/core");
43
+ const CellModel = Symbol('CellModel');
44
+ function createCellOutputWebviewContainer(ctx, cell) {
45
+ const child = ctx.createChild();
46
+ child.bind(CellModel).toConstantValue(cell);
47
+ child.bind(CellOutputWebviewImpl).toSelf().inSingletonScope();
48
+ return child;
49
+ }
50
+ exports.createCellOutputWebviewContainer = createCellOutputWebviewContainer;
51
+ let CellOutputWebviewImpl = class CellOutputWebviewImpl {
52
+ constructor() {
53
+ this.id = (0, uuid_1.v4)();
54
+ this.elementRef = React.createRef();
55
+ this.outputPresentationListeners = new core_1.DisposableCollection();
56
+ }
57
+ async init() {
58
+ this.cell.onDidChangeOutputs(outputChange => this.updateOutput(outputChange));
59
+ this.webviewWidget = await this.widgetManager.getOrCreateWidget(webview_1.WebviewWidget.FACTORY_ID, { id: this.id });
60
+ this.webviewWidget.setContentOptions({ allowScripts: true });
61
+ this.webviewWidget.setHTML(await this.createWebviewContent());
62
+ this.webviewWidget.onMessage((message) => {
63
+ this.handleWebviewMessage(message);
64
+ });
65
+ }
66
+ render() {
67
+ return React.createElement("div", { className: 'theia-notebook-cell-output-webview', ref: this.elementRef });
68
+ }
69
+ attachWebview() {
70
+ if (this.elementRef.current) {
71
+ this.webviewWidget.processMessage(new browser_2.Message('before-attach'));
72
+ this.elementRef.current.appendChild(this.webviewWidget.node);
73
+ this.webviewWidget.processMessage(new browser_2.Message('after-attach'));
74
+ this.webviewWidget.setIframeHeight(0);
75
+ }
76
+ }
77
+ isAttached() {
78
+ var _a, _b;
79
+ return (_b = (_a = this.elementRef.current) === null || _a === void 0 ? void 0 : _a.contains(this.webviewWidget.node)) !== null && _b !== void 0 ? _b : false;
80
+ }
81
+ updateOutput(update) {
82
+ if (this.cell.outputs.length > 0) {
83
+ if (this.webviewWidget.isHidden) {
84
+ this.webviewWidget.show();
85
+ }
86
+ this.outputPresentationListeners.dispose();
87
+ this.outputPresentationListeners = new core_1.DisposableCollection();
88
+ for (const output of this.cell.outputs) {
89
+ this.outputPresentationListeners.push(output.onRequestOutputPresentationChange(() => this.requestOutputPresentationUpdate(output)));
90
+ }
91
+ const updateOutputMessage = {
92
+ type: 'outputChanged',
93
+ newOutputs: update.newOutputs.map(output => ({
94
+ id: output.outputId,
95
+ items: output.outputs.map(item => ({ mime: item.mime, data: item.data.buffer })),
96
+ metadata: output.metadata
97
+ })),
98
+ deletedOutputIds: this.cell.outputs.slice(update.start, update.start + update.deleteCount).map(output => output.outputId)
99
+ };
100
+ this.webviewWidget.sendMessage(updateOutputMessage);
101
+ }
102
+ }
103
+ async requestOutputPresentationUpdate(output) {
104
+ const selectedMime = await this.quickPickService.show(output.outputs.map(item => ({ label: item.mime })), { description: core_1.nls.localizeByDefault('Select mimetype to render for current output') });
105
+ if (selectedMime) {
106
+ this.webviewWidget.sendMessage({
107
+ type: 'changePreferredMimetype',
108
+ outputId: output.outputId,
109
+ mimeType: selectedMime.label
110
+ });
111
+ }
112
+ }
113
+ handleWebviewMessage(message) {
114
+ var _a, _b;
115
+ switch (message.type) {
116
+ case 'initialized':
117
+ this.updateOutput({ newOutputs: this.cell.outputs, start: 0, deleteCount: 0 });
118
+ break;
119
+ case 'customRendererMessage':
120
+ this.messagingService.getScoped('').postMessage(message.rendererId, message.message);
121
+ break;
122
+ case 'didRenderOutput':
123
+ this.webviewWidget.setIframeHeight(message.contentHeight + 5);
124
+ break;
125
+ case 'did-scroll-wheel':
126
+ (_b = this.notebookEditorWidgetService.getNotebookEditor(`notebook:${(_a = common_1.CellUri.parse(this.cell.uri)) === null || _a === void 0 ? void 0 : _a.notebook}`)) === null || _b === void 0 ? void 0 : _b.node.scrollBy(message.deltaX, message.deltaY);
127
+ break;
128
+ }
129
+ }
130
+ async createWebviewContent() {
131
+ const isWorkspaceTrusted = await this.workspaceTrustService.getWorkspaceTrust();
132
+ const preloads = this.preloadsScriptString(isWorkspaceTrusted);
133
+ const content = `
134
+ <html>
135
+ <head>
136
+ <meta charset="UTF-8">
137
+ </head>
138
+ <body>
139
+ <script type="module">${preloads}</script>
140
+ </body>
141
+ </html>
142
+ `;
143
+ return content;
144
+ }
145
+ preloadsScriptString(isWorkspaceTrusted) {
146
+ const ctx = {
147
+ isWorkspaceTrusted,
148
+ rendererData: this.notebookRendererRegistry.notebookRenderers,
149
+ renderOptions: {
150
+ lineLimit: 30,
151
+ outputScrolling: false,
152
+ outputWordWrap: false,
153
+ }
154
+ };
155
+ // TS will try compiling `import()` in webviewPreloads, so use a helper function instead
156
+ // of using `import(...)` directly
157
+ return `
158
+ const __import = (x) => import(x);
159
+ (${output_webview_internal_1.outputWebviewPreload})(JSON.parse(decodeURIComponent("${encodeURIComponent(JSON.stringify(ctx))}")))`;
160
+ }
161
+ dispose() {
162
+ this.outputPresentationListeners.dispose();
163
+ this.webviewWidget.dispose();
164
+ }
165
+ };
166
+ __decorate([
167
+ (0, inversify_1.inject)(browser_1.NotebookRendererMessagingService),
168
+ __metadata("design:type", browser_1.NotebookRendererMessagingService)
169
+ ], CellOutputWebviewImpl.prototype, "messagingService", void 0);
170
+ __decorate([
171
+ (0, inversify_1.inject)(CellModel),
172
+ __metadata("design:type", notebook_cell_model_1.NotebookCellModel)
173
+ ], CellOutputWebviewImpl.prototype, "cell", void 0);
174
+ __decorate([
175
+ (0, inversify_1.inject)(browser_2.WidgetManager),
176
+ __metadata("design:type", browser_2.WidgetManager)
177
+ ], CellOutputWebviewImpl.prototype, "widgetManager", void 0);
178
+ __decorate([
179
+ (0, inversify_1.inject)(browser_3.WorkspaceTrustService),
180
+ __metadata("design:type", browser_3.WorkspaceTrustService)
181
+ ], CellOutputWebviewImpl.prototype, "workspaceTrustService", void 0);
182
+ __decorate([
183
+ (0, inversify_1.inject)(browser_1.NotebookRendererRegistry),
184
+ __metadata("design:type", browser_1.NotebookRendererRegistry)
185
+ ], CellOutputWebviewImpl.prototype, "notebookRendererRegistry", void 0);
186
+ __decorate([
187
+ (0, inversify_1.inject)(browser_1.NotebookEditorWidgetService),
188
+ __metadata("design:type", browser_1.NotebookEditorWidgetService)
189
+ ], CellOutputWebviewImpl.prototype, "notebookEditorWidgetService", void 0);
190
+ __decorate([
191
+ (0, inversify_1.inject)(core_1.QuickPickService),
192
+ __metadata("design:type", Object)
193
+ ], CellOutputWebviewImpl.prototype, "quickPickService", void 0);
194
+ __decorate([
195
+ (0, inversify_1.postConstruct)(),
196
+ __metadata("design:type", Function),
197
+ __metadata("design:paramtypes", []),
198
+ __metadata("design:returntype", Promise)
199
+ ], CellOutputWebviewImpl.prototype, "init", null);
200
+ CellOutputWebviewImpl = __decorate([
201
+ (0, inversify_1.injectable)()
202
+ ], CellOutputWebviewImpl);
203
+ exports.CellOutputWebviewImpl = CellOutputWebviewImpl;
204
+ //# sourceMappingURL=cell-output-webview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cell-output-webview.js","sourceRoot":"","sources":["../../../../../src/main/browser/notebooks/renderers/cell-output-webview.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,g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AO,OAAO,CAAC;IACnB,CAAC;IAEO,oBAAoB,CAAC,kBAA2B;QACpD,MAAM,GAAG,GAAmB;YACxB,kBAAkB;YAClB,YAAY,EAAE,IAAI,CAAC,wBAAwB,CAAC,iBAAiB;YAC7D,aAAa,EAAE;gBACX,SAAS,EAAE,EAAE;gBACb,eAAe,EAAE,KAAK;gBACtB,cAAc,EAAE,KAAK;aACxB;SACJ,CAAC;QACF,wFAAwF;QACxF,kCAAkC;QAClC,OAAO;;eAEA,8CAAoB,oCAAoC,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;IACjH,CAAC;IAED,OAAO;QACH,IAAI,CAAC,2BAA2B,CAAC,OAAO,EAAE,CAAC;QAC3C,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;IACjC,CAAC;CACJ,CAAA;AAtJG;IADC,IAAA,kBAAM,EAAC,0CAAgC,CAAC;8BACJ,0CAAgC;+DAAC;AAGtE;IADC,IAAA,kBAAM,EAAC,SAAS,CAAC;8BACO,uCAAiB;mDAAC;AAG3C;IADC,IAAA,kBAAM,EAAC,uBAAa,CAAC;8BACY,uBAAa;4DAAC;AAGhD;IADC,IAAA,kBAAM,EAAC,+BAAqB,CAAC;8BACY,+BAAqB;oEAAC;AAGhE;IADC,IAAA,kBAAM,EAAC,kCAAwB,CAAC;8BACY,kCAAwB;uEAAC;AAGtE;IADC,IAAA,kBAAM,EAAC,qCAA2B,CAAC;8BACY,qCAA2B;0EAAC;AAG5E;IADC,IAAA,kBAAM,EAAC,uBAAgB,CAAC;;+DAC6B;AAUtD;IADC,IAAA,yBAAa,GAAE;;;;iDAWf;AAzCQ,qBAAqB;IADjC,IAAA,sBAAU,GAAE;GACA,qBAAqB,CAyJjC;AAzJY,sDAAqB"}
@@ -0,0 +1,13 @@
1
+ import type * as webviewCommunication from './webview-communication';
2
+ export interface RenderOptions {
3
+ readonly lineLimit: number;
4
+ readonly outputScrolling: boolean;
5
+ readonly outputWordWrap: boolean;
6
+ }
7
+ export interface PreloadContext {
8
+ readonly isWorkspaceTrusted: boolean;
9
+ readonly rendererData: readonly webviewCommunication.RendererMetadata[];
10
+ readonly renderOptions: RenderOptions;
11
+ }
12
+ export declare function outputWebviewPreload(ctx: PreloadContext): Promise<void>;
13
+ //# sourceMappingURL=output-webview-internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output-webview-internal.d.ts","sourceRoot":"","sources":["../../../../../src/main/browser/notebooks/renderers/output-webview-internal.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,KAAK,oBAAoB,MAAM,yBAAyB,CAAC;AA6BrE,MAAM,WAAW,aAAa;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CACpC;AAED,MAAM,WAAW,cAAc;IAC3B,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,SAAS,oBAAoB,CAAC,gBAAgB,EAAE,CAAC;IACxE,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;CACzC;AAED,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA6Z7E"}
@@ -0,0 +1,375 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.outputWebviewPreload = void 0;
23
+ ;
24
+ ;
25
+ async function outputWebviewPreload(ctx) {
26
+ const theia = acquireVsCodeApi();
27
+ const renderFallbackErrorName = 'vscode.fallbackToNextRenderer';
28
+ function createEmitter(listenerChange = () => undefined) {
29
+ const listeners = new Set();
30
+ return {
31
+ fire(data) {
32
+ for (const listener of [...listeners]) {
33
+ listener.fn.call(listener.thisArg, data);
34
+ }
35
+ },
36
+ event(fn, thisArg, disposables) {
37
+ const listenerObj = { fn, thisArg };
38
+ const disposable = {
39
+ dispose: () => {
40
+ listeners.delete(listenerObj);
41
+ listenerChange(listeners);
42
+ },
43
+ };
44
+ listeners.add(listenerObj);
45
+ listenerChange(listeners);
46
+ if (disposables) {
47
+ if ('push' in disposables) {
48
+ disposables.push(disposable);
49
+ }
50
+ else {
51
+ disposables.add(disposable);
52
+ }
53
+ }
54
+ return disposable;
55
+ }
56
+ };
57
+ }
58
+ ;
59
+ const settingChange = createEmitter();
60
+ class Output {
61
+ constructor(output, items) {
62
+ this.element = document.createElement('div');
63
+ // padding for scrollbars
64
+ this.element.style.paddingBottom = '10px';
65
+ this.element.style.paddingRight = '10px';
66
+ this.element.id = output.id;
67
+ document.body.appendChild(this.element);
68
+ this.allItems = items;
69
+ }
70
+ findItemToRender(preferredMimetype) {
71
+ var _a;
72
+ if (preferredMimetype) {
73
+ const itemToRender = this.allItems.find(item => item.mime === preferredMimetype);
74
+ if (itemToRender) {
75
+ return itemToRender;
76
+ }
77
+ }
78
+ return (_a = this.renderedItem) !== null && _a !== void 0 ? _a : this.allItems[0];
79
+ }
80
+ clear() {
81
+ var _a, _b, _c;
82
+ (_b = (_a = this.renderer) === null || _a === void 0 ? void 0 : _a.disposeOutputItem) === null || _b === void 0 ? void 0 : _b.call(_a, (_c = this.renderedItem) === null || _c === void 0 ? void 0 : _c.id);
83
+ this.element.innerHTML = '';
84
+ }
85
+ }
86
+ const outputs = new Map();
87
+ class Renderer {
88
+ constructor(data) {
89
+ this.data = data;
90
+ this.onMessageEvent = createEmitter();
91
+ }
92
+ receiveMessage(message) {
93
+ this.onMessageEvent.fire(message);
94
+ }
95
+ disposeOutputItem(id) {
96
+ var _a, _b;
97
+ (_b = (_a = this.rendererApi) === null || _a === void 0 ? void 0 : _a.disposeOutputItem) === null || _b === void 0 ? void 0 : _b.call(_a, id);
98
+ }
99
+ async getOrLoad() {
100
+ if (this.rendererApi) {
101
+ return this.rendererApi;
102
+ }
103
+ const rendererModule = await __import(this.data.entrypoint.uri);
104
+ this.rendererApi = await rendererModule.activate(this.createRendererContext());
105
+ return this.rendererApi;
106
+ }
107
+ createRendererContext() {
108
+ const context = {
109
+ setState: newState => theia.setState({ ...theia.getState(), [this.data.id]: newState }),
110
+ getState: () => {
111
+ const state = theia.getState();
112
+ return typeof state === 'object' && state ? state[this.data.id] : undefined;
113
+ },
114
+ getRenderer: async (id) => {
115
+ const renderer = renderers.getRenderer(id);
116
+ if (!renderer) {
117
+ return undefined;
118
+ }
119
+ if (renderer.rendererApi) {
120
+ return renderer.rendererApi;
121
+ }
122
+ return renderer.getOrLoad();
123
+ },
124
+ workspace: {
125
+ get isTrusted() { return true; } // TODO use Workspace trust service
126
+ },
127
+ settings: {
128
+ get lineLimit() { return ctx.renderOptions.lineLimit; },
129
+ get outputScrolling() { return ctx.renderOptions.outputScrolling; },
130
+ get outputWordWrap() { return ctx.renderOptions.outputWordWrap; },
131
+ },
132
+ get onDidChangeSettings() { return settingChange.event; },
133
+ };
134
+ if (this.data.requiresMessaging) {
135
+ context.onDidReceiveMessage = this.onMessageEvent.event;
136
+ context.postMessage = message => theia.postMessage({ type: 'customRendererMessage', rendererId: this.data.id, message });
137
+ }
138
+ return Object.freeze(context);
139
+ }
140
+ }
141
+ const renderers = new class {
142
+ constructor() {
143
+ this.renderers = new Map();
144
+ for (const renderer of ctx.rendererData) {
145
+ this.addRenderer(renderer);
146
+ }
147
+ }
148
+ getRenderer(id) {
149
+ return this.renderers.get(id);
150
+ }
151
+ rendererEqual(a, b) {
152
+ if (a.id !== b.id || a.entrypoint.uri !== b.entrypoint.uri || a.entrypoint.extends !== b.entrypoint.extends || a.requiresMessaging !== b.requiresMessaging) {
153
+ return false;
154
+ }
155
+ if (a.mimeTypes.length !== b.mimeTypes.length) {
156
+ return false;
157
+ }
158
+ for (let i = 0; i < a.mimeTypes.length; i++) {
159
+ if (a.mimeTypes[i] !== b.mimeTypes[i]) {
160
+ return false;
161
+ }
162
+ }
163
+ return true;
164
+ }
165
+ updateRendererData(rendererData) {
166
+ const oldKeys = new Set(this.renderers.keys());
167
+ const newKeys = new Set(rendererData.map(d => d.id));
168
+ for (const renderer of rendererData) {
169
+ const existing = this.renderers.get(renderer.id);
170
+ if (existing && this.rendererEqual(existing.data, renderer)) {
171
+ continue;
172
+ }
173
+ this.addRenderer(renderer);
174
+ }
175
+ for (const key of oldKeys) {
176
+ if (!newKeys.has(key)) {
177
+ this.renderers.delete(key);
178
+ }
179
+ }
180
+ }
181
+ addRenderer(renderer) {
182
+ this.renderers.set(renderer.id, new Renderer(renderer));
183
+ }
184
+ clearAll() {
185
+ for (const renderer of this.renderers.values()) {
186
+ renderer.disposeOutputItem();
187
+ }
188
+ }
189
+ clearOutput(rendererId, outputId) {
190
+ var _a;
191
+ // outputRunner.cancelOutput(outputId);
192
+ (_a = this.renderers.get(rendererId)) === null || _a === void 0 ? void 0 : _a.disposeOutputItem(outputId);
193
+ }
194
+ async render(output, preferredMimeType, preferredRendererId, signal) {
195
+ const item = output.findItemToRender(preferredMimeType);
196
+ const primaryRenderer = this.findRenderer(preferredRendererId, item);
197
+ if (!primaryRenderer) {
198
+ this.showRenderError(item, output.element, 'No renderer found for output type.');
199
+ return;
200
+ }
201
+ // Try primary renderer first
202
+ if (!(await this.doRender(item, output.element, primaryRenderer, signal)).continue) {
203
+ output.renderer = primaryRenderer;
204
+ this.onRenderCompleted();
205
+ return;
206
+ }
207
+ // Primary renderer failed in an expected way. Fallback to render the next mime types
208
+ for (const additionalItem of output.allItems) {
209
+ if (additionalItem.mime === item.mime) {
210
+ continue;
211
+ }
212
+ if (signal.aborted) {
213
+ return;
214
+ }
215
+ if (additionalItem) {
216
+ const renderer = this.findRenderer(undefined, additionalItem);
217
+ if (renderer) {
218
+ if (!(await this.doRender(additionalItem, output.element, renderer, signal)).continue) {
219
+ output.renderer = renderer;
220
+ this.onRenderCompleted();
221
+ return; // We rendered successfully
222
+ }
223
+ }
224
+ }
225
+ }
226
+ // All renderers have failed and there is nothing left to fallback to
227
+ this.showRenderError(item, output.element, 'No fallback renderers found or all fallback renderers failed.');
228
+ }
229
+ onRenderCompleted() {
230
+ // we need to check for all images are loaded. Otherwise we can't determine the correct height of the output
231
+ const images = Array.from(document.images);
232
+ if (images.length > 0) {
233
+ Promise.all(images.filter(img => !img.complete).map(img => new Promise(resolve => { img.onload = img.onerror = resolve; }))).then(() => theia.postMessage({ type: 'didRenderOutput', contentHeight: document.body.clientHeight }));
234
+ }
235
+ else {
236
+ theia.postMessage({ type: 'didRenderOutput', contentHeight: document.body.clientHeight });
237
+ }
238
+ }
239
+ async doRender(item, element, renderer, signal) {
240
+ var _a;
241
+ try {
242
+ (_a = (await renderer.getOrLoad())) === null || _a === void 0 ? void 0 : _a.renderOutputItem(item, element, signal);
243
+ return { continue: false }; // We rendered successfully
244
+ }
245
+ catch (e) {
246
+ if (signal.aborted) {
247
+ return { continue: false };
248
+ }
249
+ if (e instanceof Error && e.name === renderFallbackErrorName) {
250
+ return { continue: true };
251
+ }
252
+ else {
253
+ throw e; // Bail and let callers handle unknown errors
254
+ }
255
+ }
256
+ }
257
+ findRenderer(preferredRendererId, info) {
258
+ let foundRenderer;
259
+ if (typeof preferredRendererId === 'string') {
260
+ foundRenderer = Array.from(this.renderers.values())
261
+ .find(renderer => renderer.data.id === preferredRendererId);
262
+ }
263
+ else {
264
+ const rendererList = Array.from(this.renderers.values())
265
+ .filter(renderer => renderer.data.mimeTypes.includes(info.mime) && !renderer.data.entrypoint.extends);
266
+ if (rendererList.length) {
267
+ // De-prioritize built-in renderers
268
+ // rendererList.sort((a, b) => +a.data.isBuiltin - +b.data.isBuiltin);
269
+ // Use first renderer we find in sorted list
270
+ foundRenderer = rendererList[0];
271
+ }
272
+ }
273
+ return foundRenderer;
274
+ }
275
+ showRenderError(info, element, errorMessage) {
276
+ const errorContainer = document.createElement('div');
277
+ const error = document.createElement('div');
278
+ error.className = 'no-renderer-error';
279
+ error.innerText = errorMessage;
280
+ const cellText = document.createElement('div');
281
+ cellText.innerText = info.text();
282
+ errorContainer.appendChild(error);
283
+ errorContainer.appendChild(cellText);
284
+ element.innerText = '';
285
+ element.appendChild(errorContainer);
286
+ }
287
+ }();
288
+ function clearOutput(outputId) {
289
+ var _a;
290
+ (_a = outputs.get(outputId)) === null || _a === void 0 ? void 0 : _a.clear();
291
+ outputs.delete(outputId);
292
+ }
293
+ function outputsChanged(changedEvent) {
294
+ var _a, _b;
295
+ for (const outputId of (_a = changedEvent.deletedOutputIds) !== null && _a !== void 0 ? _a : []) {
296
+ clearOutput(outputId);
297
+ }
298
+ for (const outputData of (_b = changedEvent.newOutputs) !== null && _b !== void 0 ? _b : []) {
299
+ const apiItems = outputData.items.map((item, index) => ({
300
+ id: `${outputData.id}-${index}`,
301
+ mime: item.mime,
302
+ metadata: outputData.metadata,
303
+ data() {
304
+ return item.data;
305
+ },
306
+ text() {
307
+ return new TextDecoder().decode(this.data());
308
+ },
309
+ json() {
310
+ return JSON.parse(this.text());
311
+ },
312
+ blob() {
313
+ return new Blob([this.data()], { type: this.mime });
314
+ },
315
+ }));
316
+ const output = new Output(outputData, apiItems);
317
+ outputs.set(outputData.id, output);
318
+ renderers.render(output, undefined, undefined, new AbortController().signal);
319
+ }
320
+ }
321
+ function scrollParent(event) {
322
+ for (let node = event.target; node; node = node.parentNode) {
323
+ if (!(node instanceof Element)) {
324
+ continue;
325
+ }
326
+ // scroll up
327
+ if (event.deltaY < 0 && node.scrollTop > 0) {
328
+ // there is still some content to scroll
329
+ return false;
330
+ }
331
+ // scroll down
332
+ if (event.deltaY > 0 && node.scrollTop + node.clientHeight < node.scrollHeight) {
333
+ // per https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight
334
+ // scrollTop is not rounded but scrollHeight and clientHeight are
335
+ // so we need to check if the difference is less than some threshold
336
+ if (node.scrollHeight - node.scrollTop - node.clientHeight > 2) {
337
+ return false;
338
+ }
339
+ }
340
+ }
341
+ return true;
342
+ }
343
+ const handleWheel = (event) => {
344
+ if (scrollParent(event)) {
345
+ theia.postMessage({
346
+ type: 'did-scroll-wheel',
347
+ deltaY: event.deltaY,
348
+ deltaX: event.deltaX,
349
+ });
350
+ }
351
+ };
352
+ window.addEventListener('message', async (rawEvent) => {
353
+ var _a;
354
+ const event = rawEvent;
355
+ switch (event.data.type) {
356
+ case 'updateRenderers':
357
+ renderers.updateRendererData(event.data.rendererData);
358
+ break;
359
+ case 'outputChanged':
360
+ outputsChanged(event.data);
361
+ break;
362
+ case 'customRendererMessage':
363
+ (_a = renderers.getRenderer(event.data.rendererId)) === null || _a === void 0 ? void 0 : _a.receiveMessage(event.data.message);
364
+ break;
365
+ case 'changePreferredMimetype':
366
+ clearOutput(event.data.outputId);
367
+ renderers.render(outputs.get(event.data.outputId), event.data.mimeType, undefined, new AbortController().signal);
368
+ break;
369
+ }
370
+ });
371
+ window.addEventListener('wheel', handleWheel);
372
+ theia.postMessage({ type: 'initialized' });
373
+ }
374
+ exports.outputWebviewPreload = outputWebviewPreload;
375
+ //# sourceMappingURL=output-webview-internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output-webview-internal.js","sourceRoot":"","sources":["../../../../../src/main/browser/notebooks/renderers/output-web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