logisheets 0.6.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 (120) hide show
  1. package/README.md +15 -0
  2. package/index.ts +1 -0
  3. package/package.json +31 -0
  4. package/src/api/index.ts +1 -0
  5. package/src/api/workbook.ts +201 -0
  6. package/src/bindings/action_effect.ts +17 -0
  7. package/src/bindings/async_func_result.ts +12 -0
  8. package/src/bindings/block_cell_id.ts +7 -0
  9. package/src/bindings/block_info.ts +9 -0
  10. package/src/bindings/block_input.ts +9 -0
  11. package/src/bindings/block_style_update.ts +10 -0
  12. package/src/bindings/border.ts +15 -0
  13. package/src/bindings/border_pr.ts +8 -0
  14. package/src/bindings/cell_alignment.ts +15 -0
  15. package/src/bindings/cell_formula_value.ts +9 -0
  16. package/src/bindings/cell_id.ts +7 -0
  17. package/src/bindings/cell_input.ts +9 -0
  18. package/src/bindings/cell_protection.ts +6 -0
  19. package/src/bindings/cell_style.ts +8 -0
  20. package/src/bindings/col_info.ts +7 -0
  21. package/src/bindings/color.ts +8 -0
  22. package/src/bindings/comment.ts +8 -0
  23. package/src/bindings/create_block.ts +15 -0
  24. package/src/bindings/create_sheet.ts +6 -0
  25. package/src/bindings/delete_cols.ts +7 -0
  26. package/src/bindings/delete_cols_in_block.ts +8 -0
  27. package/src/bindings/delete_rows.ts +7 -0
  28. package/src/bindings/delete_rows_in_block.ts +8 -0
  29. package/src/bindings/delete_sheet.ts +5 -0
  30. package/src/bindings/display_patch.ts +19 -0
  31. package/src/bindings/display_request.ts +6 -0
  32. package/src/bindings/display_response.ts +7 -0
  33. package/src/bindings/edit_action.ts +10 -0
  34. package/src/bindings/edit_payload.ts +47 -0
  35. package/src/bindings/fill.ts +7 -0
  36. package/src/bindings/font.ts +25 -0
  37. package/src/bindings/font_family.ts +5 -0
  38. package/src/bindings/font_name.ts +5 -0
  39. package/src/bindings/font_scheme.ts +6 -0
  40. package/src/bindings/gradient_fill.ts +13 -0
  41. package/src/bindings/gradient_stop.ts +7 -0
  42. package/src/bindings/index.ts +85 -0
  43. package/src/bindings/insert_cols.ts +7 -0
  44. package/src/bindings/insert_cols_in_block.ts +8 -0
  45. package/src/bindings/insert_rows.ts +7 -0
  46. package/src/bindings/insert_rows_in_block.ts +8 -0
  47. package/src/bindings/merge_cell.ts +8 -0
  48. package/src/bindings/move_block.ts +8 -0
  49. package/src/bindings/msg_edit.ts +9 -0
  50. package/src/bindings/msg_join.ts +9 -0
  51. package/src/bindings/msg_sequencer_action_invalid_message.ts +10 -0
  52. package/src/bindings/msg_sequencer_action_message.ts +10 -0
  53. package/src/bindings/msg_sequencer_init_workbook.ts +8 -0
  54. package/src/bindings/msg_sequencer_message.ts +9 -0
  55. package/src/bindings/msg_user_message.ts +7 -0
  56. package/src/bindings/normal_cell_id.ts +6 -0
  57. package/src/bindings/pattern_fill.ts +9 -0
  58. package/src/bindings/payloads_action.ts +15 -0
  59. package/src/bindings/recalc_cell.ts +7 -0
  60. package/src/bindings/remove_block.ts +6 -0
  61. package/src/bindings/row_info.ts +7 -0
  62. package/src/bindings/set_col_width.ts +7 -0
  63. package/src/bindings/set_row_height.ts +7 -0
  64. package/src/bindings/set_visible.ts +8 -0
  65. package/src/bindings/sheet_blocks.ts +7 -0
  66. package/src/bindings/sheet_col_info.ts +8 -0
  67. package/src/bindings/sheet_comments.ts +7 -0
  68. package/src/bindings/sheet_merge_cells.ts +7 -0
  69. package/src/bindings/sheet_names.ts +5 -0
  70. package/src/bindings/sheet_rename.ts +8 -0
  71. package/src/bindings/sheet_row_info.ts +8 -0
  72. package/src/bindings/sheet_styles.ts +7 -0
  73. package/src/bindings/sheet_values.ts +7 -0
  74. package/src/bindings/st_border_style.ts +17 -0
  75. package/src/bindings/st_font_scheme.ts +6 -0
  76. package/src/bindings/st_gradient_type.ts +6 -0
  77. package/src/bindings/st_horizontal_alignment.ts +12 -0
  78. package/src/bindings/st_pattern_type.ts +23 -0
  79. package/src/bindings/st_underline_values.ts +9 -0
  80. package/src/bindings/st_vertical_align_run.ts +7 -0
  81. package/src/bindings/st_vertical_alignment.ts +9 -0
  82. package/src/bindings/status_code.ts +5 -0
  83. package/src/bindings/style.ts +15 -0
  84. package/src/bindings/style_update.ts +9 -0
  85. package/src/bindings/style_update_type.ts +29 -0
  86. package/src/bindings/task.ts +6 -0
  87. package/src/bindings/underline_property.ts +6 -0
  88. package/src/bindings/value.ts +8 -0
  89. package/src/bindings/vertical_align_font_property.ts +6 -0
  90. package/src/bindings/workbook_file.ts +6 -0
  91. package/src/index.ts +42 -0
  92. package/src/payloads/block_input.ts +54 -0
  93. package/src/payloads/cell_input.ts +44 -0
  94. package/src/payloads/create_block.ts +78 -0
  95. package/src/payloads/delete_block_cols.ts +44 -0
  96. package/src/payloads/delete_block_rows.ts +44 -0
  97. package/src/payloads/delete_cols.ts +37 -0
  98. package/src/payloads/delete_rows.ts +37 -0
  99. package/src/payloads/delete_sheet.ts +19 -0
  100. package/src/payloads/index.ts +66 -0
  101. package/src/payloads/insert_block_cols.ts +44 -0
  102. package/src/payloads/insert_block_rows.ts +44 -0
  103. package/src/payloads/insert_cols.ts +35 -0
  104. package/src/payloads/insert_rows.ts +36 -0
  105. package/src/payloads/insert_sheet.ts +27 -0
  106. package/src/payloads/move_block.ts +45 -0
  107. package/src/payloads/set_border.ts +113 -0
  108. package/src/payloads/set_col_visible.ts +35 -0
  109. package/src/payloads/set_col_width.ts +35 -0
  110. package/src/payloads/set_font.ts +107 -0
  111. package/src/payloads/set_row_height.ts +35 -0
  112. package/src/payloads/set_row_visible.ts +35 -0
  113. package/src/payloads/sheet_rename.ts +35 -0
  114. package/src/transactions.ts +14 -0
  115. package/wasm/.gitignore +1 -0
  116. package/wasm/logisheets_wasm_server.d.ts +255 -0
  117. package/wasm/logisheets_wasm_server.js +946 -0
  118. package/wasm/logisheets_wasm_server_bg.wasm +0 -0
  119. package/wasm/logisheets_wasm_server_bg.wasm.d.ts +40 -0
  120. package/wasm/package.json +14 -0
@@ -0,0 +1,45 @@
1
+ export interface MoveBlock {
2
+ readonly type: 'moveBlock'
3
+ readonly sheetIdx: number
4
+ readonly blockId: number
5
+ readonly newMasterRow: number
6
+ readonly newMasterCol: number
7
+ }
8
+
9
+ export class MoveBlockBuilder {
10
+ private _sheetIdx?: number
11
+ private _blockId?: number
12
+ private _newMasterRow?: number
13
+ private _newMasterCol?: number
14
+ public sheetIdx(sheetIdx: number): this {
15
+ this._sheetIdx = sheetIdx
16
+ return this
17
+ }
18
+ public blockId(blockId: number): this {
19
+ this._blockId = blockId
20
+ return this
21
+ }
22
+ public newMasterRow(newMasterRow: number): this {
23
+ this._newMasterRow = newMasterRow
24
+ return this
25
+ }
26
+ public newMasterCol(newMasterCol: number): this {
27
+ this._newMasterCol = newMasterCol
28
+ return this
29
+ }
30
+ public build(): MoveBlock {
31
+ if (this._sheetIdx === undefined) throw Error('sheetIdx is undefined!')
32
+ if (this._blockId === undefined) throw Error('blockId is undefined!')
33
+ if (this._newMasterRow === undefined)
34
+ throw Error('newMasterRow is undefined!')
35
+ if (this._newMasterCol === undefined)
36
+ throw Error('newMasterCol is undefined!')
37
+ return {
38
+ type: 'moveBlock',
39
+ sheetIdx: this._sheetIdx,
40
+ blockId: this._blockId,
41
+ newMasterRow: this._newMasterRow,
42
+ newMasterCol: this._newMasterCol,
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,113 @@
1
+ import {StBorderStyle} from '../bindings'
2
+ export interface SetBorder {
3
+ readonly type: 'setBorder'
4
+ readonly sheetIdx: number
5
+ readonly row: number
6
+ readonly col: number
7
+ readonly leftColor?: string
8
+ readonly rightColor?: string
9
+ readonly topColor?: string
10
+ readonly bottomColor?: string
11
+ readonly leftBorderType?: StBorderStyle
12
+ readonly rightBorderType?: StBorderStyle
13
+ readonly topBorderType?: StBorderStyle
14
+ readonly bottomBorderType?: StBorderStyle
15
+ readonly outline?: boolean
16
+ readonly diagonalUp?: boolean
17
+ readonly diagonalDown?: boolean
18
+ }
19
+
20
+ export class SetBorderBuilder {
21
+ private _sheetIdx?: number
22
+ private _row?: number
23
+ private _col?: number
24
+ private _leftColor?: string
25
+ private _rightColor?: string
26
+ private _topColor?: string
27
+ private _bottomColor?: string
28
+ private _leftBorderType?: StBorderStyle
29
+ private _rightBorderType?: StBorderStyle
30
+ private _topBorderType?: StBorderStyle
31
+ private _bottomBorderType?: StBorderStyle
32
+ private _outline?: boolean
33
+ private _diagonalUp?: boolean
34
+ private _diagonalDown?: boolean
35
+ public sheetIdx(sheetIdx: number): this {
36
+ this._sheetIdx = sheetIdx
37
+ return this
38
+ }
39
+ public row(row: number): this {
40
+ this._row = row
41
+ return this
42
+ }
43
+ public col(col: number): this {
44
+ this._col = col
45
+ return this
46
+ }
47
+ public leftColor(leftColor: string): this {
48
+ this._leftColor = leftColor
49
+ return this
50
+ }
51
+ public rightColor(rightColor: string): this {
52
+ this._rightColor = rightColor
53
+ return this
54
+ }
55
+ public topColor(topColor: string): this {
56
+ this._topColor = topColor
57
+ return this
58
+ }
59
+ public bottomColor(bottomColor: string): this {
60
+ this._bottomColor = bottomColor
61
+ return this
62
+ }
63
+ public leftBorderType(leftBorderType: StBorderStyle): this {
64
+ this._leftBorderType = leftBorderType
65
+ return this
66
+ }
67
+ public rightBorderType(rightBorderType: StBorderStyle): this {
68
+ this._rightBorderType = rightBorderType
69
+ return this
70
+ }
71
+ public topBorderType(topBorderType: StBorderStyle): this {
72
+ this._topBorderType = topBorderType
73
+ return this
74
+ }
75
+ public bottomBorderType(bottomBorderType: StBorderStyle): this {
76
+ this._bottomBorderType = bottomBorderType
77
+ return this
78
+ }
79
+ public outline(outline: boolean): this {
80
+ this._outline = outline
81
+ return this
82
+ }
83
+ public diagonalUp(diagonalUp: boolean): this {
84
+ this._diagonalUp = diagonalUp
85
+ return this
86
+ }
87
+ public diagonalDown(diagonalDown: boolean): this {
88
+ this._diagonalDown = diagonalDown
89
+ return this
90
+ }
91
+ public build(): SetBorder {
92
+ if (this._sheetIdx === undefined) throw Error('sheetIdx is undefined')
93
+ if (this._row === undefined) throw Error('row is undefined!')
94
+ if (this._col === undefined) throw Error('col is undefined!')
95
+ return {
96
+ type: 'setBorder',
97
+ sheetIdx: this._sheetIdx,
98
+ row: this._row,
99
+ col: this._col,
100
+ leftColor: this._leftColor,
101
+ rightColor: this._rightColor,
102
+ topColor: this._topColor,
103
+ bottomColor: this._bottomColor,
104
+ leftBorderType: this._leftBorderType,
105
+ rightBorderType: this._rightBorderType,
106
+ topBorderType: this._topBorderType,
107
+ bottomBorderType: this._bottomBorderType,
108
+ outline: this._outline,
109
+ diagonalUp: this._diagonalUp,
110
+ diagonalDown: this._diagonalDown,
111
+ }
112
+ }
113
+ }
@@ -0,0 +1,35 @@
1
+ export interface SetColVisible {
2
+ readonly type: 'setColVisible'
3
+ readonly sheetIdx: number
4
+ readonly col: number
5
+ readonly visible: boolean
6
+ }
7
+
8
+ export class SetColVisibleBuilder {
9
+ private _sheetIdx?: number
10
+ private _col?: number
11
+ private _visible?: boolean
12
+ public sheetIdx(sheetIdx: number): this {
13
+ this._sheetIdx = sheetIdx
14
+ return this
15
+ }
16
+ public col(col: number): this {
17
+ this._col = col
18
+ return this
19
+ }
20
+ public visible(visible: boolean): this {
21
+ this._visible = visible
22
+ return this
23
+ }
24
+ public build(): SetColVisible {
25
+ if (this._sheetIdx === undefined) throw Error('sheetIdx is undefined!')
26
+ if (this._col === undefined) throw Error('col is undefined!')
27
+ if (this._visible === undefined) throw Error('visible is undefined!')
28
+ return {
29
+ type: 'setColVisible',
30
+ sheetIdx: this._sheetIdx,
31
+ col: this._col,
32
+ visible: this._visible,
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,35 @@
1
+ export interface SetColWidth {
2
+ readonly type: 'setColWidth'
3
+ readonly sheetIdx: number
4
+ readonly col: number
5
+ readonly width: number
6
+ }
7
+
8
+ export class SetColWidthBuilder {
9
+ private _sheetIdx?: number
10
+ private _col?: number
11
+ private _width?: number
12
+ public sheetIdx(sheetIdx: number): this {
13
+ this._sheetIdx = sheetIdx
14
+ return this
15
+ }
16
+ public col(col: number): this {
17
+ this._col = col
18
+ return this
19
+ }
20
+ public width(width: number): this {
21
+ this._width = width
22
+ return this
23
+ }
24
+ public build(): SetColWidth {
25
+ if (this._sheetIdx === undefined) throw Error('sheetIdx is undefined!')
26
+ if (this._col === undefined) throw Error('col is undefined!')
27
+ if (this._width === undefined) throw Error('width is undefined!')
28
+ return {
29
+ type: 'setColWidth',
30
+ sheetIdx: this._sheetIdx,
31
+ col: this._col,
32
+ width: this._width,
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,107 @@
1
+ import {StUnderlineValues as UnderlineType} from '../bindings'
2
+
3
+ export interface SetFont {
4
+ readonly type: 'setFont'
5
+ readonly sheetIdx: number
6
+ readonly row: number
7
+ readonly col: number
8
+ readonly bold?: boolean
9
+ readonly italic?: boolean
10
+ readonly name?: string
11
+ readonly underline?: UnderlineType
12
+ readonly color?: string
13
+ readonly size?: number
14
+ readonly outline?: boolean
15
+ readonly shadow?: boolean
16
+ readonly strike?: boolean
17
+ readonly condense?: boolean
18
+ }
19
+
20
+ export class SetFontBuilder {
21
+ private _sheetIdx?: number
22
+ private _row?: number
23
+ private _col?: number
24
+ private _bold?: boolean
25
+ private _italic?: boolean
26
+ private _name?: string
27
+ private _underline?: UnderlineType
28
+ private _color?: string
29
+ private _size?: number
30
+ private _outline?: boolean
31
+ private _shadow?: boolean
32
+ private _strike?: boolean
33
+ private _condense?: boolean
34
+ public sheetIdx(sheetIdx: number): this {
35
+ this._sheetIdx = sheetIdx
36
+ return this
37
+ }
38
+ public row(row: number): this {
39
+ this._row = row
40
+ return this
41
+ }
42
+ public col(col: number): this {
43
+ this._col = col
44
+ return this
45
+ }
46
+ public bold(bold: boolean): this {
47
+ this._bold = bold
48
+ return this
49
+ }
50
+ public italic(italic: boolean): this {
51
+ this._italic = italic
52
+ return this
53
+ }
54
+ public name(name: string): this {
55
+ this._name = name
56
+ return this
57
+ }
58
+ public underline(underline: UnderlineType): this {
59
+ this._underline = underline
60
+ return this
61
+ }
62
+ public color(color: string): this {
63
+ this._color = color
64
+ return this
65
+ }
66
+ public size(size: number): this {
67
+ this._size = size
68
+ return this
69
+ }
70
+ public outline(outline: boolean): this {
71
+ this._outline = outline
72
+ return this
73
+ }
74
+ public shadow(shadow: boolean): this {
75
+ this._shadow = shadow
76
+ return this
77
+ }
78
+ public strike(strike: boolean): this {
79
+ this._strike = strike
80
+ return this
81
+ }
82
+ public condense(condense: boolean): this {
83
+ this._condense = condense
84
+ return this
85
+ }
86
+ public build(): SetFont {
87
+ if (this._sheetIdx === undefined) throw Error('sheetIdx is undefined!')
88
+ if (this._row === undefined) throw Error('row is undefined!')
89
+ if (this._col === undefined) throw Error('col is undefined!')
90
+ return {
91
+ type: 'setFont',
92
+ sheetIdx: this._sheetIdx,
93
+ row: this._row,
94
+ col: this._col,
95
+ bold: this._bold,
96
+ italic: this._italic,
97
+ underline: this._underline,
98
+ color: this._color,
99
+ size: this._size,
100
+ outline: this._outline,
101
+ shadow: this._shadow,
102
+ strike: this._strike,
103
+ condense: this._condense,
104
+ name: this._name,
105
+ }
106
+ }
107
+ }
@@ -0,0 +1,35 @@
1
+ export interface SetRowHeight {
2
+ readonly type: 'setRowHeight'
3
+ readonly sheetIdx: number
4
+ readonly row: number
5
+ readonly height: number
6
+ }
7
+
8
+ export class SetRowHeightBuilder {
9
+ private _sheetIdx?: number
10
+ private _row?: number
11
+ private _height?: number
12
+ public sheetIdx(sheetIdx: number): this {
13
+ this._sheetIdx = sheetIdx
14
+ return this
15
+ }
16
+ public row(row: number): this {
17
+ this._row = row
18
+ return this
19
+ }
20
+ public height(height: number): this {
21
+ this._height = height
22
+ return this
23
+ }
24
+ public build(): SetRowHeight {
25
+ if (this._sheetIdx === undefined) throw Error('sheetIdx is undefined!')
26
+ if (this._row === undefined) throw Error('row is undefined!')
27
+ if (this._height === undefined) throw Error('height is undefined!')
28
+ return {
29
+ type: 'setRowHeight',
30
+ sheetIdx: this._sheetIdx,
31
+ row: this._row,
32
+ height: this._height,
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,35 @@
1
+ export interface SetRowVisible {
2
+ readonly type: 'setRowVisible'
3
+ readonly sheetIdx: number
4
+ readonly row: number
5
+ readonly visible: boolean
6
+ }
7
+
8
+ export class SetRowVisibleBuilder {
9
+ private _sheetIdx?: number
10
+ private _row?: number
11
+ private _visible?: boolean
12
+ public sheetIdx(sheetIdx: number): this {
13
+ this._sheetIdx = sheetIdx
14
+ return this
15
+ }
16
+ public row(row: number): this {
17
+ this._row = row
18
+ return this
19
+ }
20
+ public visible(visible: boolean): this {
21
+ this._visible = visible
22
+ return this
23
+ }
24
+ public build(): SetRowVisible {
25
+ if (this._sheetIdx === undefined) throw Error('sheetIdx is undefined!')
26
+ if (this._row === undefined) throw Error('row is undefined!')
27
+ if (this._visible === undefined) throw Error('visible is undefined!')
28
+ return {
29
+ type: 'setRowVisible',
30
+ sheetIdx: this._sheetIdx,
31
+ row: this._row,
32
+ visible: this._visible,
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,35 @@
1
+ export interface SheetRename {
2
+ readonly type: 'sheetRename'
3
+ readonly oldName?: string
4
+ readonly idx?: number
5
+ readonly newName: string
6
+ }
7
+
8
+ export class SheetRenameBuilder {
9
+ private _oldName?: string
10
+ private _newName?: string
11
+ private _idx?: number
12
+ public oldName(oldName: string): this {
13
+ this._oldName = oldName
14
+ return this
15
+ }
16
+ public newName(newName: string): this {
17
+ this._newName = newName
18
+ return this
19
+ }
20
+ public idx(idx: number): this {
21
+ this._idx = idx
22
+ return this
23
+ }
24
+ public build(): SheetRename {
25
+ if (this._newName === undefined) throw Error('newName is undefined!')
26
+ if (this._idx === undefined && this._oldName === undefined)
27
+ throw Error('neither sheetIdx or oldName is defined')
28
+ return {
29
+ type: 'sheetRename',
30
+ oldName: this._oldName,
31
+ newName: this._newName,
32
+ idx: this._idx,
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,14 @@
1
+ import {Payload} from './payloads'
2
+
3
+ export class Transaction {
4
+ public constructor(payloads: Payload[], public readonly undoable: boolean) {
5
+ this.payloads = payloads
6
+ }
7
+
8
+ public addPayload(p: Payload): Transaction {
9
+ this.payloads.push(p)
10
+ return this
11
+ }
12
+
13
+ public payloads: Payload[] = []
14
+ }
@@ -0,0 +1 @@
1
+ *