@trebco/treb 30.2.14 → 30.6.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.
@@ -0,0 +1,44 @@
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
+ // this is a new entrypoint for the worker, as a module. while we can't
23
+ // just create a worker script, if we create this as a module and embed
24
+ // the worker script we can still get the benefits of dynamic loading.
25
+
26
+ // why can't we create a worker script? it's OK for direct embedding but
27
+ // breaks when embedding in a bundler (vite is OK, but webpack is not).
28
+ // but all bundlers seem ok with local modules (knock on wood).
29
+
30
+ /**
31
+ * import the worker as text so it will be embedded in this module
32
+ */
33
+ import * as export_worker_script from 'worker:../../treb-export/src/index.worker';
34
+
35
+ /**
36
+ * create the worker by loading the embedded text
37
+ * @returns
38
+ */
39
+ export const CreateWorker = async (): Promise<Worker> => {
40
+ const worker = new Worker(
41
+ URL.createObjectURL(new Blob([(export_worker_script as {default: string}).default], { type: 'application/javascript' })));
42
+ return worker;
43
+ };
44
+
@@ -97,7 +97,7 @@
97
97
  --treb-grid-background: rgb(30,30,30);
98
98
  --treb-grid-header-background: rgb(86,86,86);
99
99
  --treb-grid-header-color: rgb(221,221,221);
100
- --treb-tab-bar-active-tab-background: field;
100
+ --treb-tab-bar-active-tab-background: #444;
101
101
  --treb-tab-bar-tab-background: transparent;
102
102
  --treb-tab-bar-tab-border-color: #444;
103
103
  --treb-ui-border-color: #aaa;
@@ -2076,12 +2076,33 @@ export class Exporter {
2076
2076
  }
2077
2077
  }
2078
2078
 
2079
+ const color_series: {
2080
+ rgb?: string;
2081
+ tint?: string;
2082
+ theme?: string;
2083
+ } = {
2084
+ rgb: 'FF376092' // default
2085
+ };
2086
+
2087
+ if (sparkline.style?.text) {
2088
+ if (IsHTMLColor(sparkline.style.text)) {
2089
+ color_series.rgb = sparkline.style.text.text;
2090
+ }
2091
+ else if (IsThemeColor(sparkline.style.text)) {
2092
+ color_series.rgb = undefined;
2093
+ color_series.theme = sparkline.style.text.theme.toString();
2094
+ color_series.tint = typeof sparkline.style.text.tint === 'number' ?
2095
+ sparkline.style.text.tint.toString() : undefined;
2096
+ }
2097
+ }
2098
+
2079
2099
  return {
2080
2100
  a$: {
2081
2101
  displayEmptyCellsAs: 'gap',
2102
+ displayHidden: '1',
2082
2103
  type: /column/i.test(sparkline.formula) ? 'column' : undefined,
2083
2104
  },
2084
- 'x14:colorSeries': { a$: { rgb: 'FF376092' }},
2105
+ 'x14:colorSeries': { a$: { ...color_series }},
2085
2106
  'x14:sparklines': {
2086
2107
  'x14:sparkline': {
2087
2108
  'xm:f': source,
@@ -22,8 +22,8 @@
22
22
  import type { ImportedSheetData } from 'treb-base-types';
23
23
  import type { SerializedModel } from 'treb-data-model';
24
24
 
25
- import { Exporter } from '../export';
26
- import { Importer } from '../import2';
25
+ import { Exporter } from './export';
26
+ import { Importer } from './import2';
27
27
 
28
28
  const ctx: Worker = self as unknown as Worker;
29
29
  const exporter = new Exporter();
@@ -418,7 +418,7 @@ export class OverlayEditor extends Editor<ResetSelectionEvent> {
418
418
  case 'Down':
419
419
  case 'Left':
420
420
  case 'Right':
421
- return this.selecting ? undefined : 'handled';
421
+ return this.selecting ? undefined : 'commit';
422
422
 
423
423
  }
424
424
 
@@ -4014,7 +4014,15 @@ export class Grid extends GridBase {
4014
4014
  // unless we're selecting an argument, close the ICE
4015
4015
 
4016
4016
  if (this.overlay_editor?.editing && !this.overlay_editor?.selecting) {
4017
- this.DismissEditor();
4017
+
4018
+ // commit
4019
+
4020
+ if (this.overlay_editor?.selection) {
4021
+ const value = this.overlay_editor?.edit_node.textContent || undefined;
4022
+ this.SetInferredType(this.overlay_editor.selection, value, false);
4023
+ }
4024
+
4025
+ this.DismissEditor();
4018
4026
  }
4019
4027
 
4020
4028
  const offset_point = {