@trebco/treb 30.2.10 → 30.2.14

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
@@ -1310,7 +1310,7 @@ export type Color = ThemeColor | HTMLColor | NullColor;
1310
1310
  export declare const ThemeColorIndex: (color: ThemeColor) => number;
1311
1311
  export declare const IsHTMLColor: (color?: Color) => color is HTMLColor;
1312
1312
  export declare const IsThemeColor: (color?: Color) => color is ThemeColor;
1313
- export declare const IsDefinedColor: (color?: Color) => color is ThemeColor | HTMLColor;
1313
+ export declare const IsDefinedColor: (color?: Color) => color is (ThemeColor | HTMLColor);
1314
1314
  export type CellValue = undefined | string | number | boolean | Complex | DimensionedQuantity;
1315
1315
 
1316
1316
  /**
@@ -1,5 +1,7 @@
1
1
  // @ts-check
2
2
 
3
+ /* global process */
4
+
3
5
  import * as esbuild from 'esbuild';
4
6
 
5
7
  import { SassPlugin, WorkerPlugin, NotifyPlugin, HTMLPlugin } from './esbuild-utils.mjs';
package/esbuild-utils.mjs CHANGED
@@ -1,6 +1,8 @@
1
1
 
2
2
  // @ts-check
3
3
 
4
+ /* global console */
5
+
4
6
  import * as esbuild from 'esbuild';
5
7
  import { promises as fs } from 'fs';
6
8
  import { minify } from 'html-minifier';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trebco/treb",
3
- "version": "30.2.10",
3
+ "version": "30.2.14",
4
4
  "license": "LGPL-3.0-or-later",
5
5
  "homepage": "https://treb.app",
6
6
  "repository": {
@@ -12,13 +12,12 @@
12
12
  "type": "module",
13
13
  "devDependencies": {
14
14
  "@types/html-minifier": "^4.0.2",
15
- "@types/node": "^20.8.5",
15
+ "@types/node": "^22.1.0",
16
16
  "@types/uzip": "^0.20201231.0",
17
- "archiver": "^6.0.1",
18
17
  "base64-js": "^1.5.1",
19
- "cssnano": "^6.0.0",
20
- "esbuild": "^0.20.1",
21
- "eslint": "^8.56.0",
18
+ "cssnano": "^7.0.4",
19
+ "esbuild": "^0.23.0",
20
+ "eslint": "^9.8.0",
22
21
  "fast-xml-parser": "^4.0.7",
23
22
  "html-minifier": "^4.0.0",
24
23
  "sass": "^1.69.3",
@@ -34,7 +33,7 @@
34
33
  "ts-node-dev": "^2.0.0",
35
34
  "tslib": "^2.2.0",
36
35
  "typescript": "^5.3.3",
37
- "typescript-eslint": "^7.0.2",
36
+ "typescript-eslint": "^8.0.0",
38
37
  "uzip": "^0.20201231.0"
39
38
  },
40
39
  "scripts": {
@@ -782,7 +782,36 @@ export class ExpressionCalculator {
782
782
  // unless the expression changes, which will discard the generated
783
783
  // function (along with the expression itself).
784
784
 
785
- const fn = Primitives.MapOperator(x.operator);
785
+ // pulling out concat so we can bind the model for language values
786
+
787
+ const fn = x.operator === '&' ? (a: UnionValue, b: UnionValue): UnionValue => {
788
+
789
+ // this works, but it's not volatile so it doesn't update on
790
+ // a language change; maybe language change should force a recalc? (...)
791
+
792
+ if (a.type === ValueType.error) { return a; }
793
+ if (b.type === ValueType.error) { return b; }
794
+
795
+ const strings = [a, b].map(x => {
796
+ if (x.type === ValueType.undefined) { return ''; }
797
+ if (x.type === ValueType.boolean) {
798
+ if (x.value) {
799
+ return this.data_model.language_model?.boolean_true || 'TRUE';
800
+ }
801
+ else {
802
+ return this.data_model.language_model?.boolean_false || 'FALSE';
803
+ }
804
+ }
805
+ return x.value;
806
+ });
807
+
808
+ return {
809
+ type: ValueType.string,
810
+ value: `${strings[0]}${strings[1]}`,
811
+ };
812
+
813
+
814
+ } : Primitives.MapOperator(x.operator);
786
815
 
787
816
  if (!fn) {
788
817
 
@@ -301,7 +301,7 @@ export const TextFunctionLibrary: FunctionMap = {
301
301
  },
302
302
  },
303
303
 
304
- /** canonical should be CONCAT; concatenate can be an alias */
304
+ /** canonical should be CONCAT; concatenate can be an alias */
305
305
  Concat: {
306
306
  description: 'Pastes strings together',
307
307
  fn: (...args: CellValue[]): UnionValue => {
@@ -266,6 +266,7 @@ export const Modulo = (a: UnionValue, b: UnionValue): UnionValue => {
266
266
  return { value: x % y, type: ValueType.number };
267
267
  };
268
268
 
269
+ /*
269
270
  export const Concatenate = (a: UnionValue, b: UnionValue): UnionValue => {
270
271
  if (a.type === ValueType.error) { return a; }
271
272
  if (b.type === ValueType.error) { return b; }
@@ -276,6 +277,7 @@ export const Concatenate = (a: UnionValue, b: UnionValue): UnionValue => {
276
277
  };
277
278
 
278
279
  };
280
+ */
279
281
 
280
282
  export const Equals = (a: UnionValue, b: UnionValue): UnionValue => {
281
283
  if (a.type === ValueType.error) { return a; }
@@ -430,7 +432,7 @@ export const UseComplex = () => {
430
432
 
431
433
  export const MapOperator = (operator: string) => {
432
434
  switch(operator) {
433
- case '&': return Concatenate;
435
+ // case '&': return Concatenate;
434
436
  case '+': return Add;
435
437
  case '-': return Subtract;
436
438
  case '*': return Multiply;
@@ -803,7 +803,7 @@ export class EmbeddedSpreadsheet<USER_DATA_TYPE = unknown> {
803
803
  const obj = JSON.parse(json);
804
804
  grid_options.initial_scale = obj.scale || 1;
805
805
  }
806
- catch (e) {
806
+ catch {
807
807
  console.warn('parsing persisted scale failed');
808
808
  }
809
809
  }
@@ -2006,10 +2006,17 @@ export class EmbeddedSpreadsheet<USER_DATA_TYPE = unknown> {
2006
2006
  }
2007
2007
 
2008
2008
  language = language.toLowerCase();
2009
-
2010
2009
  let mod: { LanguageMap: LanguageModel } | undefined;
2011
2010
 
2012
- if (language && language !== 'en') {
2011
+ // FIXME: this should be generated and included, to allow for changes.
2012
+ // for the time being hardcoding as a quick fix
2013
+
2014
+ const supported_languages = [
2015
+ 'es', 'fr', 'pt', 'nl', 'de',
2016
+ 'pl', 'sv', 'no', 'da', 'it',
2017
+ ];
2018
+
2019
+ if (language && supported_languages.includes(language)) {
2013
2020
 
2014
2021
  // FIXME: even though we now have a dynamic import
2015
2022
  // working, we still probably want to use a filter
@@ -33,7 +33,6 @@
33
33
 
34
34
 
35
35
  box-sizing: border-box;
36
- * { box-sizing: border-box; }
37
36
 
38
37
  position: fixed;
39
38
  top: -1000px;
@@ -46,6 +45,8 @@
46
45
  overflow-y: auto;
47
46
  z-index: $z-index-autocomplete;
48
47
 
48
+ * { box-sizing: border-box; }
49
+
49
50
  ul {
50
51
 
51
52
  font-size: inherit;
@@ -73,23 +74,6 @@
73
74
  }
74
75
  }
75
76
 
76
- /*
77
- here we unwind the selected style if there's a hover,
78
- unless you're hovering over the selection. and so on.
79
- * /
80
-
81
- &:hover li a.selected {
82
- background: inherit;
83
- color: inherit;
84
-
85
- &:hover {
86
- background: #339966;
87
- color: #fff;
88
- }
89
-
90
- }
91
- */
92
-
93
77
  }
94
78
  }
95
79
 
@@ -98,6 +98,7 @@
98
98
  padding: 0;
99
99
  background: transparent;
100
100
  border: 0;
101
+ padding: 4px;
101
102
 
102
103
  &>svg {
103
104
 
@@ -112,7 +113,6 @@
112
113
  }
113
114
  }
114
115
 
115
- padding: 4px;
116
116
 
117
117
  }
118
118
 
@@ -56,6 +56,11 @@
56
56
  color: var(--treb-dropdown-color, inherit);
57
57
  border: 1px solid var(--treb-dropdown-border-color, unset);
58
58
 
59
+ text-align: left;
60
+ max-height: 10em;
61
+ overflow-y: auto;
62
+ outline: none;
63
+
59
64
  & div {
60
65
  padding: 2px;
61
66
  cursor: default;
@@ -66,12 +71,6 @@
66
71
  color: var(--treb-dropdown-selected-color, #fff);
67
72
  }
68
73
 
69
- text-align: left;
70
-
71
- max-height: 10em;
72
- overflow-y: auto;
73
- outline: none;
74
-
75
74
  }
76
75
 
77
76
  .treb-dropdown-caret.active {
@@ -30,15 +30,17 @@
30
30
  text-align: left;
31
31
  gap: .5em;
32
32
 
33
- &[hidden] {
34
- display: none;
35
- }
33
+
36
34
 
37
35
  padding: 0px 2px 12px 2px; // FIXME: use ems?
38
36
 
39
37
  max-width: 100%;
40
38
  overflow-x: hidden;
41
39
 
40
+ &[hidden] {
41
+ display: none;
42
+ }
43
+
42
44
  /** label for selection address */
43
45
  .treb-address-label {
44
46
 
@@ -207,23 +207,25 @@
207
207
  /** specific layout for column header cover */
208
208
  &.column-header-cover {
209
209
 
210
+ z-index: $z-index-header-tile-cover;
211
+
210
212
  /** style is attached when mousing over a column boundary */
211
213
  &.resize {
212
214
  cursor: col-resize;
213
215
  }
214
216
 
215
- z-index: $z-index-header-tile-cover;
216
217
  }
217
218
 
218
219
  /** specific layout for row header cover */
219
220
  &.row-header-cover {
220
221
 
222
+ z-index: $z-index-header-tile-cover;
223
+
221
224
  /** style is attached when mousing over a row boundary */
222
225
  &.resize {
223
226
  cursor: row-resize;
224
227
  }
225
228
 
226
- z-index: $z-index-header-tile-cover;
227
229
  }
228
230
 
229
231
  }
@@ -234,6 +236,9 @@
234
236
  top: 0px;
235
237
  left: 0px;
236
238
 
239
+ z-index: $z-index-annotations;
240
+ pointer-events: none;
241
+
237
242
  .annotation {
238
243
  position: absolute;
239
244
  overflow: hidden;
@@ -297,8 +302,6 @@
297
302
  cursor: move;
298
303
  }
299
304
 
300
- z-index: $z-index-annotations;
301
- pointer-events: none;
302
305
  }
303
306
 
304
307
  /** selection stacks over the grid but under the cover */
@@ -68,6 +68,28 @@
68
68
 
69
69
  line-height: normal;
70
70
 
71
+ // ---------------------------------------------------------------------------
72
+
73
+ color-scheme: var(--treb-color-scheme, unset);
74
+
75
+ font-family: $font-stack;
76
+
77
+ font-style: normal;
78
+ font-weight: normal;
79
+ color: inherit;
80
+ font-size: 14px; // ?
81
+
82
+ height: 100%;
83
+ width: 100%;
84
+
85
+ position: relative;
86
+ display: grid;
87
+ grid-template-rows: auto minmax(0, 1fr);
88
+ grid-template-columns: minmax(0, 1fr) auto;
89
+ // gap: 1em;
90
+
91
+ // ---------------------------------------------------------------------------
92
+
71
93
  div, button, input, ul, ol, li, a, textarea, svg {
72
94
 
73
95
  // maybe this is being too aggressive. we could be a little
@@ -110,23 +132,6 @@
110
132
 
111
133
  // ---------------------------------------------------------------------------
112
134
 
113
- color-scheme: var(--treb-color-scheme, unset);
114
-
115
- font-family: $font-stack;
116
-
117
- font-style: normal;
118
- font-weight: normal;
119
- color: inherit;
120
- font-size: 14px; // ?
121
-
122
- height: 100%;
123
- width: 100%;
124
-
125
- position: relative;
126
- display: grid;
127
- grid-template-rows: auto minmax(0, 1fr);
128
- grid-template-columns: minmax(0, 1fr) auto;
129
- // gap: 1em;
130
135
 
131
136
  &[animate] {
132
137
  .treb-layout-header {
@@ -354,11 +359,11 @@
354
359
  right: 0px;
355
360
  border-top-right-radius: 0px;
356
361
  border-bottom-right-radius: 0px;
362
+ background: var(--treb-toolbar-button-background, #fff);
357
363
  &::after {
358
364
  mask-image: var(--icon-chevron-left);
359
365
  -webkit-mask-image: var(--icon-chevron-left);
360
366
  }
361
- background: var(--treb-toolbar-button-background, #fff);
362
367
 
363
368
  }
364
369
  }
@@ -29,6 +29,8 @@
29
29
 
30
30
  grid-area: 3/1/4/2;
31
31
 
32
+ align-items: center;
33
+
32
34
  .treb-spreadsheet-tab-container {
33
35
  align-self: flex-start;
34
36
  overflow: hidden;
@@ -59,8 +61,6 @@
59
61
  display: none;
60
62
  }
61
63
 
62
- align-items: center;
63
-
64
64
  & .treb-spreadsheet-tabs>li {
65
65
  display: inline-block;
66
66
  position: relative;
@@ -234,6 +234,10 @@ $text-reference-color-5: rgb(254, 47, 1);
234
234
  color: var(--treb-autocomplete-tooltip-color, inherit);
235
235
  border: 1px solid var(--treb-autocomplete-tooltip-border-color, unset);
236
236
 
237
+ padding: 3px 8px;
238
+ margin: 4px 0px;
239
+ line-height: normal;
240
+
237
241
  & .active-argument {
238
242
  font-weight: 700;
239
243
  }
@@ -242,10 +246,6 @@ $text-reference-color-5: rgb(254, 47, 1);
242
246
  font-style: italic;
243
247
  }
244
248
 
245
- padding: 3px 8px;
246
- margin: 4px 0px;
247
- line-height: normal;
248
-
249
249
  }
250
250
 
251
251
  /**
@@ -167,10 +167,10 @@ $swatch-size: 18px;
167
167
  gap: 0;
168
168
 
169
169
  button[data-command] {
170
+ font-size: $split-font-size;
170
171
  &::before {
171
172
  display: none;
172
173
  }
173
- font-size: $split-font-size;
174
174
  }
175
175
 
176
176
  & > button {