@difizen/libro-core 0.3.3 → 1.0.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 (307) hide show
  1. package/es/add-cell/libro-add-cell-module.d.ts +1 -1
  2. package/es/add-cell/libro-add-cell-module.d.ts.map +1 -1
  3. package/es/add-cell/libro-add-cell-module.js +1 -1
  4. package/es/add-cell/libro-add-cell-slot-contribution.d.ts +1 -1
  5. package/es/add-cell/libro-add-cell-slot-contribution.d.ts.map +1 -1
  6. package/es/add-cell/libro-add-cell-slot-contribution.js +2 -2
  7. package/es/add-cell/libro-add-cell-view.d.ts +1 -1
  8. package/es/add-cell/libro-add-cell-view.d.ts.map +1 -1
  9. package/es/add-cell/libro-add-cell-view.js +1 -1
  10. package/es/cell/libro-cell-contribution.js +1 -1
  11. package/es/cell/libro-cell-model.d.ts +1 -1
  12. package/es/cell/libro-cell-model.d.ts.map +1 -1
  13. package/es/cell/libro-cell-model.js +2 -2
  14. package/es/cell/libro-cell-module.d.ts +1 -1
  15. package/es/cell/libro-cell-module.d.ts.map +1 -1
  16. package/es/cell/libro-cell-module.js +1 -1
  17. package/es/cell/libro-cell-protocol.d.ts +2 -2
  18. package/es/cell/libro-cell-protocol.d.ts.map +1 -1
  19. package/es/cell/libro-cell-protocol.js +1 -1
  20. package/es/cell/libro-cell-service.d.ts +2 -2
  21. package/es/cell/libro-cell-service.d.ts.map +1 -1
  22. package/es/cell/libro-cell-service.js +3 -3
  23. package/es/cell/libro-cell-view.d.ts +4 -4
  24. package/es/cell/libro-cell-view.d.ts.map +1 -1
  25. package/es/cell/libro-cell-view.js +6 -6
  26. package/es/cell/libro-edit-cell-view.d.ts +1 -1
  27. package/es/cell/libro-edit-cell-view.d.ts.map +1 -1
  28. package/es/cell/libro-edit-cell-view.js +1 -1
  29. package/es/cell/libro-executable-cell-model.d.ts +1 -1
  30. package/es/cell/libro-executable-cell-model.d.ts.map +1 -1
  31. package/es/cell/libro-executable-cell-view.js +3 -3
  32. package/es/collapse-service.js +1 -1
  33. package/es/command/document-commands.d.ts +1 -1
  34. package/es/command/document-commands.d.ts.map +1 -1
  35. package/es/command/kernel-command.d.ts +1 -1
  36. package/es/command/kernel-command.d.ts.map +1 -1
  37. package/es/command/kernel-command.js +1 -1
  38. package/es/command/libro-command-contribution.d.ts +2 -2
  39. package/es/command/libro-command-contribution.d.ts.map +1 -1
  40. package/es/command/libro-command-contribution.js +2 -2
  41. package/es/command/libro-command-register.d.ts +1 -1
  42. package/es/command/libro-command-register.d.ts.map +1 -1
  43. package/es/command/libro-command-register.js +1 -1
  44. package/es/command/module.d.ts +1 -1
  45. package/es/command/module.d.ts.map +1 -1
  46. package/es/command/module.js +1 -1
  47. package/es/command/notebook-commands.d.ts +1 -1
  48. package/es/command/notebook-commands.d.ts.map +1 -1
  49. package/es/command/notebook-commands.js +1 -1
  50. package/es/components/dnd-cell-item-render.js +2 -2
  51. package/es/components/dnd-component/default-dnd-content.d.ts.map +1 -1
  52. package/es/components/dnd-component/default-dnd-content.js +90 -167
  53. package/es/components/dnd-component/dnd-list.d.ts +12 -0
  54. package/es/components/dnd-component/dnd-list.d.ts.map +1 -1
  55. package/es/components/dnd-component/dnd-list.js +307 -63
  56. package/es/components/dnd-component/index.d.ts +0 -2
  57. package/es/components/dnd-component/index.d.ts.map +1 -1
  58. package/es/components/dnd-component/index.js +0 -2
  59. package/es/components/dnd-component/index.less +84 -0
  60. package/es/components/dnd-component/virtualized-manager.d.ts.map +1 -1
  61. package/es/components/dnd-component/virtualized-manager.js +3 -9
  62. package/es/components/libro-component.js +2 -2
  63. package/es/components/libro-side-toolbar-menu.js +2 -2
  64. package/es/components/libro-view-header.js +1 -1
  65. package/es/content/libro-content-contribution.js +1 -1
  66. package/es/content/libro-content-module.d.ts +1 -1
  67. package/es/content/libro-content-module.d.ts.map +1 -1
  68. package/es/content/libro-content-module.js +1 -1
  69. package/es/content/libro-content-protocol.d.ts +1 -1
  70. package/es/content/libro-content-protocol.d.ts.map +1 -1
  71. package/es/content/libro-content-protocol.js +1 -1
  72. package/es/content/libro-content-service.d.ts +1 -1
  73. package/es/content/libro-content-service.d.ts.map +1 -1
  74. package/es/content/libro-content-service.js +1 -1
  75. package/es/content/libro-save-content-contribution.js +1 -1
  76. package/es/formatter/libro-formatter-json-contribution.d.ts +1 -1
  77. package/es/formatter/libro-formatter-json-contribution.js +1 -1
  78. package/es/formatter/libro-formatter-manager.d.ts +1 -1
  79. package/es/formatter/libro-formatter-manager.d.ts.map +1 -1
  80. package/es/formatter/libro-formatter-manager.js +1 -1
  81. package/es/formatter/libro-formatter-module.d.ts +1 -1
  82. package/es/formatter/libro-formatter-module.d.ts.map +1 -1
  83. package/es/formatter/libro-formatter-module.js +1 -1
  84. package/es/formatter/libro-formatter-protocol.d.ts +1 -1
  85. package/es/formatter/libro-formatter-protocol.d.ts.map +1 -1
  86. package/es/formatter/libro-formatter-protocol.js +1 -1
  87. package/es/formatter/libro-formatter-string-contribution.d.ts +1 -1
  88. package/es/formatter/libro-formatter-string-contribution.js +1 -1
  89. package/es/formatter/libro-formatter-trans-default-contribution.js +1 -1
  90. package/es/index.d.ts +2 -0
  91. package/es/index.d.ts.map +1 -1
  92. package/es/index.js +2 -0
  93. package/es/index.less +0 -22
  94. package/es/libro-context-key.d.ts +3 -3
  95. package/es/libro-context-key.d.ts.map +1 -1
  96. package/es/libro-context-key.js +2 -2
  97. package/es/libro-keybind-registry.d.ts +1 -1
  98. package/es/libro-keybind-registry.d.ts.map +1 -1
  99. package/es/libro-keybind-registry.js +2 -2
  100. package/es/libro-model.d.ts +9 -9
  101. package/es/libro-model.d.ts.map +1 -1
  102. package/es/libro-model.js +4 -4
  103. package/es/libro-protocol.d.ts +2 -2
  104. package/es/libro-protocol.d.ts.map +1 -1
  105. package/es/libro-service.d.ts +13 -13
  106. package/es/libro-service.d.ts.map +1 -1
  107. package/es/libro-service.js +4 -4
  108. package/es/libro-setting-contribution.d.ts +2 -2
  109. package/es/libro-setting-contribution.d.ts.map +1 -1
  110. package/es/libro-setting-contribution.js +1 -1
  111. package/es/libro-setting.d.ts +1 -1
  112. package/es/libro-setting.d.ts.map +1 -1
  113. package/es/libro-setting.js +1 -1
  114. package/es/libro-view-tracker.js +1 -1
  115. package/es/libro-view.d.ts +9 -9
  116. package/es/libro-view.d.ts.map +1 -1
  117. package/es/libro-view.js +8 -12
  118. package/es/libro-workspace-service.d.ts +1 -1
  119. package/es/libro-workspace-service.d.ts.map +1 -1
  120. package/es/libro-workspace-service.js +2 -2
  121. package/es/module.d.ts +1 -1
  122. package/es/module.d.ts.map +1 -1
  123. package/es/module.js +2 -2
  124. package/es/output/output-area.d.ts +4 -4
  125. package/es/output/output-area.d.ts.map +1 -1
  126. package/es/output/output-area.js +2 -2
  127. package/es/output/output-contribution.d.ts +1 -1
  128. package/es/output/output-contribution.d.ts.map +1 -1
  129. package/es/output/output-contribution.js +1 -1
  130. package/es/output/output-model.d.ts +1 -1
  131. package/es/output/output-model.d.ts.map +1 -1
  132. package/es/output/output-model.js +2 -2
  133. package/es/output/output-module.d.ts +1 -1
  134. package/es/output/output-module.d.ts.map +1 -1
  135. package/es/output/output-module.js +1 -1
  136. package/es/output/output-protocol.d.ts +3 -3
  137. package/es/output/output-protocol.d.ts.map +1 -1
  138. package/es/output/output-protocol.js +1 -1
  139. package/es/settings/module.d.ts +1 -1
  140. package/es/settings/module.d.ts.map +1 -1
  141. package/es/settings/module.js +1 -1
  142. package/es/settings/setting-editor/configuration-panel-view.d.ts +2 -2
  143. package/es/settings/setting-editor/configuration-panel-view.d.ts.map +1 -1
  144. package/es/settings/setting-editor/configuration-panel-view.js +1 -1
  145. package/es/settings/setting-editor/configuration-render-contribution.d.ts +2 -2
  146. package/es/settings/setting-editor/configuration-render-contribution.d.ts.map +1 -1
  147. package/es/settings/setting-editor/configuration-render-contribution.js +1 -1
  148. package/es/settings/setting-editor/default-node-render.d.ts +1 -1
  149. package/es/settings/setting-editor/default-node-render.d.ts.map +1 -1
  150. package/es/settings/setting-editor/default-node-render.js +1 -1
  151. package/es/settings/setting-editor/module.d.ts +1 -1
  152. package/es/settings/setting-editor/module.d.ts.map +1 -1
  153. package/es/settings/setting-editor/module.js +1 -1
  154. package/es/settings/setting-editor/setting-editor-view.d.ts +1 -1
  155. package/es/settings/setting-editor/setting-editor-view.d.ts.map +1 -1
  156. package/es/settings/setting-editor/setting-editor-view.js +2 -2
  157. package/es/settings/setting-editor/setting-tree-service.d.ts +3 -3
  158. package/es/settings/setting-editor/setting-tree-service.d.ts.map +1 -1
  159. package/es/settings/setting-editor/setting-tree-service.js +2 -2
  160. package/es/settings/setting-editor/setting-tree-view.d.ts +2 -2
  161. package/es/settings/setting-editor/setting-tree-view.d.ts.map +1 -1
  162. package/es/settings/setting-editor/setting-tree-view.js +2 -2
  163. package/es/settings/settings-contribution.d.ts +3 -3
  164. package/es/settings/settings-contribution.d.ts.map +1 -1
  165. package/es/settings/settings-contribution.js +2 -2
  166. package/es/settings/settings-modal.d.ts +1 -1
  167. package/es/settings/settings-modal.d.ts.map +1 -1
  168. package/es/settings/settings-modal.js +3 -3
  169. package/es/settings/settings-protocol.d.ts +1 -1
  170. package/es/settings/settings-protocol.d.ts.map +1 -1
  171. package/es/slot/libro-slot-manager.d.ts +2 -2
  172. package/es/slot/libro-slot-manager.d.ts.map +1 -1
  173. package/es/slot/libro-slot-manager.js +2 -2
  174. package/es/slot/libro-slot-protocol.d.ts +2 -2
  175. package/es/slot/libro-slot-protocol.d.ts.map +1 -1
  176. package/es/slot/libro-slot-protocol.js +1 -1
  177. package/es/slot/libro-slot-view.d.ts +2 -2
  178. package/es/slot/libro-slot-view.d.ts.map +1 -1
  179. package/es/slot/libro-slot-view.js +3 -3
  180. package/es/slot/module.d.ts +1 -1
  181. package/es/slot/module.d.ts.map +1 -1
  182. package/es/slot/module.js +1 -1
  183. package/es/theme/libro-color-registry.d.ts +2 -2
  184. package/es/theme/libro-color-registry.d.ts.map +1 -1
  185. package/es/theme/libro-color-registry.js +2 -2
  186. package/es/toolbar/all-outputs-scroll-icon.js +1 -1
  187. package/es/toolbar/change-cell-to-selector.js +1 -1
  188. package/es/toolbar/hide-all-selector.js +2 -2
  189. package/es/toolbar/libro-toolbar.d.ts +2 -2
  190. package/es/toolbar/libro-toolbar.d.ts.map +1 -1
  191. package/es/toolbar/libro-toolbar.js +3 -3
  192. package/es/toolbar/module.d.ts +1 -1
  193. package/es/toolbar/module.d.ts.map +1 -1
  194. package/es/toolbar/module.js +1 -1
  195. package/es/toolbar/restart-clear-outputs-contribution.d.ts +2 -2
  196. package/es/toolbar/restart-clear-outputs-contribution.d.ts.map +1 -1
  197. package/es/toolbar/restart-clear-outputs-contribution.js +1 -1
  198. package/es/toolbar/restart-clear-outputs-modal.d.ts +1 -1
  199. package/es/toolbar/restart-clear-outputs-modal.d.ts.map +1 -1
  200. package/es/toolbar/restart-clear-outputs-modal.js +1 -1
  201. package/es/toolbar/save-icon.js +1 -1
  202. package/es/toolbar/shutdown-contribution.d.ts +2 -2
  203. package/es/toolbar/shutdown-contribution.d.ts.map +1 -1
  204. package/es/toolbar/shutdown-contribution.js +1 -1
  205. package/es/toolbar/shutdown-modal.d.ts +1 -1
  206. package/es/toolbar/shutdown-modal.d.ts.map +1 -1
  207. package/es/toolbar/side-toolar-more-select.js +4 -4
  208. package/es/utils/index.js +1 -1
  209. package/es/virtualized-manager-helper.js +1 -1
  210. package/es/virtualized-manager.d.ts.map +1 -1
  211. package/es/virtualized-manager.js +2 -9
  212. package/package.json +10 -9
  213. package/src/add-cell/libro-add-cell-module.ts +1 -1
  214. package/src/add-cell/libro-add-cell-slot-contribution.ts +2 -2
  215. package/src/add-cell/libro-add-cell-view.tsx +1 -1
  216. package/src/cell/libro-cell-contribution.ts +1 -1
  217. package/src/cell/libro-cell-model.ts +2 -2
  218. package/src/cell/libro-cell-module.ts +1 -1
  219. package/src/cell/libro-cell-protocol.ts +2 -2
  220. package/src/cell/libro-cell-service.ts +4 -4
  221. package/src/cell/libro-cell-view.tsx +7 -7
  222. package/src/cell/libro-edit-cell-view.tsx +1 -1
  223. package/src/cell/libro-executable-cell-model.ts +1 -1
  224. package/src/cell/libro-executable-cell-view.ts +3 -3
  225. package/src/collapse-service.ts +1 -1
  226. package/src/command/document-commands.ts +1 -1
  227. package/src/command/kernel-command.ts +2 -2
  228. package/src/command/libro-command-contribution.ts +3 -3
  229. package/src/command/libro-command-register.ts +2 -2
  230. package/src/command/module.ts +1 -1
  231. package/src/command/notebook-commands.ts +2 -2
  232. package/src/components/dnd-cell-item-render.tsx +2 -2
  233. package/src/components/dnd-component/default-dnd-content.tsx +101 -165
  234. package/src/components/dnd-component/dnd-list.tsx +309 -35
  235. package/src/components/dnd-component/index.less +84 -0
  236. package/src/components/dnd-component/index.tsx +0 -2
  237. package/src/components/dnd-component/virtualized-manager.ts +11 -8
  238. package/src/components/libro-component.tsx +2 -2
  239. package/src/components/libro-side-toolbar-menu.tsx +3 -3
  240. package/src/components/libro-view-header.tsx +1 -1
  241. package/src/content/libro-content-contribution.ts +1 -1
  242. package/src/content/libro-content-module.ts +1 -1
  243. package/src/content/libro-content-protocol.ts +1 -1
  244. package/src/content/libro-content-service.ts +2 -2
  245. package/src/content/libro-save-content-contribution.ts +1 -1
  246. package/src/formatter/libro-formatter-json-contribution.ts +1 -1
  247. package/src/formatter/libro-formatter-manager.ts +2 -2
  248. package/src/formatter/libro-formatter-module.ts +1 -1
  249. package/src/formatter/libro-formatter-protocol.ts +1 -1
  250. package/src/formatter/libro-formatter-string-contribution.ts +1 -1
  251. package/src/formatter/libro-formatter-trans-default-contribution.ts +1 -1
  252. package/src/index.less +0 -22
  253. package/src/index.tsx +3 -0
  254. package/src/libro-context-key.ts +4 -4
  255. package/src/libro-keybind-registry.ts +2 -2
  256. package/src/libro-model.ts +4 -4
  257. package/src/libro-protocol.ts +2 -2
  258. package/src/libro-service.ts +5 -5
  259. package/src/libro-setting-contribution.ts +1 -1
  260. package/src/libro-setting.ts +2 -2
  261. package/src/libro-view-tracker.ts +1 -1
  262. package/src/libro-view.tsx +8 -18
  263. package/src/libro-workspace-service.ts +2 -2
  264. package/src/module.ts +2 -2
  265. package/src/output/output-area.tsx +3 -3
  266. package/src/output/output-contribution.ts +1 -1
  267. package/src/output/output-model.tsx +2 -2
  268. package/src/output/output-module.ts +1 -1
  269. package/src/output/output-protocol.ts +3 -3
  270. package/src/settings/module.ts +1 -1
  271. package/src/settings/setting-editor/configuration-panel-view.tsx +2 -2
  272. package/src/settings/setting-editor/configuration-render-contribution.ts +2 -2
  273. package/src/settings/setting-editor/default-node-render.tsx +2 -2
  274. package/src/settings/setting-editor/module.ts +1 -1
  275. package/src/settings/setting-editor/setting-editor-view.tsx +2 -2
  276. package/src/settings/setting-editor/setting-tree-service.ts +3 -3
  277. package/src/settings/setting-editor/setting-tree-view.tsx +3 -3
  278. package/src/settings/settings-contribution.tsx +7 -3
  279. package/src/settings/settings-modal.tsx +4 -4
  280. package/src/settings/settings-protocol.ts +1 -1
  281. package/src/slot/libro-slot-manager.ts +3 -3
  282. package/src/slot/libro-slot-protocol.ts +2 -2
  283. package/src/slot/libro-slot-view.tsx +9 -4
  284. package/src/slot/module.ts +1 -1
  285. package/src/theme/libro-color-registry.ts +3 -3
  286. package/src/toolbar/all-outputs-scroll-icon.tsx +1 -1
  287. package/src/toolbar/change-cell-to-selector.tsx +2 -2
  288. package/src/toolbar/hide-all-selector.tsx +3 -3
  289. package/src/toolbar/libro-toolbar.tsx +4 -4
  290. package/src/toolbar/module.ts +1 -1
  291. package/src/toolbar/restart-clear-outputs-contribution.tsx +1 -1
  292. package/src/toolbar/restart-clear-outputs-modal.tsx +2 -2
  293. package/src/toolbar/save-icon.tsx +2 -2
  294. package/src/toolbar/shutdown-contribution.tsx +1 -1
  295. package/src/toolbar/shutdown-modal.tsx +1 -1
  296. package/src/toolbar/side-toolar-more-select.tsx +5 -5
  297. package/src/utils/index.ts +1 -1
  298. package/src/virtualized-manager-helper.ts +1 -1
  299. package/src/virtualized-manager.ts +10 -8
  300. package/es/components/dnd-component/custom-drag-layer.d.ts +0 -9
  301. package/es/components/dnd-component/custom-drag-layer.d.ts.map +0 -1
  302. package/es/components/dnd-component/custom-drag-layer.js +0 -140
  303. package/es/components/dnd-component/dnd-context.d.ts +0 -3
  304. package/es/components/dnd-component/dnd-context.d.ts.map +0 -1
  305. package/es/components/dnd-component/dnd-context.js +0 -20
  306. package/src/components/dnd-component/custom-drag-layer.tsx +0 -144
  307. package/src/components/dnd-component/dnd-context.tsx +0 -28
@@ -1,5 +1,8 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
2
  var _excluded = ["cell", "index"];
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 e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
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); }); }; }
3
6
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
7
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
8
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -13,22 +16,85 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
13
16
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
14
17
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
15
18
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
16
- import { getOrigin, useInject, useObserve, ViewInstance } from '@difizen/mana-app';
19
+ import { getOrigin, useInject, useObserve, ViewInstance } from '@difizen/libro-common/app';
17
20
  import classNames from 'classnames';
18
- import { forwardRef, memo, useEffect, useState } from 'react';
19
- import { useDrop } from 'react-dnd';
21
+ import { throttle } from 'lodash';
22
+ import { useRef, useCallback, createContext, useMemo, forwardRef, memo, useEffect, useState } from 'react';
23
+ import { createRoot } from 'react-dom/client';
24
+ import { ExecutableCellModel } from "../../cell/index.js";
20
25
  import { LibroCellService } from "../../cell/index.js";
21
- import { DragAreaKey, isCellView } from "../../libro-protocol.js";
26
+ import { isCellView } from "../../libro-protocol.js";
22
27
  import { VirtualizedManagerHelper } from "../../virtualized-manager-helper.js";
23
28
  import { LibroCellsOutputRender } from "../libro-virtualized-render.js";
24
29
  import "./index.less";
25
30
  import { jsx as _jsx } from "react/jsx-runtime";
26
- import { Fragment as _Fragment } from "react/jsx-runtime";
27
31
  import { jsxs as _jsxs } from "react/jsx-runtime";
28
- export var DndCellRender = /*#__PURE__*/memo(function DndCellRender(_ref) {
29
- var cell = _ref.cell,
30
- index = _ref.index,
31
- props = _objectWithoutProperties(_ref, _excluded);
32
+ import { Fragment as _Fragment } from "react/jsx-runtime";
33
+ export var DragContext = /*#__PURE__*/createContext({
34
+ dragOverIndex: undefined,
35
+ isDraging: false,
36
+ sourceIndex: undefined,
37
+ onDragStart: function onDragStart() {
38
+ return;
39
+ },
40
+ onDragOver: function onDragOver() {
41
+ return;
42
+ },
43
+ onDrop: function onDrop() {
44
+ return;
45
+ },
46
+ onDragEnd: function onDragEnd() {
47
+ return;
48
+ },
49
+ fragFromRef: {}
50
+ });
51
+ var MultipleImageCompnent = function MultipleImageCompnent(_ref) {
52
+ var selections = _ref.selections;
53
+ var firstCell = selections[0];
54
+ var executable = ExecutableCellModel.is(firstCell.model);
55
+ var executeState = ExecutableCellModel.is(firstCell.model) && !firstCell.model.executing ? firstCell.model.executeCount || ' ' : '*';
56
+ return /*#__PURE__*/_jsx("div", {
57
+ className: "libro-drag-image-container",
58
+ children: /*#__PURE__*/_jsxs("div", {
59
+ className: "libro-cell-drag-image-input-container",
60
+ children: [executable && /*#__PURE__*/_jsx("pre", {
61
+ className: "libro-execute-state-tip",
62
+ children: "[".concat(executeState, "]:")
63
+ }), /*#__PURE__*/_jsx("pre", {
64
+ className: "cell-drag-image-input",
65
+ children: /*#__PURE__*/_jsx("code", {
66
+ children: firstCell.model.value
67
+ })
68
+ }), /*#__PURE__*/_jsx("div", {
69
+ className: "libro-dnd-cascading-multiple-selection"
70
+ })]
71
+ })
72
+ });
73
+ };
74
+ var CellImageComponent = function CellImageComponent(_ref2) {
75
+ var cell = _ref2.cell;
76
+ var executable = ExecutableCellModel.is(cell.model);
77
+ var executeState = ExecutableCellModel.is(cell.model) && !cell.model.executing ? cell.model.executeCount || ' ' : '*';
78
+ return /*#__PURE__*/_jsx("div", {
79
+ className: "libro-single-drag-image-container",
80
+ children: /*#__PURE__*/_jsxs("div", {
81
+ className: "libro-cell-drag-image-input-container",
82
+ children: [executable && /*#__PURE__*/_jsx("pre", {
83
+ className: "libro-execute-state-tip",
84
+ children: "[".concat(executeState, "]:")
85
+ }), /*#__PURE__*/_jsx("pre", {
86
+ className: "cell-drag-image-input",
87
+ children: /*#__PURE__*/_jsx("code", {
88
+ children: cell.model.value
89
+ })
90
+ })]
91
+ })
92
+ });
93
+ };
94
+ export var DndCellRender = /*#__PURE__*/memo(function DndCellRender(_ref3) {
95
+ var cell = _ref3.cell,
96
+ index = _ref3.index,
97
+ props = _objectWithoutProperties(_ref3, _excluded);
32
98
  var observableCell = useObserve(cell);
33
99
  var instance = useInject(ViewInstance);
34
100
  var DndCellContainer = instance.dndContentRender;
@@ -61,9 +127,9 @@ var renderNonVirtualListCells = function renderNonVirtualListCells(cells) {
61
127
  })
62
128
  });
63
129
  };
64
- export var DndCellsRender = /*#__PURE__*/forwardRef(function DndCellsRender(_ref2, ref) {
65
- var libroView = _ref2.libroView,
66
- addCellButtons = _ref2.addCellButtons;
130
+ export var DndCellsRender = /*#__PURE__*/forwardRef(function DndCellsRender(_ref4, ref) {
131
+ var libroView = _ref4.libroView,
132
+ addCellButtons = _ref4.addCellButtons;
67
133
  var LoadingRender = getOrigin(libroView.loadingRender);
68
134
  var virtualizedManagerHelper = useInject(VirtualizedManagerHelper);
69
135
  var virtualizedManager = virtualizedManagerHelper.getOrCreate(libroView.model);
@@ -126,63 +192,241 @@ export var DndCellsRender = /*#__PURE__*/forwardRef(function DndCellsRender(_ref
126
192
  }), shouldRenderCells && !isVirtualList && addCellButtons]
127
193
  });
128
194
  });
129
- export var DndList = /*#__PURE__*/forwardRef(function DndList(_ref3, ref) {
130
- var libroView = _ref3.libroView,
131
- children = _ref3.children;
195
+ export var DndList = /*#__PURE__*/forwardRef(function DndList(_ref5, ref) {
196
+ var libroView = _ref5.libroView,
197
+ children = _ref5.children;
132
198
  var cellService = useInject(LibroCellService);
133
- var _useDrop = useDrop(function () {
134
- return {
135
- accept: DragAreaKey,
136
- drop: function drop(item, dropMonitor) {
137
- cellService.getOrCreateView(_objectSpread(_objectSpread({}, item.cell.model.options), {}, {
138
- modelId: item.cell.model.id,
139
- singleSelectionDragPreview: true
140
- }), item.cell.parent.id).then(function (view) {
141
- view.dispose();
142
- return;
143
- }).catch(function (e) {
144
- //
145
- });
146
- if (isCellView(item.cell)) {
147
- var _lastCell$container;
148
- var didDrop = dropMonitor.didDrop();
149
- if (didDrop) {
150
- return;
199
+ var _useState5 = useState(false),
200
+ _useState6 = _slicedToArray(_useState5, 2),
201
+ isDraging = _useState6[0],
202
+ setIsDraging = _useState6[1];
203
+ var _useState7 = useState(),
204
+ _useState8 = _slicedToArray(_useState7, 2),
205
+ dragOverIndex = _useState8[0],
206
+ setDragOverIndex = _useState8[1];
207
+ var _useState9 = useState(),
208
+ _useState10 = _slicedToArray(_useState9, 2),
209
+ sourceIndex = _useState10[0],
210
+ setSourceIndex = _useState10[1];
211
+ var followNodeRef = useRef();
212
+ var editorScrollRef = useRef();
213
+ var multipleImageRef = useRef();
214
+ var singleImageRef = useRef();
215
+ var fragFromRef = useRef('');
216
+ useEffect(function () {
217
+ var multipleDrag = document.getElementById('libro-multiple-drag-container');
218
+ if (multipleDrag) {
219
+ multipleImageRef.current = multipleDrag;
220
+ } else {
221
+ multipleImageRef.current = document.createElement('div');
222
+ multipleImageRef.current.id = 'libro-multiple-drag-container';
223
+ document.body.appendChild(multipleImageRef.current);
224
+ }
225
+ var singleDrag = document.getElementById('libro-single-drag-container');
226
+ if (singleDrag) {
227
+ singleImageRef.current = singleDrag;
228
+ } else {
229
+ singleImageRef.current = document.createElement('div');
230
+ singleImageRef.current.id = 'libro-single-drag-container';
231
+ document.body.appendChild(singleImageRef.current);
232
+ }
233
+ }, []);
234
+ var clearSelects = useCallback(function () {
235
+ if (libroView.model.selections.length > 0) {
236
+ libroView.model.selections = [];
237
+ }
238
+ }, [libroView.model]);
239
+ var exchangeCellIndex = useCallback(function (sourceCellIndex, targetIndex) {
240
+ var sourceCellView = libroView.model.cells[sourceCellIndex];
241
+ if (!sourceCellView) {
242
+ return;
243
+ }
244
+ cellService.getOrCreateView(_objectSpread(_objectSpread({}, sourceCellView.model.options), {}, {
245
+ modelId: sourceCellView.model.id,
246
+ singleSelectionDragPreview: true
247
+ }), sourceCellView.parent.id).then(function (view) {
248
+ view.dispose();
249
+ return;
250
+ }).catch(function () {
251
+ //
252
+ });
253
+ if (isCellView(sourceCellView)) {
254
+ var targetCell = libroView.model.cells[targetIndex];
255
+ if (sourceCellIndex < targetIndex) {
256
+ libroView.model.exchangeCell(sourceCellIndex, targetIndex);
257
+ libroView.model.scrollToView(targetCell);
258
+ }
259
+ if (sourceCellIndex > targetIndex) {
260
+ libroView.model.exchangeCell(sourceCellIndex, targetIndex);
261
+ libroView.model.scrollToView(targetCell);
262
+ }
263
+ }
264
+ }, [cellService, libroView.model]);
265
+ var onDragStart = useCallback( /*#__PURE__*/function () {
266
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e, sourceCellIndex) {
267
+ var _parentElement;
268
+ var selectCells, childNode, sourceCellView, root, editorScrollNodex, _root;
269
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
270
+ while (1) switch (_context.prev = _context.next) {
271
+ case 0:
272
+ e.dataTransfer.setData('libro_notebook_drag_text', "".concat(sourceCellIndex));
273
+ fragFromRef.current = 'cell';
274
+ e.dataTransfer.effectAllowed = 'move';
275
+ selectCells = libroView.model.selections;
276
+ childNode = (_parentElement = e.target.parentElement) === null || _parentElement === void 0 ? void 0 : _parentElement.getElementsByClassName('libro-cell-input-content')[0]; // 多选cell拖拽排序
277
+ sourceCellView = libroView.model.cells[sourceCellIndex];
278
+ if (!(selectCells.length > 0 && selectCells.findIndex(function (selection) {
279
+ return selection.id === sourceCellView.id;
280
+ }) > -1 && multipleImageRef.current)) {
281
+ _context.next = 14;
282
+ break;
151
283
  }
152
- // Determine mouse position
153
- var clientOffset = dropMonitor.getClientOffset();
154
- var clientOffsetY = clientOffset.y;
155
- var dragIndex = libroView.findCellIndex(item.cell);
156
- // Determine rectangle on screen
157
- var lastCell = libroView.model.getCells()[libroView.model.getCells().length - 1];
158
- var lastCellOffsetY = (_lastCell$container = lastCell.container) === null || _lastCell$container === void 0 || (_lastCell$container = _lastCell$container.current) === null || _lastCell$container === void 0 ? void 0 : _lastCell$container.getBoundingClientRect().y;
159
- if (lastCellOffsetY && clientOffsetY >= lastCellOffsetY) {
160
- if (libroView.model.selections.length > 0) {
161
- var isDragInSelections = libroView.model.selections.findIndex(function (selection) {
162
- return selection.id === item.cell.id;
163
- }) > -1 ? true : false;
164
- if (isDragInSelections) {
165
- libroView.model.exchangeCells(libroView.model.selections, libroView.model.cells.length);
166
- return;
167
- }
168
- }
169
- libroView.model.exchangeCell(dragIndex, libroView.model.cells.length - 1);
284
+ root = createRoot(multipleImageRef.current);
285
+ root.render( /*#__PURE__*/_jsx(MultipleImageCompnent, {
286
+ selections: selectCells
287
+ }));
288
+ // 清除编辑器中无效元素宽度(只针对e2编辑器)
289
+ editorScrollNodex = childNode === null || childNode === void 0 ? void 0 : childNode.getElementsByClassName('erd_scroll_detection_container')[0];
290
+ if (editorScrollNodex) {
291
+ editorScrollRef.current = editorScrollNodex;
292
+ editorScrollNodex.style.display = 'none';
170
293
  }
171
- }
172
- // Determine mouse position
173
-
174
- return;
294
+ e.dataTransfer.setDragImage(multipleImageRef.current, 0, 0);
295
+ _context.next = 19;
296
+ break;
297
+ case 14:
298
+ if (childNode) {
299
+ _context.next = 16;
300
+ break;
301
+ }
302
+ return _context.abrupt("return");
303
+ case 16:
304
+ // 拖拽单个cell排序
305
+ clearSelects();
306
+ if (childNode.clientHeight > 300) {
307
+ followNodeRef.current = childNode;
308
+ childNode.style.maxHeight = '300px';
309
+ childNode.style.overflow = 'hidden';
310
+ }
311
+ if (singleImageRef.current) {
312
+ _root = createRoot(singleImageRef.current);
313
+ _root.render( /*#__PURE__*/_jsx(CellImageComponent, {
314
+ cell: sourceCellView
315
+ }));
316
+ e.dataTransfer.setDragImage(singleImageRef.current, 0, 0);
317
+ }
318
+ case 19:
319
+ setSourceIndex(sourceCellIndex);
320
+ setIsDraging(true);
321
+ case 21:
322
+ case "end":
323
+ return _context.stop();
175
324
  }
176
- };
177
- }),
178
- _useDrop2 = _slicedToArray(_useDrop, 2),
179
- drop = _useDrop2[1];
325
+ }, _callee);
326
+ }));
327
+ return function (_x, _x2) {
328
+ return _ref6.apply(this, arguments);
329
+ };
330
+ }(), [clearSelects, libroView.model.cells, libroView.model.selections]);
331
+ var onDragOver = useCallback(function (e, index) {
332
+ e.preventDefault();
333
+ throttle(function () {
334
+ setDragOverIndex(index);
335
+ }, 1000)();
336
+ }, []);
337
+ var onDrop = useCallback(function (e, index) {
338
+ e.preventDefault();
339
+ var sourceCellIndex = e.dataTransfer.getData('libro_notebook_drag_text');
340
+ setIsDraging(false);
341
+ setDragOverIndex(undefined);
342
+ setSourceIndex(undefined);
343
+ var _sourceIndex = Number(sourceCellIndex || 0);
344
+ if (libroView.model.selections.length > 0) {
345
+ var sourceCellView = libroView.model.cells[_sourceIndex];
346
+ var dropCellView = libroView.model.cells[index];
347
+ var isDragInSelections = libroView.model.selections.some(function (selection) {
348
+ return selection.id === sourceCellView.id;
349
+ });
350
+ var isDropInSelections = libroView.model.selections.some(function (selection) {
351
+ return selection.id === dropCellView.id;
352
+ });
353
+ if (isDragInSelections && isDropInSelections) {
354
+ return;
355
+ }
356
+ if (isDragInSelections) {
357
+ libroView.model.exchangeCells(libroView.model.selections, index);
358
+ libroView.model.scrollToView(dropCellView);
359
+ }
360
+ return;
361
+ }
362
+ if (_sourceIndex === index) {
363
+ return;
364
+ }
365
+ exchangeCellIndex(_sourceIndex, index);
366
+ }, [exchangeCellIndex, libroView.model]);
367
+ var onDragEnd = useCallback(function (e) {
368
+ e === null || e === void 0 || e.dataTransfer.clearData();
369
+ setIsDraging(false);
370
+ setDragOverIndex(undefined);
371
+ setSourceIndex(undefined);
372
+ if (followNodeRef.current) {
373
+ followNodeRef.current.style.maxHeight = 'unset';
374
+ followNodeRef.current.style.overflow = 'unset';
375
+ }
376
+ if (editorScrollRef.current) {
377
+ editorScrollRef.current.style.display = 'unset';
378
+ }
379
+ fragFromRef.current = '';
380
+ }, []);
381
+ var dragContextValue = useMemo(function () {
382
+ return {
383
+ dragOverIndex: dragOverIndex,
384
+ isDraging: isDraging,
385
+ sourceIndex: sourceIndex,
386
+ onDragStart: onDragStart,
387
+ onDragOver: onDragOver,
388
+ onDrop: onDrop,
389
+ onDragEnd: onDragEnd,
390
+ fragFromRef: fragFromRef
391
+ };
392
+ }, [dragOverIndex, isDraging, onDragEnd, onDragOver, onDragStart, onDrop, sourceIndex, fragFromRef]);
180
393
  return /*#__PURE__*/_jsx("div", {
181
394
  className: "libro-dnd-list-container",
182
- ref: drop,
183
- children: /*#__PURE__*/_jsx(DndCellsRender, {
184
- libroView: libroView,
185
- addCellButtons: children
395
+ onDragOver: function onDragOver(e) {
396
+ e.preventDefault();
397
+ },
398
+ onDrop: function onDrop(e) {
399
+ var _lastCell$container;
400
+ if (fragFromRef.current !== 'cell') {
401
+ return;
402
+ }
403
+ var sourceCellIndex = e.dataTransfer.getData('libro_notebook_drag_text');
404
+ var _sourceIndex = Number(sourceCellIndex || 0);
405
+ var lastCell = libroView.model.getCells()[libroView.model.getCells().length - 1];
406
+ var lastCellOffsetY = (_lastCell$container = lastCell.container) === null || _lastCell$container === void 0 || (_lastCell$container = _lastCell$container.current) === null || _lastCell$container === void 0 ? void 0 : _lastCell$container.getBoundingClientRect().y;
407
+ if (lastCellOffsetY && e.clientY >= lastCellOffsetY) {
408
+ e.preventDefault();
409
+ if (_sourceIndex === undefined) {
410
+ return;
411
+ }
412
+ if (libroView.model.selections.length > 0) {
413
+ var isDragInSelections = libroView.model.selections.findIndex(function (selection) {
414
+ return selection.id === libroView.model.getCells()[_sourceIndex].id;
415
+ }) > -1 ? true : false;
416
+ if (isDragInSelections) {
417
+ libroView.model.exchangeCells(libroView.model.selections, libroView.model.cells.length);
418
+ return;
419
+ }
420
+ }
421
+ exchangeCellIndex(_sourceIndex, libroView.model.cells.length - 1);
422
+ }
423
+ },
424
+ children: /*#__PURE__*/_jsx(DragContext.Provider, {
425
+ value: dragContextValue,
426
+ children: /*#__PURE__*/_jsx(DndCellsRender, {
427
+ libroView: libroView,
428
+ addCellButtons: children
429
+ })
186
430
  })
187
431
  });
188
432
  });
@@ -1,5 +1,3 @@
1
- export * from './custom-drag-layer.js';
2
1
  export * from './default-dnd-content.js';
3
- export * from './dnd-context.js';
4
2
  export * from './dnd-list.js';
5
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dnd-component/index.tsx"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dnd-component/index.tsx"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC"}
@@ -1,4 +1,2 @@
1
- export * from "./custom-drag-layer.js";
2
1
  export * from "./default-dnd-content.js";
3
- export * from "./dnd-context.js";
4
2
  export * from "./dnd-list.js";
@@ -10,3 +10,87 @@
10
10
  .libro-dnd-cells-container {
11
11
  padding-top: 8px;
12
12
  }
13
+
14
+ #libro-multiple-drag-container {
15
+ position: absolute;
16
+ top: 0;
17
+ left: 0;
18
+ z-index: -2;
19
+ height: 0;
20
+ }
21
+
22
+ #libro-single-drag-container {
23
+ position: absolute;
24
+ top: 0;
25
+ left: 0;
26
+ z-index: -2;
27
+ }
28
+
29
+ .libro-drag-image-container,
30
+ .libro-single-drag-image-container {
31
+ margin: 8px;
32
+
33
+ .libro-cell-drag-image-input-container {
34
+ position: relative;
35
+ display: flex;
36
+ padding: 12px;
37
+ background-color: var(--mana-libro-background);
38
+ }
39
+
40
+ .cell-drag-image-input {
41
+ z-index: 100;
42
+ max-height: 68px;
43
+ max-width: 300px;
44
+ min-height: 40px;
45
+ min-width: 100px;
46
+ overflow: hidden;
47
+ padding: 8px;
48
+ border: 1px solid var(--mana-libro-cell-border-color);
49
+ border-radius: 4px;
50
+ background: var(--mana-libro-input-background);
51
+ }
52
+
53
+ .libro-execute-state-tip {
54
+ padding-right: 8px;
55
+ color: var(--mana-libro-execution-count-color);
56
+ font-size: 11px;
57
+ vertical-align: top;
58
+ user-select: none;
59
+ }
60
+ }
61
+
62
+ .libro-dnd-cascading-multiple-selection {
63
+ position: absolute;
64
+ bottom: 6px;
65
+ right: 6px;
66
+ width: calc(100% - 60px);
67
+ height: calc(100% - 30px);
68
+ border: 1px solid var(--mana-libro-cell-border-color);
69
+ border-radius: 4px;
70
+ box-shadow:
71
+ 0 6px 16px 0 rgba(0, 0, 0, 8%),
72
+ 0 3px 6px -4px rgba(0, 0, 0, 12%),
73
+ 0 9px 28px 8px rgba(0, 0, 0, 5%);
74
+ }
75
+
76
+ .libro-drag-hoverline {
77
+ position: absolute;
78
+ top: -2px;
79
+ left: 56px;
80
+ z-index: 100;
81
+ width: calc(100% - 70px);
82
+ height: 4px;
83
+ background-color: var(--mana-libro-drag-hover-line-color);
84
+ border-radius: 2px;
85
+ }
86
+
87
+ .libro-drag-hoverline-last-one {
88
+ position: absolute;
89
+ left: 56px;
90
+ bottom: -2px;
91
+ z-index: 100;
92
+ width: calc(100% - 70px);
93
+ height: 4px;
94
+ background-color: var(--mana-libro-drag-hover-line-color);
95
+ border-radius: 2px;
96
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"virtualized-manager.d.ts","sourceRoot":"","sources":["../../../src/components/dnd-component/virtualized-manager.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACrE,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,qBACa,kBAAmB,YAAW,mBAAmB;IAC5D;;;OAGG;IAEH,aAAa,UAAS;IAEtB;;;;;OAKG;IACH,eAAe,WAAkB,MAAM,SAAS,MAAM,sBAUpD;CACH"}
1
+ {"version":3,"file":"virtualized-manager.d.ts","sourceRoot":"","sources":["../../../src/components/dnd-component/virtualized-manager.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACrE,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,qBACa,kBAAmB,YAAW,mBAAmB;IAC5D;;;OAGG;IAEH,aAAa,UAAS;IAEtB;;;;;OAKG;IAEH,eAAe,WAAkB,MAAM,SAAS,MAAM,sBAYpD;CACH"}
@@ -11,7 +11,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
11
11
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12
12
  function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
13
13
  function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
14
- import { prop, singleton } from '@difizen/mana-app';
14
+ import { prop, singleton } from '@difizen/libro-common/app';
15
15
  export var VirtualizedManager = (_dec = singleton(), _dec2 = prop(), _dec(_class = (_class2 = /*#__PURE__*/_createClass(function VirtualizedManager() {
16
16
  var _this = this;
17
17
  _classCallCheck(this, VirtualizedManager);
@@ -26,21 +26,15 @@ export var VirtualizedManager = (_dec = singleton(), _dec2 = prop(), _dec(_class
26
26
  * @param size undefined 或者 单位 为B
27
27
  * @returns 是否使用虚拟滚动
28
28
  */
29
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
29
30
  this.openVirtualized = /*#__PURE__*/function () {
30
31
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(length, size) {
31
32
  return _regeneratorRuntime().wrap(function _callee$(_context) {
32
33
  while (1) switch (_context.prev = _context.next) {
33
34
  case 0:
34
- if (!(length > 100 || size && size > 4)) {
35
- _context.next = 5;
36
- break;
37
- }
38
- _this.isVirtualized = true;
39
- return _context.abrupt("return", true);
40
- case 5:
41
35
  _this.isVirtualized = false;
42
36
  return _context.abrupt("return", false);
43
- case 7:
37
+ case 2:
44
38
  case "end":
45
39
  return _context.stop();
46
40
  }
@@ -4,8 +4,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
4
4
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
5
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import { ViewRender } from '@difizen/mana-app';
8
- import { useInject } from '@difizen/mana-app';
7
+ import { ViewRender } from '@difizen/libro-common/app';
8
+ import { useInject } from '@difizen/libro-common/app';
9
9
  import { useEffect, useState } from 'react';
10
10
  import { LibroService } from "../libro-service.js";
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -4,8 +4,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
4
4
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
5
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
6
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
- import { CommandRegistry, getOrigin, ToolbarInstance, useInject } from '@difizen/mana-app';
8
- import { Menu, MenuContext } from '@difizen/mana-react';
7
+ import { Menu, MenuContext } from '@difizen/libro-common/react';
8
+ import { CommandRegistry, getOrigin, ToolbarInstance, useInject } from '@difizen/libro-common/app';
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
11
11
  export var LibroSideToolbarMenuInlines = function LibroSideToolbarMenuInlines(_ref) {
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable react-hooks/exhaustive-deps */
2
- import { ToolbarRender, useInject, ViewInstance } from '@difizen/mana-app';
2
+ import { ToolbarRender, useInject, ViewInstance } from '@difizen/libro-common/app';
3
3
  import { useMemo } from 'react';
4
4
  import { LibroToolbarArea } from "../libro-protocol.js";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -5,7 +5,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
5
5
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
6
6
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
7
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
- import { singleton } from '@difizen/mana-app';
8
+ import { singleton } from '@difizen/libro-common/app';
9
9
  import { ContentContribution } from "./libro-content-protocol.js";
10
10
  export var DefaultContentContribution = (_dec = singleton({
11
11
  contrib: ContentContribution
@@ -1,3 +1,3 @@
1
- import { ManaModule } from '@difizen/mana-app';
1
+ import { ManaModule } from '@difizen/libro-common/app';
2
2
  export declare const LibroContentModule: ManaModule;
3
3
  //# sourceMappingURL=libro-content-module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"libro-content-module.d.ts","sourceRoot":"","sources":["../../src/content/libro-content-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAU/C,eAAO,MAAM,kBAAkB,YAM5B,CAAC"}
1
+ {"version":3,"file":"libro-content-module.d.ts","sourceRoot":"","sources":["../../src/content/libro-content-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAUvD,eAAO,MAAM,kBAAkB,YAM5B,CAAC"}
@@ -1,4 +1,4 @@
1
- import { ManaModule } from '@difizen/mana-app';
1
+ import { ManaModule } from '@difizen/libro-common/app';
2
2
  import { DefaultContentContribution } from "./libro-content-contribution.js";
3
3
  import { ContentContribution, ContentSaveContribution } from "./libro-content-protocol.js";
4
4
  import { LibroContentService } from "./libro-content-service.js";
@@ -1,5 +1,5 @@
1
1
  import type { INotebookContent } from '@difizen/libro-common';
2
- import { Syringe } from '@difizen/mana-app';
2
+ import { Syringe } from '@difizen/libro-common/app';
3
3
  export declare const ContentContribution: Syringe.DefinedToken;
4
4
  export interface ContentContribution {
5
5
  canHandle: (options: Record<string, any>, model: any) => number;