@difizen/libro-core 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (305) hide show
  1. package/es/add-cell/index.less +1 -1
  2. package/es/add-cell/libro-add-cell-slot-contribution.d.ts +1 -2
  3. package/es/add-cell/libro-add-cell-slot-contribution.d.ts.map +1 -1
  4. package/es/add-cell/libro-add-cell-slot-contribution.js +12 -6
  5. package/es/add-cell/libro-add-cell-view.d.ts +4 -4
  6. package/es/add-cell/libro-add-cell-view.d.ts.map +1 -1
  7. package/es/add-cell/libro-add-cell-view.js +4 -6
  8. package/es/cell/libro-cell-contribution.d.ts +1 -2
  9. package/es/cell/libro-cell-contribution.d.ts.map +1 -1
  10. package/es/cell/libro-cell-contribution.js +14 -8
  11. package/es/cell/libro-cell-model.d.ts +9 -0
  12. package/es/cell/libro-cell-model.d.ts.map +1 -1
  13. package/es/cell/libro-cell-model.js +53 -11
  14. package/es/cell/libro-cell-protocol.d.ts +2 -0
  15. package/es/cell/libro-cell-protocol.d.ts.map +1 -1
  16. package/es/cell/libro-cell-view.d.ts +39 -3
  17. package/es/cell/libro-cell-view.d.ts.map +1 -1
  18. package/es/cell/libro-cell-view.js +54 -24
  19. package/es/cell/libro-edit-cell-view.d.ts +6 -12
  20. package/es/cell/libro-edit-cell-view.d.ts.map +1 -1
  21. package/es/cell/libro-edit-cell-view.js +9 -4
  22. package/es/cell/libro-executable-cell-view.d.ts +2 -0
  23. package/es/cell/libro-executable-cell-view.d.ts.map +1 -1
  24. package/es/cell/libro-executable-cell-view.js +4 -1
  25. package/es/collapse-service.d.ts +1 -1
  26. package/es/collapse-service.d.ts.map +1 -1
  27. package/es/collapse-service.js +1 -1
  28. package/es/command/document-commands.d.ts +5 -0
  29. package/es/command/document-commands.d.ts.map +1 -0
  30. package/es/command/document-commands.js +3 -2
  31. package/es/command/kernel-command.d.ts +5 -0
  32. package/es/command/kernel-command.d.ts.map +1 -0
  33. package/es/command/kernel-command.js +3 -0
  34. package/es/command/libro-command-contribution.d.ts +0 -1
  35. package/es/command/libro-command-contribution.d.ts.map +1 -1
  36. package/es/command/libro-command-contribution.js +179 -129
  37. package/es/command/libro-command-register.d.ts +0 -1
  38. package/es/command/libro-command-register.d.ts.map +1 -1
  39. package/es/command/libro-command-register.js +13 -7
  40. package/es/command/notebook-commands.d.ts +6 -0
  41. package/es/command/notebook-commands.d.ts.map +1 -0
  42. package/es/command/notebook-commands.js +17 -4
  43. package/es/components/cell-protocol.d.ts +5 -5
  44. package/es/components/cell-protocol.d.ts.map +1 -1
  45. package/es/components/dnd-cell-item-render.d.ts +6 -2
  46. package/es/components/dnd-cell-item-render.d.ts.map +1 -1
  47. package/es/components/dnd-cell-item-render.js +194 -89
  48. package/es/components/dnd-component/custom-drag-layer.d.ts +1 -1
  49. package/es/components/dnd-component/custom-drag-layer.d.ts.map +1 -1
  50. package/es/components/dnd-component/custom-drag-layer.js +3 -4
  51. package/es/components/dnd-component/default-dnd-content.d.ts +2 -1
  52. package/es/components/dnd-component/default-dnd-content.d.ts.map +1 -1
  53. package/es/components/dnd-component/default-dnd-content.js +100 -44
  54. package/es/components/dnd-component/dnd-context.js +1 -1
  55. package/es/components/dnd-component/dnd-list.d.ts +9 -5
  56. package/es/components/dnd-component/dnd-list.d.ts.map +1 -1
  57. package/es/components/dnd-component/dnd-list.js +93 -26
  58. package/es/components/dnd-component/index.d.ts +1 -1
  59. package/es/components/dnd-component/index.d.ts.map +1 -1
  60. package/es/components/dnd-component/index.js +2 -2
  61. package/es/components/dnd-component/index.less +8 -0
  62. package/es/components/dnd-component/overscanIndices-getter.d.ts +22 -0
  63. package/es/components/dnd-component/overscanIndices-getter.d.ts.map +1 -0
  64. package/es/components/dnd-component/overscanIndices-getter.js +58 -0
  65. package/es/components/dnd-component/virtualized-manager.d.ts +19 -0
  66. package/es/components/dnd-component/virtualized-manager.d.ts.map +1 -0
  67. package/es/components/dnd-component/virtualized-manager.js +60 -0
  68. package/es/components/index.d.ts +2 -2
  69. package/es/components/index.d.ts.map +1 -1
  70. package/es/components/index.js +2 -2
  71. package/es/components/libro-virtualized-render.d.ts +15 -0
  72. package/es/components/libro-virtualized-render.d.ts.map +1 -0
  73. package/es/components/libro-virtualized-render.js +174 -0
  74. package/es/content/index.d.ts +1 -0
  75. package/es/content/index.d.ts.map +1 -1
  76. package/es/content/index.js +2 -1
  77. package/es/content/libro-content-contribution.d.ts +2 -2
  78. package/es/content/libro-content-contribution.d.ts.map +1 -1
  79. package/es/content/libro-content-contribution.js +2 -3
  80. package/es/content/libro-content-module.d.ts.map +1 -1
  81. package/es/content/libro-content-module.js +3 -2
  82. package/es/content/libro-content-protocol.d.ts +5 -0
  83. package/es/content/libro-content-protocol.d.ts.map +1 -1
  84. package/es/content/libro-content-protocol.js +2 -1
  85. package/es/content/libro-content-service.d.ts +6 -4
  86. package/es/content/libro-content-service.d.ts.map +1 -1
  87. package/es/content/libro-content-service.js +36 -8
  88. package/es/content/libro-save-content-contribution.d.ts +6 -0
  89. package/es/content/libro-save-content-contribution.d.ts.map +1 -0
  90. package/es/content/libro-save-content-contribution.js +27 -0
  91. package/es/formatter/index.d.ts +6 -0
  92. package/es/formatter/index.d.ts.map +1 -0
  93. package/es/formatter/index.js +5 -0
  94. package/es/formatter/libro-formatter-json-contribution.d.ts +18 -0
  95. package/es/formatter/libro-formatter-json-contribution.d.ts.map +1 -0
  96. package/es/formatter/libro-formatter-json-contribution.js +41 -0
  97. package/es/formatter/libro-formatter-manager.d.ts +16 -0
  98. package/es/formatter/libro-formatter-manager.d.ts.map +1 -0
  99. package/es/formatter/libro-formatter-manager.js +86 -0
  100. package/es/formatter/libro-formatter-module.d.ts +3 -0
  101. package/es/formatter/libro-formatter-module.d.ts.map +1 -0
  102. package/es/formatter/libro-formatter-module.js +7 -0
  103. package/es/formatter/libro-formatter-protocol.d.ts +37 -0
  104. package/es/formatter/libro-formatter-protocol.d.ts.map +1 -0
  105. package/es/formatter/libro-formatter-protocol.js +18 -0
  106. package/es/formatter/libro-formatter-string-contribution.d.ts +18 -0
  107. package/es/formatter/libro-formatter-string-contribution.d.ts.map +1 -0
  108. package/es/formatter/libro-formatter-string-contribution.js +41 -0
  109. package/es/formatter/libro-formatter-trans-default-contribution.d.ts +7 -0
  110. package/es/formatter/libro-formatter-trans-default-contribution.d.ts.map +1 -0
  111. package/es/formatter/libro-formatter-trans-default-contribution.js +19 -0
  112. package/es/index.d.ts +5 -1
  113. package/es/index.d.ts.map +1 -1
  114. package/es/index.js +6 -2
  115. package/es/index.less +135 -58
  116. package/es/libro-context-key.d.ts.map +1 -1
  117. package/es/libro-keybind-registry.d.ts +5 -0
  118. package/es/libro-keybind-registry.d.ts.map +1 -0
  119. package/es/libro-model.d.ts +13 -2
  120. package/es/libro-model.d.ts.map +1 -1
  121. package/es/libro-model.js +149 -70
  122. package/es/libro-protocol.d.ts +44 -2
  123. package/es/libro-protocol.d.ts.map +1 -1
  124. package/es/libro-protocol.js +16 -3
  125. package/es/libro-service.d.ts +1 -1
  126. package/es/libro-service.d.ts.map +1 -1
  127. package/es/libro-service.js +29 -20
  128. package/es/libro-setting-contribution.d.ts +5 -0
  129. package/es/libro-setting-contribution.d.ts.map +1 -0
  130. package/es/{configuration/libro-configuration-contribution.js → libro-setting-contribution.js} +8 -9
  131. package/es/libro-setting.d.ts +11 -0
  132. package/es/libro-setting.d.ts.map +1 -0
  133. package/es/{configuration/libro-configuration.js → libro-setting.js} +17 -7
  134. package/es/libro-view.d.ts +21 -8
  135. package/es/libro-view.d.ts.map +1 -1
  136. package/es/libro-view.js +477 -338
  137. package/es/material-from-designer.d.ts +30 -0
  138. package/es/material-from-designer.d.ts.map +1 -0
  139. package/es/material-from-designer.js +112 -1
  140. package/es/module.d.ts.map +1 -1
  141. package/es/module.js +20 -5
  142. package/es/output/output-area.d.ts +3 -4
  143. package/es/output/output-area.d.ts.map +1 -1
  144. package/es/output/output-area.js +23 -16
  145. package/es/output/output-contribution.d.ts +0 -1
  146. package/es/output/output-contribution.d.ts.map +1 -1
  147. package/es/output/output-contribution.js +14 -9
  148. package/es/output/output-model.d.ts +2 -2
  149. package/es/output/output-model.d.ts.map +1 -1
  150. package/es/output/output-model.js +2 -2
  151. package/es/output/output-protocol.d.ts.map +1 -1
  152. package/es/output/output-protocol.js +0 -2
  153. package/es/settings/index.d.ts +5 -0
  154. package/es/settings/index.d.ts.map +1 -0
  155. package/es/settings/index.js +4 -0
  156. package/es/settings/index.less +3 -0
  157. package/es/settings/module.d.ts +3 -0
  158. package/es/settings/module.d.ts.map +1 -0
  159. package/es/settings/module.js +4 -0
  160. package/es/settings/setting-editor/configuration-panel-view.d.ts +13 -0
  161. package/es/settings/setting-editor/configuration-panel-view.d.ts.map +1 -0
  162. package/es/settings/setting-editor/configuration-panel-view.js +115 -0
  163. package/es/settings/setting-editor/configuration-render-contribution.d.ts +6 -0
  164. package/es/settings/setting-editor/configuration-render-contribution.d.ts.map +1 -0
  165. package/es/settings/setting-editor/configuration-render-contribution.js +77 -0
  166. package/es/settings/setting-editor/default-node-render.d.ts +9 -0
  167. package/es/settings/setting-editor/default-node-render.d.ts.map +1 -0
  168. package/es/settings/setting-editor/default-node-render.js +79 -0
  169. package/es/settings/setting-editor/index.d.ts +7 -0
  170. package/es/settings/setting-editor/index.d.ts.map +1 -0
  171. package/es/settings/setting-editor/index.js +6 -0
  172. package/es/settings/setting-editor/index.less +12 -0
  173. package/es/settings/setting-editor/module.d.ts +3 -0
  174. package/es/settings/setting-editor/module.d.ts.map +1 -0
  175. package/es/settings/setting-editor/module.js +7 -0
  176. package/es/settings/setting-editor/setting-editor-view.d.ts +15 -0
  177. package/es/settings/setting-editor/setting-editor-view.d.ts.map +1 -0
  178. package/es/settings/setting-editor/setting-editor-view.js +169 -0
  179. package/es/settings/setting-editor/setting-tree-service.d.ts +9 -0
  180. package/es/settings/setting-editor/setting-tree-service.d.ts.map +1 -0
  181. package/es/settings/setting-editor/setting-tree-service.js +118 -0
  182. package/es/settings/setting-editor/setting-tree-view.d.ts +19 -0
  183. package/es/settings/setting-editor/setting-tree-view.d.ts.map +1 -0
  184. package/es/settings/setting-editor/setting-tree-view.js +88 -0
  185. package/es/settings/settings-contribution.d.ts +7 -0
  186. package/es/settings/settings-contribution.d.ts.map +1 -0
  187. package/es/settings/settings-contribution.js +36 -0
  188. package/es/settings/settings-modal.d.ts +5 -0
  189. package/es/settings/settings-modal.d.ts.map +1 -0
  190. package/es/settings/settings-modal.js +53 -0
  191. package/es/settings/settings-modal.less +3 -0
  192. package/es/settings/settings-protocol.d.ts +4 -0
  193. package/es/settings/settings-protocol.d.ts.map +1 -0
  194. package/es/settings/settings-protocol.js +5 -0
  195. package/es/slot/libro-slot-manager.d.ts +2 -2
  196. package/es/slot/libro-slot-manager.d.ts.map +1 -1
  197. package/es/slot/libro-slot-manager.js +14 -8
  198. package/es/slot/libro-slot-view.d.ts +3 -3
  199. package/es/slot/libro-slot-view.d.ts.map +1 -1
  200. package/es/slot/libro-slot-view.js +2 -2
  201. package/es/theme/libro-color-registry.d.ts +6 -0
  202. package/es/theme/libro-color-registry.d.ts.map +1 -0
  203. package/es/theme/libro-color-registry.js +7 -0
  204. package/es/toolbar/all-outputs-scroll-icon.d.ts +3 -0
  205. package/es/toolbar/all-outputs-scroll-icon.d.ts.map +1 -0
  206. package/es/toolbar/all-outputs-scroll-icon.js +10 -0
  207. package/es/toolbar/libro-toolbar.d.ts +2 -1
  208. package/es/toolbar/libro-toolbar.d.ts.map +1 -1
  209. package/es/toolbar/libro-toolbar.js +44 -8
  210. package/es/toolbar/restart-clear-outputs-modal.d.ts +1 -2
  211. package/es/toolbar/restart-clear-outputs-modal.d.ts.map +1 -1
  212. package/es/toolbar/restart-clear-outputs-modal.js +2 -2
  213. package/es/toolbar/shutdown-modal.d.ts +1 -2
  214. package/es/toolbar/shutdown-modal.d.ts.map +1 -1
  215. package/es/toolbar/shutdown-modal.js +2 -2
  216. package/es/toolbar/side-toolar-more-select.d.ts.map +1 -1
  217. package/es/toolbar/side-toolar-more-select.js +2 -2
  218. package/es/virtualized-manager-helper.d.ts +11 -0
  219. package/es/virtualized-manager-helper.d.ts.map +1 -0
  220. package/es/virtualized-manager-helper.js +51 -0
  221. package/es/virtualized-manager.d.ts +19 -0
  222. package/es/virtualized-manager.d.ts.map +1 -0
  223. package/es/virtualized-manager.js +61 -0
  224. package/package.json +9 -6
  225. package/src/add-cell/index.less +1 -1
  226. package/src/add-cell/libro-add-cell-slot-contribution.ts +1 -4
  227. package/src/add-cell/libro-add-cell-view.tsx +13 -6
  228. package/src/cell/libro-cell-contribution.ts +2 -6
  229. package/src/cell/libro-cell-model.ts +57 -4
  230. package/src/cell/libro-cell-protocol.ts +2 -0
  231. package/src/cell/libro-cell-view.tsx +21 -9
  232. package/src/cell/libro-edit-cell-view.tsx +10 -9
  233. package/src/cell/libro-executable-cell-view.ts +6 -1
  234. package/src/collapse-service.ts +1 -1
  235. package/src/command/document-commands.ts +3 -5
  236. package/src/command/kernel-command.ts +3 -0
  237. package/src/command/libro-command-contribution.ts +107 -91
  238. package/src/command/libro-command-register.ts +1 -4
  239. package/src/command/notebook-commands.ts +16 -3
  240. package/src/components/cell-protocol.ts +5 -5
  241. package/src/components/dnd-cell-item-render.tsx +239 -92
  242. package/src/components/dnd-component/custom-drag-layer.tsx +5 -6
  243. package/src/components/dnd-component/default-dnd-content.tsx +113 -42
  244. package/src/components/dnd-component/dnd-context.tsx +1 -1
  245. package/src/components/dnd-component/dnd-list.tsx +135 -43
  246. package/src/components/dnd-component/index.less +8 -0
  247. package/src/components/dnd-component/index.tsx +1 -1
  248. package/src/components/dnd-component/overscanIndices-getter.ts +92 -0
  249. package/src/components/dnd-component/virtualized-manager.ts +34 -0
  250. package/src/components/index.ts +2 -2
  251. package/src/components/libro-virtualized-render.tsx +178 -0
  252. package/src/content/index.ts +1 -0
  253. package/src/content/libro-content-contribution.ts +2 -3
  254. package/src/content/libro-content-module.ts +11 -3
  255. package/src/content/libro-content-protocol.ts +6 -0
  256. package/src/content/libro-content-service.ts +26 -8
  257. package/src/content/libro-save-content-contribution.ts +12 -0
  258. package/src/formatter/index.ts +5 -0
  259. package/src/formatter/libro-formatter-json-contribution.ts +42 -0
  260. package/src/formatter/libro-formatter-manager.ts +85 -0
  261. package/src/formatter/libro-formatter-module.ts +19 -0
  262. package/src/formatter/libro-formatter-protocol.ts +63 -0
  263. package/src/formatter/libro-formatter-string-contribution.ts +41 -0
  264. package/src/formatter/libro-formatter-trans-default-contribution.ts +15 -0
  265. package/src/index.less +135 -58
  266. package/src/index.tsx +6 -1
  267. package/src/libro-context-key.ts +3 -3
  268. package/src/libro-model.ts +87 -23
  269. package/src/libro-protocol.ts +81 -4
  270. package/src/libro-service.ts +4 -13
  271. package/src/{configuration/libro-configuration-contribution.ts → libro-setting-contribution.ts} +7 -8
  272. package/src/{configuration/libro-configuration.ts → libro-setting.ts} +18 -7
  273. package/src/libro-view.tsx +273 -141
  274. package/src/material-from-designer.tsx +93 -1
  275. package/src/module.ts +29 -7
  276. package/src/output/output-area.tsx +18 -12
  277. package/src/output/output-contribution.ts +2 -6
  278. package/src/output/output-model.tsx +3 -3
  279. package/src/output/output-protocol.ts +0 -1
  280. package/src/settings/index.less +3 -0
  281. package/src/settings/index.ts +4 -0
  282. package/src/settings/module.ts +8 -0
  283. package/src/settings/setting-editor/configuration-panel-view.tsx +89 -0
  284. package/src/settings/setting-editor/configuration-render-contribution.ts +81 -0
  285. package/src/settings/setting-editor/default-node-render.tsx +65 -0
  286. package/src/settings/setting-editor/index.less +12 -0
  287. package/src/settings/setting-editor/index.ts +6 -0
  288. package/src/settings/setting-editor/module.ts +17 -0
  289. package/src/settings/setting-editor/setting-editor-view.tsx +93 -0
  290. package/src/settings/setting-editor/setting-tree-service.ts +82 -0
  291. package/src/settings/setting-editor/setting-tree-view.tsx +95 -0
  292. package/src/settings/settings-contribution.tsx +24 -0
  293. package/src/settings/settings-modal.less +3 -0
  294. package/src/settings/settings-modal.tsx +50 -0
  295. package/src/settings/settings-protocol.ts +7 -0
  296. package/src/slot/libro-slot-manager.ts +1 -3
  297. package/src/slot/libro-slot-view.tsx +2 -5
  298. package/src/theme/libro-color-registry.ts +6 -0
  299. package/src/toolbar/all-outputs-scroll-icon.tsx +19 -0
  300. package/src/toolbar/libro-toolbar.tsx +30 -5
  301. package/src/toolbar/restart-clear-outputs-modal.tsx +3 -3
  302. package/src/toolbar/shutdown-modal.tsx +3 -3
  303. package/src/toolbar/side-toolar-more-select.tsx +2 -1
  304. package/src/virtualized-manager-helper.ts +29 -0
  305. package/src/virtualized-manager.ts +34 -0
package/es/libro-view.js CHANGED
@@ -1,6 +1,9 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8;
3
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
2
+ var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9;
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4
7
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
5
8
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
6
9
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -26,31 +29,29 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
26
29
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
27
30
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
28
31
  import { ToTopOutlined } from '@ant-design/icons';
29
- import { concatMultilineString } from '@difizen/libro-common';
30
- import { ConfigurationService, useConfigurationValue } from '@difizen/mana-app';
31
- import { getOrigin, prop, watch } from '@difizen/mana-app';
32
- import { Deferred, Disposable, DisposableCollection, Emitter } from '@difizen/mana-app';
33
- import { Slot, ViewManager, BaseView, view, ViewInstance, ViewOption } from '@difizen/mana-app';
34
- import { inject, transient, useInject, equals } from '@difizen/mana-app';
35
- import { Spin, Button, FloatButton } from 'antd';
36
- import { useEffect, useRef, useCallback, memo, forwardRef } from 'react';
32
+ import { concatMultilineString, copy2clipboard, readFromClipboard } from '@difizen/libro-common';
33
+ import { equals, useInject, inject, transient, BaseView, Slot, view, ViewInstance, ViewManager, ViewOption, Deferred, Disposable, DisposableCollection, Emitter, getOrigin, prop, watch, ConfigurationService, useConfigurationValue } from '@difizen/mana-app';
34
+ import { BackTop, Button, Spin } from 'antd';
35
+ import { forwardRef, memo, useCallback, useEffect, useRef } from 'react';
37
36
  import { v4 } from 'uuid';
38
- import { CellService, ExecutableCellModel, ExecutableCellView, EditorCellView } from "./cell/index.js";
37
+ import { CellService, EditorCellView, ExecutableCellModel, ExecutableCellView } from "./cell/index.js";
39
38
  import { CollapseServiceFactory } from "./collapse-service.js";
40
- import { CustomDragLayer, DefaultDndContent, DndCellItemRender, DndContext, DndList } from "./components/index.js";
39
+ import { CustomDragLayer, DndCellContainer, DndCellItemRender, DndContext, DndList } from "./components/index.js";
41
40
  import { LibroViewHeader } from "./components/libro-view-header.js";
42
- import { AutoInsertWhenNoCell, EnterEditModeWhenAddCell, HeaderToolbarVisible, RightContentFixed } from "./configuration/libro-configuration.js";
43
41
  import { LirboContextKey } from "./libro-context-key.js";
44
42
  import { LibroModel } from "./libro-model.js";
45
43
  import { NotebookService, notebookViewFactoryId } from "./libro-protocol.js";
46
44
  import { LibroService } from "./libro-service.js";
45
+ import { AutoInsertWhenNoCell, EnterEditModeWhenAddCell, HeaderToolbarVisible, RightContentFixed } from "./libro-setting.js";
47
46
  import { LibroSlotManager, LibroSlotView } from "./slot/index.js";
47
+ import { VirtualizedManagerHelper } from "./virtualized-manager-helper.js";
48
48
  import "./index.less";
49
49
  import { jsx as _jsx } from "react/jsx-runtime";
50
50
  import { jsxs as _jsxs } from "react/jsx-runtime";
51
51
  import { Fragment as _Fragment } from "react/jsx-runtime";
52
52
  export var LibroContentComponent = /*#__PURE__*/memo(function LibroContentComponent() {
53
53
  var libroSlotManager = useInject(LibroSlotManager);
54
+ var ref = useRef(null);
54
55
  var libroViewTopRef = useRef(null);
55
56
  var libroViewRightContentRef = useRef(null);
56
57
  var libroViewLeftContentRef = useRef(null);
@@ -65,6 +66,7 @@ export var LibroContentComponent = /*#__PURE__*/memo(function LibroContentCompon
65
66
  rightContentFixed = _useConfigurationValu4[0];
66
67
  var handleScroll = useCallback(function () {
67
68
  var _instance$container, _instance$activeCell, _instance$activeCell2, _instance$activeCell3, _activeOutput$outputs, _instance$activeCell4, _libroViewTopRef$curr;
69
+ instance.cellScrollEmitter.fire();
68
70
  var cellRightToolbar = (_instance$container = instance.container) === null || _instance$container === void 0 || (_instance$container = _instance$container.current) === null || _instance$container === void 0 ? void 0 : _instance$container.getElementsByClassName('libro-cell-right-toolbar')[instance.model.activeIndex];
69
71
  var activeCellOffsetY = (_instance$activeCell = instance.activeCell) === null || _instance$activeCell === void 0 || (_instance$activeCell = _instance$activeCell.container) === null || _instance$activeCell === void 0 || (_instance$activeCell = _instance$activeCell.current) === null || _instance$activeCell === void 0 ? void 0 : _instance$activeCell.getBoundingClientRect().y;
70
72
  var activeCellOffsetRight = (_instance$activeCell2 = instance.activeCell) === null || _instance$activeCell2 === void 0 || (_instance$activeCell2 = _instance$activeCell2.container) === null || _instance$activeCell2 === void 0 || (_instance$activeCell2 = _instance$activeCell2.current) === null || _instance$activeCell2 === void 0 ? void 0 : _instance$activeCell2.getBoundingClientRect().right;
@@ -102,6 +104,7 @@ export var LibroContentComponent = /*#__PURE__*/memo(function LibroContentCompon
102
104
  children: /*#__PURE__*/_jsxs(DndContext, {
103
105
  children: [/*#__PURE__*/_jsx(CustomDragLayer, {}), /*#__PURE__*/_jsx(DndList, {
104
106
  libroView: instance,
107
+ ref: ref,
105
108
  children: /*#__PURE__*/_jsx(Slot, {
106
109
  name: libroSlotManager.getSlotName(instance, 'list'),
107
110
  slotView: LibroSlotView
@@ -115,7 +118,7 @@ export var LibroContentComponent = /*#__PURE__*/memo(function LibroContentCompon
115
118
  name: libroSlotManager.getSlotName(instance, 'right'),
116
119
  slotView: LibroSlotView
117
120
  })
118
- }), /*#__PURE__*/_jsx(FloatButton.BackTop, {
121
+ }), /*#__PURE__*/_jsx(BackTop, {
119
122
  target: function target() {
120
123
  return libroViewContentRef.current || document;
121
124
  },
@@ -136,7 +139,7 @@ export var LibroContentComponent = /*#__PURE__*/memo(function LibroContentCompon
136
139
  })]
137
140
  });
138
141
  });
139
- export var LibroRender = /*#__PURE__*/forwardRef(function LibroRender(_props, ref) {
142
+ export var LibroRender = /*#__PURE__*/forwardRef(function LibroRender(props, ref) {
140
143
  var instance = useInject(ViewInstance);
141
144
  var libroService = useInject(LibroService);
142
145
  var handleMouseDown = useCallback(function (e) {
@@ -149,7 +152,7 @@ export var LibroRender = /*#__PURE__*/forwardRef(function LibroRender(_props, re
149
152
  }, [instance]);
150
153
  var handFocus = useCallback(
151
154
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
152
- function (_e) {
155
+ function (e) {
153
156
  if (!equals(libroService.active, instance)) {
154
157
  libroService.active = instance;
155
158
  }
@@ -159,10 +162,22 @@ export var LibroRender = /*#__PURE__*/forwardRef(function LibroRender(_props, re
159
162
  }, [instance, libroService]);
160
163
  var handBlur = useCallback(function (e) {
161
164
  var _ref$current;
162
- if (typeof ref !== 'function' && !(ref !== null && ref !== void 0 && (_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.contains(e.relatedTarget))) {
165
+ if (typeof ref === 'function') {
166
+ return;
167
+ }
168
+ if (ref !== null && ref !== void 0 && (_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.contains(e.relatedTarget)) {
169
+ var _ref$current2;
170
+ var dndDom = ref === null || ref === void 0 || (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.getElementsByClassName('libro-dnd-cells-container')[0];
171
+ if (!(dndDom !== null && dndDom !== void 0 && dndDom.contains(e.relatedTarget)) && instance.model.readOnly) {
172
+ instance.selectCell(undefined);
173
+ }
174
+ } else {
163
175
  instance.enterCommandMode(false);
164
176
  libroService.focus = undefined;
165
177
  instance.onBlurEmitter.fire('');
178
+ if (instance.model.readOnly) {
179
+ instance.selectCell(undefined);
180
+ }
166
181
  }
167
182
  }, [instance, libroService, ref]);
168
183
  return /*#__PURE__*/_jsx("div", {
@@ -175,10 +190,10 @@ export var LibroRender = /*#__PURE__*/forwardRef(function LibroRender(_props, re
175
190
  children: /*#__PURE__*/_jsx(LibroContentComponent, {})
176
191
  });
177
192
  });
178
- export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId), _dec3 = inject(CellService), _dec4 = inject(LibroService), _dec5 = inject(LibroSlotManager), _dec6 = inject(LirboContextKey), _dec7 = inject(ViewManager), _dec8 = inject(ConfigurationService), _dec9 = prop(), _dec10 = prop(), _dec(_class = _dec2(_class = (_class2 = /*#__PURE__*/function (_BaseView) {
193
+ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId), _dec3 = inject(CellService), _dec4 = inject(LibroService), _dec5 = inject(LibroSlotManager), _dec6 = inject(LirboContextKey), _dec7 = inject(ViewManager), _dec8 = inject(ConfigurationService), _dec9 = prop(), _dec10 = prop(), _dec11 = prop(), _dec(_class = _dec2(_class = (_class2 = /*#__PURE__*/function (_BaseView) {
179
194
  _inherits(LibroView, _BaseView);
180
195
  var _super = _createSuper(LibroView);
181
- function LibroView(_options, collapseServiceFactory, notebookService) {
196
+ function LibroView(_options, collapseServiceFactory, notebookService, virtualizedManagerHelper) {
182
197
  var _this;
183
198
  _classCallCheck(this, LibroView);
184
199
  _this = _super.call(this);
@@ -191,7 +206,7 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
191
206
  children: /*#__PURE__*/_jsx(Spin, {})
192
207
  });
193
208
  };
194
- _this.dndContentRender = DefaultDndContent;
209
+ _this.dndContentRender = DndCellContainer;
195
210
  _this.dndItemRender = DndCellItemRender;
196
211
  _this.onCellCreateEmitter = new Emitter();
197
212
  _this.onBlurEmitter = new Emitter();
@@ -201,18 +216,29 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
201
216
  _initializerDefineProperty(_this, "contextKey", _descriptor4, _assertThisInitialized(_this));
202
217
  _initializerDefineProperty(_this, "viewManager", _descriptor5, _assertThisInitialized(_this));
203
218
  _initializerDefineProperty(_this, "configurationService", _descriptor6, _assertThisInitialized(_this));
219
+ _this.virtualizedManager = void 0;
220
+ _this.virtualizedManagerHelper = void 0;
204
221
  _this.notebookService = void 0;
205
222
  _this.collapseService = void 0;
206
223
  _this.isDragging = false;
207
224
  _initializerDefineProperty(_this, "collapserVisible", _descriptor7, _assertThisInitialized(_this));
208
- _initializerDefineProperty(_this, "saving", _descriptor8, _assertThisInitialized(_this));
225
+ _initializerDefineProperty(_this, "outputsScroll", _descriptor8, _assertThisInitialized(_this));
226
+ _initializerDefineProperty(_this, "saving", _descriptor9, _assertThisInitialized(_this));
209
227
  _this.onSaveEmitter = new Emitter();
210
228
  _this.runCellEmitter = new Emitter();
229
+ _this.cellScrollEmitter = new Emitter();
211
230
  _this.initializedDefer = new Deferred();
212
231
  _this.view = LibroRender;
213
232
  _this.onViewMount = function () {
214
233
  _this.libroService.active = _assertThisInitialized(_this);
215
234
  _this.libroSlotManager.setup(_assertThisInitialized(_this));
235
+
236
+ // this.libroService.libroPerformanceStatistics.setRenderEnd(new Date());
237
+
238
+ // console.log(
239
+ // '[performance] render Time: ',
240
+ // this.libroService.libroPerformanceStatistics.getRenderTime(),
241
+ // );
216
242
  };
217
243
  _this.onViewUnmount = function () {
218
244
  if (equals(_this.libroService.active, _assertThisInitialized(_this))) {
@@ -348,7 +374,7 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
348
374
  }, 0);
349
375
  }
350
376
  return;
351
- }).catch(function () {
377
+ }).catch(function (e) {
352
378
  //
353
379
  });
354
380
  } else {
@@ -370,7 +396,7 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
370
396
  }, 0);
371
397
  }
372
398
  return;
373
- }).catch(function () {
399
+ }).catch(function (e) {
374
400
  //
375
401
  });
376
402
  }
@@ -512,14 +538,11 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
512
538
  }, selectIndex + 1).then(function () {
513
539
  _this.enterEditMode();
514
540
  return;
515
- }).catch(function () {
541
+ }).catch(function (e) {
516
542
  //
517
543
  });
518
544
  }
519
545
  _this.runCells(toRunCells);
520
- if (_this.activeCell) {
521
- _this.model.scrollToView(_this.activeCell);
522
- }
523
546
  } else {
524
547
  _selectIndex = _this.findCellIndex(cell);
525
548
  if (_selectIndex >= 0 && _selectIndex < _this.model.cells.length - 1) {
@@ -536,16 +559,28 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
536
559
  }, _selectIndex + 1).then(function () {
537
560
  _this.enterEditMode();
538
561
  return;
539
- }).catch(function () {
562
+ }).catch(function (e) {
540
563
  //
541
564
  });
542
565
  }
543
566
  _this.runCells([cell]);
544
- if (_this.activeCell) {
545
- _this.model.scrollToView(_this.activeCell);
546
- }
547
567
  }
548
- case 3:
568
+ if (_this.virtualizedManager.isVirtualized) {
569
+ setTimeout(function () {
570
+ if (_this.activeCell) {
571
+ _this.model.scrollToCellView({
572
+ cellIndex: _this.activeCellIndex
573
+ });
574
+ }
575
+ });
576
+ } else {
577
+ setTimeout(function () {
578
+ if (_this.activeCell) {
579
+ _this.model.scrollToView(_this.activeCell);
580
+ }
581
+ });
582
+ }
583
+ case 4:
549
584
  case "end":
550
585
  return _context10.stop();
551
586
  }
@@ -648,18 +683,31 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
648
683
  };
649
684
  _this.copyCell = function (cell) {
650
685
  if (_this.model.selections.length !== 0 && _this.isSelected(cell)) {
651
- _this.model.clipboard = _this.model.selections;
652
- _this.model.selections = [];
686
+ var clipboard = {
687
+ action: 'copy',
688
+ cells: _this.model.selections.map(function (selection) {
689
+ return selection.toJSONWithoutId();
690
+ })
691
+ };
692
+ copy2clipboard(JSON.stringify(clipboard));
653
693
  } else {
654
- _this.model.clipboard = cell;
694
+ var _clipboard = {
695
+ action: 'copy',
696
+ cells: [cell.toJSONWithoutId()]
697
+ };
698
+ copy2clipboard(JSON.stringify(_clipboard));
655
699
  }
656
- _this.model.lastClipboardInteraction = 'copy';
657
700
  };
658
701
  _this.cutCell = function (cell) {
659
702
  if (_this.model.selections.length !== 0 && _this.isSelected(cell)) {
660
- _this.model.clipboard = _this.model.selections;
661
- _this.model.selections = [];
662
- var _iterator2 = _createForOfIteratorHelper(_this.model.clipboard),
703
+ var clipboard = {
704
+ action: 'cut',
705
+ cells: _this.model.selections.map(function (selection) {
706
+ return selection.toJSONWithoutId();
707
+ })
708
+ };
709
+ copy2clipboard(JSON.stringify(clipboard));
710
+ var _iterator2 = _createForOfIteratorHelper(_this.model.selections),
663
711
  _step2;
664
712
  try {
665
713
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
@@ -672,20 +720,64 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
672
720
  _iterator2.f();
673
721
  }
674
722
  } else {
675
- _this.model.clipboard = cell;
723
+ var _clipboard2 = {
724
+ action: 'cut',
725
+ cells: [cell.toJSONWithoutId()]
726
+ };
727
+ copy2clipboard(JSON.stringify(_clipboard2));
676
728
  _this.deleteCell(cell);
677
729
  }
678
- _this.model.lastClipboardInteraction = 'cut';
679
730
  };
680
- _this.pasteCell = function (cell) {
731
+ _this.pasteCell = /*#__PURE__*/function () {
732
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(cell) {
733
+ var pasteIndex, pasteValue;
734
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
735
+ while (1) switch (_context12.prev = _context12.next) {
736
+ case 0:
737
+ pasteIndex = _this.model.getCells().findIndex(function (item) {
738
+ return equals(item, cell);
739
+ });
740
+ _context12.prev = 1;
741
+ _context12.t0 = JSON;
742
+ _context12.next = 5;
743
+ return readFromClipboard();
744
+ case 5:
745
+ _context12.t1 = _context12.sent;
746
+ pasteValue = _context12.t0.parse.call(_context12.t0, _context12.t1);
747
+ if (!(pasteValue.action === 'copy' || pasteValue.action === 'cut')) {
748
+ _context12.next = 10;
749
+ break;
750
+ }
751
+ _this.insertCells(pasteValue.cells.map(function (item) {
752
+ return {
753
+ id: v4(),
754
+ cell: item
755
+ };
756
+ }), pasteIndex + 1);
757
+ return _context12.abrupt("return");
758
+ case 10:
759
+ _context12.next = 15;
760
+ break;
761
+ case 12:
762
+ _context12.prev = 12;
763
+ _context12.t2 = _context12["catch"](1);
764
+ console.error(_context12.t2);
765
+ case 15:
766
+ case "end":
767
+ return _context12.stop();
768
+ }
769
+ }, _callee12, null, [[1, 12]]);
770
+ }));
771
+ return function (_x14) {
772
+ return _ref12.apply(this, arguments);
773
+ };
774
+ }();
775
+ _this.pasteCellAbove = function (cell) {
681
776
  var pasteIndex = _this.model.getCells().findIndex(function (item) {
682
777
  return equals(item, cell);
683
778
  });
684
779
  var pasteCells = getOrigin(_this.model.clipboard);
685
- if (!_this.model.lastClipboardInteraction) {
686
- return;
687
- }
688
- if (!pasteCells) {
780
+ if (!_this.model.lastClipboardInteraction || !pasteCells) {
689
781
  return;
690
782
  }
691
783
  if (_this.model.lastClipboardInteraction === 'copy') {
@@ -699,7 +791,7 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
699
791
  _this.addCell({
700
792
  id: v4(),
701
793
  cell: cellOptions
702
- }, pasteIndex + 1);
794
+ }, pasteIndex);
703
795
  pasteIndex++;
704
796
  }
705
797
  } catch (err) {
@@ -712,7 +804,7 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
712
804
  _this.addCell({
713
805
  id: v4(),
714
806
  cell: _cellOptions
715
- }, pasteIndex + 1);
807
+ }, pasteIndex);
716
808
  }
717
809
  } else {
718
810
  if (Array.isArray(pasteCells)) {
@@ -721,7 +813,7 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
721
813
  try {
722
814
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
723
815
  var _pasteCell = _step4.value;
724
- _this.model.addCell(_pasteCell, pasteIndex + 1);
816
+ _this.model.addCell(_pasteCell, pasteIndex);
725
817
  _this.model.deletedCells.splice(_this.model.deletedCells.indexOf(_pasteCell), 1);
726
818
  pasteIndex++;
727
819
  }
@@ -730,66 +822,6 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
730
822
  } finally {
731
823
  _iterator4.f();
732
824
  }
733
- } else {
734
- _this.model.addCell(pasteCells, pasteIndex + 1);
735
- _this.model.deletedCells.splice(_this.model.deletedCells.indexOf(pasteCells), 1);
736
- }
737
- _this.model.lastClipboardInteraction = '';
738
- }
739
- };
740
- _this.pasteCellAbove = function (cell) {
741
- var pasteIndex = _this.model.getCells().findIndex(function (item) {
742
- return equals(item, cell);
743
- });
744
- var pasteCells = getOrigin(_this.model.clipboard);
745
- if (!_this.model.lastClipboardInteraction) {
746
- return;
747
- }
748
- if (!pasteCells) {
749
- return;
750
- }
751
- if (_this.model.lastClipboardInteraction === 'copy') {
752
- if (Array.isArray(pasteCells)) {
753
- var _iterator5 = _createForOfIteratorHelper(pasteCells),
754
- _step5;
755
- try {
756
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
757
- var pasteCell = _step5.value;
758
- var cellOptions = pasteCell.toJSONWithoutId();
759
- _this.addCell({
760
- id: v4(),
761
- cell: cellOptions
762
- }, pasteIndex);
763
- pasteIndex++;
764
- }
765
- } catch (err) {
766
- _iterator5.e(err);
767
- } finally {
768
- _iterator5.f();
769
- }
770
- } else {
771
- var _cellOptions2 = pasteCells.toJSONWithoutId();
772
- _this.addCell({
773
- id: v4(),
774
- cell: _cellOptions2
775
- }, pasteIndex);
776
- }
777
- } else {
778
- if (Array.isArray(pasteCells)) {
779
- var _iterator6 = _createForOfIteratorHelper(pasteCells),
780
- _step6;
781
- try {
782
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
783
- var _pasteCell2 = _step6.value;
784
- _this.model.addCell(_pasteCell2, pasteIndex);
785
- _this.model.deletedCells.splice(_this.model.deletedCells.indexOf(_pasteCell2), 1);
786
- pasteIndex++;
787
- }
788
- } catch (err) {
789
- _iterator6.e(err);
790
- } finally {
791
- _iterator6.f();
792
- }
793
825
  } else {
794
826
  _this.model.addCell(pasteCells, pasteIndex);
795
827
  _this.model.deletedCells.splice(_this.model.deletedCells.indexOf(pasteCells), 1);
@@ -798,133 +830,146 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
798
830
  }
799
831
  };
800
832
  _this.invertCell = /*#__PURE__*/function () {
801
- var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(cell, type) {
802
- var cellIndex, _iterator7, _step7, selectedCell, cellOptions, cellView, _cellOptions3, _cellView;
803
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
804
- while (1) switch (_context12.prev = _context12.next) {
833
+ var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(cell, type) {
834
+ var cellIndex, _iterator5, _step5, selectedCell, cellOptions, cellView, _cellOptions2, _cellView;
835
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
836
+ while (1) switch (_context13.prev = _context13.next) {
805
837
  case 0:
806
838
  cellIndex = _this.model.getCells().findIndex(function (item) {
807
839
  return equals(item, cell);
808
840
  });
809
841
  if (!(_this.model.selections.length !== 0 && _this.isSelected(cell))) {
810
- _context12.next = 24;
842
+ _context13.next = 24;
811
843
  break;
812
844
  }
813
- _iterator7 = _createForOfIteratorHelper(_this.model.selections);
814
- _context12.prev = 3;
815
- _iterator7.s();
845
+ _iterator5 = _createForOfIteratorHelper(_this.model.selections);
846
+ _context13.prev = 3;
847
+ _iterator5.s();
816
848
  case 5:
817
- if ((_step7 = _iterator7.n()).done) {
818
- _context12.next = 14;
849
+ if ((_step5 = _iterator5.n()).done) {
850
+ _context13.next = 14;
819
851
  break;
820
852
  }
821
- selectedCell = _step7.value;
853
+ selectedCell = _step5.value;
822
854
  cellOptions = {
823
855
  cell: {
824
856
  cell_type: type,
825
- source: selectedCell.toJSON().source,
826
- metadata: {}
857
+ source: selectedCell.model.source,
858
+ metadata: _objectSpread(_objectSpread({}, selectedCell.model.metadata), {}, {
859
+ libroFormatter: selectedCell.model.libroFormatType
860
+ })
827
861
  }
828
862
  };
829
- _context12.next = 10;
863
+ _context13.next = 10;
830
864
  return _this.getCellViewByOption(cellOptions);
831
865
  case 10:
832
- cellView = _context12.sent;
866
+ cellView = _context13.sent;
833
867
  _this.model.invertCell(cellView, cellIndex);
834
868
  case 12:
835
- _context12.next = 5;
869
+ _context13.next = 5;
836
870
  break;
837
871
  case 14:
838
- _context12.next = 19;
872
+ _context13.next = 19;
839
873
  break;
840
874
  case 16:
841
- _context12.prev = 16;
842
- _context12.t0 = _context12["catch"](3);
843
- _iterator7.e(_context12.t0);
875
+ _context13.prev = 16;
876
+ _context13.t0 = _context13["catch"](3);
877
+ _iterator5.e(_context13.t0);
844
878
  case 19:
845
- _context12.prev = 19;
846
- _iterator7.f();
847
- return _context12.finish(19);
879
+ _context13.prev = 19;
880
+ _iterator5.f();
881
+ return _context13.finish(19);
848
882
  case 22:
849
- _context12.next = 29;
883
+ _context13.next = 29;
850
884
  break;
851
885
  case 24:
852
- _cellOptions3 = {
886
+ _cellOptions2 = {
853
887
  cell: {
854
888
  cell_type: type,
855
- source: cell.toJSON().source,
856
- metadata: {}
889
+ source: cell.model.source,
890
+ metadata: _objectSpread(_objectSpread({}, cell.model.metadata), {}, {
891
+ libroFormatter: cell.model.libroFormatType,
892
+ libroCellType: type
893
+ })
857
894
  }
858
895
  };
859
- _context12.next = 27;
860
- return _this.getCellViewByOption(_cellOptions3);
896
+ _context13.next = 27;
897
+ return _this.getCellViewByOption(_cellOptions2);
861
898
  case 27:
862
- _cellView = _context12.sent;
899
+ _cellView = _context13.sent;
863
900
  _this.model.invertCell(_cellView, cellIndex);
864
901
  case 29:
865
902
  case "end":
866
- return _context12.stop();
903
+ return _context13.stop();
867
904
  }
868
- }, _callee12, null, [[3, 16, 19, 22]]);
905
+ }, _callee13, null, [[3, 16, 19, 22]]);
869
906
  }));
870
- return function (_x14, _x15) {
871
- return _ref12.apply(this, arguments);
907
+ return function (_x15, _x16) {
908
+ return _ref13.apply(this, arguments);
872
909
  };
873
910
  }();
874
911
  _this.clearOutputs = function (cell) {
875
912
  if (_this.model.selections.length !== 0 && _this.isSelected(cell)) {
876
- var _iterator8 = _createForOfIteratorHelper(_this.model.selections),
877
- _step8;
913
+ var _iterator6 = _createForOfIteratorHelper(_this.model.selections),
914
+ _step6;
878
915
  try {
879
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
880
- var selectedCell = _step8.value;
916
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
917
+ var selectedCell = _step6.value;
881
918
  if (ExecutableCellView.is(selectedCell) && ExecutableCellModel.is(selectedCell.model)) {
882
919
  selectedCell.clearExecution();
920
+ selectedCell.model.executing = false;
883
921
  selectedCell.model.hasOutputHidden = false;
884
922
  }
885
923
  }
886
924
  } catch (err) {
887
- _iterator8.e(err);
925
+ _iterator6.e(err);
888
926
  } finally {
889
- _iterator8.f();
927
+ _iterator6.f();
890
928
  }
891
929
  } else {
892
930
  if (ExecutableCellView.is(cell) && ExecutableCellModel.is(cell.model)) {
893
931
  cell.clearExecution();
932
+ cell.model.executing = false;
894
933
  cell.model.hasOutputHidden = false;
895
934
  }
896
935
  }
897
936
  };
898
937
  _this.clearAllOutputs = function () {
899
- var _iterator9 = _createForOfIteratorHelper(_this.model.cells),
900
- _step9;
938
+ if (_this.virtualizedManager.isVirtualized) {
939
+ _this.model.scrollToCellView({
940
+ cellIndex: 0
941
+ });
942
+ } // 清空所有 cell滚动到最上面
943
+ var _iterator7 = _createForOfIteratorHelper(_this.model.cells),
944
+ _step7;
901
945
  try {
902
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
903
- var cell = _step9.value;
946
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
947
+ var cell = _step7.value;
904
948
  if (ExecutableCellView.is(cell) && ExecutableCellModel.is(cell.model)) {
905
949
  cell.clearExecution();
950
+ cell.model.executing = false;
906
951
  cell.model.hasOutputHidden = false;
907
952
  }
908
953
  }
909
954
  } catch (err) {
910
- _iterator9.e(err);
955
+ _iterator7.e(err);
911
956
  } finally {
912
- _iterator9.f();
957
+ _iterator7.f();
913
958
  }
914
959
  };
915
960
  _this.hideCellCode = function (cell) {
916
961
  if (_this.model.selections.length !== 0 && _this.isSelected(cell)) {
917
- var _iterator10 = _createForOfIteratorHelper(_this.model.selections),
918
- _step10;
962
+ var _iterator8 = _createForOfIteratorHelper(_this.model.selections),
963
+ _step8;
919
964
  try {
920
- for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
921
- var selectedCell = _step10.value;
965
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
966
+ var selectedCell = _step8.value;
922
967
  selectedCell.hasInputHidden = true;
923
968
  }
924
969
  } catch (err) {
925
- _iterator10.e(err);
970
+ _iterator8.e(err);
926
971
  } finally {
927
- _iterator10.f();
972
+ _iterator8.f();
928
973
  }
929
974
  } else {
930
975
  cell.hasInputHidden = true;
@@ -932,17 +977,17 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
932
977
  };
933
978
  _this.hideOrShowCellCode = function (cell) {
934
979
  if (_this.model.selections.length !== 0 && _this.isSelected(cell)) {
935
- var _iterator11 = _createForOfIteratorHelper(_this.model.selections),
936
- _step11;
980
+ var _iterator9 = _createForOfIteratorHelper(_this.model.selections),
981
+ _step9;
937
982
  try {
938
- for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
939
- var selectedCell = _step11.value;
983
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
984
+ var selectedCell = _step9.value;
940
985
  selectedCell.hasInputHidden = !selectedCell.hasInputHidden;
941
986
  }
942
987
  } catch (err) {
943
- _iterator11.e(err);
988
+ _iterator9.e(err);
944
989
  } finally {
945
- _iterator11.f();
990
+ _iterator9.f();
946
991
  }
947
992
  } else {
948
993
  cell.hasInputHidden = !cell.hasInputHidden;
@@ -950,19 +995,19 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
950
995
  };
951
996
  _this.hideOutputs = function (cell) {
952
997
  if (_this.model.selections.length !== 0 && _this.isSelected(cell)) {
953
- var _iterator12 = _createForOfIteratorHelper(_this.model.selections),
954
- _step12;
998
+ var _iterator10 = _createForOfIteratorHelper(_this.model.selections),
999
+ _step10;
955
1000
  try {
956
- for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
957
- var selectedCell = _step12.value;
1001
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
1002
+ var selectedCell = _step10.value;
958
1003
  if (ExecutableCellModel.is(selectedCell.model)) {
959
1004
  selectedCell.model.hasOutputHidden = true;
960
1005
  }
961
1006
  }
962
1007
  } catch (err) {
963
- _iterator12.e(err);
1008
+ _iterator10.e(err);
964
1009
  } finally {
965
- _iterator12.f();
1010
+ _iterator10.f();
966
1011
  }
967
1012
  } else {
968
1013
  if (ExecutableCellModel.is(cell.model)) {
@@ -972,19 +1017,19 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
972
1017
  };
973
1018
  _this.hideOrShowOutputs = function (cell) {
974
1019
  if (_this.model.selections.length !== 0 && _this.isSelected(cell)) {
975
- var _iterator13 = _createForOfIteratorHelper(_this.model.selections),
976
- _step13;
1020
+ var _iterator11 = _createForOfIteratorHelper(_this.model.selections),
1021
+ _step11;
977
1022
  try {
978
- for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
979
- var selectedCell = _step13.value;
1023
+ for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
1024
+ var selectedCell = _step11.value;
980
1025
  if (ExecutableCellModel.is(selectedCell.model)) {
981
1026
  selectedCell.model.hasOutputHidden = !selectedCell.model.hasOutputHidden;
982
1027
  }
983
1028
  }
984
1029
  } catch (err) {
985
- _iterator13.e(err);
1030
+ _iterator11.e(err);
986
1031
  } finally {
987
- _iterator13.f();
1032
+ _iterator11.f();
988
1033
  }
989
1034
  } else {
990
1035
  if (ExecutableCellModel.is(cell.model)) {
@@ -993,82 +1038,82 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
993
1038
  }
994
1039
  };
995
1040
  _this.hideAllOutputs = function () {
996
- var _iterator14 = _createForOfIteratorHelper(_this.model.cells),
997
- _step14;
1041
+ var _iterator12 = _createForOfIteratorHelper(_this.model.cells),
1042
+ _step12;
998
1043
  try {
999
- for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
1000
- var cell = _step14.value;
1044
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
1045
+ var cell = _step12.value;
1001
1046
  if (ExecutableCellModel.is(cell.model)) {
1002
1047
  cell.model.hasOutputHidden = true;
1003
1048
  }
1004
1049
  }
1005
1050
  } catch (err) {
1006
- _iterator14.e(err);
1051
+ _iterator12.e(err);
1007
1052
  } finally {
1008
- _iterator14.f();
1053
+ _iterator12.f();
1009
1054
  }
1010
1055
  };
1011
1056
  _this.hideAllCellCode = function () {
1012
- var _iterator15 = _createForOfIteratorHelper(_this.model.cells),
1013
- _step15;
1057
+ var _iterator13 = _createForOfIteratorHelper(_this.model.cells),
1058
+ _step13;
1014
1059
  try {
1015
- for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
1016
- var cell = _step15.value;
1060
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
1061
+ var cell = _step13.value;
1017
1062
  cell.hasInputHidden = true;
1018
1063
  }
1019
1064
  } catch (err) {
1020
- _iterator15.e(err);
1065
+ _iterator13.e(err);
1021
1066
  } finally {
1022
- _iterator15.f();
1067
+ _iterator13.f();
1023
1068
  }
1024
1069
  };
1025
1070
  _this.showCellCode = function (cell) {
1026
1071
  if (_this.model.selections.length !== 0 && _this.isSelected(cell)) {
1027
- var _iterator16 = _createForOfIteratorHelper(_this.model.selections),
1028
- _step16;
1072
+ var _iterator14 = _createForOfIteratorHelper(_this.model.selections),
1073
+ _step14;
1029
1074
  try {
1030
- for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
1031
- var selectedCell = _step16.value;
1075
+ for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
1076
+ var selectedCell = _step14.value;
1032
1077
  selectedCell.hasInputHidden = false;
1033
1078
  }
1034
1079
  } catch (err) {
1035
- _iterator16.e(err);
1080
+ _iterator14.e(err);
1036
1081
  } finally {
1037
- _iterator16.f();
1082
+ _iterator14.f();
1038
1083
  }
1039
1084
  } else {
1040
1085
  cell.hasInputHidden = false;
1041
1086
  }
1042
1087
  };
1043
1088
  _this.showAllCellCode = function () {
1044
- var _iterator17 = _createForOfIteratorHelper(_this.model.cells),
1045
- _step17;
1089
+ var _iterator15 = _createForOfIteratorHelper(_this.model.cells),
1090
+ _step15;
1046
1091
  try {
1047
- for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
1048
- var cell = _step17.value;
1092
+ for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
1093
+ var cell = _step15.value;
1049
1094
  cell.hasInputHidden = false;
1050
1095
  }
1051
1096
  } catch (err) {
1052
- _iterator17.e(err);
1097
+ _iterator15.e(err);
1053
1098
  } finally {
1054
- _iterator17.f();
1099
+ _iterator15.f();
1055
1100
  }
1056
1101
  };
1057
1102
  _this.showCellOutputs = function (cell) {
1058
1103
  if (_this.model.selections.length !== 0 && _this.isSelected(cell)) {
1059
- var _iterator18 = _createForOfIteratorHelper(_this.model.selections),
1060
- _step18;
1104
+ var _iterator16 = _createForOfIteratorHelper(_this.model.selections),
1105
+ _step16;
1061
1106
  try {
1062
- for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
1063
- var selectedCell = _step18.value;
1107
+ for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
1108
+ var selectedCell = _step16.value;
1064
1109
  if (ExecutableCellModel.is(selectedCell.model)) {
1065
1110
  selectedCell.model.hasOutputHidden = false;
1066
1111
  }
1067
1112
  }
1068
1113
  } catch (err) {
1069
- _iterator18.e(err);
1114
+ _iterator16.e(err);
1070
1115
  } finally {
1071
- _iterator18.f();
1116
+ _iterator16.f();
1072
1117
  }
1073
1118
  } else {
1074
1119
  if (ExecutableCellModel.is(cell.model)) {
@@ -1077,19 +1122,19 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1077
1122
  }
1078
1123
  };
1079
1124
  _this.showAllCellOutputs = function () {
1080
- var _iterator19 = _createForOfIteratorHelper(_this.model.cells),
1081
- _step19;
1125
+ var _iterator17 = _createForOfIteratorHelper(_this.model.cells),
1126
+ _step17;
1082
1127
  try {
1083
- for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
1084
- var cell = _step19.value;
1128
+ for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
1129
+ var cell = _step17.value;
1085
1130
  if (ExecutableCellModel.is(cell.model)) {
1086
1131
  cell.model.hasOutputHidden = false;
1087
1132
  }
1088
1133
  }
1089
1134
  } catch (err) {
1090
- _iterator19.e(err);
1135
+ _iterator17.e(err);
1091
1136
  } finally {
1092
- _iterator19.f();
1137
+ _iterator17.f();
1093
1138
  }
1094
1139
  };
1095
1140
  _this.extendSelectionAbove = function () {
@@ -1102,7 +1147,13 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1102
1147
  if (_this.findCellIndex(_this.activeCell) > 0) {
1103
1148
  _this.extendContiguousSelectionTo(activeIndex - 1);
1104
1149
  }
1105
- _this.model.scrollToView(_this.activeCell);
1150
+ if (_this.virtualizedManager.isVirtualized) {
1151
+ _this.model.scrollToCellView({
1152
+ cellIndex: _this.activeCellIndex
1153
+ });
1154
+ } else {
1155
+ _this.model.scrollToView(_this.activeCell);
1156
+ }
1106
1157
  }
1107
1158
  };
1108
1159
  _this.extendSelectionToTop = function () {
@@ -1110,7 +1161,13 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1110
1161
  if (_this.findCellIndex(_this.activeCell) > 0) {
1111
1162
  _this.extendContiguousSelectionTo(0);
1112
1163
  }
1113
- _this.model.scrollToView(_this.activeCell);
1164
+ if (_this.virtualizedManager.isVirtualized) {
1165
+ _this.model.scrollToCellView({
1166
+ cellIndex: _this.activeCellIndex
1167
+ });
1168
+ } else {
1169
+ _this.model.scrollToView(_this.activeCell);
1170
+ }
1114
1171
  }
1115
1172
  };
1116
1173
  _this.extendSelectionBelow = function () {
@@ -1123,7 +1180,13 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1123
1180
  if (_this.findCellIndex(_this.activeCell) >= 0) {
1124
1181
  _this.extendContiguousSelectionTo(activeIndex + 1);
1125
1182
  }
1126
- _this.model.scrollToView(_this.activeCell);
1183
+ if (_this.virtualizedManager.isVirtualized) {
1184
+ _this.model.scrollToCellView({
1185
+ cellIndex: _this.activeCellIndex
1186
+ });
1187
+ } else {
1188
+ _this.model.scrollToView(_this.activeCell);
1189
+ }
1127
1190
  }
1128
1191
  };
1129
1192
  _this.extendSelectionToBottom = function () {
@@ -1131,24 +1194,30 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1131
1194
  if (_this.findCellIndex(_this.activeCell) > 0) {
1132
1195
  _this.extendContiguousSelectionTo(_this.model.cells.length - 1);
1133
1196
  }
1134
- _this.model.scrollToView(_this.activeCell);
1197
+ if (_this.virtualizedManager.isVirtualized) {
1198
+ _this.model.scrollToCellView({
1199
+ cellIndex: _this.activeCellIndex
1200
+ });
1201
+ } else {
1202
+ _this.model.scrollToView(_this.activeCell);
1203
+ }
1135
1204
  }
1136
1205
  };
1137
1206
  _this.enableOutputScrolling = function (cell) {
1138
1207
  if (_this.model.selections.length !== 0 && _this.isSelected(cell)) {
1139
- var _iterator20 = _createForOfIteratorHelper(_this.model.selections),
1140
- _step20;
1208
+ var _iterator18 = _createForOfIteratorHelper(_this.model.selections),
1209
+ _step18;
1141
1210
  try {
1142
- for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
1143
- var selectedCell = _step20.value;
1211
+ for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
1212
+ var selectedCell = _step18.value;
1144
1213
  if (ExecutableCellModel.is(selectedCell.model)) {
1145
1214
  selectedCell.model.hasOutputsScrolled = true;
1146
1215
  }
1147
1216
  }
1148
1217
  } catch (err) {
1149
- _iterator20.e(err);
1218
+ _iterator18.e(err);
1150
1219
  } finally {
1151
- _iterator20.f();
1220
+ _iterator18.f();
1152
1221
  }
1153
1222
  } else {
1154
1223
  if (ExecutableCellModel.is(cell.model)) {
@@ -1157,20 +1226,21 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1157
1226
  }
1158
1227
  };
1159
1228
  _this.disableOutputScrolling = function (cell) {
1229
+ _this.outputsScroll = false;
1160
1230
  if (_this.model.selections.length !== 0 && _this.isSelected(cell)) {
1161
- var _iterator21 = _createForOfIteratorHelper(_this.model.selections),
1162
- _step21;
1231
+ var _iterator19 = _createForOfIteratorHelper(_this.model.selections),
1232
+ _step19;
1163
1233
  try {
1164
- for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) {
1165
- var selectedCell = _step21.value;
1234
+ for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
1235
+ var selectedCell = _step19.value;
1166
1236
  if (ExecutableCellModel.is(selectedCell.model)) {
1167
1237
  selectedCell.model.hasOutputsScrolled = false;
1168
1238
  }
1169
1239
  }
1170
1240
  } catch (err) {
1171
- _iterator21.e(err);
1241
+ _iterator19.e(err);
1172
1242
  } finally {
1173
- _iterator21.f();
1243
+ _iterator19.f();
1174
1244
  }
1175
1245
  } else {
1176
1246
  if (ExecutableCellModel.is(cell.model)) {
@@ -1178,6 +1248,40 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1178
1248
  }
1179
1249
  }
1180
1250
  };
1251
+ _this.disableAllOutputScrolling = function () {
1252
+ _this.outputsScroll = false;
1253
+ var _iterator20 = _createForOfIteratorHelper(_this.model.cells),
1254
+ _step20;
1255
+ try {
1256
+ for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
1257
+ var cell = _step20.value;
1258
+ if (ExecutableCellModel.is(cell.model)) {
1259
+ cell.model.hasOutputsScrolled = false;
1260
+ }
1261
+ }
1262
+ } catch (err) {
1263
+ _iterator20.e(err);
1264
+ } finally {
1265
+ _iterator20.f();
1266
+ }
1267
+ };
1268
+ _this.enableAllOutputScrolling = function () {
1269
+ _this.outputsScroll = true;
1270
+ var _iterator21 = _createForOfIteratorHelper(_this.model.cells),
1271
+ _step21;
1272
+ try {
1273
+ for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) {
1274
+ var cell = _step21.value;
1275
+ if (ExecutableCellModel.is(cell.model)) {
1276
+ cell.model.hasOutputsScrolled = true;
1277
+ }
1278
+ }
1279
+ } catch (err) {
1280
+ _iterator21.e(err);
1281
+ } finally {
1282
+ _iterator21.f();
1283
+ }
1284
+ };
1181
1285
  _this.disposed = false;
1182
1286
  _this.enterCommandMode = function (isInLibro) {
1183
1287
  if (_this.hasModal) {
@@ -1201,7 +1305,13 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1201
1305
  if (newSelectedCell) {
1202
1306
  _this.model.selectCell(newSelectedCell);
1203
1307
  _this.model.selections = [];
1204
- _this.model.scrollToView(newSelectedCell);
1308
+ if (_this.virtualizedManager.isVirtualized) {
1309
+ _this.model.scrollToCellView({
1310
+ cellIndex: _this.activeCellIndex
1311
+ });
1312
+ } else {
1313
+ _this.model.scrollToView(newSelectedCell);
1314
+ }
1205
1315
  }
1206
1316
  };
1207
1317
  _this.moveCursorUp = function (cell) {
@@ -1209,33 +1319,39 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1209
1319
  if (newSelectedCell) {
1210
1320
  _this.model.selectCell(newSelectedCell);
1211
1321
  _this.model.selections = [];
1212
- _this.model.scrollToView(newSelectedCell);
1322
+ if (_this.virtualizedManager.isVirtualized) {
1323
+ _this.model.scrollToCellView({
1324
+ cellIndex: _this.activeCellIndex
1325
+ });
1326
+ } else {
1327
+ _this.model.scrollToView(newSelectedCell);
1328
+ }
1213
1329
  }
1214
1330
  };
1215
1331
  _this.mergeCellBelow = /*#__PURE__*/function () {
1216
- var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(cell) {
1332
+ var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(cell) {
1217
1333
  var _this$model, cells, selections, selectedIndex, nextCell, source, cellView, cellData;
1218
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1219
- while (1) switch (_context13.prev = _context13.next) {
1334
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1335
+ while (1) switch (_context14.prev = _context14.next) {
1220
1336
  case 0:
1221
1337
  _this$model = _this.model, cells = _this$model.cells, selections = _this$model.selections;
1222
1338
  if (!(selections.length > 1)) {
1223
- _context13.next = 4;
1339
+ _context14.next = 4;
1224
1340
  break;
1225
1341
  }
1226
1342
  _this.mergeCells(cell);
1227
- return _context13.abrupt("return");
1343
+ return _context14.abrupt("return");
1228
1344
  case 4:
1229
1345
  selectedIndex = _this.findCellIndex(cell);
1230
1346
  if (!(selectedIndex >= cells.length - 1)) {
1231
- _context13.next = 7;
1347
+ _context14.next = 7;
1232
1348
  break;
1233
1349
  }
1234
- return _context13.abrupt("return");
1350
+ return _context14.abrupt("return");
1235
1351
  case 7:
1236
1352
  nextCell = cells[selectedIndex + 1];
1237
1353
  source = concatMultilineString([cell.model.value + '\n', nextCell.model.value]);
1238
- _context13.next = 11;
1354
+ _context14.next = 11;
1239
1355
  return _this.getCellViewByOption({
1240
1356
  id: v4(),
1241
1357
  cell: {
@@ -1245,7 +1361,7 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1245
1361
  }
1246
1362
  });
1247
1363
  case 11:
1248
- cellView = _context13.sent;
1364
+ cellView = _context14.sent;
1249
1365
  if (_this.model instanceof LibroModel) {
1250
1366
  _this.model.activeIndex = selectedIndex;
1251
1367
  cellData = [cellView].map(function (_cell) {
@@ -1260,38 +1376,38 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1260
1376
  }
1261
1377
  case 13:
1262
1378
  case "end":
1263
- return _context13.stop();
1379
+ return _context14.stop();
1264
1380
  }
1265
- }, _callee13);
1381
+ }, _callee14);
1266
1382
  }));
1267
- return function (_x16) {
1268
- return _ref13.apply(this, arguments);
1383
+ return function (_x17) {
1384
+ return _ref14.apply(this, arguments);
1269
1385
  };
1270
1386
  }();
1271
1387
  _this.mergeCellAbove = /*#__PURE__*/function () {
1272
- var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(cell) {
1388
+ var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(cell) {
1273
1389
  var _this$model2, cells, selections, selectedIndex, prevCell, source, cellView, cellData;
1274
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1275
- while (1) switch (_context14.prev = _context14.next) {
1390
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1391
+ while (1) switch (_context15.prev = _context15.next) {
1276
1392
  case 0:
1277
1393
  _this$model2 = _this.model, cells = _this$model2.cells, selections = _this$model2.selections;
1278
1394
  if (!(selections.length > 1)) {
1279
- _context14.next = 4;
1395
+ _context15.next = 4;
1280
1396
  break;
1281
1397
  }
1282
1398
  _this.mergeCells(cell);
1283
- return _context14.abrupt("return");
1399
+ return _context15.abrupt("return");
1284
1400
  case 4:
1285
1401
  selectedIndex = _this.findCellIndex(cell);
1286
1402
  if (!(selectedIndex <= 0)) {
1287
- _context14.next = 7;
1403
+ _context15.next = 7;
1288
1404
  break;
1289
1405
  }
1290
- return _context14.abrupt("return");
1406
+ return _context15.abrupt("return");
1291
1407
  case 7:
1292
1408
  prevCell = cells[selectedIndex - 1];
1293
1409
  source = concatMultilineString([prevCell.model.value + '\n' + cell.model.value]);
1294
- _context14.next = 11;
1410
+ _context15.next = 11;
1295
1411
  return _this.getCellViewByOption({
1296
1412
  id: v4(),
1297
1413
  cell: {
@@ -1301,7 +1417,7 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1301
1417
  }
1302
1418
  });
1303
1419
  case 11:
1304
- cellView = _context14.sent;
1420
+ cellView = _context15.sent;
1305
1421
  if (_this.model instanceof LibroModel) {
1306
1422
  _this.model.activeIndex = selectedIndex - 1;
1307
1423
  cellData = [cellView].map(function (_cell) {
@@ -1316,26 +1432,26 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1316
1432
  }
1317
1433
  case 13:
1318
1434
  case "end":
1319
- return _context14.stop();
1435
+ return _context15.stop();
1320
1436
  }
1321
- }, _callee14);
1437
+ }, _callee15);
1322
1438
  }));
1323
- return function (_x17) {
1324
- return _ref14.apply(this, arguments);
1439
+ return function (_x18) {
1440
+ return _ref15.apply(this, arguments);
1325
1441
  };
1326
1442
  }();
1327
1443
  _this.mergeCells = /*#__PURE__*/function () {
1328
- var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(cell) {
1444
+ var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(cell) {
1329
1445
  var selections, selectionsValue, selectionsIndex, source, cellView, cellData, startIndex, endIndex;
1330
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1331
- while (1) switch (_context15.prev = _context15.next) {
1446
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1447
+ while (1) switch (_context16.prev = _context16.next) {
1332
1448
  case 0:
1333
1449
  selections = _this.model.selections;
1334
1450
  if (!(selections.length <= 1)) {
1335
- _context15.next = 3;
1451
+ _context16.next = 3;
1336
1452
  break;
1337
1453
  }
1338
- return _context15.abrupt("return");
1454
+ return _context16.abrupt("return");
1339
1455
  case 3:
1340
1456
  selectionsValue = [];
1341
1457
  selectionsIndex = [];
@@ -1346,7 +1462,7 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1346
1462
  selectionsIndex.push(index);
1347
1463
  });
1348
1464
  source = concatMultilineString(selectionsValue);
1349
- _context15.next = 9;
1465
+ _context16.next = 9;
1350
1466
  return _this.getCellViewByOption({
1351
1467
  id: v4(),
1352
1468
  cell: {
@@ -1356,7 +1472,7 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1356
1472
  }
1357
1473
  });
1358
1474
  case 9:
1359
- cellView = _context15.sent;
1475
+ cellView = _context16.sent;
1360
1476
  if (_this.model instanceof LibroModel) {
1361
1477
  _this.model.activeIndex = Math.min.apply(Math, selectionsIndex);
1362
1478
  cellData = [cellView].map(function (_cell) {
@@ -1372,34 +1488,36 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1372
1488
  }
1373
1489
  case 11:
1374
1490
  case "end":
1375
- return _context15.stop();
1491
+ return _context16.stop();
1376
1492
  }
1377
- }, _callee15);
1493
+ }, _callee16);
1378
1494
  }));
1379
- return function (_x18) {
1380
- return _ref15.apply(this, arguments);
1495
+ return function (_x19) {
1496
+ return _ref16.apply(this, arguments);
1381
1497
  };
1382
1498
  }();
1383
1499
  _this.selectAllCell = function () {
1384
1500
  _this.model.selections = _this.model.cells;
1385
1501
  };
1386
1502
  _this.splitCell = /*#__PURE__*/function () {
1387
- var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(cell) {
1388
- var index, selections, offsets, i, _cell$getSelectionsOf, start, end, splitCells;
1389
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1390
- while (1) switch (_context17.prev = _context17.next) {
1503
+ var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(cell) {
1504
+ var index, _cell$editor$getSelec, _cell$editor, selections, offsets, i, _cell$editor$getOffse, _cell$editor2, _cell$editor$getOffse2, _cell$editor3, select, start, end, splitCells;
1505
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1506
+ while (1) switch (_context18.prev = _context18.next) {
1391
1507
  case 0:
1392
1508
  index = _this.findCellIndex(cell);
1393
1509
  if (!EditorCellView.is(cell)) {
1394
- _context17.next = 10;
1510
+ _context18.next = 10;
1395
1511
  break;
1396
1512
  }
1397
- selections = cell.getSelections();
1513
+ selections = (_cell$editor$getSelec = (_cell$editor = cell.editor) === null || _cell$editor === void 0 ? void 0 : _cell$editor.getSelections()) !== null && _cell$editor$getSelec !== void 0 ? _cell$editor$getSelec : [];
1398
1514
  offsets = [0];
1399
1515
  for (i = 0; i < selections.length; i++) {
1400
1516
  // append start and end to handle selections
1401
1517
  // cursors will have same start and end
1402
- _cell$getSelectionsOf = cell.getSelectionsOffsetAt(selections[i]), start = _cell$getSelectionsOf.start, end = _cell$getSelectionsOf.end;
1518
+ select = selections[i];
1519
+ start = (_cell$editor$getOffse = (_cell$editor2 = cell.editor) === null || _cell$editor2 === void 0 ? void 0 : _cell$editor2.getOffsetAt(select.start)) !== null && _cell$editor$getOffse !== void 0 ? _cell$editor$getOffse : 0;
1520
+ end = (_cell$editor$getOffse2 = (_cell$editor3 = cell.editor) === null || _cell$editor3 === void 0 ? void 0 : _cell$editor3.getOffsetAt(select.end)) !== null && _cell$editor$getOffse2 !== void 0 ? _cell$editor$getOffse2 : 0;
1403
1521
  if (start < end) {
1404
1522
  offsets.push(start);
1405
1523
  offsets.push(end);
@@ -1411,14 +1529,14 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1411
1529
  }
1412
1530
  }
1413
1531
  offsets.push(cell.model.value.length);
1414
- _context17.next = 8;
1532
+ _context18.next = 8;
1415
1533
  return Promise.all(offsets.slice(0, -1).map( /*#__PURE__*/function () {
1416
- var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(offset, offsetIdx) {
1534
+ var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(offset, offsetIdx) {
1417
1535
  var cellView;
1418
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1419
- while (1) switch (_context16.prev = _context16.next) {
1536
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1537
+ while (1) switch (_context17.prev = _context17.next) {
1420
1538
  case 0:
1421
- _context16.next = 2;
1539
+ _context17.next = 2;
1422
1540
  return _this.getCellViewByOption({
1423
1541
  id: v4(),
1424
1542
  cell: {
@@ -1428,29 +1546,29 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1428
1546
  }
1429
1547
  });
1430
1548
  case 2:
1431
- cellView = _context16.sent;
1432
- return _context16.abrupt("return", cellView);
1549
+ cellView = _context17.sent;
1550
+ return _context17.abrupt("return", cellView);
1433
1551
  case 4:
1434
1552
  case "end":
1435
- return _context16.stop();
1553
+ return _context17.stop();
1436
1554
  }
1437
- }, _callee16);
1555
+ }, _callee17);
1438
1556
  }));
1439
- return function (_x20, _x21) {
1440
- return _ref17.apply(this, arguments);
1557
+ return function (_x21, _x22) {
1558
+ return _ref18.apply(this, arguments);
1441
1559
  };
1442
1560
  }()));
1443
1561
  case 8:
1444
- splitCells = _context17.sent;
1562
+ splitCells = _context18.sent;
1445
1563
  _this.model.splitCell(splitCells, index);
1446
1564
  case 10:
1447
1565
  case "end":
1448
- return _context17.stop();
1566
+ return _context18.stop();
1449
1567
  }
1450
- }, _callee17);
1568
+ }, _callee18);
1451
1569
  }));
1452
- return function (_x19) {
1453
- return _ref16.apply(this, arguments);
1570
+ return function (_x20) {
1571
+ return _ref17.apply(this, arguments);
1454
1572
  };
1455
1573
  }();
1456
1574
  _this.restartClearOutput = function () {
@@ -1468,24 +1586,24 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1468
1586
  * Set the markdown header level of a cell.
1469
1587
  */
1470
1588
  _this.setMarkdownHeader = /*#__PURE__*/function () {
1471
- var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(cell, level) {
1589
+ var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(cell, level) {
1472
1590
  var selections, selectionsValue, selectionsIndex, cellViews, cellData, startIndex, endIndex, index, source, regex, newHeader, matches, cellView, _cellData;
1473
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1474
- while (1) switch (_context19.prev = _context19.next) {
1591
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1592
+ while (1) switch (_context20.prev = _context20.next) {
1475
1593
  case 0:
1476
1594
  if (!(_this.model.selections.length !== 0 && _this.isSelected(cell))) {
1477
- _context19.next = 10;
1595
+ _context20.next = 10;
1478
1596
  break;
1479
1597
  }
1480
1598
  selections = _this.model.selections;
1481
1599
  selectionsValue = [];
1482
1600
  selectionsIndex = [];
1483
- _context19.next = 6;
1601
+ _context20.next = 6;
1484
1602
  return Promise.all(selections.map( /*#__PURE__*/function () {
1485
- var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(item) {
1603
+ var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(item) {
1486
1604
  var source, regex, newHeader, matches, index, cellView;
1487
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1488
- while (1) switch (_context18.prev = _context18.next) {
1605
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1606
+ while (1) switch (_context19.prev = _context19.next) {
1489
1607
  case 0:
1490
1608
  source = item.model.value;
1491
1609
  regex = /^(#+\s*)|^(\s*)/;
@@ -1498,7 +1616,7 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1498
1616
  selectionsValue.push(source);
1499
1617
  index = _this.findCellIndex(item);
1500
1618
  selectionsIndex.push(index);
1501
- _context18.next = 11;
1619
+ _context19.next = 11;
1502
1620
  return _this.getCellViewByOption({
1503
1621
  id: v4(),
1504
1622
  cell: {
@@ -1508,20 +1626,20 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1508
1626
  }
1509
1627
  });
1510
1628
  case 11:
1511
- cellView = _context18.sent;
1512
- return _context18.abrupt("return", cellView);
1629
+ cellView = _context19.sent;
1630
+ return _context19.abrupt("return", cellView);
1513
1631
  case 13:
1514
1632
  case "end":
1515
- return _context18.stop();
1633
+ return _context19.stop();
1516
1634
  }
1517
- }, _callee18);
1635
+ }, _callee19);
1518
1636
  }));
1519
- return function (_x24) {
1520
- return _ref19.apply(this, arguments);
1637
+ return function (_x25) {
1638
+ return _ref20.apply(this, arguments);
1521
1639
  };
1522
1640
  }()));
1523
1641
  case 6:
1524
- cellViews = _context19.sent;
1642
+ cellViews = _context20.sent;
1525
1643
  // TODO: why is this needed?
1526
1644
  // const source = concatMultilineString(selectionsValue);
1527
1645
 
@@ -1538,7 +1656,7 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1538
1656
  _this.model.sharedModel.insertCells(startIndex, cellData);
1539
1657
  });
1540
1658
  }
1541
- _context19.next = 21;
1659
+ _context20.next = 21;
1542
1660
  break;
1543
1661
  case 10:
1544
1662
  index = _this.findCellIndex(cell);
@@ -1550,7 +1668,7 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1550
1668
  source = source.slice(matches[0].length);
1551
1669
  }
1552
1670
  source = newHeader + source;
1553
- _context19.next = 19;
1671
+ _context20.next = 19;
1554
1672
  return _this.getCellViewByOption({
1555
1673
  id: v4(),
1556
1674
  cell: {
@@ -1560,7 +1678,7 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1560
1678
  }
1561
1679
  });
1562
1680
  case 19:
1563
- cellView = _context19.sent;
1681
+ cellView = _context20.sent;
1564
1682
  if (_this.model instanceof LibroModel) {
1565
1683
  _this.model.activeIndex = index;
1566
1684
  _cellData = [cellView].map(function (_cell) {
@@ -1576,12 +1694,12 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1576
1694
  _this.enterCommandMode(true);
1577
1695
  case 22:
1578
1696
  case "end":
1579
- return _context19.stop();
1697
+ return _context20.stop();
1580
1698
  }
1581
- }, _callee19);
1699
+ }, _callee20);
1582
1700
  }));
1583
- return function (_x22, _x23) {
1584
- return _ref18.apply(this, arguments);
1701
+ return function (_x23, _x24) {
1702
+ return _ref19.apply(this, arguments);
1585
1703
  };
1586
1704
  }();
1587
1705
  if (_options.id) {
@@ -1593,10 +1711,13 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1593
1711
  view: _assertThisInitialized(_this)
1594
1712
  });
1595
1713
  _this.collapserVisible = _this.collapseService.collapserVisible;
1714
+ _this.virtualizedManagerHelper = virtualizedManagerHelper;
1715
+ _this.virtualizedManager = virtualizedManagerHelper.getOrCreate(_this.model);
1596
1716
  _this.initialize();
1597
1717
  _this.initView();
1598
1718
  return _this;
1599
1719
  }
1720
+ LibroView = inject(VirtualizedManagerHelper)(LibroView, undefined, 3) || LibroView;
1600
1721
  LibroView = inject(NotebookService)(LibroView, undefined, 2) || LibroView;
1601
1722
  LibroView = inject(CollapseServiceFactory)(LibroView, undefined, 1) || LibroView;
1602
1723
  LibroView = inject(ViewOption)(LibroView, undefined, 0) || LibroView;
@@ -1627,6 +1748,11 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1627
1748
  get: function get() {
1628
1749
  return this.runCellEmitter.event;
1629
1750
  }
1751
+ }, {
1752
+ key: "onCellScroll",
1753
+ get: function get() {
1754
+ return this.cellScrollEmitter.event;
1755
+ }
1630
1756
  }, {
1631
1757
  key: "initialized",
1632
1758
  get: function get() {
@@ -1650,17 +1776,17 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1650
1776
  }, {
1651
1777
  key: "initialize",
1652
1778
  value: function () {
1653
- var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1779
+ var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1654
1780
  var _this2 = this;
1655
1781
  var options;
1656
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1657
- while (1) switch (_context20.prev = _context20.next) {
1782
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1783
+ while (1) switch (_context21.prev = _context21.next) {
1658
1784
  case 0:
1659
1785
  this.model.isInitialized = false;
1660
- _context20.next = 3;
1786
+ _context21.next = 3;
1661
1787
  return this.model.initialize();
1662
1788
  case 3:
1663
- options = _context20.sent;
1789
+ options = _context21.sent;
1664
1790
  this.configurationService.get(AutoInsertWhenNoCell).then(function (value) {
1665
1791
  var isAutoInsertWhenNoCell = value;
1666
1792
  if (isAutoInsertWhenNoCell && options.length === 0) {
@@ -1674,10 +1800,10 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1674
1800
  }, 0);
1675
1801
  }
1676
1802
  return;
1677
- }).catch(function () {
1803
+ }).catch(function (e) {
1678
1804
  //
1679
1805
  });
1680
- _context20.next = 7;
1806
+ _context21.next = 7;
1681
1807
  return this.insertCells(options);
1682
1808
  case 7:
1683
1809
  // 第一次insert不需要历史
@@ -1692,20 +1818,21 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1692
1818
  _this2.enterCommandMode(true);
1693
1819
  }
1694
1820
  return;
1695
- }).catch(function () {
1821
+ }).catch(function (e) {
1696
1822
  //
1697
1823
  });
1698
1824
  _this2.toDispose.push(watch(_this2.model, 'cells', function () {
1699
- var _this2$model$onChange, _this2$model;
1825
+ var _this2$model$onChange, _this2$model, _this2$model$onSource, _this2$model2;
1700
1826
  (_this2$model$onChange = (_this2$model = _this2.model).onChange) === null || _this2$model$onChange === void 0 || _this2$model$onChange.call(_this2$model);
1827
+ (_this2$model$onSource = (_this2$model2 = _this2.model).onSourceChange) === null || _this2$model$onSource === void 0 || _this2$model$onSource.call(_this2$model2);
1701
1828
  }));
1702
1829
  _this2.initializedDefer.resolve();
1703
1830
  }, 0);
1704
1831
  case 8:
1705
1832
  case "end":
1706
- return _context20.stop();
1833
+ return _context21.stop();
1707
1834
  }
1708
- }, _callee20, this);
1835
+ }, _callee21, this);
1709
1836
  }));
1710
1837
  function initialize() {
1711
1838
  return _initialize.apply(this, arguments);
@@ -1715,18 +1842,18 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1715
1842
  }, {
1716
1843
  key: "getCellViewByOption",
1717
1844
  value: function () {
1718
- var _getCellViewByOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(option) {
1845
+ var _getCellViewByOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(option) {
1719
1846
  var _this3 = this;
1720
1847
  var toDispose, cellView, disposable;
1721
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1722
- while (1) switch (_context21.prev = _context21.next) {
1848
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1849
+ while (1) switch (_context22.prev = _context22.next) {
1723
1850
  case 0:
1724
1851
  toDispose = new DisposableCollection();
1725
1852
  option.cell.metadata.trusted = this.model.trusted;
1726
- _context21.next = 4;
1853
+ _context22.next = 4;
1727
1854
  return this.cellService.getOrCreateView(option, this.id);
1728
1855
  case 4:
1729
- cellView = _context21.sent;
1856
+ cellView = _context22.sent;
1730
1857
  cellView.parent = this;
1731
1858
  this.onCellCreateEmitter.fire(cellView);
1732
1859
  toDispose.push(Disposable.create(function () {
@@ -1736,14 +1863,14 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1736
1863
  toDispose.dispose();
1737
1864
  });
1738
1865
  toDispose.push(disposable);
1739
- return _context21.abrupt("return", cellView);
1866
+ return _context22.abrupt("return", cellView);
1740
1867
  case 11:
1741
1868
  case "end":
1742
- return _context21.stop();
1869
+ return _context22.stop();
1743
1870
  }
1744
- }, _callee21, this);
1871
+ }, _callee22, this);
1745
1872
  }));
1746
- function getCellViewByOption(_x25) {
1873
+ function getCellViewByOption(_x26) {
1747
1874
  return _getCellViewByOption.apply(this, arguments);
1748
1875
  }
1749
1876
  return getCellViewByOption;
@@ -1753,6 +1880,11 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1753
1880
  get: function get() {
1754
1881
  return this.model.active;
1755
1882
  }
1883
+ }, {
1884
+ key: "activeCellIndex",
1885
+ get: function get() {
1886
+ return this.model.activeIndex;
1887
+ }
1756
1888
  }, {
1757
1889
  key: "executeCellRun",
1758
1890
  value: function executeCellRun(cell) {
@@ -1783,7 +1915,7 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1783
1915
  * Whether a cell is selected.
1784
1916
  */
1785
1917
  function isSelected(cell) {
1786
- if (this.activeCell === cell) {
1918
+ if (equals(this.activeCell, cell)) {
1787
1919
  return true;
1788
1920
  }
1789
1921
  if (this.model.selections.length !== 0) {
@@ -1953,7 +2085,14 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1953
2085
  initializer: function initializer() {
1954
2086
  return false;
1955
2087
  }
1956
- }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "saving", [_dec10], {
2088
+ }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "outputsScroll", [_dec10], {
2089
+ configurable: true,
2090
+ enumerable: true,
2091
+ writable: true,
2092
+ initializer: function initializer() {
2093
+ return false;
2094
+ }
2095
+ }), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, "saving", [_dec11], {
1957
2096
  configurable: true,
1958
2097
  enumerable: true,
1959
2098
  writable: true,