microboard-temp 0.1.16 → 0.1.17

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.
@@ -2186,7 +2186,7 @@ __export(exports_browser, {
2186
2186
  RichText: () => RichText,
2187
2187
  QuadraticBezier: () => QuadraticBezier,
2188
2188
  Presence: () => Presence,
2189
- Pointer: () => Pointer2,
2189
+ Pointer: () => Pointer,
2190
2190
  Point: () => Point,
2191
2191
  Placeholder: () => Placeholder,
2192
2192
  Paths: () => Paths,
@@ -5133,6 +5133,63 @@ class MockPath2D {
5133
5133
  }
5134
5134
  }
5135
5135
 
5136
+ // src/Subject.ts
5137
+ class Subject {
5138
+ observers = [];
5139
+ subscribe(observer) {
5140
+ const index = this.observers.indexOf(observer);
5141
+ if (index === -1) {
5142
+ this.observers.push(observer);
5143
+ }
5144
+ }
5145
+ unsubscribe(observer) {
5146
+ const index = this.observers.indexOf(observer);
5147
+ if (index !== -1) {
5148
+ this.observers.splice(index, 1);
5149
+ }
5150
+ }
5151
+ publish(object) {
5152
+ for (const observer of this.observers) {
5153
+ observer(object);
5154
+ }
5155
+ }
5156
+ }
5157
+
5158
+ // src/Pointer/Pointer.ts
5159
+ var cursorsMap = {};
5160
+
5161
+ class Pointer {
5162
+ point = new Point;
5163
+ subject = new Subject;
5164
+ previous = new Point;
5165
+ delta = new Point;
5166
+ cursor = "default";
5167
+ setCursor(cursor) {
5168
+ if (this.cursor !== cursor) {
5169
+ if (cursor in cursorsMap) {
5170
+ this.cursor = cursorsMap[cursor];
5171
+ } else {
5172
+ this.cursor = cursor;
5173
+ }
5174
+ this.subject.publish(this);
5175
+ }
5176
+ }
5177
+ getCursor() {
5178
+ return this.cursor;
5179
+ }
5180
+ pointTo(x, y) {
5181
+ this.previous.x = this.point.x;
5182
+ this.previous.y = this.point.y;
5183
+ this.delta.x = x - this.point.x;
5184
+ this.delta.y = y - this.point.y;
5185
+ this.point.x = x;
5186
+ this.point.y = y;
5187
+ }
5188
+ moveBy(x, y) {
5189
+ this.point.transform(new Matrix2(x, y));
5190
+ }
5191
+ }
5192
+
5136
5193
  // src/Settings.ts
5137
5194
  var ExportQuality;
5138
5195
  ((ExportQuality2) => {
@@ -5465,7 +5522,8 @@ var conf2 = {
5465
5522
  LOG_HOTKEYS: false,
5466
5523
  FORCE_HOTKEYS: "auto",
5467
5524
  debug: false,
5468
- FALLBACK_LNG: "en"
5525
+ FALLBACK_LNG: "en",
5526
+ cursorsMap
5469
5527
  };
5470
5528
 
5471
5529
  // src/Items/Transformation/Matrix.ts
@@ -6860,28 +6918,6 @@ class Paths {
6860
6918
  return !isAllPathsOpened;
6861
6919
  }
6862
6920
  }
6863
- // src/Subject.ts
6864
- class Subject {
6865
- observers = [];
6866
- subscribe(observer) {
6867
- const index = this.observers.indexOf(observer);
6868
- if (index === -1) {
6869
- this.observers.push(observer);
6870
- }
6871
- }
6872
- unsubscribe(observer) {
6873
- const index = this.observers.indexOf(observer);
6874
- if (index !== -1) {
6875
- this.observers.splice(index, 1);
6876
- }
6877
- }
6878
- publish(object) {
6879
- for (const observer of this.observers) {
6880
- observer(object);
6881
- }
6882
- }
6883
- }
6884
-
6885
6921
  // src/Items/Connector/ConnectorCommand.ts
6886
6922
  class ConnectorCommand {
6887
6923
  connector;
@@ -47072,40 +47108,6 @@ class Comment2 {
47072
47108
  return div;
47073
47109
  }
47074
47110
  }
47075
- // src/Pointer/Pointer.ts
47076
- var cursorsMap = {};
47077
-
47078
- class Pointer2 {
47079
- point = new Point;
47080
- subject = new Subject;
47081
- previous = new Point;
47082
- delta = new Point;
47083
- cursor = "default";
47084
- setCursor(cursor) {
47085
- if (this.cursor !== cursor) {
47086
- if (cursor in cursorsMap) {
47087
- this.cursor = cursorsMap[cursor];
47088
- } else {
47089
- this.cursor = cursor;
47090
- }
47091
- this.subject.publish(this);
47092
- }
47093
- }
47094
- getCursor() {
47095
- return this.cursor;
47096
- }
47097
- pointTo(x, y) {
47098
- this.previous.x = this.point.x;
47099
- this.previous.y = this.point.y;
47100
- this.delta.x = x - this.point.x;
47101
- this.delta.y = y - this.point.y;
47102
- this.point.x = x;
47103
- this.point.y = y;
47104
- }
47105
- moveBy(x, y) {
47106
- this.point.transform(new Matrix2(x, y));
47107
- }
47108
- }
47109
47111
  // src/Pointer/Cursor.ts
47110
47112
  var defaultCursors = [
47111
47113
  "default",
@@ -47205,7 +47207,7 @@ class Camera {
47205
47207
  observableItem = null;
47206
47208
  throttledZoom;
47207
47209
  isAnimating = false;
47208
- constructor(boardPointer = new Pointer2) {
47210
+ constructor(boardPointer = new Pointer) {
47209
47211
  this.boardPointer = boardPointer;
47210
47212
  this.subject.subscribe((_camera) => {
47211
47213
  this.saveMatrixSnapshot();
@@ -52895,7 +52897,7 @@ function getQuickAddButtons(selection, board) {
52895
52897
  let htmlButtons = undefined;
52896
52898
  let quickAddItems = undefined;
52897
52899
  function calculateQuickAddPosition(index2, selectedItem, connectorStartPoint) {
52898
- const connectorStorage = new SessionStorage;
52900
+ const connectorStorage = new SessionStorage2;
52899
52901
  const currMbr = selectedItem.getMbr();
52900
52902
  const selectedItemData = selectedItem.serialize();
52901
52903
  const width2 = selectedItem.itemType === "Shape" ? selectedItem.getPath().getMbr().getWidth() : currMbr.getWidth();
@@ -52958,7 +52960,7 @@ function getQuickAddButtons(selection, board) {
52958
52960
  const fontSize = selectedItem.itemType === "RichText" ? selectedItem.getFontSize() : 14;
52959
52961
  const newItem = board.createItem(board.getNewItemId(), newItemData);
52960
52962
  if (newItem.itemType === "RichText") {
52961
- const storage = new SessionStorage;
52963
+ const storage = new SessionStorage2;
52962
52964
  storage.setFontSize("RichText", fontSize);
52963
52965
  newItem.editor.selectWholeText();
52964
52966
  newItem.applySelectionFontSize(fontSize);
@@ -56209,7 +56211,6 @@ var defaultShapeData2 = new DefaultShapeData;
56209
56211
 
56210
56212
  class BoardSelection {
56211
56213
  board;
56212
- events;
56213
56214
  subject = new Subject;
56214
56215
  itemSubject = new Subject;
56215
56216
  itemsSubject = new Subject;
@@ -56224,9 +56225,8 @@ class BoardSelection {
56224
56225
  quickAddButtons;
56225
56226
  showQuickAddPanel = false;
56226
56227
  memorySnapshot = null;
56227
- constructor(board, events2) {
56228
+ constructor(board) {
56228
56229
  this.board = board;
56229
- this.events = events2;
56230
56230
  safeRequestAnimationFrame(this.updateScheduledObservers);
56231
56231
  this.tool = new SelectionTransformer(board, this);
56232
56232
  this.quickAddButtons = getQuickAddButtons(this, board);
@@ -56286,22 +56286,22 @@ class BoardSelection {
56286
56286
  }
56287
56287
  }
56288
56288
  emit(operation) {
56289
- if (!this.events) {
56289
+ if (!this.board.events) {
56290
56290
  return;
56291
56291
  }
56292
56292
  const command = createCommand(this.board, operation);
56293
56293
  command.apply();
56294
- this.events.emit(operation, command);
56294
+ this.board.events.emit(operation, command);
56295
56295
  }
56296
56296
  emitApplied(operation) {
56297
56297
  this.emitCommand(operation);
56298
56298
  }
56299
56299
  emitCommand(operation) {
56300
- if (!this.events) {
56300
+ if (!this.board.events) {
56301
56301
  return null;
56302
56302
  }
56303
56303
  const command = createCommand(this.board, operation);
56304
- this.events.emit(operation, command);
56304
+ this.board.events.emit(operation, command);
56305
56305
  return command;
56306
56306
  }
56307
56307
  updateQueue = new Set;
@@ -57384,7 +57384,7 @@ class Board {
57384
57384
  isBoardMenuOpen = false;
57385
57385
  selection;
57386
57386
  tools = new Tools(this);
57387
- pointer = new Pointer2;
57387
+ pointer = new Pointer;
57388
57388
  aiGeneratingOnItem = undefined;
57389
57389
  aiImagePlaceholder = undefined;
57390
57390
  aiImageConnectorID = undefined;
@@ -57406,7 +57406,7 @@ class Board {
57406
57406
  this.boardId = boardId;
57407
57407
  this.accessKey = accessKey;
57408
57408
  this.saveEditingFile = saveEditingFile;
57409
- this.selection = new BoardSelection(this, this.events);
57409
+ this.selection = new BoardSelection(this);
57410
57410
  this.presence = new Presence(this);
57411
57411
  this.tools.navigate();
57412
57412
  }
@@ -57415,11 +57415,10 @@ class Board {
57415
57415
  this.events.connection?.unsubscribe(this);
57416
57416
  this.index = new SpatialIndex(this.camera, this.pointer);
57417
57417
  this.items = this.index.items;
57418
- this.selection.events = this.events;
57419
57418
  this.presence.events = this.events;
57420
57419
  }
57421
57420
  getNewItemId() {
57422
- return uuidv4();
57421
+ return v4_default();
57423
57422
  }
57424
57423
  emit(operation) {
57425
57424
  if (this.events) {
package/dist/cjs/index.js CHANGED
@@ -2186,7 +2186,7 @@ __export(exports_src, {
2186
2186
  RichText: () => RichText,
2187
2187
  QuadraticBezier: () => QuadraticBezier,
2188
2188
  Presence: () => Presence,
2189
- Pointer: () => Pointer2,
2189
+ Pointer: () => Pointer,
2190
2190
  Point: () => Point,
2191
2191
  Placeholder: () => Placeholder,
2192
2192
  Paths: () => Paths,
@@ -5133,6 +5133,63 @@ class MockPath2D {
5133
5133
  }
5134
5134
  }
5135
5135
 
5136
+ // src/Subject.ts
5137
+ class Subject {
5138
+ observers = [];
5139
+ subscribe(observer) {
5140
+ const index = this.observers.indexOf(observer);
5141
+ if (index === -1) {
5142
+ this.observers.push(observer);
5143
+ }
5144
+ }
5145
+ unsubscribe(observer) {
5146
+ const index = this.observers.indexOf(observer);
5147
+ if (index !== -1) {
5148
+ this.observers.splice(index, 1);
5149
+ }
5150
+ }
5151
+ publish(object) {
5152
+ for (const observer of this.observers) {
5153
+ observer(object);
5154
+ }
5155
+ }
5156
+ }
5157
+
5158
+ // src/Pointer/Pointer.ts
5159
+ var cursorsMap = {};
5160
+
5161
+ class Pointer {
5162
+ point = new Point;
5163
+ subject = new Subject;
5164
+ previous = new Point;
5165
+ delta = new Point;
5166
+ cursor = "default";
5167
+ setCursor(cursor) {
5168
+ if (this.cursor !== cursor) {
5169
+ if (cursor in cursorsMap) {
5170
+ this.cursor = cursorsMap[cursor];
5171
+ } else {
5172
+ this.cursor = cursor;
5173
+ }
5174
+ this.subject.publish(this);
5175
+ }
5176
+ }
5177
+ getCursor() {
5178
+ return this.cursor;
5179
+ }
5180
+ pointTo(x, y) {
5181
+ this.previous.x = this.point.x;
5182
+ this.previous.y = this.point.y;
5183
+ this.delta.x = x - this.point.x;
5184
+ this.delta.y = y - this.point.y;
5185
+ this.point.x = x;
5186
+ this.point.y = y;
5187
+ }
5188
+ moveBy(x, y) {
5189
+ this.point.transform(new Matrix2(x, y));
5190
+ }
5191
+ }
5192
+
5136
5193
  // src/Settings.ts
5137
5194
  var ExportQuality;
5138
5195
  ((ExportQuality2) => {
@@ -5465,7 +5522,8 @@ var conf2 = {
5465
5522
  LOG_HOTKEYS: false,
5466
5523
  FORCE_HOTKEYS: "auto",
5467
5524
  debug: false,
5468
- FALLBACK_LNG: "en"
5525
+ FALLBACK_LNG: "en",
5526
+ cursorsMap
5469
5527
  };
5470
5528
 
5471
5529
  // src/Items/Transformation/Matrix.ts
@@ -6860,28 +6918,6 @@ class Paths {
6860
6918
  return !isAllPathsOpened;
6861
6919
  }
6862
6920
  }
6863
- // src/Subject.ts
6864
- class Subject {
6865
- observers = [];
6866
- subscribe(observer) {
6867
- const index = this.observers.indexOf(observer);
6868
- if (index === -1) {
6869
- this.observers.push(observer);
6870
- }
6871
- }
6872
- unsubscribe(observer) {
6873
- const index = this.observers.indexOf(observer);
6874
- if (index !== -1) {
6875
- this.observers.splice(index, 1);
6876
- }
6877
- }
6878
- publish(object) {
6879
- for (const observer of this.observers) {
6880
- observer(object);
6881
- }
6882
- }
6883
- }
6884
-
6885
6921
  // src/Items/Connector/ConnectorCommand.ts
6886
6922
  class ConnectorCommand {
6887
6923
  connector;
@@ -47072,40 +47108,6 @@ class Comment2 {
47072
47108
  return div;
47073
47109
  }
47074
47110
  }
47075
- // src/Pointer/Pointer.ts
47076
- var cursorsMap = {};
47077
-
47078
- class Pointer2 {
47079
- point = new Point;
47080
- subject = new Subject;
47081
- previous = new Point;
47082
- delta = new Point;
47083
- cursor = "default";
47084
- setCursor(cursor) {
47085
- if (this.cursor !== cursor) {
47086
- if (cursor in cursorsMap) {
47087
- this.cursor = cursorsMap[cursor];
47088
- } else {
47089
- this.cursor = cursor;
47090
- }
47091
- this.subject.publish(this);
47092
- }
47093
- }
47094
- getCursor() {
47095
- return this.cursor;
47096
- }
47097
- pointTo(x, y) {
47098
- this.previous.x = this.point.x;
47099
- this.previous.y = this.point.y;
47100
- this.delta.x = x - this.point.x;
47101
- this.delta.y = y - this.point.y;
47102
- this.point.x = x;
47103
- this.point.y = y;
47104
- }
47105
- moveBy(x, y) {
47106
- this.point.transform(new Matrix2(x, y));
47107
- }
47108
- }
47109
47111
  // src/Pointer/Cursor.ts
47110
47112
  var defaultCursors = [
47111
47113
  "default",
@@ -47205,7 +47207,7 @@ class Camera {
47205
47207
  observableItem = null;
47206
47208
  throttledZoom;
47207
47209
  isAnimating = false;
47208
- constructor(boardPointer = new Pointer2) {
47210
+ constructor(boardPointer = new Pointer) {
47209
47211
  this.boardPointer = boardPointer;
47210
47212
  this.subject.subscribe((_camera) => {
47211
47213
  this.saveMatrixSnapshot();
@@ -52895,7 +52897,7 @@ function getQuickAddButtons(selection, board) {
52895
52897
  let htmlButtons = undefined;
52896
52898
  let quickAddItems = undefined;
52897
52899
  function calculateQuickAddPosition(index2, selectedItem, connectorStartPoint) {
52898
- const connectorStorage = new SessionStorage;
52900
+ const connectorStorage = new SessionStorage2;
52899
52901
  const currMbr = selectedItem.getMbr();
52900
52902
  const selectedItemData = selectedItem.serialize();
52901
52903
  const width2 = selectedItem.itemType === "Shape" ? selectedItem.getPath().getMbr().getWidth() : currMbr.getWidth();
@@ -52958,7 +52960,7 @@ function getQuickAddButtons(selection, board) {
52958
52960
  const fontSize = selectedItem.itemType === "RichText" ? selectedItem.getFontSize() : 14;
52959
52961
  const newItem = board.createItem(board.getNewItemId(), newItemData);
52960
52962
  if (newItem.itemType === "RichText") {
52961
- const storage = new SessionStorage;
52963
+ const storage = new SessionStorage2;
52962
52964
  storage.setFontSize("RichText", fontSize);
52963
52965
  newItem.editor.selectWholeText();
52964
52966
  newItem.applySelectionFontSize(fontSize);
@@ -56209,7 +56211,6 @@ var defaultShapeData2 = new DefaultShapeData;
56209
56211
 
56210
56212
  class BoardSelection {
56211
56213
  board;
56212
- events;
56213
56214
  subject = new Subject;
56214
56215
  itemSubject = new Subject;
56215
56216
  itemsSubject = new Subject;
@@ -56224,9 +56225,8 @@ class BoardSelection {
56224
56225
  quickAddButtons;
56225
56226
  showQuickAddPanel = false;
56226
56227
  memorySnapshot = null;
56227
- constructor(board, events2) {
56228
+ constructor(board) {
56228
56229
  this.board = board;
56229
- this.events = events2;
56230
56230
  safeRequestAnimationFrame(this.updateScheduledObservers);
56231
56231
  this.tool = new SelectionTransformer(board, this);
56232
56232
  this.quickAddButtons = getQuickAddButtons(this, board);
@@ -56286,22 +56286,22 @@ class BoardSelection {
56286
56286
  }
56287
56287
  }
56288
56288
  emit(operation) {
56289
- if (!this.events) {
56289
+ if (!this.board.events) {
56290
56290
  return;
56291
56291
  }
56292
56292
  const command = createCommand(this.board, operation);
56293
56293
  command.apply();
56294
- this.events.emit(operation, command);
56294
+ this.board.events.emit(operation, command);
56295
56295
  }
56296
56296
  emitApplied(operation) {
56297
56297
  this.emitCommand(operation);
56298
56298
  }
56299
56299
  emitCommand(operation) {
56300
- if (!this.events) {
56300
+ if (!this.board.events) {
56301
56301
  return null;
56302
56302
  }
56303
56303
  const command = createCommand(this.board, operation);
56304
- this.events.emit(operation, command);
56304
+ this.board.events.emit(operation, command);
56305
56305
  return command;
56306
56306
  }
56307
56307
  updateQueue = new Set;
@@ -57384,7 +57384,7 @@ class Board {
57384
57384
  isBoardMenuOpen = false;
57385
57385
  selection;
57386
57386
  tools = new Tools(this);
57387
- pointer = new Pointer2;
57387
+ pointer = new Pointer;
57388
57388
  aiGeneratingOnItem = undefined;
57389
57389
  aiImagePlaceholder = undefined;
57390
57390
  aiImageConnectorID = undefined;
@@ -57406,7 +57406,7 @@ class Board {
57406
57406
  this.boardId = boardId;
57407
57407
  this.accessKey = accessKey;
57408
57408
  this.saveEditingFile = saveEditingFile;
57409
- this.selection = new BoardSelection(this, this.events);
57409
+ this.selection = new BoardSelection(this);
57410
57410
  this.presence = new Presence(this);
57411
57411
  this.tools.navigate();
57412
57412
  }
@@ -57415,11 +57415,10 @@ class Board {
57415
57415
  this.events.connection?.unsubscribe(this);
57416
57416
  this.index = new SpatialIndex(this.camera, this.pointer);
57417
57417
  this.items = this.index.items;
57418
- this.selection.events = this.events;
57419
57418
  this.presence.events = this.events;
57420
57419
  }
57421
57420
  getNewItemId() {
57422
- return uuidv4();
57421
+ return v4_default();
57423
57422
  }
57424
57423
  emit(operation) {
57425
57424
  if (this.events) {