@trebco/treb 36.1.4 → 37.0.1

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 (552) hide show
  1. package/api-config.json +1 -1
  2. package/build/package.json +119 -0
  3. package/build/treb-base-types/src/api_types.d.ts +11 -0
  4. package/build/treb-base-types/src/api_types.js +22 -0
  5. package/build/treb-base-types/src/api_types.js.map +1 -0
  6. package/build/treb-base-types/src/area-utils.d.ts +9 -0
  7. package/build/treb-base-types/src/area-utils.js +50 -0
  8. package/build/treb-base-types/src/area-utils.js.map +1 -0
  9. package/build/treb-base-types/src/area.d.ts +182 -0
  10. package/build/treb-base-types/src/area.js +715 -0
  11. package/build/treb-base-types/src/area.js.map +1 -0
  12. package/build/treb-base-types/src/basic_types.d.ts +20 -0
  13. package/build/treb-base-types/src/basic_types.js +22 -0
  14. package/build/treb-base-types/src/basic_types.js.map +1 -0
  15. package/build/treb-base-types/src/cell.d.ts +167 -0
  16. package/build/treb-base-types/src/cell.js +432 -0
  17. package/build/treb-base-types/src/cell.js.map +1 -0
  18. package/build/treb-base-types/src/cells.d.ts +251 -0
  19. package/build/treb-base-types/src/cells.js +1136 -0
  20. package/build/treb-base-types/src/cells.js.map +1 -0
  21. package/build/treb-base-types/src/color.d.ts +35 -0
  22. package/build/treb-base-types/src/color.js +162 -0
  23. package/build/treb-base-types/src/color.js.map +1 -0
  24. package/build/treb-base-types/src/dom-utilities.d.ts +70 -0
  25. package/build/treb-base-types/src/dom-utilities.js +144 -0
  26. package/build/treb-base-types/src/dom-utilities.js.map +1 -0
  27. package/build/treb-base-types/src/evaluate-options.d.ts +35 -0
  28. package/build/treb-base-types/src/evaluate-options.js +22 -0
  29. package/build/treb-base-types/src/evaluate-options.js.map +1 -0
  30. package/build/treb-base-types/src/font-stack.d.ts +37 -0
  31. package/build/treb-base-types/src/font-stack.js +93 -0
  32. package/build/treb-base-types/src/font-stack.js.map +1 -0
  33. package/build/treb-base-types/src/gradient.d.ts +18 -0
  34. package/build/treb-base-types/src/gradient.js +86 -0
  35. package/build/treb-base-types/src/gradient.js.map +1 -0
  36. package/build/treb-base-types/src/import.d.ts +48 -0
  37. package/build/treb-base-types/src/import.js +22 -0
  38. package/build/treb-base-types/src/import.js.map +1 -0
  39. package/build/treb-base-types/src/index-standalone.d.ts +6 -0
  40. package/build/treb-base-types/src/index-standalone.js +27 -0
  41. package/build/treb-base-types/src/index-standalone.js.map +1 -0
  42. package/build/treb-base-types/src/index.d.ts +22 -0
  43. package/build/treb-base-types/src/index.js +45 -0
  44. package/build/treb-base-types/src/index.js.map +1 -0
  45. package/build/treb-base-types/src/layout.d.ts +22 -0
  46. package/build/treb-base-types/src/layout.js +22 -0
  47. package/build/treb-base-types/src/layout.js.map +1 -0
  48. package/build/treb-base-types/src/localization.d.ts +37 -0
  49. package/build/treb-base-types/src/localization.js +157 -0
  50. package/build/treb-base-types/src/localization.js.map +1 -0
  51. package/build/treb-base-types/src/rectangle.d.ts +51 -0
  52. package/build/treb-base-types/src/rectangle.js +123 -0
  53. package/build/treb-base-types/src/rectangle.js.map +1 -0
  54. package/build/treb-base-types/src/render_text.d.ts +34 -0
  55. package/build/treb-base-types/src/render_text.js +22 -0
  56. package/build/treb-base-types/src/render_text.js.map +1 -0
  57. package/build/treb-base-types/src/style.d.ts +214 -0
  58. package/build/treb-base-types/src/style.js +373 -0
  59. package/build/treb-base-types/src/style.js.map +1 -0
  60. package/build/treb-base-types/src/table.d.ts +58 -0
  61. package/build/treb-base-types/src/table.js +27 -0
  62. package/build/treb-base-types/src/table.js.map +1 -0
  63. package/build/treb-base-types/src/text_part.d.ts +26 -0
  64. package/build/treb-base-types/src/text_part.js +47 -0
  65. package/build/treb-base-types/src/text_part.js.map +1 -0
  66. package/build/treb-base-types/src/theme.d.ts +120 -0
  67. package/build/treb-base-types/src/theme.js +460 -0
  68. package/build/treb-base-types/src/theme.js.map +1 -0
  69. package/build/treb-base-types/src/union.d.ts +73 -0
  70. package/build/treb-base-types/src/union.js +61 -0
  71. package/build/treb-base-types/src/union.js.map +1 -0
  72. package/build/treb-base-types/src/value-type.d.ts +86 -0
  73. package/build/treb-base-types/src/value-type.js +168 -0
  74. package/build/treb-base-types/src/value-type.js.map +1 -0
  75. package/build/treb-base-types/src/worker-proxy.d.ts +95 -0
  76. package/build/treb-base-types/src/worker-proxy.js +221 -0
  77. package/build/treb-base-types/src/worker-proxy.js.map +1 -0
  78. package/build/treb-calculator/src/calculator.d.ts +249 -0
  79. package/build/treb-calculator/src/calculator.js +2755 -0
  80. package/build/treb-calculator/src/calculator.js.map +1 -0
  81. package/build/treb-calculator/src/complex-math.d.ts +75 -0
  82. package/build/treb-calculator/src/complex-math.js +559 -0
  83. package/build/treb-calculator/src/complex-math.js.map +1 -0
  84. package/build/treb-calculator/src/dag/array-vertex.d.ts +71 -0
  85. package/build/treb-calculator/src/dag/array-vertex.js +156 -0
  86. package/build/treb-calculator/src/dag/array-vertex.js.map +1 -0
  87. package/build/treb-calculator/src/dag/calculation_leaf_vertex.d.ts +48 -0
  88. package/build/treb-calculator/src/dag/calculation_leaf_vertex.js +84 -0
  89. package/build/treb-calculator/src/dag/calculation_leaf_vertex.js.map +1 -0
  90. package/build/treb-calculator/src/dag/graph.d.ts +134 -0
  91. package/build/treb-calculator/src/dag/graph.js +842 -0
  92. package/build/treb-calculator/src/dag/graph.js.map +1 -0
  93. package/build/treb-calculator/src/dag/spreadsheet_vertex.d.ts +58 -0
  94. package/build/treb-calculator/src/dag/spreadsheet_vertex.js +232 -0
  95. package/build/treb-calculator/src/dag/spreadsheet_vertex.js.map +1 -0
  96. package/build/treb-calculator/src/dag/spreadsheet_vertex_base.d.ts +20 -0
  97. package/build/treb-calculator/src/dag/spreadsheet_vertex_base.js +25 -0
  98. package/build/treb-calculator/src/dag/spreadsheet_vertex_base.js.map +1 -0
  99. package/build/treb-calculator/src/dag/state_leaf_vertex.d.ts +43 -0
  100. package/build/treb-calculator/src/dag/state_leaf_vertex.js +81 -0
  101. package/build/treb-calculator/src/dag/state_leaf_vertex.js.map +1 -0
  102. package/build/treb-calculator/src/dag/vertex.d.ts +71 -0
  103. package/build/treb-calculator/src/dag/vertex.js +274 -0
  104. package/build/treb-calculator/src/dag/vertex.js.map +1 -0
  105. package/build/treb-calculator/src/descriptors.d.ts +189 -0
  106. package/build/treb-calculator/src/descriptors.js +22 -0
  107. package/build/treb-calculator/src/descriptors.js.map +1 -0
  108. package/build/treb-calculator/src/expression-calculator.d.ts +127 -0
  109. package/build/treb-calculator/src/expression-calculator.js +1033 -0
  110. package/build/treb-calculator/src/expression-calculator.js.map +1 -0
  111. package/build/treb-calculator/src/function-error.d.ts +35 -0
  112. package/build/treb-calculator/src/function-error.js +85 -0
  113. package/build/treb-calculator/src/function-error.js.map +1 -0
  114. package/build/treb-calculator/src/function-library.d.ts +22 -0
  115. package/build/treb-calculator/src/function-library.js +96 -0
  116. package/build/treb-calculator/src/function-library.js.map +1 -0
  117. package/build/treb-calculator/src/functions/base-functions.d.ts +7 -0
  118. package/build/treb-calculator/src/functions/base-functions.js +2611 -0
  119. package/build/treb-calculator/src/functions/base-functions.js.map +1 -0
  120. package/build/treb-calculator/src/functions/beta.d.ts +17 -0
  121. package/build/treb-calculator/src/functions/beta.js +201 -0
  122. package/build/treb-calculator/src/functions/beta.js.map +1 -0
  123. package/build/treb-calculator/src/functions/checkbox.d.ts +3 -0
  124. package/build/treb-calculator/src/functions/checkbox.js +128 -0
  125. package/build/treb-calculator/src/functions/checkbox.js.map +1 -0
  126. package/build/treb-calculator/src/functions/complex-functions.d.ts +2 -0
  127. package/build/treb-calculator/src/functions/complex-functions.js +217 -0
  128. package/build/treb-calculator/src/functions/complex-functions.js.map +1 -0
  129. package/build/treb-calculator/src/functions/date-utils.d.ts +3 -0
  130. package/build/treb-calculator/src/functions/date-utils.js +59 -0
  131. package/build/treb-calculator/src/functions/date-utils.js.map +1 -0
  132. package/build/treb-calculator/src/functions/finance-functions.d.ts +2 -0
  133. package/build/treb-calculator/src/functions/finance-functions.js +547 -0
  134. package/build/treb-calculator/src/functions/finance-functions.js.map +1 -0
  135. package/build/treb-calculator/src/functions/fp.d.ts +2 -0
  136. package/build/treb-calculator/src/functions/fp.js +463 -0
  137. package/build/treb-calculator/src/functions/fp.js.map +1 -0
  138. package/build/treb-calculator/src/functions/function-utilities.d.ts +2 -0
  139. package/build/treb-calculator/src/functions/function-utilities.js +36 -0
  140. package/build/treb-calculator/src/functions/function-utilities.js.map +1 -0
  141. package/build/treb-calculator/src/functions/gamma.d.ts +20 -0
  142. package/build/treb-calculator/src/functions/gamma.js +142 -0
  143. package/build/treb-calculator/src/functions/gamma.js.map +1 -0
  144. package/build/treb-calculator/src/functions/information-functions.d.ts +2 -0
  145. package/build/treb-calculator/src/functions/information-functions.js +71 -0
  146. package/build/treb-calculator/src/functions/information-functions.js.map +1 -0
  147. package/build/treb-calculator/src/functions/lambda-functions.d.ts +2 -0
  148. package/build/treb-calculator/src/functions/lambda-functions.js +85 -0
  149. package/build/treb-calculator/src/functions/lambda-functions.js.map +1 -0
  150. package/build/treb-calculator/src/functions/matrix-functions.d.ts +2 -0
  151. package/build/treb-calculator/src/functions/matrix-functions.js +144 -0
  152. package/build/treb-calculator/src/functions/matrix-functions.js.map +1 -0
  153. package/build/treb-calculator/src/functions/normal.d.ts +2 -0
  154. package/build/treb-calculator/src/functions/normal.js +32 -0
  155. package/build/treb-calculator/src/functions/normal.js.map +1 -0
  156. package/build/treb-calculator/src/functions/regex-functions.d.ts +2 -0
  157. package/build/treb-calculator/src/functions/regex-functions.js +188 -0
  158. package/build/treb-calculator/src/functions/regex-functions.js.map +1 -0
  159. package/build/treb-calculator/src/functions/sparkline.d.ts +37 -0
  160. package/build/treb-calculator/src/functions/sparkline.js +264 -0
  161. package/build/treb-calculator/src/functions/sparkline.js.map +1 -0
  162. package/build/treb-calculator/src/functions/statistics-functions.d.ts +6 -0
  163. package/build/treb-calculator/src/functions/statistics-functions.js +989 -0
  164. package/build/treb-calculator/src/functions/statistics-functions.js.map +1 -0
  165. package/build/treb-calculator/src/functions/students-t.d.ts +3 -0
  166. package/build/treb-calculator/src/functions/students-t.js +64 -0
  167. package/build/treb-calculator/src/functions/students-t.js.map +1 -0
  168. package/build/treb-calculator/src/functions/text-functions.d.ts +3 -0
  169. package/build/treb-calculator/src/functions/text-functions.js +320 -0
  170. package/build/treb-calculator/src/functions/text-functions.js.map +1 -0
  171. package/build/treb-calculator/src/index.d.ts +2 -0
  172. package/build/treb-calculator/src/index.js +22 -0
  173. package/build/treb-calculator/src/index.js.map +1 -0
  174. package/build/treb-calculator/src/notifier-types.d.ts +26 -0
  175. package/build/treb-calculator/src/notifier-types.js +22 -0
  176. package/build/treb-calculator/src/notifier-types.js.map +1 -0
  177. package/build/treb-calculator/src/primitives.d.ts +15 -0
  178. package/build/treb-calculator/src/primitives.js +398 -0
  179. package/build/treb-calculator/src/primitives.js.map +1 -0
  180. package/build/treb-calculator/src/utilities.d.ts +68 -0
  181. package/build/treb-calculator/src/utilities.js +324 -0
  182. package/build/treb-calculator/src/utilities.js.map +1 -0
  183. package/build/treb-charts/src/chart-functions.d.ts +8 -0
  184. package/build/treb-charts/src/chart-functions.js +209 -0
  185. package/build/treb-charts/src/chart-functions.js.map +1 -0
  186. package/build/treb-charts/src/chart-types.d.ts +233 -0
  187. package/build/treb-charts/src/chart-types.js +57 -0
  188. package/build/treb-charts/src/chart-types.js.map +1 -0
  189. package/build/treb-charts/src/chart-utils.d.ts +106 -0
  190. package/build/treb-charts/src/chart-utils.js +1060 -0
  191. package/build/treb-charts/src/chart-utils.js.map +1 -0
  192. package/build/treb-charts/src/chart.d.ts +23 -0
  193. package/build/treb-charts/src/chart.js +94 -0
  194. package/build/treb-charts/src/chart.js.map +1 -0
  195. package/build/treb-charts/src/default-chart-renderer.d.ts +16 -0
  196. package/build/treb-charts/src/default-chart-renderer.js +533 -0
  197. package/build/treb-charts/src/default-chart-renderer.js.map +1 -0
  198. package/build/treb-charts/src/index.d.ts +5 -0
  199. package/build/treb-charts/src/index.js +24 -0
  200. package/build/treb-charts/src/index.js.map +1 -0
  201. package/build/treb-charts/src/main.d.ts +1 -0
  202. package/build/treb-charts/src/main.js +34 -0
  203. package/build/treb-charts/src/main.js.map +1 -0
  204. package/build/treb-charts/src/quicksort.d.ts +1 -0
  205. package/build/treb-charts/src/quicksort.js +49 -0
  206. package/build/treb-charts/src/quicksort.js.map +1 -0
  207. package/build/treb-charts/src/rectangle.d.ts +18 -0
  208. package/build/treb-charts/src/rectangle.js +41 -0
  209. package/build/treb-charts/src/rectangle.js.map +1 -0
  210. package/build/treb-charts/src/renderer-type.d.ts +24 -0
  211. package/build/treb-charts/src/renderer-type.js +22 -0
  212. package/build/treb-charts/src/renderer-type.js.map +1 -0
  213. package/build/treb-charts/src/renderer.d.ts +127 -0
  214. package/build/treb-charts/src/renderer.js +1518 -0
  215. package/build/treb-charts/src/renderer.js.map +1 -0
  216. package/build/treb-charts/src/util.d.ts +18 -0
  217. package/build/treb-charts/src/util.js +71 -0
  218. package/build/treb-charts/src/util.js.map +1 -0
  219. package/build/treb-data-model/src/annotation.d.ts +167 -0
  220. package/build/treb-data-model/src/annotation.js +120 -0
  221. package/build/treb-data-model/src/annotation.js.map +1 -0
  222. package/build/treb-data-model/src/conditional_format.d.ts +155 -0
  223. package/build/treb-data-model/src/conditional_format.js +62 -0
  224. package/build/treb-data-model/src/conditional_format.js.map +1 -0
  225. package/build/treb-data-model/src/data-validation.d.ts +28 -0
  226. package/build/treb-data-model/src/data-validation.js +22 -0
  227. package/build/treb-data-model/src/data-validation.js.map +1 -0
  228. package/build/treb-data-model/src/data_model.d.ts +173 -0
  229. package/build/treb-data-model/src/data_model.js +637 -0
  230. package/build/treb-data-model/src/data_model.js.map +1 -0
  231. package/build/treb-data-model/src/index.d.ts +13 -0
  232. package/build/treb-data-model/src/index.js +28 -0
  233. package/build/treb-data-model/src/index.js.map +1 -0
  234. package/build/treb-data-model/src/language-model.d.ts +22 -0
  235. package/build/treb-data-model/src/language-model.js +22 -0
  236. package/build/treb-data-model/src/language-model.js.map +1 -0
  237. package/build/treb-data-model/src/named.d.ts +124 -0
  238. package/build/treb-data-model/src/named.js +372 -0
  239. package/build/treb-data-model/src/named.js.map +1 -0
  240. package/build/treb-data-model/src/serialize_options.d.ts +49 -0
  241. package/build/treb-data-model/src/serialize_options.js +22 -0
  242. package/build/treb-data-model/src/serialize_options.js.map +1 -0
  243. package/build/treb-data-model/src/sheet.d.ts +499 -0
  244. package/build/treb-data-model/src/sheet.js +2904 -0
  245. package/build/treb-data-model/src/sheet.js.map +1 -0
  246. package/build/treb-data-model/src/sheet_collection.d.ts +58 -0
  247. package/build/treb-data-model/src/sheet_collection.js +112 -0
  248. package/build/treb-data-model/src/sheet_collection.js.map +1 -0
  249. package/build/treb-data-model/src/sheet_selection.d.ts +42 -0
  250. package/build/treb-data-model/src/sheet_selection.js +39 -0
  251. package/build/treb-data-model/src/sheet_selection.js.map +1 -0
  252. package/build/treb-data-model/src/sheet_types.d.ts +104 -0
  253. package/build/treb-data-model/src/sheet_types.js +22 -0
  254. package/build/treb-data-model/src/sheet_types.js.map +1 -0
  255. package/build/treb-data-model/src/types.d.ts +59 -0
  256. package/build/treb-data-model/src/types.js +22 -0
  257. package/build/treb-data-model/src/types.js.map +1 -0
  258. package/build/treb-embed/src/custom-element/spreadsheet-constructor.d.ts +75 -0
  259. package/build/treb-embed/src/custom-element/spreadsheet-constructor.js +1144 -0
  260. package/build/treb-embed/src/custom-element/spreadsheet-constructor.js.map +1 -0
  261. package/build/treb-embed/src/custom-element/treb-global.d.ts +36 -0
  262. package/build/treb-embed/src/custom-element/treb-global.js +64 -0
  263. package/build/treb-embed/src/custom-element/treb-global.js.map +1 -0
  264. package/build/treb-embed/src/custom-element/treb-spreadsheet-element.d.ts +1 -0
  265. package/build/treb-embed/src/custom-element/treb-spreadsheet-element.js +61 -0
  266. package/build/treb-embed/src/custom-element/treb-spreadsheet-element.js.map +1 -0
  267. package/build/treb-embed/src/embedded-spreadsheet.d.ts +1358 -0
  268. package/build/treb-embed/src/embedded-spreadsheet.js +5205 -0
  269. package/build/treb-embed/src/embedded-spreadsheet.js.map +1 -0
  270. package/build/treb-embed/src/index.d.ts +12 -0
  271. package/build/treb-embed/src/index.js +34 -0
  272. package/build/treb-embed/src/index.js.map +1 -0
  273. package/build/treb-embed/src/options.d.ts +266 -0
  274. package/build/treb-embed/src/options.js +56 -0
  275. package/build/treb-embed/src/options.js.map +1 -0
  276. package/build/treb-embed/src/plugin.d.ts +9 -0
  277. package/build/treb-embed/src/plugin.js +22 -0
  278. package/build/treb-embed/src/plugin.js.map +1 -0
  279. package/build/treb-embed/src/progress-dialog.d.ts +49 -0
  280. package/build/treb-embed/src/progress-dialog.js +178 -0
  281. package/build/treb-embed/src/progress-dialog.js.map +1 -0
  282. package/build/treb-embed/src/selection-state.d.ts +15 -0
  283. package/build/treb-embed/src/selection-state.js +22 -0
  284. package/build/treb-embed/src/selection-state.js.map +1 -0
  285. package/build/treb-embed/src/spinner.d.ts +8 -0
  286. package/build/treb-embed/src/spinner.js +40 -0
  287. package/build/treb-embed/src/spinner.js.map +1 -0
  288. package/build/treb-embed/src/toolbar-message.d.ts +72 -0
  289. package/build/treb-embed/src/toolbar-message.js +22 -0
  290. package/build/treb-embed/src/toolbar-message.js.map +1 -0
  291. package/build/treb-embed/src/types.d.ts +185 -0
  292. package/build/treb-embed/src/types.js +45 -0
  293. package/build/treb-embed/src/types.js.map +1 -0
  294. package/build/treb-embed/tsconfig.tsbuildinfo +1 -0
  295. package/build/treb-export/src/address-type.d.ts +34 -0
  296. package/build/treb-export/src/address-type.js +53 -0
  297. package/build/treb-export/src/address-type.js.map +1 -0
  298. package/build/treb-export/src/base-template.d.ts +1 -0
  299. package/build/treb-export/src/base-template.js +22 -0
  300. package/build/treb-export/src/base-template.js.map +1 -0
  301. package/build/treb-export/src/column-width.d.ts +2 -0
  302. package/build/treb-export/src/column-width.js +80 -0
  303. package/build/treb-export/src/column-width.js.map +1 -0
  304. package/build/treb-export/src/drawing/bubble-chart-template.d.ts +514 -0
  305. package/build/treb-export/src/drawing/bubble-chart-template.js +544 -0
  306. package/build/treb-export/src/drawing/bubble-chart-template.js.map +1 -0
  307. package/build/treb-export/src/drawing/chart-template-components2.d.ts +365 -0
  308. package/build/treb-export/src/drawing/chart-template-components2.js +386 -0
  309. package/build/treb-export/src/drawing/chart-template-components2.js.map +1 -0
  310. package/build/treb-export/src/drawing/chart.d.ts +26 -0
  311. package/build/treb-export/src/drawing/chart.js +247 -0
  312. package/build/treb-export/src/drawing/chart.js.map +1 -0
  313. package/build/treb-export/src/drawing/column-chart-template2.d.ts +490 -0
  314. package/build/treb-export/src/drawing/column-chart-template2.js +518 -0
  315. package/build/treb-export/src/drawing/column-chart-template2.js.map +1 -0
  316. package/build/treb-export/src/drawing/donut-chart-template2.d.ts +272 -0
  317. package/build/treb-export/src/drawing/donut-chart-template2.js +293 -0
  318. package/build/treb-export/src/drawing/donut-chart-template2.js.map +1 -0
  319. package/build/treb-export/src/drawing/drawing.d.ts +49 -0
  320. package/build/treb-export/src/drawing/drawing.js +193 -0
  321. package/build/treb-export/src/drawing/drawing.js.map +1 -0
  322. package/build/treb-export/src/drawing/embedded-image.d.ts +12 -0
  323. package/build/treb-export/src/drawing/embedded-image.js +54 -0
  324. package/build/treb-export/src/drawing/embedded-image.js.map +1 -0
  325. package/build/treb-export/src/drawing/scatter-chart-template2.d.ts +520 -0
  326. package/build/treb-export/src/drawing/scatter-chart-template2.js +551 -0
  327. package/build/treb-export/src/drawing/scatter-chart-template2.js.map +1 -0
  328. package/build/treb-export/src/export.d.ts +72 -0
  329. package/build/treb-export/src/export.js +2039 -0
  330. package/build/treb-export/src/export.js.map +1 -0
  331. package/build/treb-export/src/import-export-messages.d.ts +31 -0
  332. package/build/treb-export/src/import-export-messages.js +22 -0
  333. package/build/treb-export/src/import-export-messages.js.map +1 -0
  334. package/build/treb-export/src/import.d.ts +33 -0
  335. package/build/treb-export/src/import.js +1258 -0
  336. package/build/treb-export/src/import.js.map +1 -0
  337. package/build/treb-export/src/index.worker.d.ts +1 -0
  338. package/build/treb-export/src/index.worker.js +93 -0
  339. package/build/treb-export/src/index.worker.js.map +1 -0
  340. package/build/treb-export/src/metadata.d.ts +51 -0
  341. package/build/treb-export/src/metadata.js +153 -0
  342. package/build/treb-export/src/metadata.js.map +1 -0
  343. package/build/treb-export/src/ooxml.d.ts +7 -0
  344. package/build/treb-export/src/ooxml.js +41 -0
  345. package/build/treb-export/src/ooxml.js.map +1 -0
  346. package/build/treb-export/src/relationship.d.ts +8 -0
  347. package/build/treb-export/src/relationship.js +27 -0
  348. package/build/treb-export/src/relationship.js.map +1 -0
  349. package/build/treb-export/src/shared-strings.d.ts +11 -0
  350. package/build/treb-export/src/shared-strings.js +105 -0
  351. package/build/treb-export/src/shared-strings.js.map +1 -0
  352. package/build/treb-export/src/template-2.d.ts +1 -0
  353. package/build/treb-export/src/template-2.js +22 -0
  354. package/build/treb-export/src/template-2.js.map +1 -0
  355. package/build/treb-export/src/unescape_xml.d.ts +1 -0
  356. package/build/treb-export/src/unescape_xml.js +61 -0
  357. package/build/treb-export/src/unescape_xml.js.map +1 -0
  358. package/build/treb-export/src/workbook-sheet.d.ts +75 -0
  359. package/build/treb-export/src/workbook-sheet.js +128 -0
  360. package/build/treb-export/src/workbook-sheet.js.map +1 -0
  361. package/build/treb-export/src/workbook-style.d.ts +110 -0
  362. package/build/treb-export/src/workbook-style.js +1134 -0
  363. package/build/treb-export/src/workbook-style.js.map +1 -0
  364. package/build/treb-export/src/workbook-theme.d.ts +13 -0
  365. package/build/treb-export/src/workbook-theme.js +85 -0
  366. package/build/treb-export/src/workbook-theme.js.map +1 -0
  367. package/build/treb-export/src/workbook.d.ts +123 -0
  368. package/build/treb-export/src/workbook.js +644 -0
  369. package/build/treb-export/src/workbook.js.map +1 -0
  370. package/build/treb-export/src/xml-test.d.ts +9 -0
  371. package/build/treb-export/src/xml-test.js +52 -0
  372. package/build/treb-export/src/xml-test.js.map +1 -0
  373. package/build/treb-export/src/xml-utils.d.ts +76 -0
  374. package/build/treb-export/src/xml-utils.js +223 -0
  375. package/build/treb-export/src/xml-utils.js.map +1 -0
  376. package/build/treb-export/src/zip-wrapper.d.ts +22 -0
  377. package/build/treb-export/src/zip-wrapper.js +93 -0
  378. package/build/treb-export/src/zip-wrapper.js.map +1 -0
  379. package/build/treb-format/src/format.d.ts +130 -0
  380. package/build/treb-format/src/format.js +805 -0
  381. package/build/treb-format/src/format.js.map +1 -0
  382. package/build/treb-format/src/format_cache.d.ts +55 -0
  383. package/build/treb-format/src/format_cache.js +166 -0
  384. package/build/treb-format/src/format_cache.js.map +1 -0
  385. package/build/treb-format/src/format_parser.d.ts +70 -0
  386. package/build/treb-format/src/format_parser.js +618 -0
  387. package/build/treb-format/src/format_parser.js.map +1 -0
  388. package/build/treb-format/src/index.d.ts +4 -0
  389. package/build/treb-format/src/index.js +25 -0
  390. package/build/treb-format/src/index.js.map +1 -0
  391. package/build/treb-format/src/number_format_section.d.ts +58 -0
  392. package/build/treb-format/src/number_format_section.js +78 -0
  393. package/build/treb-format/src/number_format_section.js.map +1 -0
  394. package/build/treb-format/src/value_parser.d.ts +48 -0
  395. package/build/treb-format/src/value_parser.js +244 -0
  396. package/build/treb-format/src/value_parser.js.map +1 -0
  397. package/build/treb-grid/src/editors/autocomplete.d.ts +39 -0
  398. package/build/treb-grid/src/editors/autocomplete.js +316 -0
  399. package/build/treb-grid/src/editors/autocomplete.js.map +1 -0
  400. package/build/treb-grid/src/editors/autocomplete_matcher.d.ts +74 -0
  401. package/build/treb-grid/src/editors/autocomplete_matcher.js +212 -0
  402. package/build/treb-grid/src/editors/autocomplete_matcher.js.map +1 -0
  403. package/build/treb-grid/src/editors/editor.d.ts +214 -0
  404. package/build/treb-grid/src/editors/editor.js +879 -0
  405. package/build/treb-grid/src/editors/editor.js.map +1 -0
  406. package/build/treb-grid/src/editors/external_editor.d.ts +11 -0
  407. package/build/treb-grid/src/editors/external_editor.js +118 -0
  408. package/build/treb-grid/src/editors/external_editor.js.map +1 -0
  409. package/build/treb-grid/src/editors/formula_bar.d.ts +85 -0
  410. package/build/treb-grid/src/editors/formula_bar.js +444 -0
  411. package/build/treb-grid/src/editors/formula_bar.js.map +1 -0
  412. package/build/treb-grid/src/editors/overlay_editor.d.ts +85 -0
  413. package/build/treb-grid/src/editors/overlay_editor.js +353 -0
  414. package/build/treb-grid/src/editors/overlay_editor.js.map +1 -0
  415. package/build/treb-grid/src/index.d.ts +12 -0
  416. package/build/treb-grid/src/index.js +28 -0
  417. package/build/treb-grid/src/index.js.map +1 -0
  418. package/build/treb-grid/src/layout/base_layout.d.ts +346 -0
  419. package/build/treb-grid/src/layout/base_layout.js +2050 -0
  420. package/build/treb-grid/src/layout/base_layout.js.map +1 -0
  421. package/build/treb-grid/src/layout/grid_layout.d.ts +19 -0
  422. package/build/treb-grid/src/layout/grid_layout.js +235 -0
  423. package/build/treb-grid/src/layout/grid_layout.js.map +1 -0
  424. package/build/treb-grid/src/layout/mock-layout.d.ts +10 -0
  425. package/build/treb-grid/src/layout/mock-layout.js +37 -0
  426. package/build/treb-grid/src/layout/mock-layout.js.map +1 -0
  427. package/build/treb-grid/src/render/selection-renderer.d.ts +97 -0
  428. package/build/treb-grid/src/render/selection-renderer.js +315 -0
  429. package/build/treb-grid/src/render/selection-renderer.js.map +1 -0
  430. package/build/treb-grid/src/render/svg_header_overlay.d.ts +20 -0
  431. package/build/treb-grid/src/render/svg_header_overlay.js +76 -0
  432. package/build/treb-grid/src/render/svg_header_overlay.js.map +1 -0
  433. package/build/treb-grid/src/render/svg_selection_block.d.ts +27 -0
  434. package/build/treb-grid/src/render/svg_selection_block.js +106 -0
  435. package/build/treb-grid/src/render/svg_selection_block.js.map +1 -0
  436. package/build/treb-grid/src/render/tile_renderer.d.ts +121 -0
  437. package/build/treb-grid/src/render/tile_renderer.js +1609 -0
  438. package/build/treb-grid/src/render/tile_renderer.js.map +1 -0
  439. package/build/treb-grid/src/types/border_constants.d.ts +9 -0
  440. package/build/treb-grid/src/types/border_constants.js +34 -0
  441. package/build/treb-grid/src/types/border_constants.js.map +1 -0
  442. package/build/treb-grid/src/types/clipboard_data.d.ts +11 -0
  443. package/build/treb-grid/src/types/clipboard_data.js +22 -0
  444. package/build/treb-grid/src/types/clipboard_data.js.map +1 -0
  445. package/build/treb-grid/src/types/clipboard_data2.d.ts +46 -0
  446. package/build/treb-grid/src/types/clipboard_data2.js +22 -0
  447. package/build/treb-grid/src/types/clipboard_data2.js.map +1 -0
  448. package/build/treb-grid/src/types/drag_mask.d.ts +10 -0
  449. package/build/treb-grid/src/types/drag_mask.js +78 -0
  450. package/build/treb-grid/src/types/drag_mask.js.map +1 -0
  451. package/build/treb-grid/src/types/external_editor_config.d.ts +33 -0
  452. package/build/treb-grid/src/types/external_editor_config.js +22 -0
  453. package/build/treb-grid/src/types/external_editor_config.js.map +1 -0
  454. package/build/treb-grid/src/types/grid.d.ts +806 -0
  455. package/build/treb-grid/src/types/grid.js +6410 -0
  456. package/build/treb-grid/src/types/grid.js.map +1 -0
  457. package/build/treb-grid/src/types/grid_base.d.ts +442 -0
  458. package/build/treb-grid/src/types/grid_base.js +3523 -0
  459. package/build/treb-grid/src/types/grid_base.js.map +1 -0
  460. package/build/treb-grid/src/types/grid_command.d.ts +408 -0
  461. package/build/treb-grid/src/types/grid_command.js +75 -0
  462. package/build/treb-grid/src/types/grid_command.js.map +1 -0
  463. package/build/treb-grid/src/types/grid_events.d.ts +93 -0
  464. package/build/treb-grid/src/types/grid_events.js +36 -0
  465. package/build/treb-grid/src/types/grid_events.js.map +1 -0
  466. package/build/treb-grid/src/types/grid_options.d.ts +50 -0
  467. package/build/treb-grid/src/types/grid_options.js +34 -0
  468. package/build/treb-grid/src/types/grid_options.js.map +1 -0
  469. package/build/treb-grid/src/types/scale-control.d.ts +21 -0
  470. package/build/treb-grid/src/types/scale-control.js +148 -0
  471. package/build/treb-grid/src/types/scale-control.js.map +1 -0
  472. package/build/treb-grid/src/types/set_range_options.d.ts +24 -0
  473. package/build/treb-grid/src/types/set_range_options.js +22 -0
  474. package/build/treb-grid/src/types/set_range_options.js.map +1 -0
  475. package/build/treb-grid/src/types/tab_bar.d.ts +84 -0
  476. package/build/treb-grid/src/types/tab_bar.js +426 -0
  477. package/build/treb-grid/src/types/tab_bar.js.map +1 -0
  478. package/build/treb-grid/src/types/tile.d.ts +29 -0
  479. package/build/treb-grid/src/types/tile.js +22 -0
  480. package/build/treb-grid/src/types/tile.js.map +1 -0
  481. package/build/treb-grid/src/types/update_flags.d.ts +48 -0
  482. package/build/treb-grid/src/types/update_flags.js +22 -0
  483. package/build/treb-grid/src/types/update_flags.js.map +1 -0
  484. package/build/treb-grid/src/util/fontmetrics.d.ts +21 -0
  485. package/build/treb-grid/src/util/fontmetrics.js +82 -0
  486. package/build/treb-grid/src/util/fontmetrics.js.map +1 -0
  487. package/build/treb-grid/src/util/ua.d.ts +33 -0
  488. package/build/treb-grid/src/util/ua.js +86 -0
  489. package/build/treb-grid/src/util/ua.js.map +1 -0
  490. package/build/treb-parser/src/csv-parser.d.ts +13 -0
  491. package/build/treb-parser/src/csv-parser.js +107 -0
  492. package/build/treb-parser/src/csv-parser.js.map +1 -0
  493. package/build/treb-parser/src/index.d.ts +4 -0
  494. package/build/treb-parser/src/index.js +25 -0
  495. package/build/treb-parser/src/index.js.map +1 -0
  496. package/build/treb-parser/src/md-parser.d.ts +97 -0
  497. package/build/treb-parser/src/md-parser.js +403 -0
  498. package/build/treb-parser/src/md-parser.js.map +1 -0
  499. package/build/treb-parser/src/parser-types.d.ts +345 -0
  500. package/build/treb-parser/src/parser-types.js +53 -0
  501. package/build/treb-parser/src/parser-types.js.map +1 -0
  502. package/build/treb-parser/src/parser.d.ts +422 -0
  503. package/build/treb-parser/src/parser.js +2418 -0
  504. package/build/treb-parser/src/parser.js.map +1 -0
  505. package/build/treb-utils/src/event_source.d.ts +34 -0
  506. package/build/treb-utils/src/event_source.js +110 -0
  507. package/build/treb-utils/src/event_source.js.map +1 -0
  508. package/build/treb-utils/src/ievent_source.d.ts +9 -0
  509. package/build/treb-utils/src/ievent_source.js +22 -0
  510. package/build/treb-utils/src/ievent_source.js.map +1 -0
  511. package/build/treb-utils/src/index.d.ts +6 -0
  512. package/build/treb-utils/src/index.js +30 -0
  513. package/build/treb-utils/src/index.js.map +1 -0
  514. package/build/treb-utils/src/measurement.d.ts +42 -0
  515. package/build/treb-utils/src/measurement.js +145 -0
  516. package/build/treb-utils/src/measurement.js.map +1 -0
  517. package/build/treb-utils/src/scale.d.ts +16 -0
  518. package/build/treb-utils/src/scale.js +106 -0
  519. package/build/treb-utils/src/scale.js.map +1 -0
  520. package/build/treb-utils/src/serialize_html.d.ts +5 -0
  521. package/build/treb-utils/src/serialize_html.js +128 -0
  522. package/build/treb-utils/src/serialize_html.js.map +1 -0
  523. package/build/treb-utils/src/validate_uri.d.ts +20 -0
  524. package/build/treb-utils/src/validate_uri.js +55 -0
  525. package/build/treb-utils/src/validate_uri.js.map +1 -0
  526. package/dist/{chunk-Z4XFMZ2X.mjs → chunk-E35ONJUS.mjs} +1 -1
  527. package/dist/treb-export-worker.mjs +2 -2
  528. package/dist/treb-spreadsheet.mjs +4 -4
  529. package/dist/treb.d.ts +1 -1
  530. package/esbuild-composite.mjs +5 -1
  531. package/package.json +67 -3
  532. package/treb-embed/src/custom-element/spreadsheet-constructor.ts +7 -3
  533. package/treb-embed/src/embedded-spreadsheet.ts +1 -1
  534. package/treb-grid/src/types/grid_options.ts +1 -1
  535. package/tsproject.json +1 -2
  536. package/dist/chunk-43DLP2OX.mjs +0 -11
  537. package/dist/chunk-4CKS56PE.mjs +0 -11
  538. package/dist/chunk-75PARUQE.mjs +0 -11
  539. package/dist/chunk-7QD63AZS.mjs +0 -24601
  540. package/dist/chunk-A55ARVRD.mjs +0 -11
  541. package/dist/chunk-DESAKYW4.mjs +0 -11
  542. package/dist/chunk-EQ2R5W6P.mjs +0 -24565
  543. package/dist/chunk-IYJU2J6D.mjs +0 -24601
  544. package/dist/chunk-KSJFPGXT.mjs +0 -11
  545. package/dist/chunk-MQK4DNXI.mjs +0 -11
  546. package/dist/chunk-ORQFKLXM.mjs +0 -24601
  547. package/dist/chunk-SFDNNDHY.mjs +0 -11
  548. package/dist/chunk-T47DX5MI.mjs +0 -11
  549. package/dist/chunk-T6ILBVEX.mjs +0 -11
  550. package/dist/chunk-TPRCDYYG.mjs +0 -11
  551. package/dist/chunk-YAHNOOHO.mjs +0 -11
  552. package/dist/chunk-YLCFKX2G.mjs +0 -24601
@@ -0,0 +1,373 @@
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
+ const empty_json = JSON.stringify({}); // we could probably hard-code this
22
+ const ThemeColorMap = {
23
+ 'Background': 0,
24
+ 'Text': 1,
25
+ 'Background2': 2,
26
+ 'Text2': 3,
27
+ 'Accent': 4,
28
+ 'Accent2': 5,
29
+ 'Accent3': 6,
30
+ 'Accent4': 7,
31
+ 'Accent5': 8,
32
+ 'Accent6': 9,
33
+ };
34
+ /*
35
+ for (const [index, entry] of ThemeColorList.entries()) {
36
+ ThemeColorMap[entry] = index;
37
+ }
38
+ */
39
+ export const ThemeColorIndex = (color) => {
40
+ if (typeof color.theme === 'number') {
41
+ return color.theme;
42
+ }
43
+ return ThemeColorMap[color.theme] || 0;
44
+ };
45
+ export const IsHTMLColor = (color) => {
46
+ return !!color && (typeof color.text === 'string');
47
+ };
48
+ export const IsThemeColor = (color) => {
49
+ return !!color && (typeof color.theme !== 'undefined');
50
+ };
51
+ export const IsDefinedColor = (color) => {
52
+ return !!color && ((typeof color.text === 'string') ||
53
+ (typeof color.theme !== 'undefined'));
54
+ };
55
+ /**
56
+ * (finally) removing the old namespace. we keep this object around for
57
+ * some internal methods, but all the types have moved to the top-level
58
+ * of this module and need to be imported separately.
59
+ *
60
+ * we could theoretically build a backcompat module that re-exports all
61
+ * the types, but it's probably not necessary -- most updates will just
62
+ * require a find-and-replace (plus adding some imports).
63
+ *
64
+ * @internal
65
+ */
66
+ export const Style = {
67
+ /**
68
+ * note that there are no default colors; those should be set
69
+ * in grid when style is applied. that way the default colors for
70
+ * border, text and background colors will be theme-dependent and
71
+ * can change.
72
+ *
73
+ * @internal
74
+ */
75
+ DefaultProperties: {
76
+ horizontal_align: '',
77
+ vertical_align: '',
78
+ number_format: 'General', // '0.######', // use symbolic, e.g. "general"
79
+ nan: 'NaN',
80
+ font_size: { unit: 'em', value: 1 },
81
+ // font_size: { unit: 'pt', value: 10.5 },
82
+ // font_face: 'sans-serif',
83
+ bold: false, // drop "font_"
84
+ italic: false, // ...
85
+ underline: false, // ...
86
+ strike: false, //
87
+ text: { theme: 1 },
88
+ border_top: 0, // adding defaults so these prune propery
89
+ border_left: 0,
90
+ border_right: 0,
91
+ border_bottom: 0,
92
+ },
93
+ /**
94
+ * this is a utility function for callers that use borders, to
95
+ * reduce testing and facilitate reusable methods
96
+ *
97
+ * @internal
98
+ */
99
+ CompositeBorders: (style) => {
100
+ return {
101
+ top: {
102
+ width: style.border_top || 0,
103
+ color: style.border_top_fill || {},
104
+ },
105
+ left: {
106
+ width: style.border_left || 0,
107
+ color: style.border_left_fill || {},
108
+ },
109
+ right: {
110
+ width: style.border_right || 0,
111
+ color: style.border_right_fill || {},
112
+ },
113
+ bottom: {
114
+ width: style.border_bottom || 0,
115
+ color: style.border_bottom_fill || {},
116
+ },
117
+ };
118
+ },
119
+ Serialize: (style) => {
120
+ const clone = JSON.parse(JSON.stringify(style));
121
+ // scrub border colors without widths
122
+ if (clone.border_bottom_fill && !clone.border_bottom) {
123
+ clone.border_bottom_fill = undefined;
124
+ }
125
+ if (clone.border_top_fill && !clone.border_top) {
126
+ clone.border_top_fill = undefined;
127
+ }
128
+ if (clone.border_left_fill && !clone.border_left) {
129
+ clone.border_left_fill = undefined;
130
+ }
131
+ if (clone.border_right_fill && !clone.border_right) {
132
+ clone.border_right_fill = undefined;
133
+ }
134
+ return JSON.stringify(clone);
135
+ },
136
+ /**
137
+ * merge. returns a new object, does not update dest in place.
138
+ * NOTE: if it does not update dest in place, then what would be
139
+ * the use case for a non-delta merge? (...)
140
+ *
141
+ * @internal
142
+ */
143
+ Merge: (dest, src, delta = true) => {
144
+ const properties = delta ? { ...dest, ...src } : { ...src };
145
+ return JSON.parse(JSON.stringify(properties));
146
+ },
147
+ /** @internal */
148
+ Composite: (list) => {
149
+ return JSON.parse(JSON.stringify(list.reduce((composite, item) => ({ ...composite, ...item }), {})));
150
+ },
151
+ /** @internal */
152
+ Empty: (style) => {
153
+ return JSON.stringify(style) === empty_json;
154
+ },
155
+ /* *
156
+ * this looks like a type guard, we should switch to a union
157
+ * type and then add real type guards
158
+ *
159
+ * @internal
160
+ * /
161
+ ValidColor: (color?: Color): boolean => {
162
+ return !!(color && (!color.none) && (color.text || color.theme || color.theme === 0));
163
+ },
164
+ */
165
+ /** @internal */
166
+ ParseFontSize: (text = '', default_unit = 'em') => {
167
+ const match = text.match(/(-*[\d.]+)\s*(\S*)/);
168
+ if (match) {
169
+ const value = Number(match[1]);
170
+ if (!value || isNaN(value) || value < 0) {
171
+ return {}; // invalid
172
+ }
173
+ const unit = match[2].toLowerCase() || default_unit;
174
+ if (unit === 'pt' || unit === 'em' || unit === '%' || unit === 'px') {
175
+ // return { font_size_unit: unit, font_size_value: value };
176
+ return {
177
+ font_size: { unit, value },
178
+ };
179
+ }
180
+ }
181
+ return {};
182
+ },
183
+ /**
184
+ * returns the font size of the properties argument as a ratio of the
185
+ * base argument. this is intended to show the relative font size of
186
+ * a spreadsheet cell; so anything with no value should be "1", and
187
+ * everything else is relative to that.
188
+ *
189
+ * we prefer relative sizes (em, essentially) to fixed sizes because
190
+ * we may have different base font sizes on different platforms (we do,
191
+ * in fact, on windows because calibri is too small).
192
+ *
193
+ * using relative sizes helps ensure that it looks similar, if not
194
+ * identical, on different platforms.
195
+ *
196
+ * @internal
197
+ */
198
+ RelativeFontSize: (properties, base) => {
199
+ // we can assume (I think) that base will be either points or px;
200
+ // there's no case where it should be relative. in fact, let's treat
201
+ // that as an error and return 1.
202
+ // note that if properties is relative (em or %) we don't have to
203
+ // calculate, it's implicit
204
+ let base_pt = 12;
205
+ let props_pt = 12;
206
+ switch (properties.font_size?.unit) {
207
+ case 'pt':
208
+ if (!properties.font_size.value) {
209
+ return 1;
210
+ } // also error
211
+ props_pt = properties.font_size.value;
212
+ break;
213
+ case 'px':
214
+ if (!properties.font_size.value) {
215
+ return 1;
216
+ } // also error
217
+ props_pt = Math.round(properties.font_size.value * 300 / 4) / 100;
218
+ break;
219
+ case 'em':
220
+ return (properties.font_size.value || 1); // short circuit
221
+ case '%':
222
+ return (properties.font_size.value || 100) / 100; // short circuit
223
+ default:
224
+ return 1; // error
225
+ }
226
+ switch (base.font_size?.unit) {
227
+ case 'pt':
228
+ if (!base.font_size.value) {
229
+ return 1;
230
+ } // also error
231
+ base_pt = base.font_size.value;
232
+ break;
233
+ case 'px':
234
+ if (!base.font_size.value) {
235
+ return 1;
236
+ } // also error
237
+ base_pt = Math.round(base.font_size.value * 300 / 4) / 100;
238
+ break;
239
+ default:
240
+ return 1; // error
241
+ }
242
+ return props_pt / base_pt;
243
+ },
244
+ /**
245
+ * @internal
246
+ */
247
+ FontSize: (properties, prefer_points = true) => {
248
+ const value = properties.font_size?.value;
249
+ switch (properties.font_size?.unit) {
250
+ case 'pt':
251
+ return (value || 12) + 'pt';
252
+ case 'px':
253
+ if (prefer_points) {
254
+ const points = Math.round((value || 16) * 300 / 4) / 100;
255
+ return (points) + 'pt';
256
+ }
257
+ return (value || 16) + 'px';
258
+ case 'em':
259
+ return (value || 1) + 'em';
260
+ case '%':
261
+ return (value || 100) + '%';
262
+ }
263
+ return '';
264
+ },
265
+ /**
266
+ * @internal
267
+ *
268
+ * generate a font size based on a base size (hopefully in actual units)
269
+ * and a relative size (em, %, or possibly a static unit). also optionally
270
+ * apply a scale.
271
+ *
272
+ */
273
+ CompositeFontSize: (base, relative, scale = 1, prefer_points = false) => {
274
+ let composite = { ...base };
275
+ // maybe it's actually not relative
276
+ if (relative.unit === 'pt' || relative.unit === 'px') {
277
+ composite = { ...relative };
278
+ }
279
+ else {
280
+ composite.value = relative.value * base.value;
281
+ if (relative.unit === '%') {
282
+ composite.value /= 100;
283
+ }
284
+ }
285
+ if (composite.unit === 'px' && prefer_points) {
286
+ composite.value = Math.round((composite.value || 16) * 300 / 4) / 100;
287
+ }
288
+ composite.value *= scale;
289
+ return composite;
290
+ },
291
+ /**
292
+ * return a font string suitable for canvas. because our font sizes are
293
+ * (probably) in ems, we need a base size to bounce off.
294
+ */
295
+ CompositeFont: (base, properties, scale, theme) => {
296
+ let variants;
297
+ let stack_size; // for reporting only
298
+ let font_size;
299
+ const parts = [];
300
+ if (properties.bold) {
301
+ parts.push('bold');
302
+ }
303
+ if (properties.italic) {
304
+ parts.push('italic');
305
+ }
306
+ const font_face = properties.font_face || 'stack:default';
307
+ // let stack_scale = 1;
308
+ // check if this is a stack
309
+ if (font_face.startsWith('stack:')) {
310
+ let stack = theme.font_stacks[font_face.substring(6) || 'default'];
311
+ // default to default (not just a clever name). the rationale is we
312
+ // want to support environments that don't have fonts turned on. in
313
+ // that case, we just don't create the mappings, so everything shows
314
+ // as the default font.
315
+ if (!stack) {
316
+ stack = theme.font_stacks.default;
317
+ }
318
+ if (stack) {
319
+ stack_size = properties.font_size;
320
+ font_size = Style.CompositeFontSize(stack.size, properties.font_size || { unit: 'pt', value: 10 }, scale);
321
+ parts.push(font_size.value.toFixed(2) + font_size.unit);
322
+ parts.push(stack.font || '');
323
+ variants = stack.variants;
324
+ }
325
+ }
326
+ else {
327
+ font_size = Style.CompositeFontSize(base, properties.font_size || { unit: 'pt', value: 10 }, scale);
328
+ parts.push(font_size.value.toFixed(2) + font_size.unit);
329
+ parts.push(font_face || '');
330
+ }
331
+ return { font: parts.join(' '), variants, base, size: properties.font_size, scale, stack_size, font_size };
332
+ },
333
+ /*
334
+ Font2: (properties: CellStyle, scale: number, theme: Theme) => {
335
+
336
+ let features = false;
337
+
338
+ const parts: string[] = [];
339
+
340
+ if (properties.bold) {
341
+ parts.push('bold');
342
+ }
343
+
344
+ if (properties.italic) {
345
+ parts.push('italic');
346
+ }
347
+
348
+ const font_face = properties.font_face || 'stack:default';
349
+ let stack_scale = 1;
350
+
351
+ // check if this is a stack
352
+ if (font_face.startsWith('stack:')) {
353
+ const stack = theme.font_stacks[font_face.substring(6) || 'default'];
354
+ if (stack) {
355
+ stack_scale = stack.scale;
356
+ parts.push(((properties.font_size?.value || 0) * (scale || 1) * (stack.scale || 1)).toFixed(2) +
357
+ (properties.font_size?.unit || 'pt'));
358
+ parts.push(stack.font || '');
359
+ features = !!stack.apply_num_features;
360
+ }
361
+ }
362
+ else {
363
+ parts.push(((properties.font_size?.value || 0) * (scale || 1)).toFixed(2) +
364
+ (properties.font_size?.unit || 'pt'));
365
+ parts.push(font_face || '');
366
+ }
367
+
368
+ return { font: parts.join(' '), features, base_size: properties.font_size, scale, stack_scale };
369
+
370
+ },
371
+ */
372
+ };
373
+ //# sourceMappingURL=style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.js","sourceRoot":"","sources":["../../../treb-base-types/src/style.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;MAsCE;CAEH,CAAC"}
@@ -0,0 +1,58 @@
1
+ import type { IArea } from './area';
2
+ import type { TableTheme } from './theme';
3
+ export type TableSortType = 'text' | 'numeric' | 'auto';
4
+ export interface TableSortOptions {
5
+ /**
6
+ * when sorting, column is relative to the table (and 0-based). so the
7
+ * first column in the table is 0, regardless of where the table is in
8
+ * the spreadsheet. defaults to 0, if not specified.
9
+ */
10
+ column: number;
11
+ /**
12
+ * sort type. defaults to 'auto'. 'auto' looks at the values in the column,
13
+ * and uses text sort if there are more strings, or numeric if there are
14
+ * more numbers. if it's even, sorts as text.
15
+ */
16
+ type: TableSortType;
17
+ /** ascending sort. defaults to true. */
18
+ asc: boolean;
19
+ }
20
+ /** @internal */
21
+ export declare const DefaultTableSortOptions: TableSortOptions;
22
+ /**
23
+ * struct representing a table
24
+ */
25
+ export interface Table {
26
+ /**
27
+ * table must have a name
28
+ */
29
+ name: string;
30
+ /** table area */
31
+ area: IArea;
32
+ /**
33
+ * table column headers. normalize case before inserting.
34
+ */
35
+ columns?: string[];
36
+ /**
37
+ * table has a totals row. this impacts layout and what's included
38
+ * in the range when you refer to a column. also on import/export, the
39
+ * AutoFilter element should exclude the totals row.
40
+ *
41
+ * NOTE: xlsx actually uses an integer for this -- can it be > 1?
42
+ */
43
+ totals_row?: boolean;
44
+ /**
45
+ * table is sortable. defaults to true. if false, disables UI sorting.
46
+ */
47
+ sortable?: boolean;
48
+ /**
49
+ * theme for table. we have a default, but you can set explicitly.
50
+ */
51
+ theme?: TableTheme;
52
+ /**
53
+ * sort data. sorts are hard, meaning we actually move data around.
54
+ * (not meaning difficult). we may keep track of the last sort so we
55
+ * can toggle asc/desc, for example. atm this will not survive serialization.
56
+ */
57
+ sort?: TableSortOptions;
58
+ }
@@ -0,0 +1,27 @@
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
+ /** @internal */
22
+ export const DefaultTableSortOptions = {
23
+ column: 0,
24
+ type: 'auto',
25
+ asc: true,
26
+ };
27
+ //# sourceMappingURL=table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.js","sourceRoot":"","sources":["../../../treb-base-types/src/table.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AA6BH,gBAAgB;AAChB,MAAM,CAAC,MAAM,uBAAuB,GAAqB;IACvD,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,IAAI;CACV,CAAC"}
@@ -0,0 +1,26 @@
1
+ export declare enum TextPartFlag {
2
+ /** just render */
3
+ default = 0,
4
+ /** not rendered, but included in layout (spacing) */
5
+ hidden = 1,
6
+ /** takes up all available space */
7
+ padded = 2,
8
+ /** date component, needs to be filled */
9
+ date_component = 3,
10
+ /** special flag for minutes (instead of months), which is contextual */
11
+ date_component_minutes = 4,
12
+ /** literal (@): reflect the original */
13
+ literal = 5,
14
+ /** formatting (e.g. [red]) */
15
+ formatting = 6,
16
+ /**
17
+ * this is an indent component. we want to keep track of this
18
+ * so we don't add it more than once if we're indenting dynamically.
19
+ * maybe this is not the way to indent.
20
+ */
21
+ indent = 8
22
+ }
23
+ export interface TextPart {
24
+ text: string;
25
+ flag?: TextPartFlag;
26
+ }
@@ -0,0 +1,47 @@
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
+ export var TextPartFlag;
22
+ (function (TextPartFlag) {
23
+ /** just render */
24
+ TextPartFlag[TextPartFlag["default"] = 0] = "default";
25
+ /** not rendered, but included in layout (spacing) */
26
+ TextPartFlag[TextPartFlag["hidden"] = 1] = "hidden";
27
+ /** takes up all available space */
28
+ TextPartFlag[TextPartFlag["padded"] = 2] = "padded";
29
+ /** date component, needs to be filled */
30
+ TextPartFlag[TextPartFlag["date_component"] = 3] = "date_component";
31
+ /** special flag for minutes (instead of months), which is contextual */
32
+ TextPartFlag[TextPartFlag["date_component_minutes"] = 4] = "date_component_minutes";
33
+ /** literal (@): reflect the original */
34
+ TextPartFlag[TextPartFlag["literal"] = 5] = "literal";
35
+ /** formatting (e.g. [red]) */
36
+ TextPartFlag[TextPartFlag["formatting"] = 6] = "formatting";
37
+ /* * testing, for complex
38
+ italic = 7,
39
+ */
40
+ /**
41
+ * this is an indent component. we want to keep track of this
42
+ * so we don't add it more than once if we're indenting dynamically.
43
+ * maybe this is not the way to indent.
44
+ */
45
+ TextPartFlag[TextPartFlag["indent"] = 8] = "indent";
46
+ })(TextPartFlag || (TextPartFlag = {}));
47
+ //# sourceMappingURL=text_part.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text_part.js","sourceRoot":"","sources":["../../../treb-base-types/src/text_part.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,CAAN,IAAY,YAkCX;AAlCD,WAAY,YAAY;IAEtB,kBAAkB;IAClB,qDAAW,CAAA;IAEX,qDAAqD;IACrD,mDAAU,CAAA;IAEV,mCAAmC;IACnC,mDAAU,CAAA;IAEV,yCAAyC;IACzC,mEAAkB,CAAA;IAElB,wEAAwE;IACxE,mFAA0B,CAAA;IAE1B,wCAAwC;IACxC,qDAAW,CAAA;IAEX,8BAA8B;IAC9B,2DAAc,CAAA;IAEd;;MAEE;IAEF;;;;OAIG;IACH,mDAAU,CAAA;AAEZ,CAAC,EAlCW,YAAY,KAAZ,YAAY,QAkCvB"}
@@ -0,0 +1,120 @@
1
+ import { type Color, type CellStyle, type FontSize } from './style';
2
+ import { type FontStack } from './font-stack';
3
+ /**
4
+ * composite styling for tables.
5
+ *
6
+ * @privateRemarks
7
+ *
8
+ * we used to have a "footer", now removed. use borders on rows.
9
+ */
10
+ export interface TableTheme {
11
+ /** the first row in a table, showing column titles. */
12
+ header?: CellStyle;
13
+ /**
14
+ * odd rows in the table. we count the title row as zero, so
15
+ * the first row in the table containing data is 1, hence odd.
16
+ */
17
+ odd?: CellStyle;
18
+ /**
19
+ * even rows in the table.
20
+ */
21
+ even?: CellStyle;
22
+ /**
23
+ * styling for the totals row, if included. this will be the last
24
+ * row in the table.
25
+ */
26
+ total?: CellStyle;
27
+ }
28
+ /** theme options - colors and fonts */
29
+ export interface Theme {
30
+ /** grid headers (composite) */
31
+ headers?: CellStyle;
32
+ /** grid cell defaults (composite: size, font face, color, background) */
33
+ grid_cell?: CellStyle;
34
+ /**
35
+ * base font size for grid cell. we try to specify things in ems, but
36
+ * we do need to know this in order to measure
37
+ */
38
+ grid_cell_font_size: FontSize;
39
+ /** gridlines color */
40
+ grid_color: string;
41
+ /**
42
+ * new: gridlines color for headers. should default to the regular grid
43
+ * color unless it's explicitly set.
44
+ */
45
+ headers_grid_color?: string;
46
+ /** color of grid lines */
47
+ /** color of in-cell note marker */
48
+ note_marker_color: string;
49
+ /** theme colors */
50
+ theme_colors?: string[];
51
+ /** as RGB, so we can adjust them */
52
+ theme_colors_rgb?: [number, number, number][];
53
+ /**
54
+ * cache tinted colors. the way this works is we index by the
55
+ * theme color first, then by the tint value.
56
+ *
57
+ * TODO: we could reduce the tint space... the values look like
58
+ * they are fairly regular (todo)
59
+ *
60
+ * what we are doing now is rounding to 2 decimal places on import, that
61
+ * cleans up the super precise values we get from excel to more reasonable
62
+ * values for keys, and I don't think most people can tell the difference
63
+ * between tinting 25% vs 24.99999872%
64
+ */
65
+ tint_cache?: Record<number, string>[];
66
+ /**
67
+ * cache for offset colors
68
+ */
69
+ offset_cache?: Record<string, string>;
70
+ /**
71
+ * this is now default, but you can set explicitly per-table
72
+ */
73
+ table?: TableTheme;
74
+ /**
75
+ * this is for tinting. we're experimenting with tinting towards black
76
+ * or white, as opposed to lightening/darkening colors. this should improve
77
+ * swapping themed colors.
78
+ *
79
+ * how to derive this value? @see DeriveColorScheme
80
+ */
81
+ mode: 'light' | 'dark';
82
+ /** light color for offset (against dark background) */
83
+ offset_light: string;
84
+ /** dark color for offset (against light background) */
85
+ offset_dark: string;
86
+ /** precalculated font stacks */
87
+ font_stacks: Record<string, FontStack>;
88
+ }
89
+ /**
90
+ * @internal
91
+ */
92
+ export declare const DefaultTheme: Theme;
93
+ /**
94
+ * this includes an implicit check for valid color, if a color
95
+ * can't be resolved it returns ''. now supports offset colors.
96
+ * offset returns a light color against a dark background, and
97
+ * vice versa. what constitutes a dark background is not entirely
98
+ * clear; atm using lightness = .65.
99
+ *
100
+ * @internal
101
+ */
102
+ export declare const ResolveThemeColor: (theme: Theme, color?: Color, default_index?: number) => string;
103
+ /**
104
+ * this is a shortcut for creating table formats based on theme colors.
105
+ * TODO: we might want to swap styles based on light/dark mode?
106
+ *
107
+ * @internal
108
+ */
109
+ export declare const ThemeColorTable: (theme_color: number, tint?: number) => TableTheme;
110
+ /**
111
+ * for stuff that's painted, we wamt to get the corresponding CSS value.
112
+ * we now set everything via CSS variables, but using the node structure
113
+ * allows us to read calculated values, especially when there are cascades.
114
+ *
115
+ * I keep trying to change this to just read CSS variables, but that does
116
+ * not do the same thing.
117
+ *
118
+ * @internal
119
+ */
120
+ export declare const LoadThemeProperties: (container: HTMLElement, use_font_stacks?: boolean) => Theme;