@trebco/treb 28.17.5 → 29.1.4

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 (88) hide show
  1. package/dist/treb-spreadsheet-light.mjs +12 -12
  2. package/dist/treb-spreadsheet.mjs +12 -12
  3. package/dist/treb.d.ts +121 -82
  4. package/eslint.config.js +21 -0
  5. package/package.json +6 -6
  6. package/treb-base-types/src/area.ts +4 -2
  7. package/treb-base-types/src/cell.ts +1 -1
  8. package/treb-base-types/src/cells.ts +16 -7
  9. package/treb-base-types/src/dom-utilities.ts +4 -2
  10. package/treb-base-types/src/import.ts +2 -2
  11. package/treb-base-types/src/rectangle.ts +5 -5
  12. package/treb-base-types/src/text_part.ts +7 -0
  13. package/treb-base-types/src/union.ts +6 -1
  14. package/treb-base-types/src/value-type.ts +1 -1
  15. package/treb-calculator/src/calculator.ts +114 -165
  16. package/treb-calculator/src/dag/calculation_leaf_vertex.ts +1 -2
  17. package/treb-calculator/src/dag/graph.ts +3 -3
  18. package/treb-calculator/src/dag/spreadsheet_vertex.ts +2 -2
  19. package/treb-calculator/src/dag/state_leaf_vertex.ts +2 -4
  20. package/treb-calculator/src/descriptors.ts +28 -2
  21. package/treb-calculator/src/expression-calculator.ts +25 -34
  22. package/treb-calculator/src/function-error.ts +2 -2
  23. package/treb-calculator/src/function-library.ts +16 -0
  24. package/treb-calculator/src/functions/base-functions.ts +185 -211
  25. package/treb-calculator/src/functions/checkbox.ts +0 -1
  26. package/treb-calculator/src/functions/complex-functions.ts +49 -47
  27. package/treb-calculator/src/functions/finance-functions.ts +10 -10
  28. package/treb-calculator/src/functions/function-utilities.ts +26 -0
  29. package/treb-calculator/src/functions/information-functions.ts +21 -41
  30. package/treb-calculator/src/functions/matrix-functions.ts +8 -1
  31. package/treb-calculator/src/functions/sparkline.ts +6 -4
  32. package/treb-calculator/src/functions/statistics-functions.ts +21 -17
  33. package/treb-calculator/src/functions/text-functions.ts +14 -13
  34. package/treb-calculator/src/primitives.ts +48 -37
  35. package/treb-calculator/src/utilities.ts +117 -134
  36. package/treb-charts/src/chart-functions.ts +3 -3
  37. package/treb-charts/src/chart-types.ts +42 -1
  38. package/treb-charts/src/chart-utils.ts +155 -113
  39. package/treb-charts/src/chart.ts +6 -5
  40. package/treb-charts/src/default-chart-renderer.ts +6 -5
  41. package/treb-charts/src/renderer.ts +12 -11
  42. package/treb-charts/src/util.ts +25 -36
  43. package/treb-data-model/package.json +5 -0
  44. package/{treb-grid/src/types → treb-data-model/src}/annotation.ts +2 -2
  45. package/{treb-grid/src/types → treb-data-model/src}/conditional_format.ts +20 -0
  46. package/{treb-grid/src/types → treb-data-model/src}/data_model.ts +231 -133
  47. package/treb-data-model/src/index.ts +45 -0
  48. package/{treb-grid/src/types/named_range.ts → treb-data-model/src/named.ts} +459 -376
  49. package/{treb-grid/src/types → treb-data-model/src}/sheet.ts +13 -5
  50. package/treb-data-model/src/sheet_collection.ts +114 -0
  51. package/{treb-grid/src/types → treb-data-model/src}/sheet_types.ts +6 -3
  52. package/treb-embed/modern.tsconfig.json +1 -0
  53. package/treb-embed/src/custom-element/spreadsheet-constructor.ts +2 -2
  54. package/treb-embed/src/embedded-spreadsheet.ts +125 -270
  55. package/treb-embed/src/selection-state.ts +1 -1
  56. package/treb-embed/src/toolbar-message.ts +1 -1
  57. package/treb-embed/src/types.ts +13 -5
  58. package/treb-export/src/export-worker/export-worker.ts +22 -7
  59. package/treb-export/src/export2.ts +110 -41
  60. package/treb-export/src/import2.ts +6 -5
  61. package/treb-export/src/workbook2.ts +31 -13
  62. package/treb-export/src/xml-utils.ts +5 -1
  63. package/treb-format/src/format.ts +8 -6
  64. package/treb-grid/src/editors/autocomplete.ts +2 -2
  65. package/treb-grid/src/editors/autocomplete_matcher.ts +57 -19
  66. package/treb-grid/src/editors/editor.ts +27 -25
  67. package/treb-grid/src/editors/formula_bar.ts +5 -5
  68. package/treb-grid/src/editors/overlay_editor.ts +1 -2
  69. package/treb-grid/src/index.ts +0 -11
  70. package/treb-grid/src/layout/base_layout.ts +20 -8
  71. package/treb-grid/src/layout/grid_layout.ts +2 -2
  72. package/treb-grid/src/layout/mock-layout.ts +5 -6
  73. package/treb-grid/src/render/selection-renderer.ts +2 -3
  74. package/treb-grid/src/render/tile_renderer.ts +18 -8
  75. package/treb-grid/src/types/grid.ts +96 -67
  76. package/treb-grid/src/types/grid_base.ts +76 -60
  77. package/treb-grid/src/types/grid_command.ts +3 -2
  78. package/treb-grid/src/types/grid_events.ts +12 -6
  79. package/treb-grid/src/types/tab_bar.ts +1 -2
  80. package/treb-parser/src/parser-types.ts +2 -1
  81. package/treb-parser/src/parser.ts +7 -5
  82. package/treb-utils/src/event_source.ts +1 -1
  83. package/treb-utils/src/serialize_html.ts +31 -6
  84. package/.eslintignore +0 -8
  85. package/.eslintrc.cjs +0 -168
  86. package/treb-grid/src/layout/rectangle_cache.ts +0 -86
  87. /package/{treb-grid/src/types → treb-data-model/src}/serialize_options.ts +0 -0
  88. /package/{treb-grid/src/types/grid_selection.ts → treb-data-model/src/sheet_selection.ts} +0 -0
package/dist/treb.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /*! API v28.17. Copyright 2018-2024 trebco, llc. All rights reserved. LGPL: https://treb.app/license */
1
+ /*! API v29.1. 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
@@ -929,8 +929,9 @@ export declare class EmbeddedSpreadsheet<USER_DATA_TYPE = unknown> {
929
929
 
930
930
  /**
931
931
  * Create a named range or named expression. A named range refers to an
932
- * address or range. A named expression can be a value or formula, basically
933
- * anything you would type into a cell.
932
+ * address or range. A named expression can be any value or formula. To set
933
+ * the value as a literal string, enclose the string in double-quotes (as
934
+ * you would when using a string as a function argument).
934
935
  *
935
936
  * @param value range, value or expression
936
937
  *
@@ -943,7 +944,7 @@ export declare class EmbeddedSpreadsheet<USER_DATA_TYPE = unknown> {
943
944
  *
944
945
  * @public
945
946
  */
946
- DefineName(name: string, value: RangeReference | CellValue): void;
947
+ DefineName(name: string, value: RangeReference | CellValue, scope?: string | number, overwrite?: boolean): void;
947
948
 
948
949
  /**
949
950
  * Set or remove a link in a cell.
@@ -1082,8 +1083,24 @@ export interface FreezePane {
1082
1083
  rows: number;
1083
1084
  columns: number;
1084
1085
  }
1085
- export type AnnotationType = 'treb-chart' | 'image' | 'textbox' | 'external';
1086
- export declare type BorderConstants = "none" | "all" | "outside" | "top" | "bottom" | "left" | "right";
1086
+ export declare const StandardGradientsList: {
1087
+ readonly 'red-green': {
1088
+ readonly color_space: "RGB";
1089
+ readonly stops: GradientStop[];
1090
+ };
1091
+ readonly 'red-yellow-green': {
1092
+ readonly color_space: "RGB";
1093
+ readonly stops: GradientStop[];
1094
+ };
1095
+ readonly 'green-red': {
1096
+ readonly color_space: "RGB";
1097
+ readonly stops: GradientStop[];
1098
+ };
1099
+ readonly 'green-yellow-red': {
1100
+ readonly color_space: "RGB";
1101
+ readonly stops: GradientStop[];
1102
+ };
1103
+ };
1087
1104
 
1088
1105
  /**
1089
1106
  * options for serializing data
@@ -1119,73 +1136,7 @@ export interface SerializeOptions {
1119
1136
  */
1120
1137
  export_functions?: boolean;
1121
1138
  }
1122
-
1123
- /**
1124
- * options for the SetRange method
1125
- */
1126
- export interface SetRangeOptions {
1127
-
1128
- /** transpose rectangular array before inserting */
1129
- transpose?: boolean;
1130
-
1131
- /** recycle values (R-style) */
1132
- recycle?: boolean;
1133
-
1134
- /** apply as an array (as if you pressed ctrl+shift+enter) */
1135
- array?: boolean;
1136
-
1137
- /** spill over */
1138
- spill?: boolean;
1139
-
1140
- /**
1141
- * argument separator to use when parsing the input formula. set this
1142
- * option to call SetRange with a consistent argument separator,
1143
- * independent of current locale.
1144
- */
1145
- argument_separator?: ',' | ';';
1146
-
1147
- /**
1148
- * allow R1C1-style references; these can be either absolute
1149
- * addresses (e.g. R2C4) or relative to the cell (e.g. R[-3]C[0]).
1150
- */
1151
- r1c1?: boolean;
1152
- }
1153
- export interface ExternalEditorConfig {
1154
-
1155
- /**
1156
- * list of dependencies to highlight. we support undefined entries in
1157
- * this list so you can use the result of `EmbeddedSpreadsheet.Resolve`,
1158
- * which may return undefined.
1159
- */
1160
- dependencies: DependencyList;
1161
-
1162
- /**
1163
- * this callback will be called when the selection changes in the
1164
- * spreadsheet and this external editor is active. return an updated
1165
- * list of dependencies to highlight.
1166
- *
1167
- * NOTE: this is currently synchronous, but don't rely on that. it
1168
- * might switch to async in the future depending on how it works in
1169
- * practice.
1170
- */
1171
- update: ExternalEditorCallback;
1172
-
1173
- /**
1174
- * a list of nodes that will serve as editors. when you attach, we will do
1175
- * an initial pass of context highlighting. we highlight on text changes
1176
- * and insert references if you make a selection in the spreadsheet while
1177
- * an editor is focused.
1178
- */
1179
- nodes: HTMLElement[];
1180
-
1181
- /**
1182
- * assume that we're editing a formula. does not require leading `=`.
1183
- * defaults to `true` for historical reasons.
1184
- */
1185
- assume_formula?: boolean;
1186
- }
1187
- export type DependencyList = Array<IArea | ICellAddress | undefined>;
1188
- export type ExternalEditorCallback = (selection?: string) => DependencyList | undefined;
1139
+ export type AnnotationType = 'treb-chart' | 'image' | 'textbox' | 'external';
1189
1140
 
1190
1141
  /**
1191
1142
  * Structure represents a 2d range of cells.
@@ -1408,6 +1359,74 @@ export interface EvaluateOptions {
1408
1359
  */
1409
1360
  r1c1?: boolean;
1410
1361
  }
1362
+ export declare type BorderConstants = "none" | "all" | "outside" | "top" | "bottom" | "left" | "right";
1363
+
1364
+ /**
1365
+ * options for the SetRange method
1366
+ */
1367
+ export interface SetRangeOptions {
1368
+
1369
+ /** transpose rectangular array before inserting */
1370
+ transpose?: boolean;
1371
+
1372
+ /** recycle values (R-style) */
1373
+ recycle?: boolean;
1374
+
1375
+ /** apply as an array (as if you pressed ctrl+shift+enter) */
1376
+ array?: boolean;
1377
+
1378
+ /** spill over */
1379
+ spill?: boolean;
1380
+
1381
+ /**
1382
+ * argument separator to use when parsing the input formula. set this
1383
+ * option to call SetRange with a consistent argument separator,
1384
+ * independent of current locale.
1385
+ */
1386
+ argument_separator?: ',' | ';';
1387
+
1388
+ /**
1389
+ * allow R1C1-style references; these can be either absolute
1390
+ * addresses (e.g. R2C4) or relative to the cell (e.g. R[-3]C[0]).
1391
+ */
1392
+ r1c1?: boolean;
1393
+ }
1394
+ export interface ExternalEditorConfig {
1395
+
1396
+ /**
1397
+ * list of dependencies to highlight. we support undefined entries in
1398
+ * this list so you can use the result of `EmbeddedSpreadsheet.Resolve`,
1399
+ * which may return undefined.
1400
+ */
1401
+ dependencies: DependencyList;
1402
+
1403
+ /**
1404
+ * this callback will be called when the selection changes in the
1405
+ * spreadsheet and this external editor is active. return an updated
1406
+ * list of dependencies to highlight.
1407
+ *
1408
+ * NOTE: this is currently synchronous, but don't rely on that. it
1409
+ * might switch to async in the future depending on how it works in
1410
+ * practice.
1411
+ */
1412
+ update: ExternalEditorCallback;
1413
+
1414
+ /**
1415
+ * a list of nodes that will serve as editors. when you attach, we will do
1416
+ * an initial pass of context highlighting. we highlight on text changes
1417
+ * and insert references if you make a selection in the spreadsheet while
1418
+ * an editor is focused.
1419
+ */
1420
+ nodes: HTMLElement[];
1421
+
1422
+ /**
1423
+ * assume that we're editing a formula. does not require leading `=`.
1424
+ * defaults to `true` for historical reasons.
1425
+ */
1426
+ assume_formula?: boolean;
1427
+ }
1428
+ export type DependencyList = Array<IArea | ICellAddress | undefined>;
1429
+ export type ExternalEditorCallback = (selection?: string) => DependencyList | undefined;
1411
1430
 
1412
1431
  /**
1413
1432
  * this is the document type used by TREB. it has a lot of small variations
@@ -1436,7 +1455,7 @@ export interface TREBDocument {
1436
1455
  * opaque user data. we don't read or parse this, but applications can
1437
1456
  * use it to store arbitrary data.
1438
1457
  */
1439
- user_data?: any;
1458
+ user_data?: unknown;
1440
1459
 
1441
1460
  /**
1442
1461
  * per-sheet data. this should be an array, but for historical reasons
@@ -1456,12 +1475,17 @@ export interface TREBDocument {
1456
1475
  */
1457
1476
  rendered_values?: boolean;
1458
1477
 
1459
- /** document named ranges */
1478
+ /** document named ranges @deprecated */
1460
1479
  named_ranges?: Record<string, IArea>;
1461
1480
 
1462
- /** document named expressions */
1481
+ /** document named expressions @deprecated */
1463
1482
  named_expressions?: SerializedNamedExpression[];
1464
1483
 
1484
+ /**
1485
+ * new consolidated named ranges & expressions
1486
+ */
1487
+ named?: SerializedNamed[];
1488
+
1465
1489
  /** document macro functions */
1466
1490
  macro_functions?: SerializedMacroFunction[];
1467
1491
 
@@ -1566,10 +1590,31 @@ export interface SelectionEvent {
1566
1590
  export interface FocusViewEvent {
1567
1591
  type: 'focus-view';
1568
1592
  }
1593
+ export interface SerializedMacroFunction {
1594
+ name: string;
1595
+ function_def: string;
1596
+ argument_names?: string[];
1597
+ description?: string;
1598
+ }
1569
1599
  export interface SerializedNamedExpression {
1570
1600
  name: string;
1571
1601
  expression: string;
1572
1602
  }
1603
+
1604
+ /**
1605
+ * serialized type
1606
+ */
1607
+ export interface SerializedNamed {
1608
+ name: string;
1609
+ area?: SerializedArea;
1610
+ expression?: string;
1611
+ scope?: string;
1612
+ }
1613
+ export type SerializedArea = IArea & {
1614
+ start: ICellAddress & {
1615
+ sheet: string;
1616
+ };
1617
+ };
1573
1618
  export interface SerializedSheet {
1574
1619
 
1575
1620
  /** cell data */
@@ -1937,12 +1982,6 @@ export interface Corner {
1937
1982
  address: ICellAddress;
1938
1983
  offset: AddressOffset;
1939
1984
  }
1940
- export interface SerializedMacroFunction {
1941
- name: string;
1942
- function_def: string;
1943
- argument_names?: string[];
1944
- description?: string;
1945
- }
1946
1985
 
1947
1986
  /**
1948
1987
  * options for exporting CSV/TSV
@@ -0,0 +1,21 @@
1
+ // @ts-check
2
+
3
+ import eslint from '@eslint/js';
4
+ import tseslint from 'typescript-eslint';
5
+
6
+ export default tseslint.config(
7
+ eslint.configs.recommended,
8
+ ...tseslint.configs.recommended,
9
+ {
10
+ rules: {
11
+
12
+ // allow destructuring to use garbage variables. prefix name with
13
+ // underscore (or just use underscore).
14
+
15
+ "@typescript-eslint/no-unused-vars": [
16
+ "error", {
17
+ "destructuredArrayIgnorePattern": "^_",
18
+ }],
19
+ },
20
+ },
21
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trebco/treb",
3
- "version": "28.17.5",
3
+ "version": "29.1.4",
4
4
  "license": "LGPL-3.0-or-later",
5
5
  "homepage": "https://treb.app",
6
6
  "repository": {
@@ -14,19 +14,18 @@
14
14
  "@types/html-minifier": "^4.0.2",
15
15
  "@types/node": "^20.8.5",
16
16
  "@types/uzip": "^0.20201231.0",
17
- "@typescript-eslint/eslint-plugin": "^6.1.0",
18
- "@typescript-eslint/parser": "^6.1.0",
19
17
  "archiver": "^6.0.1",
20
18
  "base64-js": "^1.5.1",
21
19
  "cssnano": "^6.0.0",
22
- "esbuild": "^0.19.2",
23
- "eslint": "^8.19.0",
20
+ "esbuild": "^0.20.1",
21
+ "eslint": "^8.56.0",
24
22
  "fast-xml-parser": "^4.0.7",
25
23
  "html-minifier": "^4.0.0",
26
24
  "sass": "^1.69.3",
27
25
  "treb-base-types": "file:treb-base-types",
28
26
  "treb-calculator": "file:treb-calculator",
29
27
  "treb-charts": "file:treb-charts",
28
+ "treb-data-model": "file:treb-data-model",
30
29
  "treb-export": "file:treb-export",
31
30
  "treb-format": "file:treb-format",
32
31
  "treb-grid": "file:treb-grid",
@@ -34,7 +33,8 @@
34
33
  "treb-utils": "file:treb-utils",
35
34
  "ts-node-dev": "^2.0.0",
36
35
  "tslib": "^2.2.0",
37
- "typescript": "^5.0.2",
36
+ "typescript": "^5.3.3",
37
+ "typescript-eslint": "^7.0.2",
38
38
  "uzip": "^0.20201231.0"
39
39
  },
40
40
  "scripts": {
@@ -55,6 +55,8 @@ export interface IArea {
55
55
  end: ICellAddress;
56
56
  }
57
57
 
58
+ export type SerializedArea = IArea & { start: ICellAddress & { sheet: string }};
59
+
58
60
  export interface PatchOptions {
59
61
  before_column: number;
60
62
  column_count: number;
@@ -712,7 +714,7 @@ export class Area implements IArea {
712
714
  },
713
715
  };
714
716
 
715
- };
717
+ }
716
718
 
717
719
  /* * @deprecated * /
718
720
  public Iterate(f: (...args: any[]) => any): void {
@@ -809,7 +811,7 @@ export class Area implements IArea {
809
811
  * the start.
810
812
  *
811
813
  */
812
- public toJSON(): any {
814
+ public toJSON(): IArea {
813
815
 
814
816
  return {
815
817
  start: { ...this.start_ },
@@ -22,7 +22,7 @@
22
22
  // import { Parser } from 'treb-parser';
23
23
 
24
24
  import type { Area, IArea } from './area';
25
- import type { Style, CellStyle } from './style';
25
+ import type { CellStyle } from './style';
26
26
  import type { TextPart } from './text_part';
27
27
  import type { Complex } from './value-type';
28
28
  import { ValueType, GetValueType } from './value-type';
@@ -31,7 +31,7 @@ import { Cell } from './cell';
31
31
  import type { Table } from './table';
32
32
  import { type SerializedValueType, ValueType, GetValueType, ValueTypeList } from './value-type';
33
33
  import type { CellValue, UnionValue } from './union';
34
- import type { Style, CellStyle } from './style';
34
+ import type { CellStyle } from './style';
35
35
 
36
36
  export interface CellSerializationOptions {
37
37
  preserve_type?: boolean;
@@ -170,10 +170,8 @@ export class Cells {
170
170
  /** switching to row-major */
171
171
  public data: Cell[][] = [];
172
172
 
173
- // tslint:disable-next-line:variable-name
174
173
  private rows_ = 0;
175
174
 
176
- // tslint:disable-next-line:variable-name
177
175
  private columns_ = 0;
178
176
 
179
177
  get rows(): number { return this.rows_; }
@@ -206,7 +204,7 @@ export class Cells {
206
204
  */
207
205
  public InsertColumns(before = 0, count = 1): void {
208
206
 
209
- const pre = JSON.parse(JSON.stringify(this.data[13]));
207
+ // const pre = JSON.parse(JSON.stringify(this.data[13]));
210
208
 
211
209
  // NOTE: iterating a sparse array, in chrome at least, only
212
210
  // hits populated keys. the returned array has the same
@@ -404,6 +402,8 @@ export class Cells {
404
402
  return type ? ValueTypeList[type] : undefined;
405
403
  }
406
404
 
405
+
406
+
407
407
  /**
408
408
  * this method is used for importing legacy data validation types. in those
409
409
  * those we used a numeric enum. we're just dropping that altogether (c.f.
@@ -422,9 +422,12 @@ export class Cells {
422
422
  */
423
423
  public ImportDataValidation(value: DataValidation): DataValidation|undefined {
424
424
 
425
- if (typeof (value as any).type === 'number') {
426
- const types = ['list', 'date', 'range', 'number', 'boolean'];
427
- (value as any).type = types[(value as any).type];
425
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
426
+ const type: DataValidation['type']|number = (value as any).type;
427
+
428
+ if (typeof type === 'number') {
429
+ const types: Array<DataValidation['type']> = ['list', 'date', 'range', 'number', 'boolean'];
430
+ value.type = types[type];
428
431
  if (!value.type) {
429
432
  return undefined;
430
433
  }
@@ -755,6 +758,11 @@ export class Cells {
755
758
  const new_data: NestedRowData[] = [];
756
759
 
757
760
  for (const element of data) {
761
+
762
+ // the construction here seems to be removing the
763
+ // "row" key -- is there a better way to do that?
764
+
765
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
758
766
  const {row, ...remainder} = element;
759
767
  if (!cells[element.row]) cells[element.row] = [];
760
768
  cells[element.row].push(remainder);
@@ -774,6 +782,7 @@ export class Cells {
774
782
  const new_data: NestedColumnData[] = [];
775
783
 
776
784
  for (const element of data) {
785
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
777
786
  const {column, ...remainder} = element;
778
787
  if (!cells[element.column]) cells[element.column] = [];
779
788
  cells[element.column].push(remainder);
@@ -22,7 +22,7 @@
22
22
  const SVGNS = 'http://www.w3.org/2000/svg';
23
23
 
24
24
  type EventHandlerMap = {
25
- [key in keyof HTMLElementEventMap]: (event: HTMLElementEventMap[key]) => any;
25
+ [key in keyof HTMLElementEventMap]: (event: HTMLElementEventMap[key]) => unknown;
26
26
  }
27
27
 
28
28
  type StyleMap = {
@@ -202,12 +202,14 @@ export class DOMContext {
202
202
 
203
203
  if (options.events) {
204
204
  for (const [key, value] of Object.entries(options.events)) {
205
- element.addEventListener(key, value as any); // typing works well up until this point
205
+ element.addEventListener(key, value as (event: unknown) => void); // typing works well up until this point
206
206
  }
207
207
  }
208
208
 
209
209
  if (options.style) {
210
210
  for (const [key, value] of Object.entries(options.style)) {
211
+
212
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
211
213
  (element.style as any)[key] = value; // more sloppy typing
212
214
  }
213
215
  }
@@ -20,12 +20,12 @@
20
20
  */
21
21
 
22
22
  import type { CellStyle } from './style';
23
- import type { SerializedValueType, ValueType } from './value-type';
23
+ import type { SerializedValueType } from './value-type';
24
24
  import type { IArea } from './area';
25
25
  import type { AnnotationLayout } from './layout';
26
26
  import type { DataValidation } from './cell';
27
27
  import type { Table } from './table';
28
- import type { AnnotationType, ConditionalFormat } from 'treb-grid';
28
+ import type { AnnotationType, ConditionalFormat } from 'treb-data-model';
29
29
 
30
30
  export interface CellParseResult {
31
31
  row: number,
@@ -45,11 +45,11 @@ export class Rectangle implements IRectangle {
45
45
  }
46
46
 
47
47
  public static IsRectangle(obj: unknown): obj is IRectangle {
48
- return (typeof obj === 'object') &&
49
- (typeof (obj as any)?.left === 'number') &&
50
- (typeof (obj as any)?.top === 'number') &&
51
- (typeof (obj as any)?.width === 'number') &&
52
- (typeof (obj as any)?.height === 'number');
48
+ return (!!obj && typeof obj === 'object') &&
49
+ (typeof (obj as Record<string, unknown>).left === 'number') &&
50
+ (typeof (obj as Record<string, unknown>).top === 'number') &&
51
+ (typeof (obj as Record<string, unknown>).width === 'number') &&
52
+ (typeof (obj as Record<string, unknown>).height === 'number');
53
53
  }
54
54
 
55
55
  constructor( public left = 0,
@@ -46,6 +46,13 @@ export enum TextPartFlag {
46
46
  italic = 7,
47
47
  */
48
48
 
49
+ /**
50
+ * this is an indent component. we want to keep track of this
51
+ * so we don't add it more than once if we're indenting dynamically.
52
+ * maybe this is not the way to indent.
53
+ */
54
+ indent = 8,
55
+
49
56
  }
50
57
 
51
58
  export interface TextPart {
@@ -76,7 +76,12 @@ export interface UndefinedUnion {
76
76
 
77
77
  export interface ExtendedUnion {
78
78
  type: ValueType.object;
79
- value: any;
79
+
80
+ // this needs to come out but it's costly; we apparently relied
81
+ // pretty heavily on this any leaking in and allowing lots of
82
+ // sloppy comparisons. work in progress.
83
+
84
+ value: unknown; // any;
80
85
  key?: string;
81
86
  }
82
87
 
@@ -139,7 +139,6 @@ export type SerializedValueType = // typeof ValueTypeList[number];
139
139
  * properly. I can't arrive at a good way of doing that automatically.
140
140
  *
141
141
  * old comments:
142
- * ---
143
142
  *
144
143
  * undefined is 0 so we can test it as falsy.
145
144
  *
@@ -157,6 +156,7 @@ export enum ValueType {
157
156
  boolean = 4,
158
157
 
159
158
  // we don't actually use this type, it's here for matching only
159
+ // OK we use it all the time now
160
160
  object = 5,
161
161
 
162
162
  // error is a STRING VALUE... object errors are layered on top? is that