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.
@@ -626,6 +626,7 @@ var require_escape_html = __commonJS((exports2, module2) => {
626
626
  // src/browser.ts
627
627
  var exports_browser = {};
628
628
  __export(exports_browser, {
629
+ viewModeHotkeyRegistry: () => viewModeHotkeyRegistry,
629
630
  validateRichTextData: () => validateRichTextData,
630
631
  validateItemsMap: () => validateItemsMap,
631
632
  uploadVideoToStorage: () => uploadVideoToStorage,
@@ -665,6 +666,7 @@ __export(exports_browser, {
665
666
  isFiniteNumber: () => isFiniteNumber,
666
667
  isControlCharacter: () => isControlCharacter,
667
668
  initI18N: () => initI18N,
669
+ hotkeyNames: () => hotkeyNames,
668
670
  getYouTubeVideoPreview: () => getYouTubeVideoPreview,
669
671
  getYouTubeThumbnail: () => getYouTubeThumbnail,
670
672
  getVideoMetadata: () => getVideoMetadata,
@@ -679,6 +681,7 @@ __export(exports_browser, {
679
681
  forceNumberIntoInterval: () => forceNumberIntoInterval,
680
682
  fileTosha256: () => fileTosha256,
681
683
  exportBoardSnapshot: () => exportBoardSnapshot,
684
+ editModeHotkeyRegistry: () => editModeHotkeyRegistry,
682
685
  decodeHtml: () => decodeHtml,
683
686
  cursors: () => defaultCursors,
684
687
  createVideoItem: () => createVideoItem,
@@ -47824,6 +47827,19 @@ function throttle(func, delay) {
47824
47827
  };
47825
47828
  }
47826
47829
 
47830
+ // src/Keyboard/HotkeyRegistry.ts
47831
+ var editModeHotkeyRegistry = {};
47832
+ var viewModeHotkeyRegistry = {};
47833
+ var hotkeyNames = {};
47834
+ function registerHotkey({ name, hotkey, hotkeyConfig, boardMode }) {
47835
+ if (boardMode === "edit") {
47836
+ editModeHotkeyRegistry[name] = hotkeyConfig;
47837
+ } else {
47838
+ viewModeHotkeyRegistry[name] = hotkeyConfig;
47839
+ }
47840
+ hotkeyNames[name] = hotkey;
47841
+ }
47842
+
47827
47843
  // src/Items/Examples/CardGame/Card/Card.ts
47828
47844
  var defaultCardData = {
47829
47845
  itemType: "Card",
@@ -47940,6 +47956,23 @@ registerItem({
47940
47956
  item: Card,
47941
47957
  defaultData: defaultCardData
47942
47958
  });
47959
+ registerHotkey({
47960
+ name: "flipCard",
47961
+ hotkey: { key: { button: "KeyF" }, label: { windows: "F", mac: "F" } },
47962
+ boardMode: "edit",
47963
+ hotkeyConfig: {
47964
+ allItemsType: ["Card"],
47965
+ cb: (event, board) => {
47966
+ const cards = board?.selection.items.list();
47967
+ if (!cards) {
47968
+ return;
47969
+ }
47970
+ cards.forEach((card) => {
47971
+ card.toggleIsOpen();
47972
+ });
47973
+ }
47974
+ }
47975
+ });
47943
47976
  // src/Items/Examples/CardGame/Deck/Deck.ts
47944
47977
  var defaultDeckData = {
47945
47978
  itemType: "Deck"
@@ -49370,10 +49403,11 @@ var hotkeys_default = {
49370
49403
 
49371
49404
  // src/Keyboard/isHotkeyPushed.ts
49372
49405
  function isHotkeyPushed(hotkey, event) {
49373
- if (!hotkeys_default[hotkey]) {
49406
+ const hotkeys = { ...hotkeys_default, ...hotkeyNames };
49407
+ if (!hotkeys[hotkey]) {
49374
49408
  return false;
49375
49409
  }
49376
- const { key } = hotkeys_default[hotkey];
49410
+ const { key } = hotkeys[hotkey];
49377
49411
  const isControlPushed = event.ctrlKey || event.metaKey;
49378
49412
  const isShiftPushed = event.shiftKey;
49379
49413
  const isAltPushed = event.altKey;
@@ -49753,13 +49787,14 @@ function logHotkey(hotkeyConfig, hotkeyName, status, context) {
49753
49787
 
49754
49788
  // src/Keyboard/checkHotkeys.ts
49755
49789
  function checkHotkeys(hotkeyMap, event, board) {
49756
- const entries = Object.entries(hotkeyMap);
49790
+ const fullHotkeysMap = { ...hotkeyMap, ...board.getInterfaceType() === "edit" ? editModeHotkeyRegistry : viewModeHotkeyRegistry };
49791
+ const entries = Object.entries(fullHotkeysMap);
49757
49792
  for (const [hotkey, configOrCb] of entries) {
49758
49793
  if (isHotkeyPushed(hotkey, event)) {
49759
49794
  const context = board.selection.getContext();
49760
49795
  if (typeof configOrCb === "function") {
49761
49796
  event.preventDefault();
49762
- configOrCb(event);
49797
+ configOrCb(event, board);
49763
49798
  logHotkey(configOrCb, hotkey, "triggered", context);
49764
49799
  return true;
49765
49800
  }
@@ -49786,7 +49821,7 @@ function checkHotkeys(hotkeyMap, event, board) {
49786
49821
  if (preventDefault) {
49787
49822
  event.preventDefault();
49788
49823
  }
49789
- cb(event);
49824
+ cb(event, board);
49790
49825
  logHotkey(configOrCb, hotkey, "triggered", context);
49791
49826
  return true;
49792
49827
  }
@@ -53033,416 +53068,6 @@ class BoardSelection {
53033
53068
  });
53034
53069
  }
53035
53070
  }
53036
- // src/public/customWebComponents.js
53037
- var customWebComponents_default = `/* eslint-disable max-classes-per-file, @typescript-eslint/no-useless-constructor */
53038
- class RichTextElement extends HTMLElement {
53039
- constructor() {
53040
- super();
53041
- }
53042
- }
53043
-
53044
- class ShapeItemElement extends HTMLElement {
53045
- constructor() {
53046
- super();
53047
- }
53048
- }
53049
-
53050
- class StickerElement extends HTMLElement {
53051
- constructor() {
53052
- super();
53053
- }
53054
- }
53055
-
53056
- class DrawingElement extends HTMLElement {
53057
- constructor() {
53058
- super();
53059
- }
53060
- }
53061
-
53062
- class ConnectorElement extends HTMLElement {
53063
- constructor() {
53064
- super();
53065
- }
53066
- }
53067
-
53068
- class FrameItemElement extends HTMLElement {
53069
- constructor() {
53070
- super();
53071
- }
53072
- }
53073
-
53074
- class ImageItemElement extends HTMLElement {
53075
- constructor() {
53076
- super();
53077
- }
53078
- }
53079
-
53080
- class LinkItemElement extends HTMLElement {
53081
- constructor() {
53082
- super();
53083
- }
53084
- }
53085
-
53086
- class AINodeItemElement extends HTMLElement {
53087
- constructor() {
53088
- super();
53089
- }
53090
- }
53091
-
53092
- class VideoItemElement extends HTMLElement {
53093
- constructor() {
53094
- super();
53095
- }
53096
- }
53097
-
53098
- class CommentElement extends HTMLElement {
53099
- constructor() {
53100
- super();
53101
- }
53102
- }
53103
-
53104
- class AudioItemElement extends HTMLElement {
53105
- constructor() {
53106
- super();
53107
- }
53108
- }
53109
-
53110
- customElements.define("rich-text", RichTextElement);
53111
- customElements.define("shape-item", ShapeItemElement);
53112
- customElements.define("sticker-item", StickerElement);
53113
- customElements.define("drawing-item", DrawingElement);
53114
- customElements.define("connector-item", ConnectorElement);
53115
- customElements.define("frame-item", FrameItemElement);
53116
- customElements.define("image-item", ImageItemElement);
53117
- customElements.define("link-item", LinkItemElement);
53118
- customElements.define("ainode-item", AINodeItemElement);
53119
- customElements.define("video-item", VideoItemElement);
53120
- customElements.define("comment-item", CommentElement);
53121
- customElements.define("audio-item", AudioItemElement);
53122
-
53123
- document.addEventListener("DOMContentLoaded", () => {
53124
- const itemsDiv = document.querySelector("#items");
53125
- if (!itemsDiv) {
53126
- console.error("ITEMS DIV NOT FOUND!");
53127
- return;
53128
- }
53129
- let isDragging = false;
53130
- let startX, startY;
53131
- let translateX = 0;
53132
- let translateY = 0;
53133
- let scale = 1;
53134
-
53135
- itemsDiv.style.transformOrigin = "0 0";
53136
- document.body.style.cursor = "grab";
53137
-
53138
- function updateTransform() {
53139
- itemsDiv.style.transform =
53140
- "translate(" +
53141
- translateX +
53142
- "px, " +
53143
- translateY +
53144
- "px) scale(" +
53145
- scale +
53146
- ")";
53147
- }
53148
-
53149
- function handleMouseDown(ev) {
53150
- isDragging = true;
53151
- startX = ev.clientX;
53152
- startY = ev.clientY;
53153
- itemsDiv.style.cursor = "grabbing";
53154
- }
53155
-
53156
- function handleMouseMove(ev) {
53157
- if (!isDragging) {
53158
- return;
53159
- }
53160
- const dx = ev.clientX - startX;
53161
- const dy = ev.clientY - startY;
53162
- startX += dx;
53163
- startY += dy;
53164
- translateX += dx;
53165
- translateY += dy;
53166
- updateTransform();
53167
- }
53168
-
53169
- function handleMouseUp(ev) {
53170
- if (!isDragging) {
53171
- return;
53172
- }
53173
- isDragging = false;
53174
- itemsDiv.style.cursor = "grab";
53175
- }
53176
-
53177
- function handleWheel(ev) {
53178
- ev.preventDefault();
53179
- const factor = ev.deltaY < 0 ? 1.1 : 0.9;
53180
- translateX = ev.clientX - (ev.clientX - translateX) * factor;
53181
- translateY = ev.clientY - (ev.clientY - translateY) * factor;
53182
- scale *= factor;
53183
- updateTransform();
53184
- }
53185
-
53186
- document.addEventListener("mousedown", handleMouseDown);
53187
- document.addEventListener("mousemove", handleMouseMove);
53188
- document.addEventListener("mouseup", handleMouseUp);
53189
- document.addEventListener("wheel", handleWheel, { passive: false });
53190
-
53191
- const titlePanel = document.createElement("div");
53192
- titlePanel.style.boxShadow = "0px 10px 16px -3px rgba(20, 21, 26, 0.08)";
53193
- titlePanel.style.position = "fixed";
53194
- titlePanel.style.left = "12px";
53195
- titlePanel.style.top = "12px";
53196
- titlePanel.style.borderRadius = "12px";
53197
- titlePanel.style.backgroundColor = "#ffff";
53198
- titlePanel.style.display = "flex";
53199
- titlePanel.style.alignItems = "center";
53200
- titlePanel.style.gap = "8px";
53201
- titlePanel.style.padding = "0 12px";
53202
- titlePanel.style.height = "48px";
53203
- const editButton = document.createElement("button");
53204
- const editIcon = document.createElementNS(
53205
- "http://www.w3.org/2000/svg",
53206
- "svg",
53207
- );
53208
- editIcon.setAttribute("width", "13");
53209
- editIcon.setAttribute("height", "13");
53210
- editIcon.setAttribute("viewBox", "0 0 13 13");
53211
- editIcon.setAttribute("fill", "none");
53212
- editIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
53213
- const editIconPath = document.createElementNS(
53214
- "http://www.w3.org/2000/svg",
53215
- "path",
53216
- );
53217
- editIconPath.setAttribute(
53218
- "d",
53219
- "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",
53220
- );
53221
- editIconPath.setAttribute("fill", "#ffff");
53222
- editIcon.appendChild(editIconPath);
53223
- editButton.appendChild(editIcon);
53224
- const editFileText = document.createElement("p");
53225
- const isSnapshotInIframe =
53226
- window.parent &&
53227
- window.parent !== window &&
53228
- window.parent.location.href.includes("/snapshots/");
53229
- editFileText.textContent = isSnapshotInIframe ? "Edit copy" : "Edit file";
53230
- editButton.appendChild(editFileText);
53231
-
53232
- editButton.style.backgroundColor = "rgba(20, 21, 26, 1)";
53233
- editButton.style.cursor = "pointer";
53234
- editButton.style.boxShadow = "0px 1px 2px 0px rgba(20, 21, 26, 0.05)";
53235
- editButton.style.color = "#ffff";
53236
- editButton.style.fontSize = "14px";
53237
- editButton.style.lineHeight = "20px";
53238
- editButton.style.display = "flex";
53239
- editButton.style.alignItems = "center";
53240
- editButton.style.gap = "8px";
53241
- editButton.style.padding = "8px";
53242
- editButton.style.borderRadius = "10px";
53243
- const separator = document.createElement("div");
53244
- separator.style.borderRight = "1px solid rgba(222, 224, 227, 1)";
53245
- separator.style.height = "100%";
53246
- const boardName = document.createElement("div");
53247
- const fileIcon = document.createElementNS(
53248
- "http://www.w3.org/2000/svg",
53249
- "svg",
53250
- );
53251
- fileIcon.setAttribute("width", "16");
53252
- fileIcon.setAttribute("height", "18");
53253
- fileIcon.setAttribute("viewBox", "0 0 16 18");
53254
- fileIcon.setAttribute("fill", "none");
53255
- fileIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
53256
- const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
53257
- path.setAttribute(
53258
- "d",
53259
- "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",
53260
- );
53261
- path.setAttribute("fill", "#696B76");
53262
- fileIcon.appendChild(path);
53263
- boardName.appendChild(fileIcon);
53264
- const boardNameTag = document.querySelector('meta[name="board-name"]');
53265
- let boardNameStr = "Untitled";
53266
- if (boardNameTag) {
53267
- boardNameStr = boardNameTag.getAttribute("content");
53268
- }
53269
- const p = document.createElement("p");
53270
- p.textContent = boardNameStr;
53271
- p.style.fontSize = "16px";
53272
- p.style.lineHeight = "24px";
53273
- boardName.appendChild(p);
53274
- const cloudIcon = document.createElementNS(
53275
- "http://www.w3.org/2000/svg",
53276
- "svg",
53277
- );
53278
- cloudIcon.setAttribute("width", "20");
53279
- cloudIcon.setAttribute("height", "18");
53280
- cloudIcon.setAttribute("viewBox", "0 0 20 18");
53281
- cloudIcon.setAttribute("fill", "none");
53282
- cloudIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
53283
- const cloudIconPath = document.createElementNS(
53284
- "http://www.w3.org/2000/svg",
53285
- "path",
53286
- );
53287
- cloudIconPath.setAttribute(
53288
- "d",
53289
- "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",
53290
- );
53291
- cloudIconPath.setAttribute("fill", "#696B76");
53292
- cloudIcon.appendChild(cloudIconPath);
53293
- boardName.appendChild(cloudIcon);
53294
- boardName.style.display = "flex";
53295
- boardName.style.alignItems = "center";
53296
- boardName.style.gap = "8px";
53297
- titlePanel.appendChild(boardName);
53298
- titlePanel.appendChild(separator);
53299
- titlePanel.appendChild(editButton);
53300
- document.body.appendChild(titlePanel);
53301
-
53302
- editButton.onclick = async () => {
53303
- editButton.disabled = true;
53304
- editButton.textContent = "Loading...";
53305
-
53306
- try {
53307
- document.removeEventListener("mousedown", handleMouseDown);
53308
- document.removeEventListener("mousemove", handleMouseMove);
53309
- document.removeEventListener("mouseup", handleMouseUp);
53310
- document.removeEventListener("wheel", handleWheel, {
53311
- passive: false,
53312
- });
53313
- translateX = 0;
53314
- translateY = 0;
53315
- scale = 1;
53316
- updateTransform();
53317
-
53318
- const { initBrowserSettings } = await import(
53319
- "https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.js"
53320
- );
53321
- initBrowserSettings();
53322
-
53323
- const { createApp } = await import(
53324
- "https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.js"
53325
- );
53326
-
53327
- const app = createApp();
53328
- window.app = app;
53329
- const stringed = await app.openAndEditFile();
53330
-
53331
- if (stringed) {
53332
- await app.openBoardFromFile();
53333
- app.getBoard().deserializeHTML(stringed);
53334
- app.localRender("items");
53335
- }
53336
-
53337
- const response = await fetch(
53338
- "https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.css",
53339
- );
53340
- const cssText = await response.text();
53341
- const styleEl = document.createElement("style");
53342
- styleEl.textContent = cssText;
53343
- document.body.appendChild(styleEl);
53344
-
53345
- const responseSvg = await fetch(
53346
- "https://www.unpkg.com/test_package_board@0.0.99/dist/sprite.svg",
53347
- );
53348
- const svgText = await responseSvg.text();
53349
- const div = document.createElement("div");
53350
- div.style.display = "none";
53351
- div.id = "sprite";
53352
- div.innerHTML = svgText;
53353
- document.body.appendChild(div);
53354
- } finally {
53355
- editButton.disabled = false;
53356
- editButton.textContent = "Edit board";
53357
- }
53358
- };
53359
- });
53360
- `;
53361
-
53362
- // src/public/index.css
53363
- var public_default = `@import "https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&display=swap";
53364
- @import "https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&display=swap";
53365
-
53366
- /* ../src/index.css */
53367
- :root {
53368
- --background-surface-default: rgb(255, 255, 255);
53369
- --background-button-secondary: rgb(255, 255, 255);
53370
- --background-button-secondary-hover: rgb(247, 247, 248);
53371
- --background-badge-purple-disabled: rgb(247, 241, 253);
53372
- --background-badge-gray: rgb(233, 234, 236);
53373
- --background-accent-purple: rgb(146, 79, 232);
53374
- --border-action-normal: rgb(222, 223, 227);
53375
- --border-action-focus: rgb(146, 79, 232);
53376
- --border-select-primary: rgb(146, 79, 232);
53377
- --text-base-primary: rgb(20, 21, 26);
53378
- --text-base-secondary: rgba(15, 19, 36, 0.6);
53379
- --text-base-quaternary: rgb(10, 15, 41, 0.25);
53380
- --text-accent-purple: rgb(152, 89, 233);
53381
- --icon-base-primary: rgb(20, 21, 26);
53382
- --icon-base-secondary: rgb(105, 107, 118);
53383
- --icon-accent-purple: rgb(146, 79, 232);
53384
- --absolute-position-panel-padding: 12px;
53385
- }
53386
- * {
53387
- box-sizing: border-box;
53388
- padding: 0;
53389
- margin: 0;
53390
- border: none;
53391
- background: none;
53392
- font-family: inherit;
53393
- }
53394
- html {
53395
- font-size: 62.5%;
53396
- }
53397
- body {
53398
- color: var(--text-base-primary);
53399
- font-size: 1.6rem;
53400
- font-optical-sizing: auto;
53401
- font-style: normal;
53402
- font-family: "Manrope", sans-serif;
53403
- }
53404
- html,
53405
- body {
53406
- overscroll-behavior-x: none;
53407
- -webkit-user-select: none;
53408
- }
53409
- input:-webkit-autofill,
53410
- input:-webkit-autofill:hover,
53411
- input:-webkit-autofill:focus,
53412
- input:-webkit-autofill:active {
53413
- -webkit-box-shadow: 0 0 0 30px white inset !important;
53414
- }
53415
- `;
53416
-
53417
- // src/public/loadLinkImages.js
53418
- var loadLinkImages_default = `document.addEventListener("DOMContentLoaded", function () {
53419
- document.querySelectorAll(".link-object").forEach(linkItem => {
53420
- const linkImage = linkItem.querySelector(".link-image");
53421
- const linkContainer = linkItem.querySelector("a");
53422
- linkImage.onerror = () => {
53423
- linkImage.onerror = null;
53424
- linkImage.style.display = "none";
53425
- const svgNamespace = "http://www.w3.org/2000/svg";
53426
- const svg = document.createElementNS(svgNamespace, "svg");
53427
- svg.setAttribute("width", "20");
53428
- svg.setAttribute("height", "20");
53429
- svg.setAttribute("viewBox", "0 0 13 14");
53430
- svg.setAttribute("fill", "none");
53431
-
53432
- const path = document.createElementNS(svgNamespace, "path");
53433
- path.setAttribute(
53434
- "d",
53435
- "M11.0054 3.414L2.39838 12.021L0.984375 10.607L9.59037 2H2.00538V0H13.0054V11H11.0054V3.414Z",
53436
- );
53437
- path.setAttribute("fill", "#924FE8");
53438
- svg.appendChild(path);
53439
-
53440
- linkContainer.appendChild(svg);
53441
- };
53442
- });
53443
- });
53444
- `;
53445
-
53446
53071
  // src/Board.ts
53447
53072
  class Board {
53448
53073
  boardId;
@@ -53825,47 +53450,29 @@ class Board {
53825
53450
  return this.copy();
53826
53451
  }
53827
53452
  serializeHTML() {
53828
- const customTagsScript = customWebComponents_default;
53829
- const loadLinksImagesScript = loadLinkImages_default;
53830
- const css = public_default;
53831
53453
  const boardName = this.getName() || this.getBoardId();
53832
53454
  const items = this.items.getWholeHTML(conf.documentFactory);
53833
53455
  const itemsDiv = `<div id="items">${items}</div>`;
53834
53456
  const scripts = `
53835
- <script type="module">${customTagsScript}</script>
53836
- <script defer>${loadLinksImagesScript}</script>
53457
+ <script type="module" src="https://unpkg.com/microboard-ui-temp/dist/customWebComponents.js"></script>
53458
+ <script type="module" src="https://unpkg.com/microboard-ui-temp/dist/controlsHandlers.js"></script>
53459
+ <script type="module" src="https://unpkg.com/microboard-ui-temp/dist/titlePanel.js"></script>
53460
+ <script defer src="https://unpkg.com/microboard-ui-temp/dist/loadLinksImages.js"></script>
53837
53461
  `;
53838
53462
  const body = `<body style="overflow-x: hidden; overflow-y: hidden;">${itemsDiv}${scripts}</body>`;
53839
53463
  const head = `
53840
- <head>
53841
- <meta charset="utf-8" />
53842
- <meta name="last-event-order" content="${this.events?.log.getLastIndex()}" />
53843
- <title>Microboard ${this.getBoardId()}</title>
53844
- <link rel="preconnect" href="https://fonts.googleapis.com">
53845
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
53846
- <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&display=swap"
53847
- rel="stylesheet"
53848
- />
53849
- <style>${css}</style>
53850
- <style>
53851
- ::-webkit-scrollbar {
53852
- appearance: none;
53853
- width: 3px;
53854
- height: 3px
53855
- }
53856
- ::-webkit-scrollbar-button {
53857
- display: none;
53858
- }
53859
- ::-webkit-scrollbar-thumb {
53860
- display: block;
53861
- background-color: black;
53862
- border-radius: 2px;
53863
- }
53864
- body {
53865
- background-color: rgba(200, 200, 200, 0.2);
53866
- }
53867
- </style>
53868
- </head>`.replace(/\t|\n/g, "");
53464
+ <head>
53465
+ <meta charset="utf-8" />
53466
+ <meta name="last-event-order" content="${this.events?.log.getLastIndex()}" />
53467
+ <title>Microboard ${boardName}</title>
53468
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
53469
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
53470
+ <link
53471
+ href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&display=swap"
53472
+ rel="stylesheet"
53473
+ />
53474
+ <link rel="stylesheet" crossorigin href="https://unpkg.com/microboard-ui-temp/dist/board.css" />
53475
+ </head>`.replace(/\t|\n/g, "");
53869
53476
  return `${head}${body}`;
53870
53477
  }
53871
53478
  deserializeHTMLAndEmit(stringedHTML) {
@@ -53935,7 +53542,10 @@ class Board {
53935
53542
  const addItem = (itemData) => {
53936
53543
  const item = this.createItem(itemData.id, itemData);
53937
53544
  if (item instanceof Connector2) {
53938
- createdConnectors[itemData.id] = { item, itemData };
53545
+ createdConnectors[itemData.id] = {
53546
+ item,
53547
+ itemData
53548
+ };
53939
53549
  }
53940
53550
  if ("index" in item && item.index) {
53941
53551
  createdGroups[item.getId()] = { item, itemData };
@@ -53970,10 +53580,16 @@ class Board {
53970
53580
  for (const itemData of items) {
53971
53581
  const item = this.createItem(itemData.id, itemData);
53972
53582
  if (item instanceof Connector2) {
53973
- createdConnectors[itemData.id] = { item, itemData };
53583
+ createdConnectors[itemData.id] = {
53584
+ item,
53585
+ itemData
53586
+ };
53974
53587
  }
53975
53588
  if ("index" in item && item.index) {
53976
- createdGroups[item.getId()] = { item, itemData };
53589
+ createdGroups[item.getId()] = {
53590
+ item,
53591
+ itemData
53592
+ };
53977
53593
  }
53978
53594
  this.index.insert(item);
53979
53595
  }