microboard-temp 0.4.6 → 0.4.7

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.
@@ -1630,6 +1630,9 @@ class Line {
1630
1630
  getStartPoint() {
1631
1631
  return this.start;
1632
1632
  }
1633
+ getEndPoint() {
1634
+ return this.end;
1635
+ }
1633
1636
  getLength() {
1634
1637
  const { start, end } = this;
1635
1638
  const deltaX = end.x - start.x;
@@ -3227,6 +3230,9 @@ class QuadraticBezier extends BaseCurve {
3227
3230
  getStartPoint() {
3228
3231
  return this.start;
3229
3232
  }
3233
+ getEndPoint() {
3234
+ return this.end;
3235
+ }
3230
3236
  moveToStart(ctx) {
3231
3237
  ctx.moveTo(this.start.x, this.start.y);
3232
3238
  }
@@ -3270,6 +3276,9 @@ class CubicBezier extends BaseCurve {
3270
3276
  getStartPoint() {
3271
3277
  return this.start;
3272
3278
  }
3279
+ getEndPoint() {
3280
+ return this.end;
3281
+ }
3273
3282
  moveToStart(ctx) {
3274
3283
  ctx.moveTo(this.start.x, this.start.y);
3275
3284
  }
@@ -7372,25 +7381,33 @@ class TransformationCommand {
7372
7381
  x: 1 / op2.x,
7373
7382
  y: 1 / op2.y
7374
7383
  };
7384
+ } else {
7385
+ reverseOp = {
7386
+ ...op2,
7387
+ x: 1,
7388
+ y: 1
7389
+ };
7375
7390
  }
7376
7391
  return { item: currTrans, operation: reverseOp };
7377
7392
  });
7378
7393
  }
7379
7394
  case "locked": {
7395
+ const op2 = this.operation;
7380
7396
  return mapItemsByOperation(this.transformation, () => {
7381
7397
  return {
7382
- ...this.operation,
7383
- item: [...op.item],
7398
+ ...op2,
7399
+ item: [...op2.item],
7384
7400
  method: "unlocked",
7385
7401
  locked: false
7386
7402
  };
7387
7403
  });
7388
7404
  }
7389
7405
  case "unlocked": {
7406
+ const op2 = this.operation;
7390
7407
  return mapItemsByOperation(this.transformation, () => {
7391
7408
  return {
7392
- ...this.operation,
7393
- item: [...op.item],
7409
+ ...op2,
7410
+ item: [...op2.item],
7394
7411
  method: "locked",
7395
7412
  locked: true
7396
7413
  };
@@ -9001,6 +9018,13 @@ var tagByType = {
9001
9018
  Comment: "comment-item",
9002
9019
  Group: ""
9003
9020
  };
9021
+ var headingTagsMap = {
9022
+ h1: "heading_one",
9023
+ h2: "heading_two",
9024
+ h3: "heading_three",
9025
+ h4: "heading_four",
9026
+ h5: "heading_five"
9027
+ };
9004
9028
  var parsersHTML = {
9005
9029
  "sticker-item": parseHTMLSticker,
9006
9030
  "shape-item": parseHTMLShape,
@@ -9025,12 +9049,12 @@ function getTransformationData(el) {
9025
9049
  if (transformMatch) {
9026
9050
  const [, translateX, translateY, scaleX, scaleY] = transformMatch.map(Number);
9027
9051
  const matrix = new Matrix2(translateX, translateY, scaleX, scaleY);
9028
- return { ...matrix, rotate: 0 };
9052
+ return { ...matrix, rotate: 0, isLocked: false };
9029
9053
  }
9030
- return { ...new Matrix2, rotate: 0 };
9054
+ return { ...new Matrix2, rotate: 0, isLocked: false };
9031
9055
  }
9032
9056
  function parseHTMLRichText(el, options) {
9033
- const parseNode = (node) => {
9057
+ const parseNode = (node, nestingLevel = 1) => {
9034
9058
  const isLinkNode = node.tagName.toLowerCase() === "a";
9035
9059
  if (node.tagName.toLowerCase() === "span" || isLinkNode && node.children.length === 0) {
9036
9060
  const isSingleSpace = node.textContent?.length === 1 && node.textContent?.trim() === "";
@@ -9053,7 +9077,7 @@ function parseHTMLRichText(el, options) {
9053
9077
  superscript: false
9054
9078
  };
9055
9079
  }
9056
- const children2 = Array.from(node.children).map((child) => parseNode(child));
9080
+ const children2 = Array.from(node.children).map((child) => parseNode(child, nestingLevel + 1));
9057
9081
  const tagName = node.tagName.toLowerCase();
9058
9082
  const extractCommonProps = () => ({
9059
9083
  horisontalAlignment: node.style.textAlign || "left",
@@ -9061,23 +9085,19 @@ function parseHTMLRichText(el, options) {
9061
9085
  paddingBottom: parseFloat(node.style.paddingBottom) || undefined
9062
9086
  });
9063
9087
  switch (tagName) {
9064
- case "blockquote":
9065
- return {
9066
- type: "block-quote",
9067
- ...extractCommonProps(),
9068
- children: children2
9069
- };
9070
9088
  case "ul":
9071
9089
  return {
9072
9090
  type: "ul_list",
9073
9091
  ...extractCommonProps(),
9074
- children: children2
9092
+ children: children2,
9093
+ listLevel: nestingLevel
9075
9094
  };
9076
9095
  case "ol":
9077
9096
  return {
9078
9097
  type: "ol_list",
9079
9098
  ...extractCommonProps(),
9080
- children: children2
9099
+ children: children2,
9100
+ listLevel: nestingLevel
9081
9101
  };
9082
9102
  case "li":
9083
9103
  return {
@@ -9099,11 +9119,9 @@ function parseHTMLRichText(el, options) {
9099
9119
  case "h2":
9100
9120
  case "h3":
9101
9121
  case "h4":
9102
- case "h5":
9103
- case "h6": {
9104
- const headingType = `heading_${["one", "two", "three", "four", "five", "six"][parseInt(tagName[1]) - 1]}`;
9122
+ case "h5": {
9105
9123
  return {
9106
- type: headingType,
9124
+ type: headingTagsMap[tagName],
9107
9125
  ...extractCommonProps(),
9108
9126
  children: children2
9109
9127
  };
@@ -9307,6 +9325,7 @@ function parseHTMLConnector(el) {
9307
9325
  ...endPointType === "FixedConnector" ? { segment: startSegment, tangent: endTangent } : {}
9308
9326
  };
9309
9327
  const connectorData = {
9328
+ middlePoint: null,
9310
9329
  id: el.id,
9311
9330
  itemType: "Connector",
9312
9331
  transformation,
@@ -9367,6 +9386,7 @@ function parseHTMLDrawing(el) {
9367
9386
  }
9368
9387
  function parseHTMLAINode(el) {
9369
9388
  const aiNodeData = {
9389
+ threadDirection: 3,
9370
9390
  id: el.id,
9371
9391
  itemType: "AINode",
9372
9392
  parentNodeId: el.getAttribute("parent-node-id") || undefined,
@@ -17219,7 +17239,9 @@ function setNodeChildrenStyles({
17219
17239
  }) {
17220
17240
  let fontStyles = conf.DEFAULT_TEXT_STYLES;
17221
17241
  if (editor) {
17222
- fontStyles = import_slate19.Editor.marks(editor) || conf.DEFAULT_TEXT_STYLES;
17242
+ const marks = import_slate19.Editor.marks(editor);
17243
+ const fontSize = marks?.fontSize ? marks.fontSize === "auto" ? conf.DEFAULT_TEXT_STYLES.fontSize : marks.fontSize : conf.DEFAULT_TEXT_STYLES.fontSize;
17244
+ fontStyles = marks ? { ...conf.DEFAULT_TEXT_STYLES, ...marks, fontSize } : conf.DEFAULT_TEXT_STYLES;
17223
17245
  }
17224
17246
  switch (node2.type) {
17225
17247
  case "heading_one":
@@ -17269,6 +17291,9 @@ function setNodeStyles({
17269
17291
  editor,
17270
17292
  horisontalAlignment
17271
17293
  }) {
17294
+ if (node2.type === "list_item") {
17295
+ return;
17296
+ }
17272
17297
  if (node2.type === "ol_list" || node2.type === "ul_list") {
17273
17298
  node2.listLevel = listLevel;
17274
17299
  for (const listItem of node2.children) {
@@ -17419,9 +17444,10 @@ class MarkdownProcessor {
17419
17444
  } else {
17420
17445
  const lastParagraphPath = this.getText().length - 1;
17421
17446
  const lastParagraph = this.getText()[lastParagraphPath];
17447
+ const lastParagraphText = lastParagraph.children[lastParagraph.children.length - 1];
17422
17448
  const insertLocation = {
17423
17449
  path: [lastParagraphPath, lastParagraph.children.length - 1],
17424
- offset: lastParagraph.children[lastParagraph.children.length - 1].text.length
17450
+ offset: lastParagraphText.text.length
17425
17451
  };
17426
17452
  import_slate20.Transforms.insertText(this.editor, combinedText, {
17427
17453
  at: insertLocation
@@ -18436,14 +18462,6 @@ class RichTextCommand {
18436
18462
  fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() || conf.DEFAULT_TEXT_STYLES.fontColor
18437
18463
  }
18438
18464
  }));
18439
- case "setBlockType":
18440
- return items.map((id) => ({
18441
- item: id,
18442
- operation: {
18443
- ...this.operation,
18444
- type: this.board.items.getById(id)?.getRichText()?.getBlockType() || "paragraph"
18445
- }
18446
- }));
18447
18465
  case "setFontStyle":
18448
18466
  return items.map((id) => ({
18449
18467
  item: id,
@@ -18546,7 +18564,8 @@ class RichTextGroupCommand {
18546
18564
  class: "RichText",
18547
18565
  method: "edit",
18548
18566
  item: [richText.getId() ?? ""],
18549
- ops
18567
+ ops,
18568
+ selection: null
18550
18569
  }
18551
18570
  });
18552
18571
  }
@@ -18563,7 +18582,8 @@ class RichTextGroupCommand {
18563
18582
  class: "RichText",
18564
18583
  method: "edit",
18565
18584
  item: [richText.getId() ?? ""],
18566
- ops: ops.map((op) => import_slate34.Operation.inverse(op)).reverse()
18585
+ ops: ops.map((op) => import_slate34.Operation.inverse(op)).reverse(),
18586
+ selection: null
18567
18587
  }
18568
18588
  });
18569
18589
  }
@@ -19213,6 +19233,9 @@ class Comment2 {
19213
19233
  const anchor = this.anchor.copy();
19214
19234
  return new Mbr(anchor.x, anchor.y, anchor.x, anchor.y);
19215
19235
  }
19236
+ getPathMbr() {
19237
+ return this.getMbr();
19238
+ }
19216
19239
  getNearestEdgePointTo(point3) {
19217
19240
  return this.anchor;
19218
19241
  }
@@ -19700,6 +19723,9 @@ class BaseItem extends Mbr {
19700
19723
  onRemove() {
19701
19724
  this.onRemoveCallbacks.forEach((cb) => cb());
19702
19725
  }
19726
+ getPathMbr() {
19727
+ return this.getMbr().copy();
19728
+ }
19703
19729
  render(context) {}
19704
19730
  renderHTML(documentFactory) {
19705
19731
  return documentFactory.createElement("div");
@@ -20225,7 +20251,10 @@ class RichText extends BaseItem {
20225
20251
  }
20226
20252
  getFontSize() {
20227
20253
  const marks = this.editor.getSelectionMarks();
20228
- const fontSize = marks?.fontSize ?? this.initialTextStyles.fontSize;
20254
+ let fontSize = marks?.fontSize ?? this.initialTextStyles.fontSize;
20255
+ if (fontSize === "auto") {
20256
+ fontSize = this.initialTextStyles.fontSize;
20257
+ }
20229
20258
  if (this.autoSize) {
20230
20259
  return fontSize * this.autoSizeScale;
20231
20260
  }
@@ -20243,7 +20272,7 @@ class RichText extends BaseItem {
20243
20272
  for (const [node2] of textNodes) {
20244
20273
  const fontSize = node2.fontSize || node2 && node2.fontSize;
20245
20274
  if (fontSize) {
20246
- fontSizes.push(fontSize);
20275
+ fontSizes.push(fontSize === "auto" ? this.initialTextStyles.fontSize : fontSize);
20247
20276
  }
20248
20277
  }
20249
20278
  if (fontSizes.length > 0) {
@@ -20256,7 +20285,7 @@ class RichText extends BaseItem {
20256
20285
  return marks?.fontHighlight ?? this.initialTextStyles.fontHighlight;
20257
20286
  }
20258
20287
  getBlockType() {
20259
- const blockNode = getSelectedBlockNode(this.editor);
20288
+ const blockNode = getSelectedBlockNode(this.editor.editor);
20260
20289
  return blockNode ? blockNode.type : "paragraph";
20261
20290
  }
20262
20291
  getHorisontalAlignment() {
@@ -20287,16 +20316,18 @@ class RichText extends BaseItem {
20287
20316
  const refMbr = new Mbr(domMbr.left, domMbr.top, domMbr.right, domMbr.bottom);
20288
20317
  if (refMbr.isInside(point3) && (conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
20289
20318
  const domRange = conf.documentFactory.caretPositionFromPoint ? conf.documentFactory.caretPositionFromPoint(point3.x, point3.y) : conf.documentFactory.caretRangeFromPoint(point3.x, point3.y);
20290
- const textNode = conf.documentFactory.caretPositionFromPoint ? domRange.offsetNode : domRange.startContainer;
20291
- const offset = conf.documentFactory.caretPositionFromPoint ? domRange.offset : domRange.startOffset;
20292
- const slatePoint = conf.reactEditorToSlatePoint(this.editor.editor, textNode, offset, {
20293
- exactMatch: false,
20294
- suppressThrow: false
20295
- });
20296
- if (slatePoint) {
20297
- const nRange = { anchor: slatePoint, focus: slatePoint };
20298
- this.editorTransforms.select(this.editor.editor, nRange);
20299
- conf.reactEditorFocus(this.editor.editor);
20319
+ if (domRange) {
20320
+ const textNode = conf.documentFactory.caretPositionFromPoint ? domRange.offsetNode : domRange.startContainer;
20321
+ const offset = conf.documentFactory.caretPositionFromPoint ? domRange.offset : domRange.startOffset;
20322
+ const slatePoint = conf.reactEditorToSlatePoint(this.editor.editor, textNode, offset, {
20323
+ exactMatch: false,
20324
+ suppressThrow: false
20325
+ });
20326
+ if (slatePoint) {
20327
+ const nRange = { anchor: slatePoint, focus: slatePoint };
20328
+ this.editorTransforms.select(this.editor.editor, nRange);
20329
+ conf.reactEditorFocus(this.editor.editor);
20330
+ }
20300
20331
  }
20301
20332
  } else {
20302
20333
  if (!(conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
@@ -37504,6 +37535,9 @@ class Shape extends BaseItem {
37504
37535
  getMbr() {
37505
37536
  return this.mbr.copy();
37506
37537
  }
37538
+ getPathMbr() {
37539
+ return this.getPath().getMbr();
37540
+ }
37507
37541
  getNearestEdgePointTo(point5) {
37508
37542
  return this.path.getNearestEdgePointTo(point5);
37509
37543
  }
@@ -43284,13 +43318,8 @@ function createCanvasDrawer(board) {
43284
43318
  // src/Selection/QuickAddButtons/quickAddHelpers.ts
43285
43319
  function getControlPointData(item, index2, isRichText = false) {
43286
43320
  const itemScale = isRichText ? { x: 1, y: 1 } : item.transformation.getScale();
43287
- const width2 = item.itemType === "Shape" ? item.getPath().getMbr().getWidth() : item.getMbr().getWidth();
43288
- let height3;
43289
- if (item.itemType === "Shape" && index2 !== 2 && index2 !== 3) {
43290
- height3 = item.getPath().getMbr().getHeight();
43291
- } else {
43292
- height3 = item.getMbr().getHeight();
43293
- }
43321
+ const width2 = item.getPathMbr().getWidth();
43322
+ let height3 = item.getPathMbr().getHeight();
43294
43323
  const adjMapScaled = {
43295
43324
  0: { x: 0, y: height3 / 2 / itemScale.y },
43296
43325
  1: {
@@ -43323,7 +43352,7 @@ function quickAddItem(board, type, connector) {
43323
43352
  optionalItem = new Sticker(board);
43324
43353
  break;
43325
43354
  case "AINode":
43326
- optionalItem = createAINode2(board, startPoint?.item?.getId(), 3);
43355
+ optionalItem = createAINode2(board, 3, "item" in startPoint ? startPoint?.item?.getId() : undefined);
43327
43356
  break;
43328
43357
  }
43329
43358
  let itemMbr = optionalItem.getMbr();
@@ -43350,20 +43379,25 @@ function quickAddItem(board, type, connector) {
43350
43379
  if ("text" in guarded && guarded.itemType !== "AINode" && guarded.itemType !== "RichText") {
43351
43380
  delete guarded.text;
43352
43381
  }
43382
+ if (!itemData.transformation) {
43383
+ itemData.transformation = new DefaultTransformationData;
43384
+ }
43353
43385
  itemData.transformation.translateX = endPoint.x;
43354
43386
  itemData.transformation.translateY = endPoint.y;
43355
43387
  const lines = connector.lines.getSegments();
43356
43388
  const lastLine = lines[lines.length - 1];
43357
- let dir2 = getDirection(lastLine.start, lastLine.end);
43389
+ const lastLineStart = lastLine.getStartPoint();
43390
+ const lastLineEnd = lastLine.getEndPoint();
43391
+ let dir2 = getDirection(lastLineStart, lastLineEnd);
43392
+ const firstLineStart = lines[0].getEndPoint();
43358
43393
  if (!dir2) {
43359
- const firstLine = lines[0];
43360
- const xDiff = Math.abs(firstLine.start.x - lastLine.end.x);
43361
- const yDiff = Math.abs(firstLine.start.y - lastLine.end.y);
43394
+ const xDiff = Math.abs(firstLineStart.x - lastLineEnd.x);
43395
+ const yDiff = Math.abs(firstLineStart.y - lastLineEnd.y);
43362
43396
  dir2 = xDiff > yDiff ? "horizontal" : "vertical";
43363
43397
  }
43364
43398
  let dirIndex = -1;
43365
43399
  if (dir2 === "vertical") {
43366
- if (lines[0].start.y > lastLine.end.y) {
43400
+ if (firstLineStart.y > lastLineEnd.y) {
43367
43401
  itemData.transformation.translateX -= itemMbr.getWidth() / 2;
43368
43402
  itemData.transformation.translateY -= itemMbr.getHeight();
43369
43403
  dirIndex = 3;
@@ -43372,7 +43406,7 @@ function quickAddItem(board, type, connector) {
43372
43406
  dirIndex = 2;
43373
43407
  }
43374
43408
  } else if (dir2 === "horizontal") {
43375
- if (lines[0].start.x > lastLine.end.x) {
43409
+ if (firstLineStart.x > lastLineEnd.x) {
43376
43410
  itemData.transformation.translateX -= itemMbr.getWidth();
43377
43411
  itemData.transformation.translateY -= itemMbr.getHeight() / 2;
43378
43412
  dirIndex = 1;
@@ -43394,7 +43428,7 @@ function quickAddItem(board, type, connector) {
43394
43428
  connector.setEndPoint(newEndPoint);
43395
43429
  board.selection.removeAll();
43396
43430
  board.selection.add(added);
43397
- if (added.itemType === "RichText" || added.itemType === "AINode") {
43431
+ if (added instanceof RichText || added instanceof AINode) {
43398
43432
  const text5 = added.getRichText();
43399
43433
  text5.editor.setMaxWidth(text5.editor.maxWidth || 600);
43400
43434
  board.selection.editText();
@@ -43402,7 +43436,7 @@ function quickAddItem(board, type, connector) {
43402
43436
  board.selection.setContext("EditUnderPointer");
43403
43437
  }
43404
43438
  }
43405
- function createAINode2(board, parentNodeId, directionIndex) {
43439
+ function createAINode2(board, directionIndex, parentNodeId) {
43406
43440
  const node2 = new AINode(board, true, parentNodeId, undefined, directionIndex);
43407
43441
  const nodeRichText = node2.getRichText();
43408
43442
  nodeRichText.applyMaxWidth(600);
@@ -43436,17 +43470,17 @@ function getQuickAddButtons(selection, board) {
43436
43470
  let quickAddItems = undefined;
43437
43471
  function calculateQuickAddPosition(index2, selectedItem, connectorStartPoint) {
43438
43472
  const connectorStorage = new SessionStorage;
43439
- const currMbr = selectedItem.getMbr();
43473
+ const currMbr = selectedItem.getPathMbr();
43440
43474
  const selectedItemData = selectedItem.serialize();
43441
- const width2 = selectedItem.itemType === "Shape" ? selectedItem.getPath().getMbr().getWidth() : currMbr.getWidth();
43442
- const height3 = selectedItem.itemType === "Shape" ? selectedItem.getPath().getMbr().getHeight() : currMbr.getHeight();
43475
+ const width2 = currMbr.getWidth();
43476
+ const height3 = currMbr.getHeight();
43443
43477
  let offsetX = width2;
43444
43478
  let offsetY = height3;
43445
43479
  let newWidth = width2;
43446
43480
  let newHeight = height3;
43447
43481
  let itemData;
43448
43482
  if (selectedItem.itemType === "AINode" || selectedItem.itemType === "RichText") {
43449
- const item = selectedItem.itemType === "AINode" ? createAINode2(board, selectedItem.getId(), index2) : createRichText2(board);
43483
+ const item = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
43450
43484
  newWidth = item.getMbr().getWidth();
43451
43485
  newHeight = item.getMbr().getHeight();
43452
43486
  itemData = item.serialize();
@@ -43495,9 +43529,9 @@ function getQuickAddButtons(selection, board) {
43495
43529
  const endPoints = getQuickButtonsPositions(newMbr);
43496
43530
  const reverseIndexMap = { 0: 1, 1: 0, 2: 3, 3: 2 };
43497
43531
  const connectorEndPoint = endPoints?.positions[reverseIndexMap[index2]] || new Point;
43498
- const fontSize = selectedItem.itemType === "RichText" ? selectedItem.getFontSize() : 14;
43532
+ const fontSize = selectedItem instanceof RichText ? selectedItem.getFontSize() : 14;
43499
43533
  const newItem = board.createItem(board.getNewItemId(), newItemData);
43500
- if (newItem.itemType === "RichText") {
43534
+ if (newItem instanceof RichText) {
43501
43535
  const storage = new SessionStorage;
43502
43536
  storage.setFontSize("RichText", fontSize);
43503
43537
  newItem.editor.selectWholeText();
@@ -43510,6 +43544,10 @@ function getQuickAddButtons(selection, board) {
43510
43544
  const scaleX = newItemMbr.getWidth() / 100;
43511
43545
  const scaleY = newItemMbr.getHeight() / 100;
43512
43546
  shapeData.transformation = {
43547
+ isLocked: false,
43548
+ rotate: 0,
43549
+ translateX: 0,
43550
+ translateY: 0,
43513
43551
  ...newItemData.transformation,
43514
43552
  scaleX,
43515
43553
  scaleY
@@ -43566,7 +43604,7 @@ function getQuickAddButtons(selection, board) {
43566
43604
  }
43567
43605
  let pathCenter;
43568
43606
  if (single.itemType === "Shape") {
43569
- pathCenter = single.getPath().getMbr().getCenter();
43607
+ pathCenter = single.getPathMbr().getCenter();
43570
43608
  }
43571
43609
  const center = itemMbr.getCenter();
43572
43610
  const width2 = itemMbr.getWidth();
@@ -47935,7 +47973,7 @@ class Presence {
47935
47973
  };
47936
47974
  });
47937
47975
  ctx2.restore();
47938
- this.pointerAnimationId = safeRequestAnimationFrame(renderLoop);
47976
+ this.pointerAnimationId = safeRequestAnimationFrame(renderLoop) || null;
47939
47977
  };
47940
47978
  renderLoop();
47941
47979
  }
@@ -49302,7 +49340,7 @@ class SpatialIndex {
49302
49340
  return this.itemsIndex.getRectsEnclosedOrCrossedBy(new Mbr(left, top, right, bottom));
49303
49341
  }
49304
49342
  getComments() {
49305
- return this.itemsArray.filter((item) => item instanceof Comment);
49343
+ return this.itemsArray.filter((item) => item instanceof Comment2);
49306
49344
  }
49307
49345
  getMbr() {
49308
49346
  return this.Mbr;
@@ -49426,10 +49464,10 @@ class Items {
49426
49464
  }
49427
49465
  const { nearest } = enclosed.reduce((acc, item) => {
49428
49466
  const area = item.getMbr().getHeight() * item.getMbr().getWidth();
49429
- if (item.itemType === "Drawing" && !item.isPointNearLine(this.pointer.point)) {
49467
+ if (item instanceof Drawing && !item.isPointNearLine(this.pointer.point)) {
49430
49468
  return acc;
49431
49469
  }
49432
- const isItemTransparent = item?.itemType === "Shape" && item?.getBackgroundColor() === "none";
49470
+ const isItemTransparent = item instanceof Shape && item?.getBackgroundColor() === "none";
49433
49471
  const itemZIndex = this.getZIndex(item);
49434
49472
  const accZIndex = this.getZIndex(acc.nearest);
49435
49473
  if (itemZIndex > accZIndex && (!isItemTransparent || area === acc.area) || area < acc.area) {
@@ -49460,7 +49498,7 @@ class Items {
49460
49498
  }
49461
49499
  getLinkedConnectorsById(id) {
49462
49500
  return this.listAll().filter((item) => {
49463
- if (item.itemType !== "Connector") {
49501
+ if (!(item instanceof Connector2)) {
49464
49502
  return false;
49465
49503
  }
49466
49504
  const { startItem, endItem } = item.getConnectedItems();
@@ -49475,7 +49513,7 @@ class Items {
49475
49513
  return [];
49476
49514
  }
49477
49515
  return this.listAll().filter((item) => {
49478
- if (item.itemType !== "Connector" || !item.isConnected()) {
49516
+ if (!(item instanceof Connector2) || !item.isConnected()) {
49479
49517
  return false;
49480
49518
  }
49481
49519
  const { startItem, endItem } = item.getConnectedItems();
@@ -49650,7 +49688,7 @@ class SelectionItems {
49650
49688
  return ids;
49651
49689
  }
49652
49690
  getSingle() {
49653
- return this.isSingle() ? this.items.values().next().value : null;
49691
+ return this.isSingle() ? this.items.values().next().value || null : null;
49654
49692
  }
49655
49693
  listByIds(itemIdList) {
49656
49694
  return itemIdList.map((id) => this.items.get(id)).filter((item) => item !== undefined);
@@ -49698,7 +49736,7 @@ class ConnectorTransformer extends Tool {
49698
49736
  getConnector(items) {
49699
49737
  if (items.isSingle()) {
49700
49738
  const connector = items.getSingle();
49701
- if (connector?.itemType === "Connector") {
49739
+ if (connector instanceof Connector2) {
49702
49740
  return connector;
49703
49741
  }
49704
49742
  }
@@ -51168,10 +51206,10 @@ class BoardSelection {
51168
51206
  }
51169
51207
  copiedItemsMap[item.getId()] = { ...serializedData, zIndex };
51170
51208
  }
51171
- copy(skipImageBlobCopy = false) {
51209
+ copy(skipImageBlobCopy) {
51172
51210
  const copiedItemsMap = {};
51173
51211
  const single = this.items.getSingle();
51174
- if (!skipImageBlobCopy && single && single.itemType === "Image") {
51212
+ if (!skipImageBlobCopy && single && single instanceof ImageItem) {
51175
51213
  this.handleItemCopy(single, copiedItemsMap);
51176
51214
  return { imageElement: single.image, imageData: copiedItemsMap };
51177
51215
  }
@@ -51196,7 +51234,7 @@ class BoardSelection {
51196
51234
  return copiedItemsMap;
51197
51235
  }
51198
51236
  cut() {
51199
- const items = this.copy();
51237
+ const items = this.copy(true);
51200
51238
  this.removeFromBoard();
51201
51239
  return items;
51202
51240
  }
@@ -51347,7 +51385,7 @@ class BoardSelection {
51347
51385
  });
51348
51386
  Object.values(selectedMap).forEach((val) => {
51349
51387
  const parentFrame = this.board.items.getById(val.item.parent);
51350
- const isParentFrame = parentFrame?.itemType === "Frame";
51388
+ const isParentFrame = parentFrame instanceof Frame;
51351
51389
  const parentFrameId = isParentFrame ? parentFrame.getId() : null;
51352
51390
  if (val.nested) {
51353
51391
  const isRemoveChildFromFrame = Object.values(selectedMap).some((val2) => val2.nested && val2.nested.getId() !== parentFrameId);
@@ -51362,7 +51400,7 @@ class BoardSelection {
51362
51400
  console.warn(`Didnt find frame with id ${val.item.parent}`);
51363
51401
  }
51364
51402
  }
51365
- if (val.item.itemType === "Frame" && checkFrames) {
51403
+ if (val.item instanceof Frame && checkFrames) {
51366
51404
  const currFrame = val.item;
51367
51405
  const currMbr = currFrame.getMbr();
51368
51406
  const children = val.item.getChildrenIds().map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
@@ -51770,12 +51808,6 @@ class BoardSelection {
51770
51808
  text5.setEditorFocus(this.context);
51771
51809
  }
51772
51810
  }
51773
- getMediaStorageIds() {
51774
- return this.items.list().filter((item) => {
51775
- const shouldClearStorageUsage = item.itemType === "Image" || item.itemType === "Video" && item.getIsStorageUrl() || item.itemType === "Audio" && item.getIsStorageUrl();
51776
- return shouldClearStorageUsage;
51777
- }).map((item) => item.getStorageId());
51778
- }
51779
51811
  removeFromBoard() {
51780
51812
  const isLocked = this.items.list().some((item) => item.transformation.isLocked);
51781
51813
  if (isLocked) {
@@ -51790,7 +51822,6 @@ class BoardSelection {
51790
51822
  const connectors = itemIds.flatMap((id) => {
51791
51823
  return this.board.items.getLinkedConnectorsById(id);
51792
51824
  }).map((connector) => connector.getId());
51793
- conf.hooks.beforeMediaRemove(this.getMediaStorageIds(), this.board.getBoardId());
51794
51825
  this.emit({
51795
51826
  class: "Board",
51796
51827
  method: "remove",
@@ -51827,7 +51858,15 @@ class BoardSelection {
51827
51858
  this.board.sendToBack(this.items.list());
51828
51859
  }
51829
51860
  async duplicate() {
51830
- const mediaIds = this.getMediaStorageIds();
51861
+ const mediaIds = [];
51862
+ this.items.list().forEach((item) => {
51863
+ if ("getStorageId" in item) {
51864
+ const storageId = item.getStorageId();
51865
+ if (storageId) {
51866
+ mediaIds.push(storageId);
51867
+ }
51868
+ }
51869
+ });
51831
51870
  const canDuplicate = mediaIds.length ? await conf.hooks.beforeMediaUpload(mediaIds, this.board.getBoardId()) : true;
51832
51871
  if (!canDuplicate) {
51833
51872
  return;
@@ -51895,7 +51934,7 @@ class BoardSelection {
51895
51934
  }
51896
51935
  }
51897
51936
  const contextItems = [];
51898
- if (single && single.itemType === "AINode") {
51937
+ if (single && single instanceof AINode) {
51899
51938
  const contextItemsIds = single.getContextItems();
51900
51939
  if (contextItemsIds.length) {
51901
51940
  const newContextItems = this.board.items.listAll().filter((item) => contextItemsIds.includes(item.getId()));
@@ -51917,7 +51956,7 @@ class BoardSelection {
51917
51956
  }
51918
51957
  }
51919
51958
  contextItems.forEach((item) => {
51920
- if (item.itemType === "AINode") {
51959
+ if (item instanceof AINode) {
51921
51960
  const path2 = item.getPath();
51922
51961
  path2.setBorderColor(CONTEXT_NODE_HIGHLIGHT_COLOR);
51923
51962
  path2.setBorderWidth(2);
@@ -51932,6 +51971,416 @@ class BoardSelection {
51932
51971
  });
51933
51972
  }
51934
51973
  }
51974
+ // src/public/customWebComponents.js
51975
+ var customWebComponents_default = `/* eslint-disable max-classes-per-file, @typescript-eslint/no-useless-constructor */
51976
+ class RichTextElement extends HTMLElement {
51977
+ constructor() {
51978
+ super();
51979
+ }
51980
+ }
51981
+
51982
+ class ShapeItemElement extends HTMLElement {
51983
+ constructor() {
51984
+ super();
51985
+ }
51986
+ }
51987
+
51988
+ class StickerElement extends HTMLElement {
51989
+ constructor() {
51990
+ super();
51991
+ }
51992
+ }
51993
+
51994
+ class DrawingElement extends HTMLElement {
51995
+ constructor() {
51996
+ super();
51997
+ }
51998
+ }
51999
+
52000
+ class ConnectorElement extends HTMLElement {
52001
+ constructor() {
52002
+ super();
52003
+ }
52004
+ }
52005
+
52006
+ class FrameItemElement extends HTMLElement {
52007
+ constructor() {
52008
+ super();
52009
+ }
52010
+ }
52011
+
52012
+ class ImageItemElement extends HTMLElement {
52013
+ constructor() {
52014
+ super();
52015
+ }
52016
+ }
52017
+
52018
+ class LinkItemElement extends HTMLElement {
52019
+ constructor() {
52020
+ super();
52021
+ }
52022
+ }
52023
+
52024
+ class AINodeItemElement extends HTMLElement {
52025
+ constructor() {
52026
+ super();
52027
+ }
52028
+ }
52029
+
52030
+ class VideoItemElement extends HTMLElement {
52031
+ constructor() {
52032
+ super();
52033
+ }
52034
+ }
52035
+
52036
+ class CommentElement extends HTMLElement {
52037
+ constructor() {
52038
+ super();
52039
+ }
52040
+ }
52041
+
52042
+ class AudioItemElement extends HTMLElement {
52043
+ constructor() {
52044
+ super();
52045
+ }
52046
+ }
52047
+
52048
+ customElements.define("rich-text", RichTextElement);
52049
+ customElements.define("shape-item", ShapeItemElement);
52050
+ customElements.define("sticker-item", StickerElement);
52051
+ customElements.define("drawing-item", DrawingElement);
52052
+ customElements.define("connector-item", ConnectorElement);
52053
+ customElements.define("frame-item", FrameItemElement);
52054
+ customElements.define("image-item", ImageItemElement);
52055
+ customElements.define("link-item", LinkItemElement);
52056
+ customElements.define("ainode-item", AINodeItemElement);
52057
+ customElements.define("video-item", VideoItemElement);
52058
+ customElements.define("comment-item", CommentElement);
52059
+ customElements.define("audio-item", AudioItemElement);
52060
+
52061
+ document.addEventListener("DOMContentLoaded", () => {
52062
+ const itemsDiv = document.querySelector("#items");
52063
+ if (!itemsDiv) {
52064
+ console.error("ITEMS DIV NOT FOUND!");
52065
+ return;
52066
+ }
52067
+ let isDragging = false;
52068
+ let startX, startY;
52069
+ let translateX = 0;
52070
+ let translateY = 0;
52071
+ let scale = 1;
52072
+
52073
+ itemsDiv.style.transformOrigin = "0 0";
52074
+ document.body.style.cursor = "grab";
52075
+
52076
+ function updateTransform() {
52077
+ itemsDiv.style.transform =
52078
+ "translate(" +
52079
+ translateX +
52080
+ "px, " +
52081
+ translateY +
52082
+ "px) scale(" +
52083
+ scale +
52084
+ ")";
52085
+ }
52086
+
52087
+ function handleMouseDown(ev) {
52088
+ isDragging = true;
52089
+ startX = ev.clientX;
52090
+ startY = ev.clientY;
52091
+ itemsDiv.style.cursor = "grabbing";
52092
+ }
52093
+
52094
+ function handleMouseMove(ev) {
52095
+ if (!isDragging) {
52096
+ return;
52097
+ }
52098
+ const dx = ev.clientX - startX;
52099
+ const dy = ev.clientY - startY;
52100
+ startX += dx;
52101
+ startY += dy;
52102
+ translateX += dx;
52103
+ translateY += dy;
52104
+ updateTransform();
52105
+ }
52106
+
52107
+ function handleMouseUp(ev) {
52108
+ if (!isDragging) {
52109
+ return;
52110
+ }
52111
+ isDragging = false;
52112
+ itemsDiv.style.cursor = "grab";
52113
+ }
52114
+
52115
+ function handleWheel(ev) {
52116
+ ev.preventDefault();
52117
+ const factor = ev.deltaY < 0 ? 1.1 : 0.9;
52118
+ translateX = ev.clientX - (ev.clientX - translateX) * factor;
52119
+ translateY = ev.clientY - (ev.clientY - translateY) * factor;
52120
+ scale *= factor;
52121
+ updateTransform();
52122
+ }
52123
+
52124
+ document.addEventListener("mousedown", handleMouseDown);
52125
+ document.addEventListener("mousemove", handleMouseMove);
52126
+ document.addEventListener("mouseup", handleMouseUp);
52127
+ document.addEventListener("wheel", handleWheel, { passive: false });
52128
+
52129
+ const titlePanel = document.createElement("div");
52130
+ titlePanel.style.boxShadow = "0px 10px 16px -3px rgba(20, 21, 26, 0.08)";
52131
+ titlePanel.style.position = "fixed";
52132
+ titlePanel.style.left = "12px";
52133
+ titlePanel.style.top = "12px";
52134
+ titlePanel.style.borderRadius = "12px";
52135
+ titlePanel.style.backgroundColor = "#ffff";
52136
+ titlePanel.style.display = "flex";
52137
+ titlePanel.style.alignItems = "center";
52138
+ titlePanel.style.gap = "8px";
52139
+ titlePanel.style.padding = "0 12px";
52140
+ titlePanel.style.height = "48px";
52141
+ const editButton = document.createElement("button");
52142
+ const editIcon = document.createElementNS(
52143
+ "http://www.w3.org/2000/svg",
52144
+ "svg",
52145
+ );
52146
+ editIcon.setAttribute("width", "13");
52147
+ editIcon.setAttribute("height", "13");
52148
+ editIcon.setAttribute("viewBox", "0 0 13 13");
52149
+ editIcon.setAttribute("fill", "none");
52150
+ editIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
52151
+ const editIconPath = document.createElementNS(
52152
+ "http://www.w3.org/2000/svg",
52153
+ "path",
52154
+ );
52155
+ editIconPath.setAttribute(
52156
+ "d",
52157
+ "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",
52158
+ );
52159
+ editIconPath.setAttribute("fill", "#ffff");
52160
+ editIcon.appendChild(editIconPath);
52161
+ editButton.appendChild(editIcon);
52162
+ const editFileText = document.createElement("p");
52163
+ const isSnapshotInIframe =
52164
+ window.parent &&
52165
+ window.parent !== window &&
52166
+ window.parent.location.href.includes("/snapshots/");
52167
+ editFileText.textContent = isSnapshotInIframe ? "Edit copy" : "Edit file";
52168
+ editButton.appendChild(editFileText);
52169
+
52170
+ editButton.style.backgroundColor = "rgba(20, 21, 26, 1)";
52171
+ editButton.style.cursor = "pointer";
52172
+ editButton.style.boxShadow = "0px 1px 2px 0px rgba(20, 21, 26, 0.05)";
52173
+ editButton.style.color = "#ffff";
52174
+ editButton.style.fontSize = "14px";
52175
+ editButton.style.lineHeight = "20px";
52176
+ editButton.style.display = "flex";
52177
+ editButton.style.alignItems = "center";
52178
+ editButton.style.gap = "8px";
52179
+ editButton.style.padding = "8px";
52180
+ editButton.style.borderRadius = "10px";
52181
+ const separator = document.createElement("div");
52182
+ separator.style.borderRight = "1px solid rgba(222, 224, 227, 1)";
52183
+ separator.style.height = "100%";
52184
+ const boardName = document.createElement("div");
52185
+ const fileIcon = document.createElementNS(
52186
+ "http://www.w3.org/2000/svg",
52187
+ "svg",
52188
+ );
52189
+ fileIcon.setAttribute("width", "16");
52190
+ fileIcon.setAttribute("height", "18");
52191
+ fileIcon.setAttribute("viewBox", "0 0 16 18");
52192
+ fileIcon.setAttribute("fill", "none");
52193
+ fileIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
52194
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
52195
+ path.setAttribute(
52196
+ "d",
52197
+ "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",
52198
+ );
52199
+ path.setAttribute("fill", "#696B76");
52200
+ fileIcon.appendChild(path);
52201
+ boardName.appendChild(fileIcon);
52202
+ const boardNameTag = document.querySelector('meta[name="board-name"]');
52203
+ let boardNameStr = "Untitled";
52204
+ if (boardNameTag) {
52205
+ boardNameStr = boardNameTag.getAttribute("content");
52206
+ }
52207
+ const p = document.createElement("p");
52208
+ p.textContent = boardNameStr;
52209
+ p.style.fontSize = "16px";
52210
+ p.style.lineHeight = "24px";
52211
+ boardName.appendChild(p);
52212
+ const cloudIcon = document.createElementNS(
52213
+ "http://www.w3.org/2000/svg",
52214
+ "svg",
52215
+ );
52216
+ cloudIcon.setAttribute("width", "20");
52217
+ cloudIcon.setAttribute("height", "18");
52218
+ cloudIcon.setAttribute("viewBox", "0 0 20 18");
52219
+ cloudIcon.setAttribute("fill", "none");
52220
+ cloudIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
52221
+ const cloudIconPath = document.createElementNS(
52222
+ "http://www.w3.org/2000/svg",
52223
+ "path",
52224
+ );
52225
+ cloudIconPath.setAttribute(
52226
+ "d",
52227
+ "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",
52228
+ );
52229
+ cloudIconPath.setAttribute("fill", "#696B76");
52230
+ cloudIcon.appendChild(cloudIconPath);
52231
+ boardName.appendChild(cloudIcon);
52232
+ boardName.style.display = "flex";
52233
+ boardName.style.alignItems = "center";
52234
+ boardName.style.gap = "8px";
52235
+ titlePanel.appendChild(boardName);
52236
+ titlePanel.appendChild(separator);
52237
+ titlePanel.appendChild(editButton);
52238
+ document.body.appendChild(titlePanel);
52239
+
52240
+ editButton.onclick = async () => {
52241
+ editButton.disabled = true;
52242
+ editButton.textContent = "Loading...";
52243
+
52244
+ try {
52245
+ document.removeEventListener("mousedown", handleMouseDown);
52246
+ document.removeEventListener("mousemove", handleMouseMove);
52247
+ document.removeEventListener("mouseup", handleMouseUp);
52248
+ document.removeEventListener("wheel", handleWheel, {
52249
+ passive: false,
52250
+ });
52251
+ translateX = 0;
52252
+ translateY = 0;
52253
+ scale = 1;
52254
+ updateTransform();
52255
+
52256
+ const { initBrowserSettings } = await import(
52257
+ "https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.js"
52258
+ );
52259
+ initBrowserSettings();
52260
+
52261
+ const { createApp } = await import(
52262
+ "https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.js"
52263
+ );
52264
+
52265
+ const app = createApp();
52266
+ window.app = app;
52267
+ const stringed = await app.openAndEditFile();
52268
+
52269
+ if (stringed) {
52270
+ await app.openBoardFromFile();
52271
+ app.getBoard().deserializeHTML(stringed);
52272
+ app.localRender("items");
52273
+ }
52274
+
52275
+ const response = await fetch(
52276
+ "https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.css",
52277
+ );
52278
+ const cssText = await response.text();
52279
+ const styleEl = document.createElement("style");
52280
+ styleEl.textContent = cssText;
52281
+ document.body.appendChild(styleEl);
52282
+
52283
+ const responseSvg = await fetch(
52284
+ "https://www.unpkg.com/test_package_board@0.0.99/dist/sprite.svg",
52285
+ );
52286
+ const svgText = await responseSvg.text();
52287
+ const div = document.createElement("div");
52288
+ div.style.display = "none";
52289
+ div.id = "sprite";
52290
+ div.innerHTML = svgText;
52291
+ document.body.appendChild(div);
52292
+ } finally {
52293
+ editButton.disabled = false;
52294
+ editButton.textContent = "Edit board";
52295
+ }
52296
+ };
52297
+ });
52298
+ `;
52299
+
52300
+ // src/public/loadLinkImages.js
52301
+ var loadLinkImages_default = `document.addEventListener("DOMContentLoaded", function () {
52302
+ document.querySelectorAll(".link-object").forEach(linkItem => {
52303
+ const linkImage = linkItem.querySelector(".link-image");
52304
+ const linkContainer = linkItem.querySelector("a");
52305
+ linkImage.onerror = () => {
52306
+ linkImage.onerror = null;
52307
+ linkImage.style.display = "none";
52308
+ const svgNamespace = "http://www.w3.org/2000/svg";
52309
+ const svg = document.createElementNS(svgNamespace, "svg");
52310
+ svg.setAttribute("width", "20");
52311
+ svg.setAttribute("height", "20");
52312
+ svg.setAttribute("viewBox", "0 0 13 14");
52313
+ svg.setAttribute("fill", "none");
52314
+
52315
+ const path = document.createElementNS(svgNamespace, "path");
52316
+ path.setAttribute(
52317
+ "d",
52318
+ "M11.0054 3.414L2.39838 12.021L0.984375 10.607L9.59037 2H2.00538V0H13.0054V11H11.0054V3.414Z",
52319
+ );
52320
+ path.setAttribute("fill", "#924FE8");
52321
+ svg.appendChild(path);
52322
+
52323
+ linkContainer.appendChild(svg);
52324
+ };
52325
+ });
52326
+ });
52327
+ `;
52328
+
52329
+ // src/public/index.css
52330
+ var public_default = `@import "https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&display=swap";
52331
+ @import "https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&display=swap";
52332
+
52333
+ /* ../src/index.css */
52334
+ :root {
52335
+ --background-surface-default: rgb(255, 255, 255);
52336
+ --background-button-secondary: rgb(255, 255, 255);
52337
+ --background-button-secondary-hover: rgb(247, 247, 248);
52338
+ --background-badge-purple-disabled: rgb(247, 241, 253);
52339
+ --background-badge-gray: rgb(233, 234, 236);
52340
+ --background-accent-purple: rgb(146, 79, 232);
52341
+ --border-action-normal: rgb(222, 223, 227);
52342
+ --border-action-focus: rgb(146, 79, 232);
52343
+ --border-select-primary: rgb(146, 79, 232);
52344
+ --text-base-primary: rgb(20, 21, 26);
52345
+ --text-base-secondary: rgba(15, 19, 36, 0.6);
52346
+ --text-base-quaternary: rgb(10, 15, 41, 0.25);
52347
+ --text-accent-purple: rgb(152, 89, 233);
52348
+ --icon-base-primary: rgb(20, 21, 26);
52349
+ --icon-base-secondary: rgb(105, 107, 118);
52350
+ --icon-accent-purple: rgb(146, 79, 232);
52351
+ --absolute-position-panel-padding: 12px;
52352
+ }
52353
+ * {
52354
+ box-sizing: border-box;
52355
+ padding: 0;
52356
+ margin: 0;
52357
+ border: none;
52358
+ background: none;
52359
+ font-family: inherit;
52360
+ }
52361
+ html {
52362
+ font-size: 62.5%;
52363
+ }
52364
+ body {
52365
+ color: var(--text-base-primary);
52366
+ font-size: 1.6rem;
52367
+ font-optical-sizing: auto;
52368
+ font-style: normal;
52369
+ font-family: "Manrope", sans-serif;
52370
+ }
52371
+ html,
52372
+ body {
52373
+ overscroll-behavior-x: none;
52374
+ -webkit-user-select: none;
52375
+ }
52376
+ input:-webkit-autofill,
52377
+ input:-webkit-autofill:hover,
52378
+ input:-webkit-autofill:focus,
52379
+ input:-webkit-autofill:active {
52380
+ -webkit-box-shadow: 0 0 0 30px white inset !important;
52381
+ }
52382
+ `;
52383
+
51935
52384
  // src/Board.ts
51936
52385
  class Board {
51937
52386
  boardId;
@@ -52314,9 +52763,9 @@ class Board {
52314
52763
  return this.copy();
52315
52764
  }
52316
52765
  serializeHTML() {
52317
- const customTagsScript = CUSTOM_WEB_COMPONENTS_JS;
52318
- const loadLinksImagesScript = LOAD_LINKS_IMAGES_JS;
52319
- const css = INDEX_CSS;
52766
+ const customTagsScript = customWebComponents_default;
52767
+ const loadLinksImagesScript = loadLinkImages_default;
52768
+ const css = public_default;
52320
52769
  const boardName = this.getName() || this.getBoardId();
52321
52770
  const items = this.items.getWholeHTML(conf.documentFactory);
52322
52771
  const itemsDiv = `<div id="items">${items}</div>`;