@trebco/treb 32.9.3 → 32.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.
package/dist/treb.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /*! API v32.9. Copyright 2018-2025 trebco, llc. All rights reserved. LGPL: https://treb.app/license */
1
+ /*! API v32.10. Copyright 2018-2025 trebco, llc. All rights reserved. LGPL: https://treb.app/license */
2
2
  /*
3
3
  * This file is part of TREB.
4
4
  *
package/package.json CHANGED
@@ -1,53 +1,53 @@
1
- {
2
- "name": "@trebco/treb",
3
- "version": "32.9.3",
4
- "license": "LGPL-3.0-or-later",
5
- "homepage": "https://treb.app",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/trebco/treb.git"
9
- },
10
- "main": "dist/treb-spreadsheet.mjs",
11
- "types": "dist/treb.d.ts",
12
- "type": "module",
13
- "devDependencies": {
14
- "@types/html-minifier": "^4.0.2",
15
- "@types/node": "^22.5.2",
16
- "@types/uzip": "^0.20201231.0",
17
- "base64-js": "^1.5.1",
18
- "cssnano": "^7.0.4",
19
- "esbuild": "^0.25.0",
20
- "eslint": "^9.9.1",
21
- "fast-xml-parser": "^4.0.7",
22
- "html-minifier-terser": "^7.2.0",
23
- "sass": "^1.69.3",
24
- "treb-base-types": "file:treb-base-types",
25
- "treb-calculator": "file:treb-calculator",
26
- "treb-charts": "file:treb-charts",
27
- "treb-data-model": "file:treb-data-model",
28
- "treb-export": "file:treb-export",
29
- "treb-format": "file:treb-format",
30
- "treb-grid": "file:treb-grid",
31
- "treb-parser": "file:treb-parser",
32
- "treb-utils": "file:treb-utils",
33
- "ts-node": "^10.9.2",
34
- "tslib": "^2.7.0",
35
- "tsx": "^4.19.1",
36
- "typescript": "^5.3.3",
37
- "typescript-eslint": "^8.3.0",
38
- "uzip": "^0.20201231.0"
39
- },
40
- "scripts": {
41
- "build": "node esbuild-composite.mjs",
42
- "dev": "node esbuild-composite.mjs --dev",
43
- "clean": "rm -fr build dist declaration",
44
- "watch": "node --watch esbuild-composite.mjs --watch --dev",
45
- "watch-production": "node --watch esbuild-composite.mjs --watch",
46
- "tsc": "tsc -b treb-embed/tsconfig.json",
47
- "rebuild-tsc": "tsc -b --force treb-embed/tsconfig.json",
48
- "watch-tsc": "tsc -b treb-embed/tsconfig.json -w",
49
- "watch-api": "tsx --watch api-generator/api-generator.ts --config api-config.json",
50
- "generate-api": "tsx api-generator/api-generator.ts --config api-config.json",
51
- "release": "npm run rebuild-tsc && npm run build && npm run generate-api"
52
- }
53
- }
1
+ {
2
+ "name": "@trebco/treb",
3
+ "version": "32.10.0",
4
+ "license": "LGPL-3.0-or-later",
5
+ "homepage": "https://treb.app",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/trebco/treb.git"
9
+ },
10
+ "main": "dist/treb-spreadsheet.mjs",
11
+ "types": "dist/treb.d.ts",
12
+ "type": "module",
13
+ "devDependencies": {
14
+ "@types/html-minifier": "^4.0.5",
15
+ "@types/node": "^24.3.1",
16
+ "@types/uzip": "^0.20201231.2",
17
+ "base64-js": "^1.5.1",
18
+ "cssnano": "^7.1.1",
19
+ "esbuild": "^0.25.9",
20
+ "eslint": "^9.35.0",
21
+ "fast-xml-parser": "^5.2.5",
22
+ "html-minifier-terser": "^7.2.0",
23
+ "sass": "^1.92.1",
24
+ "treb-base-types": "file:treb-base-types",
25
+ "treb-calculator": "file:treb-calculator",
26
+ "treb-charts": "file:treb-charts",
27
+ "treb-data-model": "file:treb-data-model",
28
+ "treb-export": "file:treb-export",
29
+ "treb-format": "file:treb-format",
30
+ "treb-grid": "file:treb-grid",
31
+ "treb-parser": "file:treb-parser",
32
+ "treb-utils": "file:treb-utils",
33
+ "ts-node": "^10.9.2",
34
+ "tslib": "^2.8.1",
35
+ "tsx": "^4.20.5",
36
+ "typescript": "^5.9.2",
37
+ "typescript-eslint": "^8.43.0",
38
+ "uzip": "^0.20201231.0"
39
+ },
40
+ "scripts": {
41
+ "build": "node esbuild-composite.mjs",
42
+ "dev": "node esbuild-composite.mjs --dev",
43
+ "clean": "rm -fr build dist declaration",
44
+ "watch": "node --watch esbuild-composite.mjs --watch --dev",
45
+ "watch-production": "node --watch esbuild-composite.mjs --watch",
46
+ "tsc": "tsc -b treb-embed/tsconfig.json",
47
+ "rebuild-tsc": "tsc -b --force treb-embed/tsconfig.json",
48
+ "watch-tsc": "tsc -b treb-embed/tsconfig.json -w",
49
+ "watch-api": "tsx --watch api-generator/api-generator.ts --config api-config.json",
50
+ "generate-api": "tsx api-generator/api-generator.ts --config api-config.json",
51
+ "release": "npm run rebuild-tsc && npm run build && npm run generate-api"
52
+ }
53
+ }
@@ -87,6 +87,7 @@ export interface ReferenceMetadata {
87
87
  }
88
88
 
89
89
  export type BindingFrame = Record<string, ExpressionUnit>; // FIXME (type?)
90
+
90
91
  export type PositionalFrame = ExpressionUnit[];
91
92
 
92
93
  export interface CalculationContext {
@@ -464,8 +465,6 @@ export class ExpressionCalculator {
464
465
  return ExpressionError();
465
466
  }
466
467
 
467
- // let frame = value.bindings(expr.args);
468
-
469
468
  const frame: BindingFrame = {};
470
469
 
471
470
  for (let i = 0; i < value.bindings.length; i++) {
@@ -479,8 +478,6 @@ export class ExpressionCalculator {
479
478
  }
480
479
  }
481
480
 
482
- // frame = this.NormalizeBindings(frame); // inline
483
-
484
481
  const munged = JSON.parse(JSON.stringify(value.func));
485
482
 
486
483
  this.parser.Walk2(munged, (unit: ExpressionUnit) => {
@@ -493,11 +490,6 @@ export class ExpressionCalculator {
493
490
  }
494
491
  return true;
495
492
  });
496
-
497
- // console.info({frame, func, munged});
498
-
499
- // const exec_result = this.CalculateExpression(munged as ExtendedExpressionUnit);
500
- // return exec_result || ExpressionError();
501
493
 
502
494
  return this.CalculateExpression(munged as ExtendedExpressionUnit);
503
495
 
@@ -582,6 +574,7 @@ export class ExpressionCalculator {
582
574
  * the parsing stage, it's a simple translation between the two
583
575
  */
584
576
  protected ImplicitCall(): (expr: UnitImplicitCall|UnitCall) => UnionValue {
577
+
585
578
  return (expr: UnitImplicitCall|UnitCall) => {
586
579
 
587
580
  if (expr.type === 'call') {
@@ -634,6 +627,7 @@ export class ExpressionCalculator {
634
627
  const upper_case = outer.name.toUpperCase();
635
628
 
636
629
  const binding = this.LookupBinding(upper_case);
630
+
637
631
  if (binding) {
638
632
  return this.ImplicitCall();
639
633
  }
@@ -636,8 +636,13 @@ export class Parser {
636
636
  // function. in that case we don't want a space in front of the
637
637
  // operator.
638
638
 
639
+ // UPDATE: for aesthetic reasons, also remove spaces around a
640
+ // power operator (caret, "^")
641
+
642
+ // FIXME: parameterize?
643
+
639
644
  {
640
- const separator = (unit.operator === ':' ? '': ' ');
645
+ const separator = ((unit.operator === ':' || unit.operator === '^') ? '': ' ');
641
646
 
642
647
  return (
643
648
  this.Render(unit.left, options) +