microboard-ui-temp 0.0.31 → 0.0.33

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/board.html CHANGED
@@ -11,7 +11,7 @@
11
11
  <link
12
12
  rel="stylesheet"
13
13
  crossorigin
14
- href="https://unpkg.com/microboard-ui-temp@0.0.31/dist/board.css"
14
+ href="https://unpkg.com/microboard-ui-temp@0.0.33/dist/board.css"
15
15
  />
16
16
  <body style="overflow-x: hidden; overflow-y: hidden">
17
17
  <div id="items">
@@ -84,11 +84,11 @@
84
84
  </div>
85
85
  <script
86
86
  type="module"
87
- src="https://unpkg.com/microboard-ui-temp@0.0.31/dist/customWebComponents.js"
87
+ src="https://unpkg.com/microboard-ui-temp@0.0.33/dist/customWebComponents.js"
88
88
  ></script>
89
89
  <script
90
90
  defer
91
- src="https://unpkg.com/microboard-ui-temp@0.0.31/dist/loadLinksImages.js"
91
+ src="https://unpkg.com/microboard-ui-temp@0.0.33/dist/loadLinksImages.js"
92
92
  ></script>
93
93
  </body>
94
94
  </head>
@@ -275,9 +275,9 @@ document.addEventListener("DOMContentLoaded", () => {
275
275
  translateY = 0;
276
276
  scale = 1;
277
277
  updateTransform();
278
- const { initInter } = await import("https://www.unpkg.com/microboard-ui-temp@0.0.31/dist/index.js");
278
+ const { initInter } = await import("https://www.unpkg.com/microboard-ui-temp@0.0.33/dist/index.js");
279
279
  initInter();
280
- const { createApp } = await import("https://www.unpkg.com/microboard-ui-temp@0.0.31/dist/index.js");
280
+ const { createApp } = await import("https://www.unpkg.com/microboard-ui-temp@0.0.33/dist/index.js");
281
281
  const app = createApp();
282
282
  window.app = app;
283
283
  const stringed = await app.openAndEditFile();
@@ -286,12 +286,12 @@ document.addEventListener("DOMContentLoaded", () => {
286
286
  app.getBoard().deserializeHTML(stringed);
287
287
  app.localRender("items");
288
288
  }
289
- const response = await fetch("https://www.unpkg.com/microboard-ui-temp@0.0.31/dist/index.css");
289
+ const response = await fetch("https://www.unpkg.com/microboard-ui-temp@0.0.33/dist/index.css");
290
290
  const cssText = await response.text();
291
291
  const styleEl = document.createElement("style");
292
292
  styleEl.textContent = cssText;
293
293
  document.body.appendChild(styleEl);
294
- const responseSvg = await fetch("https://www.unpkg.com/microboard-ui-temp@0.0.31/dist/sprite.svg");
294
+ const responseSvg = await fetch("https://www.unpkg.com/microboard-ui-temp@0.0.33/dist/sprite.svg");
295
295
  const svgText = await responseSvg.text();
296
296
  const div = document.createElement("div");
297
297
  div.style.display = "none";
@@ -308,7 +308,7 @@ document.addEventListener("DOMContentLoaded", () => {
308
308
  ev.stopPropagation();
309
309
  const htmlContent = document.documentElement.innerHTML;
310
310
  const boardName2 = document.title?.trim() || "shared-board";
311
- const { boardsApi, createApp, conf } = await import("https://www.unpkg.com/microboard-ui-temp@0.0.31/dist/index.js");
311
+ const { boardsApi, createApp, conf } = await import("https://www.unpkg.com/microboard-ui-temp@0.0.33/dist/index.js");
312
312
  conf.apiURL = "https://dev-app.microboard.io/api/v1/";
313
313
  const boardId = await boardsApi.createBoardUnAuthed(boardName2);
314
314
  const app = createApp();
package/dist/index.js CHANGED
@@ -338066,30 +338066,38 @@ function createConnection(getCurrentBoard, getAccount3, getStorage) {
338066
338066
  }, "*");
338067
338067
  }
338068
338068
  async function publishAuth() {
338069
+ if (isAuthPublishing.flag && tokenPromise) {
338070
+ return tokenPromise.promise;
338071
+ }
338072
+ let localTokenPromise = tokenPromise;
338073
+ let needsCleanup = false;
338069
338074
  try {
338070
- if (isAuthPublishing.flag) {
338071
- return tokenPromise?.promise;
338072
- }
338073
338075
  isAuthPublishing.flag = true;
338074
- const account = getAccount3();
338075
- if (!tokenPromise) {
338076
- tokenPromise = createPromiseWithResolvers();
338076
+ needsCleanup = true;
338077
+ if (!localTokenPromise) {
338078
+ localTokenPromise = createPromiseWithResolvers();
338079
+ tokenPromise = localTokenPromise;
338077
338080
  }
338081
+ const account = getAccount3();
338078
338082
  await account.refreshTokens();
338079
338083
  const jwt = account.accessToken;
338080
338084
  if (!jwt) {
338085
+ localTokenPromise.resolve();
338081
338086
  return;
338082
338087
  }
338083
338088
  ws4.send({
338084
338089
  type: "Auth",
338085
338090
  jwt
338086
338091
  });
338087
- await tokenPromise.promise;
338088
- } catch {
338089
- console.info("Unauthorized");
338092
+ localTokenPromise.resolve();
338093
+ } catch (error3) {
338094
+ console.info("Unauthorized", error3);
338095
+ localTokenPromise?.resolve();
338090
338096
  } finally {
338091
- isAuthPublishing.flag = false;
338092
- tokenPromise = null;
338097
+ if (needsCleanup) {
338098
+ isAuthPublishing.flag = false;
338099
+ tokenPromise = null;
338100
+ }
338093
338101
  }
338094
338102
  }
338095
338103
  function publishLogout() {
@@ -353021,10 +353029,7 @@ function ContextMenu() {
353021
353029
  app.getBoard().deserializeHTML(stringedHTML);
353022
353030
  }
353023
353031
  app.render();
353024
- const sumMbr = [
353025
- ...app.getBoard().items.listAll(),
353026
- ...app.getBoard().items.listFrames()
353027
- ].reduce((acc, item) => {
353032
+ const sumMbr = app.getBoard().items.listAll().reduce((acc, item) => {
353028
353033
  if (!acc) {
353029
353034
  return item.getMbr();
353030
353035
  }
@@ -420493,27 +420498,21 @@ function CreateCardsModal() {
420493
420498
  const handleCardsClick = () => cardsInputRef.current?.click();
420494
420499
  const createDeck = (backsideUrl, faceUrls) => {
420495
420500
  const cards2 = [];
420496
- const { left: left2, top: top2, bottom: bottom2, right: right2 } = board.camera.getMbr();
420497
- const x10 = (left2 + right2) / 2;
420498
- const y14 = (top2 + bottom2) / 2;
420499
420501
  faceUrls.forEach((faceUrl, index4) => {
420500
420502
  const card = new Card(board, index4 + faceUrl, {
420501
420503
  backsideUrl,
420502
420504
  faceUrl
420503
420505
  });
420504
- card.transformation.apply({
420505
- class: "Transformation",
420506
- method: "translateTo",
420507
- item: [card.getId()],
420508
- x: x10,
420509
- y: y14
420510
- });
420511
420506
  cards2.push(card);
420512
420507
  });
420513
420508
  const itemsMap = {};
420514
420509
  cards2.forEach((card) => {
420515
420510
  itemsMap[card.getId()] = card.serialize();
420516
420511
  });
420512
+ const { left: left2, top: top2, bottom: bottom2, right: right2 } = board.camera.getMbr();
420513
+ const x10 = (left2 + right2) / 2 - cards2[0].getWidth() / 2;
420514
+ const y14 = (top2 + bottom2) / 2 - cards2[0].getHeight() / 2;
420515
+ board.pointer.pointTo(x10, y14);
420517
420516
  board.paste(itemsMap, false, false);
420518
420517
  };
420519
420518
  const handleCoverChange = (e15) => {
@@ -423660,7 +423659,7 @@ function ZoomPanel() {
423660
423659
  const { t: t11 } = useTranslation();
423661
423660
  const isMobile2 = useMediaQuery("screen and (max-width: 1200px)");
423662
423661
  const zoomToFit = () => {
423663
- const items = [...board.items.listAll(), ...board.items.listFrames()];
423662
+ const items = board.items.listAll();
423664
423663
  if (items.length > 0) {
423665
423664
  const rect = new Mbr(1e6, 1e6, -1e6, -1e6);
423666
423665
  items.forEach((item) => rect.combine([item.getMbr()]));
@@ -423935,7 +423934,7 @@ var LinksProvider = () => {
423935
423934
  }
423936
423935
  window.open(url3, "_blank");
423937
423936
  }, []);
423938
- return /* @__PURE__ */ import_react396.default.createElement(import_react396.default.Fragment, null, [...board.items.listAll(), ...board.items.listFrames()].filter((item) => item.getLinkTo() && !item.transformationRenderBlock).map((item) => {
423937
+ return /* @__PURE__ */ import_react396.default.createElement(import_react396.default.Fragment, null, board.items.listAll().filter((item) => item.getLinkTo() && !item.transformationRenderBlock).map((item) => {
423939
423938
  return /* @__PURE__ */ import_react396.default.createElement(LinkToButton, {
423940
423939
  item,
423941
423940
  key: item.getId(),
@@ -446828,7 +446827,7 @@ function createApp(isHistory = true) {
446828
446827
  newBoard.camera.zoomToFit(itemsMbr);
446829
446828
  }
446830
446829
  }
446831
- const isItemsOnBoard = newBoard.items.listAll().length > 0 || newBoard.items.listFrames().length > 0;
446830
+ const isItemsOnBoard = newBoard.items.listAll().length > 0;
446832
446831
  if (newBoard.items.getItemsInView().length === 0 && isItemsOnBoard) {
446833
446832
  newBoard.camera.zoomToFit(newBoard.items.getMbr());
446834
446833
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-ui-temp",
3
- "version": "0.0.31",
3
+ "version": "0.0.33",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "type": "module",