microboard-ui-temp 0.0.45 → 0.0.47
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 +3 -3
- package/dist/customWebComponents.js +21 -8
- package/dist/index.js +15 -7
- package/package.json +2 -2
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
|
|
14
|
+
href="https://unpkg.com/microboard-ui-temp/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
|
|
87
|
+
src="https://unpkg.com/microboard-ui-temp/dist/customWebComponents.js"
|
|
88
88
|
></script>
|
|
89
89
|
<script
|
|
90
90
|
defer
|
|
91
|
-
src="https://unpkg.com/microboard-ui-temp
|
|
91
|
+
src="https://unpkg.com/microboard-ui-temp/dist/loadLinksImages.js"
|
|
92
92
|
></script>
|
|
93
93
|
</body>
|
|
94
94
|
</head>
|
|
@@ -22,6 +22,17 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
22
22
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
+
// src/Config.ts
|
|
26
|
+
var frontConf = {
|
|
27
|
+
apiURL: undefined,
|
|
28
|
+
wsURL: undefined
|
|
29
|
+
};
|
|
30
|
+
var isSnapshotInIframe = typeof window !== "undefined" && window.parent && window.parent !== window && window.parent.location.href.includes("/snapshots/");
|
|
31
|
+
var baseUrl = typeof process !== "undefined" && process.env.BASE_URL ? process.env.BASE_URL : isSnapshotInIframe ? `${window.parent.location.protocol}//${window.parent.location.host}` : `${location.protocol}//${location.host}`;
|
|
32
|
+
var parsedUrl = new URL(baseUrl);
|
|
33
|
+
var PROTOCOL = parsedUrl.protocol;
|
|
34
|
+
var HOST = parsedUrl.host;
|
|
35
|
+
|
|
25
36
|
// src/public/customWebComponents.ts
|
|
26
37
|
class RichTextElement extends HTMLElement {
|
|
27
38
|
constructor() {
|
|
@@ -190,8 +201,8 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
|
190
201
|
editIcon.appendChild(editIconPath);
|
|
191
202
|
editButton.appendChild(editIcon);
|
|
192
203
|
const editFileText = document.createElement("p");
|
|
193
|
-
const
|
|
194
|
-
editFileText.textContent =
|
|
204
|
+
const isSnapshotInIframe2 = window.parent && window.parent !== window && window.parent.location.href.includes("/snapshots/");
|
|
205
|
+
editFileText.textContent = isSnapshotInIframe2 ? "Edit copy" : "Edit file";
|
|
195
206
|
editButton.appendChild(editFileText);
|
|
196
207
|
editButton.style.backgroundColor = "rgba(20, 21, 26, 1)";
|
|
197
208
|
editButton.style.cursor = "pointer";
|
|
@@ -275,9 +286,9 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
|
275
286
|
translateY = 0;
|
|
276
287
|
scale = 1;
|
|
277
288
|
updateTransform();
|
|
278
|
-
const { initInter } = await import("https://www.unpkg.com/microboard-ui-temp
|
|
289
|
+
const { initInter } = await import("https://www.unpkg.com/microboard-ui-temp/dist/index.js");
|
|
279
290
|
initInter();
|
|
280
|
-
const { createApp } = await import("https://www.unpkg.com/microboard-ui-temp
|
|
291
|
+
const { createApp } = await import("https://www.unpkg.com/microboard-ui-temp/dist/index.js");
|
|
281
292
|
const app = createApp();
|
|
282
293
|
window.app = app;
|
|
283
294
|
const stringed = await app.openAndEditFile();
|
|
@@ -286,12 +297,12 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
|
286
297
|
app.getBoard().deserializeHTML(stringed);
|
|
287
298
|
app.localRender("items");
|
|
288
299
|
}
|
|
289
|
-
const response = await fetch("https://www.unpkg.com/microboard-ui-temp
|
|
300
|
+
const response = await fetch("https://www.unpkg.com/microboard-ui-temp/dist/index.css");
|
|
290
301
|
const cssText = await response.text();
|
|
291
302
|
const styleEl = document.createElement("style");
|
|
292
303
|
styleEl.textContent = cssText;
|
|
293
304
|
document.body.appendChild(styleEl);
|
|
294
|
-
const responseSvg = await fetch("https://www.unpkg.com/microboard-ui-temp
|
|
305
|
+
const responseSvg = await fetch("https://www.unpkg.com/microboard-ui-temp/dist/sprite.svg");
|
|
295
306
|
const svgText = await responseSvg.text();
|
|
296
307
|
const div = document.createElement("div");
|
|
297
308
|
div.style.display = "none";
|
|
@@ -308,9 +319,11 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
|
308
319
|
ev.stopPropagation();
|
|
309
320
|
const htmlContent = document.documentElement.innerHTML;
|
|
310
321
|
const boardName2 = document.title?.trim() || "shared-board";
|
|
311
|
-
const { boardsApi, createApp, api } = await import("https://www.unpkg.com/microboard-ui-temp
|
|
322
|
+
const { boardsApi, createApp, api } = await import("https://www.unpkg.com/microboard-ui-temp/dist/index.js");
|
|
312
323
|
api.updateURL("https://dev-app.microboard.io/api/v1");
|
|
313
|
-
|
|
324
|
+
frontConf.wsURL = "wss://dev-app.microboard.io/ws";
|
|
325
|
+
const boardId = await boardsApi.createBoard(boardName2, true);
|
|
326
|
+
console.log("boardid", boardId);
|
|
314
327
|
const app = createApp();
|
|
315
328
|
window.app = app;
|
|
316
329
|
await app.openBoard(boardId);
|
package/dist/index.js
CHANGED
|
@@ -215912,7 +215912,9 @@ var conf = {
|
|
|
215912
215912
|
FORCE_HOTKEYS: "auto",
|
|
215913
215913
|
debug: false,
|
|
215914
215914
|
FALLBACK_LNG: "en",
|
|
215915
|
-
cursorsMap
|
|
215915
|
+
cursorsMap,
|
|
215916
|
+
DECK_HORIZONTAL_OFFSET: 2,
|
|
215917
|
+
DECK_VERTICAL_OFFSET: 0
|
|
215916
215918
|
};
|
|
215917
215919
|
initDefaultI18N();
|
|
215918
215920
|
|
|
@@ -255896,6 +255898,9 @@ class Card extends BaseItem {
|
|
|
255896
255898
|
this.imageToRender = this.face;
|
|
255897
255899
|
}
|
|
255898
255900
|
}
|
|
255901
|
+
getImage() {
|
|
255902
|
+
return this.imageToRender;
|
|
255903
|
+
}
|
|
255899
255904
|
render(context, left, top) {
|
|
255900
255905
|
if (this.transformationRenderBlock) {
|
|
255901
255906
|
return;
|
|
@@ -255984,8 +255989,8 @@ class Deck extends BaseItem {
|
|
|
255984
255989
|
class: "Transformation",
|
|
255985
255990
|
method: "translateTo",
|
|
255986
255991
|
item: [this.id],
|
|
255987
|
-
x: this.left + (this.index?.list().length || 0) *
|
|
255988
|
-
y: this.top
|
|
255992
|
+
x: this.left + (this.index?.list().length || 0) * conf.DECK_HORIZONTAL_OFFSET,
|
|
255993
|
+
y: this.top - (this.index?.list().length || 0) * conf.DECK_VERTICAL_OFFSET
|
|
255989
255994
|
});
|
|
255990
255995
|
this.board.items.index.remove(foundItem);
|
|
255991
255996
|
foundItem.parent = this.getId();
|
|
@@ -256087,7 +256092,6 @@ class Deck extends BaseItem {
|
|
|
256087
256092
|
const ctx = context.ctx;
|
|
256088
256093
|
if (this.isCacheDirty || !this.cachedCanvas) {
|
|
256089
256094
|
this.updateCache(context);
|
|
256090
|
-
this.isCacheDirty = false;
|
|
256091
256095
|
}
|
|
256092
256096
|
if (this.cachedCanvas && this.cachedCanvas.width && this.cachedCanvas.height) {
|
|
256093
256097
|
ctx.save();
|
|
@@ -256096,9 +256100,12 @@ class Deck extends BaseItem {
|
|
|
256096
256100
|
}
|
|
256097
256101
|
}
|
|
256098
256102
|
updateCache(context) {
|
|
256103
|
+
const cards = this.index?.list();
|
|
256104
|
+
const topCard = cards[cards.length - 1];
|
|
256105
|
+
const topCardImage = topCard?.getImage();
|
|
256099
256106
|
const width2 = this.getWidth();
|
|
256100
256107
|
const height3 = this.getHeight();
|
|
256101
|
-
if (!width2 || !height3) {
|
|
256108
|
+
if (!width2 || !height3 || !topCardImage || !topCardImage.complete) {
|
|
256102
256109
|
return;
|
|
256103
256110
|
}
|
|
256104
256111
|
const tempCanvas = conf.documentFactory.createElement("canvas");
|
|
@@ -256108,10 +256115,11 @@ class Deck extends BaseItem {
|
|
|
256108
256115
|
if (!tempCtx)
|
|
256109
256116
|
return;
|
|
256110
256117
|
const tempContext = { ...context, ctx: tempCtx };
|
|
256111
|
-
|
|
256112
|
-
|
|
256118
|
+
cards.forEach((_, index2) => {
|
|
256119
|
+
topCard.render(tempContext, index2 * conf.DECK_HORIZONTAL_OFFSET, index2 * conf.DECK_VERTICAL_OFFSET);
|
|
256113
256120
|
});
|
|
256114
256121
|
this.cachedCanvas = tempCanvas;
|
|
256122
|
+
this.isCacheDirty = false;
|
|
256115
256123
|
}
|
|
256116
256124
|
}
|
|
256117
256125
|
registerItem({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "microboard-ui-temp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.47",
|
|
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.
|
|
53
|
+
"microboard-temp": "^0.4.97",
|
|
54
54
|
"nanoid": "^5.1.5",
|
|
55
55
|
"prop-types": "^15.8.1",
|
|
56
56
|
"react-hot-toast": "2.4.1",
|