@difizen/libro-core 0.0.0-snapshot-20241017072317

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 (433) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +280 -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 +11 -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 +59 -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 +121 -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 +12 -0
  20. package/es/cell/libro-cell-contribution.d.ts.map +1 -0
  21. package/es/cell/libro-cell-contribution.js +47 -0
  22. package/es/cell/libro-cell-model.d.ts +29 -0
  23. package/es/cell/libro-cell-model.d.ts.map +1 -0
  24. package/es/cell/libro-cell-model.js +130 -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 +44 -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 +245 -0
  34. package/es/cell/libro-cell-view.d.ts +74 -0
  35. package/es/cell/libro-cell-view.d.ts.map +1 -0
  36. package/es/cell/libro-cell-view.js +239 -0
  37. package/es/cell/libro-edit-cell-view.d.ts +44 -0
  38. package/es/cell/libro-edit-cell-view.d.ts.map +1 -0
  39. package/es/cell/libro-edit-cell-view.js +256 -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 +34 -0
  44. package/es/cell/libro-executable-cell-view.d.ts.map +1 -0
  45. package/es/cell/libro-executable-cell-view.js +74 -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 +5 -0
  53. package/es/command/document-commands.d.ts.map +1 -0
  54. package/es/command/document-commands.js +21 -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 +40 -0
  61. package/es/command/libro-command-contribution.d.ts +13 -0
  62. package/es/command/libro-command-contribution.d.ts.map +1 -0
  63. package/es/command/libro-command-contribution.js +1842 -0
  64. package/es/command/libro-command-register.d.ts +21 -0
  65. package/es/command/libro-command-register.d.ts.map +1 -0
  66. package/es/command/libro-command-register.js +111 -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 +472 -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 +16 -0
  77. package/es/components/dnd-cell-item-render.d.ts.map +1 -0
  78. package/es/components/dnd-cell-item-render.js +364 -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 +140 -0
  82. package/es/components/dnd-component/default-dnd-content.d.ts +11 -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 +292 -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 +14 -0
  89. package/es/components/dnd-component/dnd-list.d.ts.map +1 -0
  90. package/es/components/dnd-component/dnd-list.js +182 -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/dnd-component/index.less +8 -0
  95. package/es/components/dnd-component/overscanIndices-getter.d.ts +22 -0
  96. package/es/components/dnd-component/overscanIndices-getter.d.ts.map +1 -0
  97. package/es/components/dnd-component/overscanIndices-getter.js +58 -0
  98. package/es/components/dnd-component/virtualized-manager.d.ts +19 -0
  99. package/es/components/dnd-component/virtualized-manager.d.ts.map +1 -0
  100. package/es/components/dnd-component/virtualized-manager.js +60 -0
  101. package/es/components/index.d.ts +6 -0
  102. package/es/components/index.d.ts.map +1 -0
  103. package/es/components/index.js +5 -0
  104. package/es/components/libro-component.d.ts +5 -0
  105. package/es/components/libro-component.d.ts.map +1 -0
  106. package/es/components/libro-component.js +35 -0
  107. package/es/components/libro-side-toolbar-menu.d.ts +21 -0
  108. package/es/components/libro-side-toolbar-menu.d.ts.map +1 -0
  109. package/es/components/libro-side-toolbar-menu.js +58 -0
  110. package/es/components/libro-view-header.d.ts +3 -0
  111. package/es/components/libro-view-header.d.ts.map +1 -0
  112. package/es/components/libro-view-header.js +37 -0
  113. package/es/components/libro-virtualized-render.d.ts +15 -0
  114. package/es/components/libro-virtualized-render.d.ts.map +1 -0
  115. package/es/components/libro-virtualized-render.js +174 -0
  116. package/es/content/index.d.ts +6 -0
  117. package/es/content/index.d.ts.map +1 -0
  118. package/es/content/index.js +5 -0
  119. package/es/content/libro-content-contribution.d.ts +11 -0
  120. package/es/content/libro-content-contribution.d.ts.map +1 -0
  121. package/es/content/libro-content-contribution.js +31 -0
  122. package/es/content/libro-content-module.d.ts +3 -0
  123. package/es/content/libro-content-module.d.ts.map +1 -0
  124. package/es/content/libro-content-module.js +6 -0
  125. package/es/content/libro-content-protocol.d.ts +13 -0
  126. package/es/content/libro-content-protocol.d.ts.map +1 -0
  127. package/es/content/libro-content-protocol.js +3 -0
  128. package/es/content/libro-content-service.d.ts +11 -0
  129. package/es/content/libro-content-service.d.ts.map +1 -0
  130. package/es/content/libro-content-service.js +63 -0
  131. package/es/content/libro-save-content-contribution.d.ts +6 -0
  132. package/es/content/libro-save-content-contribution.d.ts.map +1 -0
  133. package/es/content/libro-save-content-contribution.js +27 -0
  134. package/es/formatter/index.d.ts +6 -0
  135. package/es/formatter/index.d.ts.map +1 -0
  136. package/es/formatter/index.js +5 -0
  137. package/es/formatter/libro-formatter-json-contribution.d.ts +18 -0
  138. package/es/formatter/libro-formatter-json-contribution.d.ts.map +1 -0
  139. package/es/formatter/libro-formatter-json-contribution.js +41 -0
  140. package/es/formatter/libro-formatter-manager.d.ts +16 -0
  141. package/es/formatter/libro-formatter-manager.d.ts.map +1 -0
  142. package/es/formatter/libro-formatter-manager.js +86 -0
  143. package/es/formatter/libro-formatter-module.d.ts +3 -0
  144. package/es/formatter/libro-formatter-module.d.ts.map +1 -0
  145. package/es/formatter/libro-formatter-module.js +7 -0
  146. package/es/formatter/libro-formatter-protocol.d.ts +37 -0
  147. package/es/formatter/libro-formatter-protocol.d.ts.map +1 -0
  148. package/es/formatter/libro-formatter-protocol.js +18 -0
  149. package/es/formatter/libro-formatter-string-contribution.d.ts +18 -0
  150. package/es/formatter/libro-formatter-string-contribution.d.ts.map +1 -0
  151. package/es/formatter/libro-formatter-string-contribution.js +41 -0
  152. package/es/formatter/libro-formatter-trans-default-contribution.d.ts +7 -0
  153. package/es/formatter/libro-formatter-trans-default-contribution.d.ts.map +1 -0
  154. package/es/formatter/libro-formatter-trans-default-contribution.js +19 -0
  155. package/es/index.d.ts +26 -0
  156. package/es/index.d.ts.map +1 -0
  157. package/es/index.js +25 -0
  158. package/es/index.less +781 -0
  159. package/es/libro-context-key.d.ts +26 -0
  160. package/es/libro-context-key.d.ts.map +1 -0
  161. package/es/libro-context-key.js +84 -0
  162. package/es/libro-keybind-registry.d.ts +5 -0
  163. package/es/libro-keybind-registry.d.ts.map +1 -0
  164. package/es/libro-keybind-registry.js +68 -0
  165. package/es/libro-model.d.ts +145 -0
  166. package/es/libro-model.d.ts.map +1 -0
  167. package/es/libro-model.js +921 -0
  168. package/es/libro-protocol.d.ts +315 -0
  169. package/es/libro-protocol.d.ts.map +1 -0
  170. package/es/libro-protocol.js +47 -0
  171. package/es/libro-service.d.ts +69 -0
  172. package/es/libro-service.d.ts.map +1 -0
  173. package/es/libro-service.js +303 -0
  174. package/es/libro-setting-contribution.d.ts +5 -0
  175. package/es/libro-setting-contribution.d.ts.map +1 -0
  176. package/es/libro-setting-contribution.js +23 -0
  177. package/es/libro-setting.d.ts +12 -0
  178. package/es/libro-setting.d.ts.map +1 -0
  179. package/es/libro-setting.js +101 -0
  180. package/es/libro-view-tracker.d.ts +6 -0
  181. package/es/libro-view-tracker.d.ts.map +1 -0
  182. package/es/libro-view-tracker.js +13 -0
  183. package/es/libro-view.d.ts +170 -0
  184. package/es/libro-view.d.ts.map +1 -0
  185. package/es/libro-view.js +2077 -0
  186. package/es/libro-workspace-service.d.ts +17 -0
  187. package/es/libro-workspace-service.d.ts.map +1 -0
  188. package/es/libro-workspace-service.js +36 -0
  189. package/es/material-from-designer.d.ts +31 -0
  190. package/es/material-from-designer.d.ts.map +1 -0
  191. package/es/material-from-designer.js +697 -0
  192. package/es/module.d.ts +3 -0
  193. package/es/module.d.ts.map +1 -0
  194. package/es/module.js +71 -0
  195. package/es/output/index.d.ts +6 -0
  196. package/es/output/index.d.ts.map +1 -0
  197. package/es/output/index.js +5 -0
  198. package/es/output/output-area.d.ts +51 -0
  199. package/es/output/output-area.d.ts.map +1 -0
  200. package/es/output/output-area.js +399 -0
  201. package/es/output/output-contribution.d.ts +10 -0
  202. package/es/output/output-contribution.d.ts.map +1 -0
  203. package/es/output/output-contribution.js +36 -0
  204. package/es/output/output-model.d.ts +28 -0
  205. package/es/output/output-model.d.ts.map +1 -0
  206. package/es/output/output-model.js +105 -0
  207. package/es/output/output-module.d.ts +3 -0
  208. package/es/output/output-module.d.ts.map +1 -0
  209. package/es/output/output-module.js +6 -0
  210. package/es/output/output-protocol.d.ts +134 -0
  211. package/es/output/output-protocol.d.ts.map +1 -0
  212. package/es/output/output-protocol.js +16 -0
  213. package/es/settings/index.d.ts +5 -0
  214. package/es/settings/index.d.ts.map +1 -0
  215. package/es/settings/index.js +4 -0
  216. package/es/settings/index.less +3 -0
  217. package/es/settings/module.d.ts +3 -0
  218. package/es/settings/module.d.ts.map +1 -0
  219. package/es/settings/module.js +4 -0
  220. package/es/settings/setting-editor/configuration-panel-view.d.ts +13 -0
  221. package/es/settings/setting-editor/configuration-panel-view.d.ts.map +1 -0
  222. package/es/settings/setting-editor/configuration-panel-view.js +115 -0
  223. package/es/settings/setting-editor/configuration-render-contribution.d.ts +6 -0
  224. package/es/settings/setting-editor/configuration-render-contribution.d.ts.map +1 -0
  225. package/es/settings/setting-editor/configuration-render-contribution.js +77 -0
  226. package/es/settings/setting-editor/default-node-render.d.ts +9 -0
  227. package/es/settings/setting-editor/default-node-render.d.ts.map +1 -0
  228. package/es/settings/setting-editor/default-node-render.js +79 -0
  229. package/es/settings/setting-editor/index.d.ts +7 -0
  230. package/es/settings/setting-editor/index.d.ts.map +1 -0
  231. package/es/settings/setting-editor/index.js +6 -0
  232. package/es/settings/setting-editor/index.less +12 -0
  233. package/es/settings/setting-editor/module.d.ts +3 -0
  234. package/es/settings/setting-editor/module.d.ts.map +1 -0
  235. package/es/settings/setting-editor/module.js +11 -0
  236. package/es/settings/setting-editor/setting-editor-view.d.ts +15 -0
  237. package/es/settings/setting-editor/setting-editor-view.d.ts.map +1 -0
  238. package/es/settings/setting-editor/setting-editor-view.js +169 -0
  239. package/es/settings/setting-editor/setting-tree-service.d.ts +9 -0
  240. package/es/settings/setting-editor/setting-tree-service.d.ts.map +1 -0
  241. package/es/settings/setting-editor/setting-tree-service.js +118 -0
  242. package/es/settings/setting-editor/setting-tree-view.d.ts +19 -0
  243. package/es/settings/setting-editor/setting-tree-view.d.ts.map +1 -0
  244. package/es/settings/setting-editor/setting-tree-view.js +87 -0
  245. package/es/settings/settings-contribution.d.ts +7 -0
  246. package/es/settings/settings-contribution.d.ts.map +1 -0
  247. package/es/settings/settings-contribution.js +36 -0
  248. package/es/settings/settings-modal.d.ts +5 -0
  249. package/es/settings/settings-modal.d.ts.map +1 -0
  250. package/es/settings/settings-modal.js +53 -0
  251. package/es/settings/settings-modal.less +3 -0
  252. package/es/settings/settings-protocol.d.ts +4 -0
  253. package/es/settings/settings-protocol.d.ts.map +1 -0
  254. package/es/settings/settings-protocol.js +5 -0
  255. package/es/slot/index.d.ts +5 -0
  256. package/es/slot/index.d.ts.map +1 -0
  257. package/es/slot/index.js +4 -0
  258. package/es/slot/libro-slot-manager.d.ts +13 -0
  259. package/es/slot/libro-slot-manager.d.ts.map +1 -0
  260. package/es/slot/libro-slot-manager.js +66 -0
  261. package/es/slot/libro-slot-protocol.d.ts +19 -0
  262. package/es/slot/libro-slot-protocol.d.ts.map +1 -0
  263. package/es/slot/libro-slot-protocol.js +5 -0
  264. package/es/slot/libro-slot-view.d.ts +9 -0
  265. package/es/slot/libro-slot-view.d.ts.map +1 -0
  266. package/es/slot/libro-slot-view.js +81 -0
  267. package/es/slot/module.d.ts +3 -0
  268. package/es/slot/module.d.ts.map +1 -0
  269. package/es/slot/module.js +5 -0
  270. package/es/theme/libro-color-registry.d.ts +6 -0
  271. package/es/theme/libro-color-registry.d.ts.map +1 -0
  272. package/es/theme/libro-color-registry.js +515 -0
  273. package/es/toolbar/all-outputs-scroll-icon.d.ts +3 -0
  274. package/es/toolbar/all-outputs-scroll-icon.d.ts.map +1 -0
  275. package/es/toolbar/all-outputs-scroll-icon.js +10 -0
  276. package/es/toolbar/change-cell-to-selector.d.ts +5 -0
  277. package/es/toolbar/change-cell-to-selector.d.ts.map +1 -0
  278. package/es/toolbar/change-cell-to-selector.js +51 -0
  279. package/es/toolbar/hide-all-selector.d.ts +5 -0
  280. package/es/toolbar/hide-all-selector.d.ts.map +1 -0
  281. package/es/toolbar/hide-all-selector.js +99 -0
  282. package/es/toolbar/index.d.ts +4 -0
  283. package/es/toolbar/index.d.ts.map +1 -0
  284. package/es/toolbar/index.js +3 -0
  285. package/es/toolbar/index.less +59 -0
  286. package/es/toolbar/libro-toolbar-protocol.d.ts +4 -0
  287. package/es/toolbar/libro-toolbar-protocol.d.ts.map +1 -0
  288. package/es/toolbar/libro-toolbar-protocol.js +1 -0
  289. package/es/toolbar/libro-toolbar.d.ts +9 -0
  290. package/es/toolbar/libro-toolbar.d.ts.map +1 -0
  291. package/es/toolbar/libro-toolbar.js +275 -0
  292. package/es/toolbar/module.d.ts +3 -0
  293. package/es/toolbar/module.d.ts.map +1 -0
  294. package/es/toolbar/module.js +5 -0
  295. package/es/toolbar/restart-clear-outputs-contribution.d.ts +5 -0
  296. package/es/toolbar/restart-clear-outputs-contribution.d.ts.map +1 -0
  297. package/es/toolbar/restart-clear-outputs-contribution.js +23 -0
  298. package/es/toolbar/restart-clear-outputs-modal.d.ts +5 -0
  299. package/es/toolbar/restart-clear-outputs-modal.d.ts.map +1 -0
  300. package/es/toolbar/restart-clear-outputs-modal.js +30 -0
  301. package/es/toolbar/save-icon.d.ts +3 -0
  302. package/es/toolbar/save-icon.d.ts.map +1 -0
  303. package/es/toolbar/save-icon.js +54 -0
  304. package/es/toolbar/shutdown-contribution.d.ts +5 -0
  305. package/es/toolbar/shutdown-contribution.d.ts.map +1 -0
  306. package/es/toolbar/shutdown-contribution.js +23 -0
  307. package/es/toolbar/shutdown-modal.d.ts +5 -0
  308. package/es/toolbar/shutdown-modal.d.ts.map +1 -0
  309. package/es/toolbar/shutdown-modal.js +30 -0
  310. package/es/toolbar/side-toolar-more-select.d.ts +4 -0
  311. package/es/toolbar/side-toolar-more-select.d.ts.map +1 -0
  312. package/es/toolbar/side-toolar-more-select.js +161 -0
  313. package/es/typings/index.d.ts +1 -0
  314. package/es/virtualized-manager-helper.d.ts +11 -0
  315. package/es/virtualized-manager-helper.d.ts.map +1 -0
  316. package/es/virtualized-manager-helper.js +51 -0
  317. package/es/virtualized-manager.d.ts +23 -0
  318. package/es/virtualized-manager.d.ts.map +1 -0
  319. package/es/virtualized-manager.js +65 -0
  320. package/package.json +73 -0
  321. package/src/add-cell/index.less +38 -0
  322. package/src/add-cell/index.ts +3 -0
  323. package/src/add-cell/libro-add-cell-module.ts +9 -0
  324. package/src/add-cell/libro-add-cell-slot-contribution.ts +28 -0
  325. package/src/add-cell/libro-add-cell-view.tsx +99 -0
  326. package/src/cell/README.md +14 -0
  327. package/src/cell/index.ts +9 -0
  328. package/src/cell/libro-cell-contribution.ts +34 -0
  329. package/src/cell/libro-cell-model.ts +119 -0
  330. package/src/cell/libro-cell-module.ts +40 -0
  331. package/src/cell/libro-cell-protocol.ts +55 -0
  332. package/src/cell/libro-cell-service.ts +158 -0
  333. package/src/cell/libro-cell-view.tsx +156 -0
  334. package/src/cell/libro-edit-cell-view.tsx +205 -0
  335. package/src/cell/libro-executable-cell-model.ts +32 -0
  336. package/src/cell/libro-executable-cell-view.ts +86 -0
  337. package/src/cell/libro-markdown-cell-model.ts +20 -0
  338. package/src/collapse-service.ts +69 -0
  339. package/src/command/document-commands.ts +24 -0
  340. package/src/command/index.ts +6 -0
  341. package/src/command/kernel-command.ts +42 -0
  342. package/src/command/libro-command-contribution.ts +1346 -0
  343. package/src/command/libro-command-register.ts +168 -0
  344. package/src/command/module.ts +9 -0
  345. package/src/command/notebook-commands.ts +502 -0
  346. package/src/components/cell-protocol.ts +26 -0
  347. package/src/components/dnd-cell-item-render.tsx +465 -0
  348. package/src/components/dnd-component/custom-drag-layer.tsx +144 -0
  349. package/src/components/dnd-component/default-dnd-content.tsx +330 -0
  350. package/src/components/dnd-component/dnd-context.tsx +28 -0
  351. package/src/components/dnd-component/dnd-list.tsx +211 -0
  352. package/src/components/dnd-component/index.less +12 -0
  353. package/src/components/dnd-component/index.tsx +4 -0
  354. package/src/components/dnd-component/overscanIndices-getter.ts +92 -0
  355. package/src/components/dnd-component/virtualized-manager.ts +34 -0
  356. package/src/components/index.ts +5 -0
  357. package/src/components/libro-component.tsx +30 -0
  358. package/src/components/libro-side-toolbar-menu.tsx +82 -0
  359. package/src/components/libro-view-header.tsx +33 -0
  360. package/src/components/libro-virtualized-render.tsx +178 -0
  361. package/src/content/index.ts +5 -0
  362. package/src/content/libro-content-contribution.ts +16 -0
  363. package/src/content/libro-content-module.ts +17 -0
  364. package/src/content/libro-content-protocol.ts +14 -0
  365. package/src/content/libro-content-service.ts +48 -0
  366. package/src/content/libro-save-content-contribution.ts +12 -0
  367. package/src/formatter/index.ts +5 -0
  368. package/src/formatter/libro-formatter-json-contribution.ts +42 -0
  369. package/src/formatter/libro-formatter-manager.ts +85 -0
  370. package/src/formatter/libro-formatter-module.ts +19 -0
  371. package/src/formatter/libro-formatter-protocol.ts +63 -0
  372. package/src/formatter/libro-formatter-string-contribution.ts +41 -0
  373. package/src/formatter/libro-formatter-trans-default-contribution.ts +15 -0
  374. package/src/index.less +789 -0
  375. package/src/index.spec.ts +12 -0
  376. package/src/index.tsx +25 -0
  377. package/src/libro-context-key.ts +84 -0
  378. package/src/libro-keybind-registry.ts +43 -0
  379. package/src/libro-model.ts +710 -0
  380. package/src/libro-protocol.ts +435 -0
  381. package/src/libro-service.ts +234 -0
  382. package/src/libro-setting-contribution.ts +28 -0
  383. package/src/libro-setting.ts +110 -0
  384. package/src/libro-view-tracker.ts +9 -0
  385. package/src/libro-view.tsx +1532 -0
  386. package/src/libro-workspace-service.ts +28 -0
  387. package/src/material-from-designer.tsx +579 -0
  388. package/src/module.ts +121 -0
  389. package/src/output/index.ts +5 -0
  390. package/src/output/output-area.tsx +286 -0
  391. package/src/output/output-contribution.ts +14 -0
  392. package/src/output/output-model.tsx +70 -0
  393. package/src/output/output-module.ts +10 -0
  394. package/src/output/output-protocol.ts +168 -0
  395. package/src/settings/index.less +3 -0
  396. package/src/settings/index.ts +4 -0
  397. package/src/settings/module.ts +8 -0
  398. package/src/settings/setting-editor/configuration-panel-view.tsx +89 -0
  399. package/src/settings/setting-editor/configuration-render-contribution.ts +81 -0
  400. package/src/settings/setting-editor/default-node-render.tsx +65 -0
  401. package/src/settings/setting-editor/index.less +12 -0
  402. package/src/settings/setting-editor/index.ts +6 -0
  403. package/src/settings/setting-editor/module.ts +17 -0
  404. package/src/settings/setting-editor/setting-editor-view.tsx +93 -0
  405. package/src/settings/setting-editor/setting-tree-service.ts +82 -0
  406. package/src/settings/setting-editor/setting-tree-view.tsx +95 -0
  407. package/src/settings/settings-contribution.tsx +24 -0
  408. package/src/settings/settings-modal.less +3 -0
  409. package/src/settings/settings-modal.tsx +51 -0
  410. package/src/settings/settings-protocol.ts +7 -0
  411. package/src/slot/index.ts +4 -0
  412. package/src/slot/libro-slot-manager.ts +38 -0
  413. package/src/slot/libro-slot-protocol.ts +28 -0
  414. package/src/slot/libro-slot-view.tsx +48 -0
  415. package/src/slot/module.ts +9 -0
  416. package/src/theme/libro-color-registry.ts +386 -0
  417. package/src/toolbar/all-outputs-scroll-icon.tsx +19 -0
  418. package/src/toolbar/change-cell-to-selector.tsx +67 -0
  419. package/src/toolbar/hide-all-selector.tsx +126 -0
  420. package/src/toolbar/index.less +59 -0
  421. package/src/toolbar/index.ts +3 -0
  422. package/src/toolbar/libro-toolbar-protocol.ts +4 -0
  423. package/src/toolbar/libro-toolbar.tsx +231 -0
  424. package/src/toolbar/module.ts +11 -0
  425. package/src/toolbar/restart-clear-outputs-contribution.tsx +10 -0
  426. package/src/toolbar/restart-clear-outputs-modal.tsx +37 -0
  427. package/src/toolbar/save-icon.tsx +47 -0
  428. package/src/toolbar/shutdown-contribution.tsx +10 -0
  429. package/src/toolbar/shutdown-modal.tsx +37 -0
  430. package/src/toolbar/side-toolar-more-select.tsx +177 -0
  431. package/src/typings/index.d.ts +1 -0
  432. package/src/virtualized-manager-helper.ts +29 -0
  433. package/src/virtualized-manager.ts +47 -0
@@ -0,0 +1,292 @@
1
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
5
+ 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); }
6
+ 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); }
7
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+ 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."); }
9
+ 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); }
10
+ 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; }
11
+ 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; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ /* eslint-disable react-hooks/exhaustive-deps */
14
+ import { getOrigin, useInject, ViewInstance } from '@difizen/mana-app';
15
+ import { useConfigurationValue } from '@difizen/mana-app';
16
+ import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, forwardRef } from 'react';
17
+ import { useDrag, useDragDropManager, useDrop } from 'react-dnd';
18
+ import { getEmptyImage } from 'react-dnd-html5-backend';
19
+ import 'resize-observer-polyfill';
20
+ import { LibroCellService } from "../../cell/index.js";
21
+ import { CellCollapsible } from "../../collapse-service.js";
22
+ import { DragAreaKey, isCellView } from "../../libro-protocol.js";
23
+ import { MultiSelectionWhenShiftClick } from "../../libro-setting.js";
24
+ import { HolderOutlined, PlusOutlined } from "../../material-from-designer.js";
25
+ import { BetweenCellProvider } from "../cell-protocol.js";
26
+ import { jsx as _jsx } from "react/jsx-runtime";
27
+ import { jsxs as _jsxs } from "react/jsx-runtime";
28
+ export var DndCellContainer = function DndCellContainer(_ref) {
29
+ var _instance$container;
30
+ var cell = _ref.cell,
31
+ index = _ref.index;
32
+ var ref = useRef(null);
33
+ var instance = useInject(ViewInstance);
34
+ var _useConfigurationValu = useConfigurationValue(MultiSelectionWhenShiftClick),
35
+ _useConfigurationValu2 = _slicedToArray(_useConfigurationValu, 1),
36
+ multiSelectionWhenShiftClick = _useConfigurationValu2[0];
37
+ var BetweenCellContent = useInject(BetweenCellProvider);
38
+ var cellService = useInject(LibroCellService);
39
+ var dragDropManager = useDragDropManager();
40
+ var dragDropMonitor = dragDropManager.getMonitor();
41
+ var ItemRender = getOrigin(instance.dndItemRender);
42
+ useLayoutEffect(function () {
43
+ if (_typeof(ref) !== 'object') {
44
+ return function () {
45
+ //
46
+ };
47
+ }
48
+ var el = ref === null || ref === void 0 ? void 0 : ref.current;
49
+ if (!el) {
50
+ return function () {
51
+ //
52
+ };
53
+ }
54
+ var resizeObserver = new ResizeObserver(function (entries) {
55
+ entries.forEach(function (entry) {
56
+ var isVisible = entry.contentRect.width !== 0 && entry.contentRect.height !== 0;
57
+ if (isVisible) {
58
+ var _ref$current;
59
+ cell.noEditorAreaHeight = ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.clientHeight) || 0;
60
+ }
61
+ });
62
+ });
63
+ resizeObserver.observe(el);
64
+ return function () {
65
+ cell.noEditorAreaHeight = 0;
66
+ resizeObserver.disconnect();
67
+ };
68
+ }, [ref, cell]);
69
+ var handleFocus = useCallback(function (e) {
70
+ var className = e.target.className;
71
+ if (e.target.tagName === 'svg' || className && className && typeof className === 'string' && (className.includes('mana-toolbar-item') || className.includes('mana-toolbar'))) {
72
+ return;
73
+ }
74
+ instance.model.selectCell(cell);
75
+ instance.model.selections = [];
76
+ if (cell.shouldEnterEditorMode(e)) {
77
+ instance.enterEditMode();
78
+ }
79
+ }, [instance, cell]);
80
+ var handleMouseDown = useCallback(function (e) {
81
+ if (e.shiftKey && multiSelectionWhenShiftClick) {
82
+ //按shift键时为多选cell
83
+ instance.extendContiguousSelectionTo(index);
84
+ instance.model.mouseMode = 'multipleSelection';
85
+ return;
86
+ }
87
+ instance.model.mouseMode = 'mouseDown';
88
+ }, [multiSelectionWhenShiftClick, instance, index]);
89
+ var handleMouseUp = useCallback(function () {
90
+ if (instance.model.mouseMode === 'multipleSelection' || instance.model.mouseMode === 'drag') {
91
+ return;
92
+ }
93
+ instance.model.selectCell(cell);
94
+ instance.model.selections = [];
95
+ }, [instance, cell]);
96
+ var scrollTimer = useRef(null);
97
+ var unsubscribe = useRef(null);
98
+ var _useDrag = useDrag({
99
+ type: DragAreaKey,
100
+ item: {
101
+ cell: cell,
102
+ index: index
103
+ },
104
+ collect: function collect(monitor) {
105
+ return {
106
+ isDrag: monitor.isDragging()
107
+ };
108
+ },
109
+ end: function end() {
110
+ instance.isDragging = false;
111
+ if (scrollTimer.current) {
112
+ clearInterval(scrollTimer.current);
113
+ }
114
+ }
115
+ }, [cell, index]),
116
+ _useDrag2 = _slicedToArray(_useDrag, 3),
117
+ isDrag = _useDrag2[0].isDrag,
118
+ drag = _useDrag2[1],
119
+ preview = _useDrag2[2];
120
+ var libroViewContent = (_instance$container = instance.container) === null || _instance$container === void 0 || (_instance$container = _instance$container.current) === null || _instance$container === void 0 ? void 0 : _instance$container.getElementsByClassName('libro-view-content')[0];
121
+ useEffect(function () {
122
+ unsubscribe.current = dragDropMonitor.subscribeToStateChange(function () {
123
+ instance.isDragging = dragDropMonitor.isDragging();
124
+ scrollTimer.current = setInterval(function () {
125
+ var currentOffset = dragDropMonitor.getClientOffset();
126
+ if (libroViewContent && instance.isDragging && currentOffset) {
127
+ var libroViewClientRect = libroViewContent.getBoundingClientRect();
128
+ var top = libroViewClientRect.top,
129
+ bottom = libroViewClientRect.bottom;
130
+ var y = currentOffset.y;
131
+ var topLimit = top + 30;
132
+ var bottomLimit = bottom - 50;
133
+ if (y < topLimit) {
134
+ libroViewContent.scrollTop -= 0.5;
135
+ } else if (y > bottomLimit) {
136
+ libroViewContent.scrollTop += 0.5;
137
+ }
138
+ }
139
+ }, 10);
140
+ return function () {
141
+ if (scrollTimer.current) {
142
+ clearInterval(scrollTimer.current);
143
+ }
144
+ if (unsubscribe.current) {
145
+ unsubscribe.current();
146
+ }
147
+ };
148
+ });
149
+ }, [dragDropMonitor]);
150
+ useEffect(function () {
151
+ // This gets called after every render, by default
152
+ // (the first one, and every one after that)
153
+
154
+ // Use empty image as a drag preview so browsers don't draw it
155
+ // and we can draw whatever we want on the custom drag layer instead.
156
+ preview(getEmptyImage(), {
157
+ // IE fallback: specify that we'd rather screenshot the node
158
+ // when it already knows it's being dragged so we can hide it with CSS.
159
+ captureDraggingState: true
160
+ });
161
+ }, [preview]);
162
+ var _useDrop = useDrop({
163
+ accept: DragAreaKey,
164
+ drop: function drop(item, monitor) {
165
+ cellService.getOrCreateView(_objectSpread(_objectSpread({}, item.cell.model.options), {}, {
166
+ modelId: item.cell.model.id,
167
+ singleSelectionDragPreview: true
168
+ }), item.cell.parent.id).then(function (view) {
169
+ view.dispose();
170
+ return;
171
+ }).catch(function (e) {
172
+ //
173
+ });
174
+ if (isCellView(item.cell)) {
175
+ var didDrop = monitor.didDrop();
176
+ if (didDrop) {
177
+ return;
178
+ }
179
+ var dragIndex = instance.findCellIndex(item.cell);
180
+ var dropIndex = instance.findCellIndex(cell);
181
+ if (instance.model.selections.length > 0) {
182
+ var isDragInSelections = instance.model.selections.findIndex(function (selection) {
183
+ return selection.id === item.cell.id;
184
+ }) > -1 ? true : false;
185
+ var isDropInSelections = instance.model.selections.findIndex(function (selection) {
186
+ return selection.id === cell.id;
187
+ }) > -1 ? true : false;
188
+ if (isDragInSelections && isDropInSelections) {
189
+ return;
190
+ }
191
+ if (isDragInSelections) {
192
+ instance.model.exchangeCells(instance.model.selections, dropIndex);
193
+ instance.model.scrollToView(cell);
194
+ return;
195
+ }
196
+ }
197
+ if (dragIndex < dropIndex) {
198
+ instance.model.exchangeCell(dragIndex, dropIndex - 1);
199
+ instance.model.scrollToView(cell);
200
+ }
201
+ if (dragIndex > dropIndex) {
202
+ instance.model.exchangeCell(dragIndex, dropIndex);
203
+ instance.model.scrollToView(cell);
204
+ }
205
+ }
206
+ return;
207
+ },
208
+ collect: function collect(monitor) {
209
+ return {
210
+ isDragOver: monitor.isOver(),
211
+ canDrop: monitor.canDrop(),
212
+ handlerId: monitor.getHandlerId()
213
+ };
214
+ }
215
+ }),
216
+ _useDrop2 = _slicedToArray(_useDrop, 2),
217
+ _useDrop2$ = _useDrop2[0],
218
+ handlerId = _useDrop2$.handlerId,
219
+ isDragOver = _useDrop2$.isDragOver,
220
+ drop = _useDrop2[1];
221
+ var opacity = isDrag ? 0.4 : 1;
222
+ if (instance.model.cellsEditable) {
223
+ drop(ref);
224
+ }
225
+ if (isDrag) {
226
+ instance.model.mouseMode = 'drag';
227
+ }
228
+ var isMultiSelected = instance.model.selections.length !== 0 && instance.isSelected(cell);
229
+ // let isMouseOver = false;
230
+ var _useState = useState(false),
231
+ _useState2 = _slicedToArray(_useState, 2),
232
+ isMouseOverDragArea = _useState2[0],
233
+ setIsMouseOverDragArea = _useState2[1];
234
+ var hasCellHidden = useMemo(function () {
235
+ return cell.hasCellHidden();
236
+ }, [cell]);
237
+ var isCollapsible = CellCollapsible.is(cell);
238
+ return /*#__PURE__*/_jsxs("div", {
239
+ className: "libro-dnd-cell-container ".concat(isMultiSelected ? 'multi-selected' : '', " ").concat(hasCellHidden ? 'hidden' : ''),
240
+ "data-handler-id": handlerId,
241
+ style: {
242
+ opacity: opacity
243
+ },
244
+ ref: ref,
245
+ id: cell.id,
246
+ children: [/*#__PURE__*/_jsx(BetweenCellContent, {
247
+ index: index,
248
+ addCell: cell.parent.addCellAbove
249
+ }), isDragOver && /*#__PURE__*/_jsx("div", {
250
+ className: "libro-drag-hoverline"
251
+ }), isMouseOverDragArea && /*#__PURE__*/_jsx(HolderOutlined, {
252
+ className: "libro-handle-style"
253
+ }), /*#__PURE__*/_jsx("div", {
254
+ className: "libro-drag-area",
255
+ ref: drag,
256
+ onMouseDown: handleMouseDown,
257
+ onMouseUp: handleMouseUp,
258
+ onMouseOver: function onMouseOver() {
259
+ return setIsMouseOverDragArea(true);
260
+ },
261
+ onMouseLeave: function onMouseLeave() {
262
+ return setIsMouseOverDragArea(false);
263
+ }
264
+ }), /*#__PURE__*/_jsx("div", {
265
+ tabIndex: -1,
266
+ onFocus: handleFocus
267
+ // onClick={e => e.preventDefault()}
268
+ ,
269
+ className: "libro-dnd-cell-content",
270
+ children: /*#__PURE__*/_jsx(ItemRender, {
271
+ isDragOver: !!isDragOver,
272
+ isDrag: !!isDrag,
273
+ cell: cell,
274
+ isMouseOverDragArea: isMouseOverDragArea
275
+ })
276
+ }), isCollapsible && cell.headingCollapsed && cell.collapsibleChildNumber > 0 && /*#__PURE__*/_jsx("div", {
277
+ className: "libro-cell-collapsed-expander",
278
+ children: /*#__PURE__*/_jsxs("button", {
279
+ className: "libro-cell-expand-button",
280
+ onClick: function onClick() {
281
+ return instance.collapseCell(cell, false);
282
+ },
283
+ children: [/*#__PURE__*/_jsx(PlusOutlined, {
284
+ className: ""
285
+ }), " ", cell.collapsibleChildNumber, " cell hidden"]
286
+ })
287
+ })]
288
+ });
289
+ };
290
+ export var LibroBetweenCellContent = /*#__PURE__*/forwardRef(function LibroBetweenCellContent() {
291
+ return null;
292
+ });
@@ -0,0 +1,3 @@
1
+ import type { FC } from 'react';
2
+ export declare const DndContext: FC<any>;
3
+ //# sourceMappingURL=dnd-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dnd-context.d.ts","sourceRoot":"","sources":["../../../src/components/dnd-component/dnd-context.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAMhC,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,GAAG,CAmB9B,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { getOrigin, useInject } from '@difizen/mana-app';
2
+ import { ViewInstance } from '@difizen/mana-app';
3
+ import { DndProvider } from 'react-dnd';
4
+ import { HTML5Backend } from 'react-dnd-html5-backend';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ export var DndContext = function DndContext(_ref) {
7
+ var _getOrigin$container;
8
+ var children = _ref.children;
9
+ var instance = useInject(ViewInstance);
10
+ if (!instance.isVisible && !instance.model.dndAreaNullEnable) {
11
+ return null;
12
+ }
13
+ return /*#__PURE__*/_jsx(DndProvider, {
14
+ backend: HTML5Backend,
15
+ options: {
16
+ rootElement: instance.isVisible || !instance.model.dndAreaNullEnable ? (_getOrigin$container = getOrigin(instance).container) === null || _getOrigin$container === void 0 ? void 0 : _getOrigin$container.current : null
17
+ },
18
+ children: children
19
+ });
20
+ };
@@ -0,0 +1,14 @@
1
+ import type { FC, ReactNode } from 'react';
2
+ import type { DndContentProps } from '../../libro-protocol.js';
3
+ import type { LibroView } from '../../libro-view.js';
4
+ import './index.less';
5
+ export declare const DndCellRender: FC<DndContentProps>;
6
+ export declare const DndCellsRender: import("react").ForwardRefExoticComponent<{
7
+ libroView: LibroView;
8
+ addCellButtons: ReactNode;
9
+ } & import("react").RefAttributes<HTMLDivElement>>;
10
+ export declare const DndList: import("react").ForwardRefExoticComponent<{
11
+ libroView: LibroView;
12
+ children: ReactNode;
13
+ } & import("react").RefAttributes<HTMLDivElement>>;
14
+ //# sourceMappingURL=dnd-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dnd-list.d.ts","sourceRoot":"","sources":["../../../src/components/dnd-component/dnd-list.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAO3C,OAAO,KAAK,EAAY,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAEzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKrD,OAAO,cAAc,CAAC;AAEtB,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,eAAe,CAY5C,CAAC;AAaH,eAAO,MAAM,cAAc;eAEZ,SAAS;oBAAkB,SAAS;kDAsFjD,CAAC;AAEH,eAAO,MAAM,OAAO;eAEL,SAAS;cAAY,SAAS;kDA2E3C,CAAC"}
@@ -0,0 +1,182 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["cell", "index"];
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+ 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
+ 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); }
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
+ 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; } }
8
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
13
+ 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
+ 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
+ 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';
17
+ import classNames from 'classnames';
18
+ import { forwardRef, memo, useEffect, useState } from 'react';
19
+ import { useDrop } from 'react-dnd';
20
+ import { LibroCellService } from "../../cell/index.js";
21
+ import { DragAreaKey, isCellView } from "../../libro-protocol.js";
22
+ import { VirtualizedManagerHelper } from "../../virtualized-manager-helper.js";
23
+ import { LibroCellsOutputRender } from "../libro-virtualized-render.js";
24
+ import "./index.less";
25
+ import { jsx as _jsx } from "react/jsx-runtime";
26
+ import { Fragment as _Fragment } from "react/jsx-runtime";
27
+ 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
+ var observableCell = useObserve(cell);
33
+ var instance = useInject(ViewInstance);
34
+ var DndCellContainer = instance.dndContentRender;
35
+ return /*#__PURE__*/_jsx(DndCellContainer, _objectSpread({
36
+ cell: observableCell,
37
+ index: index
38
+ }, props), cell.id);
39
+ });
40
+
41
+ // 定义一个函数用于渲染非虚拟列表时的单元格
42
+ var renderNonVirtualListCells = function renderNonVirtualListCells(cells) {
43
+ return /*#__PURE__*/_jsx("div", {
44
+ style: {
45
+ height: '100%',
46
+ overflow: 'visible'
47
+ },
48
+ children: cells.filter(function (cell) {
49
+ return !cell.collapsedHidden;
50
+ }).map(function (cell, index) {
51
+ return /*#__PURE__*/_jsx(DndCellRender, {
52
+ cell: cell,
53
+ index: index
54
+ }, cell.id);
55
+ })
56
+ });
57
+ };
58
+ export var DndCellsRender = /*#__PURE__*/forwardRef(function DndCellsRender(_ref2, ref) {
59
+ var libroView = _ref2.libroView,
60
+ addCellButtons = _ref2.addCellButtons;
61
+ var LoadingRender = getOrigin(libroView.loadingRender);
62
+ var virtualizedManagerHelper = useInject(VirtualizedManagerHelper);
63
+ var virtualizedManager = virtualizedManagerHelper.getOrCreate(libroView.model);
64
+ var cells = libroView.model.getCells().reduce(function (a, b) {
65
+ if (a.indexOf(b) < 0) {
66
+ a.push(b);
67
+ }
68
+ return a;
69
+ }, []);
70
+ var _useState = useState(false),
71
+ _useState2 = _slicedToArray(_useState, 2),
72
+ isVirtualList = _useState2[0],
73
+ setIsVirtualList = _useState2[1];
74
+ var _useState3 = useState(true),
75
+ _useState4 = _slicedToArray(_useState3, 2),
76
+ isJudging = _useState4[0],
77
+ setIsJudging = _useState4[1];
78
+ useEffect(function () {
79
+ if (!libroView.model.isInitialized) {
80
+ return;
81
+ }
82
+ var size = undefined;
83
+ var path = undefined;
84
+
85
+ // TODO: 类型处理
86
+ var model = libroView.model;
87
+ if (model.currentFileContents && model.currentFileContents.size) {
88
+ size = parseFloat((model.currentFileContents.size / 1048576).toFixed(3)); // 单位MB
89
+ path = model.currentFileContents.path || '';
90
+ }
91
+ setIsJudging(true);
92
+ virtualizedManager.openVirtualized(cells.length, size, path).then(function (willOpen) {
93
+ setIsVirtualList(willOpen);
94
+ return;
95
+ }).catch(function () {
96
+ setIsVirtualList(false);
97
+ }).finally(function () {
98
+ setIsJudging(false);
99
+ }).catch(function (e) {
100
+ //
101
+ });
102
+ // eslint-disable-next-line react-hooks/exhaustive-deps
103
+ }, [virtualizedManager, libroView.model.isInitialized]);
104
+ var isInitialized = libroView.model.isInitialized;
105
+ var isLoading = !isInitialized || isJudging;
106
+ var shouldRenderCells = isInitialized && !isJudging;
107
+ return /*#__PURE__*/_jsxs(_Fragment, {
108
+ children: [/*#__PURE__*/_jsxs("div", {
109
+ className: classNames('libro-dnd-cells-container', isVirtualList && 'virtual_list_container'),
110
+ ref: ref,
111
+ children: [isLoading && /*#__PURE__*/_jsx(LoadingRender, {}), /*#__PURE__*/_jsx(_Fragment, {
112
+ children: shouldRenderCells && /*#__PURE__*/_jsx(_Fragment, {
113
+ children: isVirtualList ? /*#__PURE__*/_jsx(LibroCellsOutputRender, {
114
+ cells: cells,
115
+ libroView: libroView,
116
+ addCellButtons: addCellButtons
117
+ }) : renderNonVirtualListCells(cells)
118
+ })
119
+ })]
120
+ }), shouldRenderCells && !isVirtualList && addCellButtons]
121
+ });
122
+ });
123
+ export var DndList = /*#__PURE__*/forwardRef(function DndList(_ref3, ref) {
124
+ var libroView = _ref3.libroView,
125
+ children = _ref3.children;
126
+ var cellService = useInject(LibroCellService);
127
+ var _useDrop = useDrop(function () {
128
+ return {
129
+ accept: DragAreaKey,
130
+ drop: function drop(item, dropMonitor) {
131
+ cellService.getOrCreateView(_objectSpread(_objectSpread({}, item.cell.model.options), {}, {
132
+ modelId: item.cell.model.id,
133
+ singleSelectionDragPreview: true
134
+ }), item.cell.parent.id).then(function (view) {
135
+ view.dispose();
136
+ return;
137
+ }).catch(function (e) {
138
+ //
139
+ });
140
+ if (isCellView(item.cell)) {
141
+ var _lastCell$container;
142
+ var didDrop = dropMonitor.didDrop();
143
+ if (didDrop) {
144
+ return;
145
+ }
146
+ // Determine mouse position
147
+ var clientOffset = dropMonitor.getClientOffset();
148
+ var clientOffsetY = clientOffset.y;
149
+ var dragIndex = libroView.findCellIndex(item.cell);
150
+ // Determine rectangle on screen
151
+ var lastCell = libroView.model.getCells()[libroView.model.getCells().length - 1];
152
+ 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;
153
+ if (lastCellOffsetY && clientOffsetY >= lastCellOffsetY) {
154
+ if (libroView.model.selections.length > 0) {
155
+ var isDragInSelections = libroView.model.selections.findIndex(function (selection) {
156
+ return selection.id === item.cell.id;
157
+ }) > -1 ? true : false;
158
+ if (isDragInSelections) {
159
+ libroView.model.exchangeCells(libroView.model.selections, libroView.model.cells.length);
160
+ return;
161
+ }
162
+ }
163
+ libroView.model.exchangeCell(dragIndex, libroView.model.cells.length - 1);
164
+ }
165
+ }
166
+ // Determine mouse position
167
+
168
+ return;
169
+ }
170
+ };
171
+ }),
172
+ _useDrop2 = _slicedToArray(_useDrop, 2),
173
+ drop = _useDrop2[1];
174
+ return /*#__PURE__*/_jsx("div", {
175
+ className: "libro-dnd-list-container",
176
+ ref: drop,
177
+ children: /*#__PURE__*/_jsx(DndCellsRender, {
178
+ libroView: libroView,
179
+ addCellButtons: children
180
+ })
181
+ });
182
+ });
@@ -0,0 +1,5 @@
1
+ export * from './custom-drag-layer.js';
2
+ export * from './default-dnd-content.js';
3
+ export * from './dnd-context.js';
4
+ export * from './dnd-list.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,4 @@
1
+ export * from "./custom-drag-layer.js";
2
+ export * from "./default-dnd-content.js";
3
+ export * from "./dnd-context.js";
4
+ export * from "./dnd-list.js";
@@ -0,0 +1,8 @@
1
+ .virtual_list_container {
2
+ height: 100%;
3
+ width: 100%;
4
+
5
+ // .ReactVirtualized__Grid__innerScrollContainer {
6
+ // overflow: auto !important;
7
+ // }
8
+ }
@@ -0,0 +1,22 @@
1
+ export type OverscanIndicesGetterParams = {
2
+ direction: 'horizontal' | 'vertical';
3
+ scrollDirection: -1 | 1;
4
+ cellCount: number;
5
+ overscanCellsCount: number;
6
+ startIndex: number;
7
+ stopIndex: number;
8
+ };
9
+ export type OverscanIndices = {
10
+ overscanStartIndex: number;
11
+ overscanStopIndex: number;
12
+ };
13
+ export declare const SCROLL_DIRECTION_BACKWARD = -1;
14
+ export declare const SCROLL_DIRECTION_FORWARD = 1;
15
+ export declare const SCROLL_DIRECTION_HORIZONTAL = "horizontal";
16
+ export declare const SCROLL_DIRECTION_VERTICAL = "vertical";
17
+ /**
18
+ * Calculates the number of cells to overscan before and after a specified range.
19
+ * This function ensures that overscanning doesn't exceed the available cells.
20
+ */
21
+ export default function libroOverscanIndicesGetter({ cellCount, overscanCellsCount, scrollDirection, startIndex, stopIndex, }: OverscanIndicesGetterParams): OverscanIndices;
22
+ //# sourceMappingURL=overscanIndices-getter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overscanIndices-getter.d.ts","sourceRoot":"","sources":["../../../src/components/dnd-component/overscanIndices-getter.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,2BAA2B,GAAG;IAExC,SAAS,EAAE,YAAY,GAAG,UAAU,CAAC;IAGrC,eAAe,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;IAGxB,SAAS,EAAE,MAAM,CAAC;IAGlB,kBAAkB,EAAE,MAAM,CAAC;IAG3B,UAAU,EAAE,MAAM,CAAC;IAGnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAC5C,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C,eAAO,MAAM,2BAA2B,eAAe,CAAC;AACxD,eAAO,MAAM,yBAAyB,aAAa,CAAC;AAIpD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAAC,EACjD,SAAS,EACT,kBAAkB,EAClB,eAAe,EACf,UAAU,EACV,SAAS,GACV,EAAE,2BAA2B,GAAG,eAAe,CAgD/C"}
@@ -0,0 +1,58 @@
1
+ export var SCROLL_DIRECTION_BACKWARD = -1;
2
+ export var SCROLL_DIRECTION_FORWARD = 1;
3
+ export var SCROLL_DIRECTION_HORIZONTAL = 'horizontal';
4
+ export var SCROLL_DIRECTION_VERTICAL = 'vertical';
5
+ var overscanIndicesCache = null;
6
+
7
+ /**
8
+ * Calculates the number of cells to overscan before and after a specified range.
9
+ * This function ensures that overscanning doesn't exceed the available cells.
10
+ */
11
+ export default function libroOverscanIndicesGetter(_ref) {
12
+ var cellCount = _ref.cellCount,
13
+ overscanCellsCount = _ref.overscanCellsCount,
14
+ scrollDirection = _ref.scrollDirection,
15
+ startIndex = _ref.startIndex,
16
+ stopIndex = _ref.stopIndex;
17
+ // Make sure we render at least 1 cell extra before and after (except near boundaries)
18
+ // This is necessary in order to support keyboard navigation (TAB/SHIFT+TAB) in some cases
19
+ // For more info see issues #625
20
+
21
+ // 计算 overscanIndices 的函数
22
+ var calculateOverscanIndices = function calculateOverscanIndices() {
23
+ var _overscanCellsCount = Math.max(1, overscanCellsCount);
24
+ var overscanIndices = null;
25
+ if (scrollDirection === SCROLL_DIRECTION_FORWARD) {
26
+ overscanIndices = {
27
+ overscanStartIndex: Math.max(0, startIndex - 1),
28
+ overscanStopIndex: Math.min(cellCount - 1, stopIndex + _overscanCellsCount)
29
+ };
30
+ } else {
31
+ overscanIndices = {
32
+ overscanStartIndex: Math.max(0, startIndex - _overscanCellsCount),
33
+ overscanStopIndex: Math.min(cellCount - 1, stopIndex + 1)
34
+ };
35
+ }
36
+ return overscanIndices;
37
+ };
38
+
39
+ // 检查缓存和时间戳函数
40
+ var checkCacheAndTimestamp = function checkCacheAndTimestamp() {
41
+ if (cellCount === 1) {
42
+ // 'horizontal' 方向 不用缓存
43
+ var overscanIndices = calculateOverscanIndices();
44
+ return overscanIndices;
45
+ }
46
+ if (overscanIndicesCache && Date.now() - overscanIndicesCache.timestamp < 500) {
47
+ return overscanIndicesCache.value;
48
+ } else {
49
+ var _overscanIndices = calculateOverscanIndices();
50
+ overscanIndicesCache = {
51
+ value: _overscanIndices,
52
+ timestamp: Date.now()
53
+ };
54
+ return _overscanIndices;
55
+ }
56
+ };
57
+ return checkCacheAndTimestamp();
58
+ }
@@ -0,0 +1,19 @@
1
+ export interface IVirtualizedManager {
2
+ openVirtualized: (length: number, size?: number) => Promise<boolean>;
3
+ isVirtualized: boolean;
4
+ }
5
+ export declare class VirtualizedManager implements IVirtualizedManager {
6
+ /**
7
+ * 因为进行isVirtualized判断过后才会渲染list
8
+ * 所以它用于滚动到某个cell的判断依据是没有问题的。
9
+ */
10
+ isVirtualized: boolean;
11
+ /**
12
+ *
13
+ * @param length cell个数
14
+ * @param size undefined 或者 单位 为B
15
+ * @returns 是否使用虚拟滚动
16
+ */
17
+ openVirtualized: (length: number, size?: number) => Promise<boolean>;
18
+ }
19
+ //# sourceMappingURL=virtualized-manager.d.ts.map
@@ -0,0 +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"}