@difizen/libro-core 0.0.2-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (312) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -0
  3. package/es/add-cell/index.d.ts +4 -0
  4. package/es/add-cell/index.d.ts.map +1 -0
  5. package/es/add-cell/index.js +3 -0
  6. package/es/add-cell/index.less +38 -0
  7. package/es/add-cell/libro-add-cell-module.d.ts +3 -0
  8. package/es/add-cell/libro-add-cell-module.d.ts.map +1 -0
  9. package/es/add-cell/libro-add-cell-module.js +4 -0
  10. package/es/add-cell/libro-add-cell-slot-contribution.d.ts +12 -0
  11. package/es/add-cell/libro-add-cell-slot-contribution.d.ts.map +1 -0
  12. package/es/add-cell/libro-add-cell-slot-contribution.js +53 -0
  13. package/es/add-cell/libro-add-cell-view.d.ts +21 -0
  14. package/es/add-cell/libro-add-cell-view.d.ts.map +1 -0
  15. package/es/add-cell/libro-add-cell-view.js +129 -0
  16. package/es/cell/index.d.ts +10 -0
  17. package/es/cell/index.d.ts.map +1 -0
  18. package/es/cell/index.js +9 -0
  19. package/es/cell/libro-cell-contribution.d.ts +13 -0
  20. package/es/cell/libro-cell-contribution.d.ts.map +1 -0
  21. package/es/cell/libro-cell-contribution.js +41 -0
  22. package/es/cell/libro-cell-model.d.ts +19 -0
  23. package/es/cell/libro-cell-model.d.ts.map +1 -0
  24. package/es/cell/libro-cell-model.js +103 -0
  25. package/es/cell/libro-cell-module.d.ts +10 -0
  26. package/es/cell/libro-cell-module.d.ts.map +1 -0
  27. package/es/cell/libro-cell-module.js +30 -0
  28. package/es/cell/libro-cell-protocol.d.ts +42 -0
  29. package/es/cell/libro-cell-protocol.d.ts.map +1 -0
  30. package/es/cell/libro-cell-protocol.js +11 -0
  31. package/es/cell/libro-cell-service.d.ts +28 -0
  32. package/es/cell/libro-cell-service.d.ts.map +1 -0
  33. package/es/cell/libro-cell-service.js +242 -0
  34. package/es/cell/libro-cell-view.d.ts +65 -0
  35. package/es/cell/libro-cell-view.d.ts.map +1 -0
  36. package/es/cell/libro-cell-view.js +191 -0
  37. package/es/cell/libro-edit-cell-view.d.ts +32 -0
  38. package/es/cell/libro-edit-cell-view.d.ts.map +1 -0
  39. package/es/cell/libro-edit-cell-view.js +72 -0
  40. package/es/cell/libro-executable-cell-model.d.ts +14 -0
  41. package/es/cell/libro-executable-cell-model.d.ts.map +1 -0
  42. package/es/cell/libro-executable-cell-model.js +7 -0
  43. package/es/cell/libro-executable-cell-view.d.ts +27 -0
  44. package/es/cell/libro-executable-cell-view.d.ts.map +1 -0
  45. package/es/cell/libro-executable-cell-view.js +66 -0
  46. package/es/cell/libro-markdown-cell-model.d.ts +9 -0
  47. package/es/cell/libro-markdown-cell-model.d.ts.map +1 -0
  48. package/es/cell/libro-markdown-cell-model.js +7 -0
  49. package/es/collapse-service.d.ts +36 -0
  50. package/es/collapse-service.d.ts.map +1 -0
  51. package/es/collapse-service.js +55 -0
  52. package/es/command/document-commands.d.ts +6 -0
  53. package/es/command/document-commands.d.ts.map +1 -0
  54. package/es/command/document-commands.js +13 -0
  55. package/es/command/index.d.ts +7 -0
  56. package/es/command/index.d.ts.map +1 -0
  57. package/es/command/index.js +6 -0
  58. package/es/command/kernel-command.d.ts +5 -0
  59. package/es/command/kernel-command.d.ts.map +1 -0
  60. package/es/command/kernel-command.js +39 -0
  61. package/es/command/libro-command-contribution.d.ts +14 -0
  62. package/es/command/libro-command-contribution.d.ts.map +1 -0
  63. package/es/command/libro-command-contribution.js +1751 -0
  64. package/es/command/libro-command-register.d.ts +22 -0
  65. package/es/command/libro-command-register.d.ts.map +1 -0
  66. package/es/command/libro-command-register.js +105 -0
  67. package/es/command/module.d.ts +3 -0
  68. package/es/command/module.d.ts.map +1 -0
  69. package/es/command/module.js +4 -0
  70. package/es/command/notebook-commands.d.ts +6 -0
  71. package/es/command/notebook-commands.d.ts.map +1 -0
  72. package/es/command/notebook-commands.js +468 -0
  73. package/es/components/cell-protocol.d.ts +20 -0
  74. package/es/components/cell-protocol.d.ts.map +1 -0
  75. package/es/components/cell-protocol.js +4 -0
  76. package/es/components/dnd-cell-item-render.d.ts +12 -0
  77. package/es/components/dnd-cell-item-render.d.ts.map +1 -0
  78. package/es/components/dnd-cell-item-render.js +253 -0
  79. package/es/components/dnd-component/custom-drag-layer.d.ts +9 -0
  80. package/es/components/dnd-component/custom-drag-layer.d.ts.map +1 -0
  81. package/es/components/dnd-component/custom-drag-layer.js +141 -0
  82. package/es/components/dnd-component/default-dnd-content.d.ts +10 -0
  83. package/es/components/dnd-component/default-dnd-content.d.ts.map +1 -0
  84. package/es/components/dnd-component/default-dnd-content.js +257 -0
  85. package/es/components/dnd-component/dnd-context.d.ts +3 -0
  86. package/es/components/dnd-component/dnd-context.d.ts.map +1 -0
  87. package/es/components/dnd-component/dnd-context.js +20 -0
  88. package/es/components/dnd-component/dnd-list.d.ts +10 -0
  89. package/es/components/dnd-component/dnd-list.d.ts.map +1 -0
  90. package/es/components/dnd-component/dnd-list.js +115 -0
  91. package/es/components/dnd-component/index.d.ts +5 -0
  92. package/es/components/dnd-component/index.d.ts.map +1 -0
  93. package/es/components/dnd-component/index.js +4 -0
  94. package/es/components/index.d.ts +6 -0
  95. package/es/components/index.d.ts.map +1 -0
  96. package/es/components/index.js +5 -0
  97. package/es/components/libro-component.d.ts +5 -0
  98. package/es/components/libro-component.d.ts.map +1 -0
  99. package/es/components/libro-component.js +35 -0
  100. package/es/components/libro-side-toolbar-menu.d.ts +21 -0
  101. package/es/components/libro-side-toolbar-menu.d.ts.map +1 -0
  102. package/es/components/libro-side-toolbar-menu.js +58 -0
  103. package/es/components/libro-view-header.d.ts +3 -0
  104. package/es/components/libro-view-header.d.ts.map +1 -0
  105. package/es/components/libro-view-header.js +37 -0
  106. package/es/configuration/libro-configuration-contribution.d.ts +5 -0
  107. package/es/configuration/libro-configuration-contribution.d.ts.map +1 -0
  108. package/es/configuration/libro-configuration-contribution.js +24 -0
  109. package/es/configuration/libro-configuration.d.ts +10 -0
  110. package/es/configuration/libro-configuration.d.ts.map +1 -0
  111. package/es/configuration/libro-configuration.js +81 -0
  112. package/es/content/index.d.ts +5 -0
  113. package/es/content/index.d.ts.map +1 -0
  114. package/es/content/index.js +4 -0
  115. package/es/content/libro-content-contribution.d.ts +11 -0
  116. package/es/content/libro-content-contribution.d.ts.map +1 -0
  117. package/es/content/libro-content-contribution.js +32 -0
  118. package/es/content/libro-content-module.d.ts +3 -0
  119. package/es/content/libro-content-module.d.ts.map +1 -0
  120. package/es/content/libro-content-module.js +5 -0
  121. package/es/content/libro-content-protocol.d.ts +8 -0
  122. package/es/content/libro-content-protocol.d.ts.map +1 -0
  123. package/es/content/libro-content-protocol.js +2 -0
  124. package/es/content/libro-content-service.d.ts +9 -0
  125. package/es/content/libro-content-service.d.ts.map +1 -0
  126. package/es/content/libro-content-service.js +35 -0
  127. package/es/index.d.ts +20 -0
  128. package/es/index.d.ts.map +1 -0
  129. package/es/index.js +19 -0
  130. package/es/index.less +682 -0
  131. package/es/libro-context-key.d.ts +22 -0
  132. package/es/libro-context-key.d.ts.map +1 -0
  133. package/es/libro-context-key.js +80 -0
  134. package/es/libro-keybind-registry.d.ts +5 -0
  135. package/es/libro-keybind-registry.d.ts.map +1 -0
  136. package/es/libro-keybind-registry.js +68 -0
  137. package/es/libro-model.d.ts +129 -0
  138. package/es/libro-model.d.ts.map +1 -0
  139. package/es/libro-model.js +803 -0
  140. package/es/libro-protocol.d.ts +241 -0
  141. package/es/libro-protocol.d.ts.map +1 -0
  142. package/es/libro-protocol.js +34 -0
  143. package/es/libro-service.d.ts +34 -0
  144. package/es/libro-service.d.ts.map +1 -0
  145. package/es/libro-service.js +180 -0
  146. package/es/libro-view-tracker.d.ts +6 -0
  147. package/es/libro-view-tracker.d.ts.map +1 -0
  148. package/es/libro-view-tracker.js +13 -0
  149. package/es/libro-view.d.ts +151 -0
  150. package/es/libro-view.d.ts.map +1 -0
  151. package/es/libro-view.js +1963 -0
  152. package/es/material-from-designer.d.ts +27 -0
  153. package/es/material-from-designer.d.ts.map +1 -0
  154. package/es/material-from-designer.js +550 -0
  155. package/es/module.d.ts +3 -0
  156. package/es/module.d.ts.map +1 -0
  157. package/es/module.js +55 -0
  158. package/es/output/index.d.ts +6 -0
  159. package/es/output/index.d.ts.map +1 -0
  160. package/es/output/index.js +5 -0
  161. package/es/output/output-area.d.ts +51 -0
  162. package/es/output/output-area.d.ts.map +1 -0
  163. package/es/output/output-area.js +346 -0
  164. package/es/output/output-contribution.d.ts +11 -0
  165. package/es/output/output-contribution.d.ts.map +1 -0
  166. package/es/output/output-contribution.js +31 -0
  167. package/es/output/output-model.d.ts +27 -0
  168. package/es/output/output-model.d.ts.map +1 -0
  169. package/es/output/output-model.js +95 -0
  170. package/es/output/output-module.d.ts +3 -0
  171. package/es/output/output-module.d.ts.map +1 -0
  172. package/es/output/output-module.js +6 -0
  173. package/es/output/output-protocol.d.ts +130 -0
  174. package/es/output/output-protocol.d.ts.map +1 -0
  175. package/es/output/output-protocol.js +18 -0
  176. package/es/slot/index.d.ts +5 -0
  177. package/es/slot/index.d.ts.map +1 -0
  178. package/es/slot/index.js +4 -0
  179. package/es/slot/libro-slot-manager.d.ts +13 -0
  180. package/es/slot/libro-slot-manager.d.ts.map +1 -0
  181. package/es/slot/libro-slot-manager.js +57 -0
  182. package/es/slot/libro-slot-protocol.d.ts +19 -0
  183. package/es/slot/libro-slot-protocol.d.ts.map +1 -0
  184. package/es/slot/libro-slot-protocol.js +5 -0
  185. package/es/slot/libro-slot-view.d.ts +9 -0
  186. package/es/slot/libro-slot-view.d.ts.map +1 -0
  187. package/es/slot/libro-slot-view.js +81 -0
  188. package/es/slot/module.d.ts +3 -0
  189. package/es/slot/module.d.ts.map +1 -0
  190. package/es/slot/module.js +5 -0
  191. package/es/theme/libro-color-registry.d.ts +6 -0
  192. package/es/theme/libro-color-registry.d.ts.map +1 -0
  193. package/es/theme/libro-color-registry.js +494 -0
  194. package/es/toolbar/change-cell-to-selector.d.ts +5 -0
  195. package/es/toolbar/change-cell-to-selector.d.ts.map +1 -0
  196. package/es/toolbar/change-cell-to-selector.js +48 -0
  197. package/es/toolbar/hide-all-selector.d.ts +5 -0
  198. package/es/toolbar/hide-all-selector.d.ts.map +1 -0
  199. package/es/toolbar/hide-all-selector.js +99 -0
  200. package/es/toolbar/index.d.ts +4 -0
  201. package/es/toolbar/index.d.ts.map +1 -0
  202. package/es/toolbar/index.js +3 -0
  203. package/es/toolbar/index.less +59 -0
  204. package/es/toolbar/libro-toolbar-protocol.d.ts +4 -0
  205. package/es/toolbar/libro-toolbar-protocol.d.ts.map +1 -0
  206. package/es/toolbar/libro-toolbar-protocol.js +1 -0
  207. package/es/toolbar/libro-toolbar.d.ts +8 -0
  208. package/es/toolbar/libro-toolbar.d.ts.map +1 -0
  209. package/es/toolbar/libro-toolbar.js +223 -0
  210. package/es/toolbar/module.d.ts +3 -0
  211. package/es/toolbar/module.d.ts.map +1 -0
  212. package/es/toolbar/module.js +5 -0
  213. package/es/toolbar/restart-clear-outputs-contribution.d.ts +5 -0
  214. package/es/toolbar/restart-clear-outputs-contribution.d.ts.map +1 -0
  215. package/es/toolbar/restart-clear-outputs-contribution.js +23 -0
  216. package/es/toolbar/restart-clear-outputs-modal.d.ts +6 -0
  217. package/es/toolbar/restart-clear-outputs-modal.d.ts.map +1 -0
  218. package/es/toolbar/restart-clear-outputs-modal.js +30 -0
  219. package/es/toolbar/save-icon.d.ts +3 -0
  220. package/es/toolbar/save-icon.d.ts.map +1 -0
  221. package/es/toolbar/save-icon.js +54 -0
  222. package/es/toolbar/shutdown-contribution.d.ts +5 -0
  223. package/es/toolbar/shutdown-contribution.d.ts.map +1 -0
  224. package/es/toolbar/shutdown-contribution.js +23 -0
  225. package/es/toolbar/shutdown-modal.d.ts +6 -0
  226. package/es/toolbar/shutdown-modal.d.ts.map +1 -0
  227. package/es/toolbar/shutdown-modal.js +30 -0
  228. package/es/toolbar/side-toolar-more-select.d.ts +4 -0
  229. package/es/toolbar/side-toolar-more-select.d.ts.map +1 -0
  230. package/es/toolbar/side-toolar-more-select.js +161 -0
  231. package/es/typings/index.d.ts +1 -0
  232. package/package.json +70 -0
  233. package/src/add-cell/index.less +38 -0
  234. package/src/add-cell/index.ts +3 -0
  235. package/src/add-cell/libro-add-cell-module.ts +9 -0
  236. package/src/add-cell/libro-add-cell-slot-contribution.ts +31 -0
  237. package/src/add-cell/libro-add-cell-view.tsx +101 -0
  238. package/src/cell/README.md +14 -0
  239. package/src/cell/index.ts +9 -0
  240. package/src/cell/libro-cell-contribution.ts +38 -0
  241. package/src/cell/libro-cell-model.ts +61 -0
  242. package/src/cell/libro-cell-module.ts +40 -0
  243. package/src/cell/libro-cell-protocol.ts +53 -0
  244. package/src/cell/libro-cell-service.ts +157 -0
  245. package/src/cell/libro-cell-view.tsx +128 -0
  246. package/src/cell/libro-edit-cell-view.tsx +60 -0
  247. package/src/cell/libro-executable-cell-model.ts +32 -0
  248. package/src/cell/libro-executable-cell-view.ts +74 -0
  249. package/src/cell/libro-markdown-cell-model.ts +20 -0
  250. package/src/collapse-service.ts +69 -0
  251. package/src/command/document-commands.ts +18 -0
  252. package/src/command/index.ts +6 -0
  253. package/src/command/kernel-command.ts +41 -0
  254. package/src/command/libro-command-contribution.ts +1339 -0
  255. package/src/command/libro-command-register.ts +171 -0
  256. package/src/command/module.ts +9 -0
  257. package/src/command/notebook-commands.ts +498 -0
  258. package/src/components/cell-protocol.ts +22 -0
  259. package/src/components/dnd-cell-item-render.tsx +308 -0
  260. package/src/components/dnd-component/custom-drag-layer.tsx +145 -0
  261. package/src/components/dnd-component/default-dnd-content.tsx +275 -0
  262. package/src/components/dnd-component/dnd-context.tsx +28 -0
  263. package/src/components/dnd-component/dnd-list.tsx +116 -0
  264. package/src/components/dnd-component/index.tsx +4 -0
  265. package/src/components/index.ts +5 -0
  266. package/src/components/libro-component.tsx +30 -0
  267. package/src/components/libro-side-toolbar-menu.tsx +82 -0
  268. package/src/components/libro-view-header.tsx +33 -0
  269. package/src/configuration/libro-configuration-contribution.ts +29 -0
  270. package/src/configuration/libro-configuration.ts +88 -0
  271. package/src/content/index.ts +4 -0
  272. package/src/content/libro-content-contribution.ts +17 -0
  273. package/src/content/libro-content-module.ts +9 -0
  274. package/src/content/libro-content-protocol.ts +8 -0
  275. package/src/content/libro-content-service.ts +30 -0
  276. package/src/index.less +682 -0
  277. package/src/index.tsx +19 -0
  278. package/src/libro-context-key.ts +80 -0
  279. package/src/libro-keybind-registry.ts +43 -0
  280. package/src/libro-model.ts +614 -0
  281. package/src/libro-protocol.ts +322 -0
  282. package/src/libro-service.ts +121 -0
  283. package/src/libro-view-tracker.ts +9 -0
  284. package/src/libro-view.tsx +1399 -0
  285. package/src/material-from-designer.tsx +457 -0
  286. package/src/module.ts +90 -0
  287. package/src/output/index.ts +5 -0
  288. package/src/output/output-area.tsx +255 -0
  289. package/src/output/output-contribution.ts +18 -0
  290. package/src/output/output-model.tsx +66 -0
  291. package/src/output/output-module.ts +10 -0
  292. package/src/output/output-protocol.ts +164 -0
  293. package/src/slot/index.ts +4 -0
  294. package/src/slot/libro-slot-manager.ts +37 -0
  295. package/src/slot/libro-slot-protocol.ts +28 -0
  296. package/src/slot/libro-slot-view.tsx +51 -0
  297. package/src/slot/module.ts +9 -0
  298. package/src/theme/libro-color-registry.ts +371 -0
  299. package/src/toolbar/change-cell-to-selector.tsx +58 -0
  300. package/src/toolbar/hide-all-selector.tsx +126 -0
  301. package/src/toolbar/index.less +59 -0
  302. package/src/toolbar/index.ts +3 -0
  303. package/src/toolbar/libro-toolbar-protocol.ts +4 -0
  304. package/src/toolbar/libro-toolbar.tsx +192 -0
  305. package/src/toolbar/module.ts +11 -0
  306. package/src/toolbar/restart-clear-outputs-contribution.tsx +10 -0
  307. package/src/toolbar/restart-clear-outputs-modal.tsx +37 -0
  308. package/src/toolbar/save-icon.tsx +47 -0
  309. package/src/toolbar/shutdown-contribution.tsx +10 -0
  310. package/src/toolbar/shutdown-modal.tsx +37 -0
  311. package/src/toolbar/side-toolar-more-select.tsx +172 -0
  312. package/src/typings/index.d.ts +1 -0
@@ -0,0 +1,1751 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ var _dec, _class;
3
+ 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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
4
+ 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); } }
5
+ 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); }); }; }
6
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
7
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
8
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
9
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
10
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
11
+ import { inject, ModalService, singleton, CommandContribution } from '@difizen/mana-app';
12
+ import { equals } from '@difizen/mana-app';
13
+ import { v4 } from 'uuid';
14
+ import { LibroCellView, ExecutableCellModel } from "../cell/index.js";
15
+ import { LirboContextKey } from "../libro-context-key.js";
16
+ import { LibroToolbarArea } from "../libro-protocol.js";
17
+ import { LibroService } from "../libro-service.js";
18
+ import { LibroView } from "../libro-view.js";
19
+ import { RestartClearOutputModal } from "../toolbar/restart-clear-outputs-modal.js";
20
+ import { ShutdownModal } from "../toolbar/shutdown-modal.js";
21
+ import { DocumentCommands } from "./document-commands.js";
22
+ import { LibroCommandRegister } from "./libro-command-register.js";
23
+ import { NotebookCommands } from "./notebook-commands.js";
24
+ export var LibroCommandContribution = (_dec = singleton({
25
+ contrib: CommandContribution
26
+ }), _dec(_class = /*#__PURE__*/function () {
27
+ function LibroCommandContribution(modalService, libroCommand, libroService, lirboContextKey) {
28
+ _classCallCheck(this, LibroCommandContribution);
29
+ this.modalService = void 0;
30
+ this.libroCommand = void 0;
31
+ this.libroService = void 0;
32
+ this.lirboContextKey = void 0;
33
+ this.libroCommand = libroCommand;
34
+ this.modalService = modalService;
35
+ this.libroService = libroService;
36
+ this.lirboContextKey = lirboContextKey;
37
+ }
38
+ LibroCommandContribution = inject(LirboContextKey)(LibroCommandContribution, undefined, 3) || LibroCommandContribution;
39
+ LibroCommandContribution = inject(LibroService)(LibroCommandContribution, undefined, 2) || LibroCommandContribution;
40
+ LibroCommandContribution = inject(LibroCommandRegister)(LibroCommandContribution, undefined, 1) || LibroCommandContribution;
41
+ LibroCommandContribution = inject(ModalService)(LibroCommandContribution, undefined, 0) || LibroCommandContribution;
42
+ _createClass(LibroCommandContribution, [{
43
+ key: "registerCommands",
44
+ value: function registerCommands(command) {
45
+ var _this = this;
46
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['EnterEditMode'], {
47
+ execute: function () {
48
+ var _execute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
49
+ var _this$libroService$ac;
50
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
51
+ while (1) switch (_context.prev = _context.next) {
52
+ case 0:
53
+ (_this$libroService$ac = _this.libroService.active) === null || _this$libroService$ac === void 0 ? void 0 : _this$libroService$ac.enterEditMode();
54
+ case 1:
55
+ case "end":
56
+ return _context.stop();
57
+ }
58
+ }, _callee);
59
+ }));
60
+ function execute() {
61
+ return _execute.apply(this, arguments);
62
+ }
63
+ return execute;
64
+ }(),
65
+ isEnabled: function isEnabled(_cell, libro) {
66
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
67
+ return false;
68
+ }
69
+ return true;
70
+ }
71
+ });
72
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['EnterCommandMode'], {
73
+ execute: function execute() {
74
+ var _this$libroService$ac2;
75
+ (_this$libroService$ac2 = _this.libroService.active) === null || _this$libroService$ac2 === void 0 ? void 0 : _this$libroService$ac2.enterCommandMode(true);
76
+ }
77
+ });
78
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['SelectAll'], {
79
+ execute: function execute(cell, libro) {
80
+ if (!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView)) {
81
+ return;
82
+ }
83
+ libro.selectAllCell();
84
+ }
85
+ });
86
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['RunCell'], {
87
+ execute: function () {
88
+ var _execute2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(cell, libro) {
89
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
90
+ while (1) switch (_context2.prev = _context2.next) {
91
+ case 0:
92
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
93
+ _context2.next = 2;
94
+ break;
95
+ }
96
+ return _context2.abrupt("return");
97
+ case 2:
98
+ libro.runCell(cell);
99
+ case 3:
100
+ case "end":
101
+ return _context2.stop();
102
+ }
103
+ }, _callee2);
104
+ }));
105
+ function execute(_x, _x2) {
106
+ return _execute2.apply(this, arguments);
107
+ }
108
+ return execute;
109
+ }(),
110
+ isEnabled: function isEnabled(_cell, libro) {
111
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
112
+ return false;
113
+ }
114
+ return true;
115
+ }
116
+ });
117
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['RunAllCells'], {
118
+ execute: function () {
119
+ var _execute3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_cell, libro) {
120
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
121
+ while (1) switch (_context3.prev = _context3.next) {
122
+ case 0:
123
+ if (!(!libro || !(libro instanceof LibroView))) {
124
+ _context3.next = 2;
125
+ break;
126
+ }
127
+ return _context3.abrupt("return");
128
+ case 2:
129
+ libro.runAllCell();
130
+ case 3:
131
+ case "end":
132
+ return _context3.stop();
133
+ }
134
+ }, _callee3);
135
+ }));
136
+ function execute(_x3, _x4) {
137
+ return _execute3.apply(this, arguments);
138
+ }
139
+ return execute;
140
+ }()
141
+ });
142
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['RunAllAbove'], {
143
+ execute: function () {
144
+ var _execute4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(cell, libro) {
145
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
146
+ while (1) switch (_context4.prev = _context4.next) {
147
+ case 0:
148
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
149
+ _context4.next = 2;
150
+ break;
151
+ }
152
+ return _context4.abrupt("return");
153
+ case 2:
154
+ libro.runAllAbove(cell);
155
+ case 3:
156
+ case "end":
157
+ return _context4.stop();
158
+ }
159
+ }, _callee4);
160
+ }));
161
+ function execute(_x5, _x6) {
162
+ return _execute4.apply(this, arguments);
163
+ }
164
+ return execute;
165
+ }()
166
+ });
167
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['RunAllBelow'], {
168
+ execute: function () {
169
+ var _execute5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(cell, libro) {
170
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
171
+ while (1) switch (_context5.prev = _context5.next) {
172
+ case 0:
173
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
174
+ _context5.next = 2;
175
+ break;
176
+ }
177
+ return _context5.abrupt("return");
178
+ case 2:
179
+ libro.runAllBelow(cell);
180
+ case 3:
181
+ case "end":
182
+ return _context5.stop();
183
+ }
184
+ }, _callee5);
185
+ }));
186
+ function execute(_x7, _x8) {
187
+ return _execute5.apply(this, arguments);
188
+ }
189
+ return execute;
190
+ }()
191
+ });
192
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['RunCellAndSelectNext'], {
193
+ execute: function () {
194
+ var _execute6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(cell, libro) {
195
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
196
+ while (1) switch (_context6.prev = _context6.next) {
197
+ case 0:
198
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
199
+ _context6.next = 2;
200
+ break;
201
+ }
202
+ return _context6.abrupt("return");
203
+ case 2:
204
+ libro.runCellandSelectNext(cell);
205
+ case 3:
206
+ case "end":
207
+ return _context6.stop();
208
+ }
209
+ }, _callee6);
210
+ }));
211
+ function execute(_x9, _x10) {
212
+ return _execute6.apply(this, arguments);
213
+ }
214
+ return execute;
215
+ }(),
216
+ isEnabled: function isEnabled(_cell, libro) {
217
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
218
+ return false;
219
+ }
220
+ return true;
221
+ }
222
+ });
223
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['RunCellAndInsertBelow'], {
224
+ execute: function () {
225
+ var _execute7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(cell, libro) {
226
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
227
+ while (1) switch (_context7.prev = _context7.next) {
228
+ case 0:
229
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
230
+ _context7.next = 2;
231
+ break;
232
+ }
233
+ return _context7.abrupt("return");
234
+ case 2:
235
+ libro.runCellandInsertBelow(cell);
236
+ case 3:
237
+ case "end":
238
+ return _context7.stop();
239
+ }
240
+ }, _callee7);
241
+ }));
242
+ function execute(_x11, _x12) {
243
+ return _execute7.apply(this, arguments);
244
+ }
245
+ return execute;
246
+ }(),
247
+ isEnabled: function isEnabled(_cell, libro) {
248
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
249
+ return false;
250
+ }
251
+ return true;
252
+ }
253
+ });
254
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['Interrupt'], {
255
+ execute: function () {
256
+ var _execute8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_cell, libro) {
257
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
258
+ while (1) switch (_context8.prev = _context8.next) {
259
+ case 0:
260
+ if (!(!libro || !(libro instanceof LibroView))) {
261
+ _context8.next = 2;
262
+ break;
263
+ }
264
+ return _context8.abrupt("return", false);
265
+ case 2:
266
+ if (libro.model.interrupt) {
267
+ libro.model.interrupt();
268
+ }
269
+ return _context8.abrupt("return");
270
+ case 4:
271
+ case "end":
272
+ return _context8.stop();
273
+ }
274
+ }, _callee8);
275
+ }));
276
+ function execute(_x13, _x14) {
277
+ return _execute8.apply(this, arguments);
278
+ }
279
+ return execute;
280
+ }(),
281
+ isEnabled: function isEnabled(_cell, libro) {
282
+ if (!libro || !(libro instanceof LibroView)) {
283
+ return false;
284
+ }
285
+ return libro.model.getCells().findIndex(function (item) {
286
+ return ExecutableCellModel.is(item.model) && item.model.executing;
287
+ }) >= 0;
288
+ },
289
+ isVisible: function isVisible(_cell, libro, path) {
290
+ if (!libro || !(libro instanceof LibroView)) {
291
+ return false;
292
+ }
293
+ return !(libro !== null && libro !== void 0 && libro.model.quickEditMode) && !(libro !== null && libro !== void 0 && libro.model.readOnly) && path === LibroToolbarArea.HeaderCenter;
294
+ }
295
+ });
296
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['RestartClearOutput'], {
297
+ execute: function () {
298
+ var _execute9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_cell, libro) {
299
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
300
+ while (1) switch (_context9.prev = _context9.next) {
301
+ case 0:
302
+ if (!(!libro || !(libro instanceof LibroView))) {
303
+ _context9.next = 2;
304
+ break;
305
+ }
306
+ return _context9.abrupt("return", false);
307
+ case 2:
308
+ _this.modalService.openModal(RestartClearOutputModal, libro);
309
+ return _context9.abrupt("return");
310
+ case 4:
311
+ case "end":
312
+ return _context9.stop();
313
+ }
314
+ }, _callee9);
315
+ }));
316
+ function execute(_x15, _x16) {
317
+ return _execute9.apply(this, arguments);
318
+ }
319
+ return execute;
320
+ }(),
321
+ isVisible: function isVisible(_cell, libro, path) {
322
+ if (!libro || !(libro instanceof LibroView)) {
323
+ return false;
324
+ }
325
+ return !(libro !== null && libro !== void 0 && libro.model.quickEditMode) && !(libro !== null && libro !== void 0 && libro.model.readOnly) && path === LibroToolbarArea.HeaderCenter;
326
+ }
327
+ });
328
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['CloseAndShutdown'], {
329
+ execute: function () {
330
+ var _execute10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_cell, libro) {
331
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
332
+ while (1) switch (_context10.prev = _context10.next) {
333
+ case 0:
334
+ if (!(!libro || !(libro instanceof LibroView))) {
335
+ _context10.next = 2;
336
+ break;
337
+ }
338
+ return _context10.abrupt("return", false);
339
+ case 2:
340
+ _this.modalService.openModal(ShutdownModal, libro);
341
+ return _context10.abrupt("return");
342
+ case 4:
343
+ case "end":
344
+ return _context10.stop();
345
+ }
346
+ }, _callee10);
347
+ }));
348
+ function execute(_x17, _x18) {
349
+ return _execute10.apply(this, arguments);
350
+ }
351
+ return execute;
352
+ }(),
353
+ isVisible: function isVisible() {
354
+ return false;
355
+ }
356
+ // isVisible: (cell, libro, path) => {
357
+ // if (!libro || !(libro instanceof LibroView)) return false;
358
+ // if (path !== LibroToolbarArea.HeaderCenter || libro.model.quickEditMode) return false;
359
+ // return true;
360
+ // },
361
+ });
362
+
363
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['InsertCellBelow'], {
364
+ execute: function () {
365
+ var _execute11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(cell, libro) {
366
+ var cellIndex;
367
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
368
+ while (1) switch (_context11.prev = _context11.next) {
369
+ case 0:
370
+ if (!(!libro || !(libro instanceof LibroView))) {
371
+ _context11.next = 2;
372
+ break;
373
+ }
374
+ return _context11.abrupt("return");
375
+ case 2:
376
+ if (!cell || !(cell instanceof LibroCellView)) {
377
+ libro.addCell({
378
+ id: v4(),
379
+ cell: {
380
+ cell_type: 'code',
381
+ source: '',
382
+ metadata: {}
383
+ }
384
+ }, 0);
385
+ } else {
386
+ cellIndex = libro.model.cells.findIndex(function (item) {
387
+ return equals(item, cell);
388
+ });
389
+ libro.addCell({
390
+ id: v4(),
391
+ cell: {
392
+ cell_type: cell.model.type,
393
+ source: '',
394
+ metadata: {}
395
+ }
396
+ }, cellIndex + 1);
397
+ }
398
+ case 3:
399
+ case "end":
400
+ return _context11.stop();
401
+ }
402
+ }, _callee11);
403
+ }));
404
+ function execute(_x19, _x20) {
405
+ return _execute11.apply(this, arguments);
406
+ }
407
+ return execute;
408
+ }(),
409
+ // isVisible: () => false,
410
+ isVisible: function isVisible(_cell, libro, path) {
411
+ if (!libro || !(libro instanceof LibroView)) {
412
+ return false;
413
+ }
414
+ return !(libro !== null && libro !== void 0 && libro.model.readOnly) && path === LibroToolbarArea.CellRight;
415
+ },
416
+ isEnabled: function isEnabled(_cell, libro) {
417
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
418
+ return false;
419
+ }
420
+ return true;
421
+ }
422
+ });
423
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['InsertCellAbove'], {
424
+ execute: function () {
425
+ var _execute12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(cell, libro) {
426
+ var cellIndex;
427
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
428
+ while (1) switch (_context12.prev = _context12.next) {
429
+ case 0:
430
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
431
+ _context12.next = 2;
432
+ break;
433
+ }
434
+ return _context12.abrupt("return");
435
+ case 2:
436
+ cellIndex = libro.model.cells.findIndex(function (item) {
437
+ return equals(item, cell);
438
+ });
439
+ if (cellIndex > -1) {
440
+ libro.addCellAbove({
441
+ id: v4(),
442
+ cell: {
443
+ cell_type: cell.model.type,
444
+ source: '',
445
+ metadata: {}
446
+ }
447
+ }, cellIndex);
448
+ }
449
+ case 4:
450
+ case "end":
451
+ return _context12.stop();
452
+ }
453
+ }, _callee12);
454
+ }));
455
+ function execute(_x21, _x22) {
456
+ return _execute12.apply(this, arguments);
457
+ }
458
+ return execute;
459
+ }(),
460
+ isEnabled: function isEnabled(_cell, libro) {
461
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
462
+ return false;
463
+ }
464
+ return true;
465
+ }
466
+ });
467
+ command.registerCommand(NotebookCommands['InsertCellBottom'], {
468
+ execute: function () {
469
+ var _execute13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(libro, targetType) {
470
+ var nextIndex;
471
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
472
+ while (1) switch (_context13.prev = _context13.next) {
473
+ case 0:
474
+ if (!(!libro || !(libro instanceof LibroView))) {
475
+ _context13.next = 2;
476
+ break;
477
+ }
478
+ return _context13.abrupt("return");
479
+ case 2:
480
+ nextIndex = libro.model.cells.length;
481
+ libro.addCell({
482
+ cell: {
483
+ cell_type: targetType,
484
+ metadata: {},
485
+ source: ''
486
+ }
487
+ }, nextIndex);
488
+ case 4:
489
+ case "end":
490
+ return _context13.stop();
491
+ }
492
+ }, _callee13);
493
+ }));
494
+ function execute(_x23, _x24) {
495
+ return _execute13.apply(this, arguments);
496
+ }
497
+ return execute;
498
+ }()
499
+ });
500
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['MoveCursorDown'], {
501
+ execute: function () {
502
+ var _execute14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(cell, libro) {
503
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
504
+ while (1) switch (_context14.prev = _context14.next) {
505
+ case 0:
506
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
507
+ _context14.next = 2;
508
+ break;
509
+ }
510
+ return _context14.abrupt("return");
511
+ case 2:
512
+ libro.moveCursorDown(cell);
513
+ case 3:
514
+ case "end":
515
+ return _context14.stop();
516
+ }
517
+ }, _callee14);
518
+ }));
519
+ function execute(_x25, _x26) {
520
+ return _execute14.apply(this, arguments);
521
+ }
522
+ return execute;
523
+ }()
524
+ });
525
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['MoveCursorUp'], {
526
+ execute: function () {
527
+ var _execute15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(cell, libro) {
528
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
529
+ while (1) switch (_context15.prev = _context15.next) {
530
+ case 0:
531
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
532
+ _context15.next = 2;
533
+ break;
534
+ }
535
+ return _context15.abrupt("return");
536
+ case 2:
537
+ libro.moveCursorUp(cell);
538
+ case 3:
539
+ case "end":
540
+ return _context15.stop();
541
+ }
542
+ }, _callee15);
543
+ }));
544
+ function execute(_x27, _x28) {
545
+ return _execute15.apply(this, arguments);
546
+ }
547
+ return execute;
548
+ }()
549
+ });
550
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['MergeCellBelow'], {
551
+ execute: function () {
552
+ var _execute16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(cell, libro) {
553
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
554
+ while (1) switch (_context16.prev = _context16.next) {
555
+ case 0:
556
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
557
+ _context16.next = 2;
558
+ break;
559
+ }
560
+ return _context16.abrupt("return");
561
+ case 2:
562
+ libro.mergeCellBelow(cell);
563
+ case 3:
564
+ case "end":
565
+ return _context16.stop();
566
+ }
567
+ }, _callee16);
568
+ }));
569
+ function execute(_x29, _x30) {
570
+ return _execute16.apply(this, arguments);
571
+ }
572
+ return execute;
573
+ }(),
574
+ isEnabled: function isEnabled(_cell, libro) {
575
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
576
+ return false;
577
+ }
578
+ return true;
579
+ }
580
+ });
581
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['MergeCellAbove'], {
582
+ execute: function () {
583
+ var _execute17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(cell, libro) {
584
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
585
+ while (1) switch (_context17.prev = _context17.next) {
586
+ case 0:
587
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
588
+ _context17.next = 2;
589
+ break;
590
+ }
591
+ return _context17.abrupt("return");
592
+ case 2:
593
+ libro.mergeCellAbove(cell);
594
+ case 3:
595
+ case "end":
596
+ return _context17.stop();
597
+ }
598
+ }, _callee17);
599
+ }));
600
+ function execute(_x31, _x32) {
601
+ return _execute17.apply(this, arguments);
602
+ }
603
+ return execute;
604
+ }(),
605
+ isEnabled: function isEnabled(_cell, libro) {
606
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
607
+ return false;
608
+ }
609
+ return true;
610
+ }
611
+ });
612
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['MergeCells'], {
613
+ execute: function () {
614
+ var _execute18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(cell, libro) {
615
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
616
+ while (1) switch (_context18.prev = _context18.next) {
617
+ case 0:
618
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
619
+ _context18.next = 2;
620
+ break;
621
+ }
622
+ return _context18.abrupt("return");
623
+ case 2:
624
+ libro.mergeCells(cell);
625
+ case 3:
626
+ case "end":
627
+ return _context18.stop();
628
+ }
629
+ }, _callee18);
630
+ }));
631
+ function execute(_x33, _x34) {
632
+ return _execute18.apply(this, arguments);
633
+ }
634
+ return execute;
635
+ }(),
636
+ isEnabled: function isEnabled(_cell, libro) {
637
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
638
+ return false;
639
+ }
640
+ return true;
641
+ }
642
+ });
643
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['DeleteCell'], {
644
+ execute: function () {
645
+ var _execute19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(cell, libro) {
646
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
647
+ while (1) switch (_context19.prev = _context19.next) {
648
+ case 0:
649
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
650
+ _context19.next = 2;
651
+ break;
652
+ }
653
+ return _context19.abrupt("return");
654
+ case 2:
655
+ libro.deleteCell(cell);
656
+ case 3:
657
+ case "end":
658
+ return _context19.stop();
659
+ }
660
+ }, _callee19);
661
+ }));
662
+ function execute(_x35, _x36) {
663
+ return _execute19.apply(this, arguments);
664
+ }
665
+ return execute;
666
+ }(),
667
+ isVisible: function isVisible(_cell, libro, path) {
668
+ if (!libro || !(libro instanceof LibroView)) {
669
+ return false;
670
+ }
671
+ return !(libro !== null && libro !== void 0 && libro.model.readOnly) && path === LibroToolbarArea.CellRight;
672
+ },
673
+ isEnabled: function isEnabled(_cell, libro) {
674
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
675
+ return false;
676
+ }
677
+ return true;
678
+ }
679
+ });
680
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['ClearCellOutput'], {
681
+ execute: function () {
682
+ var _execute20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(cell, libro) {
683
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
684
+ while (1) switch (_context20.prev = _context20.next) {
685
+ case 0:
686
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
687
+ _context20.next = 2;
688
+ break;
689
+ }
690
+ return _context20.abrupt("return");
691
+ case 2:
692
+ libro.clearOutputs(cell);
693
+ case 3:
694
+ case "end":
695
+ return _context20.stop();
696
+ }
697
+ }, _callee20);
698
+ }));
699
+ function execute(_x37, _x38) {
700
+ return _execute20.apply(this, arguments);
701
+ }
702
+ return execute;
703
+ }(),
704
+ isEnabled: function isEnabled(_cell, libro) {
705
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
706
+ return false;
707
+ }
708
+ return true;
709
+ }
710
+ });
711
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['ClearAllCellOutput'], {
712
+ execute: function () {
713
+ var _execute21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(cell, libro) {
714
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
715
+ while (1) switch (_context21.prev = _context21.next) {
716
+ case 0:
717
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
718
+ _context21.next = 2;
719
+ break;
720
+ }
721
+ return _context21.abrupt("return");
722
+ case 2:
723
+ libro.clearAllOutputs();
724
+ case 3:
725
+ case "end":
726
+ return _context21.stop();
727
+ }
728
+ }, _callee21);
729
+ }));
730
+ function execute(_x39, _x40) {
731
+ return _execute21.apply(this, arguments);
732
+ }
733
+ return execute;
734
+ }(),
735
+ isVisible: function isVisible(_cell, libro, path) {
736
+ if (!libro || !(libro instanceof LibroView)) {
737
+ return false;
738
+ }
739
+ return !(libro !== null && libro !== void 0 && libro.model.readOnly) && path === LibroToolbarArea.HeaderCenter;
740
+ },
741
+ isEnabled: function isEnabled(_cell, libro) {
742
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
743
+ return false;
744
+ }
745
+ return true;
746
+ }
747
+ });
748
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['MoveCellUp'], {
749
+ execute: function () {
750
+ var _execute22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(cell, libro) {
751
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
752
+ while (1) switch (_context22.prev = _context22.next) {
753
+ case 0:
754
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
755
+ _context22.next = 2;
756
+ break;
757
+ }
758
+ return _context22.abrupt("return");
759
+ case 2:
760
+ libro.moveUpCell(cell);
761
+ case 3:
762
+ case "end":
763
+ return _context22.stop();
764
+ }
765
+ }, _callee22);
766
+ }));
767
+ function execute(_x41, _x42) {
768
+ return _execute22.apply(this, arguments);
769
+ }
770
+ return execute;
771
+ }(),
772
+ isVisible: function isVisible(_cell, _libro, path) {
773
+ return path === LibroToolbarArea.CellRight;
774
+ },
775
+ isEnabled: function isEnabled(cell, libro) {
776
+ if (!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView) || libro.model.readOnly) {
777
+ return false;
778
+ }
779
+ var cellIndex = libro.model.getCells().findIndex(function (item) {
780
+ return equals(item, cell);
781
+ });
782
+ return cellIndex > 0;
783
+ }
784
+ });
785
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['MoveCellDown'], {
786
+ execute: function () {
787
+ var _execute23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(cell, libro) {
788
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
789
+ while (1) switch (_context23.prev = _context23.next) {
790
+ case 0:
791
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
792
+ _context23.next = 2;
793
+ break;
794
+ }
795
+ return _context23.abrupt("return");
796
+ case 2:
797
+ libro.moveDownCell(cell);
798
+ case 3:
799
+ case "end":
800
+ return _context23.stop();
801
+ }
802
+ }, _callee23);
803
+ }));
804
+ function execute(_x43, _x44) {
805
+ return _execute23.apply(this, arguments);
806
+ }
807
+ return execute;
808
+ }(),
809
+ isEnabled: function isEnabled(cell, libro) {
810
+ if (!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView) || libro.model.readOnly) {
811
+ return false;
812
+ }
813
+ var cellIndex = libro.model.getCells().findIndex(function (item) {
814
+ return equals(item, cell);
815
+ });
816
+ return cellIndex !== libro.model.getCells().length - 1;
817
+ },
818
+ isVisible: function isVisible(_cell, _libro, path) {
819
+ return path === LibroToolbarArea.CellRight;
820
+ }
821
+ });
822
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['CopyCell'], {
823
+ execute: function () {
824
+ var _execute24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(cell, libro) {
825
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
826
+ while (1) switch (_context24.prev = _context24.next) {
827
+ case 0:
828
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
829
+ _context24.next = 2;
830
+ break;
831
+ }
832
+ return _context24.abrupt("return");
833
+ case 2:
834
+ libro.copyCell(cell);
835
+ case 3:
836
+ case "end":
837
+ return _context24.stop();
838
+ }
839
+ }, _callee24);
840
+ }));
841
+ function execute(_x45, _x46) {
842
+ return _execute24.apply(this, arguments);
843
+ }
844
+ return execute;
845
+ }(),
846
+ isVisible: function isVisible() {
847
+ return false;
848
+ },
849
+ // isVisible: (cell, libro, path) => {
850
+ // if (
851
+ // ![LibroToolbarArea.CellRight, LibroToolbarArea.HeaderCenter].find(item => item === path)
852
+ // ) {
853
+ // return false;
854
+ // }
855
+ // return true;
856
+ // },
857
+ isEnabled: function isEnabled(_cell, libro) {
858
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
859
+ return false;
860
+ }
861
+ return true;
862
+ }
863
+ });
864
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['CutCell'], {
865
+ execute: function () {
866
+ var _execute25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(cell, libro) {
867
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
868
+ while (1) switch (_context25.prev = _context25.next) {
869
+ case 0:
870
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
871
+ _context25.next = 2;
872
+ break;
873
+ }
874
+ return _context25.abrupt("return");
875
+ case 2:
876
+ libro.cutCell(cell);
877
+ case 3:
878
+ case "end":
879
+ return _context25.stop();
880
+ }
881
+ }, _callee25);
882
+ }));
883
+ function execute(_x47, _x48) {
884
+ return _execute25.apply(this, arguments);
885
+ }
886
+ return execute;
887
+ }(),
888
+ isVisible: function isVisible() {
889
+ return false;
890
+ },
891
+ // isVisible: (cell, libro, path) => {
892
+ // if (
893
+ // ![LibroToolbarArea.CellRight, LibroToolbarArea.HeaderCenter].find(item => item === path)
894
+ // ) {
895
+ // return false;
896
+ // }
897
+ // return true;
898
+ // },
899
+ isEnabled: function isEnabled(_cell, libro) {
900
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
901
+ return false;
902
+ }
903
+ return true;
904
+ }
905
+ });
906
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['PasteCellAbove'], {
907
+ execute: function () {
908
+ var _execute26 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(cell, libro) {
909
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
910
+ while (1) switch (_context26.prev = _context26.next) {
911
+ case 0:
912
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
913
+ _context26.next = 2;
914
+ break;
915
+ }
916
+ return _context26.abrupt("return");
917
+ case 2:
918
+ libro.pasteCellAbove(cell);
919
+ case 3:
920
+ case "end":
921
+ return _context26.stop();
922
+ }
923
+ }, _callee26);
924
+ }));
925
+ function execute(_x49, _x50) {
926
+ return _execute26.apply(this, arguments);
927
+ }
928
+ return execute;
929
+ }(),
930
+ isEnabled: function isEnabled(_cell, libro) {
931
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
932
+ return false;
933
+ }
934
+ return true;
935
+ }
936
+ });
937
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['PasteCellBelow'], {
938
+ execute: function () {
939
+ var _execute27 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(cell, libro) {
940
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
941
+ while (1) switch (_context27.prev = _context27.next) {
942
+ case 0:
943
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
944
+ _context27.next = 2;
945
+ break;
946
+ }
947
+ return _context27.abrupt("return");
948
+ case 2:
949
+ libro.pasteCell(cell);
950
+ case 3:
951
+ case "end":
952
+ return _context27.stop();
953
+ }
954
+ }, _callee27);
955
+ }));
956
+ function execute(_x51, _x52) {
957
+ return _execute27.apply(this, arguments);
958
+ }
959
+ return execute;
960
+ }(),
961
+ isVisible: function isVisible() {
962
+ return false;
963
+ },
964
+ // isVisible: (cell, libro, path) => {
965
+ // if (
966
+ // ![LibroToolbarArea.CellRight, LibroToolbarArea.HeaderCenter].find(item => item === path)
967
+ // ) {
968
+ // return false;
969
+ // }
970
+ // return true;
971
+ // },
972
+ isEnabled: function isEnabled(_cell, libro) {
973
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
974
+ return false;
975
+ }
976
+ return !!libro.model.lastClipboardInteraction;
977
+ }
978
+ });
979
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['HideCellCode'], {
980
+ execute: function () {
981
+ var _execute28 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(cell, libro) {
982
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
983
+ while (1) switch (_context28.prev = _context28.next) {
984
+ case 0:
985
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
986
+ _context28.next = 2;
987
+ break;
988
+ }
989
+ return _context28.abrupt("return");
990
+ case 2:
991
+ libro.hideCellCode(cell);
992
+ case 3:
993
+ case "end":
994
+ return _context28.stop();
995
+ }
996
+ }, _callee28);
997
+ }));
998
+ function execute(_x53, _x54) {
999
+ return _execute28.apply(this, arguments);
1000
+ }
1001
+ return execute;
1002
+ }(),
1003
+ isVisible: function isVisible(_cell, _libro, path) {
1004
+ if (path === LibroToolbarArea.HeaderCenter) {
1005
+ return true;
1006
+ }
1007
+ return false;
1008
+ }
1009
+ });
1010
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['HideOrShowCellCode'], {
1011
+ execute: function () {
1012
+ var _execute29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(cell, libro) {
1013
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
1014
+ while (1) switch (_context29.prev = _context29.next) {
1015
+ case 0:
1016
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
1017
+ _context29.next = 2;
1018
+ break;
1019
+ }
1020
+ return _context29.abrupt("return");
1021
+ case 2:
1022
+ libro.hideOrShowCellCode(cell);
1023
+ case 3:
1024
+ case "end":
1025
+ return _context29.stop();
1026
+ }
1027
+ }, _callee29);
1028
+ }));
1029
+ function execute(_x55, _x56) {
1030
+ return _execute29.apply(this, arguments);
1031
+ }
1032
+ return execute;
1033
+ }()
1034
+ });
1035
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['HideCellOutputs'], {
1036
+ execute: function () {
1037
+ var _execute30 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(cell, libro) {
1038
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
1039
+ while (1) switch (_context30.prev = _context30.next) {
1040
+ case 0:
1041
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
1042
+ _context30.next = 2;
1043
+ break;
1044
+ }
1045
+ return _context30.abrupt("return");
1046
+ case 2:
1047
+ libro.hideOutputs(cell);
1048
+ case 3:
1049
+ case "end":
1050
+ return _context30.stop();
1051
+ }
1052
+ }, _callee30);
1053
+ }));
1054
+ function execute(_x57, _x58) {
1055
+ return _execute30.apply(this, arguments);
1056
+ }
1057
+ return execute;
1058
+ }(),
1059
+ isVisible: function isVisible(cell, _libro, path) {
1060
+ if (cell && cell instanceof LibroCellView && ExecutableCellModel.is(cell.model) && path === LibroToolbarArea.CellRight) {
1061
+ return true;
1062
+ }
1063
+ return false;
1064
+ }
1065
+ });
1066
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['HideOrShowOutputs'], {
1067
+ execute: function () {
1068
+ var _execute31 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(cell, libro) {
1069
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
1070
+ while (1) switch (_context31.prev = _context31.next) {
1071
+ case 0:
1072
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
1073
+ _context31.next = 2;
1074
+ break;
1075
+ }
1076
+ return _context31.abrupt("return");
1077
+ case 2:
1078
+ libro.hideOrShowOutputs(cell);
1079
+ case 3:
1080
+ case "end":
1081
+ return _context31.stop();
1082
+ }
1083
+ }, _callee31);
1084
+ }));
1085
+ function execute(_x59, _x60) {
1086
+ return _execute31.apply(this, arguments);
1087
+ }
1088
+ return execute;
1089
+ }()
1090
+ });
1091
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['HideAllCellCode'], {
1092
+ execute: function () {
1093
+ var _execute32 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(cell, libro) {
1094
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
1095
+ while (1) switch (_context32.prev = _context32.next) {
1096
+ case 0:
1097
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
1098
+ _context32.next = 2;
1099
+ break;
1100
+ }
1101
+ return _context32.abrupt("return");
1102
+ case 2:
1103
+ libro.hideAllCellCode();
1104
+ case 3:
1105
+ case "end":
1106
+ return _context32.stop();
1107
+ }
1108
+ }, _callee32);
1109
+ }));
1110
+ function execute(_x61, _x62) {
1111
+ return _execute32.apply(this, arguments);
1112
+ }
1113
+ return execute;
1114
+ }()
1115
+ });
1116
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['HideAllCellOutput'], {
1117
+ execute: function () {
1118
+ var _execute33 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(cell, libro) {
1119
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
1120
+ while (1) switch (_context33.prev = _context33.next) {
1121
+ case 0:
1122
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
1123
+ _context33.next = 2;
1124
+ break;
1125
+ }
1126
+ return _context33.abrupt("return");
1127
+ case 2:
1128
+ libro.hideAllOutputs();
1129
+ case 3:
1130
+ case "end":
1131
+ return _context33.stop();
1132
+ }
1133
+ }, _callee33);
1134
+ }));
1135
+ function execute(_x63, _x64) {
1136
+ return _execute33.apply(this, arguments);
1137
+ }
1138
+ return execute;
1139
+ }()
1140
+ });
1141
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['HideAllCell'], {
1142
+ execute: function execute() {
1143
+ //
1144
+ },
1145
+ isVisible: function isVisible(_cell, libro, path) {
1146
+ if (!libro || !(libro instanceof LibroView)) {
1147
+ return false;
1148
+ }
1149
+ return !(libro !== null && libro !== void 0 && libro.model.readOnly) && path === LibroToolbarArea.HeaderCenter;
1150
+ },
1151
+ isEnabled: function isEnabled(_cell, libro) {
1152
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
1153
+ return false;
1154
+ }
1155
+ return true;
1156
+ }
1157
+ });
1158
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['ShowCellOutputs'], {
1159
+ execute: function () {
1160
+ var _execute34 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(cell, libro) {
1161
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
1162
+ while (1) switch (_context34.prev = _context34.next) {
1163
+ case 0:
1164
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
1165
+ _context34.next = 2;
1166
+ break;
1167
+ }
1168
+ return _context34.abrupt("return");
1169
+ case 2:
1170
+ libro.showCellOutputs(cell);
1171
+ case 3:
1172
+ case "end":
1173
+ return _context34.stop();
1174
+ }
1175
+ }, _callee34);
1176
+ }));
1177
+ function execute(_x65, _x66) {
1178
+ return _execute34.apply(this, arguments);
1179
+ }
1180
+ return execute;
1181
+ }()
1182
+ });
1183
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['ShowAllCellOutputs'], {
1184
+ execute: function () {
1185
+ var _execute35 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(cell, libro) {
1186
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
1187
+ while (1) switch (_context35.prev = _context35.next) {
1188
+ case 0:
1189
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
1190
+ _context35.next = 2;
1191
+ break;
1192
+ }
1193
+ return _context35.abrupt("return");
1194
+ case 2:
1195
+ libro.showAllCellOutputs();
1196
+ case 3:
1197
+ case "end":
1198
+ return _context35.stop();
1199
+ }
1200
+ }, _callee35);
1201
+ }));
1202
+ function execute(_x67, _x68) {
1203
+ return _execute35.apply(this, arguments);
1204
+ }
1205
+ return execute;
1206
+ }()
1207
+ });
1208
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['ShowCellCode'], {
1209
+ execute: function () {
1210
+ var _execute36 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(cell, libro) {
1211
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
1212
+ while (1) switch (_context36.prev = _context36.next) {
1213
+ case 0:
1214
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
1215
+ _context36.next = 2;
1216
+ break;
1217
+ }
1218
+ return _context36.abrupt("return");
1219
+ case 2:
1220
+ libro.showCellCode(cell);
1221
+ case 3:
1222
+ case "end":
1223
+ return _context36.stop();
1224
+ }
1225
+ }, _callee36);
1226
+ }));
1227
+ function execute(_x69, _x70) {
1228
+ return _execute36.apply(this, arguments);
1229
+ }
1230
+ return execute;
1231
+ }()
1232
+ });
1233
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['ShowAllCellCode'], {
1234
+ execute: function () {
1235
+ var _execute37 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(cell, libro) {
1236
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
1237
+ while (1) switch (_context37.prev = _context37.next) {
1238
+ case 0:
1239
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
1240
+ _context37.next = 2;
1241
+ break;
1242
+ }
1243
+ return _context37.abrupt("return");
1244
+ case 2:
1245
+ libro.showAllCellCode();
1246
+ case 3:
1247
+ case "end":
1248
+ return _context37.stop();
1249
+ }
1250
+ }, _callee37);
1251
+ }));
1252
+ function execute(_x71, _x72) {
1253
+ return _execute37.apply(this, arguments);
1254
+ }
1255
+ return execute;
1256
+ }()
1257
+ });
1258
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['ExtendMarkedCellsAbove'], {
1259
+ execute: function () {
1260
+ var _execute38 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(cell, libro) {
1261
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
1262
+ while (1) switch (_context38.prev = _context38.next) {
1263
+ case 0:
1264
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
1265
+ _context38.next = 2;
1266
+ break;
1267
+ }
1268
+ return _context38.abrupt("return");
1269
+ case 2:
1270
+ libro.extendSelectionAbove();
1271
+ case 3:
1272
+ case "end":
1273
+ return _context38.stop();
1274
+ }
1275
+ }, _callee38);
1276
+ }));
1277
+ function execute(_x73, _x74) {
1278
+ return _execute38.apply(this, arguments);
1279
+ }
1280
+ return execute;
1281
+ }()
1282
+ });
1283
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['ExtendMarkedCellsTop'], {
1284
+ execute: function () {
1285
+ var _execute39 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(cell, libro) {
1286
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
1287
+ while (1) switch (_context39.prev = _context39.next) {
1288
+ case 0:
1289
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
1290
+ _context39.next = 2;
1291
+ break;
1292
+ }
1293
+ return _context39.abrupt("return");
1294
+ case 2:
1295
+ libro.extendSelectionToTop();
1296
+ case 3:
1297
+ case "end":
1298
+ return _context39.stop();
1299
+ }
1300
+ }, _callee39);
1301
+ }));
1302
+ function execute(_x75, _x76) {
1303
+ return _execute39.apply(this, arguments);
1304
+ }
1305
+ return execute;
1306
+ }()
1307
+ });
1308
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['ExtendMarkedCellsBelow'], {
1309
+ execute: function () {
1310
+ var _execute40 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(cell, libro) {
1311
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
1312
+ while (1) switch (_context40.prev = _context40.next) {
1313
+ case 0:
1314
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
1315
+ _context40.next = 2;
1316
+ break;
1317
+ }
1318
+ return _context40.abrupt("return");
1319
+ case 2:
1320
+ libro.extendSelectionBelow();
1321
+ case 3:
1322
+ case "end":
1323
+ return _context40.stop();
1324
+ }
1325
+ }, _callee40);
1326
+ }));
1327
+ function execute(_x77, _x78) {
1328
+ return _execute40.apply(this, arguments);
1329
+ }
1330
+ return execute;
1331
+ }()
1332
+ });
1333
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['ExtendMarkedCellsBottom'], {
1334
+ execute: function () {
1335
+ var _execute41 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(cell, libro) {
1336
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
1337
+ while (1) switch (_context41.prev = _context41.next) {
1338
+ case 0:
1339
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
1340
+ _context41.next = 2;
1341
+ break;
1342
+ }
1343
+ return _context41.abrupt("return");
1344
+ case 2:
1345
+ libro.extendSelectionToBottom();
1346
+ case 3:
1347
+ case "end":
1348
+ return _context41.stop();
1349
+ }
1350
+ }, _callee41);
1351
+ }));
1352
+ function execute(_x79, _x80) {
1353
+ return _execute41.apply(this, arguments);
1354
+ }
1355
+ return execute;
1356
+ }()
1357
+ });
1358
+ command.registerCommand(NotebookCommands['ChangeCellTo'], {
1359
+ execute: function () {
1360
+ var _execute42 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(cell, libro, _path, targetType) {
1361
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
1362
+ while (1) switch (_context42.prev = _context42.next) {
1363
+ case 0:
1364
+ if (!(!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView))) {
1365
+ _context42.next = 2;
1366
+ break;
1367
+ }
1368
+ return _context42.abrupt("return");
1369
+ case 2:
1370
+ if (targetType) {
1371
+ libro.invertCell(cell, targetType);
1372
+ }
1373
+ case 3:
1374
+ case "end":
1375
+ return _context42.stop();
1376
+ }
1377
+ }, _callee42);
1378
+ }));
1379
+ function execute(_x81, _x82, _x83, _x84) {
1380
+ return _execute42.apply(this, arguments);
1381
+ }
1382
+ return execute;
1383
+ }(),
1384
+ isVisible: function isVisible(_cell, libro, path) {
1385
+ if (!libro || !(libro instanceof LibroView)) {
1386
+ return false;
1387
+ }
1388
+ return !(libro !== null && libro !== void 0 && libro.model.readOnly) && path === LibroToolbarArea.HeaderCenter;
1389
+ },
1390
+ isEnabled: function isEnabled(_cell, libro) {
1391
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
1392
+ return false;
1393
+ }
1394
+ return true;
1395
+ }
1396
+ });
1397
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['ChangeCellToCode'], {
1398
+ execute: function execute(cell, libro) {
1399
+ if (!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView)) {
1400
+ return;
1401
+ }
1402
+ libro.invertCell(cell, 'code');
1403
+ },
1404
+ isEnabled: function isEnabled(_cell, libro) {
1405
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
1406
+ return false;
1407
+ }
1408
+ return true;
1409
+ }
1410
+ });
1411
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['ChangeCellToMarkdown'], {
1412
+ execute: function execute(cell, libro) {
1413
+ if (!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView)) {
1414
+ return;
1415
+ }
1416
+ libro.invertCell(cell, 'markdown');
1417
+ },
1418
+ isEnabled: function isEnabled(_cell, libro) {
1419
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
1420
+ return false;
1421
+ }
1422
+ return true;
1423
+ }
1424
+ });
1425
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['EnableOutputScrolling'], {
1426
+ execute: function execute(cell, libro) {
1427
+ if (!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView)) {
1428
+ return;
1429
+ }
1430
+ libro.enableOutputScrolling(cell);
1431
+ }
1432
+ });
1433
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['DisableOutputScrolling'], {
1434
+ execute: function execute(cell, libro) {
1435
+ if (!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView)) {
1436
+ return;
1437
+ }
1438
+ libro.disableOutputScrolling(cell);
1439
+ }
1440
+ });
1441
+ this.libroCommand.registerLibroCommand(command, DocumentCommands['Save'], {
1442
+ execute: function () {
1443
+ var _execute43 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(_cell, libro) {
1444
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
1445
+ while (1) switch (_context43.prev = _context43.next) {
1446
+ case 0:
1447
+ if (!(!libro || !(libro instanceof LibroView))) {
1448
+ _context43.next = 2;
1449
+ break;
1450
+ }
1451
+ return _context43.abrupt("return");
1452
+ case 2:
1453
+ libro.save();
1454
+ case 3:
1455
+ case "end":
1456
+ return _context43.stop();
1457
+ }
1458
+ }, _callee43);
1459
+ }));
1460
+ function execute(_x85, _x86) {
1461
+ return _execute43.apply(this, arguments);
1462
+ }
1463
+ return execute;
1464
+ }(),
1465
+ isVisible: function isVisible(_cell, libro, path) {
1466
+ if (!libro || !(libro instanceof LibroView)) {
1467
+ return false;
1468
+ }
1469
+ return !(libro !== null && libro !== void 0 && libro.model.readOnly) && path === LibroToolbarArea.HeaderCenter;
1470
+ },
1471
+ isEnabled: function isEnabled(_cell, libro) {
1472
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
1473
+ return false;
1474
+ }
1475
+ return true;
1476
+ }
1477
+ });
1478
+ // this.libroCommand.registerLibroCommand(command, DocumentCommands['OpenSettings'], {
1479
+ // execute: async () => {
1480
+ // this.modalService.openModal(SettingsModal);
1481
+ // },
1482
+ // isVisible: (cell, libro, path) => {
1483
+ // return path === LibroToolbarArea.HeaderCenter;
1484
+ // },
1485
+ // });
1486
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['UndoCellAction'], {
1487
+ execute: function () {
1488
+ var _execute44 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(_cell, libro) {
1489
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
1490
+ while (1) switch (_context44.prev = _context44.next) {
1491
+ case 0:
1492
+ if (!(!libro || !(libro instanceof LibroView))) {
1493
+ _context44.next = 2;
1494
+ break;
1495
+ }
1496
+ return _context44.abrupt("return");
1497
+ case 2:
1498
+ libro.model.undo();
1499
+ case 3:
1500
+ case "end":
1501
+ return _context44.stop();
1502
+ }
1503
+ }, _callee44);
1504
+ }));
1505
+ function execute(_x87, _x88) {
1506
+ return _execute44.apply(this, arguments);
1507
+ }
1508
+ return execute;
1509
+ }(),
1510
+ isVisible: function isVisible(_cell, libro, path) {
1511
+ if (!libro || !(libro instanceof LibroView)) {
1512
+ return false;
1513
+ }
1514
+ return !(libro !== null && libro !== void 0 && libro.model.readOnly) && path === LibroToolbarArea.HeaderCenter;
1515
+ },
1516
+ isEnabled: function isEnabled(_cell, libro) {
1517
+ var _libro$model$canUndo;
1518
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
1519
+ return false;
1520
+ }
1521
+ return (_libro$model$canUndo = libro.model.canUndo) !== null && _libro$model$canUndo !== void 0 ? _libro$model$canUndo : false;
1522
+ }
1523
+ });
1524
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['RedoCellAction'], {
1525
+ execute: function () {
1526
+ var _execute45 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(_cell, libro) {
1527
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
1528
+ while (1) switch (_context45.prev = _context45.next) {
1529
+ case 0:
1530
+ if (!(!libro || !(libro instanceof LibroView))) {
1531
+ _context45.next = 2;
1532
+ break;
1533
+ }
1534
+ return _context45.abrupt("return");
1535
+ case 2:
1536
+ libro.model.redo();
1537
+ case 3:
1538
+ case "end":
1539
+ return _context45.stop();
1540
+ }
1541
+ }, _callee45);
1542
+ }));
1543
+ function execute(_x89, _x90) {
1544
+ return _execute45.apply(this, arguments);
1545
+ }
1546
+ return execute;
1547
+ }(),
1548
+ isVisible: function isVisible(_cell, libro, path) {
1549
+ if (!libro || !(libro instanceof LibroView)) {
1550
+ return false;
1551
+ }
1552
+ return !(libro !== null && libro !== void 0 && libro.model.readOnly) && path === LibroToolbarArea.HeaderCenter;
1553
+ },
1554
+ isEnabled: function isEnabled(_cell, libro) {
1555
+ var _libro$model$canRedo;
1556
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
1557
+ return false;
1558
+ }
1559
+ return (_libro$model$canRedo = libro.model.canRedo) !== null && _libro$model$canRedo !== void 0 ? _libro$model$canRedo : false;
1560
+ }
1561
+ });
1562
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['SplitCellAntCursor'], {
1563
+ execute: function execute(cell, libro) {
1564
+ if (!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView)) {
1565
+ return;
1566
+ }
1567
+ libro.splitCell(cell);
1568
+ },
1569
+ isEnabled: function isEnabled(_cell, libro) {
1570
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
1571
+ return false;
1572
+ }
1573
+ return true;
1574
+ }
1575
+ });
1576
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['Redo'], {
1577
+ execute: function () {
1578
+ var _execute46 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(cell) {
1579
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
1580
+ while (1) switch (_context46.prev = _context46.next) {
1581
+ case 0:
1582
+ if (!(!cell || !(cell instanceof LibroCellView))) {
1583
+ _context46.next = 2;
1584
+ break;
1585
+ }
1586
+ return _context46.abrupt("return");
1587
+ case 2:
1588
+ cell.redo();
1589
+ case 3:
1590
+ case "end":
1591
+ return _context46.stop();
1592
+ }
1593
+ }, _callee46);
1594
+ }));
1595
+ function execute(_x91) {
1596
+ return _execute46.apply(this, arguments);
1597
+ }
1598
+ return execute;
1599
+ }(),
1600
+ isEnabled: function isEnabled(_cell, libro) {
1601
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
1602
+ return false;
1603
+ }
1604
+ return true;
1605
+ }
1606
+ });
1607
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['Undo'], {
1608
+ execute: function () {
1609
+ var _execute47 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(cell) {
1610
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
1611
+ while (1) switch (_context47.prev = _context47.next) {
1612
+ case 0:
1613
+ if (!(!cell || !(cell instanceof LibroCellView))) {
1614
+ _context47.next = 2;
1615
+ break;
1616
+ }
1617
+ return _context47.abrupt("return");
1618
+ case 2:
1619
+ cell.undo();
1620
+ case 3:
1621
+ case "end":
1622
+ return _context47.stop();
1623
+ }
1624
+ }, _callee47);
1625
+ }));
1626
+ function execute(_x92) {
1627
+ return _execute47.apply(this, arguments);
1628
+ }
1629
+ return execute;
1630
+ }(),
1631
+ isEnabled: function isEnabled(_cell, libro) {
1632
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
1633
+ return false;
1634
+ }
1635
+ return true;
1636
+ }
1637
+ });
1638
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['ChangeCellToHeading1'], {
1639
+ execute: function execute(cell, libro) {
1640
+ if (!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView)) {
1641
+ return;
1642
+ }
1643
+ libro.setMarkdownHeader(cell, 1);
1644
+ },
1645
+ isEnabled: function isEnabled(_cell, libro) {
1646
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
1647
+ return false;
1648
+ }
1649
+ return true;
1650
+ }
1651
+ });
1652
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['ChangeCellToHeading2'], {
1653
+ execute: function execute(cell, libro) {
1654
+ if (!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView)) {
1655
+ return;
1656
+ }
1657
+ libro.setMarkdownHeader(cell, 2);
1658
+ },
1659
+ isEnabled: function isEnabled(_cell, libro) {
1660
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
1661
+ return false;
1662
+ }
1663
+ return true;
1664
+ }
1665
+ });
1666
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['ChangeCellToHeading3'], {
1667
+ execute: function execute(cell, libro) {
1668
+ if (!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView)) {
1669
+ return;
1670
+ }
1671
+ libro.setMarkdownHeader(cell, 3);
1672
+ },
1673
+ isEnabled: function isEnabled(_cell, libro) {
1674
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
1675
+ return false;
1676
+ }
1677
+ return true;
1678
+ }
1679
+ });
1680
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['ChangeCellToHeading4'], {
1681
+ execute: function execute(cell, libro) {
1682
+ if (!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView)) {
1683
+ return;
1684
+ }
1685
+ libro.setMarkdownHeader(cell, 4);
1686
+ },
1687
+ isEnabled: function isEnabled(_cell, libro) {
1688
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
1689
+ return false;
1690
+ }
1691
+ return true;
1692
+ }
1693
+ });
1694
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['ChangeCellToHeading5'], {
1695
+ execute: function execute(cell, libro) {
1696
+ if (!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView)) {
1697
+ return;
1698
+ }
1699
+ libro.setMarkdownHeader(cell, 5);
1700
+ },
1701
+ isEnabled: function isEnabled(_cell, libro) {
1702
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
1703
+ return false;
1704
+ }
1705
+ return true;
1706
+ }
1707
+ });
1708
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['ChangeCellToHeading6'], {
1709
+ execute: function execute(cell, libro) {
1710
+ if (!cell || !libro || !(cell instanceof LibroCellView) || !(libro instanceof LibroView)) {
1711
+ return;
1712
+ }
1713
+ libro.setMarkdownHeader(cell, 6);
1714
+ },
1715
+ isEnabled: function isEnabled(_cell, libro) {
1716
+ if (!libro || !(libro instanceof LibroView) || libro.model.readOnly) {
1717
+ return false;
1718
+ }
1719
+ return true;
1720
+ }
1721
+ });
1722
+ this.libroCommand.registerLibroCommand(command, NotebookCommands['More'], {
1723
+ execute: function () {
1724
+ var _execute48 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(_cell, libro) {
1725
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
1726
+ while (1) switch (_context48.prev = _context48.next) {
1727
+ case 0:
1728
+ if (!(!libro || !(libro instanceof LibroView))) {
1729
+ _context48.next = 2;
1730
+ break;
1731
+ }
1732
+ return _context48.abrupt("return");
1733
+ case 2:
1734
+ case "end":
1735
+ return _context48.stop();
1736
+ }
1737
+ }, _callee48);
1738
+ }));
1739
+ function execute(_x93, _x94) {
1740
+ return _execute48.apply(this, arguments);
1741
+ }
1742
+ return execute;
1743
+ }(),
1744
+ isVisible: function isVisible(_cell, _libro, path) {
1745
+ return path === LibroToolbarArea.CellRight;
1746
+ }
1747
+ });
1748
+ }
1749
+ }]);
1750
+ return LibroCommandContribution;
1751
+ }()) || _class);