microboard-temp 0.2.0 → 0.2.2

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/esm/index.js CHANGED
@@ -8441,7 +8441,7 @@ if (typeof window !== "undefined" && window.sessionStorage) {
8441
8441
  _sessionStorage = new NodeStoragePolyfill;
8442
8442
  }
8443
8443
 
8444
- class SessionStorage2 {
8444
+ class SessionStorage {
8445
8445
  set(key, value) {
8446
8446
  const boardId = this.getBoardId() || "";
8447
8447
  _sessionStorage.setItem(boardId + "_" + key, JSON.stringify(value));
@@ -8573,7 +8573,7 @@ class SessionStorage2 {
8573
8573
  return window.location.href.split("/").pop()?.split("?")[0];
8574
8574
  }
8575
8575
  }
8576
- var tempStorage2 = new SessionStorage2;
8576
+ var tempStorage = new SessionStorage;
8577
8577
 
8578
8578
  // src/HTMLRender/HTMLRender.ts
8579
8579
  function getTranslationFromHTML(el) {
@@ -18158,7 +18158,7 @@ class RichText extends Mbr {
18158
18158
  counter = counter + 1;
18159
18159
  this.rtCounter = counter;
18160
18160
  this.linkTo = linkTo || new LinkTo(this.id, this.board.events);
18161
- let textSizeFromStorage = new SessionStorage2().getFontSize(insideOf || "RichText");
18161
+ let textSizeFromStorage = new SessionStorage().getFontSize(insideOf || "RichText");
18162
18162
  if (!textSizeFromStorage || textSizeFromStorage === "auto") {
18163
18163
  textSizeFromStorage = initialTextStyles.fontSize;
18164
18164
  }
@@ -37043,7 +37043,7 @@ class Shape extends BaseItem {
37043
37043
  this.updateMbr();
37044
37044
  }
37045
37045
  saveShapeData() {
37046
- tempStorage2.setShapeData({
37046
+ tempStorage.setShapeData({
37047
37047
  shapeType: this.shapeType,
37048
37048
  backgroundColor: this.backgroundColor,
37049
37049
  backgroundOpacity: this.backgroundOpacity,
@@ -37584,7 +37584,7 @@ class Sticker extends BaseItem {
37584
37584
  }
37585
37585
  }
37586
37586
  saveStickerData() {
37587
- const storage = new SessionStorage2;
37587
+ const storage = new SessionStorage;
37588
37588
  storage.setStickerData(this.serialize());
37589
37589
  }
37590
37590
  serialize() {
@@ -38097,8 +38097,8 @@ class Frame extends BaseItem {
38097
38097
  this.borderWidth = borderWidth;
38098
38098
  this.textContainer = Frames[this.shapeType].textBounds.copy();
38099
38099
  this.path = Frames[this.shapeType].path.copy();
38100
- this.transformation = new Transformation(this.id, this.board.events);
38101
- this.linkTo = new LinkTo(this.id, this.board.events);
38100
+ this.transformation = new Transformation(this.id, board.events);
38101
+ this.linkTo = new LinkTo(this.id, board.events);
38102
38102
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontColor: FRAME_TITLE_COLOR });
38103
38103
  this.text.setSelectionHorisontalAlignment("left");
38104
38104
  this.transformation.subject.subscribe(() => {
@@ -39009,7 +39009,7 @@ function calculatePosition(boardImage, board) {
39009
39009
  const centerPoint = viewportMbr.getCenter();
39010
39010
  const imageWidth = boardImage.getWidth();
39011
39011
  const imageHeight = boardImage.getHeight();
39012
- const prevDimensions = tempStorage2.getImageDimensions();
39012
+ const prevDimensions = tempStorage.getImageDimensions();
39013
39013
  if (prevDimensions) {
39014
39014
  const scaleX2 = prevDimensions.width / imageWidth;
39015
39015
  const scaleY2 = prevDimensions.height / imageHeight;
@@ -39030,7 +39030,7 @@ function calculatePosition(boardImage, board) {
39030
39030
  const finalScale = scaleToFit;
39031
39031
  const scaledImageWidth = imageWidth * finalScale;
39032
39032
  const scaledImageHeight = imageHeight * finalScale;
39033
- tempStorage2.setImageDimensions({
39033
+ tempStorage.setImageDimensions({
39034
39034
  width: scaledImageWidth,
39035
39035
  height: scaledImageHeight
39036
39036
  });
@@ -40287,7 +40287,7 @@ class ImageItem extends BaseItem {
40287
40287
  }
40288
40288
  }
40289
40289
  // src/isSafari.ts
40290
- function isSafari2() {
40290
+ function isSafari() {
40291
40291
  if (typeof navigator === "undefined") {
40292
40292
  return false;
40293
40293
  }
@@ -40393,8 +40393,8 @@ class Drawing extends BaseItem {
40393
40393
  const cy = (points[j].y + points[j + 1].y) / 2;
40394
40394
  context.quadraticCurveTo(points[j].x, points[j].y, cx, cy);
40395
40395
  }
40396
- const x = points[j].x === points[j + 1].x && isSafari2() ? points[j + 1].x + 0.01 : points[j + 1].x;
40397
- const y = points[j].y === points[j + 1].y && isSafari2() ? points[j + 1].y + 0.01 : points[j + 1].y;
40396
+ const x = points[j].x === points[j + 1].x && isSafari() ? points[j + 1].x + 0.01 : points[j + 1].x;
40397
+ const y = points[j].y === points[j + 1].y && isSafari() ? points[j + 1].y + 0.01 : points[j + 1].y;
40398
40398
  context.quadraticCurveTo(points[j].x, points[j].y, x, y);
40399
40399
  }
40400
40400
  let left = Number.MAX_SAFE_INTEGER;
@@ -40525,8 +40525,8 @@ class Drawing extends BaseItem {
40525
40525
  const cy = (points[j].y + points[j + 1].y) / 2;
40526
40526
  pathData += ` Q ${points[j].x} ${points[j].y} ${cx} ${cy}`;
40527
40527
  }
40528
- const x = points[j].x === points[j + 1].x && isSafari2() ? points[j + 1].x + 0.01 : points[j + 1].x;
40529
- const y = points[j].y === points[j + 1].y && isSafari2() ? points[j + 1].y + 0.01 : points[j + 1].y;
40528
+ const x = points[j].x === points[j + 1].x && isSafari() ? points[j + 1].x + 0.01 : points[j + 1].x;
40529
+ const y = points[j].y === points[j + 1].y && isSafari() ? points[j + 1].y + 0.01 : points[j + 1].y;
40530
40530
  pathData += ` Q ${points[j].x} ${points[j].y} ${x} ${y}`;
40531
40531
  }
40532
40532
  return pathData;
@@ -42073,7 +42073,7 @@ class AddShape extends BoardTool {
42073
42073
  constructor(board) {
42074
42074
  super(board);
42075
42075
  this.setCursor();
42076
- const data = tempStorage2.getShapeData();
42076
+ const data = tempStorage.getShapeData();
42077
42077
  if (data) {
42078
42078
  this.shape = new Shape(board, "", data.shapeType, data.backgroundColor, data.backgroundOpacity, data.borderColor, data.borderOpacity, data.borderStyle, data.borderWidth);
42079
42079
  this.setShapeType(data.shapeType);
@@ -42154,13 +42154,13 @@ class AddShape extends BoardTool {
42154
42154
  if (this.type === "None") {
42155
42155
  return false;
42156
42156
  }
42157
- const width2 = this.bounds.getWidth() < 2 ? tempStorage2.getShapeWidth() || 100 : this.bounds.getWidth();
42158
- const height2 = this.bounds.getHeight() < 2 ? tempStorage2.getShapeHeight() || 100 : this.bounds.getHeight();
42157
+ const width2 = this.bounds.getWidth() < 2 ? tempStorage.getShapeWidth() || 100 : this.bounds.getWidth();
42158
+ const height2 = this.bounds.getHeight() < 2 ? tempStorage.getShapeHeight() || 100 : this.bounds.getHeight();
42159
42159
  if (this.bounds.getWidth() > 2) {
42160
- tempStorage2.setShapeWidth(this.bounds.getWidth());
42160
+ tempStorage.setShapeWidth(this.bounds.getWidth());
42161
42161
  }
42162
42162
  if (this.bounds.getHeight() > 2) {
42163
- tempStorage2.setShapeHeight(this.bounds.getHeight());
42163
+ tempStorage.setShapeHeight(this.bounds.getHeight());
42164
42164
  }
42165
42165
  this.initTransformation(width2 / 100, height2 / 100);
42166
42166
  const shape = this.board.add(this.shape);
@@ -43348,7 +43348,7 @@ function getQuickAddButtons(selection, board) {
43348
43348
  let htmlButtons = undefined;
43349
43349
  let quickAddItems = undefined;
43350
43350
  function calculateQuickAddPosition(index2, selectedItem, connectorStartPoint) {
43351
- const connectorStorage = new SessionStorage2;
43351
+ const connectorStorage = new SessionStorage;
43352
43352
  const currMbr = selectedItem.getMbr();
43353
43353
  const selectedItemData = selectedItem.serialize();
43354
43354
  const width2 = selectedItem.itemType === "Shape" ? selectedItem.getPath().getMbr().getWidth() : currMbr.getWidth();
@@ -43411,7 +43411,7 @@ function getQuickAddButtons(selection, board) {
43411
43411
  const fontSize = selectedItem.itemType === "RichText" ? selectedItem.getFontSize() : 14;
43412
43412
  const newItem = board.createItem(board.getNewItemId(), newItemData);
43413
43413
  if (newItem.itemType === "RichText") {
43414
- const storage = new SessionStorage2;
43414
+ const storage = new SessionStorage;
43415
43415
  storage.setFontSize("RichText", fontSize);
43416
43416
  newItem.editor.selectWholeText();
43417
43417
  newItem.applySelectionFontSize(fontSize);
@@ -44958,6 +44958,11 @@ class StickerTool extends CustomTool {
44958
44958
  }
44959
44959
  }
44960
44960
 
44961
+ // src/api/isIfarme.ts
44962
+ var isIframe = () => {
44963
+ return window.self !== window.top;
44964
+ };
44965
+
44961
44966
  // src/Tools/Tools.ts
44962
44967
  var registeredTools = {};
44963
44968
 
@@ -47859,7 +47864,7 @@ class Presence {
47859
47864
  if (!ctx) {
47860
47865
  return;
47861
47866
  }
47862
- const anonTranslate = i18n.t("presence.anonymous");
47867
+ const anonTranslate = conf.i18n.t("presence.anonymous");
47863
47868
  const label = cursor.nickname === "Anonymous" ? anonTranslate : cursor.nickname;
47864
47869
  const textWidth = ctx.measureText(label).width;
47865
47870
  const labelHeight = 20 * scale;
@@ -50201,7 +50206,7 @@ function transformItems({
50201
50206
  return null;
50202
50207
  }
50203
50208
  if (single instanceof ImageItem) {
50204
- tempStorage2.setImageDimensions({
50209
+ tempStorage.setImageDimensions({
50205
50210
  width: resize.mbr.getWidth(),
50206
50211
  height: resize.mbr.getHeight()
50207
50212
  });
@@ -50960,12 +50965,12 @@ class BoardSelection {
50960
50965
  return;
50961
50966
  }
50962
50967
  if (text5.isEmpty()) {
50963
- const textColor = tempStorage2.getFontColor(item.itemType);
50964
- const textSize = tempStorage2.getFontSize(item.itemType);
50965
- const highlightColor = tempStorage2.getFontHighlight(item.itemType);
50966
- const styles = tempStorage2.getFontStyles(item.itemType);
50967
- const horizontalAlignment = tempStorage2.getHorizontalAlignment(item.itemType);
50968
- const verticalAlignment = tempStorage2.getVerticalAlignment(item.itemType);
50968
+ const textColor = tempStorage.getFontColor(item.itemType);
50969
+ const textSize = tempStorage.getFontSize(item.itemType);
50970
+ const highlightColor = tempStorage.getFontHighlight(item.itemType);
50971
+ const styles = tempStorage.getFontStyles(item.itemType);
50972
+ const horizontalAlignment = tempStorage.getHorizontalAlignment(item.itemType);
50973
+ const verticalAlignment = tempStorage.getVerticalAlignment(item.itemType);
50969
50974
  if (textColor) {
50970
50975
  text5.setSelectionFontColor(textColor, "None");
50971
50976
  }
@@ -51508,9 +51513,9 @@ class BoardSelection {
51508
51513
  ops
51509
51514
  });
51510
51515
  if (item.itemType === "Sticker" && fontSize === "auto") {
51511
- tempStorage2.remove(`fontSize_${item.itemType}`);
51516
+ tempStorage.remove(`fontSize_${item.itemType}`);
51512
51517
  } else if (item.itemType !== "AINode") {
51513
- tempStorage2.setFontSize(item.itemType, fontSize);
51518
+ tempStorage.setFontSize(item.itemType, fontSize);
51514
51519
  }
51515
51520
  }
51516
51521
  const emptyOps = itemsOps.filter((op) => !op.ops.length);
@@ -51548,7 +51553,7 @@ class BoardSelection {
51548
51553
  ops
51549
51554
  });
51550
51555
  if (item.itemType !== "AINode") {
51551
- tempStorage2.setFontStyles(item.itemType, text5.getFontStyles());
51556
+ tempStorage.setFontStyles(item.itemType, text5.getFontStyles());
51552
51557
  }
51553
51558
  }
51554
51559
  this.emitApplied({
@@ -51574,7 +51579,7 @@ class BoardSelection {
51574
51579
  selection: text5.editor.getSelection(),
51575
51580
  ops
51576
51581
  });
51577
- tempStorage2.setFontColor(item.itemType, fontColor);
51582
+ tempStorage.setFontColor(item.itemType, fontColor);
51578
51583
  }
51579
51584
  this.emitApplied({
51580
51585
  class: "RichText",
@@ -51618,7 +51623,7 @@ class BoardSelection {
51618
51623
  ops
51619
51624
  });
51620
51625
  if (item.itemType !== "AINode") {
51621
- tempStorage2.setFontHighlight(item.itemType, fontHighlight);
51626
+ tempStorage.setFontHighlight(item.itemType, fontHighlight);
51622
51627
  }
51623
51628
  }
51624
51629
  this.emitApplied({
@@ -51644,7 +51649,7 @@ class BoardSelection {
51644
51649
  selection: text5.editor.getSelection(),
51645
51650
  ops
51646
51651
  });
51647
- tempStorage2.setHorizontalAlignment(item.itemType, horisontalAlignment);
51652
+ tempStorage.setHorizontalAlignment(item.itemType, horisontalAlignment);
51648
51653
  }
51649
51654
  this.emitApplied({
51650
51655
  class: "RichText",
@@ -51668,7 +51673,7 @@ class BoardSelection {
51668
51673
  if (!text5) {
51669
51674
  return;
51670
51675
  }
51671
- tempStorage2.setVerticalAlignment(item.itemType, verticalAlignment);
51676
+ tempStorage.setVerticalAlignment(item.itemType, verticalAlignment);
51672
51677
  if (item instanceof RichText) {
51673
51678
  item.setEditorFocus(this.context);
51674
51679
  }
@@ -55265,7 +55270,7 @@ export {
55265
55270
  transformHtmlOrTextToMarkdown,
55266
55271
  toRelativePoint,
55267
55272
  toFiniteNumber,
55268
- tempStorage2 as tempStorage,
55273
+ tempStorage,
55269
55274
  tagByType,
55270
55275
  stickerColors,
55271
55276
  sha256,
@@ -55336,7 +55341,7 @@ export {
55336
55341
  Shapes,
55337
55342
  ShapeCommand,
55338
55343
  Shape,
55339
- SessionStorage2 as SessionStorage,
55344
+ SessionStorage,
55340
55345
  BoardSelection as Selection,
55341
55346
  STEP_STROKE_WIDTH,
55342
55347
  SHAPE_LAST_TYPE_KEY,
package/dist/esm/node.js CHANGED
@@ -9225,7 +9225,7 @@ if (typeof window !== "undefined" && window.sessionStorage) {
9225
9225
  _sessionStorage = new NodeStoragePolyfill;
9226
9226
  }
9227
9227
 
9228
- class SessionStorage2 {
9228
+ class SessionStorage {
9229
9229
  set(key, value) {
9230
9230
  const boardId = this.getBoardId() || "";
9231
9231
  _sessionStorage.setItem(boardId + "_" + key, JSON.stringify(value));
@@ -9357,7 +9357,7 @@ class SessionStorage2 {
9357
9357
  return window.location.href.split("/").pop()?.split("?")[0];
9358
9358
  }
9359
9359
  }
9360
- var tempStorage2 = new SessionStorage2;
9360
+ var tempStorage = new SessionStorage;
9361
9361
 
9362
9362
  // src/HTMLRender/HTMLRender.ts
9363
9363
  function getTranslationFromHTML(el) {
@@ -20693,7 +20693,7 @@ class RichText extends Mbr {
20693
20693
  counter = counter + 1;
20694
20694
  this.rtCounter = counter;
20695
20695
  this.linkTo = linkTo || new LinkTo(this.id, this.board.events);
20696
- let textSizeFromStorage = new SessionStorage2().getFontSize(insideOf || "RichText");
20696
+ let textSizeFromStorage = new SessionStorage().getFontSize(insideOf || "RichText");
20697
20697
  if (!textSizeFromStorage || textSizeFromStorage === "auto") {
20698
20698
  textSizeFromStorage = initialTextStyles.fontSize;
20699
20699
  }
@@ -39578,7 +39578,7 @@ class Shape extends BaseItem {
39578
39578
  this.updateMbr();
39579
39579
  }
39580
39580
  saveShapeData() {
39581
- tempStorage2.setShapeData({
39581
+ tempStorage.setShapeData({
39582
39582
  shapeType: this.shapeType,
39583
39583
  backgroundColor: this.backgroundColor,
39584
39584
  backgroundOpacity: this.backgroundOpacity,
@@ -40119,7 +40119,7 @@ class Sticker extends BaseItem {
40119
40119
  }
40120
40120
  }
40121
40121
  saveStickerData() {
40122
- const storage = new SessionStorage2;
40122
+ const storage = new SessionStorage;
40123
40123
  storage.setStickerData(this.serialize());
40124
40124
  }
40125
40125
  serialize() {
@@ -40632,8 +40632,8 @@ class Frame extends BaseItem {
40632
40632
  this.borderWidth = borderWidth;
40633
40633
  this.textContainer = Frames[this.shapeType].textBounds.copy();
40634
40634
  this.path = Frames[this.shapeType].path.copy();
40635
- this.transformation = new Transformation(this.id, this.board.events);
40636
- this.linkTo = new LinkTo(this.id, this.board.events);
40635
+ this.transformation = new Transformation(this.id, board.events);
40636
+ this.linkTo = new LinkTo(this.id, board.events);
40637
40637
  this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontColor: FRAME_TITLE_COLOR });
40638
40638
  this.text.setSelectionHorisontalAlignment("left");
40639
40639
  this.transformation.subject.subscribe(() => {
@@ -41544,7 +41544,7 @@ function calculatePosition(boardImage, board) {
41544
41544
  const centerPoint = viewportMbr.getCenter();
41545
41545
  const imageWidth = boardImage.getWidth();
41546
41546
  const imageHeight = boardImage.getHeight();
41547
- const prevDimensions = tempStorage2.getImageDimensions();
41547
+ const prevDimensions = tempStorage.getImageDimensions();
41548
41548
  if (prevDimensions) {
41549
41549
  const scaleX2 = prevDimensions.width / imageWidth;
41550
41550
  const scaleY2 = prevDimensions.height / imageHeight;
@@ -41565,7 +41565,7 @@ function calculatePosition(boardImage, board) {
41565
41565
  const finalScale = scaleToFit;
41566
41566
  const scaledImageWidth = imageWidth * finalScale;
41567
41567
  const scaledImageHeight = imageHeight * finalScale;
41568
- tempStorage2.setImageDimensions({
41568
+ tempStorage.setImageDimensions({
41569
41569
  width: scaledImageWidth,
41570
41570
  height: scaledImageHeight
41571
41571
  });
@@ -42822,7 +42822,7 @@ class ImageItem extends BaseItem {
42822
42822
  }
42823
42823
  }
42824
42824
  // src/isSafari.ts
42825
- function isSafari2() {
42825
+ function isSafari() {
42826
42826
  if (typeof navigator === "undefined") {
42827
42827
  return false;
42828
42828
  }
@@ -42928,8 +42928,8 @@ class Drawing extends BaseItem {
42928
42928
  const cy = (points[j].y + points[j + 1].y) / 2;
42929
42929
  context.quadraticCurveTo(points[j].x, points[j].y, cx, cy);
42930
42930
  }
42931
- const x = points[j].x === points[j + 1].x && isSafari2() ? points[j + 1].x + 0.01 : points[j + 1].x;
42932
- const y = points[j].y === points[j + 1].y && isSafari2() ? points[j + 1].y + 0.01 : points[j + 1].y;
42931
+ const x = points[j].x === points[j + 1].x && isSafari() ? points[j + 1].x + 0.01 : points[j + 1].x;
42932
+ const y = points[j].y === points[j + 1].y && isSafari() ? points[j + 1].y + 0.01 : points[j + 1].y;
42933
42933
  context.quadraticCurveTo(points[j].x, points[j].y, x, y);
42934
42934
  }
42935
42935
  let left = Number.MAX_SAFE_INTEGER;
@@ -43060,8 +43060,8 @@ class Drawing extends BaseItem {
43060
43060
  const cy = (points[j].y + points[j + 1].y) / 2;
43061
43061
  pathData += ` Q ${points[j].x} ${points[j].y} ${cx} ${cy}`;
43062
43062
  }
43063
- const x = points[j].x === points[j + 1].x && isSafari2() ? points[j + 1].x + 0.01 : points[j + 1].x;
43064
- const y = points[j].y === points[j + 1].y && isSafari2() ? points[j + 1].y + 0.01 : points[j + 1].y;
43063
+ const x = points[j].x === points[j + 1].x && isSafari() ? points[j + 1].x + 0.01 : points[j + 1].x;
43064
+ const y = points[j].y === points[j + 1].y && isSafari() ? points[j + 1].y + 0.01 : points[j + 1].y;
43065
43065
  pathData += ` Q ${points[j].x} ${points[j].y} ${x} ${y}`;
43066
43066
  }
43067
43067
  return pathData;
@@ -44608,7 +44608,7 @@ class AddShape extends BoardTool {
44608
44608
  constructor(board) {
44609
44609
  super(board);
44610
44610
  this.setCursor();
44611
- const data = tempStorage2.getShapeData();
44611
+ const data = tempStorage.getShapeData();
44612
44612
  if (data) {
44613
44613
  this.shape = new Shape(board, "", data.shapeType, data.backgroundColor, data.backgroundOpacity, data.borderColor, data.borderOpacity, data.borderStyle, data.borderWidth);
44614
44614
  this.setShapeType(data.shapeType);
@@ -44689,13 +44689,13 @@ class AddShape extends BoardTool {
44689
44689
  if (this.type === "None") {
44690
44690
  return false;
44691
44691
  }
44692
- const width2 = this.bounds.getWidth() < 2 ? tempStorage2.getShapeWidth() || 100 : this.bounds.getWidth();
44693
- const height2 = this.bounds.getHeight() < 2 ? tempStorage2.getShapeHeight() || 100 : this.bounds.getHeight();
44692
+ const width2 = this.bounds.getWidth() < 2 ? tempStorage.getShapeWidth() || 100 : this.bounds.getWidth();
44693
+ const height2 = this.bounds.getHeight() < 2 ? tempStorage.getShapeHeight() || 100 : this.bounds.getHeight();
44694
44694
  if (this.bounds.getWidth() > 2) {
44695
- tempStorage2.setShapeWidth(this.bounds.getWidth());
44695
+ tempStorage.setShapeWidth(this.bounds.getWidth());
44696
44696
  }
44697
44697
  if (this.bounds.getHeight() > 2) {
44698
- tempStorage2.setShapeHeight(this.bounds.getHeight());
44698
+ tempStorage.setShapeHeight(this.bounds.getHeight());
44699
44699
  }
44700
44700
  this.initTransformation(width2 / 100, height2 / 100);
44701
44701
  const shape = this.board.add(this.shape);
@@ -45883,7 +45883,7 @@ function getQuickAddButtons(selection, board) {
45883
45883
  let htmlButtons = undefined;
45884
45884
  let quickAddItems = undefined;
45885
45885
  function calculateQuickAddPosition(index2, selectedItem, connectorStartPoint) {
45886
- const connectorStorage = new SessionStorage2;
45886
+ const connectorStorage = new SessionStorage;
45887
45887
  const currMbr = selectedItem.getMbr();
45888
45888
  const selectedItemData = selectedItem.serialize();
45889
45889
  const width2 = selectedItem.itemType === "Shape" ? selectedItem.getPath().getMbr().getWidth() : currMbr.getWidth();
@@ -45946,7 +45946,7 @@ function getQuickAddButtons(selection, board) {
45946
45946
  const fontSize = selectedItem.itemType === "RichText" ? selectedItem.getFontSize() : 14;
45947
45947
  const newItem = board.createItem(board.getNewItemId(), newItemData);
45948
45948
  if (newItem.itemType === "RichText") {
45949
- const storage = new SessionStorage2;
45949
+ const storage = new SessionStorage;
45950
45950
  storage.setFontSize("RichText", fontSize);
45951
45951
  newItem.editor.selectWholeText();
45952
45952
  newItem.applySelectionFontSize(fontSize);
@@ -47493,6 +47493,11 @@ class StickerTool extends CustomTool {
47493
47493
  }
47494
47494
  }
47495
47495
 
47496
+ // src/api/isIfarme.ts
47497
+ var isIframe = () => {
47498
+ return window.self !== window.top;
47499
+ };
47500
+
47496
47501
  // src/Tools/Tools.ts
47497
47502
  var registeredTools = {};
47498
47503
 
@@ -50394,7 +50399,7 @@ class Presence {
50394
50399
  if (!ctx) {
50395
50400
  return;
50396
50401
  }
50397
- const anonTranslate = i18n.t("presence.anonymous");
50402
+ const anonTranslate = conf.i18n.t("presence.anonymous");
50398
50403
  const label = cursor.nickname === "Anonymous" ? anonTranslate : cursor.nickname;
50399
50404
  const textWidth = ctx.measureText(label).width;
50400
50405
  const labelHeight = 20 * scale;
@@ -52669,7 +52674,7 @@ function transformItems({
52669
52674
  return null;
52670
52675
  }
52671
52676
  if (single instanceof ImageItem) {
52672
- tempStorage2.setImageDimensions({
52677
+ tempStorage.setImageDimensions({
52673
52678
  width: resize.mbr.getWidth(),
52674
52679
  height: resize.mbr.getHeight()
52675
52680
  });
@@ -53428,12 +53433,12 @@ class BoardSelection {
53428
53433
  return;
53429
53434
  }
53430
53435
  if (text5.isEmpty()) {
53431
- const textColor = tempStorage2.getFontColor(item.itemType);
53432
- const textSize = tempStorage2.getFontSize(item.itemType);
53433
- const highlightColor = tempStorage2.getFontHighlight(item.itemType);
53434
- const styles = tempStorage2.getFontStyles(item.itemType);
53435
- const horizontalAlignment = tempStorage2.getHorizontalAlignment(item.itemType);
53436
- const verticalAlignment = tempStorage2.getVerticalAlignment(item.itemType);
53436
+ const textColor = tempStorage.getFontColor(item.itemType);
53437
+ const textSize = tempStorage.getFontSize(item.itemType);
53438
+ const highlightColor = tempStorage.getFontHighlight(item.itemType);
53439
+ const styles = tempStorage.getFontStyles(item.itemType);
53440
+ const horizontalAlignment = tempStorage.getHorizontalAlignment(item.itemType);
53441
+ const verticalAlignment = tempStorage.getVerticalAlignment(item.itemType);
53437
53442
  if (textColor) {
53438
53443
  text5.setSelectionFontColor(textColor, "None");
53439
53444
  }
@@ -53976,9 +53981,9 @@ class BoardSelection {
53976
53981
  ops
53977
53982
  });
53978
53983
  if (item.itemType === "Sticker" && fontSize === "auto") {
53979
- tempStorage2.remove(`fontSize_${item.itemType}`);
53984
+ tempStorage.remove(`fontSize_${item.itemType}`);
53980
53985
  } else if (item.itemType !== "AINode") {
53981
- tempStorage2.setFontSize(item.itemType, fontSize);
53986
+ tempStorage.setFontSize(item.itemType, fontSize);
53982
53987
  }
53983
53988
  }
53984
53989
  const emptyOps = itemsOps.filter((op) => !op.ops.length);
@@ -54016,7 +54021,7 @@ class BoardSelection {
54016
54021
  ops
54017
54022
  });
54018
54023
  if (item.itemType !== "AINode") {
54019
- tempStorage2.setFontStyles(item.itemType, text5.getFontStyles());
54024
+ tempStorage.setFontStyles(item.itemType, text5.getFontStyles());
54020
54025
  }
54021
54026
  }
54022
54027
  this.emitApplied({
@@ -54042,7 +54047,7 @@ class BoardSelection {
54042
54047
  selection: text5.editor.getSelection(),
54043
54048
  ops
54044
54049
  });
54045
- tempStorage2.setFontColor(item.itemType, fontColor);
54050
+ tempStorage.setFontColor(item.itemType, fontColor);
54046
54051
  }
54047
54052
  this.emitApplied({
54048
54053
  class: "RichText",
@@ -54086,7 +54091,7 @@ class BoardSelection {
54086
54091
  ops
54087
54092
  });
54088
54093
  if (item.itemType !== "AINode") {
54089
- tempStorage2.setFontHighlight(item.itemType, fontHighlight);
54094
+ tempStorage.setFontHighlight(item.itemType, fontHighlight);
54090
54095
  }
54091
54096
  }
54092
54097
  this.emitApplied({
@@ -54112,7 +54117,7 @@ class BoardSelection {
54112
54117
  selection: text5.editor.getSelection(),
54113
54118
  ops
54114
54119
  });
54115
- tempStorage2.setHorizontalAlignment(item.itemType, horisontalAlignment);
54120
+ tempStorage.setHorizontalAlignment(item.itemType, horisontalAlignment);
54116
54121
  }
54117
54122
  this.emitApplied({
54118
54123
  class: "RichText",
@@ -54136,7 +54141,7 @@ class BoardSelection {
54136
54141
  if (!text5) {
54137
54142
  return;
54138
54143
  }
54139
- tempStorage2.setVerticalAlignment(item.itemType, verticalAlignment);
54144
+ tempStorage.setVerticalAlignment(item.itemType, verticalAlignment);
54140
54145
  if (item instanceof RichText) {
54141
54146
  item.setEditorFocus(this.context);
54142
54147
  }
@@ -57888,7 +57893,7 @@ export {
57888
57893
  transformHtmlOrTextToMarkdown,
57889
57894
  toRelativePoint,
57890
57895
  toFiniteNumber,
57891
- tempStorage2 as tempStorage,
57896
+ tempStorage,
57892
57897
  tagByType,
57893
57898
  stickerColors,
57894
57899
  sha256,
@@ -57959,7 +57964,7 @@ export {
57959
57964
  Shapes,
57960
57965
  ShapeCommand,
57961
57966
  Shape,
57962
- SessionStorage2 as SessionStorage,
57967
+ SessionStorage,
57963
57968
  BoardSelection as Selection,
57964
57969
  STEP_STROKE_WIDTH,
57965
57970
  SHAPE_LAST_TYPE_KEY,
@@ -1,7 +1,7 @@
1
1
  import { Board, BoardSnapshot } from 'Board';
2
2
  import { BoardEvent, BoardEventPack, SyncBoardEvent, SyncEvent } from '../Events';
3
3
  import { EventsList } from './createEventsList';
4
- import { Command } from 'Plugin';
4
+ import { Command } from '../Command';
5
5
  export interface HistoryRecord {
6
6
  event: BoardEvent;
7
7
  command: Command;
@@ -1,7 +1,7 @@
1
- import { Command } from "Plugin";
2
1
  import { BoardEvent } from "../Events";
3
2
  import { SyncLog, SyncLogSubject } from "../SyncLog";
4
3
  import { HistoryRecord } from "./EventsLog";
4
+ import { Command } from "../Command";
5
5
  export type FilterPredicate = (value: HistoryRecord, index: number, array: HistoryRecord[]) => boolean;
6
6
  export interface EventsList {
7
7
  addConfirmedRecords(records: HistoryRecord[]): void;
@@ -0,0 +1,76 @@
1
+ import { AiChatMsg, Board, BoardEventMsg, ConfirmationMsg, ModeMsg, PresenceEventMsg, PresenceEventType, SnapshotRequestMsg, UserJoinMsg } from "index";
2
+ import { SyncBoardEventPack } from "Events/Events";
3
+ export interface AuthMsg {
4
+ type: "Auth";
5
+ jwt: string;
6
+ }
7
+ export interface LogoutMsg {
8
+ type: "Logout";
9
+ }
10
+ export interface InvalidateRightsMsg {
11
+ type: "InvalidateRights";
12
+ boardId: string;
13
+ byUser: boolean;
14
+ }
15
+ export interface GetModeMsg {
16
+ type: "GetMode";
17
+ boardId: string;
18
+ }
19
+ export interface SubscribeMsg {
20
+ type: "Subscribe";
21
+ boardId: string;
22
+ userId: string;
23
+ index: number;
24
+ accessKey?: string;
25
+ }
26
+ export interface UnsubscribeMsg {
27
+ type: "Unsubscribe";
28
+ boardId: string;
29
+ }
30
+ export interface ErrorMsg {
31
+ type: "Error";
32
+ message: string;
33
+ deniedBoardId?: string;
34
+ expectedSequence?: number;
35
+ receivedSequence?: number;
36
+ }
37
+ export interface VersionCheckMsg {
38
+ type: "VersionCheck";
39
+ version: string;
40
+ }
41
+ export interface AuthConfirmationMsg {
42
+ type: "AuthConfirmation";
43
+ }
44
+ export interface PingMsg {
45
+ type: "ping";
46
+ }
47
+ export interface BoardAccessDeniedMsg {
48
+ type: "BoardAccessDenied";
49
+ boardId: string;
50
+ }
51
+ export interface BoardSubscriptionCompletedMsg {
52
+ type: "BoardSubscriptionCompleted";
53
+ boardId: string;
54
+ mode: "view" | "edit";
55
+ snapshot: string | null;
56
+ eventsSinceLastSnapshot: SyncBoardEventPack[];
57
+ initialSequenceNumber: number;
58
+ }
59
+ export type EventsMsg = ModeMsg | BoardEventMsg | SnapshotRequestMsg | ConfirmationMsg | BoardSubscriptionCompletedMsg | UserJoinMsg | PresenceEventMsg | AiChatMsg;
60
+ export type SocketMsg = EventsMsg | AuthMsg | AuthConfirmationMsg | LogoutMsg | GetModeMsg | InvalidateRightsMsg | UserJoinMsg | SubscribeMsg | UnsubscribeMsg | VersionCheckMsg | ErrorMsg | ModeMsg | PingMsg | AiChatMsg | BoardAccessDeniedMsg;
61
+ export interface Connection {
62
+ connectionId: number;
63
+ getCurrentUser: () => string;
64
+ connect(): Promise<void>;
65
+ subscribe(board: Board): void;
66
+ unsubscribe(board: Board): void;
67
+ publishPresenceEvent(boardId: string, event: PresenceEventType): void;
68
+ publishAuth(): Promise<void>;
69
+ publishLogout(): void;
70
+ onMessage?: (msg: SocketMsg) => void;
71
+ onAccessDenied: (boardId: string, forceUpdate?: boolean) => void;
72
+ notifyAboutLostConnection: () => void;
73
+ dismissNotificationAboutLostConnection: () => void;
74
+ resetConnection: () => void;
75
+ send: (msg: SocketMsg) => void;
76
+ }
@@ -1,5 +1,5 @@
1
- import { EventsMsg } from "App/Connection";
2
1
  import { Board } from "Board";
2
+ import { EventsMsg } from "./boardMessageInterface";
3
3
  type MessageHandler<T extends EventsMsg = EventsMsg> = (message: T, board: Board) => void;
4
4
  export interface MessageRouter {
5
5
  addHandler: <T extends EventsMsg>(type: string, handler: MessageHandler<T>) => void;
@@ -1,5 +1,5 @@
1
- import { BoardSubscriptionCompletedMsg } from 'App/Connection';
2
1
  import { Board } from 'Board';
2
+ import { BoardSubscriptionCompletedMsg } from './boardMessageInterface';
3
3
  export declare function handleBoardSubscriptionCompletedMsg(msg: BoardSubscriptionCompletedMsg, board: Board): void;
4
4
  export declare function handleSeqNumApplication(initialSequenceNumber: number, board: Board): void;
5
5
  export declare function startIntervals(board: Board): void;
@@ -4,3 +4,4 @@ export type { BoardEventMsg } from "./handleBoardEventMessage";
4
4
  export type { ConfirmationMsg } from "./handleConfirmation";
5
5
  export type { SnapshotRequestMsg } from "./handleCreateSnapshotRequestMessage";
6
6
  export type { ModeMsg } from "./handleModeMessage";
7
+ export * from "./boardMessageInterface";
@@ -1,2 +1,2 @@
1
- import { HistoryRecord } from "./EventsLog";
1
+ import type { HistoryRecord } from "./Log";
2
2
  export declare function mergeRecords(records: HistoryRecord[]): HistoryRecord[];
@@ -1,7 +0,0 @@
1
- import { BlockNode } from '../Editor/BlockNode';
2
- import { LayoutBlockNodes } from './LayoutBlockNodes';
3
- import { Descendant } from 'slate';
4
- export declare function getBlockNodes(data: BlockNode[], maxWidth: number, shrink?: boolean, isFrame?: boolean): LayoutBlockNodes;
5
- export declare function getOneCharacterMaxWidth(data: Descendant[]): number;
6
- export declare function measureText(fontSize: any, fontFamily: any, text: any): TextMetrics;
7
- export declare function findMinimumWidthForSingleLineHeight(data: BlockNode[], singleLineHeight: number, maxWidth: number): number;
@@ -0,0 +1 @@
1
+ export declare const isIframe: () => boolean;