@trebco/treb 23.6.5 → 25.0.0-rc2

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 (217) hide show
  1. package/.eslintignore +8 -0
  2. package/.eslintrc.js +164 -0
  3. package/README-shadow-DOM.md +88 -0
  4. package/README.md +37 -130
  5. package/api-config.json +29 -0
  6. package/api-generator/api-generator-types.ts +82 -0
  7. package/api-generator/api-generator.ts +1172 -0
  8. package/api-generator/package.json +3 -0
  9. package/build/treb-spreadsheet.mjs +14 -0
  10. package/{treb.d.ts → build/treb.d.ts} +323 -271
  11. package/esbuild-custom-element.mjs +336 -0
  12. package/esbuild.js +305 -0
  13. package/package.json +49 -14
  14. package/treb-base-types/package.json +5 -0
  15. package/treb-base-types/src/api_types.ts +36 -0
  16. package/treb-base-types/src/area.ts +583 -0
  17. package/treb-base-types/src/basic_types.ts +45 -0
  18. package/treb-base-types/src/cell.ts +612 -0
  19. package/treb-base-types/src/cells.ts +1066 -0
  20. package/treb-base-types/src/color.ts +124 -0
  21. package/treb-base-types/src/import.ts +71 -0
  22. package/treb-base-types/src/index-standalone.ts +29 -0
  23. package/treb-base-types/src/index.ts +42 -0
  24. package/treb-base-types/src/layout.ts +47 -0
  25. package/treb-base-types/src/localization.ts +187 -0
  26. package/treb-base-types/src/rectangle.ts +145 -0
  27. package/treb-base-types/src/render_text.ts +72 -0
  28. package/treb-base-types/src/style.ts +545 -0
  29. package/treb-base-types/src/table.ts +109 -0
  30. package/treb-base-types/src/text_part.ts +54 -0
  31. package/treb-base-types/src/theme.ts +608 -0
  32. package/treb-base-types/src/union.ts +152 -0
  33. package/treb-base-types/src/value-type.ts +164 -0
  34. package/treb-base-types/style/resizable.css +59 -0
  35. package/treb-calculator/modern.tsconfig.json +11 -0
  36. package/treb-calculator/package.json +5 -0
  37. package/treb-calculator/src/calculator.ts +2546 -0
  38. package/treb-calculator/src/complex-math.ts +558 -0
  39. package/treb-calculator/src/dag/array-vertex.ts +198 -0
  40. package/treb-calculator/src/dag/graph.ts +951 -0
  41. package/treb-calculator/src/dag/leaf_vertex.ts +118 -0
  42. package/treb-calculator/src/dag/spreadsheet_vertex.ts +327 -0
  43. package/treb-calculator/src/dag/spreadsheet_vertex_base.ts +44 -0
  44. package/treb-calculator/src/dag/vertex.ts +352 -0
  45. package/treb-calculator/src/descriptors.ts +162 -0
  46. package/treb-calculator/src/expression-calculator.ts +1069 -0
  47. package/treb-calculator/src/function-error.ts +103 -0
  48. package/treb-calculator/src/function-library.ts +103 -0
  49. package/treb-calculator/src/functions/base-functions.ts +1214 -0
  50. package/treb-calculator/src/functions/checkbox.ts +164 -0
  51. package/treb-calculator/src/functions/complex-functions.ts +253 -0
  52. package/treb-calculator/src/functions/finance-functions.ts +399 -0
  53. package/treb-calculator/src/functions/information-functions.ts +102 -0
  54. package/treb-calculator/src/functions/matrix-functions.ts +182 -0
  55. package/treb-calculator/src/functions/sparkline.ts +335 -0
  56. package/treb-calculator/src/functions/statistics-functions.ts +350 -0
  57. package/treb-calculator/src/functions/text-functions.ts +298 -0
  58. package/treb-calculator/src/index.ts +27 -0
  59. package/treb-calculator/src/notifier-types.ts +59 -0
  60. package/treb-calculator/src/primitives.ts +428 -0
  61. package/treb-calculator/src/utilities.ts +305 -0
  62. package/treb-charts/package.json +5 -0
  63. package/treb-charts/src/chart-functions.ts +156 -0
  64. package/treb-charts/src/chart-types.ts +230 -0
  65. package/treb-charts/src/chart.ts +1288 -0
  66. package/treb-charts/src/index.ts +24 -0
  67. package/treb-charts/src/main.ts +37 -0
  68. package/treb-charts/src/rectangle.ts +52 -0
  69. package/treb-charts/src/renderer.ts +1841 -0
  70. package/treb-charts/src/util.ts +122 -0
  71. package/treb-charts/style/charts.scss +221 -0
  72. package/treb-charts/style/old-charts.scss +250 -0
  73. package/treb-embed/markup/layout.html +137 -0
  74. package/treb-embed/markup/toolbar.html +175 -0
  75. package/treb-embed/modern.tsconfig.json +25 -0
  76. package/treb-embed/src/custom-element/content-types.d.ts +18 -0
  77. package/treb-embed/src/custom-element/global.d.ts +11 -0
  78. package/treb-embed/src/custom-element/spreadsheet-constructor.ts +1228 -0
  79. package/treb-embed/src/custom-element/treb-global.ts +44 -0
  80. package/treb-embed/src/custom-element/treb-spreadsheet-element.ts +52 -0
  81. package/treb-embed/src/embedded-spreadsheet.ts +5358 -0
  82. package/treb-embed/src/index.ts +16 -0
  83. package/treb-embed/src/language-model.ts +41 -0
  84. package/treb-embed/src/options.ts +298 -0
  85. package/treb-embed/src/progress-dialog.ts +228 -0
  86. package/treb-embed/src/selection-state.ts +16 -0
  87. package/treb-embed/src/spinner.ts +42 -0
  88. package/treb-embed/src/toolbar-message.ts +96 -0
  89. package/treb-embed/src/types.ts +167 -0
  90. package/treb-embed/style/autocomplete.scss +103 -0
  91. package/treb-embed/style/dark-theme.scss +114 -0
  92. package/treb-embed/style/defaults.scss +36 -0
  93. package/treb-embed/style/dialog.scss +181 -0
  94. package/treb-embed/style/dropdown-select.scss +101 -0
  95. package/treb-embed/style/formula-bar.scss +193 -0
  96. package/treb-embed/style/grid.scss +374 -0
  97. package/treb-embed/style/layout.scss +424 -0
  98. package/treb-embed/style/mouse-mask.scss +67 -0
  99. package/treb-embed/style/note.scss +92 -0
  100. package/treb-embed/style/overlay-editor.scss +102 -0
  101. package/treb-embed/style/spinner.scss +92 -0
  102. package/treb-embed/style/tab-bar.scss +228 -0
  103. package/treb-embed/style/table.scss +80 -0
  104. package/treb-embed/style/theme-defaults.scss +444 -0
  105. package/treb-embed/style/toolbar.scss +416 -0
  106. package/treb-embed/style/tooltip.scss +68 -0
  107. package/treb-embed/style/treb-icons.scss +130 -0
  108. package/treb-embed/style/treb-spreadsheet-element.scss +20 -0
  109. package/treb-embed/style/z-index.scss +43 -0
  110. package/treb-export/docs/charts.md +68 -0
  111. package/treb-export/modern.tsconfig.json +19 -0
  112. package/treb-export/package.json +4 -0
  113. package/treb-export/src/address-type.ts +77 -0
  114. package/treb-export/src/base-template.ts +22 -0
  115. package/treb-export/src/column-width.ts +85 -0
  116. package/treb-export/src/drawing2/chart-template-components2.ts +389 -0
  117. package/treb-export/src/drawing2/chart2.ts +282 -0
  118. package/treb-export/src/drawing2/column-chart-template2.ts +521 -0
  119. package/treb-export/src/drawing2/donut-chart-template2.ts +296 -0
  120. package/treb-export/src/drawing2/drawing2.ts +355 -0
  121. package/treb-export/src/drawing2/embedded-image.ts +71 -0
  122. package/treb-export/src/drawing2/scatter-chart-template2.ts +555 -0
  123. package/treb-export/src/export-worker/export-worker.ts +99 -0
  124. package/treb-export/src/export-worker/index-modern.ts +22 -0
  125. package/treb-export/src/export2.ts +2204 -0
  126. package/treb-export/src/import2.ts +882 -0
  127. package/treb-export/src/relationship.ts +36 -0
  128. package/treb-export/src/shared-strings2.ts +128 -0
  129. package/treb-export/src/template-2.ts +22 -0
  130. package/treb-export/src/unescape_xml.ts +47 -0
  131. package/treb-export/src/workbook-sheet2.ts +182 -0
  132. package/treb-export/src/workbook-style2.ts +1285 -0
  133. package/treb-export/src/workbook-theme2.ts +88 -0
  134. package/treb-export/src/workbook2.ts +491 -0
  135. package/treb-export/src/xml-utils.ts +201 -0
  136. package/treb-export/template/base/[Content_Types].xml +2 -0
  137. package/treb-export/template/base/_rels/.rels +2 -0
  138. package/treb-export/template/base/docProps/app.xml +2 -0
  139. package/treb-export/template/base/docProps/core.xml +12 -0
  140. package/treb-export/template/base/xl/_rels/workbook.xml.rels +2 -0
  141. package/treb-export/template/base/xl/sharedStrings.xml +2 -0
  142. package/treb-export/template/base/xl/styles.xml +2 -0
  143. package/treb-export/template/base/xl/theme/theme1.xml +2 -0
  144. package/treb-export/template/base/xl/workbook.xml +2 -0
  145. package/treb-export/template/base/xl/worksheets/sheet1.xml +2 -0
  146. package/treb-export/template/base.xlsx +0 -0
  147. package/treb-format/package.json +8 -0
  148. package/treb-format/src/format.test.ts +213 -0
  149. package/treb-format/src/format.ts +942 -0
  150. package/treb-format/src/format_cache.ts +199 -0
  151. package/treb-format/src/format_parser.ts +723 -0
  152. package/treb-format/src/index.ts +25 -0
  153. package/treb-format/src/number_format_section.ts +100 -0
  154. package/treb-format/src/value_parser.ts +337 -0
  155. package/treb-grid/package.json +5 -0
  156. package/treb-grid/src/editors/autocomplete.ts +394 -0
  157. package/treb-grid/src/editors/autocomplete_matcher.ts +260 -0
  158. package/treb-grid/src/editors/formula_bar.ts +473 -0
  159. package/treb-grid/src/editors/formula_editor_base.ts +910 -0
  160. package/treb-grid/src/editors/overlay_editor.ts +511 -0
  161. package/treb-grid/src/index.ts +37 -0
  162. package/treb-grid/src/layout/base_layout.ts +2618 -0
  163. package/treb-grid/src/layout/grid_layout.ts +299 -0
  164. package/treb-grid/src/layout/rectangle_cache.ts +86 -0
  165. package/treb-grid/src/render/selection-renderer.ts +414 -0
  166. package/treb-grid/src/render/svg_header_overlay.ts +93 -0
  167. package/treb-grid/src/render/svg_selection_block.ts +187 -0
  168. package/treb-grid/src/render/tile_renderer.ts +2122 -0
  169. package/treb-grid/src/types/annotation.ts +216 -0
  170. package/treb-grid/src/types/border_constants.ts +34 -0
  171. package/treb-grid/src/types/clipboard_data.ts +31 -0
  172. package/treb-grid/src/types/data_model.ts +334 -0
  173. package/treb-grid/src/types/drag_mask.ts +81 -0
  174. package/treb-grid/src/types/grid.ts +7743 -0
  175. package/treb-grid/src/types/grid_base.ts +3644 -0
  176. package/treb-grid/src/types/grid_command.ts +470 -0
  177. package/treb-grid/src/types/grid_events.ts +124 -0
  178. package/treb-grid/src/types/grid_options.ts +97 -0
  179. package/treb-grid/src/types/grid_selection.ts +60 -0
  180. package/treb-grid/src/types/named_range.ts +369 -0
  181. package/treb-grid/src/types/scale-control.ts +202 -0
  182. package/treb-grid/src/types/serialize_options.ts +72 -0
  183. package/treb-grid/src/types/set_range_options.ts +52 -0
  184. package/treb-grid/src/types/sheet.ts +3099 -0
  185. package/treb-grid/src/types/sheet_types.ts +95 -0
  186. package/treb-grid/src/types/tab_bar.ts +464 -0
  187. package/treb-grid/src/types/tile.ts +59 -0
  188. package/treb-grid/src/types/update_flags.ts +75 -0
  189. package/treb-grid/src/util/dom_utilities.ts +44 -0
  190. package/treb-grid/src/util/fontmetrics2.ts +179 -0
  191. package/treb-grid/src/util/ua.ts +104 -0
  192. package/treb-logo.svg +18 -0
  193. package/treb-parser/package.json +5 -0
  194. package/treb-parser/src/csv-parser.ts +122 -0
  195. package/treb-parser/src/index.ts +25 -0
  196. package/treb-parser/src/md-parser.ts +526 -0
  197. package/treb-parser/src/parser-types.ts +397 -0
  198. package/treb-parser/src/parser.test.ts +298 -0
  199. package/treb-parser/src/parser.ts +2673 -0
  200. package/treb-utils/package.json +5 -0
  201. package/treb-utils/src/dispatch.ts +57 -0
  202. package/treb-utils/src/event_source.ts +147 -0
  203. package/treb-utils/src/ievent_source.ts +33 -0
  204. package/treb-utils/src/index.ts +31 -0
  205. package/treb-utils/src/measurement.ts +174 -0
  206. package/treb-utils/src/resizable.ts +160 -0
  207. package/treb-utils/src/scale.ts +137 -0
  208. package/treb-utils/src/serialize_html.ts +124 -0
  209. package/treb-utils/src/template.ts +70 -0
  210. package/treb-utils/src/validate_uri.ts +61 -0
  211. package/tsconfig.json +10 -0
  212. package/tsproject.json +30 -0
  213. package/util/license-plugin-esbuild.js +86 -0
  214. package/util/list-css-vars.sh +46 -0
  215. package/README-esm.md +0 -37
  216. package/treb-bundle.css +0 -2
  217. package/treb-bundle.mjs +0 -15
@@ -0,0 +1,71 @@
1
+ /*
2
+ * This file is part of TREB.
3
+ *
4
+ * TREB is free software: you can redistribute it and/or modify it under the
5
+ * terms of the GNU General Public License as published by the Free Software
6
+ * Foundation, either version 3 of the License, or (at your option) any
7
+ * later version.
8
+ *
9
+ * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
+ * details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License along
15
+ * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
+ *
17
+ * Copyright 2022-2023 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+
22
+ export interface ImageOptions {
23
+ // ...
24
+ data?: string;
25
+ encoding?: 'base64';
26
+ mimetype?: string;
27
+ }
28
+
29
+ export class EmbeddedImage {
30
+
31
+ public static next_image_index = 1;
32
+ public extension = '';
33
+
34
+ constructor(public options: ImageOptions, public index = EmbeddedImage.next_image_index++) {
35
+
36
+ switch (options.mimetype) {
37
+
38
+ case 'svg+xml':
39
+ this.extension = 'svg';
40
+ break;
41
+
42
+ case 'image/png':
43
+ this.extension = 'png';
44
+ break;
45
+
46
+ case 'jpg':
47
+ this.extension = 'jpeg';
48
+ break;
49
+
50
+ case 'svg':
51
+ case 'png':
52
+ case 'jpeg':
53
+ case 'gif':
54
+ this.extension = options.mimetype;
55
+ break;
56
+
57
+ //case 'webp':
58
+ // this.extension = 'bin';
59
+ // break;
60
+
61
+ default:
62
+ console.warn('unhandled mime type', options.mimetype);
63
+ break;
64
+
65
+ }
66
+
67
+ }
68
+
69
+
70
+
71
+ }
@@ -0,0 +1,555 @@
1
+ /*
2
+ * This file is part of TREB.
3
+ *
4
+ * TREB is free software: you can redistribute it and/or modify it under the
5
+ * terms of the GNU General Public License as published by the Free Software
6
+ * Foundation, either version 3 of the License, or (at your option) any
7
+ * later version.
8
+ *
9
+ * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
+ * details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License along
15
+ * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
+ *
17
+ * Copyright 2022-2023 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+
22
+ export const scatter_json =
23
+ {
24
+ 'c:title': {},
25
+ 'c:autoTitleDeleted': {
26
+ a$: {
27
+ 'val': '0'
28
+ }
29
+ },
30
+ 'c:plotArea': {
31
+ 'c:layout': {},
32
+ 'c:scatterChart': {
33
+ 'c:scatterStyle': {
34
+ a$: {
35
+ 'val': 'lineMarker'
36
+ }
37
+ },
38
+ 'c:varyColors': {
39
+ a$: {
40
+ 'val': '0'
41
+ }
42
+ },
43
+ 'c:ser': [],
44
+ 'c:dLbls': {
45
+ 'c:showLegendKey': {
46
+ a$: {
47
+ 'val': '0'
48
+ }
49
+ },
50
+ 'c:showVal': {
51
+ a$: {
52
+ 'val': '0'
53
+ }
54
+ },
55
+ 'c:showCatName': {
56
+ a$: {
57
+ 'val': '0'
58
+ }
59
+ },
60
+ 'c:showSerName': {
61
+ a$: {
62
+ 'val': '0'
63
+ }
64
+ },
65
+ 'c:showPercent': {
66
+ a$: {
67
+ 'val': '0'
68
+ }
69
+ },
70
+ 'c:showBubbleSize': {
71
+ a$: {
72
+ 'val': '0'
73
+ }
74
+ }
75
+ },
76
+ 'c:axId': [
77
+ {
78
+ a$: {
79
+ 'val': '2028657983'
80
+ }
81
+ },
82
+ {
83
+ a$: {
84
+ 'val': '2023395087'
85
+ }
86
+ }
87
+ ]
88
+ },
89
+ 'c:valAx': [
90
+ {
91
+ 'c:axId': {
92
+ a$: {
93
+ 'val': '2028657983'
94
+ }
95
+ },
96
+ 'c:scaling': {
97
+ 'c:orientation': {
98
+ a$: {
99
+ 'val': 'minMax'
100
+ }
101
+ }
102
+ },
103
+ 'c:delete': {
104
+ a$: {
105
+ 'val': '0'
106
+ }
107
+ },
108
+ 'c:axPos': {
109
+ a$: {
110
+ 'val': 'b'
111
+ }
112
+ },
113
+ 'c:majorGridlines': {
114
+ 'c:spPr': {
115
+ 'a:ln': {
116
+ a$: {
117
+ 'w': '9525',
118
+ 'cap': 'flat',
119
+ 'cmpd': 'sng',
120
+ 'algn': 'ctr'
121
+ },
122
+ 'a:solidFill': {
123
+ 'a:schemeClr': {
124
+ a$: {
125
+ 'val': 'tx1'
126
+ },
127
+ 'a:lumMod': {
128
+ a$: {
129
+ 'val': '15000'
130
+ }
131
+ },
132
+ 'a:lumOff': {
133
+ a$: {
134
+ 'val': '85000'
135
+ }
136
+ }
137
+ }
138
+ },
139
+ 'a:round': {}
140
+ },
141
+ 'a:effectLst': {}
142
+ }
143
+ },
144
+ 'c:majorTickMark': {
145
+ a$: {
146
+ 'val': 'none'
147
+ }
148
+ },
149
+ 'c:minorTickMark': {
150
+ a$: {
151
+ 'val': 'none'
152
+ }
153
+ },
154
+ 'c:tickLblPos': {
155
+ a$: {
156
+ 'val': 'nextTo'
157
+ }
158
+ },
159
+ 'c:spPr': {
160
+ 'a:noFill': {},
161
+ 'a:ln': {
162
+ a$: {
163
+ 'w': '9525',
164
+ 'cap': 'flat',
165
+ 'cmpd': 'sng',
166
+ 'algn': 'ctr'
167
+ },
168
+ 'a:solidFill': {
169
+ 'a:schemeClr': {
170
+ a$: {
171
+ 'val': 'tx1'
172
+ },
173
+ 'a:lumMod': {
174
+ a$: {
175
+ 'val': '25000'
176
+ }
177
+ },
178
+ 'a:lumOff': {
179
+ a$: {
180
+ 'val': '75000'
181
+ }
182
+ }
183
+ }
184
+ },
185
+ 'a:round': {}
186
+ },
187
+ 'a:effectLst': {}
188
+ },
189
+ 'c:txPr': {
190
+ 'a:bodyPr': {
191
+ a$: {
192
+ 'rot': '-60000000',
193
+ 'spcFirstLastPara': '1',
194
+ 'vertOverflow': 'ellipsis',
195
+ 'vert': 'horz',
196
+ 'wrap': 'square',
197
+ 'anchor': 'ctr',
198
+ 'anchorCtr': '1'
199
+ }
200
+ },
201
+ 'a:lstStyle': {},
202
+ 'a:p': {
203
+ 'a:pPr': {
204
+ 'a:defRPr': {
205
+ a$: {
206
+ 'sz': '900',
207
+ 'b': '0',
208
+ 'i': '0',
209
+ 'u': 'none',
210
+ 'strike': 'noStrike',
211
+ 'kern': '1200',
212
+ 'baseline': '0'
213
+ },
214
+ 'a:solidFill': {
215
+ 'a:schemeClr': {
216
+ a$: {
217
+ 'val': 'tx1'
218
+ },
219
+ 'a:lumMod': {
220
+ a$: {
221
+ 'val': '65000'
222
+ }
223
+ },
224
+ 'a:lumOff': {
225
+ a$: {
226
+ 'val': '35000'
227
+ }
228
+ }
229
+ }
230
+ },
231
+ 'a:latin': {
232
+ a$: {
233
+ 'typeface': '+mn-lt'
234
+ }
235
+ },
236
+ 'a:ea': {
237
+ a$: {
238
+ 'typeface': '+mn-ea'
239
+ }
240
+ },
241
+ 'a:cs': {
242
+ a$: {
243
+ 'typeface': '+mn-cs'
244
+ }
245
+ }
246
+ }
247
+ },
248
+ 'a:endParaRPr': {
249
+ a$: {
250
+ 'lang': 'en-US'
251
+ }
252
+ }
253
+ }
254
+ },
255
+ 'c:crossAx': {
256
+ a$: {
257
+ 'val': '2023395087'
258
+ }
259
+ },
260
+ 'c:crosses': {
261
+ a$: {
262
+ 'val': 'autoZero'
263
+ }
264
+ },
265
+ 'c:crossBetween': {
266
+ a$: {
267
+ 'val': 'midCat'
268
+ }
269
+ }
270
+ },
271
+ {
272
+ 'c:axId': {
273
+ a$: {
274
+ 'val': '2023395087'
275
+ }
276
+ },
277
+ 'c:scaling': {
278
+ 'c:orientation': {
279
+ a$: {
280
+ 'val': 'minMax'
281
+ }
282
+ }
283
+ },
284
+ 'c:delete': {
285
+ a$: {
286
+ 'val': '0'
287
+ }
288
+ },
289
+ 'c:axPos': {
290
+ a$: {
291
+ 'val': 'l'
292
+ }
293
+ },
294
+ 'c:majorGridlines': {
295
+ 'c:spPr': {
296
+ 'a:ln': {
297
+ a$: {
298
+ 'w': '9525',
299
+ 'cap': 'flat',
300
+ 'cmpd': 'sng',
301
+ 'algn': 'ctr'
302
+ },
303
+ 'a:solidFill': {
304
+ 'a:schemeClr': {
305
+ a$: {
306
+ 'val': 'tx1'
307
+ },
308
+ 'a:lumMod': {
309
+ a$: {
310
+ 'val': '15000'
311
+ }
312
+ },
313
+ 'a:lumOff': {
314
+ a$: {
315
+ 'val': '85000'
316
+ }
317
+ }
318
+ }
319
+ },
320
+ 'a:round': {}
321
+ },
322
+ 'a:effectLst': {}
323
+ }
324
+ },
325
+ 'c:numFmt': {
326
+ a$: {
327
+ 'formatCode': '0.00',
328
+ 'sourceLinked': '1'
329
+ }
330
+ },
331
+ 'c:majorTickMark': {
332
+ a$: {
333
+ 'val': 'none'
334
+ }
335
+ },
336
+ 'c:minorTickMark': {
337
+ a$: {
338
+ 'val': 'none'
339
+ }
340
+ },
341
+ 'c:tickLblPos': {
342
+ a$: {
343
+ 'val': 'nextTo'
344
+ }
345
+ },
346
+ 'c:spPr': {
347
+ 'a:noFill': {},
348
+ 'a:ln': {
349
+ a$: {
350
+ 'w': '9525',
351
+ 'cap': 'flat',
352
+ 'cmpd': 'sng',
353
+ 'algn': 'ctr'
354
+ },
355
+ 'a:solidFill': {
356
+ 'a:schemeClr': {
357
+ a$: {
358
+ 'val': 'tx1'
359
+ },
360
+ 'a:lumMod': {
361
+ a$: {
362
+ 'val': '25000'
363
+ }
364
+ },
365
+ 'a:lumOff': {
366
+ a$: {
367
+ 'val': '75000'
368
+ }
369
+ }
370
+ }
371
+ },
372
+ 'a:round': {}
373
+ },
374
+ 'a:effectLst': {}
375
+ },
376
+ 'c:txPr': {
377
+ 'a:bodyPr': {
378
+ a$: {
379
+ 'rot': '-60000000',
380
+ 'spcFirstLastPara': '1',
381
+ 'vertOverflow': 'ellipsis',
382
+ 'vert': 'horz',
383
+ 'wrap': 'square',
384
+ 'anchor': 'ctr',
385
+ 'anchorCtr': '1'
386
+ }
387
+ },
388
+ 'a:lstStyle': {},
389
+ 'a:p': {
390
+ 'a:pPr': {
391
+ 'a:defRPr': {
392
+ a$: {
393
+ 'sz': '900',
394
+ 'b': '0',
395
+ 'i': '0',
396
+ 'u': 'none',
397
+ 'strike': 'noStrike',
398
+ 'kern': '1200',
399
+ 'baseline': '0'
400
+ },
401
+ 'a:solidFill': {
402
+ 'a:schemeClr': {
403
+ a$: {
404
+ 'val': 'tx1'
405
+ },
406
+ 'a:lumMod': {
407
+ a$: {
408
+ 'val': '65000'
409
+ }
410
+ },
411
+ 'a:lumOff': {
412
+ a$: {
413
+ 'val': '35000'
414
+ }
415
+ }
416
+ }
417
+ },
418
+ 'a:latin': {
419
+ a$: {
420
+ 'typeface': '+mn-lt'
421
+ }
422
+ },
423
+ 'a:ea': {
424
+ a$: {
425
+ 'typeface': '+mn-ea'
426
+ }
427
+ },
428
+ 'a:cs': {
429
+ a$: {
430
+ 'typeface': '+mn-cs'
431
+ }
432
+ }
433
+ }
434
+ },
435
+ 'a:endParaRPr': {
436
+ a$: {
437
+ 'lang': 'en-US'
438
+ }
439
+ }
440
+ }
441
+ },
442
+ 'c:crossAx': {
443
+ a$: {
444
+ 'val': '2028657983'
445
+ }
446
+ },
447
+ 'c:crosses': {
448
+ a$: {
449
+ 'val': 'autoZero'
450
+ }
451
+ },
452
+ 'c:crossBetween': {
453
+ a$: {
454
+ 'val': 'midCat'
455
+ }
456
+ }
457
+ }
458
+ ],
459
+ 'c:spPr': {
460
+ 'a:noFill': {},
461
+ 'a:ln': {
462
+ 'a:noFill': {}
463
+ },
464
+ 'a:effectLst': {}
465
+ }
466
+ },
467
+ 'c:plotVisOnly': {
468
+ a$: {
469
+ 'val': '1'
470
+ }
471
+ },
472
+ 'c:dispBlanksAs': {
473
+ a$: {
474
+ 'val': 'gap'
475
+ }
476
+ },
477
+ 'c:extLst': {
478
+ 'c:ext': {
479
+ a$: {
480
+ 'uri': '{56B9EC1D-385E-4148-901F-78D8002777C0}',
481
+ 'xmlns:c16r3': 'http://schemas.microsoft.com/office/drawing/2017/03/chart'
482
+ },
483
+ 'c16r3:dataDisplayOptions16': {
484
+ 'c16r3:dispNaAsBlank': {
485
+ a$: {
486
+ 'val': '1'
487
+ }
488
+ }
489
+ }
490
+ }
491
+ },
492
+ 'c:showDLblsOverMax': {
493
+ a$: {
494
+ 'val': '0'
495
+ }
496
+ }
497
+ };
498
+
499
+ export const scatter_series =
500
+ {
501
+ 'c:spPr': {
502
+ 'a:ln': {
503
+ a$: {
504
+ 'w': '19050',
505
+ 'cap': 'rnd'
506
+ },
507
+ 'a:solidFill': {
508
+ 'a:schemeClr': {
509
+ a$: {
510
+ 'val': 'accent1'
511
+ }
512
+ }
513
+ },
514
+ 'a:round': {}
515
+ },
516
+ 'a:effectLst': {}
517
+ },
518
+ 'c:marker': {
519
+ 'c:symbol': {
520
+ a$: {
521
+ 'val': 'none'
522
+ }
523
+ }
524
+ },
525
+ // <- 'c:tx': {},
526
+ 'c:xVal': {
527
+ 'c:numRef': {
528
+ 'c:f': '',
529
+ }
530
+ },
531
+ 'c:yVal': {
532
+ 'c:numRef': {
533
+ 'c:f': '',
534
+ }
535
+ },
536
+ 'c:smooth': {
537
+ a$: {
538
+ 'val': '0'
539
+ }
540
+ },
541
+ 'c:extLst': {
542
+ 'c:ext': {
543
+ a$: {
544
+ 'uri': '{C3380CC4-5D6E-409C-BE32-E72D297353CC}',
545
+ 'xmlns:c16': 'http://schemas.microsoft.com/office/drawing/2014/chart'
546
+ },
547
+ 'c16:uniqueId': {
548
+ a$: {
549
+ 'val': '{00000000-1F6C-44A9-AA4F-6706F20CC72E}'
550
+ }
551
+ }
552
+ }
553
+ }
554
+ };
555
+
@@ -0,0 +1,99 @@
1
+ /*
2
+ * This file is part of TREB.
3
+ *
4
+ * TREB is free software: you can redistribute it and/or modify it under the
5
+ * terms of the GNU General Public License as published by the Free Software
6
+ * Foundation, either version 3 of the License, or (at your option) any
7
+ * later version.
8
+ *
9
+ * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
+ * details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License along
15
+ * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
+ *
17
+ * Copyright 2022-2023 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+
22
+ // import { Importer } from '../import';
23
+ // import { Exporter } from '../export';
24
+ import type { ImportedSheetData, IArea } from 'treb-base-types/src';
25
+
26
+ import { Exporter } from '../export2';
27
+ import { Importer } from '../import2';
28
+
29
+ const ctx: Worker = self as any;
30
+ const exporter = new Exporter();
31
+
32
+ const ExportSheets = async (data: any) => {
33
+
34
+ if (data.sheet) {
35
+ await exporter.Init(data.decorated || []);
36
+ await exporter.Export(data.sheet);
37
+
38
+ const blob = await exporter.AsBlob(1);
39
+ const corrected = (blob as Blob).slice(0, (blob as Blob).size,
40
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
41
+
42
+ ctx.postMessage({ status: 'complete', blob: corrected });
43
+ }
44
+
45
+ /*
46
+ if (data.sheet) {
47
+ await exporter.Init();
48
+ await exporter.ExportSheets(data.sheet);
49
+ const blob = await exporter.AsBlob(1);
50
+
51
+ // correct the mime type for firefox
52
+ const corrected = (blob as Blob).slice(0, (blob as Blob).size,
53
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
54
+
55
+ ctx.postMessage({ status: 'complete', blob: corrected });
56
+ }
57
+ */
58
+ };
59
+
60
+ const ImportSheet = async (data: any) => {
61
+
62
+ const importer = new Importer();
63
+
64
+ try {
65
+ await importer.Init(data.data);
66
+
67
+ const count = importer.SheetCount();
68
+ const results = {
69
+ sheets: [] as ImportedSheetData[],
70
+ names: importer.workbook?.GetNamedRanges(),
71
+ active_tab: importer.workbook?.active_tab,
72
+ };
73
+
74
+ for (let i = 0; i < count; i++) {
75
+ const result = await importer.GetSheet(i);
76
+ if (result) {
77
+ results.sheets.push(result);
78
+ }
79
+ }
80
+ ctx.postMessage({ status: 'complete', results });
81
+
82
+ }
83
+ catch (err) {
84
+ console.warn('error importing xlsx file');
85
+ console.info(err);
86
+ ctx.postMessage({ status: 'error', data: err });
87
+ }
88
+
89
+ };
90
+
91
+ // initialize message handler
92
+ ctx.addEventListener('message', (event) => {
93
+ if (event.data && event.data.command === 'export'){
94
+ ExportSheets(event.data);
95
+ }
96
+ else if (event.data && event.data.command === 'import'){
97
+ ImportSheet(event.data);
98
+ }
99
+ });