@difizen/libro-core 0.0.2-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (312) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -0
  3. package/es/add-cell/index.d.ts +4 -0
  4. package/es/add-cell/index.d.ts.map +1 -0
  5. package/es/add-cell/index.js +3 -0
  6. package/es/add-cell/index.less +38 -0
  7. package/es/add-cell/libro-add-cell-module.d.ts +3 -0
  8. package/es/add-cell/libro-add-cell-module.d.ts.map +1 -0
  9. package/es/add-cell/libro-add-cell-module.js +4 -0
  10. package/es/add-cell/libro-add-cell-slot-contribution.d.ts +12 -0
  11. package/es/add-cell/libro-add-cell-slot-contribution.d.ts.map +1 -0
  12. package/es/add-cell/libro-add-cell-slot-contribution.js +53 -0
  13. package/es/add-cell/libro-add-cell-view.d.ts +21 -0
  14. package/es/add-cell/libro-add-cell-view.d.ts.map +1 -0
  15. package/es/add-cell/libro-add-cell-view.js +129 -0
  16. package/es/cell/index.d.ts +10 -0
  17. package/es/cell/index.d.ts.map +1 -0
  18. package/es/cell/index.js +9 -0
  19. package/es/cell/libro-cell-contribution.d.ts +13 -0
  20. package/es/cell/libro-cell-contribution.d.ts.map +1 -0
  21. package/es/cell/libro-cell-contribution.js +41 -0
  22. package/es/cell/libro-cell-model.d.ts +19 -0
  23. package/es/cell/libro-cell-model.d.ts.map +1 -0
  24. package/es/cell/libro-cell-model.js +103 -0
  25. package/es/cell/libro-cell-module.d.ts +10 -0
  26. package/es/cell/libro-cell-module.d.ts.map +1 -0
  27. package/es/cell/libro-cell-module.js +30 -0
  28. package/es/cell/libro-cell-protocol.d.ts +42 -0
  29. package/es/cell/libro-cell-protocol.d.ts.map +1 -0
  30. package/es/cell/libro-cell-protocol.js +11 -0
  31. package/es/cell/libro-cell-service.d.ts +28 -0
  32. package/es/cell/libro-cell-service.d.ts.map +1 -0
  33. package/es/cell/libro-cell-service.js +242 -0
  34. package/es/cell/libro-cell-view.d.ts +65 -0
  35. package/es/cell/libro-cell-view.d.ts.map +1 -0
  36. package/es/cell/libro-cell-view.js +191 -0
  37. package/es/cell/libro-edit-cell-view.d.ts +32 -0
  38. package/es/cell/libro-edit-cell-view.d.ts.map +1 -0
  39. package/es/cell/libro-edit-cell-view.js +72 -0
  40. package/es/cell/libro-executable-cell-model.d.ts +14 -0
  41. package/es/cell/libro-executable-cell-model.d.ts.map +1 -0
  42. package/es/cell/libro-executable-cell-model.js +7 -0
  43. package/es/cell/libro-executable-cell-view.d.ts +27 -0
  44. package/es/cell/libro-executable-cell-view.d.ts.map +1 -0
  45. package/es/cell/libro-executable-cell-view.js +66 -0
  46. package/es/cell/libro-markdown-cell-model.d.ts +9 -0
  47. package/es/cell/libro-markdown-cell-model.d.ts.map +1 -0
  48. package/es/cell/libro-markdown-cell-model.js +7 -0
  49. package/es/collapse-service.d.ts +36 -0
  50. package/es/collapse-service.d.ts.map +1 -0
  51. package/es/collapse-service.js +55 -0
  52. package/es/command/document-commands.d.ts +6 -0
  53. package/es/command/document-commands.d.ts.map +1 -0
  54. package/es/command/document-commands.js +13 -0
  55. package/es/command/index.d.ts +7 -0
  56. package/es/command/index.d.ts.map +1 -0
  57. package/es/command/index.js +6 -0
  58. package/es/command/kernel-command.d.ts +5 -0
  59. package/es/command/kernel-command.d.ts.map +1 -0
  60. package/es/command/kernel-command.js +39 -0
  61. package/es/command/libro-command-contribution.d.ts +14 -0
  62. package/es/command/libro-command-contribution.d.ts.map +1 -0
  63. package/es/command/libro-command-contribution.js +1751 -0
  64. package/es/command/libro-command-register.d.ts +22 -0
  65. package/es/command/libro-command-register.d.ts.map +1 -0
  66. package/es/command/libro-command-register.js +105 -0
  67. package/es/command/module.d.ts +3 -0
  68. package/es/command/module.d.ts.map +1 -0
  69. package/es/command/module.js +4 -0
  70. package/es/command/notebook-commands.d.ts +6 -0
  71. package/es/command/notebook-commands.d.ts.map +1 -0
  72. package/es/command/notebook-commands.js +468 -0
  73. package/es/components/cell-protocol.d.ts +20 -0
  74. package/es/components/cell-protocol.d.ts.map +1 -0
  75. package/es/components/cell-protocol.js +4 -0
  76. package/es/components/dnd-cell-item-render.d.ts +12 -0
  77. package/es/components/dnd-cell-item-render.d.ts.map +1 -0
  78. package/es/components/dnd-cell-item-render.js +253 -0
  79. package/es/components/dnd-component/custom-drag-layer.d.ts +9 -0
  80. package/es/components/dnd-component/custom-drag-layer.d.ts.map +1 -0
  81. package/es/components/dnd-component/custom-drag-layer.js +141 -0
  82. package/es/components/dnd-component/default-dnd-content.d.ts +10 -0
  83. package/es/components/dnd-component/default-dnd-content.d.ts.map +1 -0
  84. package/es/components/dnd-component/default-dnd-content.js +257 -0
  85. package/es/components/dnd-component/dnd-context.d.ts +3 -0
  86. package/es/components/dnd-component/dnd-context.d.ts.map +1 -0
  87. package/es/components/dnd-component/dnd-context.js +20 -0
  88. package/es/components/dnd-component/dnd-list.d.ts +10 -0
  89. package/es/components/dnd-component/dnd-list.d.ts.map +1 -0
  90. package/es/components/dnd-component/dnd-list.js +115 -0
  91. package/es/components/dnd-component/index.d.ts +5 -0
  92. package/es/components/dnd-component/index.d.ts.map +1 -0
  93. package/es/components/dnd-component/index.js +4 -0
  94. package/es/components/index.d.ts +6 -0
  95. package/es/components/index.d.ts.map +1 -0
  96. package/es/components/index.js +5 -0
  97. package/es/components/libro-component.d.ts +5 -0
  98. package/es/components/libro-component.d.ts.map +1 -0
  99. package/es/components/libro-component.js +35 -0
  100. package/es/components/libro-side-toolbar-menu.d.ts +21 -0
  101. package/es/components/libro-side-toolbar-menu.d.ts.map +1 -0
  102. package/es/components/libro-side-toolbar-menu.js +58 -0
  103. package/es/components/libro-view-header.d.ts +3 -0
  104. package/es/components/libro-view-header.d.ts.map +1 -0
  105. package/es/components/libro-view-header.js +37 -0
  106. package/es/configuration/libro-configuration-contribution.d.ts +5 -0
  107. package/es/configuration/libro-configuration-contribution.d.ts.map +1 -0
  108. package/es/configuration/libro-configuration-contribution.js +24 -0
  109. package/es/configuration/libro-configuration.d.ts +10 -0
  110. package/es/configuration/libro-configuration.d.ts.map +1 -0
  111. package/es/configuration/libro-configuration.js +81 -0
  112. package/es/content/index.d.ts +5 -0
  113. package/es/content/index.d.ts.map +1 -0
  114. package/es/content/index.js +4 -0
  115. package/es/content/libro-content-contribution.d.ts +11 -0
  116. package/es/content/libro-content-contribution.d.ts.map +1 -0
  117. package/es/content/libro-content-contribution.js +32 -0
  118. package/es/content/libro-content-module.d.ts +3 -0
  119. package/es/content/libro-content-module.d.ts.map +1 -0
  120. package/es/content/libro-content-module.js +5 -0
  121. package/es/content/libro-content-protocol.d.ts +8 -0
  122. package/es/content/libro-content-protocol.d.ts.map +1 -0
  123. package/es/content/libro-content-protocol.js +2 -0
  124. package/es/content/libro-content-service.d.ts +9 -0
  125. package/es/content/libro-content-service.d.ts.map +1 -0
  126. package/es/content/libro-content-service.js +35 -0
  127. package/es/index.d.ts +20 -0
  128. package/es/index.d.ts.map +1 -0
  129. package/es/index.js +19 -0
  130. package/es/index.less +682 -0
  131. package/es/libro-context-key.d.ts +22 -0
  132. package/es/libro-context-key.d.ts.map +1 -0
  133. package/es/libro-context-key.js +80 -0
  134. package/es/libro-keybind-registry.d.ts +5 -0
  135. package/es/libro-keybind-registry.d.ts.map +1 -0
  136. package/es/libro-keybind-registry.js +68 -0
  137. package/es/libro-model.d.ts +129 -0
  138. package/es/libro-model.d.ts.map +1 -0
  139. package/es/libro-model.js +803 -0
  140. package/es/libro-protocol.d.ts +241 -0
  141. package/es/libro-protocol.d.ts.map +1 -0
  142. package/es/libro-protocol.js +34 -0
  143. package/es/libro-service.d.ts +34 -0
  144. package/es/libro-service.d.ts.map +1 -0
  145. package/es/libro-service.js +180 -0
  146. package/es/libro-view-tracker.d.ts +6 -0
  147. package/es/libro-view-tracker.d.ts.map +1 -0
  148. package/es/libro-view-tracker.js +13 -0
  149. package/es/libro-view.d.ts +151 -0
  150. package/es/libro-view.d.ts.map +1 -0
  151. package/es/libro-view.js +1963 -0
  152. package/es/material-from-designer.d.ts +27 -0
  153. package/es/material-from-designer.d.ts.map +1 -0
  154. package/es/material-from-designer.js +550 -0
  155. package/es/module.d.ts +3 -0
  156. package/es/module.d.ts.map +1 -0
  157. package/es/module.js +55 -0
  158. package/es/output/index.d.ts +6 -0
  159. package/es/output/index.d.ts.map +1 -0
  160. package/es/output/index.js +5 -0
  161. package/es/output/output-area.d.ts +51 -0
  162. package/es/output/output-area.d.ts.map +1 -0
  163. package/es/output/output-area.js +346 -0
  164. package/es/output/output-contribution.d.ts +11 -0
  165. package/es/output/output-contribution.d.ts.map +1 -0
  166. package/es/output/output-contribution.js +31 -0
  167. package/es/output/output-model.d.ts +27 -0
  168. package/es/output/output-model.d.ts.map +1 -0
  169. package/es/output/output-model.js +95 -0
  170. package/es/output/output-module.d.ts +3 -0
  171. package/es/output/output-module.d.ts.map +1 -0
  172. package/es/output/output-module.js +6 -0
  173. package/es/output/output-protocol.d.ts +130 -0
  174. package/es/output/output-protocol.d.ts.map +1 -0
  175. package/es/output/output-protocol.js +18 -0
  176. package/es/slot/index.d.ts +5 -0
  177. package/es/slot/index.d.ts.map +1 -0
  178. package/es/slot/index.js +4 -0
  179. package/es/slot/libro-slot-manager.d.ts +13 -0
  180. package/es/slot/libro-slot-manager.d.ts.map +1 -0
  181. package/es/slot/libro-slot-manager.js +57 -0
  182. package/es/slot/libro-slot-protocol.d.ts +19 -0
  183. package/es/slot/libro-slot-protocol.d.ts.map +1 -0
  184. package/es/slot/libro-slot-protocol.js +5 -0
  185. package/es/slot/libro-slot-view.d.ts +9 -0
  186. package/es/slot/libro-slot-view.d.ts.map +1 -0
  187. package/es/slot/libro-slot-view.js +81 -0
  188. package/es/slot/module.d.ts +3 -0
  189. package/es/slot/module.d.ts.map +1 -0
  190. package/es/slot/module.js +5 -0
  191. package/es/theme/libro-color-registry.d.ts +6 -0
  192. package/es/theme/libro-color-registry.d.ts.map +1 -0
  193. package/es/theme/libro-color-registry.js +494 -0
  194. package/es/toolbar/change-cell-to-selector.d.ts +5 -0
  195. package/es/toolbar/change-cell-to-selector.d.ts.map +1 -0
  196. package/es/toolbar/change-cell-to-selector.js +48 -0
  197. package/es/toolbar/hide-all-selector.d.ts +5 -0
  198. package/es/toolbar/hide-all-selector.d.ts.map +1 -0
  199. package/es/toolbar/hide-all-selector.js +99 -0
  200. package/es/toolbar/index.d.ts +4 -0
  201. package/es/toolbar/index.d.ts.map +1 -0
  202. package/es/toolbar/index.js +3 -0
  203. package/es/toolbar/index.less +59 -0
  204. package/es/toolbar/libro-toolbar-protocol.d.ts +4 -0
  205. package/es/toolbar/libro-toolbar-protocol.d.ts.map +1 -0
  206. package/es/toolbar/libro-toolbar-protocol.js +1 -0
  207. package/es/toolbar/libro-toolbar.d.ts +8 -0
  208. package/es/toolbar/libro-toolbar.d.ts.map +1 -0
  209. package/es/toolbar/libro-toolbar.js +223 -0
  210. package/es/toolbar/module.d.ts +3 -0
  211. package/es/toolbar/module.d.ts.map +1 -0
  212. package/es/toolbar/module.js +5 -0
  213. package/es/toolbar/restart-clear-outputs-contribution.d.ts +5 -0
  214. package/es/toolbar/restart-clear-outputs-contribution.d.ts.map +1 -0
  215. package/es/toolbar/restart-clear-outputs-contribution.js +23 -0
  216. package/es/toolbar/restart-clear-outputs-modal.d.ts +6 -0
  217. package/es/toolbar/restart-clear-outputs-modal.d.ts.map +1 -0
  218. package/es/toolbar/restart-clear-outputs-modal.js +30 -0
  219. package/es/toolbar/save-icon.d.ts +3 -0
  220. package/es/toolbar/save-icon.d.ts.map +1 -0
  221. package/es/toolbar/save-icon.js +54 -0
  222. package/es/toolbar/shutdown-contribution.d.ts +5 -0
  223. package/es/toolbar/shutdown-contribution.d.ts.map +1 -0
  224. package/es/toolbar/shutdown-contribution.js +23 -0
  225. package/es/toolbar/shutdown-modal.d.ts +6 -0
  226. package/es/toolbar/shutdown-modal.d.ts.map +1 -0
  227. package/es/toolbar/shutdown-modal.js +30 -0
  228. package/es/toolbar/side-toolar-more-select.d.ts +4 -0
  229. package/es/toolbar/side-toolar-more-select.d.ts.map +1 -0
  230. package/es/toolbar/side-toolar-more-select.js +161 -0
  231. package/es/typings/index.d.ts +1 -0
  232. package/package.json +70 -0
  233. package/src/add-cell/index.less +38 -0
  234. package/src/add-cell/index.ts +3 -0
  235. package/src/add-cell/libro-add-cell-module.ts +9 -0
  236. package/src/add-cell/libro-add-cell-slot-contribution.ts +31 -0
  237. package/src/add-cell/libro-add-cell-view.tsx +101 -0
  238. package/src/cell/README.md +14 -0
  239. package/src/cell/index.ts +9 -0
  240. package/src/cell/libro-cell-contribution.ts +38 -0
  241. package/src/cell/libro-cell-model.ts +61 -0
  242. package/src/cell/libro-cell-module.ts +40 -0
  243. package/src/cell/libro-cell-protocol.ts +53 -0
  244. package/src/cell/libro-cell-service.ts +157 -0
  245. package/src/cell/libro-cell-view.tsx +128 -0
  246. package/src/cell/libro-edit-cell-view.tsx +60 -0
  247. package/src/cell/libro-executable-cell-model.ts +32 -0
  248. package/src/cell/libro-executable-cell-view.ts +74 -0
  249. package/src/cell/libro-markdown-cell-model.ts +20 -0
  250. package/src/collapse-service.ts +69 -0
  251. package/src/command/document-commands.ts +18 -0
  252. package/src/command/index.ts +6 -0
  253. package/src/command/kernel-command.ts +41 -0
  254. package/src/command/libro-command-contribution.ts +1339 -0
  255. package/src/command/libro-command-register.ts +171 -0
  256. package/src/command/module.ts +9 -0
  257. package/src/command/notebook-commands.ts +498 -0
  258. package/src/components/cell-protocol.ts +22 -0
  259. package/src/components/dnd-cell-item-render.tsx +308 -0
  260. package/src/components/dnd-component/custom-drag-layer.tsx +145 -0
  261. package/src/components/dnd-component/default-dnd-content.tsx +275 -0
  262. package/src/components/dnd-component/dnd-context.tsx +28 -0
  263. package/src/components/dnd-component/dnd-list.tsx +116 -0
  264. package/src/components/dnd-component/index.tsx +4 -0
  265. package/src/components/index.ts +5 -0
  266. package/src/components/libro-component.tsx +30 -0
  267. package/src/components/libro-side-toolbar-menu.tsx +82 -0
  268. package/src/components/libro-view-header.tsx +33 -0
  269. package/src/configuration/libro-configuration-contribution.ts +29 -0
  270. package/src/configuration/libro-configuration.ts +88 -0
  271. package/src/content/index.ts +4 -0
  272. package/src/content/libro-content-contribution.ts +17 -0
  273. package/src/content/libro-content-module.ts +9 -0
  274. package/src/content/libro-content-protocol.ts +8 -0
  275. package/src/content/libro-content-service.ts +30 -0
  276. package/src/index.less +682 -0
  277. package/src/index.tsx +19 -0
  278. package/src/libro-context-key.ts +80 -0
  279. package/src/libro-keybind-registry.ts +43 -0
  280. package/src/libro-model.ts +614 -0
  281. package/src/libro-protocol.ts +322 -0
  282. package/src/libro-service.ts +121 -0
  283. package/src/libro-view-tracker.ts +9 -0
  284. package/src/libro-view.tsx +1399 -0
  285. package/src/material-from-designer.tsx +457 -0
  286. package/src/module.ts +90 -0
  287. package/src/output/index.ts +5 -0
  288. package/src/output/output-area.tsx +255 -0
  289. package/src/output/output-contribution.ts +18 -0
  290. package/src/output/output-model.tsx +66 -0
  291. package/src/output/output-module.ts +10 -0
  292. package/src/output/output-protocol.ts +164 -0
  293. package/src/slot/index.ts +4 -0
  294. package/src/slot/libro-slot-manager.ts +37 -0
  295. package/src/slot/libro-slot-protocol.ts +28 -0
  296. package/src/slot/libro-slot-view.tsx +51 -0
  297. package/src/slot/module.ts +9 -0
  298. package/src/theme/libro-color-registry.ts +371 -0
  299. package/src/toolbar/change-cell-to-selector.tsx +58 -0
  300. package/src/toolbar/hide-all-selector.tsx +126 -0
  301. package/src/toolbar/index.less +59 -0
  302. package/src/toolbar/index.ts +3 -0
  303. package/src/toolbar/libro-toolbar-protocol.ts +4 -0
  304. package/src/toolbar/libro-toolbar.tsx +192 -0
  305. package/src/toolbar/module.ts +11 -0
  306. package/src/toolbar/restart-clear-outputs-contribution.tsx +10 -0
  307. package/src/toolbar/restart-clear-outputs-modal.tsx +37 -0
  308. package/src/toolbar/save-icon.tsx +47 -0
  309. package/src/toolbar/shutdown-contribution.tsx +10 -0
  310. package/src/toolbar/shutdown-modal.tsx +37 -0
  311. package/src/toolbar/side-toolar-more-select.tsx +172 -0
  312. package/src/typings/index.d.ts +1 -0
@@ -0,0 +1,257 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ 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; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
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(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ import { useConfigurationValue } from '@difizen/mana-app';
14
+ import { getOrigin, useInject, ViewInstance } from '@difizen/mana-app';
15
+ import React, { useEffect, useRef, useState, useCallback, forwardRef } from 'react';
16
+ import { useDrag, useDragDropManager, useDrop } from 'react-dnd';
17
+ import { getEmptyImage } from 'react-dnd-html5-backend';
18
+ import { CellService } from "../../cell/index.js";
19
+ import { CellCollapsible } from "../../collapse-service.js";
20
+ import { isCellView, DragAreaKey } from "../../libro-protocol.js";
21
+ import { MultiSelectionWhenShiftClick } from "../../configuration/libro-configuration.js";
22
+ import { HolderOutlined, PlusOutlined } from "../../material-from-designer.js";
23
+ import { hasErrorOutput } from "../../output/index.js";
24
+ import { BetweenCellProvider } from "../cell-protocol.js";
25
+ import { jsx as _jsx } from "react/jsx-runtime";
26
+ import { jsxs as _jsxs } from "react/jsx-runtime";
27
+ export var DefaultDndContent = function DefaultDndContent(_ref) {
28
+ var _instance$container, _instance$container$c;
29
+ var cell = _ref.cell,
30
+ index = _ref.index;
31
+ var ref = useRef(null);
32
+ var instance = useInject(ViewInstance);
33
+ var _useConfigurationValu = useConfigurationValue(MultiSelectionWhenShiftClick),
34
+ _useConfigurationValu2 = _slicedToArray(_useConfigurationValu, 1),
35
+ multiSelectionWhenShiftClick = _useConfigurationValu2[0];
36
+ var BetweenCellContent = useInject(BetweenCellProvider);
37
+ var cellService = useInject(CellService);
38
+ var dragDropManager = useDragDropManager();
39
+ var dragDropMonitor = dragDropManager.getMonitor();
40
+ var ItemRender = getOrigin(instance.dndItemRender);
41
+ var handleFocus = useCallback(function (e) {
42
+ var className = e.target.className;
43
+ if (e.target.tagName === 'svg' || className && className && typeof className === 'string' && (className.includes('mana-toolbar-item') || className.includes('mana-toolbar'))) {
44
+ return;
45
+ }
46
+ instance.model.selectCell(cell);
47
+ instance.model.selections = [];
48
+ if (cell.shouldEnterEditorMode(e)) {
49
+ instance.enterEditMode();
50
+ }
51
+ }, [instance, cell]);
52
+ var handleMouseDown = useCallback(function (e) {
53
+ if (e.shiftKey && multiSelectionWhenShiftClick) {
54
+ //按shift键时为多选cell
55
+ instance.extendContiguousSelectionTo(index);
56
+ instance.model.mouseMode = 'multipleSelection';
57
+ return;
58
+ }
59
+ instance.model.mouseMode = 'mouseDown';
60
+ }, [multiSelectionWhenShiftClick, instance, index]);
61
+ var handleMouseUp = useCallback(function () {
62
+ if (instance.model.mouseMode === 'multipleSelection' || instance.model.mouseMode === 'drag') {
63
+ return;
64
+ }
65
+ instance.model.selectCell(cell);
66
+ instance.model.selections = [];
67
+ }, [instance, cell]);
68
+ var _useDrag = useDrag({
69
+ type: DragAreaKey,
70
+ item: {
71
+ cell: cell,
72
+ index: index
73
+ },
74
+ collect: function collect(monitor) {
75
+ return {
76
+ isDrag: monitor.isDragging()
77
+ };
78
+ },
79
+ end: function end() {
80
+ instance.isDragging = false;
81
+ }
82
+ }, [cell, index]),
83
+ _useDrag2 = _slicedToArray(_useDrag, 3),
84
+ isDrag = _useDrag2[0].isDrag,
85
+ drag = _useDrag2[1],
86
+ preview = _useDrag2[2];
87
+ dragDropMonitor.subscribeToStateChange(function () {
88
+ instance.isDragging = dragDropMonitor.isDragging();
89
+ });
90
+ var libroViewContent = (_instance$container = instance.container) === null || _instance$container === void 0 ? void 0 : (_instance$container$c = _instance$container.current) === null || _instance$container$c === void 0 ? void 0 : _instance$container$c.getElementsByClassName('libro-view-content')[0];
91
+ var scrollTimer = useRef(null);
92
+ useEffect(function () {
93
+ scrollTimer.current = setInterval(function () {
94
+ var currentOffset = dragDropMonitor.getClientOffset();
95
+ if (libroViewContent && instance.isDragging && currentOffset) {
96
+ var libroViewClientRect = libroViewContent.getBoundingClientRect();
97
+ var top = libroViewClientRect.top,
98
+ bottom = libroViewClientRect.bottom;
99
+ var y = currentOffset.y;
100
+ var topLimit = top + 30;
101
+ var bottomLimit = bottom - 50;
102
+ if (y < topLimit) {
103
+ libroViewContent.scrollTop -= 0.5;
104
+ } else if (y > bottomLimit) {
105
+ libroViewContent.scrollTop += 0.5;
106
+ }
107
+ }
108
+ }, 10);
109
+ return function () {
110
+ if (scrollTimer.current) {
111
+ clearInterval(scrollTimer.current);
112
+ }
113
+ };
114
+ // eslint-disable-next-line react-hooks/exhaustive-deps
115
+ }, []);
116
+ useEffect(function () {
117
+ // This gets called after every render, by default
118
+ // (the first one, and every one after that)
119
+
120
+ // Use empty image as a drag preview so browsers don't draw it
121
+ // and we can draw whatever we want on the custom drag layer instead.
122
+ preview(getEmptyImage(), {
123
+ // IE fallback: specify that we'd rather screenshot the node
124
+ // when it already knows it's being dragged so we can hide it with CSS.
125
+ captureDraggingState: true
126
+ });
127
+ }, [preview]);
128
+ var _useDrop = useDrop({
129
+ accept: DragAreaKey,
130
+ drop: function drop(item, monitor) {
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 () {
138
+ //
139
+ });
140
+ if (isCellView(item.cell)) {
141
+ var didDrop = monitor.didDrop();
142
+ if (didDrop) {
143
+ return;
144
+ }
145
+ var dragIndex = instance.findCellIndex(item.cell);
146
+ var dropIndex = instance.findCellIndex(cell);
147
+ if (instance.model.selections.length > 0) {
148
+ var isDragInSelections = instance.model.selections.findIndex(function (selection) {
149
+ return selection.id === item.cell.id;
150
+ }) > -1 ? true : false;
151
+ var isDropInSelections = instance.model.selections.findIndex(function (selection) {
152
+ return selection.id === cell.id;
153
+ }) > -1 ? true : false;
154
+ if (isDragInSelections && isDropInSelections) {
155
+ return;
156
+ }
157
+ if (isDragInSelections) {
158
+ instance.model.exchangeCells(instance.model.selections, dropIndex);
159
+ instance.model.scrollToView(cell);
160
+ return;
161
+ }
162
+ }
163
+ if (dragIndex < dropIndex) {
164
+ instance.model.exchangeCell(dragIndex, dropIndex - 1);
165
+ instance.model.scrollToView(cell);
166
+ }
167
+ if (dragIndex > dropIndex) {
168
+ instance.model.exchangeCell(dragIndex, dropIndex);
169
+ instance.model.scrollToView(cell);
170
+ }
171
+ }
172
+ return;
173
+ },
174
+ collect: function collect(monitor) {
175
+ return {
176
+ isDragOver: monitor.isOver(),
177
+ canDrop: monitor.canDrop(),
178
+ handlerId: monitor.getHandlerId()
179
+ };
180
+ }
181
+ }),
182
+ _useDrop2 = _slicedToArray(_useDrop, 2),
183
+ _useDrop2$ = _useDrop2[0],
184
+ handlerId = _useDrop2$.handlerId,
185
+ isDragOver = _useDrop2$.isDragOver,
186
+ drop = _useDrop2[1];
187
+ var opacity = isDrag ? 0.4 : 1;
188
+ if (!instance.model.readOnly) {
189
+ drop(ref);
190
+ }
191
+ if (isDrag) {
192
+ instance.model.mouseMode = 'drag';
193
+ }
194
+ var isSelected = instance.isSelected(cell);
195
+ // let isMouseOver = false;
196
+ var _useState = useState(false),
197
+ _useState2 = _slicedToArray(_useState, 2),
198
+ isMouseOverDragArea = _useState2[0],
199
+ setIsMouseOverDragArea = _useState2[1];
200
+ var hasCellHidden = cell.hasCellHidden();
201
+ var hasErrorOutputs = hasErrorOutput(cell);
202
+ var isCollapsible = CellCollapsible.is(cell);
203
+ return /*#__PURE__*/_jsxs("div", {
204
+ className: "libro-dnd-cell-container ".concat(isSelected ? 'selected' : '', " ").concat(hasCellHidden ? 'hidden' : ''),
205
+ "data-handler-id": handlerId,
206
+ style: {
207
+ opacity: opacity
208
+ },
209
+ ref: ref,
210
+ id: cell.id,
211
+ children: [/*#__PURE__*/_jsx(BetweenCellContent, {
212
+ index: index,
213
+ addCell: cell.parent.addCellAbove
214
+ }), isDragOver && /*#__PURE__*/_jsx("div", {
215
+ className: "libro-drag-hoverline"
216
+ }), isMouseOverDragArea && /*#__PURE__*/_jsx(HolderOutlined, {
217
+ className: "libro-handle-style"
218
+ }), /*#__PURE__*/_jsx("div", {
219
+ className: "libro-drag-area",
220
+ ref: drag,
221
+ onMouseDown: handleMouseDown,
222
+ onMouseUp: handleMouseUp,
223
+ onMouseOver: function onMouseOver() {
224
+ return setIsMouseOverDragArea(true);
225
+ },
226
+ onMouseLeave: function onMouseLeave() {
227
+ return setIsMouseOverDragArea(false);
228
+ }
229
+ }), /*#__PURE__*/_jsx("div", {
230
+ tabIndex: -1,
231
+ onFocus: handleFocus
232
+ // onClick={e => e.preventDefault()}
233
+ ,
234
+ className: "libro-dnd-cell-content ".concat(hasErrorOutputs ? 'error' : ''),
235
+ children: /*#__PURE__*/_jsx(ItemRender, {
236
+ isDragOver: !!isDragOver,
237
+ isDrag: !!isDrag,
238
+ cell: cell,
239
+ isMouseOverDragArea: isMouseOverDragArea
240
+ })
241
+ }), isCollapsible && cell.headingCollapsed && cell.collapsibleChildNumber > 0 && /*#__PURE__*/_jsx("div", {
242
+ className: "libro-cell-collapsed-expander",
243
+ children: /*#__PURE__*/_jsxs("button", {
244
+ className: "libro-cell-expand-button",
245
+ onClick: function onClick() {
246
+ return instance.collapseCell(cell, false);
247
+ },
248
+ children: [/*#__PURE__*/_jsx(PlusOutlined, {
249
+ className: ""
250
+ }), " ", cell.collapsibleChildNumber, " cell hidden"]
251
+ })
252
+ })]
253
+ });
254
+ };
255
+ export var LibroBetweenCellContent = /*#__PURE__*/forwardRef(function LibroBetweenCellContent() {
256
+ return null;
257
+ });
@@ -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 { ViewInstance } from '@difizen/mana-app';
2
+ import { getOrigin, useInject } 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,10 @@
1
+ /// <reference types="react" resolution-mode="require"/>
2
+ import type { LibroView } from '../../libro-view.js';
3
+ export declare const DndCellContent: import("react").ForwardRefExoticComponent<{
4
+ libroView: LibroView;
5
+ } & import("react").RefAttributes<HTMLDivElement>>;
6
+ export declare const DndList: import("react").ForwardRefExoticComponent<{
7
+ libroView: LibroView;
8
+ children: any;
9
+ } & import("react").RefAttributes<HTMLDivElement>>;
10
+ //# 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":";AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAcrD,eAAO,MAAM,cAAc;eAA2C,SAAS;kDAqB9E,CAAC;AAEF,eAAO,MAAM,OAAO;eAEL,SAAS;cAAY,GAAG;kDAkErC,CAAC"}
@@ -0,0 +1,115 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ var _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(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
8
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
13
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
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 { forwardRef, memo } from 'react';
18
+ import { useDrop } from 'react-dnd';
19
+ import { LibroCellService } from "../../cell/index.js";
20
+ import { DragAreaKey, isCellView } from "../../libro-protocol.js";
21
+ import { jsx as _jsx } from "react/jsx-runtime";
22
+ import { jsxs as _jsxs } from "react/jsx-runtime";
23
+ var DndContent = function DndContent(_ref) {
24
+ var cell = _ref.cell,
25
+ index = _ref.index,
26
+ props = _objectWithoutProperties(_ref, _excluded);
27
+ var observableCell = useObserve(cell);
28
+ var instance = useInject(ViewInstance);
29
+ var DndContentRender = instance.dndContentRender;
30
+ return /*#__PURE__*/_jsx(DndContentRender, _objectSpread({
31
+ cell: observableCell,
32
+ index: index
33
+ }, props), cell.id);
34
+ };
35
+ var DndContentMemo = /*#__PURE__*/memo(DndContent);
36
+ export var DndCellContent = /*#__PURE__*/forwardRef(function DndCellContent(_ref2, ref) {
37
+ var libroView = _ref2.libroView;
38
+ var LoadingRender = getOrigin(libroView.loadingRender);
39
+ var cells = libroView.model.getCells().reduce(function (a, b) {
40
+ if (a.indexOf(b) < 0) {
41
+ a.push(b);
42
+ }
43
+ return a;
44
+ }, []);
45
+ return /*#__PURE__*/_jsxs("div", {
46
+ className: "libro-dnd-cells-container",
47
+ ref: ref,
48
+ children: [!libroView.model.isInitialized && /*#__PURE__*/_jsx(LoadingRender, {}), libroView.model.isInitialized && cells.filter(function (cell) {
49
+ return cell.collapsedHidden === false;
50
+ }).map(function (cell, index) {
51
+ return /*#__PURE__*/_jsx(DndContentMemo, {
52
+ cell: cell,
53
+ index: index
54
+ }, cell.id);
55
+ })]
56
+ });
57
+ });
58
+ export var DndList = /*#__PURE__*/forwardRef(function DndList(_ref3) {
59
+ var libroView = _ref3.libroView,
60
+ children = _ref3.children;
61
+ var cellService = useInject(LibroCellService);
62
+ var _useDrop = useDrop(function () {
63
+ return {
64
+ accept: DragAreaKey,
65
+ drop: function drop(item, dropMonitor) {
66
+ cellService.getOrCreateView(_objectSpread(_objectSpread({}, item.cell.model.options), {}, {
67
+ modelId: item.cell.model.id,
68
+ singleSelectionDragPreview: true
69
+ }), item.cell.parent.id).then(function (view) {
70
+ return view.dispose();
71
+ }).catch(function () {
72
+ //
73
+ });
74
+ if (isCellView(item.cell)) {
75
+ var _lastCell$container, _lastCell$container$c;
76
+ var didDrop = dropMonitor.didDrop();
77
+ if (didDrop) {
78
+ return;
79
+ }
80
+ // Determine mouse position
81
+ var clientOffset = dropMonitor.getClientOffset();
82
+ var clientOffsetY = clientOffset.y;
83
+ var dragIndex = libroView.findCellIndex(item.cell);
84
+ // Determine rectangle on screen
85
+ var lastCell = libroView.model.getCells()[libroView.model.getCells().length - 1];
86
+ var lastCellOffsetY = (_lastCell$container = lastCell.container) === null || _lastCell$container === void 0 ? void 0 : (_lastCell$container$c = _lastCell$container.current) === null || _lastCell$container$c === void 0 ? void 0 : _lastCell$container$c.getBoundingClientRect().y;
87
+ if (lastCellOffsetY && clientOffsetY >= lastCellOffsetY) {
88
+ if (libroView.model.selections.length > 0) {
89
+ var isDragInSelections = libroView.model.selections.findIndex(function (selection) {
90
+ return selection.id === item.cell.id;
91
+ }) > -1 ? true : false;
92
+ if (isDragInSelections) {
93
+ libroView.model.exchangeCells(libroView.model.selections, libroView.model.cells.length);
94
+ return;
95
+ }
96
+ }
97
+ libroView.model.exchangeCell(dragIndex, libroView.model.cells.length - 1);
98
+ }
99
+ }
100
+ // Determine mouse position
101
+
102
+ return;
103
+ }
104
+ };
105
+ }),
106
+ _useDrop2 = _slicedToArray(_useDrop, 2),
107
+ drop = _useDrop2[1];
108
+ return /*#__PURE__*/_jsxs("div", {
109
+ className: "libro-dnd-list-container",
110
+ ref: drop,
111
+ children: [/*#__PURE__*/_jsx(DndCellContent, {
112
+ libroView: libroView
113
+ }), children]
114
+ });
115
+ });
@@ -0,0 +1,5 @@
1
+ export * from './default-dnd-content.js';
2
+ export * from './dnd-context.js';
3
+ export * from './dnd-list.js';
4
+ export * from './custom-drag-layer.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,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./default-dnd-content.js";
2
+ export * from "./dnd-context.js";
3
+ export * from "./dnd-list.js";
4
+ export * from "./custom-drag-layer.js";
@@ -0,0 +1,6 @@
1
+ export * from './libro-component.js';
2
+ export * from './dnd-component/index.js';
3
+ export * from './cell-protocol.js';
4
+ export * from './dnd-cell-item-render.js';
5
+ export * from './libro-side-toolbar-menu.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from "./libro-component.js";
2
+ export * from "./dnd-component/index.js";
3
+ export * from "./cell-protocol.js";
4
+ export * from "./dnd-cell-item-render.js";
5
+ export * from "./libro-side-toolbar-menu.js";
@@ -0,0 +1,5 @@
1
+ import type { NotebookOption } from '../libro-protocol.js';
2
+ export declare function LibroComponent(props: {
3
+ options: NotebookOption;
4
+ }): import("react/jsx-runtime").JSX.Element | null;
5
+ //# sourceMappingURL=libro-component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"libro-component.d.ts","sourceRoot":"","sources":["../../src/components/libro-component.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAgB,MAAM,sBAAsB,CAAC;AAGzE,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,OAAO,EAAE,cAAc,CAAA;CAAE,kDAsBhE"}
@@ -0,0 +1,35 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ 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."); }
3
+ 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); }
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
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { ViewRender } from '@difizen/mana-app';
8
+ import { useInject } from '@difizen/mana-app';
9
+ import { useEffect, useState } from 'react';
10
+ import { LibroService } from "../libro-service.js";
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ export function LibroComponent(props) {
13
+ var libroService = useInject(LibroService);
14
+ var _useState = useState(undefined),
15
+ _useState2 = _slicedToArray(_useState, 2),
16
+ libroView = _useState2[0],
17
+ setLibroView = _useState2[1];
18
+ useEffect(function () {
19
+ libroService.getOrCreateView(props.options).then(function (view) {
20
+ if (!view) {
21
+ return;
22
+ }
23
+ setLibroView(view);
24
+ return;
25
+ }).catch(function () {
26
+ //
27
+ });
28
+ }, [props.options, libroService]);
29
+ if (!libroView || !libroView.view) {
30
+ return null;
31
+ }
32
+ return /*#__PURE__*/_jsx(ViewRender, {
33
+ view: libroView
34
+ });
35
+ }
@@ -0,0 +1,21 @@
1
+ import type { ReactNode } from 'react';
2
+ export type LibroSideToolbarMenuItemType = {
3
+ id: string;
4
+ label: ReactNode;
5
+ /**
6
+ * When extra, group means that the item will be located in a submenu(s) of the `...` dropdown.
7
+ * The submenu's title is named by the name in group, e.g. ['menu', 'submenu'].
8
+ */
9
+ readonly group?: string | string[];
10
+ disabled?: boolean;
11
+ };
12
+ interface LibroSideToolbarMenuInlinesProps {
13
+ items: LibroSideToolbarMenuItemType[];
14
+ }
15
+ export declare const LibroSideToolbarMenuInlines: React.FC<LibroSideToolbarMenuInlinesProps>;
16
+ interface LibroSideToolbarMenuProps {
17
+ items: LibroSideToolbarMenuItemType[];
18
+ }
19
+ export declare const LibroSideToolbarMenu: React.FC<LibroSideToolbarMenuProps>;
20
+ export {};
21
+ //# sourceMappingURL=libro-side-toolbar-menu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"libro-side-toolbar-menu.d.ts","sourceRoot":"","sources":["../../src/components/libro-side-toolbar-menu.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,MAAM,MAAM,4BAA4B,GAAG;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,UAAU,gCAAgC;IACxC,KAAK,EAAE,4BAA4B,EAAE,CAAC;CACvC;AAED,eAAO,MAAM,2BAA2B,EAAE,KAAK,CAAC,EAAE,CAChD,gCAAgC,CAwCjC,CAAC;AAEF,UAAU,yBAAyB;IACjC,KAAK,EAAE,4BAA4B,EAAE,CAAC;CACvC;AACD,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAQpE,CAAC"}
@@ -0,0 +1,58 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ 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); }
4
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
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';
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ export var LibroSideToolbarMenuInlines = function LibroSideToolbarMenuInlines(_ref) {
12
+ var items = _ref.items;
13
+ var command = useInject(CommandRegistry);
14
+ var toolbar = useInject(ToolbarInstance);
15
+ var data = toolbar.currentArgs;
16
+ var args = getOrigin(data) || [];
17
+ if (!items.length) {
18
+ return null;
19
+ }
20
+ var nodes = [];
21
+ var group = undefined;
22
+ var baseCls = 'mana-menu';
23
+ var contextValue = {
24
+ prefixCls: baseCls
25
+ };
26
+ items.forEach(function (item) {
27
+ var itemGroup = item.group;
28
+ if (itemGroup) {
29
+ itemGroup = typeof itemGroup === 'string' ? itemGroup : itemGroup[0];
30
+ }
31
+ if (nodes.length && itemGroup !== group) {
32
+ nodes.push(itemGroup && /*#__PURE__*/_jsx(Menu.Divider, {}, "".concat(item.id, "-divider")));
33
+ }
34
+ group = itemGroup;
35
+ nodes.push( /*#__PURE__*/_jsx(Menu.Item, {
36
+ onClick: function onClick() {
37
+ command.executeCommand.apply(command, [item.id].concat(_toConsumableArray(args)));
38
+ },
39
+ children: item.label
40
+ }, item.id));
41
+ });
42
+ return /*#__PURE__*/_jsx("div", {
43
+ className: "libro-toolbar-menu-inlines",
44
+ children: /*#__PURE__*/_jsxs(MenuContext.Provider, {
45
+ value: contextValue,
46
+ children: [nodes, " "]
47
+ })
48
+ });
49
+ };
50
+ export var LibroSideToolbarMenu = function LibroSideToolbarMenu(_ref2) {
51
+ var items = _ref2.items;
52
+ return /*#__PURE__*/_jsx("div", {
53
+ className: "libro-side-toolbar-menu",
54
+ children: /*#__PURE__*/_jsx(LibroSideToolbarMenuInlines, {
55
+ items: items
56
+ })
57
+ });
58
+ };
@@ -0,0 +1,3 @@
1
+ import type { FC } from 'react';
2
+ export declare const LibroViewHeader: FC;
3
+ //# sourceMappingURL=libro-view-header.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"libro-view-header.d.ts","sourceRoot":"","sources":["../../src/components/libro-view-header.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAMhC,eAAO,MAAM,eAAe,EAAE,EAwB7B,CAAC"}
@@ -0,0 +1,37 @@
1
+ /* eslint-disable react-hooks/exhaustive-deps */
2
+ import { ToolbarRender, useInject, ViewInstance } from '@difizen/mana-app';
3
+ import { useMemo } from 'react';
4
+ import { LibroToolbarArea } from "../libro-protocol.js";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { Fragment as _Fragment } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
+ export var LibroViewHeader = function LibroViewHeader() {
9
+ var instance = useInject(ViewInstance);
10
+ var headerLeftArgs = useMemo(function () {
11
+ return [instance.model.active, instance, LibroToolbarArea.HeaderLeft];
12
+ }, [instance.model.active, instance]);
13
+ var headerCenterArgs = useMemo(function () {
14
+ return [instance.model.active, instance, LibroToolbarArea.HeaderCenter];
15
+ }, [instance.model.active, instance]);
16
+ var headerRightArgs = useMemo(function () {
17
+ return [instance.model.active, instance, LibroToolbarArea.HeaderRight];
18
+ }, [instance.model.active, instance]);
19
+ return /*#__PURE__*/_jsxs(_Fragment, {
20
+ children: [/*#__PURE__*/_jsx("div", {
21
+ className: "libro-header-left",
22
+ children: /*#__PURE__*/_jsx(ToolbarRender, {
23
+ data: headerLeftArgs
24
+ })
25
+ }), /*#__PURE__*/_jsx("div", {
26
+ className: "libro-header-center",
27
+ children: /*#__PURE__*/_jsx(ToolbarRender, {
28
+ data: headerCenterArgs
29
+ })
30
+ }), /*#__PURE__*/_jsx("div", {
31
+ className: "libro-header-right",
32
+ children: /*#__PURE__*/_jsx(ToolbarRender, {
33
+ data: headerRightArgs
34
+ })
35
+ })]
36
+ });
37
+ };
@@ -0,0 +1,5 @@
1
+ import { ConfigurationContribution } from '@difizen/mana-app';
2
+ export declare class LibroConfigurationContribution implements ConfigurationContribution {
3
+ registerConfigurations(): import("@difizen/mana-app").ConfigurationNode<boolean>[];
4
+ }
5
+ //# sourceMappingURL=libro-configuration-contribution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"libro-configuration-contribution.d.ts","sourceRoot":"","sources":["../../src/configuration/libro-configuration-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAc9D,qBACa,8BAA+B,YAAW,yBAAyB;IAC9E,sBAAsB;CAYvB"}