microboard-ui-temp 0.1.89 → 0.1.91

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/index.js CHANGED
@@ -255865,6 +255865,17 @@ function throttle2(func, delay) {
255865
255865
  }
255866
255866
  };
255867
255867
  }
255868
+ var editModeHotkeyRegistry = {};
255869
+ var viewModeHotkeyRegistry = {};
255870
+ var hotkeyNames = {};
255871
+ function registerHotkey({ name, hotkey, hotkeyConfig, boardMode }) {
255872
+ if (boardMode === "edit") {
255873
+ editModeHotkeyRegistry[name] = hotkeyConfig;
255874
+ } else {
255875
+ viewModeHotkeyRegistry[name] = hotkeyConfig;
255876
+ }
255877
+ hotkeyNames[name] = hotkey;
255878
+ }
255868
255879
  var defaultCardData = {
255869
255880
  itemType: "Card",
255870
255881
  isOpen: false,
@@ -256042,17 +256053,40 @@ registerItem({
256042
256053
  item: Card,
256043
256054
  defaultData: defaultCardData
256044
256055
  });
256045
- var editModeHotkeyRegistry = {};
256046
- var viewModeHotkeyRegistry = {};
256047
- var hotkeyNames = {};
256048
- function registerHotkey({ name, hotkey, hotkeyConfig, boardMode }) {
256049
- if (boardMode === "edit") {
256050
- editModeHotkeyRegistry[name] = hotkeyConfig;
256051
- } else {
256052
- viewModeHotkeyRegistry[name] = hotkeyConfig;
256056
+ registerHotkey({
256057
+ name: "Rotate90deg",
256058
+ hotkey: { key: { button: "KeyQ" }, label: { windows: "Q", mac: "Q" } },
256059
+ boardMode: "edit",
256060
+ hotkeyConfig: {
256061
+ allItemsType: ["Image", "Card"],
256062
+ cb: (event, board) => {
256063
+ const items = board?.selection.items.list();
256064
+ if (!items) {
256065
+ return;
256066
+ }
256067
+ items.forEach((item) => {
256068
+ item.rotate(false);
256069
+ });
256070
+ }
256053
256071
  }
256054
- hotkeyNames[name] = hotkey;
256055
- }
256072
+ });
256073
+ registerHotkey({
256074
+ name: "Rotate90deg-clockwise",
256075
+ hotkey: { key: { button: "KeyE" }, label: { windows: "E", mac: "E" } },
256076
+ boardMode: "edit",
256077
+ hotkeyConfig: {
256078
+ allItemsType: ["Image", "Card"],
256079
+ cb: (event, board) => {
256080
+ const items = board?.selection.items.list();
256081
+ if (!items) {
256082
+ return;
256083
+ }
256084
+ items.forEach((item) => {
256085
+ item.rotate(true);
256086
+ });
256087
+ }
256088
+ }
256089
+ });
256056
256090
  var defaultDeckData = {
256057
256091
  itemType: "Deck"
256058
256092
  };
@@ -256096,6 +256130,7 @@ class Deck extends BaseItem {
256096
256130
  x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
256097
256131
  y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
256098
256132
  });
256133
+ this.board.selection.remove(foundItem);
256099
256134
  this.board.items.index.remove(foundItem);
256100
256135
  foundItem.parent = this.getId();
256101
256136
  foundItem.shouldUseRelativeAlignment = false;
@@ -256185,8 +256220,8 @@ class Deck extends BaseItem {
256185
256220
  const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
256186
256221
  this.left = translateX;
256187
256222
  this.top = translateY;
256188
- this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1));
256189
- this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height - conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1));
256223
+ this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1)));
256224
+ this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height + (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1) : 0));
256190
256225
  this.path = new Path2(this.getMbr().getLines(), true, "#FFFFFF");
256191
256226
  }
256192
256227
  deserialize(data) {
@@ -256253,7 +256288,7 @@ class Deck extends BaseItem {
256253
256288
  return;
256254
256289
  const tempContext = { ...context, ctx: tempCtx };
256255
256290
  cards.forEach((_, index2) => {
256256
- topCard.render(tempContext, index2 * conf.DECK_HORIZONTAL_OFFSET, index2 * conf.DECK_VERTICAL_OFFSET);
256291
+ topCard.render(tempContext, this.isPerpendicular ? 0 : index2 * conf.DECK_HORIZONTAL_OFFSET, this.isPerpendicular ? index2 * conf.DECK_VERTICAL_OFFSET : 0);
256257
256292
  });
256258
256293
  this.cachedCanvas = tempCanvas;
256259
256294
  this.isCacheDirty = false;
@@ -334594,6 +334629,10 @@ var en_default = {
334594
334629
  MB: "MB"
334595
334630
  },
334596
334631
  contextPanel: {
334632
+ rotateItem: {
334633
+ clockwise: "rotate clockwise",
334634
+ counterclockwise: "rotate counterclockwise"
334635
+ },
334597
334636
  connectorAddText: {
334598
334637
  tooltip: "Add text"
334599
334638
  },
@@ -335834,6 +335873,10 @@ var ru_default = {
335834
335873
  MB: "МБ"
335835
335874
  },
335836
335875
  contextPanel: {
335876
+ rotateItem: {
335877
+ clockwise: "Повернуть по часовой стрелке",
335878
+ counterclockwise: "Повернуть против часовой стрелки"
335879
+ },
335837
335880
  connectorAddText: {
335838
335881
  tooltip: "Добавить текст"
335839
335882
  },
@@ -374673,7 +374716,11 @@ function GetCard({ cardPosition, rounded = "none" }) {
374673
374716
  break;
374674
374717
  }
374675
374718
  const { left, top } = deck.getMbr();
374676
- card.transformation.translateTo(left, top - 280);
374719
+ if (deck.getIsPerpendicular()) {
374720
+ card.transformation.translateTo(left + 280, top);
374721
+ } else {
374722
+ card.transformation.translateTo(left, top - 280);
374723
+ }
374677
374724
  if (deck.getDeck().length === 0) {
374678
374725
  board.remove(deck);
374679
374726
  }
@@ -374953,16 +375000,14 @@ function RotateItem({ clockwise, rounded = "none" }) {
374953
375000
  return /* @__PURE__ */ import_react290.default.createElement(UiButton, {
374954
375001
  className: ContextPanelButton_module_default.contextPanelButton,
374955
375002
  id: "rotate-item",
374956
- tooltip: t10("contextPanel.gameItems.card.flip"),
375003
+ tooltip: t10(`contextPanel.rotateItem.${clockwise ? "clockwise" : "counterclockwise"}`),
374957
375004
  tooltipPosition: "top",
374958
375005
  onClick: handleClick,
374959
375006
  variant: "secondary",
374960
375007
  rounded,
374961
- hotkey: getHotkeyLabel("flipDeckOrCard")
375008
+ hotkey: getHotkeyLabel(`Rotate90deg${clockwise ? "-clockwise" : ""}`)
374962
375009
  }, /* @__PURE__ */ import_react290.default.createElement(Icon, {
374963
- iconName: "RotateCard",
374964
- width: 24,
374965
- height: 24
375010
+ iconName: clockwise ? "Redo" : "Undo"
374966
375011
  }));
374967
375012
  }
374968
375013
 
package/dist/spa.js CHANGED
@@ -255865,6 +255865,17 @@ function throttle2(func, delay) {
255865
255865
  }
255866
255866
  };
255867
255867
  }
255868
+ var editModeHotkeyRegistry = {};
255869
+ var viewModeHotkeyRegistry = {};
255870
+ var hotkeyNames = {};
255871
+ function registerHotkey({ name, hotkey, hotkeyConfig, boardMode }) {
255872
+ if (boardMode === "edit") {
255873
+ editModeHotkeyRegistry[name] = hotkeyConfig;
255874
+ } else {
255875
+ viewModeHotkeyRegistry[name] = hotkeyConfig;
255876
+ }
255877
+ hotkeyNames[name] = hotkey;
255878
+ }
255868
255879
  var defaultCardData = {
255869
255880
  itemType: "Card",
255870
255881
  isOpen: false,
@@ -256042,17 +256053,40 @@ registerItem({
256042
256053
  item: Card,
256043
256054
  defaultData: defaultCardData
256044
256055
  });
256045
- var editModeHotkeyRegistry = {};
256046
- var viewModeHotkeyRegistry = {};
256047
- var hotkeyNames = {};
256048
- function registerHotkey({ name, hotkey, hotkeyConfig, boardMode }) {
256049
- if (boardMode === "edit") {
256050
- editModeHotkeyRegistry[name] = hotkeyConfig;
256051
- } else {
256052
- viewModeHotkeyRegistry[name] = hotkeyConfig;
256056
+ registerHotkey({
256057
+ name: "Rotate90deg",
256058
+ hotkey: { key: { button: "KeyQ" }, label: { windows: "Q", mac: "Q" } },
256059
+ boardMode: "edit",
256060
+ hotkeyConfig: {
256061
+ allItemsType: ["Image", "Card"],
256062
+ cb: (event, board) => {
256063
+ const items = board?.selection.items.list();
256064
+ if (!items) {
256065
+ return;
256066
+ }
256067
+ items.forEach((item) => {
256068
+ item.rotate(false);
256069
+ });
256070
+ }
256053
256071
  }
256054
- hotkeyNames[name] = hotkey;
256055
- }
256072
+ });
256073
+ registerHotkey({
256074
+ name: "Rotate90deg-clockwise",
256075
+ hotkey: { key: { button: "KeyE" }, label: { windows: "E", mac: "E" } },
256076
+ boardMode: "edit",
256077
+ hotkeyConfig: {
256078
+ allItemsType: ["Image", "Card"],
256079
+ cb: (event, board) => {
256080
+ const items = board?.selection.items.list();
256081
+ if (!items) {
256082
+ return;
256083
+ }
256084
+ items.forEach((item) => {
256085
+ item.rotate(true);
256086
+ });
256087
+ }
256088
+ }
256089
+ });
256056
256090
  var defaultDeckData = {
256057
256091
  itemType: "Deck"
256058
256092
  };
@@ -256096,6 +256130,7 @@ class Deck extends BaseItem {
256096
256130
  x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
256097
256131
  y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
256098
256132
  });
256133
+ this.board.selection.remove(foundItem);
256099
256134
  this.board.items.index.remove(foundItem);
256100
256135
  foundItem.parent = this.getId();
256101
256136
  foundItem.shouldUseRelativeAlignment = false;
@@ -256185,8 +256220,8 @@ class Deck extends BaseItem {
256185
256220
  const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
256186
256221
  this.left = translateX;
256187
256222
  this.top = translateY;
256188
- this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1));
256189
- this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height - conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1));
256223
+ this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1)));
256224
+ this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height + (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1) : 0));
256190
256225
  this.path = new Path2(this.getMbr().getLines(), true, "#FFFFFF");
256191
256226
  }
256192
256227
  deserialize(data) {
@@ -256253,7 +256288,7 @@ class Deck extends BaseItem {
256253
256288
  return;
256254
256289
  const tempContext = { ...context, ctx: tempCtx };
256255
256290
  cards.forEach((_, index2) => {
256256
- topCard.render(tempContext, index2 * conf.DECK_HORIZONTAL_OFFSET, index2 * conf.DECK_VERTICAL_OFFSET);
256291
+ topCard.render(tempContext, this.isPerpendicular ? 0 : index2 * conf.DECK_HORIZONTAL_OFFSET, this.isPerpendicular ? index2 * conf.DECK_VERTICAL_OFFSET : 0);
256257
256292
  });
256258
256293
  this.cachedCanvas = tempCanvas;
256259
256294
  this.isCacheDirty = false;
@@ -334594,6 +334629,10 @@ var en_default = {
334594
334629
  MB: "MB"
334595
334630
  },
334596
334631
  contextPanel: {
334632
+ rotateItem: {
334633
+ clockwise: "rotate clockwise",
334634
+ counterclockwise: "rotate counterclockwise"
334635
+ },
334597
334636
  connectorAddText: {
334598
334637
  tooltip: "Add text"
334599
334638
  },
@@ -335834,6 +335873,10 @@ var ru_default = {
335834
335873
  MB: "МБ"
335835
335874
  },
335836
335875
  contextPanel: {
335876
+ rotateItem: {
335877
+ clockwise: "Повернуть по часовой стрелке",
335878
+ counterclockwise: "Повернуть против часовой стрелки"
335879
+ },
335837
335880
  connectorAddText: {
335838
335881
  tooltip: "Добавить текст"
335839
335882
  },
@@ -374673,7 +374716,11 @@ function GetCard({ cardPosition, rounded = "none" }) {
374673
374716
  break;
374674
374717
  }
374675
374718
  const { left, top } = deck.getMbr();
374676
- card.transformation.translateTo(left, top - 280);
374719
+ if (deck.getIsPerpendicular()) {
374720
+ card.transformation.translateTo(left + 280, top);
374721
+ } else {
374722
+ card.transformation.translateTo(left, top - 280);
374723
+ }
374677
374724
  if (deck.getDeck().length === 0) {
374678
374725
  board.remove(deck);
374679
374726
  }
@@ -374953,16 +375000,14 @@ function RotateItem({ clockwise, rounded = "none" }) {
374953
375000
  return /* @__PURE__ */ import_react290.default.createElement(UiButton, {
374954
375001
  className: ContextPanelButton_module_default.contextPanelButton,
374955
375002
  id: "rotate-item",
374956
- tooltip: t10("contextPanel.gameItems.card.flip"),
375003
+ tooltip: t10(`contextPanel.rotateItem.${clockwise ? "clockwise" : "counterclockwise"}`),
374957
375004
  tooltipPosition: "top",
374958
375005
  onClick: handleClick,
374959
375006
  variant: "secondary",
374960
375007
  rounded,
374961
- hotkey: getHotkeyLabel("flipDeckOrCard")
375008
+ hotkey: getHotkeyLabel(`Rotate90deg${clockwise ? "-clockwise" : ""}`)
374962
375009
  }, /* @__PURE__ */ import_react290.default.createElement(Icon, {
374963
- iconName: "RotateCard",
374964
- width: 24,
374965
- height: 24
375010
+ iconName: clockwise ? "Redo" : "Undo"
374966
375011
  }));
374967
375012
  }
374968
375013
 
@@ -23,6 +23,10 @@ export declare const resources: {
23
23
  MB: string;
24
24
  };
25
25
  contextPanel: {
26
+ rotateItem: {
27
+ clockwise: string;
28
+ counterclockwise: string;
29
+ };
26
30
  connectorAddText: {
27
31
  tooltip: string;
28
32
  };
@@ -1236,6 +1240,10 @@ export declare const resources: {
1236
1240
  MB: string;
1237
1241
  };
1238
1242
  contextPanel: {
1243
+ rotateItem: {
1244
+ clockwise: string;
1245
+ counterclockwise: string;
1246
+ };
1239
1247
  connectorAddText: {
1240
1248
  tooltip: string;
1241
1249
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-ui-temp",
3
- "version": "0.1.89",
3
+ "version": "0.1.91",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "type": "module",
@@ -60,7 +60,7 @@
60
60
  "i18next-browser-languagedetector": "^8.2.0",
61
61
  "js-cookie": "^3.0.5",
62
62
  "jwt-decode": "^4.0.0",
63
- "microboard-temp": "^0.5.29",
63
+ "microboard-temp": "^0.5.31",
64
64
  "nanoid": "^5.1.5",
65
65
  "prop-types": "^15.8.1",
66
66
  "react-hot-toast": "2.4.1",