@trebco/treb 28.5.2 → 28.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/dist/treb-spreadsheet-light.mjs +15 -15
  2. package/dist/treb-spreadsheet.mjs +15 -15
  3. package/dist/treb.d.ts +37 -6
  4. package/package.json +1 -1
  5. package/treb-base-types/src/api_types.ts +1 -1
  6. package/treb-base-types/src/area.ts +1 -1
  7. package/treb-base-types/src/basic_types.ts +21 -21
  8. package/treb-base-types/src/cell.ts +1 -1
  9. package/treb-base-types/src/cells.ts +1 -1
  10. package/treb-base-types/src/color.ts +1 -1
  11. package/treb-base-types/src/dom-utilities.ts +1 -1
  12. package/treb-base-types/src/gradient.ts +1 -1
  13. package/treb-base-types/src/import.ts +1 -1
  14. package/treb-base-types/src/index-standalone.ts +9 -9
  15. package/treb-base-types/src/index.ts +1 -1
  16. package/treb-base-types/src/layout.ts +21 -21
  17. package/treb-base-types/src/localization.ts +27 -21
  18. package/treb-base-types/src/rectangle.ts +1 -1
  19. package/treb-base-types/src/render_text.ts +1 -1
  20. package/treb-base-types/src/style.ts +1 -1
  21. package/treb-base-types/src/table.ts +1 -1
  22. package/treb-base-types/src/text_part.ts +21 -21
  23. package/treb-base-types/src/theme.ts +1 -1
  24. package/treb-base-types/src/union.ts +1 -1
  25. package/treb-base-types/src/value-type.ts +1 -1
  26. package/treb-base-types/style/resizable.css +21 -21
  27. package/treb-calculator/src/calculator.ts +24 -31
  28. package/treb-calculator/src/complex-math.ts +1 -1
  29. package/treb-calculator/src/dag/array-vertex.ts +1 -1
  30. package/treb-calculator/src/dag/calculation_leaf_vertex.ts +8 -1
  31. package/treb-calculator/src/dag/graph.ts +8 -1
  32. package/treb-calculator/src/dag/spreadsheet_vertex.ts +1 -1
  33. package/treb-calculator/src/dag/spreadsheet_vertex_base.ts +21 -21
  34. package/treb-calculator/src/dag/state_leaf_vertex.ts +1 -1
  35. package/treb-calculator/src/dag/vertex.ts +21 -21
  36. package/treb-calculator/src/descriptors.ts +1 -1
  37. package/treb-calculator/src/expression-calculator.ts +1 -1
  38. package/treb-calculator/src/function-error.ts +1 -1
  39. package/treb-calculator/src/function-library.ts +1 -1
  40. package/treb-calculator/src/functions/base-functions.ts +31 -2
  41. package/treb-calculator/src/functions/checkbox.ts +1 -1
  42. package/treb-calculator/src/functions/complex-functions.ts +1 -1
  43. package/treb-calculator/src/functions/finance-functions.ts +1 -1
  44. package/treb-calculator/src/functions/information-functions.ts +1 -1
  45. package/treb-calculator/src/functions/matrix-functions.ts +1 -1
  46. package/treb-calculator/src/functions/sparkline.ts +1 -1
  47. package/treb-calculator/src/functions/statistics-functions.ts +1 -1
  48. package/treb-calculator/src/functions/text-functions.ts +1 -1
  49. package/treb-calculator/src/index.ts +1 -1
  50. package/treb-calculator/src/notifier-types.ts +1 -1
  51. package/treb-calculator/src/primitives.ts +1 -1
  52. package/treb-calculator/src/utilities.ts +1 -1
  53. package/treb-charts/src/chart-functions.ts +12 -1
  54. package/treb-charts/src/chart-types.ts +39 -21
  55. package/treb-charts/src/chart-utils.ts +783 -0
  56. package/treb-charts/src/chart.ts +96 -1291
  57. package/treb-charts/src/default-chart-renderer.ts +560 -0
  58. package/treb-charts/src/index.ts +5 -4
  59. package/treb-charts/src/main.ts +17 -17
  60. package/treb-charts/src/rectangle.ts +21 -21
  61. package/treb-charts/src/renderer-type.ts +32 -0
  62. package/treb-charts/src/renderer.ts +82 -1
  63. package/treb-charts/src/util.ts +1 -1
  64. package/treb-charts/style/charts.scss +9 -1
  65. package/treb-charts/style/old-charts.scss +21 -21
  66. package/treb-embed/markup/toolbar.html +35 -34
  67. package/treb-embed/src/custom-element/treb-global.ts +10 -2
  68. package/treb-embed/src/embedded-spreadsheet.ts +72 -113
  69. package/treb-embed/src/language-model.ts +1 -1
  70. package/treb-embed/src/options.ts +37 -1
  71. package/treb-embed/src/progress-dialog.ts +1 -1
  72. package/treb-embed/src/spinner.ts +1 -1
  73. package/treb-embed/src/types.ts +1 -1
  74. package/treb-embed/style/autocomplete.scss +1 -1
  75. package/treb-embed/style/dark-theme.scss +1 -1
  76. package/treb-embed/style/defaults.scss +1 -1
  77. package/treb-embed/style/dialog.scss +1 -1
  78. package/treb-embed/style/dropdown-select.scss +1 -1
  79. package/treb-embed/style/formula-bar.scss +1 -1
  80. package/treb-embed/style/grid.scss +1 -1
  81. package/treb-embed/style/layout.scss +4 -0
  82. package/treb-embed/style/mouse-mask.scss +1 -1
  83. package/treb-embed/style/note.scss +1 -1
  84. package/treb-embed/style/overlay-editor.scss +1 -1
  85. package/treb-embed/style/spinner.scss +1 -1
  86. package/treb-embed/style/tab-bar.scss +1 -1
  87. package/treb-embed/style/table.scss +1 -1
  88. package/treb-embed/style/theme-defaults.scss +1 -1
  89. package/treb-embed/style/toolbar.scss +37 -0
  90. package/treb-embed/style/tooltip.scss +1 -1
  91. package/treb-embed/style/z-index.scss +1 -1
  92. package/treb-export/src/address-type.ts +21 -21
  93. package/treb-export/src/base-template.ts +1 -1
  94. package/treb-export/src/column-width.ts +1 -1
  95. package/treb-export/src/drawing2/chart-template-components2.ts +1 -1
  96. package/treb-export/src/drawing2/chart2.ts +1 -1
  97. package/treb-export/src/drawing2/column-chart-template2.ts +1 -1
  98. package/treb-export/src/drawing2/donut-chart-template2.ts +1 -1
  99. package/treb-export/src/drawing2/drawing2.ts +1 -1
  100. package/treb-export/src/drawing2/embedded-image.ts +1 -1
  101. package/treb-export/src/drawing2/scatter-chart-template2.ts +1 -1
  102. package/treb-export/src/export-worker/export-worker.ts +1 -1
  103. package/treb-export/src/export-worker/index.worker.ts +1 -1
  104. package/treb-export/src/export2.ts +1 -1
  105. package/treb-export/src/import2.ts +1 -1
  106. package/treb-export/src/relationship.ts +1 -1
  107. package/treb-export/src/shared-strings2.ts +1 -1
  108. package/treb-export/src/template-2.ts +2 -2
  109. package/treb-export/src/workbook-sheet2.ts +1 -1
  110. package/treb-export/src/workbook-style2.ts +1 -1
  111. package/treb-export/src/workbook-theme2.ts +1 -1
  112. package/treb-export/src/workbook2.ts +1 -1
  113. package/treb-export/src/xml-utils.ts +1 -1
  114. package/treb-format/src/format.test.ts +21 -21
  115. package/treb-format/src/format.ts +1 -1
  116. package/treb-format/src/format_cache.ts +21 -21
  117. package/treb-format/src/format_parser.ts +1 -1
  118. package/treb-format/src/index.ts +4 -4
  119. package/treb-format/src/number_format_section.ts +21 -21
  120. package/treb-format/src/value_parser.ts +1 -1
  121. package/treb-grid/src/editors/autocomplete.ts +1 -1
  122. package/treb-grid/src/editors/autocomplete_matcher.ts +21 -21
  123. package/treb-grid/src/editors/editor.ts +1 -1
  124. package/treb-grid/src/editors/formula_bar.ts +1 -1
  125. package/treb-grid/src/editors/overlay_editor.ts +1 -1
  126. package/treb-grid/src/index.ts +1 -1
  127. package/treb-grid/src/layout/base_layout.ts +1 -1
  128. package/treb-grid/src/layout/grid_layout.ts +1 -1
  129. package/treb-grid/src/layout/rectangle_cache.ts +21 -21
  130. package/treb-grid/src/render/selection-renderer.ts +1 -1
  131. package/treb-grid/src/render/svg_header_overlay.ts +1 -1
  132. package/treb-grid/src/render/svg_selection_block.ts +1 -1
  133. package/treb-grid/src/render/tile_renderer.ts +1 -1
  134. package/treb-grid/src/types/annotation.ts +1 -1
  135. package/treb-grid/src/types/border_constants.ts +1 -1
  136. package/treb-grid/src/types/clipboard_data.ts +1 -1
  137. package/treb-grid/src/types/conditional_format.ts +1 -1
  138. package/treb-grid/src/types/data_model.ts +1 -1
  139. package/treb-grid/src/types/drag_mask.ts +21 -21
  140. package/treb-grid/src/types/grid.ts +12 -2
  141. package/treb-grid/src/types/grid_base.ts +128 -6
  142. package/treb-grid/src/types/grid_command.ts +33 -1
  143. package/treb-grid/src/types/grid_events.ts +8 -1
  144. package/treb-grid/src/types/grid_options.ts +9 -1
  145. package/treb-grid/src/types/grid_selection.ts +1 -1
  146. package/treb-grid/src/types/named_range.ts +1 -1
  147. package/treb-grid/src/types/scale-control.ts +1 -1
  148. package/treb-grid/src/types/serialize_options.ts +1 -1
  149. package/treb-grid/src/types/set_range_options.ts +1 -1
  150. package/treb-grid/src/types/sheet.ts +1 -57
  151. package/treb-grid/src/types/sheet_types.ts +1 -1
  152. package/treb-grid/src/types/tab_bar.ts +1 -1
  153. package/treb-grid/src/types/tile.ts +21 -21
  154. package/treb-grid/src/types/update_flags.ts +2 -1
  155. package/treb-grid/src/util/fontmetrics2.ts +1 -1
  156. package/treb-grid/src/util/ua.ts +21 -21
  157. package/treb-parser/src/csv-parser.ts +21 -21
  158. package/treb-parser/src/index.ts +5 -5
  159. package/treb-parser/src/md-parser.ts +1 -1
  160. package/treb-parser/src/parser-types.ts +1 -1
  161. package/treb-parser/src/parser.test.ts +21 -21
  162. package/treb-parser/src/parser.ts +1 -1
  163. package/treb-utils/src/event_source.ts +1 -1
  164. package/treb-utils/src/ievent_source.ts +13 -13
  165. package/treb-utils/src/index.ts +1 -1
  166. package/treb-utils/src/measurement.ts +1 -1
  167. package/treb-utils/src/scale.ts +21 -21
  168. package/treb-utils/src/serialize_html.ts +1 -1
package/dist/treb.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /*! API v28.5. Copyright 2018-2023 trebco, llc. All rights reserved. LGPL: https://treb.app/license */
1
+ /*! API v28.10. Copyright 2018-2024 trebco, llc. All rights reserved. LGPL: https://treb.app/license */
2
2
 
3
3
  /**
4
4
  * add our tag to the map
@@ -19,12 +19,20 @@ declare global {
19
19
  export declare class TREBGlobal {
20
20
 
21
21
  /**
22
- * build version
22
+ * Package version
23
23
  */
24
24
  version: string;
25
25
 
26
26
  /**
27
- * create a spreadsheet instance
27
+ * Create a spreadsheet. The `USER_DATA_TYPE` template parameter is the type
28
+ * assigned to the `user_data` field of the spreadsheet instance -- it can
29
+ * help simplify typing if you are storing extra data in spreadsheet
30
+ * files.
31
+ *
32
+ * Just ignore this parameter if you don't need it.
33
+ *
34
+ * @typeParam USER_DATA_TYPE - type for the `user_data` field in the
35
+ * spreadsheet instance
28
36
  */
29
37
  CreateSpreadsheet<USER_DATA_TYPE = unknown>(options: EmbeddedSpreadsheetOptions): EmbeddedSpreadsheet<USER_DATA_TYPE>;
30
38
  }
@@ -256,6 +264,13 @@ export interface EmbeddedSpreadsheetOptions {
256
264
  * top-left of the spreadsheet when a network document has local changes.
257
265
  */
258
266
  revert_indicator?: boolean;
267
+
268
+ /**
269
+ * handle the F9 key and recalculate the spreadsheet. for compatibility.
270
+ * we're leaving this option to default `false` for now, but that may
271
+ * change in the future. key modifiers have no effect.
272
+ */
273
+ recalculate_on_f9?: boolean;
259
274
  }
260
275
 
261
276
  /**
@@ -291,11 +306,17 @@ export declare class EmbeddedSpreadsheet<USER_DATA_TYPE = unknown> {
291
306
  /** document name (metadata) */
292
307
  set document_name(name: string | undefined);
293
308
 
294
- /** opaque user data (metadata) */
309
+ /**
310
+ * opaque user data (metadata). `USER_DATA_TYPE` is a template
311
+ * parameter you can set when creating the spreadsheet.
312
+ */
295
313
  get user_data(): USER_DATA_TYPE | undefined;
296
314
 
297
- /** opaque user data (metadata) */
298
- set user_data(data: USER_DATA_TYPE);
315
+ /**
316
+ * opaque user data (metadata). `USER_DATA_TYPE` is a template
317
+ * parameter you can set when creating the spreadsheet.
318
+ */
319
+ set user_data(data: USER_DATA_TYPE | undefined);
299
320
 
300
321
  /** current grid scale */
301
322
  get scale(): number;
@@ -849,6 +870,16 @@ export declare class EmbeddedSpreadsheet<USER_DATA_TYPE = unknown> {
849
870
  */
850
871
  FormatNumber(value: number, format?: string): string;
851
872
 
873
+ /**
874
+ * convert a javascript date (or timestamp) to a spreadsheet date
875
+ */
876
+ SpreadsheetDate(javascript_date: number | Date): number;
877
+
878
+ /**
879
+ * convert a spreadsheet date to a javascript date
880
+ */
881
+ JavascriptDate(spreadsheet_date: number): number;
882
+
852
883
  /**
853
884
  * Apply borders to range.
854
885
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trebco/treb",
3
- "version": "28.5.2",
3
+ "version": "28.10.0",
4
4
  "license": "LGPL-3.0-or-later",
5
5
  "homepage": "https://treb.app",
6
6
  "repository": {
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU General Public License along
15
15
  * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
16
  *
17
- * Copyright 2022-2023 trebco, llc.
17
+ * Copyright 2022-2024 trebco, llc.
18
18
  * info@treb.app
19
19
  *
20
20
  */
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU General Public License along
15
15
  * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
16
  *
17
- * Copyright 2022-2023 trebco, llc.
17
+ * Copyright 2022-2024 trebco, llc.
18
18
  * info@treb.app
19
19
  *
20
20
  */
@@ -1,24 +1,24 @@
1
- /*
2
- * This file is part of TREB.
3
- *
4
- * TREB is free software: you can redistribute it and/or modify it under the
5
- * terms of the GNU General Public License as published by the Free Software
6
- * Foundation, either version 3 of the License, or (at your option) any
7
- * later version.
8
- *
9
- * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
- * details.
13
- *
14
- * You should have received a copy of the GNU General Public License along
15
- * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
- *
17
- * Copyright 2022-2023 trebco, llc.
18
- * info@treb.app
19
- *
20
- */
21
-
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-2024 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+
22
22
  /**
23
23
  * utility types collected from various other files,
24
24
  * attempting to consolidate
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU General Public License along
15
15
  * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
16
  *
17
- * Copyright 2022-2023 trebco, llc.
17
+ * Copyright 2022-2024 trebco, llc.
18
18
  * info@treb.app
19
19
  *
20
20
  */
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU General Public License along
15
15
  * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
16
  *
17
- * Copyright 2022-2023 trebco, llc.
17
+ * Copyright 2022-2024 trebco, llc.
18
18
  * info@treb.app
19
19
  *
20
20
  */
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU General Public License along
15
15
  * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
16
  *
17
- * Copyright 2022-2023 trebco, llc.
17
+ * Copyright 2022-2024 trebco, llc.
18
18
  * info@treb.app
19
19
  *
20
20
  */
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU General Public License along
15
15
  * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
16
  *
17
- * Copyright 2022-2023 trebco, llc.
17
+ * Copyright 2022-2024 trebco, llc.
18
18
  * info@treb.app
19
19
  *
20
20
  */
@@ -15,7 +15,7 @@ export class Gradient {
15
15
 
16
16
  public mapped: Array<GradientStop & { resolved: number[] }>;
17
17
 
18
- constructor(stops: GradientStop[], theme: Theme, public color_space: ColorSpace = 'HSL') {
18
+ constructor(stops: GradientStop[], theme: Theme, public color_space: ColorSpace = 'RGB') {
19
19
 
20
20
  this.mapped = stops.map(stop => {
21
21
 
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU General Public License along
15
15
  * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
16
  *
17
- * Copyright 2022-2023 trebco, llc.
17
+ * Copyright 2022-2024 trebco, llc.
18
18
  * info@treb.app
19
19
  *
20
20
  */
@@ -14,16 +14,16 @@
14
14
  * You should have received a copy of the GNU General Public License along
15
15
  * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
16
  *
17
- * Copyright 2022-2023 trebco, llc.
17
+ * Copyright 2022-2024 trebco, llc.
18
18
  * info@treb.app
19
19
  *
20
20
  */
21
21
 
22
- /**
23
- * this is a special index for inclusion in the standalone format lib
24
- */
25
-
26
- export * from './localization';
27
- export * from './text_part';
28
- export * from './value-type';
29
-
22
+ /**
23
+ * this is a special index for inclusion in the standalone format lib
24
+ */
25
+
26
+ export * from './localization';
27
+ export * from './text_part';
28
+ export * from './value-type';
29
+
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU General Public License along
15
15
  * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
16
  *
17
- * Copyright 2022-2023 trebco, llc.
17
+ * Copyright 2022-2024 trebco, llc.
18
18
  * info@treb.app
19
19
  *
20
20
  */
@@ -1,24 +1,24 @@
1
- /*
2
- * This file is part of TREB.
3
- *
4
- * TREB is free software: you can redistribute it and/or modify it under the
5
- * terms of the GNU General Public License as published by the Free Software
6
- * Foundation, either version 3 of the License, or (at your option) any
7
- * later version.
8
- *
9
- * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
- * details.
13
- *
14
- * You should have received a copy of the GNU General Public License along
15
- * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
- *
17
- * Copyright 2022-2023 trebco, llc.
18
- * info@treb.app
19
- *
20
- */
21
-
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-2024 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+
22
22
  import type { ICellAddress } from './area';
23
23
 
24
24
  /**
@@ -1,24 +1,24 @@
1
- /*
2
- * This file is part of TREB.
3
- *
4
- * TREB is free software: you can redistribute it and/or modify it under the
5
- * terms of the GNU General Public License as published by the Free Software
6
- * Foundation, either version 3 of the License, or (at your option) any
7
- * later version.
8
- *
9
- * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
- * details.
13
- *
14
- * You should have received a copy of the GNU General Public License along
15
- * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
- *
17
- * Copyright 2022-2023 trebco, llc.
18
- * info@treb.app
19
- *
20
- */
21
-
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-2024 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+
22
22
  /**
23
23
  * the point of localization is to have a central, single source of truth
24
24
  * for the current locale. this can come from the browser, via a GET
@@ -98,6 +98,12 @@ export class Localization {
98
98
 
99
99
  }
100
100
 
101
+ // don't allow the "C" locale
102
+ if (this.locale === 'C') {
103
+ console.warn('Locale not set, defaulting to en-us');
104
+ this.locale = 'en-us';
105
+ }
106
+
101
107
  const decimal_separator = new Intl.NumberFormat(this.locale,
102
108
  {minimumFractionDigits: 1}).format(3.3).replace(/\d/g, '');
103
109
 
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU General Public License along
15
15
  * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
16
  *
17
- * Copyright 2022-2023 trebco, llc.
17
+ * Copyright 2022-2024 trebco, llc.
18
18
  * info@treb.app
19
19
  *
20
20
  */
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU General Public License along
15
15
  * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
16
  *
17
- * Copyright 2022-2023 trebco, llc.
17
+ * Copyright 2022-2024 trebco, llc.
18
18
  * info@treb.app
19
19
  *
20
20
  */
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU General Public License along
15
15
  * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
16
  *
17
- * Copyright 2022-2023 trebco, llc.
17
+ * Copyright 2022-2024 trebco, llc.
18
18
  * info@treb.app
19
19
  *
20
20
  */
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU General Public License along
15
15
  * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
16
  *
17
- * Copyright 2022-2023 trebco, llc.
17
+ * Copyright 2022-2024 trebco, llc.
18
18
  * info@treb.app
19
19
  *
20
20
  */
@@ -1,24 +1,24 @@
1
- /*
2
- * This file is part of TREB.
3
- *
4
- * TREB is free software: you can redistribute it and/or modify it under the
5
- * terms of the GNU General Public License as published by the Free Software
6
- * Foundation, either version 3 of the License, or (at your option) any
7
- * later version.
8
- *
9
- * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
- * details.
13
- *
14
- * You should have received a copy of the GNU General Public License along
15
- * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
- *
17
- * Copyright 2022-2023 trebco, llc.
18
- * info@treb.app
19
- *
20
- */
21
-
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-2024 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+
22
22
  export enum TextPartFlag {
23
23
 
24
24
  /** just render */
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU General Public License along
15
15
  * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
16
  *
17
- * Copyright 2022-2023 trebco, llc.
17
+ * Copyright 2022-2024 trebco, llc.
18
18
  * info@treb.app
19
19
  *
20
20
  */
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU General Public License along
15
15
  * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
16
  *
17
- * Copyright 2022-2023 trebco, llc.
17
+ * Copyright 2022-2024 trebco, llc.
18
18
  * info@treb.app
19
19
  *
20
20
  */
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU General Public License along
15
15
  * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
16
  *
17
- * Copyright 2022-2023 trebco, llc.
17
+ * Copyright 2022-2024 trebco, llc.
18
18
  * info@treb.app
19
19
  *
20
20
  */
@@ -1,24 +1,24 @@
1
- /*
2
- * This file is part of TREB.
3
- *
4
- * TREB is free software: you can redistribute it and/or modify it under the
5
- * terms of the GNU General Public License as published by the Free Software
6
- * Foundation, either version 3 of the License, or (at your option) any
7
- * later version.
8
- *
9
- * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
- * details.
13
- *
14
- * You should have received a copy of the GNU General Public License along
15
- * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
- *
17
- * Copyright 2022-2023 trebco, llc.
18
- * info@treb.app
19
- *
20
- */
21
-
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-2024 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+
22
22
  .treb-embed-mouse-mask {
23
23
  position: fixed;
24
24
  top: 0px;
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU General Public License along
15
15
  * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
16
  *
17
- * Copyright 2022-2023 trebco, llc.
17
+ * Copyright 2022-2024 trebco, llc.
18
18
  * info@treb.app
19
19
  *
20
20
  */
@@ -1769,7 +1769,25 @@ export class Calculator extends Graph {
1769
1769
 
1770
1770
  public UpdateConditionals(list?: ConditionalFormat|ConditionalFormat[], context?: Sheet): void {
1771
1771
 
1772
+ // this method is (1) relying on the leaf vertex Set to avoid duplication,
1773
+ // and (2) leaving orphansed conditionals in place. we should look to
1774
+ // cleaning things up.
1775
+
1776
+ // is it also (3) adding unecessary calculations (building the expression,
1777
+ // below)?
1778
+
1772
1779
  if (!list) {
1780
+
1781
+ // we could in theory remove all of the leaves (the ones we know to
1782
+ // be used for conditionals), because they will be added back below.
1783
+ // how wasteful is that?
1784
+
1785
+ // or maybe we could change the mark, and then use invalid marks
1786
+ // to check?
1787
+
1788
+ // the alternative is just to leave them as orphans until the graph
1789
+ // is rebuilt. which is lazy, but probably not that bad...
1790
+
1773
1791
  for (const sheet of this.model.sheets.list) {
1774
1792
  if (sheet.conditional_formats?.length) {
1775
1793
  this.UpdateConditionals(sheet.conditional_formats, sheet);
@@ -1833,7 +1851,11 @@ export class Calculator extends Graph {
1833
1851
  entry.internal = {};
1834
1852
  }
1835
1853
  if (!entry.internal.vertex) {
1836
- entry.internal.vertex = new CalculationLeafVertex();
1854
+
1855
+ const vertex = new CalculationLeafVertex();
1856
+ vertex.use = 'conditional';
1857
+
1858
+ entry.internal.vertex = vertex;
1837
1859
 
1838
1860
  let options: EvaluateOptions|undefined;
1839
1861
  if (entry.type !== 'gradient' && entry.type !== 'duplicate-values') {
@@ -1851,35 +1873,6 @@ export class Calculator extends Graph {
1851
1873
  this.AddLeafVertex(vertex);
1852
1874
  this.UpdateLeafVertex(vertex, expression, context);
1853
1875
 
1854
- /*
1855
- if (entry.type === 'cell-match') {
1856
- if (!entry.internal) {
1857
- entry.internal = {};
1858
- }
1859
- if (!entry.internal.vertex) {
1860
- entry.internal.vertex = new CalculationLeafVertex();
1861
- }
1862
- const vertex = entry.internal.vertex as LeafVertex;
1863
- this.AddLeafVertex(vertex);
1864
- this.UpdateLeafVertex(vertex, entry.expression, context);
1865
- }
1866
- else if (entry.type === 'expression') {
1867
- if (!entry.internal) {
1868
- entry.internal = {};
1869
- }
1870
- if (!entry.internal.vertex) {
1871
- entry.internal.vertex = new CalculationLeafVertex();
1872
-
1873
- // set initial state based on current state
1874
- entry.internal.vertex.result = { type: ValueType.boolean, value: !!entry.applied };
1875
-
1876
- }
1877
- const vertex = entry.internal.vertex as LeafVertex;
1878
- this.AddLeafVertex(vertex);
1879
- this.UpdateLeafVertex(vertex, entry.expression, context);
1880
- }
1881
- */
1882
-
1883
1876
  }
1884
1877
 
1885
1878
  }
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU General Public License along
15
15
  * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
16
  *
17
- * Copyright 2022-2023 trebco, llc.
17
+ * Copyright 2022-2024 trebco, llc.
18
18
  * info@treb.app
19
19
  *
20
20
  */
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU General Public License along
15
15
  * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
16
  *
17
- * Copyright 2022-2023 trebco, llc.
17
+ * Copyright 2022-2024 trebco, llc.
18
18
  * info@treb.app
19
19
  *
20
20
  */
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU General Public License along
15
15
  * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
16
  *
17
- * Copyright 2022-2023 trebco, llc.
17
+ * Copyright 2022-2024 trebco, llc.
18
18
  * info@treb.app
19
19
  *
20
20
  */
@@ -42,6 +42,13 @@ export class CalculationLeafVertex extends SpreadsheetVertex {
42
42
 
43
43
  public address = { row: -1, column: -1 }; // fake address
44
44
 
45
+ /**
46
+ * this type is currently only used for conditional formatting.
47
+ * but that might change in the future. I want to identify what
48
+ * it's used for so we can selectively prune them when necessary.
49
+ */
50
+ public use?: string;
51
+
45
52
  /**
46
53
  * flag, to reduce unecessary application. work in progress. this
47
54
  * indicates that we reached the calculation step. that means either