logisheets 0.6.0 → 0.7.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 (346) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +1 -0
  3. package/dist/src/api/index.d.ts +2 -0
  4. package/dist/src/api/index.js +2 -0
  5. package/dist/src/api/utils.d.ts +3 -0
  6. package/dist/src/api/utils.js +4 -0
  7. package/dist/src/api/workbook.d.ts +18 -0
  8. package/dist/src/api/workbook.js +87 -0
  9. package/dist/src/api/worksheet.d.ts +16 -0
  10. package/dist/src/api/worksheet.js +33 -0
  11. package/dist/src/bindings/action_effect.d.ts +7 -0
  12. package/dist/src/bindings/action_effect.js +1 -0
  13. package/dist/src/bindings/async_func_result.d.ts +5 -0
  14. package/dist/src/bindings/async_func_result.js +1 -0
  15. package/dist/src/bindings/block_cell_id.d.ts +5 -0
  16. package/dist/src/bindings/block_cell_id.js +2 -0
  17. package/dist/src/bindings/block_info.d.ts +7 -0
  18. package/dist/src/bindings/block_info.js +2 -0
  19. package/dist/src/bindings/block_input.d.ts +7 -0
  20. package/dist/src/bindings/block_input.js +2 -0
  21. package/dist/src/bindings/block_style_update.d.ts +8 -0
  22. package/dist/src/bindings/block_style_update.js +1 -0
  23. package/dist/src/bindings/border.d.ts +13 -0
  24. package/dist/src/bindings/border.js +1 -0
  25. package/dist/src/bindings/border_pr.d.ts +6 -0
  26. package/dist/src/bindings/border_pr.js +1 -0
  27. package/dist/src/bindings/cell_alignment.d.ts +13 -0
  28. package/dist/src/bindings/cell_alignment.js +1 -0
  29. package/dist/src/bindings/cell_formula_value.d.ts +7 -0
  30. package/dist/src/bindings/cell_formula_value.js +1 -0
  31. package/dist/src/bindings/cell_id.d.ts +7 -0
  32. package/dist/src/bindings/cell_id.js +1 -0
  33. package/dist/src/bindings/cell_info.d.ts +7 -0
  34. package/dist/src/bindings/cell_info.js +1 -0
  35. package/dist/src/bindings/cell_input.d.ts +6 -0
  36. package/dist/src/bindings/cell_input.js +2 -0
  37. package/dist/src/bindings/cell_protection.d.ts +4 -0
  38. package/dist/src/bindings/cell_protection.js +2 -0
  39. package/dist/src/bindings/cell_style.d.ts +6 -0
  40. package/dist/src/bindings/cell_style.js +1 -0
  41. package/dist/src/bindings/col_info.d.ts +5 -0
  42. package/dist/src/bindings/col_info.js +2 -0
  43. package/dist/src/bindings/color.d.ts +6 -0
  44. package/dist/src/bindings/color.js +2 -0
  45. package/dist/src/bindings/comment.d.ts +6 -0
  46. package/dist/src/bindings/comment.js +2 -0
  47. package/dist/src/bindings/create_block.d.ts +8 -0
  48. package/dist/src/bindings/create_block.js +2 -0
  49. package/dist/src/bindings/create_sheet.d.ts +4 -0
  50. package/dist/src/bindings/create_sheet.js +2 -0
  51. package/dist/src/bindings/delete_cols.d.ts +5 -0
  52. package/dist/src/bindings/delete_cols.js +2 -0
  53. package/dist/src/bindings/delete_cols_in_block.d.ts +6 -0
  54. package/dist/src/bindings/delete_cols_in_block.js +2 -0
  55. package/dist/src/bindings/delete_rows.d.ts +5 -0
  56. package/dist/src/bindings/delete_rows.js +2 -0
  57. package/dist/src/bindings/delete_rows_in_block.d.ts +6 -0
  58. package/dist/src/bindings/delete_rows_in_block.js +2 -0
  59. package/dist/src/bindings/delete_sheet.d.ts +3 -0
  60. package/dist/src/bindings/delete_sheet.js +2 -0
  61. package/dist/src/bindings/display_patch.d.ts +25 -0
  62. package/dist/src/bindings/display_patch.js +1 -0
  63. package/dist/src/bindings/display_request.d.ts +4 -0
  64. package/dist/src/bindings/display_request.js +2 -0
  65. package/dist/src/bindings/display_response.d.ts +5 -0
  66. package/dist/src/bindings/display_response.js +1 -0
  67. package/dist/src/bindings/edit_action.d.ts +7 -0
  68. package/dist/src/bindings/edit_action.js +1 -0
  69. package/dist/src/bindings/edit_payload.d.ts +64 -0
  70. package/dist/src/bindings/edit_payload.js +1 -0
  71. package/dist/src/bindings/error_message.d.ts +4 -0
  72. package/dist/src/bindings/error_message.js +2 -0
  73. package/dist/src/bindings/fill.d.ts +7 -0
  74. package/dist/src/bindings/fill.js +1 -0
  75. package/dist/src/bindings/font.d.ts +23 -0
  76. package/dist/src/bindings/font.js +1 -0
  77. package/dist/src/bindings/font_family.d.ts +3 -0
  78. package/dist/src/bindings/font_family.js +2 -0
  79. package/dist/src/bindings/font_name.d.ts +3 -0
  80. package/dist/src/bindings/font_name.js +2 -0
  81. package/dist/src/bindings/font_scheme.d.ts +4 -0
  82. package/dist/src/bindings/font_scheme.js +1 -0
  83. package/dist/src/bindings/gradient_fill.d.ts +11 -0
  84. package/dist/src/bindings/gradient_fill.js +1 -0
  85. package/dist/src/bindings/gradient_stop.d.ts +5 -0
  86. package/dist/src/bindings/gradient_stop.js +1 -0
  87. package/dist/src/bindings/index.d.ts +86 -0
  88. package/dist/src/bindings/index.js +87 -0
  89. package/dist/src/bindings/insert_cols.d.ts +5 -0
  90. package/dist/src/bindings/insert_cols.js +2 -0
  91. package/dist/src/bindings/insert_cols_in_block.d.ts +6 -0
  92. package/dist/src/bindings/insert_cols_in_block.js +2 -0
  93. package/dist/src/bindings/insert_rows.d.ts +5 -0
  94. package/dist/src/bindings/insert_rows.js +2 -0
  95. package/dist/src/bindings/insert_rows_in_block.d.ts +6 -0
  96. package/dist/src/bindings/insert_rows_in_block.js +2 -0
  97. package/dist/src/bindings/merge_cell.d.ts +6 -0
  98. package/dist/src/bindings/merge_cell.js +2 -0
  99. package/dist/src/bindings/move_block.d.ts +6 -0
  100. package/dist/src/bindings/move_block.js +2 -0
  101. package/dist/src/bindings/msg_edit.d.ts +7 -0
  102. package/dist/src/bindings/msg_edit.js +1 -0
  103. package/dist/src/bindings/msg_join.d.ts +6 -0
  104. package/dist/src/bindings/msg_join.js +1 -0
  105. package/dist/src/bindings/msg_sequencer_action_invalid_message.d.ts +6 -0
  106. package/dist/src/bindings/msg_sequencer_action_invalid_message.js +2 -0
  107. package/dist/src/bindings/msg_sequencer_action_message.d.ts +7 -0
  108. package/dist/src/bindings/msg_sequencer_action_message.js +1 -0
  109. package/dist/src/bindings/msg_sequencer_init_workbook.d.ts +5 -0
  110. package/dist/src/bindings/msg_sequencer_init_workbook.js +2 -0
  111. package/dist/src/bindings/msg_sequencer_message.d.ts +10 -0
  112. package/dist/src/bindings/msg_sequencer_message.js +1 -0
  113. package/dist/src/bindings/msg_user_message.d.ts +7 -0
  114. package/dist/src/bindings/msg_user_message.js +1 -0
  115. package/dist/src/bindings/normal_cell_id.d.ts +4 -0
  116. package/dist/src/bindings/normal_cell_id.js +2 -0
  117. package/dist/src/bindings/pattern_fill.d.ts +7 -0
  118. package/dist/src/bindings/pattern_fill.js +1 -0
  119. package/dist/src/bindings/payloads_action.d.ts +5 -0
  120. package/dist/src/bindings/payloads_action.js +1 -0
  121. package/dist/src/bindings/recalc_cell.d.ts +5 -0
  122. package/dist/src/bindings/recalc_cell.js +1 -0
  123. package/dist/src/bindings/remove_block.d.ts +4 -0
  124. package/dist/src/bindings/remove_block.js +2 -0
  125. package/dist/src/bindings/row_info.d.ts +5 -0
  126. package/dist/src/bindings/row_info.js +2 -0
  127. package/dist/src/bindings/set_col_width.d.ts +5 -0
  128. package/dist/src/bindings/set_col_width.js +2 -0
  129. package/dist/src/bindings/set_row_height.d.ts +5 -0
  130. package/dist/src/bindings/set_row_height.js +2 -0
  131. package/dist/src/bindings/set_visible.d.ts +6 -0
  132. package/dist/src/bindings/set_visible.js +2 -0
  133. package/dist/src/bindings/sheet_blocks.d.ts +5 -0
  134. package/dist/src/bindings/sheet_blocks.js +1 -0
  135. package/dist/src/bindings/sheet_col_info.d.ts +6 -0
  136. package/dist/src/bindings/sheet_col_info.js +1 -0
  137. package/dist/src/bindings/sheet_comments.d.ts +5 -0
  138. package/dist/src/bindings/sheet_comments.js +1 -0
  139. package/dist/src/bindings/sheet_merge_cells.d.ts +5 -0
  140. package/dist/src/bindings/sheet_merge_cells.js +1 -0
  141. package/dist/src/bindings/sheet_names.d.ts +3 -0
  142. package/dist/src/bindings/sheet_names.js +2 -0
  143. package/dist/src/bindings/sheet_rename.d.ts +5 -0
  144. package/dist/src/bindings/sheet_rename.js +2 -0
  145. package/dist/src/bindings/sheet_row_info.d.ts +6 -0
  146. package/dist/src/bindings/sheet_row_info.js +1 -0
  147. package/dist/src/bindings/sheet_styles.d.ts +5 -0
  148. package/dist/src/bindings/sheet_styles.js +1 -0
  149. package/dist/src/bindings/sheet_values.d.ts +5 -0
  150. package/dist/src/bindings/sheet_values.js +1 -0
  151. package/dist/src/bindings/st_border_style.d.ts +1 -0
  152. package/dist/src/bindings/st_border_style.js +2 -0
  153. package/dist/src/bindings/st_font_scheme.d.ts +1 -0
  154. package/dist/src/bindings/st_font_scheme.js +2 -0
  155. package/dist/src/bindings/st_gradient_type.d.ts +1 -0
  156. package/dist/src/bindings/st_gradient_type.js +2 -0
  157. package/dist/src/bindings/st_horizontal_alignment.d.ts +1 -0
  158. package/dist/src/bindings/st_horizontal_alignment.js +2 -0
  159. package/dist/src/bindings/st_pattern_type.d.ts +1 -0
  160. package/dist/src/bindings/st_pattern_type.js +2 -0
  161. package/dist/src/bindings/st_underline_values.d.ts +1 -0
  162. package/dist/src/bindings/st_underline_values.js +2 -0
  163. package/dist/src/bindings/st_vertical_align_run.d.ts +1 -0
  164. package/dist/src/bindings/st_vertical_align_run.js +2 -0
  165. package/dist/src/bindings/st_vertical_alignment.d.ts +1 -0
  166. package/dist/src/bindings/st_vertical_alignment.js +2 -0
  167. package/dist/src/bindings/status_code.d.ts +5 -0
  168. package/dist/src/bindings/status_code.js +2 -0
  169. package/dist/src/bindings/style.d.ts +13 -0
  170. package/dist/src/bindings/style.js +1 -0
  171. package/dist/src/bindings/style_update.d.ts +7 -0
  172. package/dist/src/bindings/style_update.js +1 -0
  173. package/dist/src/bindings/style_update_type.d.ts +27 -0
  174. package/dist/src/bindings/style_update_type.js +1 -0
  175. package/dist/src/bindings/task.d.ts +4 -0
  176. package/dist/src/bindings/task.js +2 -0
  177. package/dist/src/bindings/underline_property.d.ts +4 -0
  178. package/dist/src/bindings/underline_property.js +1 -0
  179. package/dist/src/bindings/value.d.ts +9 -0
  180. package/dist/src/bindings/value.js +2 -0
  181. package/dist/src/bindings/vertical_align_font_property.d.ts +4 -0
  182. package/dist/src/bindings/vertical_align_font_property.js +1 -0
  183. package/dist/src/bindings/workbook_file.d.ts +4 -0
  184. package/dist/src/bindings/workbook_file.js +2 -0
  185. package/dist/src/index.d.ts +4 -0
  186. package/dist/src/index.js +3 -0
  187. package/dist/src/payloads/block_input.d.ts +21 -0
  188. package/dist/src/payloads/block_input.js +47 -0
  189. package/dist/src/payloads/cell_input.d.ts +18 -0
  190. package/dist/src/payloads/cell_input.js +39 -0
  191. package/dist/src/payloads/create_block.d.ts +24 -0
  192. package/dist/src/payloads/create_block.js +61 -0
  193. package/dist/src/payloads/delete_block_cols.d.ts +18 -0
  194. package/dist/src/payloads/delete_block_cols.js +39 -0
  195. package/dist/src/payloads/delete_block_rows.d.ts +18 -0
  196. package/dist/src/payloads/delete_block_rows.js +39 -0
  197. package/dist/src/payloads/delete_cols.d.ts +15 -0
  198. package/dist/src/payloads/delete_cols.js +31 -0
  199. package/dist/src/payloads/delete_rows.d.ts +15 -0
  200. package/dist/src/payloads/delete_rows.js +31 -0
  201. package/dist/src/payloads/delete_sheet.d.ts +9 -0
  202. package/dist/src/payloads/delete_sheet.js +15 -0
  203. package/dist/src/payloads/index.d.ts +43 -0
  204. package/dist/src/payloads/index.js +21 -0
  205. package/dist/src/payloads/insert_block_cols.d.ts +18 -0
  206. package/dist/src/payloads/insert_block_cols.js +39 -0
  207. package/dist/src/payloads/insert_block_rows.d.ts +18 -0
  208. package/dist/src/payloads/insert_block_rows.js +39 -0
  209. package/dist/src/payloads/insert_cols.d.ts +15 -0
  210. package/dist/src/payloads/insert_cols.js +31 -0
  211. package/dist/src/payloads/insert_rows.d.ts +15 -0
  212. package/dist/src/payloads/insert_rows.js +31 -0
  213. package/dist/src/payloads/insert_sheet.d.ts +12 -0
  214. package/dist/src/payloads/insert_sheet.js +23 -0
  215. package/dist/src/payloads/move_block.d.ts +18 -0
  216. package/dist/src/payloads/move_block.js +39 -0
  217. package/dist/src/payloads/set_border.d.ts +49 -0
  218. package/dist/src/payloads/set_border.js +97 -0
  219. package/dist/src/payloads/set_col_visible.d.ts +15 -0
  220. package/dist/src/payloads/set_col_visible.js +31 -0
  221. package/dist/src/payloads/set_col_width.d.ts +15 -0
  222. package/dist/src/payloads/set_col_width.js +31 -0
  223. package/dist/src/payloads/set_font.d.ts +46 -0
  224. package/dist/src/payloads/set_font.js +91 -0
  225. package/dist/src/payloads/set_row_height.d.ts +15 -0
  226. package/dist/src/payloads/set_row_height.js +31 -0
  227. package/dist/src/payloads/set_row_visible.d.ts +15 -0
  228. package/dist/src/payloads/set_row_visible.js +31 -0
  229. package/dist/src/payloads/sheet_rename.d.ts +15 -0
  230. package/dist/src/payloads/sheet_rename.js +29 -0
  231. package/dist/src/transactions.d.ts +7 -0
  232. package/dist/src/transactions.js +12 -0
  233. package/package.json +6 -5
  234. package/wasm/logisheets_wasm_server_bg.wasm +0 -0
  235. package/index.ts +0 -1
  236. package/src/api/index.ts +0 -1
  237. package/src/api/workbook.ts +0 -201
  238. package/src/bindings/action_effect.ts +0 -17
  239. package/src/bindings/async_func_result.ts +0 -12
  240. package/src/bindings/block_cell_id.ts +0 -7
  241. package/src/bindings/block_info.ts +0 -9
  242. package/src/bindings/block_input.ts +0 -9
  243. package/src/bindings/block_style_update.ts +0 -10
  244. package/src/bindings/border.ts +0 -15
  245. package/src/bindings/border_pr.ts +0 -8
  246. package/src/bindings/cell_alignment.ts +0 -15
  247. package/src/bindings/cell_formula_value.ts +0 -9
  248. package/src/bindings/cell_id.ts +0 -7
  249. package/src/bindings/cell_input.ts +0 -9
  250. package/src/bindings/cell_protection.ts +0 -6
  251. package/src/bindings/cell_style.ts +0 -8
  252. package/src/bindings/col_info.ts +0 -7
  253. package/src/bindings/color.ts +0 -8
  254. package/src/bindings/comment.ts +0 -8
  255. package/src/bindings/create_block.ts +0 -15
  256. package/src/bindings/create_sheet.ts +0 -6
  257. package/src/bindings/delete_cols.ts +0 -7
  258. package/src/bindings/delete_cols_in_block.ts +0 -8
  259. package/src/bindings/delete_rows.ts +0 -7
  260. package/src/bindings/delete_rows_in_block.ts +0 -8
  261. package/src/bindings/delete_sheet.ts +0 -5
  262. package/src/bindings/display_patch.ts +0 -19
  263. package/src/bindings/display_request.ts +0 -6
  264. package/src/bindings/display_response.ts +0 -7
  265. package/src/bindings/edit_action.ts +0 -10
  266. package/src/bindings/edit_payload.ts +0 -47
  267. package/src/bindings/fill.ts +0 -7
  268. package/src/bindings/font.ts +0 -25
  269. package/src/bindings/font_family.ts +0 -5
  270. package/src/bindings/font_name.ts +0 -5
  271. package/src/bindings/font_scheme.ts +0 -6
  272. package/src/bindings/gradient_fill.ts +0 -13
  273. package/src/bindings/gradient_stop.ts +0 -7
  274. package/src/bindings/index.ts +0 -85
  275. package/src/bindings/insert_cols.ts +0 -7
  276. package/src/bindings/insert_cols_in_block.ts +0 -8
  277. package/src/bindings/insert_rows.ts +0 -7
  278. package/src/bindings/insert_rows_in_block.ts +0 -8
  279. package/src/bindings/merge_cell.ts +0 -8
  280. package/src/bindings/move_block.ts +0 -8
  281. package/src/bindings/msg_edit.ts +0 -9
  282. package/src/bindings/msg_join.ts +0 -9
  283. package/src/bindings/msg_sequencer_action_invalid_message.ts +0 -10
  284. package/src/bindings/msg_sequencer_action_message.ts +0 -10
  285. package/src/bindings/msg_sequencer_init_workbook.ts +0 -8
  286. package/src/bindings/msg_sequencer_message.ts +0 -9
  287. package/src/bindings/msg_user_message.ts +0 -7
  288. package/src/bindings/normal_cell_id.ts +0 -6
  289. package/src/bindings/pattern_fill.ts +0 -9
  290. package/src/bindings/payloads_action.ts +0 -15
  291. package/src/bindings/recalc_cell.ts +0 -7
  292. package/src/bindings/remove_block.ts +0 -6
  293. package/src/bindings/row_info.ts +0 -7
  294. package/src/bindings/set_col_width.ts +0 -7
  295. package/src/bindings/set_row_height.ts +0 -7
  296. package/src/bindings/set_visible.ts +0 -8
  297. package/src/bindings/sheet_blocks.ts +0 -7
  298. package/src/bindings/sheet_col_info.ts +0 -8
  299. package/src/bindings/sheet_comments.ts +0 -7
  300. package/src/bindings/sheet_merge_cells.ts +0 -7
  301. package/src/bindings/sheet_names.ts +0 -5
  302. package/src/bindings/sheet_rename.ts +0 -8
  303. package/src/bindings/sheet_row_info.ts +0 -8
  304. package/src/bindings/sheet_styles.ts +0 -7
  305. package/src/bindings/sheet_values.ts +0 -7
  306. package/src/bindings/st_border_style.ts +0 -17
  307. package/src/bindings/st_font_scheme.ts +0 -6
  308. package/src/bindings/st_gradient_type.ts +0 -6
  309. package/src/bindings/st_horizontal_alignment.ts +0 -12
  310. package/src/bindings/st_pattern_type.ts +0 -23
  311. package/src/bindings/st_underline_values.ts +0 -9
  312. package/src/bindings/st_vertical_align_run.ts +0 -7
  313. package/src/bindings/st_vertical_alignment.ts +0 -9
  314. package/src/bindings/status_code.ts +0 -5
  315. package/src/bindings/style.ts +0 -15
  316. package/src/bindings/style_update.ts +0 -9
  317. package/src/bindings/style_update_type.ts +0 -29
  318. package/src/bindings/task.ts +0 -6
  319. package/src/bindings/underline_property.ts +0 -6
  320. package/src/bindings/value.ts +0 -8
  321. package/src/bindings/vertical_align_font_property.ts +0 -6
  322. package/src/bindings/workbook_file.ts +0 -6
  323. package/src/index.ts +0 -42
  324. package/src/payloads/block_input.ts +0 -54
  325. package/src/payloads/cell_input.ts +0 -44
  326. package/src/payloads/create_block.ts +0 -78
  327. package/src/payloads/delete_block_cols.ts +0 -44
  328. package/src/payloads/delete_block_rows.ts +0 -44
  329. package/src/payloads/delete_cols.ts +0 -37
  330. package/src/payloads/delete_rows.ts +0 -37
  331. package/src/payloads/delete_sheet.ts +0 -19
  332. package/src/payloads/index.ts +0 -66
  333. package/src/payloads/insert_block_cols.ts +0 -44
  334. package/src/payloads/insert_block_rows.ts +0 -44
  335. package/src/payloads/insert_cols.ts +0 -35
  336. package/src/payloads/insert_rows.ts +0 -36
  337. package/src/payloads/insert_sheet.ts +0 -27
  338. package/src/payloads/move_block.ts +0 -45
  339. package/src/payloads/set_border.ts +0 -113
  340. package/src/payloads/set_col_visible.ts +0 -35
  341. package/src/payloads/set_col_width.ts +0 -35
  342. package/src/payloads/set_font.ts +0 -107
  343. package/src/payloads/set_row_height.ts +0 -35
  344. package/src/payloads/set_row_visible.ts +0 -35
  345. package/src/payloads/sheet_rename.ts +0 -35
  346. package/src/transactions.ts +0 -14
@@ -0,0 +1 @@
1
+ export * from './src';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from './src';
@@ -0,0 +1,2 @@
1
+ export * from './workbook';
2
+ export * from './worksheet';
@@ -0,0 +1,2 @@
1
+ export * from './workbook';
2
+ export * from './worksheet';
@@ -0,0 +1,3 @@
1
+ import { ErrorMessage } from '../bindings/error_message';
2
+ export declare function isErrorMessage(v: any): v is ErrorMessage;
3
+ export declare type Result<V> = V | ErrorMessage;
@@ -0,0 +1,4 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
+ export function isErrorMessage(v) {
3
+ return 'msg' in v && 'ty' in v;
4
+ }
@@ -0,0 +1,18 @@
1
+ import { ActionEffect, AsyncFuncResult, DisplayResponse } from '../bindings';
2
+ import { Transaction } from '../transactions';
3
+ import { Worksheet } from './worksheet';
4
+ export declare type ReturnCode = number;
5
+ export declare class Workbook {
6
+ constructor();
7
+ undo(): boolean;
8
+ redo(): boolean;
9
+ execTransaction(tx: Transaction, undoable: boolean): ActionEffect;
10
+ load(buf: Uint8Array, book_name: string): ReturnCode;
11
+ release(): void;
12
+ inputAsyncResult(r: AsyncFuncResult): ActionEffect;
13
+ getPatches(sheet_idx: number, version: number): DisplayResponse;
14
+ get_sheet_count(): number;
15
+ get_worksheet(idx: number): Worksheet;
16
+ private _addPayload;
17
+ private _id;
18
+ }
@@ -0,0 +1,87 @@
1
+ import { new_workbook, undo, redo, transaction_end, transaction_start, cell_input, row_insert, row_delete, col_insert, col_delete, create_block, move_block, block_input, set_font, set_border, read_file, release, input_async_result, get_patches, block_line_shift, sheet_rename_by_idx, sheet_rename_by_name, create_sheet, delete_sheet, get_sheet_count, } from '../../wasm/logisheets_wasm_server';
2
+ import { Worksheet } from './worksheet';
3
+ export class Workbook {
4
+ constructor() {
5
+ this._id = new_workbook();
6
+ }
7
+ undo() {
8
+ return undo(this._id);
9
+ }
10
+ redo() {
11
+ return redo(this._id);
12
+ }
13
+ execTransaction(tx, undoable) {
14
+ transaction_start(this._id);
15
+ tx.payloads.forEach((p) => {
16
+ this._addPayload(p);
17
+ });
18
+ return transaction_end(this._id, undoable);
19
+ }
20
+ load(buf, book_name) {
21
+ return read_file(this._id, book_name, buf);
22
+ }
23
+ release() {
24
+ release(this._id);
25
+ }
26
+ inputAsyncResult(r) {
27
+ return input_async_result(this._id, r);
28
+ }
29
+ getPatches(sheet_idx, version) {
30
+ const res = get_patches(this._id, sheet_idx, version);
31
+ return res;
32
+ }
33
+ get_sheet_count() {
34
+ return get_sheet_count(this._id);
35
+ }
36
+ get_worksheet(idx) {
37
+ if (idx >= this.get_sheet_count())
38
+ throw Error(`invalid sheet index: ${idx}`);
39
+ return new Worksheet(this._id, idx);
40
+ }
41
+ _addPayload(p) {
42
+ if (p.type === 'cellInput')
43
+ return cell_input(this._id, p.sheetIdx, p.row, p.col, p.input);
44
+ if (p.type === 'insertRows')
45
+ return row_insert(this._id, p.sheetIdx, p.start, p.cnt);
46
+ if (p.type === 'deleteRows')
47
+ return row_delete(this._id, p.sheetIdx, p.start, p.cnt);
48
+ if (p.type === 'insertCols')
49
+ return col_insert(this._id, p.sheetIdx, p.start, p.cnt);
50
+ if (p.type === 'deleteCols')
51
+ return col_delete(this._id, p.sheetIdx, p.start, p.cnt);
52
+ if (p.type === 'createBlock')
53
+ return create_block(this._id, p.sheetIdx, p.blockId, p.masterRow, p.masterCol, p.rowCnt, p.colCnt);
54
+ if (p.type === 'moveBlock')
55
+ return move_block(this._id, p.sheetIdx, p.blockId, p.newMasterRow, p.newMasterCol);
56
+ if (p.type === 'setBorder')
57
+ return set_border(this._id, p.sheetIdx, p.row, p.col, p.leftColor, p.rightColor, p.topColor, p.bottomColor, p.leftBorderType, p.rightBorderType, p.topBorderType, p.bottomBorderType, p.outline, p.diagonalUp, p.diagonalDown);
58
+ if (p.type === 'setFont')
59
+ return set_font(this._id, p.sheetIdx, p.row, p.col, p.bold, p.italic, p.name, p.underline, p.color, p.size, p.outline, p.shadow, p.strike, p.condense);
60
+ if (p.type === 'blockInput')
61
+ return block_input(this._id, p.sheetIdx, p.blockId, p.row, p.col, p.input);
62
+ if (p.type === 'insertBlockCols')
63
+ return block_line_shift(this._id, p.sheetIdx, p.blockId, p.colIdx, p.cnt, false, true);
64
+ if (p.type === 'insertBlockRows')
65
+ return block_line_shift(this._id, p.sheetIdx, p.blockId, p.rowIdx, p.cnt, true, true);
66
+ if (p.type === 'deleteBlockRows')
67
+ return block_line_shift(this._id, p.sheetIdx, p.blockId, p.rowIdx, p.cnt, true, false);
68
+ if (p.type === 'deleteBlockCols')
69
+ return block_line_shift(this._id, p.sheetIdx, p.blockId, p.colIdx, p.cnt, true, true);
70
+ if (p.type === 'sheetRename') {
71
+ if (p.oldName) {
72
+ return sheet_rename_by_name(this._id, p.oldName, p.newName);
73
+ }
74
+ if (p.idx) {
75
+ return sheet_rename_by_idx(this._id, p.idx, p.newName);
76
+ }
77
+ }
78
+ if (p.type === 'deleteSheet')
79
+ return delete_sheet(this._id, p.sheetIdx);
80
+ if (p.type === 'insertSheet')
81
+ return create_sheet(this._id, p.sheetIdx, p.name);
82
+ // eslint-disable-next-line no-console
83
+ console.log('Unimplemented!');
84
+ }
85
+ // The book id which is generated by `WASM`
86
+ _id;
87
+ }
@@ -0,0 +1,16 @@
1
+ import { ColInfo, RowInfo, Style, Value } from '../bindings';
2
+ import { CellInfo } from '../bindings/cell_info';
3
+ import { Result } from './utils';
4
+ export declare class Worksheet {
5
+ constructor(id: number, idx: number);
6
+ get_row_height(row_idx: number): Result<number>;
7
+ get_col_width(col_idx: number): Result<number>;
8
+ get_row_info(row_idx: number): Result<RowInfo>;
9
+ get_col_info(col_idx: number): Result<ColInfo>;
10
+ get_cell_info(row_idx: number, col_idx: number): Result<CellInfo>;
11
+ get_formula(row_idx: number, col_idx: number): Result<string>;
12
+ get_style(row_idx: number, col_idx: number): Result<Style>;
13
+ get_value(row_idx: number, col_idx: number): Result<Value>;
14
+ private _id;
15
+ private _sheetIdx;
16
+ }
@@ -0,0 +1,33 @@
1
+ import { get_cell_info, get_col_info, get_col_width, get_formula, get_row_height, get_row_info, get_style, get_value, } from '../../wasm';
2
+ export class Worksheet {
3
+ constructor(id, idx) {
4
+ this._id = id;
5
+ this._sheetIdx = idx;
6
+ }
7
+ get_row_height(row_idx) {
8
+ return get_row_height(this._id, this._sheetIdx, row_idx);
9
+ }
10
+ get_col_width(col_idx) {
11
+ return get_col_width(this._id, this._sheetIdx, col_idx);
12
+ }
13
+ get_row_info(row_idx) {
14
+ return get_row_info(this._id, this._sheetIdx, row_idx);
15
+ }
16
+ get_col_info(col_idx) {
17
+ return get_col_info(this._id, this._sheetIdx, col_idx);
18
+ }
19
+ get_cell_info(row_idx, col_idx) {
20
+ return get_cell_info(this._id, this._sheetIdx, row_idx, col_idx);
21
+ }
22
+ get_formula(row_idx, col_idx) {
23
+ return get_formula(this._id, this._sheetIdx, row_idx, col_idx);
24
+ }
25
+ get_style(row_idx, col_idx) {
26
+ return get_style(this._id, this._sheetIdx, row_idx, col_idx);
27
+ }
28
+ get_value(row_idx, col_idx) {
29
+ return get_value(this._id, this._sheetIdx, row_idx, col_idx);
30
+ }
31
+ _id;
32
+ _sheetIdx;
33
+ }
@@ -0,0 +1,7 @@
1
+ import { StatusCode } from './status_code';
2
+ import { Task } from './task';
3
+ export interface ActionEffect {
4
+ version: number;
5
+ asyncTasks: readonly Task[];
6
+ status: StatusCode;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { Task } from './task';
2
+ export interface AsyncFuncResult {
3
+ tasks: readonly Task[];
4
+ values: readonly string[];
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export interface BlockCellId {
2
+ block_id: number;
3
+ row: number;
4
+ col: number;
5
+ }
@@ -0,0 +1,2 @@
1
+ // DO NOT EDIT. CODE GENERATED BY gents.
2
+ export {};
@@ -0,0 +1,7 @@
1
+ export interface BlockInfo {
2
+ blockId: number;
3
+ rowStart: number;
4
+ rowCnt: number;
5
+ colStart: number;
6
+ colCnt: number;
7
+ }
@@ -0,0 +1,2 @@
1
+ // DO NOT EDIT. CODE GENERATED BY gents.
2
+ export {};
@@ -0,0 +1,7 @@
1
+ export interface BlockInput {
2
+ sheetIdx: number;
3
+ blockId: number;
4
+ row: number;
5
+ col: number;
6
+ input: string;
7
+ }
@@ -0,0 +1,2 @@
1
+ // DO NOT EDIT. CODE GENERATED BY gents.
2
+ export {};
@@ -0,0 +1,8 @@
1
+ import { StyleUpdateType } from './style_update_type';
2
+ export interface BlockStyleUpdate {
3
+ sheetIdx: number;
4
+ blockId: number;
5
+ row: number;
6
+ col: number;
7
+ styleUpdate: StyleUpdateType;
8
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import { BorderPr } from './border_pr';
2
+ export interface Border {
3
+ left?: BorderPr;
4
+ right?: BorderPr;
5
+ top?: BorderPr;
6
+ bottom?: BorderPr;
7
+ diagonal?: BorderPr;
8
+ vertical?: BorderPr;
9
+ horizontal?: BorderPr;
10
+ diagonalUp?: boolean;
11
+ diagonalDown?: boolean;
12
+ outline: boolean;
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import { Color } from './color';
2
+ import { StBorderStyle } from './st_border_style';
3
+ export interface BorderPr {
4
+ color?: Color;
5
+ style: StBorderStyle;
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import { StHorizontalAlignment } from './st_horizontal_alignment';
2
+ import { StVerticalAlignment } from './st_vertical_alignment';
3
+ export interface CtCellAlignment {
4
+ horizontal?: StHorizontalAlignment;
5
+ vertical?: StVerticalAlignment;
6
+ textRotation?: number;
7
+ wrapText?: boolean;
8
+ indent?: number;
9
+ relativeIndent?: number;
10
+ justifyLastLine?: boolean;
11
+ shrinkToFit?: boolean;
12
+ readingOrder?: number;
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { Value } from './value';
2
+ export interface CellFormulaValue {
3
+ row: number;
4
+ col: number;
5
+ formula: string;
6
+ value: Value;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { BlockCellId } from './block_cell_id';
2
+ import { NormalCellId } from './normal_cell_id';
3
+ export declare type CellId = {
4
+ NormalCell: NormalCellId;
5
+ } | {
6
+ BlockCell: BlockCellId;
7
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { Style } from './style';
2
+ import { Value } from './value';
3
+ export interface CellInfo {
4
+ value: Value;
5
+ formula: string;
6
+ style: Style;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export interface CellInput {
2
+ sheetIdx: number;
3
+ row: number;
4
+ col: number;
5
+ content: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ // DO NOT EDIT. CODE GENERATED BY gents.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface CtCellProtection {
2
+ locked?: boolean;
3
+ hidden?: boolean;
4
+ }
@@ -0,0 +1,2 @@
1
+ // DO NOT EDIT. CODE GENERATED BY gents.
2
+ export {};
@@ -0,0 +1,6 @@
1
+ import { Style } from './style';
2
+ export interface CellStyle {
3
+ row: number;
4
+ col: number;
5
+ style: Style;
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export interface ColInfo {
2
+ idx: number;
3
+ width: number;
4
+ hidden: boolean;
5
+ }
@@ -0,0 +1,2 @@
1
+ // DO NOT EDIT. CODE GENERATED BY gents.
2
+ export {};
@@ -0,0 +1,6 @@
1
+ export interface Color {
2
+ red?: number;
3
+ green?: number;
4
+ blue?: number;
5
+ alpha?: number;
6
+ }
@@ -0,0 +1,2 @@
1
+ // DO NOT EDIT. CODE GENERATED BY gents.
2
+ export {};
@@ -0,0 +1,6 @@
1
+ export interface Comment {
2
+ row: number;
3
+ col: number;
4
+ author: string;
5
+ content: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ // DO NOT EDIT. CODE GENERATED BY gents.
2
+ export {};
@@ -0,0 +1,8 @@
1
+ export interface CreateBlock {
2
+ sheetIdx: number;
3
+ id: number;
4
+ masterRow: number;
5
+ masterCol: number;
6
+ rowCnt: number;
7
+ colCnt: number;
8
+ }
@@ -0,0 +1,2 @@
1
+ // DO NOT EDIT. CODE GENERATED BY gents.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface CreateSheet {
2
+ idx: number;
3
+ newName: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ // DO NOT EDIT. CODE GENERATED BY gents.
2
+ export {};
@@ -0,0 +1,5 @@
1
+ export interface DeleteCols {
2
+ sheetIdx: number;
3
+ start: number;
4
+ count: number;
5
+ }
@@ -0,0 +1,2 @@
1
+ // DO NOT EDIT. CODE GENERATED BY gents.
2
+ export {};
@@ -0,0 +1,6 @@
1
+ export interface DeleteColsInBlock {
2
+ sheetIdx: number;
3
+ blockId: number;
4
+ start: number;
5
+ cnt: number;
6
+ }
@@ -0,0 +1,2 @@
1
+ // DO NOT EDIT. CODE GENERATED BY gents.
2
+ export {};
@@ -0,0 +1,5 @@
1
+ export interface DeleteRows {
2
+ sheetIdx: number;
3
+ start: number;
4
+ count: number;
5
+ }
@@ -0,0 +1,2 @@
1
+ // DO NOT EDIT. CODE GENERATED BY gents.
2
+ export {};
@@ -0,0 +1,6 @@
1
+ export interface DeleteRowsInBlock {
2
+ sheetIdx: number;
3
+ blockId: number;
4
+ start: number;
5
+ cnt: number;
6
+ }
@@ -0,0 +1,2 @@
1
+ // DO NOT EDIT. CODE GENERATED BY gents.
2
+ export {};
@@ -0,0 +1,3 @@
1
+ export interface DeleteSheet {
2
+ idx: number;
3
+ }
@@ -0,0 +1,2 @@
1
+ // DO NOT EDIT. CODE GENERATED BY gents.
2
+ export {};
@@ -0,0 +1,25 @@
1
+ import { SheetBlocks } from './sheet_blocks';
2
+ import { SheetColInfo } from './sheet_col_info';
3
+ import { SheetComments } from './sheet_comments';
4
+ import { SheetMergeCells } from './sheet_merge_cells';
5
+ import { SheetNames } from './sheet_names';
6
+ import { SheetRowInfo } from './sheet_row_info';
7
+ import { SheetStyles } from './sheet_styles';
8
+ import { SheetValues } from './sheet_values';
9
+ export declare type DisplayPatch = {
10
+ values: SheetValues;
11
+ } | {
12
+ styles: SheetStyles;
13
+ } | {
14
+ rowInfo: SheetRowInfo;
15
+ } | {
16
+ colInfo: SheetColInfo;
17
+ } | {
18
+ mergeCells: SheetMergeCells;
19
+ } | {
20
+ comments: SheetComments;
21
+ } | {
22
+ blocks: SheetBlocks;
23
+ } | {
24
+ sheetNames: SheetNames;
25
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface DisplayRequest {
2
+ sheetIdx: number;
3
+ version: number;
4
+ }
@@ -0,0 +1,2 @@
1
+ // DO NOT EDIT. CODE GENERATED BY gents.
2
+ export {};
@@ -0,0 +1,5 @@
1
+ import { DisplayPatch } from './display_patch';
2
+ export interface DisplayResponse {
3
+ incremental: boolean;
4
+ patches: readonly DisplayPatch[];
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { PayloadsAction } from './payloads_action';
2
+ import { RecalcCell } from './recalc_cell';
3
+ export declare type EditAction = 'undo' | 'redo' | {
4
+ payloads: PayloadsAction;
5
+ } | {
6
+ recalc: readonly RecalcCell[];
7
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,64 @@
1
+ import { BlockInput } from './block_input';
2
+ import { BlockStyleUpdate } from './block_style_update';
3
+ import { CellInput } from './cell_input';
4
+ import { CreateBlock } from './create_block';
5
+ import { CreateSheet } from './create_sheet';
6
+ import { DeleteColsInBlock } from './delete_cols_in_block';
7
+ import { DeleteCols } from './delete_cols';
8
+ import { DeleteRowsInBlock } from './delete_rows_in_block';
9
+ import { DeleteRows } from './delete_rows';
10
+ import { DeleteSheet } from './delete_sheet';
11
+ import { InsertColsInBlock } from './insert_cols_in_block';
12
+ import { InsertCols } from './insert_cols';
13
+ import { InsertRowsInBlock } from './insert_rows_in_block';
14
+ import { InsertRows } from './insert_rows';
15
+ import { MoveBlock } from './move_block';
16
+ import { RemoveBlock } from './remove_block';
17
+ import { SetColWidth } from './set_col_width';
18
+ import { SetRowHeight } from './set_row_height';
19
+ import { SetVisible } from './set_visible';
20
+ import { SheetRename } from './sheet_rename';
21
+ import { StyleUpdate } from './style_update';
22
+ export declare type EditPayload = {
23
+ blockInput: BlockInput;
24
+ } | {
25
+ moveBlock: MoveBlock;
26
+ } | {
27
+ removeBlock: RemoveBlock;
28
+ } | {
29
+ createBlock: CreateBlock;
30
+ } | {
31
+ styleUpdate: StyleUpdate;
32
+ } | {
33
+ blockStyleUpdate: BlockStyleUpdate;
34
+ } | {
35
+ cellInput: CellInput;
36
+ } | {
37
+ setColWidth: SetColWidth;
38
+ } | {
39
+ setRowHeight: SetRowHeight;
40
+ } | {
41
+ setVisible: SetVisible;
42
+ } | {
43
+ sheetRename: SheetRename;
44
+ } | {
45
+ createSheet: CreateSheet;
46
+ } | {
47
+ deleteSheet: DeleteSheet;
48
+ } | {
49
+ insertCols: InsertCols;
50
+ } | {
51
+ deleteCols: DeleteCols;
52
+ } | {
53
+ insertRows: InsertRows;
54
+ } | {
55
+ deleteRows: DeleteRows;
56
+ } | {
57
+ insertColsInBlock: InsertColsInBlock;
58
+ } | {
59
+ deleteColsInBlock: DeleteColsInBlock;
60
+ } | {
61
+ insertRowsInBlock: InsertRowsInBlock;
62
+ } | {
63
+ deleteRowsInBlock: DeleteRowsInBlock;
64
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface ErrorMessage {
2
+ msg: string;
3
+ ty: number;
4
+ }
@@ -0,0 +1,2 @@
1
+ // DO NOT EDIT. CODE GENERATED BY gents.
2
+ export {};
@@ -0,0 +1,7 @@
1
+ import { GradientFill } from './gradient_fill';
2
+ import { PatternFill } from './pattern_fill';
3
+ export declare type Fill = {
4
+ patternFill: PatternFill;
5
+ } | {
6
+ gradientFill: GradientFill;
7
+ };