microboard-ui-temp 0.1.93 → 0.1.95
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 +34 -9
- package/dist/spa.js +34 -9
- package/dist/types/shared/lib/IframeModule.d.ts +12 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -217836,11 +217836,11 @@ var decodeHtml = (htmlString) => {
|
|
|
217836
217836
|
};
|
|
217837
217837
|
function getTransformationData(el) {
|
|
217838
217838
|
const transformStyle = el.style.transform;
|
|
217839
|
-
const transformMatch = transformStyle.match(/
|
|
217839
|
+
const transformMatch = transformStyle.match(/translate\(([^,]+)px,\s*([^)]+)px\)\s*scale\(([^,]+),\s*([^)]+)\)/);
|
|
217840
217840
|
if (transformMatch) {
|
|
217841
|
-
const [, translateX, translateY, scaleX, scaleY
|
|
217841
|
+
const [, translateX, translateY, scaleX, scaleY] = transformMatch.map(Number);
|
|
217842
217842
|
const matrix = new Matrix2(translateX, translateY, scaleX, scaleY);
|
|
217843
|
-
return { ...matrix, rotate, isLocked: false };
|
|
217843
|
+
return { ...matrix, rotate: Number(el.getAttribute("rotation")) || 0, isLocked: false };
|
|
217844
217844
|
}
|
|
217845
217845
|
return { ...new Matrix2, rotate: 0, isLocked: false };
|
|
217846
217846
|
}
|
|
@@ -250332,7 +250332,7 @@ class ImageItem extends BaseItem {
|
|
|
250332
250332
|
renderHTML(documentFactory) {
|
|
250333
250333
|
const div = documentFactory.createElement("image-item");
|
|
250334
250334
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
250335
|
-
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})
|
|
250335
|
+
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
250336
250336
|
div.style.backgroundImage = `url(${this.storageLink})`;
|
|
250337
250337
|
div.id = this.getId();
|
|
250338
250338
|
div.style.width = `${this.imageDimension.width}px`;
|
|
@@ -250341,6 +250341,7 @@ class ImageItem extends BaseItem {
|
|
|
250341
250341
|
div.style.transform = transform;
|
|
250342
250342
|
div.style.position = "absolute";
|
|
250343
250343
|
div.style.backgroundSize = "cover";
|
|
250344
|
+
div.setAttribute("rotation", this.transformation.getRotation().toString());
|
|
250344
250345
|
div.setAttribute("data-link-to", this.linkTo.serialize() || "");
|
|
250345
250346
|
if (this.getLinkTo()) {
|
|
250346
250347
|
const linkElement = this.linkTo.renderHTML(documentFactory);
|
|
@@ -255965,7 +255966,7 @@ class Card extends BaseItem {
|
|
|
255965
255966
|
renderHTML(documentFactory) {
|
|
255966
255967
|
const div = super.renderHTML(documentFactory);
|
|
255967
255968
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
255968
|
-
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})
|
|
255969
|
+
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
255969
255970
|
div.style.backgroundImage = `url(${this.imageToRender?.src || this.backsideUrl})`;
|
|
255970
255971
|
div.id = this.getId();
|
|
255971
255972
|
div.style.width = `${conf.CARD_DIMENSIONS.width}px`;
|
|
@@ -255974,6 +255975,7 @@ class Card extends BaseItem {
|
|
|
255974
255975
|
div.style.transform = transform;
|
|
255975
255976
|
div.style.position = "absolute";
|
|
255976
255977
|
div.style.backgroundSize = "cover";
|
|
255978
|
+
div.setAttribute("rotation", this.transformation.getRotation().toString());
|
|
255977
255979
|
return div;
|
|
255978
255980
|
}
|
|
255979
255981
|
updateMbr() {
|
|
@@ -440612,6 +440614,16 @@ var ActionButtons = () => {
|
|
|
440612
440614
|
|
|
440613
440615
|
// src/features/UserPanel/Buttons/ShareBtn/ShareBtn.tsx
|
|
440614
440616
|
var import_react374 = __toESM(require_react(), 1);
|
|
440617
|
+
|
|
440618
|
+
// src/shared/lib/IframeModule.ts
|
|
440619
|
+
function redirectParentPage(url3, parentUrl) {
|
|
440620
|
+
window.parent.postMessage({
|
|
440621
|
+
type: "open-new-window",
|
|
440622
|
+
url: url3
|
|
440623
|
+
}, parentUrl);
|
|
440624
|
+
}
|
|
440625
|
+
|
|
440626
|
+
// src/features/UserPanel/Buttons/ShareBtn/ShareBtn.tsx
|
|
440615
440627
|
var ShareBtn = () => {
|
|
440616
440628
|
const { setIds } = useContextMenuContext();
|
|
440617
440629
|
const { openModal: openModal2 } = useUiModalContext();
|
|
@@ -440621,6 +440633,11 @@ var ShareBtn = () => {
|
|
|
440621
440633
|
const boardId = board.getBoardId();
|
|
440622
440634
|
const boardInfo = boardsList.getBoardInfo(boardId);
|
|
440623
440635
|
const handleShare = (ev) => {
|
|
440636
|
+
if (isIframe2()) {
|
|
440637
|
+
const currentPage = window.location.href;
|
|
440638
|
+
redirectParentPage(currentPage, currentPage.includes("dev") ? "https://dev-landing.microboard.io/" : "https://microboard.io/");
|
|
440639
|
+
return;
|
|
440640
|
+
}
|
|
440624
440641
|
ev.preventDefault();
|
|
440625
440642
|
ev.stopPropagation();
|
|
440626
440643
|
setIds(boardId);
|
|
@@ -442140,6 +442157,14 @@ var UserPanel = () => {
|
|
|
442140
442157
|
const { app, board } = useAppContext();
|
|
442141
442158
|
const account = useAccount2();
|
|
442142
442159
|
const insideOfMicroboard = document.referrer.includes("https://microboard.io/") || document.referrer.includes("https://microboard.ru/");
|
|
442160
|
+
const onLoginOrRegistrationClick = (url3) => {
|
|
442161
|
+
if (isIframe2()) {
|
|
442162
|
+
const origin = window.location.origin;
|
|
442163
|
+
redirectParentPage(origin + url3, origin.includes("dev") ? "https://dev-landing.microboard.io/" : "https://microboard.io/");
|
|
442164
|
+
} else {
|
|
442165
|
+
navigate(url3);
|
|
442166
|
+
}
|
|
442167
|
+
};
|
|
442143
442168
|
if (!account.isLoggedIn) {
|
|
442144
442169
|
return /* @__PURE__ */ import_react395.default.createElement(UiPanel, {
|
|
442145
442170
|
padding: 0,
|
|
@@ -442151,22 +442176,22 @@ var UserPanel = () => {
|
|
|
442151
442176
|
}, isMicroboardIframe() && insideOfMicroboard ? /* @__PURE__ */ import_react395.default.createElement(import_react395.default.Fragment, null, /* @__PURE__ */ import_react395.default.createElement(UiLink, {
|
|
442152
442177
|
variant: "secondary",
|
|
442153
442178
|
className: UserPanel_module_default.logInBtn,
|
|
442154
|
-
|
|
442179
|
+
onClick: () => onLoginOrRegistrationClick(`/auth/sign-in`),
|
|
442155
442180
|
target: "_parent",
|
|
442156
442181
|
size: "sm"
|
|
442157
442182
|
}, t11("auth.login")), /* @__PURE__ */ import_react395.default.createElement(UiLink, {
|
|
442158
442183
|
className: clsx_default(UserPanel_module_default.signUpBtn, UserPanel_module_default.smallMobileHide),
|
|
442159
|
-
|
|
442184
|
+
onClick: () => onLoginOrRegistrationClick(`/auth/sign-up`),
|
|
442160
442185
|
size: "sm",
|
|
442161
442186
|
target: "_parent"
|
|
442162
442187
|
}, t11("auth.signUpForFree")), /* @__PURE__ */ import_react395.default.createElement(ShareBtn, null)) : /* @__PURE__ */ import_react395.default.createElement(import_react395.default.Fragment, null, /* @__PURE__ */ import_react395.default.createElement(UiButton, {
|
|
442163
442188
|
variant: "secondary",
|
|
442164
442189
|
className: UserPanel_module_default.logInBtn,
|
|
442165
|
-
onClick: () =>
|
|
442190
|
+
onClick: () => onLoginOrRegistrationClick("/auth/sign-in"),
|
|
442166
442191
|
size: "sm"
|
|
442167
442192
|
}, t11("auth.login")), /* @__PURE__ */ import_react395.default.createElement(UiButton, {
|
|
442168
442193
|
className: UserPanel_module_default.signUpBtn,
|
|
442169
|
-
onClick: () =>
|
|
442194
|
+
onClick: () => onLoginOrRegistrationClick("/auth/sign-up"),
|
|
442170
442195
|
size: "sm"
|
|
442171
442196
|
}, t11("auth.signUpForFree")), /* @__PURE__ */ import_react395.default.createElement(ShareBtn, null)))));
|
|
442172
442197
|
}
|
package/dist/spa.js
CHANGED
|
@@ -217836,11 +217836,11 @@ var decodeHtml = (htmlString) => {
|
|
|
217836
217836
|
};
|
|
217837
217837
|
function getTransformationData(el) {
|
|
217838
217838
|
const transformStyle = el.style.transform;
|
|
217839
|
-
const transformMatch = transformStyle.match(/
|
|
217839
|
+
const transformMatch = transformStyle.match(/translate\(([^,]+)px,\s*([^)]+)px\)\s*scale\(([^,]+),\s*([^)]+)\)/);
|
|
217840
217840
|
if (transformMatch) {
|
|
217841
|
-
const [, translateX, translateY, scaleX, scaleY
|
|
217841
|
+
const [, translateX, translateY, scaleX, scaleY] = transformMatch.map(Number);
|
|
217842
217842
|
const matrix = new Matrix2(translateX, translateY, scaleX, scaleY);
|
|
217843
|
-
return { ...matrix, rotate, isLocked: false };
|
|
217843
|
+
return { ...matrix, rotate: Number(el.getAttribute("rotation")) || 0, isLocked: false };
|
|
217844
217844
|
}
|
|
217845
217845
|
return { ...new Matrix2, rotate: 0, isLocked: false };
|
|
217846
217846
|
}
|
|
@@ -250332,7 +250332,7 @@ class ImageItem extends BaseItem {
|
|
|
250332
250332
|
renderHTML(documentFactory) {
|
|
250333
250333
|
const div = documentFactory.createElement("image-item");
|
|
250334
250334
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
250335
|
-
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})
|
|
250335
|
+
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
250336
250336
|
div.style.backgroundImage = `url(${this.storageLink})`;
|
|
250337
250337
|
div.id = this.getId();
|
|
250338
250338
|
div.style.width = `${this.imageDimension.width}px`;
|
|
@@ -250341,6 +250341,7 @@ class ImageItem extends BaseItem {
|
|
|
250341
250341
|
div.style.transform = transform;
|
|
250342
250342
|
div.style.position = "absolute";
|
|
250343
250343
|
div.style.backgroundSize = "cover";
|
|
250344
|
+
div.setAttribute("rotation", this.transformation.getRotation().toString());
|
|
250344
250345
|
div.setAttribute("data-link-to", this.linkTo.serialize() || "");
|
|
250345
250346
|
if (this.getLinkTo()) {
|
|
250346
250347
|
const linkElement = this.linkTo.renderHTML(documentFactory);
|
|
@@ -255965,7 +255966,7 @@ class Card extends BaseItem {
|
|
|
255965
255966
|
renderHTML(documentFactory) {
|
|
255966
255967
|
const div = super.renderHTML(documentFactory);
|
|
255967
255968
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
255968
|
-
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})
|
|
255969
|
+
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
255969
255970
|
div.style.backgroundImage = `url(${this.imageToRender?.src || this.backsideUrl})`;
|
|
255970
255971
|
div.id = this.getId();
|
|
255971
255972
|
div.style.width = `${conf.CARD_DIMENSIONS.width}px`;
|
|
@@ -255974,6 +255975,7 @@ class Card extends BaseItem {
|
|
|
255974
255975
|
div.style.transform = transform;
|
|
255975
255976
|
div.style.position = "absolute";
|
|
255976
255977
|
div.style.backgroundSize = "cover";
|
|
255978
|
+
div.setAttribute("rotation", this.transformation.getRotation().toString());
|
|
255977
255979
|
return div;
|
|
255978
255980
|
}
|
|
255979
255981
|
updateMbr() {
|
|
@@ -440612,6 +440614,16 @@ var ActionButtons = () => {
|
|
|
440612
440614
|
|
|
440613
440615
|
// src/features/UserPanel/Buttons/ShareBtn/ShareBtn.tsx
|
|
440614
440616
|
var import_react374 = __toESM(require_react(), 1);
|
|
440617
|
+
|
|
440618
|
+
// src/shared/lib/IframeModule.ts
|
|
440619
|
+
function redirectParentPage(url3, parentUrl) {
|
|
440620
|
+
window.parent.postMessage({
|
|
440621
|
+
type: "open-new-window",
|
|
440622
|
+
url: url3
|
|
440623
|
+
}, parentUrl);
|
|
440624
|
+
}
|
|
440625
|
+
|
|
440626
|
+
// src/features/UserPanel/Buttons/ShareBtn/ShareBtn.tsx
|
|
440615
440627
|
var ShareBtn = () => {
|
|
440616
440628
|
const { setIds } = useContextMenuContext();
|
|
440617
440629
|
const { openModal: openModal2 } = useUiModalContext();
|
|
@@ -440621,6 +440633,11 @@ var ShareBtn = () => {
|
|
|
440621
440633
|
const boardId = board.getBoardId();
|
|
440622
440634
|
const boardInfo = boardsList.getBoardInfo(boardId);
|
|
440623
440635
|
const handleShare = (ev) => {
|
|
440636
|
+
if (isIframe2()) {
|
|
440637
|
+
const currentPage = window.location.href;
|
|
440638
|
+
redirectParentPage(currentPage, currentPage.includes("dev") ? "https://dev-landing.microboard.io/" : "https://microboard.io/");
|
|
440639
|
+
return;
|
|
440640
|
+
}
|
|
440624
440641
|
ev.preventDefault();
|
|
440625
440642
|
ev.stopPropagation();
|
|
440626
440643
|
setIds(boardId);
|
|
@@ -442140,6 +442157,14 @@ var UserPanel = () => {
|
|
|
442140
442157
|
const { app, board } = useAppContext();
|
|
442141
442158
|
const account = useAccount2();
|
|
442142
442159
|
const insideOfMicroboard = document.referrer.includes("https://microboard.io/") || document.referrer.includes("https://microboard.ru/");
|
|
442160
|
+
const onLoginOrRegistrationClick = (url3) => {
|
|
442161
|
+
if (isIframe2()) {
|
|
442162
|
+
const origin = window.location.origin;
|
|
442163
|
+
redirectParentPage(origin + url3, origin.includes("dev") ? "https://dev-landing.microboard.io/" : "https://microboard.io/");
|
|
442164
|
+
} else {
|
|
442165
|
+
navigate(url3);
|
|
442166
|
+
}
|
|
442167
|
+
};
|
|
442143
442168
|
if (!account.isLoggedIn) {
|
|
442144
442169
|
return /* @__PURE__ */ import_react395.default.createElement(UiPanel, {
|
|
442145
442170
|
padding: 0,
|
|
@@ -442151,22 +442176,22 @@ var UserPanel = () => {
|
|
|
442151
442176
|
}, isMicroboardIframe() && insideOfMicroboard ? /* @__PURE__ */ import_react395.default.createElement(import_react395.default.Fragment, null, /* @__PURE__ */ import_react395.default.createElement(UiLink, {
|
|
442152
442177
|
variant: "secondary",
|
|
442153
442178
|
className: UserPanel_module_default.logInBtn,
|
|
442154
|
-
|
|
442179
|
+
onClick: () => onLoginOrRegistrationClick(`/auth/sign-in`),
|
|
442155
442180
|
target: "_parent",
|
|
442156
442181
|
size: "sm"
|
|
442157
442182
|
}, t11("auth.login")), /* @__PURE__ */ import_react395.default.createElement(UiLink, {
|
|
442158
442183
|
className: clsx_default(UserPanel_module_default.signUpBtn, UserPanel_module_default.smallMobileHide),
|
|
442159
|
-
|
|
442184
|
+
onClick: () => onLoginOrRegistrationClick(`/auth/sign-up`),
|
|
442160
442185
|
size: "sm",
|
|
442161
442186
|
target: "_parent"
|
|
442162
442187
|
}, t11("auth.signUpForFree")), /* @__PURE__ */ import_react395.default.createElement(ShareBtn, null)) : /* @__PURE__ */ import_react395.default.createElement(import_react395.default.Fragment, null, /* @__PURE__ */ import_react395.default.createElement(UiButton, {
|
|
442163
442188
|
variant: "secondary",
|
|
442164
442189
|
className: UserPanel_module_default.logInBtn,
|
|
442165
|
-
onClick: () =>
|
|
442190
|
+
onClick: () => onLoginOrRegistrationClick("/auth/sign-in"),
|
|
442166
442191
|
size: "sm"
|
|
442167
442192
|
}, t11("auth.login")), /* @__PURE__ */ import_react395.default.createElement(UiButton, {
|
|
442168
442193
|
className: UserPanel_module_default.signUpBtn,
|
|
442169
|
-
onClick: () =>
|
|
442194
|
+
onClick: () => onLoginOrRegistrationClick("/auth/sign-up"),
|
|
442170
442195
|
size: "sm"
|
|
442171
442196
|
}, t11("auth.signUpForFree")), /* @__PURE__ */ import_react395.default.createElement(ShareBtn, null)))));
|
|
442172
442197
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { App } from "../../App";
|
|
2
|
+
export declare class IframeModule {
|
|
3
|
+
private static instance;
|
|
4
|
+
private app;
|
|
5
|
+
constructor(app: App, origins?: string[]);
|
|
6
|
+
private setEventListeners;
|
|
7
|
+
static getInstance(app: App, origins?: string[]): IframeModule;
|
|
8
|
+
private handleCustomMessages;
|
|
9
|
+
private sendSnapshotCreated;
|
|
10
|
+
private sendSnapshotError;
|
|
11
|
+
}
|
|
12
|
+
export declare function redirectParentPage(url: string, parentUrl: string): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "microboard-ui-temp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.95",
|
|
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.
|
|
63
|
+
"microboard-temp": "^0.5.34",
|
|
64
64
|
"nanoid": "^5.1.5",
|
|
65
65
|
"prop-types": "^15.8.1",
|
|
66
66
|
"react-hot-toast": "2.4.1",
|