microboard-ui-temp 0.0.33 → 0.0.35

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.33/dist/board.css"
14
+ href="https://unpkg.com/microboard-ui-temp@0.0.35/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.33/dist/customWebComponents.js"
87
+ src="https://unpkg.com/microboard-ui-temp@0.0.35/dist/customWebComponents.js"
88
88
  ></script>
89
89
  <script
90
90
  defer
91
- src="https://unpkg.com/microboard-ui-temp@0.0.33/dist/loadLinksImages.js"
91
+ src="https://unpkg.com/microboard-ui-temp@0.0.35/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.33/dist/index.js");
278
+ const { initInter } = await import("https://www.unpkg.com/microboard-ui-temp@0.0.35/dist/index.js");
279
279
  initInter();
280
- const { createApp } = await import("https://www.unpkg.com/microboard-ui-temp@0.0.33/dist/index.js");
280
+ const { createApp } = await import("https://www.unpkg.com/microboard-ui-temp@0.0.35/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.33/dist/index.css");
289
+ const response = await fetch("https://www.unpkg.com/microboard-ui-temp@0.0.35/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.33/dist/sprite.svg");
294
+ const responseSvg = await fetch("https://www.unpkg.com/microboard-ui-temp@0.0.35/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.33/dist/index.js");
311
+ const { boardsApi, createApp, conf } = await import("https://www.unpkg.com/microboard-ui-temp@0.0.35/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
@@ -255869,8 +255869,10 @@ class Card extends BaseItem {
255869
255869
  this.throttledBringToFront = throttle2(() => {
255870
255870
  this.board.bringToFront(this);
255871
255871
  }, 1000);
255872
- this.transformation.subject.subscribe(() => {
255873
- this.throttledBringToFront();
255872
+ this.transformation.subject.subscribe((_, op) => {
255873
+ if (this.parent === "Board" && op.method === "translateBy" || op.method === "transformMany" && !Object.keys(op.items).length) {
255874
+ this.throttledBringToFront();
255875
+ }
255874
255876
  this.updateMbr();
255875
255877
  this.subject.publish(this);
255876
255878
  });
@@ -255958,6 +255960,8 @@ var defaultDeckData = {
255958
255960
  class Deck extends BaseItem {
255959
255961
  subject = new Subject;
255960
255962
  shouldUseCustomRender = false;
255963
+ cachedCanvas = null;
255964
+ isCacheDirty = true;
255961
255965
  constructor(board, id = "") {
255962
255966
  super(board, id, defaultDeckData, true);
255963
255967
  this.index.getUnderPoint = () => [];
@@ -256055,6 +256059,9 @@ class Deck extends BaseItem {
256055
256059
  }
256056
256060
  apply(op) {
256057
256061
  super.apply(op);
256062
+ if (op.class === "Deck") {
256063
+ this.isCacheDirty = true;
256064
+ }
256058
256065
  this.subject.publish(this);
256059
256066
  }
256060
256067
  updateMbr() {
@@ -256076,7 +256083,27 @@ class Deck extends BaseItem {
256076
256083
  if (this.transformationRenderBlock) {
256077
256084
  return;
256078
256085
  }
256079
- super.render(context);
256086
+ const ctx = context.ctx;
256087
+ if (this.isCacheDirty || !this.cachedCanvas) {
256088
+ this.updateCache(context);
256089
+ this.isCacheDirty = false;
256090
+ }
256091
+ if (this.cachedCanvas) {
256092
+ ctx.save();
256093
+ ctx.drawImage(this.cachedCanvas, this.left, this.top);
256094
+ ctx.restore();
256095
+ }
256096
+ }
256097
+ updateCache(context) {
256098
+ const tempCanvas = document.createElement("canvas");
256099
+ tempCanvas.width = this.getWidth();
256100
+ tempCanvas.height = this.getHeight();
256101
+ const tempCtx = tempCanvas.getContext("2d");
256102
+ if (!tempCtx)
256103
+ return;
256104
+ const tempContext = { ...context, ctx: tempCtx };
256105
+ this.index?.render(tempContext);
256106
+ this.cachedCanvas = tempCanvas;
256080
256107
  }
256081
256108
  }
256082
256109
  registerItem({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-ui-temp",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "type": "module",
@@ -50,7 +50,7 @@
50
50
  "i18next-browser-languagedetector": "^8.2.0",
51
51
  "js-cookie": "^3.0.5",
52
52
  "jwt-decode": "^4.0.0",
53
- "microboard-temp": "^0.4.88",
53
+ "microboard-temp": "^0.4.90",
54
54
  "nanoid": "^5.1.5",
55
55
  "prop-types": "^15.8.1",
56
56
  "react-hot-toast": "2.4.1",