microboard-temp 0.4.107 → 0.5.0
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/cjs/browser.js +68 -452
- package/dist/cjs/index.js +68 -452
- package/dist/cjs/node.js +68 -452
- package/dist/esm/browser.js +68 -452
- package/dist/esm/index.js +68 -452
- package/dist/esm/node.js +68 -452
- package/dist/microboard.css +1 -1
- package/dist/types/Keyboard/HotkeyRegistry.d.ts +13 -0
- package/dist/types/Keyboard/index.d.ts +1 -0
- package/package.json +1 -1
- package/dist/types/public/customWebComponents.d.ts +0 -24
- package/dist/types/public/loadLinkImages.d.ts +0 -0
package/dist/cjs/node.js
CHANGED
|
@@ -1663,6 +1663,7 @@ var require_css_escape = __commonJS((exports2, module2) => {
|
|
|
1663
1663
|
// src/node.ts
|
|
1664
1664
|
var exports_node = {};
|
|
1665
1665
|
__export(exports_node, {
|
|
1666
|
+
viewModeHotkeyRegistry: () => viewModeHotkeyRegistry,
|
|
1666
1667
|
validateRichTextData: () => validateRichTextData,
|
|
1667
1668
|
validateItemsMap: () => validateItemsMap,
|
|
1668
1669
|
uploadVideoToStorage: () => uploadVideoToStorage,
|
|
@@ -1702,6 +1703,7 @@ __export(exports_node, {
|
|
|
1702
1703
|
isFiniteNumber: () => isFiniteNumber,
|
|
1703
1704
|
isControlCharacter: () => isControlCharacter,
|
|
1704
1705
|
initI18N: () => initI18N,
|
|
1706
|
+
hotkeyNames: () => hotkeyNames,
|
|
1705
1707
|
getYouTubeVideoPreview: () => getYouTubeVideoPreview,
|
|
1706
1708
|
getYouTubeThumbnail: () => getYouTubeThumbnail,
|
|
1707
1709
|
getVideoMetadata: () => getVideoMetadata,
|
|
@@ -1716,6 +1718,7 @@ __export(exports_node, {
|
|
|
1716
1718
|
forceNumberIntoInterval: () => forceNumberIntoInterval,
|
|
1717
1719
|
fileTosha256: () => fileTosha256,
|
|
1718
1720
|
exportBoardSnapshot: () => exportBoardSnapshot,
|
|
1721
|
+
editModeHotkeyRegistry: () => editModeHotkeyRegistry,
|
|
1719
1722
|
decodeHtml: () => decodeHtml,
|
|
1720
1723
|
cursors: () => defaultCursors,
|
|
1721
1724
|
createVideoItem: () => createVideoItem,
|
|
@@ -50297,6 +50300,19 @@ function throttle(func, delay) {
|
|
|
50297
50300
|
};
|
|
50298
50301
|
}
|
|
50299
50302
|
|
|
50303
|
+
// src/Keyboard/HotkeyRegistry.ts
|
|
50304
|
+
var editModeHotkeyRegistry = {};
|
|
50305
|
+
var viewModeHotkeyRegistry = {};
|
|
50306
|
+
var hotkeyNames = {};
|
|
50307
|
+
function registerHotkey({ name, hotkey, hotkeyConfig, boardMode }) {
|
|
50308
|
+
if (boardMode === "edit") {
|
|
50309
|
+
editModeHotkeyRegistry[name] = hotkeyConfig;
|
|
50310
|
+
} else {
|
|
50311
|
+
viewModeHotkeyRegistry[name] = hotkeyConfig;
|
|
50312
|
+
}
|
|
50313
|
+
hotkeyNames[name] = hotkey;
|
|
50314
|
+
}
|
|
50315
|
+
|
|
50300
50316
|
// src/Items/Examples/CardGame/Card/Card.ts
|
|
50301
50317
|
var defaultCardData = {
|
|
50302
50318
|
itemType: "Card",
|
|
@@ -50413,6 +50429,23 @@ registerItem({
|
|
|
50413
50429
|
item: Card,
|
|
50414
50430
|
defaultData: defaultCardData
|
|
50415
50431
|
});
|
|
50432
|
+
registerHotkey({
|
|
50433
|
+
name: "flipCard",
|
|
50434
|
+
hotkey: { key: { button: "KeyF" }, label: { windows: "F", mac: "F" } },
|
|
50435
|
+
boardMode: "edit",
|
|
50436
|
+
hotkeyConfig: {
|
|
50437
|
+
allItemsType: ["Card"],
|
|
50438
|
+
cb: (event, board) => {
|
|
50439
|
+
const cards = board?.selection.items.list();
|
|
50440
|
+
if (!cards) {
|
|
50441
|
+
return;
|
|
50442
|
+
}
|
|
50443
|
+
cards.forEach((card) => {
|
|
50444
|
+
card.toggleIsOpen();
|
|
50445
|
+
});
|
|
50446
|
+
}
|
|
50447
|
+
}
|
|
50448
|
+
});
|
|
50416
50449
|
// src/Items/Examples/CardGame/Deck/Deck.ts
|
|
50417
50450
|
var defaultDeckData = {
|
|
50418
50451
|
itemType: "Deck"
|
|
@@ -51843,10 +51876,11 @@ var hotkeys_default = {
|
|
|
51843
51876
|
|
|
51844
51877
|
// src/Keyboard/isHotkeyPushed.ts
|
|
51845
51878
|
function isHotkeyPushed(hotkey, event) {
|
|
51846
|
-
|
|
51879
|
+
const hotkeys = { ...hotkeys_default, ...hotkeyNames };
|
|
51880
|
+
if (!hotkeys[hotkey]) {
|
|
51847
51881
|
return false;
|
|
51848
51882
|
}
|
|
51849
|
-
const { key } =
|
|
51883
|
+
const { key } = hotkeys[hotkey];
|
|
51850
51884
|
const isControlPushed = event.ctrlKey || event.metaKey;
|
|
51851
51885
|
const isShiftPushed = event.shiftKey;
|
|
51852
51886
|
const isAltPushed = event.altKey;
|
|
@@ -52226,13 +52260,14 @@ function logHotkey(hotkeyConfig, hotkeyName, status, context) {
|
|
|
52226
52260
|
|
|
52227
52261
|
// src/Keyboard/checkHotkeys.ts
|
|
52228
52262
|
function checkHotkeys(hotkeyMap, event, board) {
|
|
52229
|
-
const
|
|
52263
|
+
const fullHotkeysMap = { ...hotkeyMap, ...board.getInterfaceType() === "edit" ? editModeHotkeyRegistry : viewModeHotkeyRegistry };
|
|
52264
|
+
const entries = Object.entries(fullHotkeysMap);
|
|
52230
52265
|
for (const [hotkey, configOrCb] of entries) {
|
|
52231
52266
|
if (isHotkeyPushed(hotkey, event)) {
|
|
52232
52267
|
const context = board.selection.getContext();
|
|
52233
52268
|
if (typeof configOrCb === "function") {
|
|
52234
52269
|
event.preventDefault();
|
|
52235
|
-
configOrCb(event);
|
|
52270
|
+
configOrCb(event, board);
|
|
52236
52271
|
logHotkey(configOrCb, hotkey, "triggered", context);
|
|
52237
52272
|
return true;
|
|
52238
52273
|
}
|
|
@@ -52259,7 +52294,7 @@ function checkHotkeys(hotkeyMap, event, board) {
|
|
|
52259
52294
|
if (preventDefault) {
|
|
52260
52295
|
event.preventDefault();
|
|
52261
52296
|
}
|
|
52262
|
-
cb(event);
|
|
52297
|
+
cb(event, board);
|
|
52263
52298
|
logHotkey(configOrCb, hotkey, "triggered", context);
|
|
52264
52299
|
return true;
|
|
52265
52300
|
}
|
|
@@ -55506,416 +55541,6 @@ class BoardSelection {
|
|
|
55506
55541
|
});
|
|
55507
55542
|
}
|
|
55508
55543
|
}
|
|
55509
|
-
// src/public/customWebComponents.js
|
|
55510
|
-
var customWebComponents_default = `/* eslint-disable max-classes-per-file, @typescript-eslint/no-useless-constructor */
|
|
55511
|
-
class RichTextElement extends HTMLElement {
|
|
55512
|
-
constructor() {
|
|
55513
|
-
super();
|
|
55514
|
-
}
|
|
55515
|
-
}
|
|
55516
|
-
|
|
55517
|
-
class ShapeItemElement extends HTMLElement {
|
|
55518
|
-
constructor() {
|
|
55519
|
-
super();
|
|
55520
|
-
}
|
|
55521
|
-
}
|
|
55522
|
-
|
|
55523
|
-
class StickerElement extends HTMLElement {
|
|
55524
|
-
constructor() {
|
|
55525
|
-
super();
|
|
55526
|
-
}
|
|
55527
|
-
}
|
|
55528
|
-
|
|
55529
|
-
class DrawingElement extends HTMLElement {
|
|
55530
|
-
constructor() {
|
|
55531
|
-
super();
|
|
55532
|
-
}
|
|
55533
|
-
}
|
|
55534
|
-
|
|
55535
|
-
class ConnectorElement extends HTMLElement {
|
|
55536
|
-
constructor() {
|
|
55537
|
-
super();
|
|
55538
|
-
}
|
|
55539
|
-
}
|
|
55540
|
-
|
|
55541
|
-
class FrameItemElement extends HTMLElement {
|
|
55542
|
-
constructor() {
|
|
55543
|
-
super();
|
|
55544
|
-
}
|
|
55545
|
-
}
|
|
55546
|
-
|
|
55547
|
-
class ImageItemElement extends HTMLElement {
|
|
55548
|
-
constructor() {
|
|
55549
|
-
super();
|
|
55550
|
-
}
|
|
55551
|
-
}
|
|
55552
|
-
|
|
55553
|
-
class LinkItemElement extends HTMLElement {
|
|
55554
|
-
constructor() {
|
|
55555
|
-
super();
|
|
55556
|
-
}
|
|
55557
|
-
}
|
|
55558
|
-
|
|
55559
|
-
class AINodeItemElement extends HTMLElement {
|
|
55560
|
-
constructor() {
|
|
55561
|
-
super();
|
|
55562
|
-
}
|
|
55563
|
-
}
|
|
55564
|
-
|
|
55565
|
-
class VideoItemElement extends HTMLElement {
|
|
55566
|
-
constructor() {
|
|
55567
|
-
super();
|
|
55568
|
-
}
|
|
55569
|
-
}
|
|
55570
|
-
|
|
55571
|
-
class CommentElement extends HTMLElement {
|
|
55572
|
-
constructor() {
|
|
55573
|
-
super();
|
|
55574
|
-
}
|
|
55575
|
-
}
|
|
55576
|
-
|
|
55577
|
-
class AudioItemElement extends HTMLElement {
|
|
55578
|
-
constructor() {
|
|
55579
|
-
super();
|
|
55580
|
-
}
|
|
55581
|
-
}
|
|
55582
|
-
|
|
55583
|
-
customElements.define("rich-text", RichTextElement);
|
|
55584
|
-
customElements.define("shape-item", ShapeItemElement);
|
|
55585
|
-
customElements.define("sticker-item", StickerElement);
|
|
55586
|
-
customElements.define("drawing-item", DrawingElement);
|
|
55587
|
-
customElements.define("connector-item", ConnectorElement);
|
|
55588
|
-
customElements.define("frame-item", FrameItemElement);
|
|
55589
|
-
customElements.define("image-item", ImageItemElement);
|
|
55590
|
-
customElements.define("link-item", LinkItemElement);
|
|
55591
|
-
customElements.define("ainode-item", AINodeItemElement);
|
|
55592
|
-
customElements.define("video-item", VideoItemElement);
|
|
55593
|
-
customElements.define("comment-item", CommentElement);
|
|
55594
|
-
customElements.define("audio-item", AudioItemElement);
|
|
55595
|
-
|
|
55596
|
-
document.addEventListener("DOMContentLoaded", () => {
|
|
55597
|
-
const itemsDiv = document.querySelector("#items");
|
|
55598
|
-
if (!itemsDiv) {
|
|
55599
|
-
console.error("ITEMS DIV NOT FOUND!");
|
|
55600
|
-
return;
|
|
55601
|
-
}
|
|
55602
|
-
let isDragging = false;
|
|
55603
|
-
let startX, startY;
|
|
55604
|
-
let translateX = 0;
|
|
55605
|
-
let translateY = 0;
|
|
55606
|
-
let scale = 1;
|
|
55607
|
-
|
|
55608
|
-
itemsDiv.style.transformOrigin = "0 0";
|
|
55609
|
-
document.body.style.cursor = "grab";
|
|
55610
|
-
|
|
55611
|
-
function updateTransform() {
|
|
55612
|
-
itemsDiv.style.transform =
|
|
55613
|
-
"translate(" +
|
|
55614
|
-
translateX +
|
|
55615
|
-
"px, " +
|
|
55616
|
-
translateY +
|
|
55617
|
-
"px) scale(" +
|
|
55618
|
-
scale +
|
|
55619
|
-
")";
|
|
55620
|
-
}
|
|
55621
|
-
|
|
55622
|
-
function handleMouseDown(ev) {
|
|
55623
|
-
isDragging = true;
|
|
55624
|
-
startX = ev.clientX;
|
|
55625
|
-
startY = ev.clientY;
|
|
55626
|
-
itemsDiv.style.cursor = "grabbing";
|
|
55627
|
-
}
|
|
55628
|
-
|
|
55629
|
-
function handleMouseMove(ev) {
|
|
55630
|
-
if (!isDragging) {
|
|
55631
|
-
return;
|
|
55632
|
-
}
|
|
55633
|
-
const dx = ev.clientX - startX;
|
|
55634
|
-
const dy = ev.clientY - startY;
|
|
55635
|
-
startX += dx;
|
|
55636
|
-
startY += dy;
|
|
55637
|
-
translateX += dx;
|
|
55638
|
-
translateY += dy;
|
|
55639
|
-
updateTransform();
|
|
55640
|
-
}
|
|
55641
|
-
|
|
55642
|
-
function handleMouseUp(ev) {
|
|
55643
|
-
if (!isDragging) {
|
|
55644
|
-
return;
|
|
55645
|
-
}
|
|
55646
|
-
isDragging = false;
|
|
55647
|
-
itemsDiv.style.cursor = "grab";
|
|
55648
|
-
}
|
|
55649
|
-
|
|
55650
|
-
function handleWheel(ev) {
|
|
55651
|
-
ev.preventDefault();
|
|
55652
|
-
const factor = ev.deltaY < 0 ? 1.1 : 0.9;
|
|
55653
|
-
translateX = ev.clientX - (ev.clientX - translateX) * factor;
|
|
55654
|
-
translateY = ev.clientY - (ev.clientY - translateY) * factor;
|
|
55655
|
-
scale *= factor;
|
|
55656
|
-
updateTransform();
|
|
55657
|
-
}
|
|
55658
|
-
|
|
55659
|
-
document.addEventListener("mousedown", handleMouseDown);
|
|
55660
|
-
document.addEventListener("mousemove", handleMouseMove);
|
|
55661
|
-
document.addEventListener("mouseup", handleMouseUp);
|
|
55662
|
-
document.addEventListener("wheel", handleWheel, { passive: false });
|
|
55663
|
-
|
|
55664
|
-
const titlePanel = document.createElement("div");
|
|
55665
|
-
titlePanel.style.boxShadow = "0px 10px 16px -3px rgba(20, 21, 26, 0.08)";
|
|
55666
|
-
titlePanel.style.position = "fixed";
|
|
55667
|
-
titlePanel.style.left = "12px";
|
|
55668
|
-
titlePanel.style.top = "12px";
|
|
55669
|
-
titlePanel.style.borderRadius = "12px";
|
|
55670
|
-
titlePanel.style.backgroundColor = "#ffff";
|
|
55671
|
-
titlePanel.style.display = "flex";
|
|
55672
|
-
titlePanel.style.alignItems = "center";
|
|
55673
|
-
titlePanel.style.gap = "8px";
|
|
55674
|
-
titlePanel.style.padding = "0 12px";
|
|
55675
|
-
titlePanel.style.height = "48px";
|
|
55676
|
-
const editButton = document.createElement("button");
|
|
55677
|
-
const editIcon = document.createElementNS(
|
|
55678
|
-
"http://www.w3.org/2000/svg",
|
|
55679
|
-
"svg",
|
|
55680
|
-
);
|
|
55681
|
-
editIcon.setAttribute("width", "13");
|
|
55682
|
-
editIcon.setAttribute("height", "13");
|
|
55683
|
-
editIcon.setAttribute("viewBox", "0 0 13 13");
|
|
55684
|
-
editIcon.setAttribute("fill", "none");
|
|
55685
|
-
editIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
55686
|
-
const editIconPath = document.createElementNS(
|
|
55687
|
-
"http://www.w3.org/2000/svg",
|
|
55688
|
-
"path",
|
|
55689
|
-
);
|
|
55690
|
-
editIconPath.setAttribute(
|
|
55691
|
-
"d",
|
|
55692
|
-
"M7.838 0.999902V2.33324H1.33333V11.6666H10.6667V5.1619H12V12.3332C12 12.51 11.9298 12.6796 11.8047 12.8046C11.6797 12.9297 11.5101 12.9999 11.3333 12.9999H0.666667C0.489856 12.9999 0.320286 12.9297 0.195262 12.8046C0.0702379 12.6796 0 12.51 0 12.3332V1.66657C0 1.48976 0.0702379 1.32019 0.195262 1.19516C0.320286 1.07014 0.489856 0.999902 0.666667 0.999902H7.838ZM11.1847 0.872018C11.4453 0.611315 11.868 0.611355 12.1285 0.872108C12.3889 1.1327 12.3889 1.55503 12.1284 1.81553L6.472 7.4719L5.53067 7.4739L5.52933 6.52924L11.1847 0.872018Z",
|
|
55693
|
-
);
|
|
55694
|
-
editIconPath.setAttribute("fill", "#ffff");
|
|
55695
|
-
editIcon.appendChild(editIconPath);
|
|
55696
|
-
editButton.appendChild(editIcon);
|
|
55697
|
-
const editFileText = document.createElement("p");
|
|
55698
|
-
const isSnapshotInIframe =
|
|
55699
|
-
window.parent &&
|
|
55700
|
-
window.parent !== window &&
|
|
55701
|
-
window.parent.location.href.includes("/snapshots/");
|
|
55702
|
-
editFileText.textContent = isSnapshotInIframe ? "Edit copy" : "Edit file";
|
|
55703
|
-
editButton.appendChild(editFileText);
|
|
55704
|
-
|
|
55705
|
-
editButton.style.backgroundColor = "rgba(20, 21, 26, 1)";
|
|
55706
|
-
editButton.style.cursor = "pointer";
|
|
55707
|
-
editButton.style.boxShadow = "0px 1px 2px 0px rgba(20, 21, 26, 0.05)";
|
|
55708
|
-
editButton.style.color = "#ffff";
|
|
55709
|
-
editButton.style.fontSize = "14px";
|
|
55710
|
-
editButton.style.lineHeight = "20px";
|
|
55711
|
-
editButton.style.display = "flex";
|
|
55712
|
-
editButton.style.alignItems = "center";
|
|
55713
|
-
editButton.style.gap = "8px";
|
|
55714
|
-
editButton.style.padding = "8px";
|
|
55715
|
-
editButton.style.borderRadius = "10px";
|
|
55716
|
-
const separator = document.createElement("div");
|
|
55717
|
-
separator.style.borderRight = "1px solid rgba(222, 224, 227, 1)";
|
|
55718
|
-
separator.style.height = "100%";
|
|
55719
|
-
const boardName = document.createElement("div");
|
|
55720
|
-
const fileIcon = document.createElementNS(
|
|
55721
|
-
"http://www.w3.org/2000/svg",
|
|
55722
|
-
"svg",
|
|
55723
|
-
);
|
|
55724
|
-
fileIcon.setAttribute("width", "16");
|
|
55725
|
-
fileIcon.setAttribute("height", "18");
|
|
55726
|
-
fileIcon.setAttribute("viewBox", "0 0 16 18");
|
|
55727
|
-
fileIcon.setAttribute("fill", "none");
|
|
55728
|
-
fileIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
55729
|
-
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
55730
|
-
path.setAttribute(
|
|
55731
|
-
"d",
|
|
55732
|
-
"M10.5 2.33341H2.16667V15.6667H13.8333V5.66675H10.5V2.33341ZM0.5 1.49341C0.5 1.03675 0.8725 0.666748 1.3325 0.666748H11.3333L15.5 4.83342V16.4942C15.5008 16.6037 15.48 16.7122 15.4388 16.8136C15.3976 16.915 15.3369 17.0073 15.2601 17.0852C15.1832 17.1631 15.0918 17.2252 14.991 17.2678C14.8902 17.3103 14.7819 17.3327 14.6725 17.3334H1.3275C1.10865 17.3319 0.899181 17.2443 0.744348 17.0897C0.589515 16.935 0.501746 16.7256 0.5 16.5067V1.49341ZM7.16667 8.16675V5.66675H8.83333V8.16675H11.3333V9.83342H8.83333V12.3334H7.16667V9.83342H4.66667V8.16675H7.16667Z",
|
|
55733
|
-
);
|
|
55734
|
-
path.setAttribute("fill", "#696B76");
|
|
55735
|
-
fileIcon.appendChild(path);
|
|
55736
|
-
boardName.appendChild(fileIcon);
|
|
55737
|
-
const boardNameTag = document.querySelector('meta[name="board-name"]');
|
|
55738
|
-
let boardNameStr = "Untitled";
|
|
55739
|
-
if (boardNameTag) {
|
|
55740
|
-
boardNameStr = boardNameTag.getAttribute("content");
|
|
55741
|
-
}
|
|
55742
|
-
const p = document.createElement("p");
|
|
55743
|
-
p.textContent = boardNameStr;
|
|
55744
|
-
p.style.fontSize = "16px";
|
|
55745
|
-
p.style.lineHeight = "24px";
|
|
55746
|
-
boardName.appendChild(p);
|
|
55747
|
-
const cloudIcon = document.createElementNS(
|
|
55748
|
-
"http://www.w3.org/2000/svg",
|
|
55749
|
-
"svg",
|
|
55750
|
-
);
|
|
55751
|
-
cloudIcon.setAttribute("width", "20");
|
|
55752
|
-
cloudIcon.setAttribute("height", "18");
|
|
55753
|
-
cloudIcon.setAttribute("viewBox", "0 0 20 18");
|
|
55754
|
-
cloudIcon.setAttribute("fill", "none");
|
|
55755
|
-
cloudIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
55756
|
-
const cloudIconPath = document.createElementNS(
|
|
55757
|
-
"http://www.w3.org/2000/svg",
|
|
55758
|
-
"path",
|
|
55759
|
-
);
|
|
55760
|
-
cloudIconPath.setAttribute(
|
|
55761
|
-
"d",
|
|
55762
|
-
"M2.92711 0.75009L18.8371 16.6601L17.6579 17.8393L15.9796 16.1601C15.401 16.3854 14.7855 16.5007 14.1646 16.5001H5.83128C4.65063 16.5008 3.50782 16.0838 2.60518 15.3227C1.70255 14.5617 1.09833 13.5058 0.89953 12.342C0.700726 11.1782 0.920157 9.98165 1.51897 8.96413C2.11778 7.94662 3.05734 7.17382 4.17128 6.78259C4.13561 6.05854 4.23538 5.3342 4.46544 4.64676L1.74794 1.92842L2.92711 0.75009ZM5.83128 6.50009C5.83128 6.56759 5.83294 6.63592 5.83628 6.70259L5.89461 7.94259L4.72461 8.35426C3.98336 8.6164 3.35857 9.132 2.96052 9.81003C2.56248 10.4881 2.41678 11.2849 2.54916 12.0599C2.68153 12.8349 3.08347 13.5383 3.684 14.0457C4.28453 14.5532 5.04504 14.8322 5.83128 14.8334H14.1646C14.3196 14.8334 14.4721 14.8226 14.6213 14.8026L5.85628 6.03759C5.83961 6.18926 5.83128 6.34342 5.83128 6.50009ZM9.99794 0.666756C10.7878 0.666732 11.5694 0.827112 12.2954 1.13817C13.0214 1.44923 13.6767 1.90449 14.2215 2.47635C14.7664 3.04821 15.1894 3.72476 15.4649 4.46498C15.7405 5.2052 15.8629 5.99367 15.8246 6.78259C16.5167 7.02639 17.1467 7.41945 17.6699 7.93391C18.1931 8.44837 18.5967 9.07163 18.8521 9.75951C19.1076 10.4474 19.2085 11.183 19.1479 11.9143C19.0873 12.6455 18.8665 13.3545 18.5013 13.9909L17.2571 12.7468C17.5023 12.1401 17.5636 11.4747 17.4331 10.8335C17.3027 10.1924 16.9864 9.60375 16.5237 9.14112C16.061 8.67849 15.4723 8.36232 14.8311 8.23202C14.1899 8.10173 13.5245 8.16308 12.9179 8.40842L11.6729 7.16259C12.4071 6.74176 13.2571 6.50009 14.1646 6.50009C14.1646 5.73714 13.9551 4.98884 13.559 4.33679C13.1629 3.68473 12.5953 3.15396 11.9182 2.80235C11.2411 2.45073 10.4805 2.29177 9.71923 2.34281C8.95799 2.39384 8.22538 2.65291 7.60127 3.09176L6.40961 1.90009C7.43392 1.09887 8.69749 0.664571 9.99794 0.666756Z",
|
|
55763
|
-
);
|
|
55764
|
-
cloudIconPath.setAttribute("fill", "#696B76");
|
|
55765
|
-
cloudIcon.appendChild(cloudIconPath);
|
|
55766
|
-
boardName.appendChild(cloudIcon);
|
|
55767
|
-
boardName.style.display = "flex";
|
|
55768
|
-
boardName.style.alignItems = "center";
|
|
55769
|
-
boardName.style.gap = "8px";
|
|
55770
|
-
titlePanel.appendChild(boardName);
|
|
55771
|
-
titlePanel.appendChild(separator);
|
|
55772
|
-
titlePanel.appendChild(editButton);
|
|
55773
|
-
document.body.appendChild(titlePanel);
|
|
55774
|
-
|
|
55775
|
-
editButton.onclick = async () => {
|
|
55776
|
-
editButton.disabled = true;
|
|
55777
|
-
editButton.textContent = "Loading...";
|
|
55778
|
-
|
|
55779
|
-
try {
|
|
55780
|
-
document.removeEventListener("mousedown", handleMouseDown);
|
|
55781
|
-
document.removeEventListener("mousemove", handleMouseMove);
|
|
55782
|
-
document.removeEventListener("mouseup", handleMouseUp);
|
|
55783
|
-
document.removeEventListener("wheel", handleWheel, {
|
|
55784
|
-
passive: false,
|
|
55785
|
-
});
|
|
55786
|
-
translateX = 0;
|
|
55787
|
-
translateY = 0;
|
|
55788
|
-
scale = 1;
|
|
55789
|
-
updateTransform();
|
|
55790
|
-
|
|
55791
|
-
const { initBrowserSettings } = await import(
|
|
55792
|
-
"https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.js"
|
|
55793
|
-
);
|
|
55794
|
-
initBrowserSettings();
|
|
55795
|
-
|
|
55796
|
-
const { createApp } = await import(
|
|
55797
|
-
"https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.js"
|
|
55798
|
-
);
|
|
55799
|
-
|
|
55800
|
-
const app = createApp();
|
|
55801
|
-
window.app = app;
|
|
55802
|
-
const stringed = await app.openAndEditFile();
|
|
55803
|
-
|
|
55804
|
-
if (stringed) {
|
|
55805
|
-
await app.openBoardFromFile();
|
|
55806
|
-
app.getBoard().deserializeHTML(stringed);
|
|
55807
|
-
app.localRender("items");
|
|
55808
|
-
}
|
|
55809
|
-
|
|
55810
|
-
const response = await fetch(
|
|
55811
|
-
"https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.css",
|
|
55812
|
-
);
|
|
55813
|
-
const cssText = await response.text();
|
|
55814
|
-
const styleEl = document.createElement("style");
|
|
55815
|
-
styleEl.textContent = cssText;
|
|
55816
|
-
document.body.appendChild(styleEl);
|
|
55817
|
-
|
|
55818
|
-
const responseSvg = await fetch(
|
|
55819
|
-
"https://www.unpkg.com/test_package_board@0.0.99/dist/sprite.svg",
|
|
55820
|
-
);
|
|
55821
|
-
const svgText = await responseSvg.text();
|
|
55822
|
-
const div = document.createElement("div");
|
|
55823
|
-
div.style.display = "none";
|
|
55824
|
-
div.id = "sprite";
|
|
55825
|
-
div.innerHTML = svgText;
|
|
55826
|
-
document.body.appendChild(div);
|
|
55827
|
-
} finally {
|
|
55828
|
-
editButton.disabled = false;
|
|
55829
|
-
editButton.textContent = "Edit board";
|
|
55830
|
-
}
|
|
55831
|
-
};
|
|
55832
|
-
});
|
|
55833
|
-
`;
|
|
55834
|
-
|
|
55835
|
-
// src/public/index.css
|
|
55836
|
-
var public_default = `@import "https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&display=swap";
|
|
55837
|
-
@import "https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&display=swap";
|
|
55838
|
-
|
|
55839
|
-
/* ../src/index.css */
|
|
55840
|
-
:root {
|
|
55841
|
-
--background-surface-default: rgb(255, 255, 255);
|
|
55842
|
-
--background-button-secondary: rgb(255, 255, 255);
|
|
55843
|
-
--background-button-secondary-hover: rgb(247, 247, 248);
|
|
55844
|
-
--background-badge-purple-disabled: rgb(247, 241, 253);
|
|
55845
|
-
--background-badge-gray: rgb(233, 234, 236);
|
|
55846
|
-
--background-accent-purple: rgb(146, 79, 232);
|
|
55847
|
-
--border-action-normal: rgb(222, 223, 227);
|
|
55848
|
-
--border-action-focus: rgb(146, 79, 232);
|
|
55849
|
-
--border-select-primary: rgb(146, 79, 232);
|
|
55850
|
-
--text-base-primary: rgb(20, 21, 26);
|
|
55851
|
-
--text-base-secondary: rgba(15, 19, 36, 0.6);
|
|
55852
|
-
--text-base-quaternary: rgb(10, 15, 41, 0.25);
|
|
55853
|
-
--text-accent-purple: rgb(152, 89, 233);
|
|
55854
|
-
--icon-base-primary: rgb(20, 21, 26);
|
|
55855
|
-
--icon-base-secondary: rgb(105, 107, 118);
|
|
55856
|
-
--icon-accent-purple: rgb(146, 79, 232);
|
|
55857
|
-
--absolute-position-panel-padding: 12px;
|
|
55858
|
-
}
|
|
55859
|
-
* {
|
|
55860
|
-
box-sizing: border-box;
|
|
55861
|
-
padding: 0;
|
|
55862
|
-
margin: 0;
|
|
55863
|
-
border: none;
|
|
55864
|
-
background: none;
|
|
55865
|
-
font-family: inherit;
|
|
55866
|
-
}
|
|
55867
|
-
html {
|
|
55868
|
-
font-size: 62.5%;
|
|
55869
|
-
}
|
|
55870
|
-
body {
|
|
55871
|
-
color: var(--text-base-primary);
|
|
55872
|
-
font-size: 1.6rem;
|
|
55873
|
-
font-optical-sizing: auto;
|
|
55874
|
-
font-style: normal;
|
|
55875
|
-
font-family: "Manrope", sans-serif;
|
|
55876
|
-
}
|
|
55877
|
-
html,
|
|
55878
|
-
body {
|
|
55879
|
-
overscroll-behavior-x: none;
|
|
55880
|
-
-webkit-user-select: none;
|
|
55881
|
-
}
|
|
55882
|
-
input:-webkit-autofill,
|
|
55883
|
-
input:-webkit-autofill:hover,
|
|
55884
|
-
input:-webkit-autofill:focus,
|
|
55885
|
-
input:-webkit-autofill:active {
|
|
55886
|
-
-webkit-box-shadow: 0 0 0 30px white inset !important;
|
|
55887
|
-
}
|
|
55888
|
-
`;
|
|
55889
|
-
|
|
55890
|
-
// src/public/loadLinkImages.js
|
|
55891
|
-
var loadLinkImages_default = `document.addEventListener("DOMContentLoaded", function () {
|
|
55892
|
-
document.querySelectorAll(".link-object").forEach(linkItem => {
|
|
55893
|
-
const linkImage = linkItem.querySelector(".link-image");
|
|
55894
|
-
const linkContainer = linkItem.querySelector("a");
|
|
55895
|
-
linkImage.onerror = () => {
|
|
55896
|
-
linkImage.onerror = null;
|
|
55897
|
-
linkImage.style.display = "none";
|
|
55898
|
-
const svgNamespace = "http://www.w3.org/2000/svg";
|
|
55899
|
-
const svg = document.createElementNS(svgNamespace, "svg");
|
|
55900
|
-
svg.setAttribute("width", "20");
|
|
55901
|
-
svg.setAttribute("height", "20");
|
|
55902
|
-
svg.setAttribute("viewBox", "0 0 13 14");
|
|
55903
|
-
svg.setAttribute("fill", "none");
|
|
55904
|
-
|
|
55905
|
-
const path = document.createElementNS(svgNamespace, "path");
|
|
55906
|
-
path.setAttribute(
|
|
55907
|
-
"d",
|
|
55908
|
-
"M11.0054 3.414L2.39838 12.021L0.984375 10.607L9.59037 2H2.00538V0H13.0054V11H11.0054V3.414Z",
|
|
55909
|
-
);
|
|
55910
|
-
path.setAttribute("fill", "#924FE8");
|
|
55911
|
-
svg.appendChild(path);
|
|
55912
|
-
|
|
55913
|
-
linkContainer.appendChild(svg);
|
|
55914
|
-
};
|
|
55915
|
-
});
|
|
55916
|
-
});
|
|
55917
|
-
`;
|
|
55918
|
-
|
|
55919
55544
|
// src/Board.ts
|
|
55920
55545
|
class Board {
|
|
55921
55546
|
boardId;
|
|
@@ -56298,47 +55923,29 @@ class Board {
|
|
|
56298
55923
|
return this.copy();
|
|
56299
55924
|
}
|
|
56300
55925
|
serializeHTML() {
|
|
56301
|
-
const customTagsScript = customWebComponents_default;
|
|
56302
|
-
const loadLinksImagesScript = loadLinkImages_default;
|
|
56303
|
-
const css = public_default;
|
|
56304
55926
|
const boardName = this.getName() || this.getBoardId();
|
|
56305
55927
|
const items = this.items.getWholeHTML(conf.documentFactory);
|
|
56306
55928
|
const itemsDiv = `<div id="items">${items}</div>`;
|
|
56307
55929
|
const scripts = `
|
|
56308
|
-
<script type="module"
|
|
56309
|
-
|
|
55930
|
+
<script type="module" src="https://unpkg.com/microboard-ui-temp/dist/customWebComponents.js"></script>
|
|
55931
|
+
<script type="module" src="https://unpkg.com/microboard-ui-temp/dist/controlsHandlers.js"></script>
|
|
55932
|
+
<script type="module" src="https://unpkg.com/microboard-ui-temp/dist/titlePanel.js"></script>
|
|
55933
|
+
<script defer src="https://unpkg.com/microboard-ui-temp/dist/loadLinksImages.js"></script>
|
|
56310
55934
|
`;
|
|
56311
55935
|
const body = `<body style="overflow-x: hidden; overflow-y: hidden;">${itemsDiv}${scripts}</body>`;
|
|
56312
55936
|
const head = `
|
|
56313
|
-
|
|
56314
|
-
|
|
56315
|
-
|
|
56316
|
-
|
|
56317
|
-
|
|
56318
|
-
|
|
56319
|
-
|
|
56320
|
-
|
|
56321
|
-
|
|
56322
|
-
|
|
56323
|
-
|
|
56324
|
-
|
|
56325
|
-
appearance: none;
|
|
56326
|
-
width: 3px;
|
|
56327
|
-
height: 3px
|
|
56328
|
-
}
|
|
56329
|
-
::-webkit-scrollbar-button {
|
|
56330
|
-
display: none;
|
|
56331
|
-
}
|
|
56332
|
-
::-webkit-scrollbar-thumb {
|
|
56333
|
-
display: block;
|
|
56334
|
-
background-color: black;
|
|
56335
|
-
border-radius: 2px;
|
|
56336
|
-
}
|
|
56337
|
-
body {
|
|
56338
|
-
background-color: rgba(200, 200, 200, 0.2);
|
|
56339
|
-
}
|
|
56340
|
-
</style>
|
|
56341
|
-
</head>`.replace(/\t|\n/g, "");
|
|
55937
|
+
<head>
|
|
55938
|
+
<meta charset="utf-8" />
|
|
55939
|
+
<meta name="last-event-order" content="${this.events?.log.getLastIndex()}" />
|
|
55940
|
+
<title>Microboard ${boardName}</title>
|
|
55941
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
55942
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
55943
|
+
<link
|
|
55944
|
+
href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&display=swap"
|
|
55945
|
+
rel="stylesheet"
|
|
55946
|
+
/>
|
|
55947
|
+
<link rel="stylesheet" crossorigin href="https://unpkg.com/microboard-ui-temp/dist/board.css" />
|
|
55948
|
+
</head>`.replace(/\t|\n/g, "");
|
|
56342
55949
|
return `${head}${body}`;
|
|
56343
55950
|
}
|
|
56344
55951
|
deserializeHTMLAndEmit(stringedHTML) {
|
|
@@ -56408,7 +56015,10 @@ class Board {
|
|
|
56408
56015
|
const addItem = (itemData) => {
|
|
56409
56016
|
const item = this.createItem(itemData.id, itemData);
|
|
56410
56017
|
if (item instanceof Connector2) {
|
|
56411
|
-
createdConnectors[itemData.id] = {
|
|
56018
|
+
createdConnectors[itemData.id] = {
|
|
56019
|
+
item,
|
|
56020
|
+
itemData
|
|
56021
|
+
};
|
|
56412
56022
|
}
|
|
56413
56023
|
if ("index" in item && item.index) {
|
|
56414
56024
|
createdGroups[item.getId()] = { item, itemData };
|
|
@@ -56443,10 +56053,16 @@ class Board {
|
|
|
56443
56053
|
for (const itemData of items) {
|
|
56444
56054
|
const item = this.createItem(itemData.id, itemData);
|
|
56445
56055
|
if (item instanceof Connector2) {
|
|
56446
|
-
createdConnectors[itemData.id] = {
|
|
56056
|
+
createdConnectors[itemData.id] = {
|
|
56057
|
+
item,
|
|
56058
|
+
itemData
|
|
56059
|
+
};
|
|
56447
56060
|
}
|
|
56448
56061
|
if ("index" in item && item.index) {
|
|
56449
|
-
createdGroups[item.getId()] = {
|
|
56062
|
+
createdGroups[item.getId()] = {
|
|
56063
|
+
item,
|
|
56064
|
+
itemData
|
|
56065
|
+
};
|
|
56450
56066
|
}
|
|
56451
56067
|
this.index.insert(item);
|
|
56452
56068
|
}
|