@trebco/treb 25.2.0 → 25.5.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 (71) hide show
  1. package/{.eslintrc.js → .eslintrc.cjs} +4 -0
  2. package/api-generator/api-generator.ts +25 -55
  3. package/dist/treb-spreadsheet.mjs +9 -9
  4. package/dist/treb.d.ts +2 -2
  5. package/esbuild-custom-element.mjs +5 -264
  6. package/esbuild-utils.mjs +273 -0
  7. package/package.json +2 -2
  8. package/treb-base-types/src/cell.ts +23 -22
  9. package/treb-base-types/src/cells.ts +55 -2
  10. package/treb-base-types/src/theme.ts +0 -11
  11. package/treb-base-types/src/union.ts +2 -1
  12. package/treb-calculator/src/calculator.ts +8 -5
  13. package/treb-calculator/src/dag/array-vertex.ts +22 -22
  14. package/treb-calculator/src/dag/graph.ts +25 -23
  15. package/treb-calculator/src/dag/leaf_vertex.ts +23 -22
  16. package/treb-calculator/src/dag/spreadsheet_vertex.ts +25 -23
  17. package/treb-calculator/src/expression-calculator.ts +23 -22
  18. package/treb-calculator/src/function-error.ts +23 -22
  19. package/treb-calculator/src/functions/base-functions.ts +3 -2
  20. package/treb-calculator/src/functions/checkbox.ts +23 -22
  21. package/treb-calculator/src/functions/complex-functions.ts +2 -1
  22. package/treb-calculator/src/functions/finance-functions.ts +22 -22
  23. package/treb-calculator/src/functions/information-functions.ts +22 -22
  24. package/treb-calculator/src/functions/matrix-functions.ts +2 -1
  25. package/treb-calculator/src/functions/statistics-functions.ts +22 -22
  26. package/treb-calculator/src/functions/text-functions.ts +23 -22
  27. package/treb-calculator/src/primitives.ts +23 -22
  28. package/treb-calculator/src/utilities.ts +23 -24
  29. package/treb-charts/src/chart-functions.ts +22 -22
  30. package/treb-charts/src/chart.ts +6 -3
  31. package/treb-charts/src/renderer.ts +25 -23
  32. package/treb-charts/src/util.ts +23 -22
  33. package/treb-embed/modern.tsconfig.json +3 -2
  34. package/treb-embed/src/custom-element/spreadsheet-constructor.ts +57 -14
  35. package/treb-embed/src/embedded-spreadsheet.ts +81 -47
  36. package/treb-embed/src/options.ts +11 -0
  37. package/treb-embed/src/progress-dialog.ts +0 -3
  38. package/treb-embed/src/types.ts +14 -3
  39. package/treb-embed/style/layout.scss +32 -29
  40. package/treb-embed/style/theme-defaults.scss +5 -0
  41. package/treb-export/src/drawing2/chart2.ts +2 -2
  42. package/treb-export/src/drawing2/drawing2.ts +6 -4
  43. package/treb-export/src/export-worker/export-worker.ts +22 -24
  44. package/treb-export/src/export-worker/index-modern.ts +2 -1
  45. package/treb-export/src/export2.ts +15 -8
  46. package/treb-export/src/import2.ts +10 -5
  47. package/treb-export/src/workbook-sheet2.ts +2 -1
  48. package/treb-format/src/format.ts +23 -22
  49. package/treb-format/src/format_parser.ts +23 -22
  50. package/treb-format/src/value_parser.ts +23 -22
  51. package/treb-grid/src/editors/formula_bar.ts +2 -1
  52. package/treb-grid/src/editors/formula_editor_base.ts +4 -2
  53. package/treb-grid/src/editors/overlay_editor.ts +2 -1
  54. package/treb-grid/src/index.ts +12 -9
  55. package/treb-grid/src/layout/base_layout.ts +4 -2
  56. package/treb-grid/src/render/selection-renderer.ts +25 -23
  57. package/treb-grid/src/render/tile_renderer.ts +6 -4
  58. package/treb-grid/src/types/annotation.ts +33 -37
  59. package/treb-grid/src/types/data_model.ts +30 -22
  60. package/treb-grid/src/types/grid.ts +55 -584
  61. package/treb-grid/src/types/grid_base.ts +401 -7
  62. package/treb-grid/src/types/grid_events.ts +3 -0
  63. package/treb-grid/src/types/grid_selection.ts +22 -22
  64. package/treb-grid/src/types/named_range.ts +22 -22
  65. package/treb-grid/src/types/sheet.ts +8 -7
  66. package/treb-grid/src/types/sheet_types.ts +11 -7
  67. package/treb-grid/src/types/tab_bar.ts +1 -1
  68. package/treb-parser/src/parser.ts +5 -4
  69. package/tsproject.json +3 -4
  70. package/tsconfig.json +0 -10
  71. /package/treb-embed/src/{custom-element/content-types.d.ts → content-types.d.ts} +0 -0
@@ -1,26 +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-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-2023 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+
22
22
  import { NumberFormatSection } from './number_format_section';
23
- import { TextPartFlag, TextPart } from 'treb-base-types';
23
+ import type { TextPart } from 'treb-base-types';
24
+ import { TextPartFlag } from 'treb-base-types';
24
25
  // import { NumberFormat } from './format';
25
26
 
26
27
  const ASTERISK = 0x2A; // TODO
@@ -1,25 +1,26 @@
1
- /*
2
- * This file is part of TREB.
3
- *
4
- * TREB is free software: you can redistribute it and/or modify it under the
5
- * terms of the GNU General Public License as published by the Free Software
6
- * Foundation, either version 3 of the License, or (at your option) any
7
- * later version.
8
- *
9
- * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
- * details.
13
- *
14
- * You should have received a copy of the GNU General Public License along
15
- * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
- *
17
- * Copyright 2022-2023 trebco, llc.
18
- * info@treb.app
19
- *
20
- */
21
-
22
- import { ValueType, Localization, Complex } from 'treb-base-types';
1
+ /*
2
+ * This file is part of TREB.
3
+ *
4
+ * TREB is free software: you can redistribute it and/or modify it under the
5
+ * terms of the GNU General Public License as published by the Free Software
6
+ * Foundation, either version 3 of the License, or (at your option) any
7
+ * later version.
8
+ *
9
+ * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
+ * details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License along
15
+ * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
+ *
17
+ * Copyright 2022-2023 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+
22
+ import type { Complex } from 'treb-base-types';
23
+ import { ValueType, Localization } from 'treb-base-types';
23
24
  import { UnlotusDate } from './format';
24
25
 
25
26
  /**
@@ -23,7 +23,8 @@ import { Yield } from 'treb-utils';
23
23
 
24
24
  import { DOMUtilities } from '../util/dom_utilities';
25
25
  import type { Theme } from 'treb-base-types';
26
- import { FormulaEditorBase, FormulaEditorEvent } from './formula_editor_base';
26
+ import type { FormulaEditorEvent } from './formula_editor_base';
27
+ import { FormulaEditorBase } from './formula_editor_base';
27
28
  import type { GridOptions } from '../types/grid_options';
28
29
  import type { Autocomplete } from './autocomplete';
29
30
  import type { DataModel, ViewModel } from '../types/data_model';
@@ -19,13 +19,15 @@
19
19
  *
20
20
  */
21
21
 
22
- import { Area, Cell, Theme, Rectangle, Localization, ICellAddress } from 'treb-base-types';
22
+ import type { Cell, Theme, ICellAddress } from 'treb-base-types';
23
+ import { Area, Rectangle, Localization } from 'treb-base-types';
23
24
  import { Yield, EventSource } from 'treb-utils';
24
25
  import type { Parser, UnitRange, UnitAddress, ParseResult, ExpressionUnit } from 'treb-parser';
25
26
 
26
27
  import type { GridSelection } from '../types/grid_selection';
27
28
  import type { Autocomplete, AutocompleteResult } from './autocomplete';
28
- import { AutocompleteExecResult, AutocompleteMatcher, DescriptorType } from './autocomplete_matcher';
29
+ import type { AutocompleteExecResult, AutocompleteMatcher} from './autocomplete_matcher';
30
+ import { DescriptorType } from './autocomplete_matcher';
29
31
 
30
32
  import type { DataModel, ViewModel } from '../types/data_model';
31
33
  import { UA } from '../util/ua';
@@ -28,7 +28,8 @@
28
28
  * and get layout working properly.
29
29
  */
30
30
 
31
- import { Style, Theme, CellValue, Rectangle, ThemeColor2, Cell } from 'treb-base-types';
31
+ import type { Theme, CellValue, Rectangle, Cell } from 'treb-base-types';
32
+ import { Style, ThemeColor2 } from 'treb-base-types';
32
33
  import { Yield } from 'treb-utils';
33
34
  import type { Parser } from 'treb-parser';
34
35
  import type { GridSelection } from '../types/grid_selection';
@@ -22,16 +22,19 @@
22
22
  export { Grid } from './types/grid';
23
23
  export { GridBase } from './types/grid_base';
24
24
  export { Sheet } from './types/sheet';
25
- export { DataModel, MacroFunction, SerializedNamedExpression, SerializedModel } from './types/data_model';
25
+ export { DataModel, type MacroFunction } from './types/data_model';
26
+ export type { SerializedNamedExpression, SerializedModel } from './types/data_model';
26
27
  export * from './types/grid_events';
27
- export { SerializedSheet, FreezePane } from './types/sheet_types';
28
- export { Annotation, ViewData as AnnotationViewData } from './types/annotation';
29
- export { GridOptions } from './types/grid_options';
30
- export { Command, CommandKey } from './types/grid_command';
28
+ export type { SerializedSheet, FreezePane } from './types/sheet_types';
29
+ export { Annotation } from './types/annotation';
30
+ export type { ViewData as AnnotationViewData } from './types/annotation';
31
+ export type { GridOptions } from './types/grid_options';
32
+ export { CommandKey } from './types/grid_command';
33
+ export type { Command } from './types/grid_command';
31
34
  export { NamedRangeCollection } from './types/named_range';
32
- export { GridSelection } from './types/grid_selection';
35
+ export type { GridSelection } from './types/grid_selection';
33
36
  export { BorderConstants } from './types/border_constants';
34
- export { SerializeOptions } from './types/serialize_options';
35
- export { FunctionDescriptor, ArgumentDescriptor } from './editors/autocomplete_matcher';
37
+ export type { SerializeOptions } from './types/serialize_options';
38
+ export type { FunctionDescriptor, ArgumentDescriptor } from './editors/autocomplete_matcher';
36
39
  export { UA } from './util/ua';
37
- export { SetRangeOptions } from './types/set_range_options';
40
+ export type { SetRangeOptions } from './types/set_range_options';
@@ -23,7 +23,8 @@ import { DOMUtilities } from '../util/dom_utilities';
23
23
  import type { DataModel, ViewModel } from '../types/data_model';
24
24
 
25
25
  import type { Tile } from '../types/tile';
26
- import { Style, Theme, Point, Extent, Size, Position, Area, ICellAddress, Rectangle, ThemeColor, Table } from 'treb-base-types';
26
+ import type { Theme, Point, Extent, Size, Position, ICellAddress, Table } from 'treb-base-types';
27
+ import { Style, Area, Rectangle, ThemeColor } from 'treb-base-types';
27
28
 
28
29
  import { MouseDrag } from '../types/drag_mask';
29
30
  import type { GridEvent } from '../types/grid_events';
@@ -39,7 +40,8 @@ import type { GridEvent } from '../types/grid_events';
39
40
  // define area as a generic, then define it on some arbitrary value. that would
40
41
  // force separation of all the functions between the two types (I think)
41
42
 
42
- import { Area as TileRange, CellValue, AnnotationLayout, Corner } from 'treb-base-types';
43
+ import type { CellValue, AnnotationLayout, Corner } from 'treb-base-types';
44
+ import { Area as TileRange } from 'treb-base-types';
43
45
  import type { Annotation } from '../types/annotation';
44
46
 
45
47
  export { Area as TileRange } from 'treb-base-types';
@@ -1,27 +1,29 @@
1
- /*
2
- * This file is part of TREB.
3
- *
4
- * TREB is free software: you can redistribute it and/or modify it under the
5
- * terms of the GNU General Public License as published by the Free Software
6
- * Foundation, either version 3 of the License, or (at your option) any
7
- * later version.
8
- *
9
- * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
- * details.
13
- *
14
- * You should have received a copy of the GNU General Public License along
15
- * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
- *
17
- * Copyright 2022-2023 trebco, llc.
18
- * info@treb.app
19
- *
20
- */
21
-
22
- import { Theme, Rectangle, ICellAddress } from 'treb-base-types';
1
+ /*
2
+ * This file is part of TREB.
3
+ *
4
+ * TREB is free software: you can redistribute it and/or modify it under the
5
+ * terms of the GNU General Public License as published by the Free Software
6
+ * Foundation, either version 3 of the License, or (at your option) any
7
+ * later version.
8
+ *
9
+ * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
+ * details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License along
15
+ * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
+ *
17
+ * Copyright 2022-2023 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+
22
+ import type { Theme, ICellAddress } from 'treb-base-types';
23
+ import { Rectangle } from 'treb-base-types';
23
24
  import type { BaseLayout } from '../layout/base_layout';
24
- import { SVGSelectionBlock, SelectionOffset } from './svg_selection_block';
25
+ import type { SelectionOffset } from './svg_selection_block';
26
+ import { SVGSelectionBlock } from './svg_selection_block';
25
27
  import type { GridSelection } from '../types/grid_selection';
26
28
  import { HeaderOverlay, Orientation } from './svg_header_overlay';
27
29
  import type { DataModel, ViewModel } from '../types/data_model';
@@ -19,14 +19,16 @@
19
19
  *
20
20
  */
21
21
 
22
- import { TextPartFlag, ICellAddress, Style, ValueType,
22
+ import type { ICellAddress,
23
23
  PreparedText, RenderTextPart,
24
- Cell, Area, Size, Rectangle,
25
- Theme, ThemeColor, ThemeColor2, Table } from 'treb-base-types';
24
+ Cell, Size,
25
+ Theme} from 'treb-base-types';
26
+ import { TextPartFlag, Style, ValueType, Area, Rectangle, ThemeColor, ThemeColor2 } from 'treb-base-types';
26
27
 
27
28
  import type { Tile } from '../types/tile';
28
29
  import { FontMetricsCache as FontMetricsCache2 } from '../util/fontmetrics2';
29
- import { FormattedString, MDParser } from 'treb-parser';
30
+ import type { FormattedString} from 'treb-parser';
31
+ import { MDParser } from 'treb-parser';
30
32
  import type { BaseLayout, TileRange } from '../layout/base_layout';
31
33
  import type { DataModel, ViewModel } from '../types/data_model';
32
34
  import type { GridOptions } from '../types/grid_options';
@@ -1,25 +1,26 @@
1
- /*
2
- * This file is part of TREB.
3
- *
4
- * TREB is free software: you can redistribute it and/or modify it under the
5
- * terms of the GNU General Public License as published by the Free Software
6
- * Foundation, either version 3 of the License, or (at your option) any
7
- * later version.
8
- *
9
- * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
- * details.
13
- *
14
- * You should have received a copy of the GNU General Public License along
15
- * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
- *
17
- * Copyright 2022-2023 trebco, llc.
18
- * info@treb.app
19
- *
20
- */
21
-
22
- import { Rectangle, ICellAddress, AnnotationLayout } from 'treb-base-types';
1
+ /*
2
+ * This file is part of TREB.
3
+ *
4
+ * TREB is free software: you can redistribute it and/or modify it under the
5
+ * terms of the GNU General Public License as published by the Free Software
6
+ * Foundation, either version 3 of the License, or (at your option) any
7
+ * later version.
8
+ *
9
+ * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
+ * details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License along
15
+ * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
+ *
17
+ * Copyright 2022-2023 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+
22
+ import type { ICellAddress, AnnotationLayout } from 'treb-base-types';
23
+ import { Rectangle } from 'treb-base-types';
23
24
 
24
25
  /**
25
26
  * new annotation class. annotations are arbitrary content
@@ -78,8 +79,18 @@ export interface ViewData {
78
79
 
79
80
  }
80
81
 
82
+ /**
83
+ * why is this a class? it doesn't do anything.
84
+ * FIXME: -> interface
85
+ */
81
86
  export class Annotation {
82
87
 
88
+ /**
89
+ * the key field is used to identify and coordinate annotations when we
90
+ * have freeze panes. when an annotation crosses a freeze pane, we need
91
+ * two copies of the rendered node so that we can scroll. we use the key
92
+ * to match the frozen/unfrozen instances.
93
+ */
83
94
  public get key(): number { return this.key_; }
84
95
 
85
96
  /** coordinates, in sheet space */
@@ -105,15 +116,6 @@ export class Annotation {
105
116
  /** also opaque data, but not serialized. */
106
117
  public temp: any = {};
107
118
 
108
- /* * flag indicating we have inflated this. not serialized */
109
- // public inflated = false;
110
-
111
- /* * if function exists, will be called when the annotation is resized */
112
- // public resize_callback?: () => void;
113
-
114
- /* * if function exists, will be called when the annotation needs to update */
115
- // public update_callback?: () => void;
116
-
117
119
  /** annotation can be resized. this is advisory, for UI */
118
120
  public resizable = true;
119
121
 
@@ -132,12 +134,6 @@ export class Annotation {
132
134
  /** resize when resizing/inserting rows/columns */
133
135
  public resize_with_cells = true;
134
136
 
135
- /* * layout node, obviously not serialized */
136
- // public node?: HTMLDivElement;
137
-
138
- /* * content node */
139
- // public content_node?: HTMLDivElement;
140
-
141
137
  public view: ViewData[] = [];
142
138
 
143
139
  /**
@@ -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-2023 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+
22
22
  import type { Sheet } from './sheet';
23
23
  import type { IArea, ICellAddress, Table } from 'treb-base-types';
24
24
  import type { SerializedSheet } from './sheet_types';
@@ -26,12 +26,20 @@ import { NamedRangeCollection } from './named_range';
26
26
  import type { ExpressionUnit, UnitAddress, UnitStructuredReference, UnitRange } from 'treb-parser';
27
27
  import { Style } from 'treb-base-types';
28
28
 
29
- export interface MacroFunction {
29
+ export interface SerializedMacroFunction {
30
30
  name: string;
31
31
  function_def: string;
32
32
  argument_names?: string[];
33
33
  // argument_default_values?: any[]; // <- new
34
34
  description?: string;
35
+ }
36
+
37
+ /**
38
+ * we define this as extending the serialized version, rather
39
+ * than taking out the parameter, so we can make that def public
40
+ * in the API types.
41
+ */
42
+ export interface MacroFunction extends SerializedMacroFunction {
35
43
  expression?: ExpressionUnit;
36
44
  }
37
45