@trebco/treb 37.0.0 → 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 (528) hide show
  1. package/build/package.json +119 -0
  2. package/build/treb-base-types/src/api_types.d.ts +11 -0
  3. package/build/treb-base-types/src/api_types.js +22 -0
  4. package/build/treb-base-types/src/api_types.js.map +1 -0
  5. package/build/treb-base-types/src/area-utils.d.ts +9 -0
  6. package/build/treb-base-types/src/area-utils.js +50 -0
  7. package/build/treb-base-types/src/area-utils.js.map +1 -0
  8. package/build/treb-base-types/src/area.d.ts +182 -0
  9. package/build/treb-base-types/src/area.js +715 -0
  10. package/build/treb-base-types/src/area.js.map +1 -0
  11. package/build/treb-base-types/src/basic_types.d.ts +20 -0
  12. package/build/treb-base-types/src/basic_types.js +22 -0
  13. package/build/treb-base-types/src/basic_types.js.map +1 -0
  14. package/build/treb-base-types/src/cell.d.ts +167 -0
  15. package/build/treb-base-types/src/cell.js +432 -0
  16. package/build/treb-base-types/src/cell.js.map +1 -0
  17. package/build/treb-base-types/src/cells.d.ts +251 -0
  18. package/build/treb-base-types/src/cells.js +1136 -0
  19. package/build/treb-base-types/src/cells.js.map +1 -0
  20. package/build/treb-base-types/src/color.d.ts +35 -0
  21. package/build/treb-base-types/src/color.js +162 -0
  22. package/build/treb-base-types/src/color.js.map +1 -0
  23. package/build/treb-base-types/src/dom-utilities.d.ts +70 -0
  24. package/build/treb-base-types/src/dom-utilities.js +144 -0
  25. package/build/treb-base-types/src/dom-utilities.js.map +1 -0
  26. package/build/treb-base-types/src/evaluate-options.d.ts +35 -0
  27. package/build/treb-base-types/src/evaluate-options.js +22 -0
  28. package/build/treb-base-types/src/evaluate-options.js.map +1 -0
  29. package/build/treb-base-types/src/font-stack.d.ts +37 -0
  30. package/build/treb-base-types/src/font-stack.js +93 -0
  31. package/build/treb-base-types/src/font-stack.js.map +1 -0
  32. package/build/treb-base-types/src/gradient.d.ts +18 -0
  33. package/build/treb-base-types/src/gradient.js +86 -0
  34. package/build/treb-base-types/src/gradient.js.map +1 -0
  35. package/build/treb-base-types/src/import.d.ts +48 -0
  36. package/build/treb-base-types/src/import.js +22 -0
  37. package/build/treb-base-types/src/import.js.map +1 -0
  38. package/build/treb-base-types/src/index-standalone.d.ts +6 -0
  39. package/build/treb-base-types/src/index-standalone.js +27 -0
  40. package/build/treb-base-types/src/index-standalone.js.map +1 -0
  41. package/build/treb-base-types/src/index.d.ts +22 -0
  42. package/build/treb-base-types/src/index.js +45 -0
  43. package/build/treb-base-types/src/index.js.map +1 -0
  44. package/build/treb-base-types/src/layout.d.ts +22 -0
  45. package/build/treb-base-types/src/layout.js +22 -0
  46. package/build/treb-base-types/src/layout.js.map +1 -0
  47. package/build/treb-base-types/src/localization.d.ts +37 -0
  48. package/build/treb-base-types/src/localization.js +157 -0
  49. package/build/treb-base-types/src/localization.js.map +1 -0
  50. package/build/treb-base-types/src/rectangle.d.ts +51 -0
  51. package/build/treb-base-types/src/rectangle.js +123 -0
  52. package/build/treb-base-types/src/rectangle.js.map +1 -0
  53. package/build/treb-base-types/src/render_text.d.ts +34 -0
  54. package/build/treb-base-types/src/render_text.js +22 -0
  55. package/build/treb-base-types/src/render_text.js.map +1 -0
  56. package/build/treb-base-types/src/style.d.ts +214 -0
  57. package/build/treb-base-types/src/style.js +373 -0
  58. package/build/treb-base-types/src/style.js.map +1 -0
  59. package/build/treb-base-types/src/table.d.ts +58 -0
  60. package/build/treb-base-types/src/table.js +27 -0
  61. package/build/treb-base-types/src/table.js.map +1 -0
  62. package/build/treb-base-types/src/text_part.d.ts +26 -0
  63. package/build/treb-base-types/src/text_part.js +47 -0
  64. package/build/treb-base-types/src/text_part.js.map +1 -0
  65. package/build/treb-base-types/src/theme.d.ts +120 -0
  66. package/build/treb-base-types/src/theme.js +460 -0
  67. package/build/treb-base-types/src/theme.js.map +1 -0
  68. package/build/treb-base-types/src/union.d.ts +73 -0
  69. package/build/treb-base-types/src/union.js +61 -0
  70. package/build/treb-base-types/src/union.js.map +1 -0
  71. package/build/treb-base-types/src/value-type.d.ts +86 -0
  72. package/build/treb-base-types/src/value-type.js +168 -0
  73. package/build/treb-base-types/src/value-type.js.map +1 -0
  74. package/build/treb-base-types/src/worker-proxy.d.ts +95 -0
  75. package/build/treb-base-types/src/worker-proxy.js +221 -0
  76. package/build/treb-base-types/src/worker-proxy.js.map +1 -0
  77. package/build/treb-calculator/src/calculator.d.ts +249 -0
  78. package/build/treb-calculator/src/calculator.js +2755 -0
  79. package/build/treb-calculator/src/calculator.js.map +1 -0
  80. package/build/treb-calculator/src/complex-math.d.ts +75 -0
  81. package/build/treb-calculator/src/complex-math.js +559 -0
  82. package/build/treb-calculator/src/complex-math.js.map +1 -0
  83. package/build/treb-calculator/src/dag/array-vertex.d.ts +71 -0
  84. package/build/treb-calculator/src/dag/array-vertex.js +156 -0
  85. package/build/treb-calculator/src/dag/array-vertex.js.map +1 -0
  86. package/build/treb-calculator/src/dag/calculation_leaf_vertex.d.ts +48 -0
  87. package/build/treb-calculator/src/dag/calculation_leaf_vertex.js +84 -0
  88. package/build/treb-calculator/src/dag/calculation_leaf_vertex.js.map +1 -0
  89. package/build/treb-calculator/src/dag/graph.d.ts +134 -0
  90. package/build/treb-calculator/src/dag/graph.js +842 -0
  91. package/build/treb-calculator/src/dag/graph.js.map +1 -0
  92. package/build/treb-calculator/src/dag/spreadsheet_vertex.d.ts +58 -0
  93. package/build/treb-calculator/src/dag/spreadsheet_vertex.js +232 -0
  94. package/build/treb-calculator/src/dag/spreadsheet_vertex.js.map +1 -0
  95. package/build/treb-calculator/src/dag/spreadsheet_vertex_base.d.ts +20 -0
  96. package/build/treb-calculator/src/dag/spreadsheet_vertex_base.js +25 -0
  97. package/build/treb-calculator/src/dag/spreadsheet_vertex_base.js.map +1 -0
  98. package/build/treb-calculator/src/dag/state_leaf_vertex.d.ts +43 -0
  99. package/build/treb-calculator/src/dag/state_leaf_vertex.js +81 -0
  100. package/build/treb-calculator/src/dag/state_leaf_vertex.js.map +1 -0
  101. package/build/treb-calculator/src/dag/vertex.d.ts +71 -0
  102. package/build/treb-calculator/src/dag/vertex.js +274 -0
  103. package/build/treb-calculator/src/dag/vertex.js.map +1 -0
  104. package/build/treb-calculator/src/descriptors.d.ts +189 -0
  105. package/build/treb-calculator/src/descriptors.js +22 -0
  106. package/build/treb-calculator/src/descriptors.js.map +1 -0
  107. package/build/treb-calculator/src/expression-calculator.d.ts +127 -0
  108. package/build/treb-calculator/src/expression-calculator.js +1033 -0
  109. package/build/treb-calculator/src/expression-calculator.js.map +1 -0
  110. package/build/treb-calculator/src/function-error.d.ts +35 -0
  111. package/build/treb-calculator/src/function-error.js +85 -0
  112. package/build/treb-calculator/src/function-error.js.map +1 -0
  113. package/build/treb-calculator/src/function-library.d.ts +22 -0
  114. package/build/treb-calculator/src/function-library.js +96 -0
  115. package/build/treb-calculator/src/function-library.js.map +1 -0
  116. package/build/treb-calculator/src/functions/base-functions.d.ts +7 -0
  117. package/build/treb-calculator/src/functions/base-functions.js +2611 -0
  118. package/build/treb-calculator/src/functions/base-functions.js.map +1 -0
  119. package/build/treb-calculator/src/functions/beta.d.ts +17 -0
  120. package/build/treb-calculator/src/functions/beta.js +201 -0
  121. package/build/treb-calculator/src/functions/beta.js.map +1 -0
  122. package/build/treb-calculator/src/functions/checkbox.d.ts +3 -0
  123. package/build/treb-calculator/src/functions/checkbox.js +128 -0
  124. package/build/treb-calculator/src/functions/checkbox.js.map +1 -0
  125. package/build/treb-calculator/src/functions/complex-functions.d.ts +2 -0
  126. package/build/treb-calculator/src/functions/complex-functions.js +217 -0
  127. package/build/treb-calculator/src/functions/complex-functions.js.map +1 -0
  128. package/build/treb-calculator/src/functions/date-utils.d.ts +3 -0
  129. package/build/treb-calculator/src/functions/date-utils.js +59 -0
  130. package/build/treb-calculator/src/functions/date-utils.js.map +1 -0
  131. package/build/treb-calculator/src/functions/finance-functions.d.ts +2 -0
  132. package/build/treb-calculator/src/functions/finance-functions.js +547 -0
  133. package/build/treb-calculator/src/functions/finance-functions.js.map +1 -0
  134. package/build/treb-calculator/src/functions/fp.d.ts +2 -0
  135. package/build/treb-calculator/src/functions/fp.js +463 -0
  136. package/build/treb-calculator/src/functions/fp.js.map +1 -0
  137. package/build/treb-calculator/src/functions/function-utilities.d.ts +2 -0
  138. package/build/treb-calculator/src/functions/function-utilities.js +36 -0
  139. package/build/treb-calculator/src/functions/function-utilities.js.map +1 -0
  140. package/build/treb-calculator/src/functions/gamma.d.ts +20 -0
  141. package/build/treb-calculator/src/functions/gamma.js +142 -0
  142. package/build/treb-calculator/src/functions/gamma.js.map +1 -0
  143. package/build/treb-calculator/src/functions/information-functions.d.ts +2 -0
  144. package/build/treb-calculator/src/functions/information-functions.js +71 -0
  145. package/build/treb-calculator/src/functions/information-functions.js.map +1 -0
  146. package/build/treb-calculator/src/functions/lambda-functions.d.ts +2 -0
  147. package/build/treb-calculator/src/functions/lambda-functions.js +85 -0
  148. package/build/treb-calculator/src/functions/lambda-functions.js.map +1 -0
  149. package/build/treb-calculator/src/functions/matrix-functions.d.ts +2 -0
  150. package/build/treb-calculator/src/functions/matrix-functions.js +144 -0
  151. package/build/treb-calculator/src/functions/matrix-functions.js.map +1 -0
  152. package/build/treb-calculator/src/functions/normal.d.ts +2 -0
  153. package/build/treb-calculator/src/functions/normal.js +32 -0
  154. package/build/treb-calculator/src/functions/normal.js.map +1 -0
  155. package/build/treb-calculator/src/functions/regex-functions.d.ts +2 -0
  156. package/build/treb-calculator/src/functions/regex-functions.js +188 -0
  157. package/build/treb-calculator/src/functions/regex-functions.js.map +1 -0
  158. package/build/treb-calculator/src/functions/sparkline.d.ts +37 -0
  159. package/build/treb-calculator/src/functions/sparkline.js +264 -0
  160. package/build/treb-calculator/src/functions/sparkline.js.map +1 -0
  161. package/build/treb-calculator/src/functions/statistics-functions.d.ts +6 -0
  162. package/build/treb-calculator/src/functions/statistics-functions.js +989 -0
  163. package/build/treb-calculator/src/functions/statistics-functions.js.map +1 -0
  164. package/build/treb-calculator/src/functions/students-t.d.ts +3 -0
  165. package/build/treb-calculator/src/functions/students-t.js +64 -0
  166. package/build/treb-calculator/src/functions/students-t.js.map +1 -0
  167. package/build/treb-calculator/src/functions/text-functions.d.ts +3 -0
  168. package/build/treb-calculator/src/functions/text-functions.js +320 -0
  169. package/build/treb-calculator/src/functions/text-functions.js.map +1 -0
  170. package/build/treb-calculator/src/index.d.ts +2 -0
  171. package/build/treb-calculator/src/index.js +22 -0
  172. package/build/treb-calculator/src/index.js.map +1 -0
  173. package/build/treb-calculator/src/notifier-types.d.ts +26 -0
  174. package/build/treb-calculator/src/notifier-types.js +22 -0
  175. package/build/treb-calculator/src/notifier-types.js.map +1 -0
  176. package/build/treb-calculator/src/primitives.d.ts +15 -0
  177. package/build/treb-calculator/src/primitives.js +398 -0
  178. package/build/treb-calculator/src/primitives.js.map +1 -0
  179. package/build/treb-calculator/src/utilities.d.ts +68 -0
  180. package/build/treb-calculator/src/utilities.js +324 -0
  181. package/build/treb-calculator/src/utilities.js.map +1 -0
  182. package/build/treb-charts/src/chart-functions.d.ts +8 -0
  183. package/build/treb-charts/src/chart-functions.js +209 -0
  184. package/build/treb-charts/src/chart-functions.js.map +1 -0
  185. package/build/treb-charts/src/chart-types.d.ts +233 -0
  186. package/build/treb-charts/src/chart-types.js +57 -0
  187. package/build/treb-charts/src/chart-types.js.map +1 -0
  188. package/build/treb-charts/src/chart-utils.d.ts +106 -0
  189. package/build/treb-charts/src/chart-utils.js +1060 -0
  190. package/build/treb-charts/src/chart-utils.js.map +1 -0
  191. package/build/treb-charts/src/chart.d.ts +23 -0
  192. package/build/treb-charts/src/chart.js +94 -0
  193. package/build/treb-charts/src/chart.js.map +1 -0
  194. package/build/treb-charts/src/default-chart-renderer.d.ts +16 -0
  195. package/build/treb-charts/src/default-chart-renderer.js +533 -0
  196. package/build/treb-charts/src/default-chart-renderer.js.map +1 -0
  197. package/build/treb-charts/src/index.d.ts +5 -0
  198. package/build/treb-charts/src/index.js +24 -0
  199. package/build/treb-charts/src/index.js.map +1 -0
  200. package/build/treb-charts/src/main.d.ts +1 -0
  201. package/build/treb-charts/src/main.js +34 -0
  202. package/build/treb-charts/src/main.js.map +1 -0
  203. package/build/treb-charts/src/quicksort.d.ts +1 -0
  204. package/build/treb-charts/src/quicksort.js +49 -0
  205. package/build/treb-charts/src/quicksort.js.map +1 -0
  206. package/build/treb-charts/src/rectangle.d.ts +18 -0
  207. package/build/treb-charts/src/rectangle.js +41 -0
  208. package/build/treb-charts/src/rectangle.js.map +1 -0
  209. package/build/treb-charts/src/renderer-type.d.ts +24 -0
  210. package/build/treb-charts/src/renderer-type.js +22 -0
  211. package/build/treb-charts/src/renderer-type.js.map +1 -0
  212. package/build/treb-charts/src/renderer.d.ts +127 -0
  213. package/build/treb-charts/src/renderer.js +1518 -0
  214. package/build/treb-charts/src/renderer.js.map +1 -0
  215. package/build/treb-charts/src/util.d.ts +18 -0
  216. package/build/treb-charts/src/util.js +71 -0
  217. package/build/treb-charts/src/util.js.map +1 -0
  218. package/build/treb-data-model/src/annotation.d.ts +167 -0
  219. package/build/treb-data-model/src/annotation.js +120 -0
  220. package/build/treb-data-model/src/annotation.js.map +1 -0
  221. package/build/treb-data-model/src/conditional_format.d.ts +155 -0
  222. package/build/treb-data-model/src/conditional_format.js +62 -0
  223. package/build/treb-data-model/src/conditional_format.js.map +1 -0
  224. package/build/treb-data-model/src/data-validation.d.ts +28 -0
  225. package/build/treb-data-model/src/data-validation.js +22 -0
  226. package/build/treb-data-model/src/data-validation.js.map +1 -0
  227. package/build/treb-data-model/src/data_model.d.ts +173 -0
  228. package/build/treb-data-model/src/data_model.js +637 -0
  229. package/build/treb-data-model/src/data_model.js.map +1 -0
  230. package/build/treb-data-model/src/index.d.ts +13 -0
  231. package/build/treb-data-model/src/index.js +28 -0
  232. package/build/treb-data-model/src/index.js.map +1 -0
  233. package/build/treb-data-model/src/language-model.d.ts +22 -0
  234. package/build/treb-data-model/src/language-model.js +22 -0
  235. package/build/treb-data-model/src/language-model.js.map +1 -0
  236. package/build/treb-data-model/src/named.d.ts +124 -0
  237. package/build/treb-data-model/src/named.js +372 -0
  238. package/build/treb-data-model/src/named.js.map +1 -0
  239. package/build/treb-data-model/src/serialize_options.d.ts +49 -0
  240. package/build/treb-data-model/src/serialize_options.js +22 -0
  241. package/build/treb-data-model/src/serialize_options.js.map +1 -0
  242. package/build/treb-data-model/src/sheet.d.ts +499 -0
  243. package/build/treb-data-model/src/sheet.js +2904 -0
  244. package/build/treb-data-model/src/sheet.js.map +1 -0
  245. package/build/treb-data-model/src/sheet_collection.d.ts +58 -0
  246. package/build/treb-data-model/src/sheet_collection.js +112 -0
  247. package/build/treb-data-model/src/sheet_collection.js.map +1 -0
  248. package/build/treb-data-model/src/sheet_selection.d.ts +42 -0
  249. package/build/treb-data-model/src/sheet_selection.js +39 -0
  250. package/build/treb-data-model/src/sheet_selection.js.map +1 -0
  251. package/build/treb-data-model/src/sheet_types.d.ts +104 -0
  252. package/build/treb-data-model/src/sheet_types.js +22 -0
  253. package/build/treb-data-model/src/sheet_types.js.map +1 -0
  254. package/build/treb-data-model/src/types.d.ts +59 -0
  255. package/build/treb-data-model/src/types.js +22 -0
  256. package/build/treb-data-model/src/types.js.map +1 -0
  257. package/build/treb-embed/src/custom-element/spreadsheet-constructor.d.ts +75 -0
  258. package/build/treb-embed/src/custom-element/spreadsheet-constructor.js +1144 -0
  259. package/build/treb-embed/src/custom-element/spreadsheet-constructor.js.map +1 -0
  260. package/build/treb-embed/src/custom-element/treb-global.d.ts +36 -0
  261. package/build/treb-embed/src/custom-element/treb-global.js +64 -0
  262. package/build/treb-embed/src/custom-element/treb-global.js.map +1 -0
  263. package/build/treb-embed/src/custom-element/treb-spreadsheet-element.d.ts +1 -0
  264. package/build/treb-embed/src/custom-element/treb-spreadsheet-element.js +61 -0
  265. package/build/treb-embed/src/custom-element/treb-spreadsheet-element.js.map +1 -0
  266. package/build/treb-embed/src/embedded-spreadsheet.d.ts +1358 -0
  267. package/build/treb-embed/src/embedded-spreadsheet.js +5205 -0
  268. package/build/treb-embed/src/embedded-spreadsheet.js.map +1 -0
  269. package/build/treb-embed/src/index.d.ts +12 -0
  270. package/build/treb-embed/src/index.js +34 -0
  271. package/build/treb-embed/src/index.js.map +1 -0
  272. package/build/treb-embed/src/options.d.ts +266 -0
  273. package/build/treb-embed/src/options.js +56 -0
  274. package/build/treb-embed/src/options.js.map +1 -0
  275. package/build/treb-embed/src/plugin.d.ts +9 -0
  276. package/build/treb-embed/src/plugin.js +22 -0
  277. package/build/treb-embed/src/plugin.js.map +1 -0
  278. package/build/treb-embed/src/progress-dialog.d.ts +49 -0
  279. package/build/treb-embed/src/progress-dialog.js +178 -0
  280. package/build/treb-embed/src/progress-dialog.js.map +1 -0
  281. package/build/treb-embed/src/selection-state.d.ts +15 -0
  282. package/build/treb-embed/src/selection-state.js +22 -0
  283. package/build/treb-embed/src/selection-state.js.map +1 -0
  284. package/build/treb-embed/src/spinner.d.ts +8 -0
  285. package/build/treb-embed/src/spinner.js +40 -0
  286. package/build/treb-embed/src/spinner.js.map +1 -0
  287. package/build/treb-embed/src/toolbar-message.d.ts +72 -0
  288. package/build/treb-embed/src/toolbar-message.js +22 -0
  289. package/build/treb-embed/src/toolbar-message.js.map +1 -0
  290. package/build/treb-embed/src/types.d.ts +185 -0
  291. package/build/treb-embed/src/types.js +45 -0
  292. package/build/treb-embed/src/types.js.map +1 -0
  293. package/build/treb-embed/tsconfig.tsbuildinfo +1 -0
  294. package/build/treb-export/src/address-type.d.ts +34 -0
  295. package/build/treb-export/src/address-type.js +53 -0
  296. package/build/treb-export/src/address-type.js.map +1 -0
  297. package/build/treb-export/src/base-template.d.ts +1 -0
  298. package/build/treb-export/src/base-template.js +22 -0
  299. package/build/treb-export/src/base-template.js.map +1 -0
  300. package/build/treb-export/src/column-width.d.ts +2 -0
  301. package/build/treb-export/src/column-width.js +80 -0
  302. package/build/treb-export/src/column-width.js.map +1 -0
  303. package/build/treb-export/src/drawing/bubble-chart-template.d.ts +514 -0
  304. package/build/treb-export/src/drawing/bubble-chart-template.js +544 -0
  305. package/build/treb-export/src/drawing/bubble-chart-template.js.map +1 -0
  306. package/build/treb-export/src/drawing/chart-template-components2.d.ts +365 -0
  307. package/build/treb-export/src/drawing/chart-template-components2.js +386 -0
  308. package/build/treb-export/src/drawing/chart-template-components2.js.map +1 -0
  309. package/build/treb-export/src/drawing/chart.d.ts +26 -0
  310. package/build/treb-export/src/drawing/chart.js +247 -0
  311. package/build/treb-export/src/drawing/chart.js.map +1 -0
  312. package/build/treb-export/src/drawing/column-chart-template2.d.ts +490 -0
  313. package/build/treb-export/src/drawing/column-chart-template2.js +518 -0
  314. package/build/treb-export/src/drawing/column-chart-template2.js.map +1 -0
  315. package/build/treb-export/src/drawing/donut-chart-template2.d.ts +272 -0
  316. package/build/treb-export/src/drawing/donut-chart-template2.js +293 -0
  317. package/build/treb-export/src/drawing/donut-chart-template2.js.map +1 -0
  318. package/build/treb-export/src/drawing/drawing.d.ts +49 -0
  319. package/build/treb-export/src/drawing/drawing.js +193 -0
  320. package/build/treb-export/src/drawing/drawing.js.map +1 -0
  321. package/build/treb-export/src/drawing/embedded-image.d.ts +12 -0
  322. package/build/treb-export/src/drawing/embedded-image.js +54 -0
  323. package/build/treb-export/src/drawing/embedded-image.js.map +1 -0
  324. package/build/treb-export/src/drawing/scatter-chart-template2.d.ts +520 -0
  325. package/build/treb-export/src/drawing/scatter-chart-template2.js +551 -0
  326. package/build/treb-export/src/drawing/scatter-chart-template2.js.map +1 -0
  327. package/build/treb-export/src/export.d.ts +72 -0
  328. package/build/treb-export/src/export.js +2039 -0
  329. package/build/treb-export/src/export.js.map +1 -0
  330. package/build/treb-export/src/import-export-messages.d.ts +31 -0
  331. package/build/treb-export/src/import-export-messages.js +22 -0
  332. package/build/treb-export/src/import-export-messages.js.map +1 -0
  333. package/build/treb-export/src/import.d.ts +33 -0
  334. package/build/treb-export/src/import.js +1258 -0
  335. package/build/treb-export/src/import.js.map +1 -0
  336. package/build/treb-export/src/index.worker.d.ts +1 -0
  337. package/build/treb-export/src/index.worker.js +93 -0
  338. package/build/treb-export/src/index.worker.js.map +1 -0
  339. package/build/treb-export/src/metadata.d.ts +51 -0
  340. package/build/treb-export/src/metadata.js +153 -0
  341. package/build/treb-export/src/metadata.js.map +1 -0
  342. package/build/treb-export/src/ooxml.d.ts +7 -0
  343. package/build/treb-export/src/ooxml.js +41 -0
  344. package/build/treb-export/src/ooxml.js.map +1 -0
  345. package/build/treb-export/src/relationship.d.ts +8 -0
  346. package/build/treb-export/src/relationship.js +27 -0
  347. package/build/treb-export/src/relationship.js.map +1 -0
  348. package/build/treb-export/src/shared-strings.d.ts +11 -0
  349. package/build/treb-export/src/shared-strings.js +105 -0
  350. package/build/treb-export/src/shared-strings.js.map +1 -0
  351. package/build/treb-export/src/template-2.d.ts +1 -0
  352. package/build/treb-export/src/template-2.js +22 -0
  353. package/build/treb-export/src/template-2.js.map +1 -0
  354. package/build/treb-export/src/unescape_xml.d.ts +1 -0
  355. package/build/treb-export/src/unescape_xml.js +61 -0
  356. package/build/treb-export/src/unescape_xml.js.map +1 -0
  357. package/build/treb-export/src/workbook-sheet.d.ts +75 -0
  358. package/build/treb-export/src/workbook-sheet.js +128 -0
  359. package/build/treb-export/src/workbook-sheet.js.map +1 -0
  360. package/build/treb-export/src/workbook-style.d.ts +110 -0
  361. package/build/treb-export/src/workbook-style.js +1134 -0
  362. package/build/treb-export/src/workbook-style.js.map +1 -0
  363. package/build/treb-export/src/workbook-theme.d.ts +13 -0
  364. package/build/treb-export/src/workbook-theme.js +85 -0
  365. package/build/treb-export/src/workbook-theme.js.map +1 -0
  366. package/build/treb-export/src/workbook.d.ts +123 -0
  367. package/build/treb-export/src/workbook.js +644 -0
  368. package/build/treb-export/src/workbook.js.map +1 -0
  369. package/build/treb-export/src/xml-test.d.ts +9 -0
  370. package/build/treb-export/src/xml-test.js +52 -0
  371. package/build/treb-export/src/xml-test.js.map +1 -0
  372. package/build/treb-export/src/xml-utils.d.ts +76 -0
  373. package/build/treb-export/src/xml-utils.js +223 -0
  374. package/build/treb-export/src/xml-utils.js.map +1 -0
  375. package/build/treb-export/src/zip-wrapper.d.ts +22 -0
  376. package/build/treb-export/src/zip-wrapper.js +93 -0
  377. package/build/treb-export/src/zip-wrapper.js.map +1 -0
  378. package/build/treb-format/src/format.d.ts +130 -0
  379. package/build/treb-format/src/format.js +805 -0
  380. package/build/treb-format/src/format.js.map +1 -0
  381. package/build/treb-format/src/format_cache.d.ts +55 -0
  382. package/build/treb-format/src/format_cache.js +166 -0
  383. package/build/treb-format/src/format_cache.js.map +1 -0
  384. package/build/treb-format/src/format_parser.d.ts +70 -0
  385. package/build/treb-format/src/format_parser.js +618 -0
  386. package/build/treb-format/src/format_parser.js.map +1 -0
  387. package/build/treb-format/src/index.d.ts +4 -0
  388. package/build/treb-format/src/index.js +25 -0
  389. package/build/treb-format/src/index.js.map +1 -0
  390. package/build/treb-format/src/number_format_section.d.ts +58 -0
  391. package/build/treb-format/src/number_format_section.js +78 -0
  392. package/build/treb-format/src/number_format_section.js.map +1 -0
  393. package/build/treb-format/src/value_parser.d.ts +48 -0
  394. package/build/treb-format/src/value_parser.js +244 -0
  395. package/build/treb-format/src/value_parser.js.map +1 -0
  396. package/build/treb-grid/src/editors/autocomplete.d.ts +39 -0
  397. package/build/treb-grid/src/editors/autocomplete.js +316 -0
  398. package/build/treb-grid/src/editors/autocomplete.js.map +1 -0
  399. package/build/treb-grid/src/editors/autocomplete_matcher.d.ts +74 -0
  400. package/build/treb-grid/src/editors/autocomplete_matcher.js +212 -0
  401. package/build/treb-grid/src/editors/autocomplete_matcher.js.map +1 -0
  402. package/build/treb-grid/src/editors/editor.d.ts +214 -0
  403. package/build/treb-grid/src/editors/editor.js +879 -0
  404. package/build/treb-grid/src/editors/editor.js.map +1 -0
  405. package/build/treb-grid/src/editors/external_editor.d.ts +11 -0
  406. package/build/treb-grid/src/editors/external_editor.js +118 -0
  407. package/build/treb-grid/src/editors/external_editor.js.map +1 -0
  408. package/build/treb-grid/src/editors/formula_bar.d.ts +85 -0
  409. package/build/treb-grid/src/editors/formula_bar.js +444 -0
  410. package/build/treb-grid/src/editors/formula_bar.js.map +1 -0
  411. package/build/treb-grid/src/editors/overlay_editor.d.ts +85 -0
  412. package/build/treb-grid/src/editors/overlay_editor.js +353 -0
  413. package/build/treb-grid/src/editors/overlay_editor.js.map +1 -0
  414. package/build/treb-grid/src/index.d.ts +12 -0
  415. package/build/treb-grid/src/index.js +28 -0
  416. package/build/treb-grid/src/index.js.map +1 -0
  417. package/build/treb-grid/src/layout/base_layout.d.ts +346 -0
  418. package/build/treb-grid/src/layout/base_layout.js +2050 -0
  419. package/build/treb-grid/src/layout/base_layout.js.map +1 -0
  420. package/build/treb-grid/src/layout/grid_layout.d.ts +19 -0
  421. package/build/treb-grid/src/layout/grid_layout.js +235 -0
  422. package/build/treb-grid/src/layout/grid_layout.js.map +1 -0
  423. package/build/treb-grid/src/layout/mock-layout.d.ts +10 -0
  424. package/build/treb-grid/src/layout/mock-layout.js +37 -0
  425. package/build/treb-grid/src/layout/mock-layout.js.map +1 -0
  426. package/build/treb-grid/src/render/selection-renderer.d.ts +97 -0
  427. package/build/treb-grid/src/render/selection-renderer.js +315 -0
  428. package/build/treb-grid/src/render/selection-renderer.js.map +1 -0
  429. package/build/treb-grid/src/render/svg_header_overlay.d.ts +20 -0
  430. package/build/treb-grid/src/render/svg_header_overlay.js +76 -0
  431. package/build/treb-grid/src/render/svg_header_overlay.js.map +1 -0
  432. package/build/treb-grid/src/render/svg_selection_block.d.ts +27 -0
  433. package/build/treb-grid/src/render/svg_selection_block.js +106 -0
  434. package/build/treb-grid/src/render/svg_selection_block.js.map +1 -0
  435. package/build/treb-grid/src/render/tile_renderer.d.ts +121 -0
  436. package/build/treb-grid/src/render/tile_renderer.js +1609 -0
  437. package/build/treb-grid/src/render/tile_renderer.js.map +1 -0
  438. package/build/treb-grid/src/types/border_constants.d.ts +9 -0
  439. package/build/treb-grid/src/types/border_constants.js +34 -0
  440. package/build/treb-grid/src/types/border_constants.js.map +1 -0
  441. package/build/treb-grid/src/types/clipboard_data.d.ts +11 -0
  442. package/build/treb-grid/src/types/clipboard_data.js +22 -0
  443. package/build/treb-grid/src/types/clipboard_data.js.map +1 -0
  444. package/build/treb-grid/src/types/clipboard_data2.d.ts +46 -0
  445. package/build/treb-grid/src/types/clipboard_data2.js +22 -0
  446. package/build/treb-grid/src/types/clipboard_data2.js.map +1 -0
  447. package/build/treb-grid/src/types/drag_mask.d.ts +10 -0
  448. package/build/treb-grid/src/types/drag_mask.js +78 -0
  449. package/build/treb-grid/src/types/drag_mask.js.map +1 -0
  450. package/build/treb-grid/src/types/external_editor_config.d.ts +33 -0
  451. package/build/treb-grid/src/types/external_editor_config.js +22 -0
  452. package/build/treb-grid/src/types/external_editor_config.js.map +1 -0
  453. package/build/treb-grid/src/types/grid.d.ts +806 -0
  454. package/build/treb-grid/src/types/grid.js +6410 -0
  455. package/build/treb-grid/src/types/grid.js.map +1 -0
  456. package/build/treb-grid/src/types/grid_base.d.ts +442 -0
  457. package/build/treb-grid/src/types/grid_base.js +3523 -0
  458. package/build/treb-grid/src/types/grid_base.js.map +1 -0
  459. package/build/treb-grid/src/types/grid_command.d.ts +408 -0
  460. package/build/treb-grid/src/types/grid_command.js +75 -0
  461. package/build/treb-grid/src/types/grid_command.js.map +1 -0
  462. package/build/treb-grid/src/types/grid_events.d.ts +93 -0
  463. package/build/treb-grid/src/types/grid_events.js +36 -0
  464. package/build/treb-grid/src/types/grid_events.js.map +1 -0
  465. package/build/treb-grid/src/types/grid_options.d.ts +50 -0
  466. package/build/treb-grid/src/types/grid_options.js +34 -0
  467. package/build/treb-grid/src/types/grid_options.js.map +1 -0
  468. package/build/treb-grid/src/types/scale-control.d.ts +21 -0
  469. package/build/treb-grid/src/types/scale-control.js +148 -0
  470. package/build/treb-grid/src/types/scale-control.js.map +1 -0
  471. package/build/treb-grid/src/types/set_range_options.d.ts +24 -0
  472. package/build/treb-grid/src/types/set_range_options.js +22 -0
  473. package/build/treb-grid/src/types/set_range_options.js.map +1 -0
  474. package/build/treb-grid/src/types/tab_bar.d.ts +84 -0
  475. package/build/treb-grid/src/types/tab_bar.js +426 -0
  476. package/build/treb-grid/src/types/tab_bar.js.map +1 -0
  477. package/build/treb-grid/src/types/tile.d.ts +29 -0
  478. package/build/treb-grid/src/types/tile.js +22 -0
  479. package/build/treb-grid/src/types/tile.js.map +1 -0
  480. package/build/treb-grid/src/types/update_flags.d.ts +48 -0
  481. package/build/treb-grid/src/types/update_flags.js +22 -0
  482. package/build/treb-grid/src/types/update_flags.js.map +1 -0
  483. package/build/treb-grid/src/util/fontmetrics.d.ts +21 -0
  484. package/build/treb-grid/src/util/fontmetrics.js +82 -0
  485. package/build/treb-grid/src/util/fontmetrics.js.map +1 -0
  486. package/build/treb-grid/src/util/ua.d.ts +33 -0
  487. package/build/treb-grid/src/util/ua.js +86 -0
  488. package/build/treb-grid/src/util/ua.js.map +1 -0
  489. package/build/treb-parser/src/csv-parser.d.ts +13 -0
  490. package/build/treb-parser/src/csv-parser.js +107 -0
  491. package/build/treb-parser/src/csv-parser.js.map +1 -0
  492. package/build/treb-parser/src/index.d.ts +4 -0
  493. package/build/treb-parser/src/index.js +25 -0
  494. package/build/treb-parser/src/index.js.map +1 -0
  495. package/build/treb-parser/src/md-parser.d.ts +97 -0
  496. package/build/treb-parser/src/md-parser.js +403 -0
  497. package/build/treb-parser/src/md-parser.js.map +1 -0
  498. package/build/treb-parser/src/parser-types.d.ts +345 -0
  499. package/build/treb-parser/src/parser-types.js +53 -0
  500. package/build/treb-parser/src/parser-types.js.map +1 -0
  501. package/build/treb-parser/src/parser.d.ts +422 -0
  502. package/build/treb-parser/src/parser.js +2418 -0
  503. package/build/treb-parser/src/parser.js.map +1 -0
  504. package/build/treb-utils/src/event_source.d.ts +34 -0
  505. package/build/treb-utils/src/event_source.js +110 -0
  506. package/build/treb-utils/src/event_source.js.map +1 -0
  507. package/build/treb-utils/src/ievent_source.d.ts +9 -0
  508. package/build/treb-utils/src/ievent_source.js +22 -0
  509. package/build/treb-utils/src/ievent_source.js.map +1 -0
  510. package/build/treb-utils/src/index.d.ts +6 -0
  511. package/build/treb-utils/src/index.js +30 -0
  512. package/build/treb-utils/src/index.js.map +1 -0
  513. package/build/treb-utils/src/measurement.d.ts +42 -0
  514. package/build/treb-utils/src/measurement.js +145 -0
  515. package/build/treb-utils/src/measurement.js.map +1 -0
  516. package/build/treb-utils/src/scale.d.ts +16 -0
  517. package/build/treb-utils/src/scale.js +106 -0
  518. package/build/treb-utils/src/scale.js.map +1 -0
  519. package/build/treb-utils/src/serialize_html.d.ts +5 -0
  520. package/build/treb-utils/src/serialize_html.js +128 -0
  521. package/build/treb-utils/src/serialize_html.js.map +1 -0
  522. package/build/treb-utils/src/validate_uri.d.ts +20 -0
  523. package/build/treb-utils/src/validate_uri.js +55 -0
  524. package/build/treb-utils/src/validate_uri.js.map +1 -0
  525. package/dist/{chunk-XD5PEZBZ.mjs → chunk-E35ONJUS.mjs} +1 -1
  526. package/dist/treb-export-worker.mjs +2 -2
  527. package/dist/treb-spreadsheet.mjs +4 -4
  528. package/package.json +1 -1
@@ -0,0 +1,316 @@
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
+ import { DOMContext } from 'treb-base-types';
22
+ export class Autocomplete {
23
+ options;
24
+ completion_list_visible = false;
25
+ tooltip_visible = false;
26
+ last_completion;
27
+ completion_list;
28
+ tooltip;
29
+ selected_index = 0;
30
+ block = false;
31
+ autocomplete_data = {};
32
+ callback;
33
+ // ALTHOUGH we are dropping scope from _this_ node, it might be
34
+ // useful to add it to the containing node... something to think
35
+ // about
36
+ // private scope: string;
37
+ active_element;
38
+ DOM;
39
+ constructor(options = {}) {
40
+ this.options = options;
41
+ this.DOM = DOMContext.GetInstance(options.container?.ownerDocument);
42
+ if (!this.DOM.doc) {
43
+ throw new Error('invalid context');
44
+ }
45
+ // this.scope = 'AC' + Math.round(Math.random() * Math.pow(10, 10)).toString(16);
46
+ this.completion_list = this.DOM.Div('treb-cell-editor-ac-list treb-autocomplete', options.container || this.DOM.doc.body, {
47
+ events: {
48
+ mousedown: (event) => this.ListMouseDown(event),
49
+ mousemove: (event) => this.ListMouseMove(event)
50
+ }
51
+ });
52
+ // this.completion_list.addEventListener('mousedown', (event) => this.ListMouseDown(event));
53
+ // FIXME: should we add/remove listener based on visibility? (...)
54
+ // this.completion_list.addEventListener('mousemove', (event) => this.ListMouseMove(event));
55
+ this.tooltip = this.DOM.Div('treb-cell-editor-ac-tooltip treb-autocomplete-tooltip', options.container || this.DOM.doc.body);
56
+ }
57
+ /*
58
+ public UpdateTheme(): void {
59
+ if (this.options.theme) {
60
+
61
+ // FIXME: no longer sharing, don't need scoped styling anymore
62
+
63
+ // FIXME: split?
64
+
65
+ this.completion_list.style.fontFamily =
66
+ this.tooltip.style.fontFamily = this.options.theme.cell_font ?
67
+ this.options.theme.cell_font : '';
68
+
69
+ const font_size = (this.options.theme.cell_font_size_value || 0) +
70
+ (this.options.theme.cell_font_size_unit || 'pt');
71
+
72
+ / *
73
+ let font_size: string|null = null;
74
+ if (typeof this.options.theme.cell_font_size === 'string') {
75
+ font_size = this.options.theme.cell_font_size;
76
+ }
77
+ else if (typeof this.options.theme.cell_font_size === 'number') {
78
+ font_size = this.options.theme.cell_font_size + 'pt';
79
+ }
80
+ * /
81
+
82
+ this.completion_list.style.fontSize =
83
+ this.tooltip.style.fontSize =
84
+ font_size || '';
85
+
86
+ / *
87
+ this.stylesheet.textContent = `
88
+
89
+ .treb-ac-list[${this.scope}] {
90
+ background: ${this.options.theme.autocomplete_background};
91
+ }
92
+
93
+ .treb-ac-list[${this.scope}] ul li {
94
+ color: ${this.options.theme.autocomplete_color};
95
+ }
96
+
97
+ .treb-ac-list[${this.scope}] ul li a:hover, .treb-ac-list[${this.scope}] ul li a.selected,
98
+ .treb-ac-list[${this.scope}] ul:hover li a.selected:hover {
99
+ color: ${this.options.theme.autocomplete_highlight_color};
100
+ background: ${this.options.theme.autocomplete_highlight_background};
101
+ }
102
+
103
+ `.replace(/\s+/g, ' ').trim();
104
+ * /
105
+
106
+ this.stylesheet.textContent = css`
107
+
108
+ .treb-ac-list[${this.scope}] {
109
+ background: ${this.options.theme.autocomplete_background};
110
+ }
111
+
112
+ .treb-ac-list[${this.scope}] > ul > li {
113
+ color: ${this.options.theme.autocomplete_color};
114
+ }
115
+
116
+ .treb-ac-list[${this.scope}] > ul > li > a.selected {
117
+ color: ${this.options.theme.autocomplete_highlight_color};
118
+ background: ${this.options.theme.autocomplete_highlight_background};
119
+ }
120
+
121
+ `; // this is not needed because the template compressor will remove whitespace // .replace(/\s+/g, ' ').trim();
122
+
123
+ }
124
+ }
125
+ */
126
+ Hide() {
127
+ this.tooltip.style.top = '-1000px';
128
+ this.completion_list.style.top = '-1000px';
129
+ this.completion_list_visible = false;
130
+ this.tooltip_visible = false;
131
+ this.active_element = undefined;
132
+ }
133
+ SetBlock() {
134
+ this.block = true;
135
+ }
136
+ ResetBlock() {
137
+ this.block = false;
138
+ }
139
+ ListMouseMove(event) {
140
+ const target = event.target;
141
+ if (target.tagName === 'A') {
142
+ if (target !== this.active_element) {
143
+ if (this.active_element) {
144
+ this.active_element.classList.remove('selected');
145
+ this.active_element = target;
146
+ this.active_element.classList.add('selected');
147
+ this.selected_index = Number(target.dataset.index || '0');
148
+ this.last_completion = target.textContent || '';
149
+ }
150
+ }
151
+ }
152
+ }
153
+ ListMouseDown(event) {
154
+ event.stopPropagation();
155
+ event.preventDefault();
156
+ let target = event.target;
157
+ while (target) {
158
+ if (target === this.completion_list)
159
+ return;
160
+ if (target.tagName === 'A')
161
+ break;
162
+ target = target.parentElement;
163
+ }
164
+ if (!target)
165
+ return;
166
+ console.info(target);
167
+ if (this.callback) {
168
+ this.callback({
169
+ handled: true,
170
+ accept: true,
171
+ value: target.textContent ? target.textContent : undefined,
172
+ data: this.autocomplete_data,
173
+ click: true,
174
+ });
175
+ }
176
+ }
177
+ HandleKey(event_type, event) {
178
+ if (!this.completion_list_visible)
179
+ return { handled: false };
180
+ let delta = 0;
181
+ let block = false;
182
+ let accept = false;
183
+ switch (event.key) {
184
+ case 'Up':
185
+ case 'ArrowUp':
186
+ delta = -1;
187
+ break;
188
+ case 'Down':
189
+ case 'ArrowDown':
190
+ delta = 1;
191
+ break;
192
+ case 'Tab':
193
+ accept = true;
194
+ break;
195
+ case 'Escape':
196
+ case 'Esc':
197
+ block = true;
198
+ break;
199
+ default:
200
+ return { handled: false };
201
+ }
202
+ event.stopPropagation();
203
+ event.preventDefault();
204
+ // keyup just consume
205
+ if (event_type === 'keyup')
206
+ return { handled: true };
207
+ // keydown handle
208
+ if (delta) {
209
+ const list_rect = this.completion_list.getBoundingClientRect();
210
+ this.selected_index += delta;
211
+ this.selected_index = Math.max(0, this.selected_index);
212
+ const children = this.completion_list.querySelectorAll('a');
213
+ this.selected_index = Math.min(this.selected_index, children.length - 1);
214
+ for (let index = 0; index < children.length; index++) {
215
+ const child = children[index];
216
+ if (index === this.selected_index) {
217
+ child.classList.add('selected');
218
+ this.active_element = child;
219
+ const child_rect = child.getBoundingClientRect();
220
+ if (child_rect.top < list_rect.top) {
221
+ this.completion_list.scrollBy(0, -child_rect.height);
222
+ }
223
+ else if (child_rect.bottom > list_rect.bottom) {
224
+ this.completion_list.scrollBy(0, child_rect.height);
225
+ }
226
+ this.last_completion = child.textContent || undefined;
227
+ }
228
+ else
229
+ child.classList.remove('selected');
230
+ }
231
+ return { handled: true };
232
+ }
233
+ else if (block) {
234
+ this.block = true;
235
+ this.Hide();
236
+ return { handled: true };
237
+ }
238
+ else if (accept) {
239
+ return {
240
+ handled: true,
241
+ accept: true,
242
+ value: this.last_completion,
243
+ data: this.autocomplete_data,
244
+ };
245
+ }
246
+ return { handled: false };
247
+ }
248
+ Show(callback, data = {}, position) {
249
+ this.completion_list_visible = false;
250
+ this.tooltip_visible = false;
251
+ this.autocomplete_data = data;
252
+ this.callback = callback;
253
+ if (this.block)
254
+ return;
255
+ // handle tooltip first. we may offset AC list based for tooltip.
256
+ if (data.tooltip) {
257
+ //this.tooltip.textContent
258
+ this.tooltip.innerHTML = data.tooltip + data.arguments +
259
+ (data.description ? '\n' + data.description : '');
260
+ this.tooltip.style.left = position.left + 'px';
261
+ if (this.options.tooltip_prefer_top) {
262
+ this.tooltip.style.top = (position.top - this.tooltip.offsetHeight - 5) + 'px';
263
+ }
264
+ else {
265
+ this.tooltip.style.top = (position.bottom + 5) + 'px';
266
+ }
267
+ this.tooltip_visible = true;
268
+ }
269
+ else
270
+ this.tooltip.style.top = '-1000px';
271
+ // now layout AC list
272
+ if (data.completions && data.completions.length) {
273
+ // temp we are just hiding tooltip if there's AC, but we could layout
274
+ this.tooltip.style.top = '-1000px';
275
+ this.selected_index = 0;
276
+ this.completion_list.innerHTML = `<ul class="notranslate">`
277
+ + data.completions.map((descriptor, index) => {
278
+ if (descriptor.name === this.last_completion)
279
+ this.selected_index = index;
280
+ return `<li><a data-index="${index}">${descriptor.name}</a></li>`;
281
+ }).join('\n') + `<ul>`;
282
+ const height = this.completion_list.offsetHeight;
283
+ let layout_top = false;
284
+ if (this.options.autocomplete_prefer_top) {
285
+ layout_top = (position.top >= 200);
286
+ }
287
+ else {
288
+ // compiler thinks this is possibly undefined, but vs code does
289
+ // not -- I thought vs code used the same tsc we use to compile?
290
+ if (this.DOM.doc?.documentElement) {
291
+ const viewport_height = Math.max(this.DOM.doc.documentElement.clientHeight, this.DOM.view?.innerHeight || 0);
292
+ if (viewport_height - position.bottom < 200) {
293
+ layout_top = true;
294
+ }
295
+ }
296
+ }
297
+ if (layout_top) {
298
+ this.completion_list.style.top = (position.top - height - 5) + 'px';
299
+ }
300
+ else {
301
+ this.completion_list.style.top = (position.bottom + 5) + 'px';
302
+ }
303
+ this.completion_list.style.left = position.left + 'px';
304
+ const children = this.completion_list.querySelectorAll('a');
305
+ this.active_element = children[this.selected_index];
306
+ children[this.selected_index].classList.add('selected');
307
+ this.last_completion = children[this.selected_index].textContent || undefined;
308
+ // scroll into view
309
+ this.completion_list.scrollTop = this.active_element.offsetTop;
310
+ this.completion_list_visible = true;
311
+ }
312
+ else
313
+ this.completion_list.style.top = '-1000px';
314
+ }
315
+ }
316
+ //# sourceMappingURL=autocomplete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autocomplete.js","sourceRoot":"","sources":["../../../../treb-grid/src/editors/autocomplete.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AA8B7C,MAAM,OAAO,YAAY;IAyBH;IAvBb,uBAAuB,GAAG,KAAK,CAAC;IAChC,eAAe,GAAG,KAAK,CAAC;IACxB,eAAe,CAAU;IAExB,eAAe,CAAiB;IAChC,OAAO,CAAiB;IAExB,cAAc,GAAG,CAAC,CAAC;IACnB,KAAK,GAAG,KAAK,CAAC;IACd,iBAAiB,GAA2B,EAAE,CAAC;IAE/C,QAAQ,CAAkB;IAElC,gEAAgE;IAChE,iEAAiE;IACjE,QAAQ;IAER,yBAAyB;IAEjB,cAAc,CAAe;IAE7B,GAAG,CAAa;IAExB,YAAoB,UAA+B,EAAE;QAAjC,YAAO,GAAP,OAAO,CAA0B;QAEnD,IAAI,CAAC,GA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,eAAe,CAAC,KAAK,CAAC,GAAG,GAAG,SAAS,CAAC;IAGlD,CAAC;CAGF"}
@@ -0,0 +1,74 @@
1
+ export interface ArgumentDescriptor {
2
+ name?: string;
3
+ }
4
+ export interface FunctionDescriptor {
5
+ name: string;
6
+ description?: string;
7
+ arguments?: ArgumentDescriptor[];
8
+ /** switching to literals */
9
+ type?: 'function' | 'token';
10
+ /** this is a named range or named expression. meaning a user/non-system name. */
11
+ named?: boolean;
12
+ /** scope refers to sheet IDs. names may be scoped. */
13
+ scope?: number;
14
+ }
15
+ export interface AutocompleteMatchData {
16
+ text: string;
17
+ cursor: number;
18
+ }
19
+ export interface AutocompleteExecResult {
20
+ completions?: FunctionDescriptor[];
21
+ token?: string;
22
+ position?: number;
23
+ tooltip?: string;
24
+ arguments?: string;
25
+ description?: string;
26
+ function_position?: number;
27
+ }
28
+ export interface TooltipParserResult {
29
+ function: string | undefined;
30
+ argument: number;
31
+ position: number;
32
+ }
33
+ export declare class AutocompleteMatcher {
34
+ private function_names;
35
+ private argument_separator;
36
+ /**
37
+ * making this public (and scrubbing the type). we need it public so we
38
+ * can check collisions. I'm not sure why it was originally private...
39
+ *
40
+ * that's backwards. this should be private, and anyone checking
41
+ * collisions should ask. also updating to modern type.
42
+ *
43
+ * OK so now a map. all names should be lower-cased for consistency (they
44
+ * can maintain canonical names inside the object).
45
+ */
46
+ private function_map;
47
+ RemoveFunctions(functions: FunctionDescriptor | FunctionDescriptor[]): void;
48
+ AddFunctions(functions: FunctionDescriptor | FunctionDescriptor[]): void;
49
+ SetFunctions(functions: FunctionDescriptor[]): void;
50
+ /**
51
+ * returns the canonical version of the name, if it exists.
52
+ * @param name
53
+ * @returns
54
+ */
55
+ NormalizeIdentifier(name: string): string | undefined;
56
+ /**
57
+ * accessor for entries. we're not stopping you from modifying
58
+ * in place, for now, but don't do that.
59
+ */
60
+ Get(name: string): FunctionDescriptor | undefined;
61
+ Exec(data: AutocompleteMatchData): AutocompleteExecResult;
62
+ /**
63
+ * baby parser for generating tooltips. we want the name of the
64
+ * current function, and the index of the current argument.
65
+ *
66
+ * not handled: escaped quotes (not even sure what the syntax for that is)
67
+ */
68
+ ParseTooltip(expression: string): TooltipParserResult;
69
+ /**
70
+ * we maintain a sorted list of names. this needs to get updated
71
+ * when the list changes.
72
+ */
73
+ private UpdateNameList;
74
+ }
@@ -0,0 +1,212 @@
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
+ * this is the data side of autocomplete (maintaining the list, matching).
23
+ * we add this to grid because grid controls the editors; clients can pass
24
+ * in lists.
25
+ *
26
+ * TODO: structure
27
+ * TODO: other symbols... [FIXME: defined names need to go in here]
28
+ * TODO: context -- cell vs annotation (...)
29
+ *
30
+ * FIXME: why does this use different definitions than the functions?
31
+ * can't we merge the two?
32
+ *
33
+ * [I think they may have been developed independently and them converged...]
34
+ *
35
+ */
36
+ import { Localization } from 'treb-base-types';
37
+ export class AutocompleteMatcher {
38
+ function_names = [];
39
+ // private function_map: {[index: string]: FunctionDescriptor} = {};
40
+ argument_separator = Localization.argument_separator.charCodeAt(0);
41
+ /**
42
+ * making this public (and scrubbing the type). we need it public so we
43
+ * can check collisions. I'm not sure why it was originally private...
44
+ *
45
+ * that's backwards. this should be private, and anyone checking
46
+ * collisions should ask. also updating to modern type.
47
+ *
48
+ * OK so now a map. all names should be lower-cased for consistency (they
49
+ * can maintain canonical names inside the object).
50
+ */
51
+ function_map = new Map();
52
+ RemoveFunctions(functions) {
53
+ if (!Array.isArray(functions)) {
54
+ functions = [functions];
55
+ }
56
+ for (const entry of functions) {
57
+ this.function_map.delete(entry.name.toLowerCase());
58
+ }
59
+ this.UpdateNameList();
60
+ }
61
+ AddFunctions(functions) {
62
+ if (!Array.isArray(functions)) {
63
+ functions = [functions];
64
+ }
65
+ for (const entry of functions) {
66
+ this.function_map.set(entry.name.toLowerCase(), entry);
67
+ }
68
+ this.UpdateNameList();
69
+ }
70
+ SetFunctions(functions) {
71
+ this.function_map.clear();
72
+ for (const entry of functions) {
73
+ this.function_map.set(entry.name.toLowerCase(), entry);
74
+ }
75
+ this.UpdateNameList();
76
+ }
77
+ /**
78
+ * returns the canonical version of the name, if it exists.
79
+ * @param name
80
+ * @returns
81
+ */
82
+ NormalizeIdentifier(name) {
83
+ return this.function_map.get(name.toLowerCase())?.name;
84
+ }
85
+ /**
86
+ * accessor for entries. we're not stopping you from modifying
87
+ * in place, for now, but don't do that.
88
+ */
89
+ Get(name) {
90
+ return this.function_map.get(name.toLowerCase());
91
+ }
92
+ Exec(data) {
93
+ // ac/tt only for formula
94
+ if (data.text[0] !== '=') {
95
+ return {};
96
+ }
97
+ // console.info(data);
98
+ let match;
99
+ let result = {};
100
+ // ac only at the end of the string
101
+ if (data.cursor === data.text.length) {
102
+ // FIXME: quoted strings...
103
+ // if it's a token, and ends with a legal character
104
+ // UPDATE: adding the negative leading \d to fix entering complex numbers
105
+ // match = data.text.match(/(?:^|[^A-Za-z_\d])([A-Za-z_][\w\d_.]*)\s*$/);
106
+ match = data.text.match(/(?:^|[^a-zA-Z\u00C0-\u024F_\d])([a-zA-Z\u00C0-\u024F_][\w\d\u00C0-\u024F_.]*)\s*$/);
107
+ if (match) {
108
+ const token = match[1];
109
+ const rex = new RegExp('^' + token.replace('.', '\\.'), 'i');
110
+ const list = this.function_names.filter((name) => rex.test(name)).map((name) => this.function_map.get(name.toLowerCase())).filter((test) => !!test);
111
+ result = {
112
+ completions: list,
113
+ token,
114
+ position: data.cursor - token.length,
115
+ };
116
+ }
117
+ else {
118
+ // console.info("NOP");
119
+ }
120
+ }
121
+ const parsed = this.ParseTooltip(data.text.substr(0, data.cursor));
122
+ if (parsed.function) {
123
+ const func = this.function_map.get(parsed.function.toLowerCase());
124
+ if (func) {
125
+ // if (func.canonical_name) result.tooltip = func.canonical_name;
126
+ // else result.tooltip = tt.toUpperCase();
127
+ result.tooltip = '<span class="notranslate">' + func.name + '</span>';
128
+ result.arguments = '(' + (func.arguments || []).map((desc, index) => {
129
+ const argument = desc.name || 'argument';
130
+ return (index === parsed.argument) ? `<span class="active-argument">${argument}</span>` : argument;
131
+ }).join(Localization.argument_separator + ' ') + ')';
132
+ result.description = func.description ? `<span class="function-description">${func.description}</span>` : '';
133
+ result.function_position = parsed.position || 0;
134
+ }
135
+ }
136
+ return result;
137
+ }
138
+ /**
139
+ * baby parser for generating tooltips. we want the name of the
140
+ * current function, and the index of the current argument.
141
+ *
142
+ * not handled: escaped quotes (not even sure what the syntax for that is)
143
+ */
144
+ ParseTooltip(expression) {
145
+ // these two things are actually unrelated, we just need to push/pop them at the same time
146
+ const stack = [];
147
+ let argument = 0;
148
+ let buffer = '';
149
+ // state flag
150
+ let quote = false;
151
+ let position = 0;
152
+ for (const letter of expression) {
153
+ const char = letter.charCodeAt(0);
154
+ if (quote) {
155
+ if (char === 0x22) {
156
+ quote = false;
157
+ }
158
+ }
159
+ else {
160
+ switch (char) {
161
+ case 0x28: // OPEN_PAREN:
162
+ stack.push({
163
+ buffer: buffer.trim(), // there is no case where spaces get in this buffer
164
+ argument,
165
+ position: position - buffer.length,
166
+ });
167
+ buffer = '';
168
+ argument = 0;
169
+ break;
170
+ case this.argument_separator:
171
+ argument++;
172
+ break;
173
+ case 0x29: // CLOSE_PAREN:
174
+ argument = stack.pop()?.argument || 0;
175
+ break;
176
+ case 0x22: // QUOTE:
177
+ buffer = '';
178
+ quote = true;
179
+ break;
180
+ default:
181
+ // these are legal symbol characters
182
+ if ((char >= 0x61 && char <= 0x7a) // a-z
183
+ || (char >= 0x41 && char <= 0x5a) // A-Z
184
+ || (char >= 0x30 && char <= 0x39) // 0-9
185
+ || (char >= 0x00C0 && char <= 0x024F) // accented characters
186
+ || (char === 0x5f) // _
187
+ || (char === 0x2e)) { // .
188
+ buffer += letter;
189
+ }
190
+ else {
191
+ buffer = '';
192
+ }
193
+ }
194
+ }
195
+ position++;
196
+ }
197
+ const last_func = stack.pop();
198
+ return {
199
+ function: last_func?.buffer || undefined,
200
+ position: last_func?.position || 0,
201
+ argument,
202
+ };
203
+ }
204
+ /**
205
+ * we maintain a sorted list of names. this needs to get updated
206
+ * when the list changes.
207
+ */
208
+ UpdateNameList() {
209
+ this.function_names = [...this.function_map.keys()].sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
210
+ }
211
+ }
212
+ //# sourceMappingURL=autocomplete_matcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autocomplete_matcher.js","sourceRoot":"","sources":["../../../../treb-grid/src/editors/autocomplete_matcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAiD/C,MAAM,OAAO,mBAAmB;IAEtB,cAAc,GAAa,EAAE,CAAC;IACtC,oEAAoE;IAE5D,kBAAkB,GAAG,YAAY,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAE3E;;;;;;;;;OASG;IACK,YAAY,GAAoC,IAAI,GAAG,EAAE,CAAC;IAE3D,eAAe,CAAC,SAAkD;QACvE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YAAC,SAAS,GAAG,CAAC,SAAS,CAAC,CAAC;QAAC,CAAC;QAC3D,KAAK,MAAM,KAAK,IAAI,SAAS,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