@trebco/treb 27.11.4 → 27.12.1

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 v27.11. Copyright 2018-2023 trebco, llc. All rights reserved. LGPL: https://treb.app/license */
1
+ /*! API v27.12. Copyright 2018-2023 trebco, llc. All rights reserved. LGPL: https://treb.app/license */
2
2
 
3
3
  /**
4
4
  * add our tag to the map
@@ -1381,7 +1381,7 @@ export declare type LoadSource = "drag-and-drop" | "local-file" | "network-file"
1381
1381
  * EmbeddedSheetEvent is a discriminated union. Switch on the `type` field
1382
1382
  * of the event.
1383
1383
  */
1384
- export type EmbeddedSheetEvent = DocumentChangeEvent | DocumentResetEvent | DocumentLoadEvent | DataChangeEvent | FocusViewEvent | SelectionEvent | ResizeEvent;
1384
+ export type EmbeddedSheetEvent = DocumentChangeEvent | DocumentResetEvent | DocumentLoadEvent | ViewChangeEvent | DataChangeEvent | FocusViewEvent | SelectionEvent | ResizeEvent;
1385
1385
 
1386
1386
  /**
1387
1387
  * options when inserting a table into a sheet
@@ -1411,6 +1411,15 @@ export interface ResizeEvent {
1411
1411
  }
1412
1412
  export declare type LoadType = "treb" | "csv" | "xlsx";
1413
1413
 
1414
+ /**
1415
+ * This event is sent when the view changes -- at the moment, that only
1416
+ * means the view scale has been changed. We might use it in the future
1417
+ * for other things.
1418
+ */
1419
+ export interface ViewChangeEvent {
1420
+ type: 'view-change';
1421
+ }
1422
+
1414
1423
  /**
1415
1424
  * This event is sent when a document is loaded, and also on undo. The
1416
1425
  * source field can help determine if it was triggered by an undo operation.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trebco/treb",
3
- "version": "27.11.4",
3
+ "version": "27.12.1",
4
4
  "license": "LGPL-3.0-or-later",
5
5
  "homepage": "https://treb.app",
6
6
  "repository": {
@@ -308,7 +308,8 @@ export class EmbeddedSpreadsheet {
308
308
  /** loaded language model, if any */
309
309
  protected language_model?: LanguageModel;
310
310
 
311
- protected events = new EventSource<{type: string}>();
311
+ /** FIXME: fix type (needs to be extensible) */
312
+ protected events = new EventSource<{ type: string }>();
312
313
 
313
314
  /**
314
315
  * automatic/manual
@@ -828,6 +829,7 @@ export class EmbeddedSpreadsheet {
828
829
 
829
830
  case 'scale':
830
831
  this.RebuildAllAnnotations();
832
+ this.events.Publish({ type: 'view-change' });
831
833
  break;
832
834
 
833
835
  case 'annotation':
@@ -122,6 +122,20 @@ export enum LoadType {
122
122
  XLSX = 'xlsx',
123
123
  }
124
124
 
125
+ /**
126
+ * This event is sent when the view changes -- at the moment, that only
127
+ * means the view scale has been changed. We might use it in the future
128
+ * for other things.
129
+ *
130
+ * @privateRemarks
131
+ * not sure if this should be combined with resize -- the only reason it's
132
+ * not is because resize implies some structural/layout changes that require
133
+ * changing the document, but scale does not. open to suggestions though.
134
+ */
135
+ export interface ViewChangeEvent {
136
+ type: 'view-change';
137
+ }
138
+
125
139
  /**
126
140
  * This event is sent when a document is loaded, and also on undo. The
127
141
  * source field can help determine if it was triggered by an undo operation.
@@ -184,6 +198,7 @@ export type EmbeddedSheetEvent
184
198
  = DocumentChangeEvent
185
199
  | DocumentResetEvent
186
200
  | DocumentLoadEvent
201
+ | ViewChangeEvent
187
202
  | DataChangeEvent
188
203
  | FocusViewEvent
189
204
  | SelectionEvent