microboard-ui-temp 0.1.35 → 0.1.37

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.
Files changed (2) hide show
  1. package/dist/index.js +56 -3
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -256196,7 +256196,7 @@ registerItem({
256196
256196
  });
256197
256197
  registerHotkey({
256198
256198
  name: "getCard-top",
256199
- hotkey: { key: { button: "KeyD", shift: true }, label: { windows: "Shift+D", mac: "⇧D" } },
256199
+ hotkey: { key: { button: "KeyT", shift: true }, label: { windows: "Shift+T", mac: "⇧T" } },
256200
256200
  boardMode: "edit",
256201
256201
  hotkeyConfig: {
256202
256202
  allItemsType: ["Deck"],
@@ -256290,6 +256290,59 @@ registerHotkey({
256290
256290
  }
256291
256291
  }
256292
256292
  });
256293
+ function createDeck(event, board) {
256294
+ if (!board) {
256295
+ return;
256296
+ }
256297
+ const single = board.selection.items.getSingle();
256298
+ if (single && single.itemType === "Deck") {
256299
+ return;
256300
+ }
256301
+ const cardsOrDecks = board.selection.items.list();
256302
+ const onlyCards = board.selection.items.isAllItemsType("Card");
256303
+ if (onlyCards) {
256304
+ const deck = new Deck(board, "");
256305
+ deck.transformation.apply({
256306
+ class: "Transformation",
256307
+ method: "translateTo",
256308
+ item: [deck.getId()],
256309
+ x: cardsOrDecks[cardsOrDecks.length - 1].left,
256310
+ y: cardsOrDecks[cardsOrDecks.length - 1].top
256311
+ });
256312
+ const addedDeck = board.add(deck);
256313
+ board.selection.items.removeAll();
256314
+ addedDeck.addChildItems(cardsOrDecks);
256315
+ board.selection.items.add(addedDeck);
256316
+ } else {
256317
+ let mainDeck = null;
256318
+ const cards = [];
256319
+ cardsOrDecks.forEach((item) => {
256320
+ if (item.itemType === "Card") {
256321
+ cards.push(item);
256322
+ } else if (item.itemType === "Deck") {
256323
+ if (mainDeck) {
256324
+ cards.push(...mainDeck.getDeck());
256325
+ board.remove(mainDeck);
256326
+ mainDeck = item;
256327
+ } else {
256328
+ mainDeck = item;
256329
+ }
256330
+ }
256331
+ });
256332
+ board.selection.items.removeAll();
256333
+ mainDeck.addChildItems(cards);
256334
+ board.selection.items.add(mainDeck);
256335
+ }
256336
+ }
256337
+ registerHotkey({
256338
+ name: "createDeck",
256339
+ hotkey: { key: { button: "KeyD", shift: true }, label: { windows: "Shift+D", mac: "⇧D" } },
256340
+ boardMode: "edit",
256341
+ hotkeyConfig: {
256342
+ allItemsType: ["Deck", "Card"],
256343
+ cb: createDeck
256344
+ }
256345
+ });
256293
256346
 
256294
256347
  class AddDice extends ShapeTool {
256295
256348
  constructor(board, name) {
@@ -419753,7 +419806,7 @@ function CreateCardsModal() {
419753
419806
  const cardsInputRef = import_react349.default.useRef(null);
419754
419807
  const handleCoverClick = () => coverInputRef.current?.click();
419755
419808
  const handleCardsClick = () => cardsInputRef.current?.click();
419756
- const createDeck = (backsideUrl, faceUrls) => {
419809
+ const createDeck2 = (backsideUrl, faceUrls) => {
419757
419810
  const cards2 = [];
419758
419811
  faceUrls.forEach((faceUrl, index4) => {
419759
419812
  const card = new Card(board, index4 + faceUrl, {
@@ -419795,7 +419848,7 @@ function CreateCardsModal() {
419795
419848
  try {
419796
419849
  if (cards.length > 0 && cover) {
419797
419850
  const urls = await uploadImages([cover, ...cards], board.getBoardId(), account.accessToken);
419798
- createDeck(urls[0], urls.slice(1));
419851
+ createDeck2(urls[0], urls.slice(1));
419799
419852
  }
419800
419853
  closeModal2();
419801
419854
  } catch (err2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-ui-temp",
3
- "version": "0.1.35",
3
+ "version": "0.1.37",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "type": "module",
@@ -51,7 +51,7 @@
51
51
  "i18next-browser-languagedetector": "^8.2.0",
52
52
  "js-cookie": "^3.0.5",
53
53
  "jwt-decode": "^4.0.0",
54
- "microboard-temp": "^0.5.12",
54
+ "microboard-temp": "^0.5.13",
55
55
  "nanoid": "^5.1.5",
56
56
  "prop-types": "^15.8.1",
57
57
  "react-hot-toast": "2.4.1",