@trebco/treb 32.13.2 → 36.1.2

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 (266) hide show
  1. package/api-generator/api-generator-types.ts +3 -0
  2. package/api-generator/api-generator.ts +15 -1
  3. package/bun.lock +145 -99
  4. package/dist/chunk-43DLP2OX.mjs +11 -0
  5. package/dist/chunk-4CKS56PE.mjs +11 -0
  6. package/dist/chunk-75PARUQE.mjs +11 -0
  7. package/dist/chunk-7QD63AZS.mjs +24601 -0
  8. package/dist/chunk-A55ARVRD.mjs +11 -0
  9. package/dist/chunk-DESAKYW4.mjs +11 -0
  10. package/dist/chunk-EQ2R5W6P.mjs +24565 -0
  11. package/dist/chunk-IYJU2J6D.mjs +24601 -0
  12. package/dist/chunk-KSJFPGXT.mjs +11 -0
  13. package/dist/chunk-ORQFKLXM.mjs +24601 -0
  14. package/dist/chunk-SFDNNDHY.mjs +11 -0
  15. package/dist/chunk-T47DX5MI.mjs +11 -0
  16. package/dist/chunk-T6ILBVEX.mjs +11 -0
  17. package/dist/chunk-TPRCDYYG.mjs +11 -0
  18. package/dist/chunk-YAHNOOHO.mjs +11 -0
  19. package/dist/treb-export-worker.mjs +9 -2
  20. package/dist/treb-spreadsheet.mjs +7 -19
  21. package/dist/treb.d.ts +20 -4
  22. package/esbuild-composite.mjs +18 -6
  23. package/esbuild-utils.mjs +62 -3
  24. package/i18n/languages/treb-i18n-da.mjs +1 -1
  25. package/i18n/languages/treb-i18n-de.mjs +1 -1
  26. package/i18n/languages/treb-i18n-es.mjs +1 -1
  27. package/i18n/languages/treb-i18n-fr.mjs +1 -1
  28. package/i18n/languages/treb-i18n-it.mjs +1 -1
  29. package/i18n/languages/treb-i18n-nl.mjs +1 -1
  30. package/i18n/languages/treb-i18n-no.mjs +1 -1
  31. package/i18n/languages/treb-i18n-pl.mjs +1 -1
  32. package/i18n/languages/treb-i18n-pt.mjs +1 -1
  33. package/i18n/languages/treb-i18n-sv.mjs +1 -1
  34. package/ooxml-types/README.md +141 -0
  35. package/ooxml-types/package.json +5 -0
  36. package/ooxml-types/src/types/drawingml/chart.ts +327 -0
  37. package/ooxml-types/src/types/drawingml/index.ts +63 -0
  38. package/ooxml-types/src/types/drawingml/spreadsheetDrawing.ts +105 -0
  39. package/ooxml-types/src/types/drawingml/theme.ts +104 -0
  40. package/ooxml-types/src/types/index.ts +3 -0
  41. package/ooxml-types/src/types/package/contentTypes.ts +49 -0
  42. package/ooxml-types/src/types/package/docProps.ts +46 -0
  43. package/ooxml-types/src/types/package/index.ts +17 -0
  44. package/ooxml-types/src/types/package/relationships.ts +37 -0
  45. package/ooxml-types/src/types/spreadsheetml/columns.ts +20 -0
  46. package/ooxml-types/src/types/spreadsheetml/comments.ts +30 -0
  47. package/ooxml-types/src/types/spreadsheetml/dataFeatures.ts +261 -0
  48. package/ooxml-types/src/types/spreadsheetml/enums.ts +175 -0
  49. package/ooxml-types/src/types/spreadsheetml/index.ts +186 -0
  50. package/ooxml-types/src/types/spreadsheetml/metadata.ts +90 -0
  51. package/ooxml-types/src/types/spreadsheetml/misc.ts +35 -0
  52. package/ooxml-types/src/types/spreadsheetml/pageLayout.ts +83 -0
  53. package/ooxml-types/src/types/spreadsheetml/sharedStrings.ts +33 -0
  54. package/ooxml-types/src/types/spreadsheetml/sheetData.ts +70 -0
  55. package/ooxml-types/src/types/spreadsheetml/sheetProperties.ts +86 -0
  56. package/ooxml-types/src/types/spreadsheetml/sheetViews.ts +51 -0
  57. package/ooxml-types/src/types/spreadsheetml/sparkline.ts +46 -0
  58. package/ooxml-types/src/types/spreadsheetml/styles.ts +274 -0
  59. package/ooxml-types/src/types/spreadsheetml/table.ts +106 -0
  60. package/ooxml-types/src/types/spreadsheetml/util.ts +15 -0
  61. package/ooxml-types/src/types/spreadsheetml/workbook.ts +165 -0
  62. package/ooxml-types/src/types/spreadsheetml/worksheet.ts +60 -0
  63. package/package.json +13 -11
  64. package/treb-base-types/src/api_types.ts +1 -1
  65. package/treb-base-types/src/area-utils.ts +1 -1
  66. package/treb-base-types/src/area.ts +1 -1
  67. package/treb-base-types/src/basic_types.ts +1 -1
  68. package/treb-base-types/src/cell.ts +1 -1
  69. package/treb-base-types/src/cells.ts +1 -1
  70. package/treb-base-types/src/color.ts +1 -1
  71. package/treb-base-types/src/dom-utilities.ts +1 -1
  72. package/treb-base-types/src/evaluate-options.ts +1 -1
  73. package/treb-base-types/src/font-stack.ts +1 -1
  74. package/treb-base-types/src/gradient.ts +1 -1
  75. package/treb-base-types/src/import.ts +1 -1
  76. package/treb-base-types/src/index-standalone.ts +1 -1
  77. package/treb-base-types/src/index.ts +2 -1
  78. package/treb-base-types/src/layout.ts +1 -1
  79. package/treb-base-types/src/localization.ts +1 -1
  80. package/treb-base-types/src/rectangle.ts +1 -1
  81. package/treb-base-types/src/render_text.ts +7 -1
  82. package/treb-base-types/src/style.ts +1 -1
  83. package/treb-base-types/src/table.ts +1 -1
  84. package/treb-base-types/src/text_part.ts +1 -1
  85. package/treb-base-types/src/theme.ts +1 -1
  86. package/treb-base-types/src/union.ts +4 -1
  87. package/treb-base-types/src/value-type.ts +1 -1
  88. package/treb-base-types/src/worker-proxy.ts +294 -0
  89. package/treb-base-types/style/resizable.css +1 -1
  90. package/treb-calculator/src/calculator.ts +133 -14
  91. package/treb-calculator/src/complex-math.ts +1 -1
  92. package/treb-calculator/src/dag/array-vertex.ts +1 -1
  93. package/treb-calculator/src/dag/calculation_leaf_vertex.ts +1 -1
  94. package/treb-calculator/src/dag/graph.ts +1 -1
  95. package/treb-calculator/src/dag/spreadsheet_vertex.ts +1 -1
  96. package/treb-calculator/src/dag/spreadsheet_vertex_base.ts +1 -1
  97. package/treb-calculator/src/dag/state_leaf_vertex.ts +1 -1
  98. package/treb-calculator/src/dag/vertex.ts +1 -1
  99. package/treb-calculator/src/descriptors.ts +9 -1
  100. package/treb-calculator/src/expression-calculator.ts +1 -1
  101. package/treb-calculator/src/function-error.ts +1 -1
  102. package/treb-calculator/src/function-library.ts +1 -1
  103. package/treb-calculator/src/functions/base-functions.ts +10 -4
  104. package/treb-calculator/src/functions/beta.ts +1 -1
  105. package/treb-calculator/src/functions/checkbox.ts +1 -1
  106. package/treb-calculator/src/functions/complex-functions.ts +1 -1
  107. package/treb-calculator/src/functions/date-utils.ts +1 -1
  108. package/treb-calculator/src/functions/finance-functions.ts +2 -4
  109. package/treb-calculator/src/functions/fp.ts +1 -1
  110. package/treb-calculator/src/functions/function-utilities.ts +1 -1
  111. package/treb-calculator/src/functions/gamma.ts +1 -1
  112. package/treb-calculator/src/functions/information-functions.ts +1 -1
  113. package/treb-calculator/src/functions/lambda-functions.ts +4 -1
  114. package/treb-calculator/src/functions/matrix-functions.ts +1 -1
  115. package/treb-calculator/src/functions/normal.ts +1 -1
  116. package/treb-calculator/src/functions/regex-functions.ts +13 -4
  117. package/treb-calculator/src/functions/sparkline.ts +1 -1
  118. package/treb-calculator/src/functions/statistics-functions.ts +1 -1
  119. package/treb-calculator/src/functions/students-t.ts +1 -1
  120. package/treb-calculator/src/functions/text-functions.ts +5 -1
  121. package/treb-calculator/src/index.ts +1 -1
  122. package/treb-calculator/src/notifier-types.ts +1 -1
  123. package/treb-calculator/src/primitives.ts +1 -1
  124. package/treb-calculator/src/utilities.ts +1 -1
  125. package/treb-charts/src/chart-functions.ts +1 -1
  126. package/treb-charts/src/chart-types.ts +1 -1
  127. package/treb-charts/src/chart-utils.ts +1 -1
  128. package/treb-charts/src/chart.ts +1 -1
  129. package/treb-charts/src/default-chart-renderer.ts +1 -1
  130. package/treb-charts/src/index.ts +1 -1
  131. package/treb-charts/src/main.ts +1 -1
  132. package/treb-charts/src/quicksort.ts +1 -1
  133. package/treb-charts/src/rectangle.ts +1 -1
  134. package/treb-charts/src/renderer-type.ts +1 -1
  135. package/treb-charts/src/renderer.ts +1 -1
  136. package/treb-charts/src/util.ts +1 -1
  137. package/treb-charts/style/charts.scss +1 -1
  138. package/treb-data-model/src/annotation.ts +1 -1
  139. package/treb-data-model/src/conditional_format.ts +1 -1
  140. package/treb-data-model/src/data-validation.ts +1 -1
  141. package/treb-data-model/src/data_model.ts +32 -5
  142. package/treb-data-model/src/index.ts +1 -1
  143. package/treb-data-model/src/language-model.ts +1 -1
  144. package/treb-data-model/src/named.ts +1 -1
  145. package/treb-data-model/src/serialize_options.ts +1 -1
  146. package/treb-data-model/src/sheet.ts +1 -1
  147. package/treb-data-model/src/sheet_collection.ts +1 -1
  148. package/treb-data-model/src/sheet_selection.ts +1 -1
  149. package/treb-data-model/src/sheet_types.ts +1 -1
  150. package/treb-data-model/src/types.ts +1 -1
  151. package/treb-embed/src/content-types.d.ts +1 -1
  152. package/treb-embed/src/custom-element/global.d.ts +1 -1
  153. package/treb-embed/src/custom-element/spreadsheet-constructor.ts +1 -1
  154. package/treb-embed/src/custom-element/treb-global.ts +1 -1
  155. package/treb-embed/src/custom-element/treb-spreadsheet-element.ts +1 -1
  156. package/treb-embed/src/embedded-spreadsheet.ts +342 -149
  157. package/treb-embed/src/index.ts +1 -1
  158. package/treb-embed/src/options.ts +4 -2
  159. package/treb-embed/src/plugin.ts +1 -1
  160. package/treb-embed/src/progress-dialog.ts +1 -1
  161. package/treb-embed/src/selection-state.ts +1 -1
  162. package/treb-embed/src/spinner.ts +1 -1
  163. package/treb-embed/src/toolbar-message.ts +6 -1
  164. package/treb-embed/src/types.ts +13 -1
  165. package/treb-embed/style/autocomplete.scss +1 -1
  166. package/treb-embed/style/dark-theme.scss +1 -1
  167. package/treb-embed/style/defaults.scss +1 -1
  168. package/treb-embed/style/dialog.scss +1 -1
  169. package/treb-embed/style/dropdown-select.scss +1 -1
  170. package/treb-embed/style/font-stacks.scss +1 -1
  171. package/treb-embed/style/formula-bar.scss +1 -1
  172. package/treb-embed/style/grid.scss +1 -1
  173. package/treb-embed/style/layout.scss +1 -1
  174. package/treb-embed/style/mouse-mask.scss +1 -1
  175. package/treb-embed/style/note.scss +1 -1
  176. package/treb-embed/style/overlay-editor.scss +1 -1
  177. package/treb-embed/style/spinner.scss +1 -1
  178. package/treb-embed/style/tab-bar.scss +1 -1
  179. package/treb-embed/style/table.scss +1 -1
  180. package/treb-embed/style/theme-defaults.scss +1 -1
  181. package/treb-embed/style/toolbar.scss +1 -1
  182. package/treb-embed/style/tooltip.scss +1 -1
  183. package/treb-embed/style/treb-icons.scss +1 -1
  184. package/treb-embed/style/treb-spreadsheet-element.scss +1 -1
  185. package/treb-embed/style/z-index.scss +1 -1
  186. package/treb-export/src/address-type.ts +1 -1
  187. package/treb-export/src/base-template.ts +1 -1
  188. package/treb-export/src/column-width.ts +1 -1
  189. package/treb-export/src/drawing/bubble-chart-template.ts +1 -1
  190. package/treb-export/src/drawing/chart-template-components2.ts +1 -1
  191. package/treb-export/src/drawing/chart.ts +1 -1
  192. package/treb-export/src/drawing/column-chart-template2.ts +1 -1
  193. package/treb-export/src/drawing/donut-chart-template2.ts +1 -1
  194. package/treb-export/src/drawing/drawing.ts +1 -1
  195. package/treb-export/src/drawing/embedded-image.ts +1 -1
  196. package/treb-export/src/drawing/scatter-chart-template2.ts +1 -1
  197. package/treb-export/src/export.ts +121 -8
  198. package/treb-export/src/import-export-messages.ts +61 -0
  199. package/treb-export/src/import.ts +318 -301
  200. package/treb-export/src/index.worker.ts +85 -53
  201. package/treb-export/src/metadata.ts +71 -3
  202. package/treb-export/src/ooxml.ts +47 -0
  203. package/treb-export/src/relationship.ts +1 -1
  204. package/treb-export/src/shared-strings.ts +19 -15
  205. package/treb-export/src/template-2.ts +1 -1
  206. package/treb-export/src/unescape_xml.ts +1 -1
  207. package/treb-export/src/workbook-sheet.ts +11 -6
  208. package/treb-export/src/workbook-style.ts +137 -25
  209. package/treb-export/src/workbook-theme.ts +20 -4
  210. package/treb-export/src/workbook.ts +85 -88
  211. package/treb-export/src/xml-test.ts +1 -1
  212. package/treb-export/src/xml-utils.ts +1 -1
  213. package/treb-export/src/zip-wrapper.ts +1 -1
  214. package/treb-export/tsconfig.json +2 -1
  215. package/treb-format/src/format.test.ts +1 -1
  216. package/treb-format/src/format.ts +12 -5
  217. package/treb-format/src/format_cache.ts +3 -3
  218. package/treb-format/src/format_parser.ts +1 -1
  219. package/treb-format/src/index.ts +1 -1
  220. package/treb-format/src/number_format_section.ts +1 -1
  221. package/treb-format/src/value_parser.ts +1 -1
  222. package/treb-grid/src/editors/autocomplete.ts +1 -1
  223. package/treb-grid/src/editors/autocomplete_matcher.ts +1 -1
  224. package/treb-grid/src/editors/editor.ts +15 -6
  225. package/treb-grid/src/editors/external_editor.ts +33 -8
  226. package/treb-grid/src/editors/formula_bar.ts +12 -1
  227. package/treb-grid/src/editors/overlay_editor.ts +4 -1
  228. package/treb-grid/src/index.ts +1 -1
  229. package/treb-grid/src/layout/base_layout.ts +1 -1
  230. package/treb-grid/src/layout/grid_layout.ts +1 -1
  231. package/treb-grid/src/layout/mock-layout.ts +1 -1
  232. package/treb-grid/src/render/selection-renderer.ts +1 -1
  233. package/treb-grid/src/render/svg_header_overlay.ts +1 -1
  234. package/treb-grid/src/render/svg_selection_block.ts +1 -1
  235. package/treb-grid/src/render/tile_renderer.ts +36 -7
  236. package/treb-grid/src/types/border_constants.ts +1 -1
  237. package/treb-grid/src/types/clipboard_data.ts +1 -1
  238. package/treb-grid/src/types/clipboard_data2.ts +1 -1
  239. package/treb-grid/src/types/drag_mask.ts +1 -1
  240. package/treb-grid/src/types/external_editor_config.ts +1 -1
  241. package/treb-grid/src/types/grid.ts +181 -40
  242. package/treb-grid/src/types/grid_base.ts +7 -4
  243. package/treb-grid/src/types/grid_command.ts +7 -1
  244. package/treb-grid/src/types/grid_events.ts +2 -1
  245. package/treb-grid/src/types/grid_options.ts +1 -1
  246. package/treb-grid/src/types/scale-control.ts +1 -1
  247. package/treb-grid/src/types/set_range_options.ts +1 -1
  248. package/treb-grid/src/types/tab_bar.ts +1 -1
  249. package/treb-grid/src/types/tile.ts +1 -1
  250. package/treb-grid/src/types/update_flags.ts +1 -1
  251. package/treb-grid/src/util/fontmetrics.ts +1 -1
  252. package/treb-grid/src/util/ua.ts +1 -1
  253. package/treb-parser/src/csv-parser.ts +1 -1
  254. package/treb-parser/src/index.ts +1 -1
  255. package/treb-parser/src/md-parser.ts +1 -1
  256. package/treb-parser/src/parser-types.ts +1 -1
  257. package/treb-parser/src/parser.ts +1 -1
  258. package/treb-utils/src/event_source.ts +1 -1
  259. package/treb-utils/src/ievent_source.ts +1 -1
  260. package/treb-utils/src/index.ts +1 -1
  261. package/treb-utils/src/measurement.ts +1 -1
  262. package/treb-utils/src/scale.ts +1 -1
  263. package/treb-utils/src/serialize_html.ts +1 -1
  264. package/treb-utils/src/validate_uri.ts +1 -1
  265. package/tsproject.json +2 -3
  266. package/treb-embed/src/export-worker.ts +0 -44
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU General Public License along
15
15
  * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
16
  *
17
- * Copyright 2022-2025 trebco, llc.
17
+ * Copyright 2022-2026 trebco, llc.
18
18
  * info@treb.app
19
19
  *
20
20
  */
@@ -42,7 +42,6 @@ import { Area, Cells, ValueType, Style, IsHTMLColor, IsThemeColor, ThemeColorInd
42
42
 
43
43
  // import * as xmlparser from 'fast-xml-parser';
44
44
  import type { XmlBuilderOptions} from 'fast-xml-parser';
45
- import { XMLParser } from 'fast-xml-parser';
46
45
 
47
46
  import { SharedStrings } from './shared-strings';
48
47
  import type { XlColor, BorderEdge } from './workbook-style';
@@ -51,7 +50,7 @@ import { Theme } from './workbook-theme';
51
50
 
52
51
  import type { RelationshipMap} from './relationship';
53
52
  import { AddRel } from './relationship';
54
- import { type DOMContent, XMLOptions2, PatchXMLBuilder } from './xml-utils';
53
+ import { type DOMContent, PatchXMLBuilder } from './xml-utils';
55
54
 
56
55
  import type { UnitAddress, UnitRange, ExpressionUnit} from 'treb-parser';
57
56
  import { Parser } from 'treb-parser';
@@ -65,6 +64,7 @@ import { Drawing } from './drawing/drawing';
65
64
  import { ConditionalFormatOperators, type TableDescription, type TableFooterType } from './workbook';
66
65
  import type { AnnotationData } from 'treb-data-model/src/annotation';
67
66
  import { ZipWrapper } from './zip-wrapper';
67
+ import { ooxml_parser } from './ooxml';
68
68
 
69
69
  /*
70
70
  interface NestedDOMType {
@@ -153,7 +153,7 @@ export class Exporter {
153
153
 
154
154
  // public xmlparser = new xmlparser.j2xParser(this.xmloptions);
155
155
  public xmlbuilder1 = PatchXMLBuilder(this.xmloptions);
156
- public xmlparser2 = new XMLParser(XMLOptions2);
156
+ // public xmlparser2 = new XMLParser(XMLOptions2);
157
157
 
158
158
  // FIXME: need a way to share/pass parser flags
159
159
  public parser = new Parser();
@@ -1214,11 +1214,19 @@ export class Exporter {
1214
1214
  const theme = new Theme();
1215
1215
 
1216
1216
  let data = this.zip?.Get('xl/theme/theme1.xml');
1217
- theme.FromXML(this.xmlparser2.parse(data || ''));
1217
+ theme.FromXML(ooxml_parser.parse(data || '')?.theme);
1218
+
1219
+ // theme.FromXML(this.xmlparser2.parse(data || ''));
1218
1220
  // console.info({data, xml: this.xmlparser2.parse(data)})
1219
1221
 
1220
1222
  data = this.zip?.Get('xl/styles.xml');
1221
- style_cache.FromXML(this.xmlparser2.parse(data || ''), theme);
1223
+
1224
+ //style_cache.FromXML(this.xmlparser2.parse(data || ''), theme);
1225
+ style_cache.FromXML(ooxml_parser.parse(data || '')?.styleSheet, theme);
1226
+
1227
+ // new flag: we need metadata for dynamic arrays
1228
+
1229
+ let dynamic_array_metadata = false;
1222
1230
 
1223
1231
  // reset counters
1224
1232
 
@@ -1573,6 +1581,7 @@ export class Exporter {
1573
1581
  }
1574
1582
 
1575
1583
  if (cell.area && cell.area.start.row === r && cell.area.start.column === c) {
1584
+
1576
1585
  if (typeof f === 'string') {
1577
1586
  f = {
1578
1587
  t$: f,
@@ -1584,6 +1593,25 @@ export class Exporter {
1584
1593
  }
1585
1594
  }
1586
1595
 
1596
+ let cm: number|undefined = undefined;
1597
+
1598
+ if (cell.spill && cell.spill.start.row === r && cell.spill.start.column === c) {
1599
+
1600
+ cm = 1;
1601
+ dynamic_array_metadata = true;
1602
+
1603
+ if (typeof f === 'string') {
1604
+ f = {
1605
+ t$: f,
1606
+ a$: {
1607
+ t: 'array',
1608
+ ref: cell.spill.spreadsheet_label,
1609
+ },
1610
+ }
1611
+ }
1612
+
1613
+ }
1614
+
1587
1615
  row.push({
1588
1616
  a$: {
1589
1617
 
@@ -1597,6 +1625,9 @@ export class Exporter {
1597
1625
  // or there is no column style and it's equal to sheet style
1598
1626
 
1599
1627
  s,
1628
+
1629
+ cm,
1630
+
1600
1631
  },
1601
1632
 
1602
1633
  f,
@@ -2357,6 +2388,83 @@ export class Exporter {
2357
2388
  `worksheets/sheet${index + 1}.xml`,
2358
2389
  ));
2359
2390
 
2391
+ if (dynamic_array_metadata) {
2392
+
2393
+ const metadata_dom: DOMContent = {
2394
+ metadata: {
2395
+ a$: {
2396
+ xmlns: 'http://schemas.openxmlformats.org/spreadsheetml/2006/main',
2397
+ 'xmlns:xda': 'http://schemas.microsoft.com/office/spreadsheetml/2017/dynamicarray',
2398
+ },
2399
+
2400
+ metadataTypes: {
2401
+ a$: {
2402
+ count: 1,
2403
+ },
2404
+ metadataType: {
2405
+ a$: {
2406
+ name: 'XLDAPR',
2407
+ minSupportedVersion: '120000',
2408
+ copy: 1,
2409
+ pasteAll: 1,
2410
+ pasteValues: 1,
2411
+ merge: 1,
2412
+ splitFirst: 1,
2413
+ rowColShift: 1,
2414
+ clearFormats: 1,
2415
+ clearComments: 1,
2416
+ assign: 1,
2417
+ coerce: 1,
2418
+ cellMeta: 1,
2419
+ },
2420
+ },
2421
+ },
2422
+
2423
+ futureMetadata: {
2424
+ a$: {
2425
+ name: 'XLDAPR',
2426
+ count: 1,
2427
+ },
2428
+ bk: {
2429
+ extLst: {
2430
+ ext: {
2431
+ a$: {
2432
+ uri: '{bdbb8cdc-fa1e-496e-a857-3c3f30c029c3}',
2433
+ },
2434
+ 'xda:dynamicArrayProperties': {
2435
+ a$: {
2436
+ fDynamic: 1,
2437
+ fCollapsed: `0`,
2438
+ },
2439
+ },
2440
+ },
2441
+ },
2442
+ },
2443
+ },
2444
+
2445
+ cellMetadata: {
2446
+ a$: { count: 1 },
2447
+ bk: {
2448
+ rc: {
2449
+ a$: {
2450
+ t: 1,
2451
+ v: `0`,
2452
+ }
2453
+ },
2454
+ },
2455
+ },
2456
+
2457
+
2458
+ },
2459
+ };
2460
+ const metadata_xml = XMLDeclaration + this.xmlbuilder1.build(metadata_dom);
2461
+ // console.info(metadata_xml);
2462
+ this.zip?.Set(`xl/metadata.xml`, metadata_xml);
2463
+
2464
+ // add rel
2465
+ AddRel(workbook_rels, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata', 'metadata.xml');
2466
+ }
2467
+
2360
2468
  this.WriteRels(workbook_rels, `xl/_rels/workbook.xml.rels`);
2361
2469
 
2362
2470
  const definedNames: DOMContent|undefined = source.named?.length ? {
@@ -2381,8 +2489,8 @@ export class Exporter {
2381
2489
 
2382
2490
  }),
2383
2491
  } : undefined;
2384
-
2385
-
2492
+
2493
+
2386
2494
  const workbook_dom: DOMContent = {
2387
2495
  workbook: {
2388
2496
  a$: {
@@ -2487,6 +2595,11 @@ export class Exporter {
2487
2595
  { a$: { PartName: '/xl/styles.xml', ContentType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml' }},
2488
2596
  { a$: { PartName: '/xl/sharedStrings.xml', ContentType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml' }},
2489
2597
 
2598
+ // metadata
2599
+ ...(dynamic_array_metadata ? [
2600
+ { a$: { PartName: '/xl/metadata.xml', ContentType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml' }},
2601
+ ] : []),
2602
+
2490
2603
  // tables
2491
2604
  ...global_tables.map(table => {
2492
2605
  return { a$: {
@@ -0,0 +1,61 @@
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-2026 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+
22
+ import type { ImportedSheetData } from 'treb-base-types';
23
+ import type { SerializedModel, SerializedNamed } from 'treb-data-model';
24
+
25
+ export type ExportMessage = {
26
+ type: 'export';
27
+ sheet: SerializedModel;
28
+ decorated: Record<string, string>;
29
+ };
30
+
31
+ export type ImportMessage = {
32
+ type: 'import';
33
+ data: ArrayBuffer;
34
+ };
35
+
36
+ export type ExportCompleteMessage = {
37
+ type: 'export-complete';
38
+ blob: Blob;
39
+ };
40
+
41
+ export type ImportErrorMessage = {
42
+ type: 'import-error';
43
+ error: unknown;
44
+ };
45
+
46
+ export type ImportCompleteMessage = {
47
+ type: 'import-complete';
48
+
49
+ results: {
50
+ sheets: ImportedSheetData[];
51
+ named?: (SerializedNamed & {
52
+ local_scope?: number;
53
+ })[];
54
+ active_tab?: number;
55
+ };
56
+ };
57
+
58
+ export type RXMessages = ExportMessage|ImportMessage;
59
+ export type TXMessages = ImportCompleteMessage|ImportErrorMessage|ExportCompleteMessage;
60
+
61
+