@trebco/treb 25.6.1 → 25.6.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.
package/dist/treb.d.ts CHANGED
@@ -603,14 +603,21 @@ export declare class EmbeddedSpreadsheet {
603
603
  ExportDelimited(options?: ExportOptions): string;
604
604
 
605
605
  /**
606
- * Save the current document to a desktop file.
606
+ * @deprecated - use SaveToDesktop
607
607
  *
608
- * @param filename Filename or extension to use the document name.
609
- *
610
- * @public
608
+ * @param filename
609
+ * @param additional_options
611
610
  */
612
611
  SaveLocalFile(filename?: string, additional_options?: SaveOptions): void;
613
612
 
613
+ /**
614
+ * Save the current document to a desktop file. This is the new version
615
+ * of the method, renamed from SaveLocalFile.
616
+ *
617
+ * @param filename Filename or extension to use the document name.
618
+ */
619
+ SaveToDesktop(filename?: string, additional_options?: SaveOptions): void;
620
+
614
621
  /**
615
622
  * Load CSV from string. This is used internally when loading network
616
623
  * documents and local files, but you can call it directly if you have
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trebco/treb",
3
- "version": "25.6.1",
3
+ "version": "25.6.4",
4
4
  "license": "LGPL-3.0-or-later",
5
5
  "homepage": "https://treb.app",
6
6
  "repository": {
@@ -1513,11 +1513,11 @@ export class EmbeddedSpreadsheet {
1513
1513
  break;
1514
1514
 
1515
1515
  case 'save-json':
1516
- this.SaveLocalFile();
1516
+ this.SaveToDesktop();
1517
1517
  break;
1518
1518
 
1519
1519
  case 'save-csv': // FIXME: should be export
1520
- this.SaveLocalFile(SaveFileType.csv);
1520
+ this.SaveToDesktop(SaveFileType.csv);
1521
1521
  break;
1522
1522
 
1523
1523
  case 'export-xlsx':
@@ -2723,14 +2723,25 @@ export class EmbeddedSpreadsheet {
2723
2723
 
2724
2724
  }
2725
2725
 
2726
+ /**
2727
+ * @deprecated - use SaveToDesktop
2728
+ *
2729
+ * @param filename
2730
+ * @param additional_options
2731
+ */
2732
+ public SaveLocalFile(
2733
+ filename: string = SaveFileType.trebjson,
2734
+ additional_options: SaveOptions = {}): void {
2735
+ this.SaveToDesktop(filename, additional_options);
2736
+ }
2737
+
2726
2738
  /**
2727
- * Save the current document to a desktop file.
2739
+ * Save the current document to a desktop file. This is the new version
2740
+ * of the method, renamed from SaveLocalFile.
2728
2741
  *
2729
2742
  * @param filename Filename or extension to use the document name.
2730
- *
2731
- * @public
2732
2743
  */
2733
- public SaveLocalFile(
2744
+ public SaveToDesktop(
2734
2745
  filename: string = SaveFileType.trebjson,
2735
2746
  additional_options: SaveOptions = {}): void {
2736
2747
 
@@ -24,83 +24,74 @@
24
24
  */
25
25
 
26
26
  @mixin dark {
27
-
28
27
  --treb-autocomplete-background: #333;
29
- --treb-autocomplete-border-color: #fff;
30
- --treb-autocomplete-entry-color: #fff;
31
- --treb-autocomplete-selected-entry-background: darkred;
32
- --treb-autocomplete-tooltip-background: darkred;
33
- --treb-autocomplete-tooltip-border-color: #fff;
34
- --treb-autocomplete-tooltip-color: #fff;
35
- --treb-chart-background: #000;
36
- --treb-chart-grid-color: #976;
37
- --treb-chart-text-color: #fff;
38
- --treb-dialog-background: #000;
39
- --treb-dialog-border-color: #fff;
40
- --treb-dialog-color: #fff;
41
- --treb-dropdown-background: #000;
42
- --treb-dropdown-border-color: #fff;
43
- --treb-dropdown-caret-active-background: darkred;
44
- --treb-dropdown-caret-background: #444;
45
- --treb-dropdown-caret-border-color: #fff;
46
- --treb-dropdown-caret-color: #fff;
47
- --treb-dropdown-color: #fff;
48
- --treb-dropdown-selected-background: darkred;
49
- --treb-grid-background: #000;
50
- --treb-grid-default-color: #fff;
51
- --treb-grid-grid-color: #444;
52
- --treb-grid-header-background: #444;
53
- --treb-grid-header-grid-color: #000;
54
- --treb-note-background: #333;
55
- --treb-note-border-color: #fff;
56
- --treb-note-color: #fff;
57
- --treb-note-marker-color: pink;
58
- --treb-resize-tooltip-background: #fff;
59
- --treb-resize-tooltip-color: #000;
60
- --treb-scale-slider-accent-color: #fff;
61
- --treb-scale-slider-background: #333;
62
- --treb-scale-slider-border-color: #fff;
63
- --treb-selection-color: yellow;
64
- --treb-selection-fill-opacity: .2;
65
- --treb-sidebar-button-background: #000;
66
- --treb-sidebar-button-border-color: #888;
67
- --treb-stats-value-background: #223;
68
- --treb-tab-bar-active-tab-background: #444;
69
- --treb-tab-bar-tab-background: #000;
70
- --treb-tab-bar-tab-color: #fff;
28
+ --treb-autocomplete-border-color: #fff;
29
+ --treb-autocomplete-entry-color: #fff;
30
+ --treb-autocomplete-selected-entry-background: darkred;
31
+ --treb-autocomplete-tooltip-background: darkred;
32
+ --treb-autocomplete-tooltip-border-color: #fff;
33
+ --treb-autocomplete-tooltip-color: #fff;
34
+ --treb-chart-background: #000;
35
+ --treb-chart-grid-color: #976;
36
+ --treb-chart-text-color: #fff;
37
+ --treb-dialog-background: #000;
38
+ --treb-dialog-border-color: #fff;
39
+ --treb-dialog-color: #fff;
40
+ --treb-dropdown-background: #000;
41
+ --treb-dropdown-border-color: #fff;
42
+ --treb-dropdown-caret-active-background: darkred;
43
+ --treb-dropdown-caret-background: #444;
44
+ --treb-dropdown-caret-border-color: #fff;
45
+ --treb-dropdown-caret-color: #fff;
46
+ --treb-dropdown-color: #fff;
47
+ --treb-dropdown-selected-background: darkred;
48
+ --treb-grid-background: #000;
49
+ --treb-grid-default-color: #fff;
50
+ --treb-grid-grid-color: #444;
51
+ --treb-grid-header-background: #444;
52
+ --treb-grid-header-grid-color: #000;
53
+ --treb-note-background: #333;
54
+ --treb-note-border-color: #fff;
55
+ --treb-note-color: #fff;
56
+ --treb-note-marker-color: pink;
57
+ --treb-resize-tooltip-background: #fff;
58
+ --treb-resize-tooltip-color: #000;
59
+ --treb-scale-slider-accent-color: #fff;
60
+ --treb-scale-slider-background: #333;
61
+ --treb-scale-slider-border-color: #fff;
62
+ --treb-selection-color: yellow;
63
+ --treb-selection-fill-opacity: .2;
64
+ --treb-sidebar-button-background: #000;
65
+ --treb-sidebar-button-border-color: #888;
66
+ --treb-stats-value-background: #223;
67
+ --treb-tab-bar-active-tab-background: #444;
68
+ --treb-tab-bar-tab-background: #000;
69
+ --treb-tab-bar-tab-color: #fff;
71
70
  --treb-theme-color-1: #222;
72
71
  --treb-theme-color-2: #ddd;
73
- --treb-toolbar-active-button-background: #555;
74
- --treb-toolbar-button-background: #000;
75
- --treb-toolbar-hover-button-background: #444;
76
- --treb-ui-border-color: #666;
77
- --treb-ui-color: #fff;
78
-
79
- --treb-table-header-background: #334; // DarkSlateGray;
80
- --treb-table-odd-background: #122;
81
- --treb-table-header-font-weight: 700;
82
-
83
- --treb-table-header-border-top: #889;
84
- --treb-table-header-border-bottom: #889;
85
- --treb-table-footer-border-bottom: #889;
86
- --treb-table-odd-border-top: #889;
87
- --treb-table-odd-border-bottom: #889;
88
- --treb-table-even-border-top: #889;
89
- --treb-table-even-border-bottom: #889;
90
-
91
- --treb-table-total-border-top: #889;
92
- --treb-table-total-border-bottom: #889;
93
-
94
- --treb-table-total-background: #334;
95
- --treb-table-total-font-weight: 700;
96
-
97
- // ---
98
-
99
- --treb-color-scheme: dark;
100
- --treb-resize-handle-color: lightblue;
101
- --treb-resize-frame-color: lightblue;
102
- --treb-formula-bar-locked-background: #234;
103
-
72
+ --treb-toolbar-active-button-background: #555;
73
+ --treb-toolbar-button-background: #000;
74
+ --treb-toolbar-hover-button-background: #444;
75
+ --treb-ui-border-color: #666;
76
+ --treb-ui-color: #fff;
77
+ --treb-table-header-background: #334; // DarkSlateGray;
78
+ --treb-table-odd-background: #122;
79
+ --treb-table-header-font-weight: 700;
80
+ --treb-table-header-border-top: #889;
81
+ --treb-table-header-border-bottom: #889;
82
+ --treb-table-footer-border-bottom: #889;
83
+ --treb-table-odd-border-top: #889;
84
+ --treb-table-odd-border-bottom: #889;
85
+ --treb-table-even-border-top: #889;
86
+ --treb-table-even-border-bottom: #889;
87
+ --treb-table-total-border-top: #889;
88
+ --treb-table-total-border-bottom: #889;
89
+ --treb-table-total-background: #334;
90
+ --treb-table-total-font-weight: 700;
91
+ --treb-color-scheme: dark;
92
+ --treb-resize-handle-color: lightblue;
93
+ --treb-resize-frame-color: lightblue;
94
+ --treb-formula-bar-locked-background: #234;
104
95
  }
105
96
 
106
97
  .treb-dark-theme {
@@ -108,7 +99,7 @@
108
99
  }
109
100
 
110
101
  @media (prefers-color-scheme: dark) {
111
- .treb-light-dark-theme {
102
+ .treb-light-dark-theme {
112
103
  @include dark;
113
104
  }
114
- }
105
+ }
@@ -47,6 +47,12 @@
47
47
  all: revert;
48
48
  box-sizing: border-box;
49
49
 
50
+ // text-align does not revert? it should be covered by all...
51
+ // or is the problem that there's no initial value? (although
52
+ // unset does not work either)
53
+
54
+ text-align: start;
55
+
50
56
  div, button, input, ul, ol, li, a, textarea {
51
57
 
52
58
  // maybe this is being too aggressive. we could be a little
@@ -21,6 +21,10 @@
21
21
 
22
22
  .treb-main {
23
23
 
24
+ .treb-mouse-mask .ghost-tab {
25
+ position: fixed;
26
+ }
27
+
24
28
  .treb-spreadsheet-footer {
25
29
 
26
30
  grid-area: 3/1/4/2;
@@ -1069,8 +1069,11 @@ export abstract class BaseLayout {
1069
1069
  // focus_callback: () => void,
1070
1070
  scroll = true): void {
1071
1071
 
1072
+ // this is getting stuck under the toolbar... we need better z-stacking
1073
+ // and this needs to be higher up in the node list
1074
+
1072
1075
  if (!this.mask.parentElement) {
1073
- container.appendChild(this.mask);
1076
+ container.parentElement?.parentElement?.appendChild(this.mask);
1074
1077
  }
1075
1078
 
1076
1079
  //if (!this.error_highlight.parentElement) {
@@ -155,6 +155,15 @@ export interface AnnotationDataBase {
155
155
 
156
156
  }
157
157
 
158
+ const default_annotation_data: Partial<AnnotationDataBase> = {
159
+ move_with_cells: true,
160
+ resize_with_cells: true,
161
+ movable: true,
162
+ resizable: true,
163
+ removable: true,
164
+ selectable: true,
165
+ };
166
+
158
167
  export interface AnnotationImageData extends AnnotationDataBase {
159
168
  type: 'image';
160
169
  data: ImageAnnotationData;
@@ -177,7 +186,9 @@ export type AnnotationData = AnnotationChartData | AnnotationImageData | Annotat
177
186
  */
178
187
  export class Annotation {
179
188
 
180
- public data: Partial<AnnotationData> = {};
189
+ public data: Partial<AnnotationData> = {
190
+ ...default_annotation_data
191
+ };
181
192
 
182
193
  /**
183
194
  * the key field is used to identify and coordinate annotations when we
@@ -212,7 +223,10 @@ export class Annotation {
212
223
  * constructor takes persisted data
213
224
  */
214
225
  constructor(opts: Partial<AnnotationData> = {}) {
215
- this.data = JSON.parse(JSON.stringify(opts)); // why clone?
226
+ this.data = {
227
+ ...default_annotation_data,
228
+ ...JSON.parse(JSON.stringify(opts))
229
+ }; // why clone?
216
230
  if (opts.rect) {
217
231
  this.rect = Rectangle.Create(opts.rect);
218
232
  }
@@ -326,9 +326,27 @@ export class TabBar extends EventSource<TabEvent> {
326
326
 
327
327
  this.dragging = true;
328
328
 
329
+ // ghost is a good idea but we need to delay it, because
330
+ // it starts to flicker if you just click a tab to select
331
+ // it (or double click to rename)
332
+
333
+ /*
334
+ const ghost = document.createElement('div');
335
+ ghost.classList.add('ghost-tab');
336
+ ghost.appendChild(tab.cloneNode(true));
337
+ ghost.style.top = '-1000px';
338
+ this.layout.mask.appendChild(ghost);
339
+ */
340
+
329
341
  MouseDrag(this.layout.mask, [], (move_event) => {
330
342
 
331
343
  const [x, y] = [move_event.clientX, move_event.clientY];
344
+
345
+ /*
346
+ ghost.style.top = `${y}px`;
347
+ ghost.style.left = `${x}px`;
348
+ */
349
+
332
350
  if (y > top && y < bottom) {
333
351
  let new_order = order;
334
352
  if (x < left) { new_order = min; }
@@ -360,6 +378,10 @@ export class TabBar extends EventSource<TabEvent> {
360
378
  let current = index;
361
379
  let move_before = (order + 1) / 2;
362
380
 
381
+ /*
382
+ this.layout.mask.removeChild(ghost);
383
+ */
384
+
363
385
  // console.info('set false')
364
386
  this.dragging = false;
365
387