microboard-temp 0.5.113 → 0.5.115

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.
@@ -42207,6 +42207,7 @@ class ImageItem extends BaseItem {
42207
42207
  beforeLoadCallbacks = [];
42208
42208
  transformationRenderBlock = undefined;
42209
42209
  storageLink;
42210
+ signedUrl = "";
42210
42211
  imageDimension;
42211
42212
  board;
42212
42213
  constructor({ base64, storageLink, imageDimension }, board, events, id = "") {
@@ -42230,8 +42231,13 @@ class ImageItem extends BaseItem {
42230
42231
  });
42231
42232
  this.transformation.subject.subscribe(this.onTransform);
42232
42233
  }
42233
- setStorageLink(link2) {
42234
+ async setStorageLink(link2) {
42235
+ console.log("setStorageLink", link2);
42234
42236
  this.storageLink = link2;
42237
+ console.log("board", this.board);
42238
+ console.log("accessToken", this.board.getAccount()?.accessToken());
42239
+ this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken() || null) || "";
42240
+ this.image.src = this.signedUrl;
42235
42241
  }
42236
42242
  getStorageId() {
42237
42243
  return this.storageLink.split("/").pop();
@@ -42341,7 +42347,6 @@ class ImageItem extends BaseItem {
42341
42347
  this.onLoad();
42342
42348
  };
42343
42349
  storageImage.onerror = this.onError;
42344
- storageImage.src = this.storageLink;
42345
42350
  return this;
42346
42351
  }
42347
42352
  emit(operation) {
@@ -42378,6 +42383,7 @@ class ImageItem extends BaseItem {
42378
42383
  if (this.transformationRenderBlock) {
42379
42384
  return;
42380
42385
  }
42386
+ console.log(this);
42381
42387
  const ctx = context.ctx;
42382
42388
  ctx.save();
42383
42389
  this.transformation.matrix.applyToContext(ctx);
@@ -42453,7 +42459,7 @@ class ImageItem extends BaseItem {
42453
42459
  }
42454
42460
  download() {
42455
42461
  const linkElem = document.createElement("a");
42456
- linkElem.href = this.storageLink;
42462
+ linkElem.href = this.signedUrl;
42457
42463
  linkElem.setAttribute("download", "");
42458
42464
  linkElem.click();
42459
42465
  }
@@ -53743,6 +53749,7 @@ class Board {
53743
53749
  boardId;
53744
53750
  accessKey;
53745
53751
  saveEditingFile;
53752
+ account;
53746
53753
  events;
53747
53754
  isBoardMenuOpen = false;
53748
53755
  selection;
@@ -53765,10 +53772,11 @@ class Board {
53765
53772
  connecting = new Promise((resolve2) => {
53766
53773
  this.resolveConnecting = resolve2;
53767
53774
  });
53768
- constructor(boardId = "", accessKey, saveEditingFile) {
53775
+ constructor(boardId = "", accessKey, saveEditingFile, account) {
53769
53776
  this.boardId = boardId;
53770
53777
  this.accessKey = accessKey;
53771
53778
  this.saveEditingFile = saveEditingFile;
53779
+ this.account = account;
53772
53780
  this.selection = new BoardSelection(this);
53773
53781
  this.presence = new Presence(this);
53774
53782
  this.tools.navigate();
@@ -53780,6 +53788,9 @@ class Board {
53780
53788
  this.items = this.index.items;
53781
53789
  this.presence.events = this.events;
53782
53790
  }
53791
+ getAccount() {
53792
+ return this.account || null;
53793
+ }
53783
53794
  getNewItemId() {
53784
53795
  return v4_default();
53785
53796
  }
package/dist/cjs/index.js CHANGED
@@ -42207,6 +42207,7 @@ class ImageItem extends BaseItem {
42207
42207
  beforeLoadCallbacks = [];
42208
42208
  transformationRenderBlock = undefined;
42209
42209
  storageLink;
42210
+ signedUrl = "";
42210
42211
  imageDimension;
42211
42212
  board;
42212
42213
  constructor({ base64, storageLink, imageDimension }, board, events, id = "") {
@@ -42230,8 +42231,13 @@ class ImageItem extends BaseItem {
42230
42231
  });
42231
42232
  this.transformation.subject.subscribe(this.onTransform);
42232
42233
  }
42233
- setStorageLink(link2) {
42234
+ async setStorageLink(link2) {
42235
+ console.log("setStorageLink", link2);
42234
42236
  this.storageLink = link2;
42237
+ console.log("board", this.board);
42238
+ console.log("accessToken", this.board.getAccount()?.accessToken());
42239
+ this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken() || null) || "";
42240
+ this.image.src = this.signedUrl;
42235
42241
  }
42236
42242
  getStorageId() {
42237
42243
  return this.storageLink.split("/").pop();
@@ -42341,7 +42347,6 @@ class ImageItem extends BaseItem {
42341
42347
  this.onLoad();
42342
42348
  };
42343
42349
  storageImage.onerror = this.onError;
42344
- storageImage.src = this.storageLink;
42345
42350
  return this;
42346
42351
  }
42347
42352
  emit(operation) {
@@ -42378,6 +42383,7 @@ class ImageItem extends BaseItem {
42378
42383
  if (this.transformationRenderBlock) {
42379
42384
  return;
42380
42385
  }
42386
+ console.log(this);
42381
42387
  const ctx = context.ctx;
42382
42388
  ctx.save();
42383
42389
  this.transformation.matrix.applyToContext(ctx);
@@ -42453,7 +42459,7 @@ class ImageItem extends BaseItem {
42453
42459
  }
42454
42460
  download() {
42455
42461
  const linkElem = document.createElement("a");
42456
- linkElem.href = this.storageLink;
42462
+ linkElem.href = this.signedUrl;
42457
42463
  linkElem.setAttribute("download", "");
42458
42464
  linkElem.click();
42459
42465
  }
@@ -53743,6 +53749,7 @@ class Board {
53743
53749
  boardId;
53744
53750
  accessKey;
53745
53751
  saveEditingFile;
53752
+ account;
53746
53753
  events;
53747
53754
  isBoardMenuOpen = false;
53748
53755
  selection;
@@ -53765,10 +53772,11 @@ class Board {
53765
53772
  connecting = new Promise((resolve2) => {
53766
53773
  this.resolveConnecting = resolve2;
53767
53774
  });
53768
- constructor(boardId = "", accessKey, saveEditingFile) {
53775
+ constructor(boardId = "", accessKey, saveEditingFile, account) {
53769
53776
  this.boardId = boardId;
53770
53777
  this.accessKey = accessKey;
53771
53778
  this.saveEditingFile = saveEditingFile;
53779
+ this.account = account;
53772
53780
  this.selection = new BoardSelection(this);
53773
53781
  this.presence = new Presence(this);
53774
53782
  this.tools.navigate();
@@ -53780,6 +53788,9 @@ class Board {
53780
53788
  this.items = this.index.items;
53781
53789
  this.presence.events = this.events;
53782
53790
  }
53791
+ getAccount() {
53792
+ return this.account || null;
53793
+ }
53783
53794
  getNewItemId() {
53784
53795
  return v4_default();
53785
53796
  }
package/dist/cjs/node.js CHANGED
@@ -44680,6 +44680,7 @@ class ImageItem extends BaseItem {
44680
44680
  beforeLoadCallbacks = [];
44681
44681
  transformationRenderBlock = undefined;
44682
44682
  storageLink;
44683
+ signedUrl = "";
44683
44684
  imageDimension;
44684
44685
  board;
44685
44686
  constructor({ base64, storageLink, imageDimension }, board, events, id = "") {
@@ -44703,8 +44704,13 @@ class ImageItem extends BaseItem {
44703
44704
  });
44704
44705
  this.transformation.subject.subscribe(this.onTransform);
44705
44706
  }
44706
- setStorageLink(link2) {
44707
+ async setStorageLink(link2) {
44708
+ console.log("setStorageLink", link2);
44707
44709
  this.storageLink = link2;
44710
+ console.log("board", this.board);
44711
+ console.log("accessToken", this.board.getAccount()?.accessToken());
44712
+ this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken() || null) || "";
44713
+ this.image.src = this.signedUrl;
44708
44714
  }
44709
44715
  getStorageId() {
44710
44716
  return this.storageLink.split("/").pop();
@@ -44814,7 +44820,6 @@ class ImageItem extends BaseItem {
44814
44820
  this.onLoad();
44815
44821
  };
44816
44822
  storageImage.onerror = this.onError;
44817
- storageImage.src = this.storageLink;
44818
44823
  return this;
44819
44824
  }
44820
44825
  emit(operation) {
@@ -44851,6 +44856,7 @@ class ImageItem extends BaseItem {
44851
44856
  if (this.transformationRenderBlock) {
44852
44857
  return;
44853
44858
  }
44859
+ console.log(this);
44854
44860
  const ctx = context.ctx;
44855
44861
  ctx.save();
44856
44862
  this.transformation.matrix.applyToContext(ctx);
@@ -44926,7 +44932,7 @@ class ImageItem extends BaseItem {
44926
44932
  }
44927
44933
  download() {
44928
44934
  const linkElem = document.createElement("a");
44929
- linkElem.href = this.storageLink;
44935
+ linkElem.href = this.signedUrl;
44930
44936
  linkElem.setAttribute("download", "");
44931
44937
  linkElem.click();
44932
44938
  }
@@ -56216,6 +56222,7 @@ class Board {
56216
56222
  boardId;
56217
56223
  accessKey;
56218
56224
  saveEditingFile;
56225
+ account;
56219
56226
  events;
56220
56227
  isBoardMenuOpen = false;
56221
56228
  selection;
@@ -56238,10 +56245,11 @@ class Board {
56238
56245
  connecting = new Promise((resolve2) => {
56239
56246
  this.resolveConnecting = resolve2;
56240
56247
  });
56241
- constructor(boardId = "", accessKey, saveEditingFile) {
56248
+ constructor(boardId = "", accessKey, saveEditingFile, account) {
56242
56249
  this.boardId = boardId;
56243
56250
  this.accessKey = accessKey;
56244
56251
  this.saveEditingFile = saveEditingFile;
56252
+ this.account = account;
56245
56253
  this.selection = new BoardSelection(this);
56246
56254
  this.presence = new Presence(this);
56247
56255
  this.tools.navigate();
@@ -56253,6 +56261,9 @@ class Board {
56253
56261
  this.items = this.index.items;
56254
56262
  this.presence.events = this.events;
56255
56263
  }
56264
+ getAccount() {
56265
+ return this.account || null;
56266
+ }
56256
56267
  getNewItemId() {
56257
56268
  return v4_default();
56258
56269
  }
@@ -42051,6 +42051,7 @@ class ImageItem extends BaseItem {
42051
42051
  beforeLoadCallbacks = [];
42052
42052
  transformationRenderBlock = undefined;
42053
42053
  storageLink;
42054
+ signedUrl = "";
42054
42055
  imageDimension;
42055
42056
  board;
42056
42057
  constructor({ base64, storageLink, imageDimension }, board, events, id = "") {
@@ -42074,8 +42075,13 @@ class ImageItem extends BaseItem {
42074
42075
  });
42075
42076
  this.transformation.subject.subscribe(this.onTransform);
42076
42077
  }
42077
- setStorageLink(link2) {
42078
+ async setStorageLink(link2) {
42079
+ console.log("setStorageLink", link2);
42078
42080
  this.storageLink = link2;
42081
+ console.log("board", this.board);
42082
+ console.log("accessToken", this.board.getAccount()?.accessToken());
42083
+ this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken() || null) || "";
42084
+ this.image.src = this.signedUrl;
42079
42085
  }
42080
42086
  getStorageId() {
42081
42087
  return this.storageLink.split("/").pop();
@@ -42185,7 +42191,6 @@ class ImageItem extends BaseItem {
42185
42191
  this.onLoad();
42186
42192
  };
42187
42193
  storageImage.onerror = this.onError;
42188
- storageImage.src = this.storageLink;
42189
42194
  return this;
42190
42195
  }
42191
42196
  emit(operation) {
@@ -42222,6 +42227,7 @@ class ImageItem extends BaseItem {
42222
42227
  if (this.transformationRenderBlock) {
42223
42228
  return;
42224
42229
  }
42230
+ console.log(this);
42225
42231
  const ctx = context.ctx;
42226
42232
  ctx.save();
42227
42233
  this.transformation.matrix.applyToContext(ctx);
@@ -42297,7 +42303,7 @@ class ImageItem extends BaseItem {
42297
42303
  }
42298
42304
  download() {
42299
42305
  const linkElem = document.createElement("a");
42300
- linkElem.href = this.storageLink;
42306
+ linkElem.href = this.signedUrl;
42301
42307
  linkElem.setAttribute("download", "");
42302
42308
  linkElem.click();
42303
42309
  }
@@ -53587,6 +53593,7 @@ class Board {
53587
53593
  boardId;
53588
53594
  accessKey;
53589
53595
  saveEditingFile;
53596
+ account;
53590
53597
  events;
53591
53598
  isBoardMenuOpen = false;
53592
53599
  selection;
@@ -53609,10 +53616,11 @@ class Board {
53609
53616
  connecting = new Promise((resolve2) => {
53610
53617
  this.resolveConnecting = resolve2;
53611
53618
  });
53612
- constructor(boardId = "", accessKey, saveEditingFile) {
53619
+ constructor(boardId = "", accessKey, saveEditingFile, account) {
53613
53620
  this.boardId = boardId;
53614
53621
  this.accessKey = accessKey;
53615
53622
  this.saveEditingFile = saveEditingFile;
53623
+ this.account = account;
53616
53624
  this.selection = new BoardSelection(this);
53617
53625
  this.presence = new Presence(this);
53618
53626
  this.tools.navigate();
@@ -53624,6 +53632,9 @@ class Board {
53624
53632
  this.items = this.index.items;
53625
53633
  this.presence.events = this.events;
53626
53634
  }
53635
+ getAccount() {
53636
+ return this.account || null;
53637
+ }
53627
53638
  getNewItemId() {
53628
53639
  return v4_default();
53629
53640
  }
package/dist/esm/index.js CHANGED
@@ -42044,6 +42044,7 @@ class ImageItem extends BaseItem {
42044
42044
  beforeLoadCallbacks = [];
42045
42045
  transformationRenderBlock = undefined;
42046
42046
  storageLink;
42047
+ signedUrl = "";
42047
42048
  imageDimension;
42048
42049
  board;
42049
42050
  constructor({ base64, storageLink, imageDimension }, board, events, id = "") {
@@ -42067,8 +42068,13 @@ class ImageItem extends BaseItem {
42067
42068
  });
42068
42069
  this.transformation.subject.subscribe(this.onTransform);
42069
42070
  }
42070
- setStorageLink(link2) {
42071
+ async setStorageLink(link2) {
42072
+ console.log("setStorageLink", link2);
42071
42073
  this.storageLink = link2;
42074
+ console.log("board", this.board);
42075
+ console.log("accessToken", this.board.getAccount()?.accessToken());
42076
+ this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken() || null) || "";
42077
+ this.image.src = this.signedUrl;
42072
42078
  }
42073
42079
  getStorageId() {
42074
42080
  return this.storageLink.split("/").pop();
@@ -42178,7 +42184,6 @@ class ImageItem extends BaseItem {
42178
42184
  this.onLoad();
42179
42185
  };
42180
42186
  storageImage.onerror = this.onError;
42181
- storageImage.src = this.storageLink;
42182
42187
  return this;
42183
42188
  }
42184
42189
  emit(operation) {
@@ -42215,6 +42220,7 @@ class ImageItem extends BaseItem {
42215
42220
  if (this.transformationRenderBlock) {
42216
42221
  return;
42217
42222
  }
42223
+ console.log(this);
42218
42224
  const ctx = context.ctx;
42219
42225
  ctx.save();
42220
42226
  this.transformation.matrix.applyToContext(ctx);
@@ -42290,7 +42296,7 @@ class ImageItem extends BaseItem {
42290
42296
  }
42291
42297
  download() {
42292
42298
  const linkElem = document.createElement("a");
42293
- linkElem.href = this.storageLink;
42299
+ linkElem.href = this.signedUrl;
42294
42300
  linkElem.setAttribute("download", "");
42295
42301
  linkElem.click();
42296
42302
  }
@@ -53580,6 +53586,7 @@ class Board {
53580
53586
  boardId;
53581
53587
  accessKey;
53582
53588
  saveEditingFile;
53589
+ account;
53583
53590
  events;
53584
53591
  isBoardMenuOpen = false;
53585
53592
  selection;
@@ -53602,10 +53609,11 @@ class Board {
53602
53609
  connecting = new Promise((resolve2) => {
53603
53610
  this.resolveConnecting = resolve2;
53604
53611
  });
53605
- constructor(boardId = "", accessKey, saveEditingFile) {
53612
+ constructor(boardId = "", accessKey, saveEditingFile, account) {
53606
53613
  this.boardId = boardId;
53607
53614
  this.accessKey = accessKey;
53608
53615
  this.saveEditingFile = saveEditingFile;
53616
+ this.account = account;
53609
53617
  this.selection = new BoardSelection(this);
53610
53618
  this.presence = new Presence(this);
53611
53619
  this.tools.navigate();
@@ -53617,6 +53625,9 @@ class Board {
53617
53625
  this.items = this.index.items;
53618
53626
  this.presence.events = this.events;
53619
53627
  }
53628
+ getAccount() {
53629
+ return this.account || null;
53630
+ }
53620
53631
  getNewItemId() {
53621
53632
  return v4_default();
53622
53633
  }
package/dist/esm/node.js CHANGED
@@ -44512,6 +44512,7 @@ class ImageItem extends BaseItem {
44512
44512
  beforeLoadCallbacks = [];
44513
44513
  transformationRenderBlock = undefined;
44514
44514
  storageLink;
44515
+ signedUrl = "";
44515
44516
  imageDimension;
44516
44517
  board;
44517
44518
  constructor({ base64, storageLink, imageDimension }, board, events, id = "") {
@@ -44535,8 +44536,13 @@ class ImageItem extends BaseItem {
44535
44536
  });
44536
44537
  this.transformation.subject.subscribe(this.onTransform);
44537
44538
  }
44538
- setStorageLink(link2) {
44539
+ async setStorageLink(link2) {
44540
+ console.log("setStorageLink", link2);
44539
44541
  this.storageLink = link2;
44542
+ console.log("board", this.board);
44543
+ console.log("accessToken", this.board.getAccount()?.accessToken());
44544
+ this.signedUrl = await getMediaSignedUrl(link2, this.board.getAccount()?.accessToken() || null) || "";
44545
+ this.image.src = this.signedUrl;
44540
44546
  }
44541
44547
  getStorageId() {
44542
44548
  return this.storageLink.split("/").pop();
@@ -44646,7 +44652,6 @@ class ImageItem extends BaseItem {
44646
44652
  this.onLoad();
44647
44653
  };
44648
44654
  storageImage.onerror = this.onError;
44649
- storageImage.src = this.storageLink;
44650
44655
  return this;
44651
44656
  }
44652
44657
  emit(operation) {
@@ -44683,6 +44688,7 @@ class ImageItem extends BaseItem {
44683
44688
  if (this.transformationRenderBlock) {
44684
44689
  return;
44685
44690
  }
44691
+ console.log(this);
44686
44692
  const ctx = context.ctx;
44687
44693
  ctx.save();
44688
44694
  this.transformation.matrix.applyToContext(ctx);
@@ -44758,7 +44764,7 @@ class ImageItem extends BaseItem {
44758
44764
  }
44759
44765
  download() {
44760
44766
  const linkElem = document.createElement("a");
44761
- linkElem.href = this.storageLink;
44767
+ linkElem.href = this.signedUrl;
44762
44768
  linkElem.setAttribute("download", "");
44763
44769
  linkElem.click();
44764
44770
  }
@@ -56048,6 +56054,7 @@ class Board {
56048
56054
  boardId;
56049
56055
  accessKey;
56050
56056
  saveEditingFile;
56057
+ account;
56051
56058
  events;
56052
56059
  isBoardMenuOpen = false;
56053
56060
  selection;
@@ -56070,10 +56077,11 @@ class Board {
56070
56077
  connecting = new Promise((resolve2) => {
56071
56078
  this.resolveConnecting = resolve2;
56072
56079
  });
56073
- constructor(boardId = "", accessKey, saveEditingFile) {
56080
+ constructor(boardId = "", accessKey, saveEditingFile, account) {
56074
56081
  this.boardId = boardId;
56075
56082
  this.accessKey = accessKey;
56076
56083
  this.saveEditingFile = saveEditingFile;
56084
+ this.account = account;
56077
56085
  this.selection = new BoardSelection(this);
56078
56086
  this.presence = new Presence(this);
56079
56087
  this.tools.navigate();
@@ -56085,6 +56093,9 @@ class Board {
56085
56093
  this.items = this.index.items;
56086
56094
  this.presence.events = this.events;
56087
56095
  }
56096
+ getAccount() {
56097
+ return this.account || null;
56098
+ }
56088
56099
  getNewItemId() {
56089
56100
  return v4_default();
56090
56101
  }
@@ -16,11 +16,13 @@ import { Subject } from "./Subject";
16
16
  import { Tools } from "./Tools";
17
17
  import { ItemsMap } from "./Validators";
18
18
  import { ItemDataWithId } from "./Items/Item";
19
+ import { Account } from "./types/Account";
19
20
  export type InterfaceType = "edit" | "view" | "loading";
20
21
  export declare class Board {
21
22
  private boardId;
22
23
  private accessKey?;
23
24
  saveEditingFile?: (() => Promise<void>) | undefined;
25
+ private account?;
24
26
  events: Events;
25
27
  private isBoardMenuOpen;
26
28
  readonly selection: BoardSelection;
@@ -41,11 +43,12 @@ export declare class Board {
41
43
  private isOpen;
42
44
  resolveConnecting: () => void;
43
45
  connecting: Promise<void>;
44
- constructor(boardId?: string, accessKey?: string | undefined, saveEditingFile?: (() => Promise<void>) | undefined);
46
+ constructor(boardId?: string, accessKey?: string | undefined, saveEditingFile?: (() => Promise<void>) | undefined, account?: Account | undefined);
45
47
  /**
46
48
  * Disconnects from the connection and sets the board mode to "loading"
47
49
  */
48
50
  disconnect(): void;
51
+ getAccount(): Account | null;
49
52
  getNewItemId(): string;
50
53
  emit(operation: BoardOps): void;
51
54
  getBoardId(): string;
@@ -39,10 +39,11 @@ export declare class ImageItem extends BaseItem {
39
39
  beforeLoadCallbacks: ((image: ImageItem) => void)[];
40
40
  transformationRenderBlock?: boolean;
41
41
  private storageLink;
42
+ private signedUrl;
42
43
  imageDimension: Dimension;
43
44
  board: Board;
44
45
  constructor({ base64, storageLink, imageDimension }: ImageConstructorData, board: Board, events?: Events | undefined, id?: string);
45
- setStorageLink(link: string): void;
46
+ setStorageLink(link: string): Promise<void>;
46
47
  getStorageId(): string | undefined;
47
48
  handleError: () => void;
48
49
  onLoad: () => Promise<void>;
@@ -0,0 +1,16 @@
1
+ import { Subject } from "../Subject";
2
+ type AccountInfo = {
3
+ id: number;
4
+ email?: string;
5
+ address?: string;
6
+ name: string;
7
+ avatar: string;
8
+ avatarGenerated: boolean;
9
+ newsletter: boolean;
10
+ };
11
+ export interface Account {
12
+ accessToken: () => string | null;
13
+ subject: Subject<AccountInfo | null>;
14
+ info: null | AccountInfo;
15
+ }
16
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.5.113",
3
+ "version": "0.5.115",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",