@plait/mind 0.23.1 → 0.24.1

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.
@@ -1,11 +1,12 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Directive, Input, Component, ChangeDetectionStrategy, NgModule, NgZone, HostListener } from '@angular/core';
2
+ import { Component, ChangeDetectionStrategy, NgModule, NgZone, Directive, Input, HostListener } from '@angular/core';
3
3
  import * as i2 from '@plait/core';
4
- import { DefaultThemeColor, ColorfulThemeColor, SoftThemeColor, RetroThemeColor, DarkThemeColor, StarryThemeColor, RectangleClient, PlaitElement, PlaitPluginKey, idCreator, isNullOrUndefined, Transforms, clearSelectedElement, addSelectedElement, PlaitNode, Path, PlaitBoard, depthFirstRecursion, getIsRecursionFunc, drawLinearPath, drawBezierPath, createG, updateForeignObject, drawRoundRectangle, getRectangleByElements, getSelectedElements, NODE_TO_PARENT, distanceBetweenPointAndRectangle, createForeignObject, createText, PlaitPointerType, PlaitPluginElementComponent, NODE_TO_INDEX, PlaitModule, isMainPointer, transformPoint, toPoint, getHitElements, distanceBetweenPointAndPoint, CLIP_BOARD_FORMAT_KEY, BOARD_TO_HOST, throttleRAF, BoardTransforms, removeSelectedElement, PlaitHistoryBoard, hotkeys, PRESS_AND_MOVE_BUFFER, MERGING, ResizeCursorClass } from '@plait/core';
5
- import { MindLayoutType, isIndentedLayout, AbstractNode, getNonAbstractChildren, isStandardLayout, isLeftLayout, isRightLayout, isVerticalLogicLayout, isHorizontalLogicLayout, isTopLayout, isBottomLayout, isHorizontalLayout, getCorrectStartEnd, getAbstractLayout, ConnectingPosition, GlobalLayout } from '@plait/layouts';
4
+ import { DefaultThemeColor, ColorfulThemeColor, SoftThemeColor, RetroThemeColor, DarkThemeColor, StarryThemeColor, RectangleClient, PlaitElement, PlaitPluginKey, idCreator, isNullOrUndefined, Transforms, clearSelectedElement, addSelectedElement, PlaitBoard, Path, PlaitNode, PlaitContextService, depthFirstRecursion, getIsRecursionFunc, drawLinearPath, drawBezierPath, createG, updateForeignObject, drawRoundRectangle, getRectangleByElements, getSelectedElements, NODE_TO_PARENT, distanceBetweenPointAndRectangle, createForeignObject, createText, PlaitPointerType, PlaitPluginElementComponent, NODE_TO_INDEX, PlaitModule, isMainPointer, transformPoint, toPoint, getHitElements, distanceBetweenPointAndPoint, CLIP_BOARD_FORMAT_KEY, BOARD_TO_HOST, throttleRAF, BoardTransforms, removeSelectedElement, PlaitHistoryBoard, hotkeys, PRESS_AND_MOVE_BUFFER, MERGING, ResizeCursorClass } from '@plait/core';
5
+ import { MindLayoutType, isIndentedLayout, AbstractNode, isStandardLayout, isHorizontalLogicLayout, isVerticalLogicLayout, getNonAbstractChildren, isLeftLayout, isRightLayout, isTopLayout, isBottomLayout, isHorizontalLayout, getCorrectStartEnd, ConnectingPosition, getAbstractLayout, GlobalLayout } from '@plait/layouts';
6
6
  import { PlaitMarkEditor, MarkTypes, DEFAULT_FONT_SIZE, TEXT_DEFAULT_HEIGHT, buildText, getTextSize, TextManage, ExitOrigin, TextModule, getTextFromClipboard } from '@plait/text';
7
7
  import { fromEvent, Subject } from 'rxjs';
8
8
  import { Node as Node$1, Path as Path$1 } from 'slate';
9
+ import { __awaiter } from 'tslib';
9
10
  import { isKeyHotkey } from 'is-hotkey';
10
11
  import { pointsOnBezierCurves } from 'points-on-curve';
11
12
  import { take, filter } from 'rxjs/operators';
@@ -232,10 +233,10 @@ const NodeSpace = {
232
233
  return (NodeSpace.getEmojiLeftSpace(board, element) +
233
234
  getEmojisWidthHeight(board, element).width +
234
235
  getSpaceEmojiAndText(element) +
235
- NodeSpace.getNodeResizableWidth(board, element) +
236
+ NodeSpace.getNodeDynamicWidth(board, element) +
236
237
  nodeAndText);
237
238
  }
238
- return nodeAndText + NodeSpace.getNodeResizableWidth(board, element) + nodeAndText;
239
+ return nodeAndText + NodeSpace.getNodeDynamicWidth(board, element) + nodeAndText;
239
240
  },
240
241
  getNodeHeight(board, element) {
241
242
  const nodeAndText = getVerticalSpaceBetweenNodeAndText(board, element);
@@ -244,12 +245,23 @@ const NodeSpace = {
244
245
  }
245
246
  return nodeAndText + element.height + nodeAndText;
246
247
  },
247
- getNodeResizableWidth(board, element) {
248
+ getNodeDynamicWidth(board, element) {
248
249
  var _a;
249
250
  const width = element.manualWidth || element.width;
250
251
  const imageWidth = MindElement.hasImage(element) ? (_a = element.data.image) === null || _a === void 0 ? void 0 : _a.width : 0;
251
252
  return Math.max(width, imageWidth);
252
253
  },
254
+ /**
255
+ * use this when upload image first or resize image
256
+ * @param board
257
+ * @param element
258
+ * @param imageWidth
259
+ * @returns
260
+ */
261
+ getNodeNewDynamicWidth(board, element, imageWidth) {
262
+ const width = element.manualWidth || element.width;
263
+ return Math.max(width, imageWidth);
264
+ },
253
265
  getNodeResizableMinWidth(board, element) {
254
266
  const minTopicWidth = NodeSpace.getNodeTopicMinWidth(board, element);
255
267
  if (MindElement.hasImage(element) && element.data.image.width > minTopicWidth) {
@@ -349,7 +361,7 @@ function getTopicRectangleByNode(board, node) {
349
361
  function getTopicRectangleByElement(board, nodeRectangle, element) {
350
362
  const x = nodeRectangle.x + NodeSpace.getTextLeftSpace(board, element);
351
363
  const y = nodeRectangle.y + NodeSpace.getTextTopSpace(board, element);
352
- const width = NodeSpace.getNodeResizableWidth(board, element);
364
+ const width = NodeSpace.getNodeDynamicWidth(board, element);
353
365
  const height = Math.ceil(element.height);
354
366
  return { height, width, x, y };
355
367
  }
@@ -671,28 +683,6 @@ const adjustNodeToRoot = (board, node) => {
671
683
  return Object.assign(Object.assign({}, newElement), { layout: (_a = newElement.layout) !== null && _a !== void 0 ? _a : MindLayoutType.right, isRoot: true, type: 'mindmap' });
672
684
  };
673
685
 
674
- const BOARD_TO_SELECTED_IMAGE_ELEMENT = new WeakMap();
675
- const getSelectedImageElement = (board) => {
676
- return BOARD_TO_SELECTED_IMAGE_ELEMENT.get(board);
677
- };
678
- const addSelectedImageElement = (board, element) => {
679
- BOARD_TO_SELECTED_IMAGE_ELEMENT.set(board, element);
680
- };
681
- const removeSelectedImageElement = (board) => {
682
- BOARD_TO_SELECTED_IMAGE_ELEMENT.delete(board);
683
- };
684
- const setImageFocus = (board, element, isFocus) => {
685
- if (isFocus) {
686
- addSelectedImageElement(board, element);
687
- }
688
- else {
689
- removeSelectedImageElement(board);
690
- }
691
- const elementComponent = PlaitElement.getComponent(element);
692
- elementComponent.imageDrawer.componentRef.instance.isFocus = isFocus;
693
- elementComponent.imageDrawer.componentRef.instance.cdr.markForCheck();
694
- };
695
-
696
686
  const DefaultAbstractNodeStyle = {
697
687
  branch: { color: GRAY_COLOR, width: 2 },
698
688
  shape: {
@@ -711,8 +701,94 @@ const DefaultNodeStyle = {
711
701
  }
712
702
  };
713
703
 
714
- const getAvailableProperty = (board, element, propertyKey) => {
715
- return element[propertyKey];
704
+ const setAbstractsByRefs = (board, abstractRefs) => {
705
+ abstractRefs.forEach((newProperty, element) => {
706
+ const start = element.start + newProperty.start;
707
+ const end = element.end + newProperty.end;
708
+ const path = PlaitBoard.findPath(board, element);
709
+ if (start > end) {
710
+ Transforms.removeNode(board, path);
711
+ }
712
+ else {
713
+ Transforms.setNode(board, { start, end }, path);
714
+ }
715
+ });
716
+ };
717
+ const setAbstractByStandardLayout = (board, element) => {
718
+ const rightNodeCount = element.rightNodeCount;
719
+ const abstract = element.children.find(child => {
720
+ return AbstractNode.isAbstract(child) && child.end >= rightNodeCount && child.start < rightNodeCount;
721
+ });
722
+ if (abstract) {
723
+ const path = PlaitBoard.findPath(board, abstract);
724
+ Transforms.setNode(board, { end: rightNodeCount - 1 }, path);
725
+ }
726
+ };
727
+ const insertAbstract = (board, elements) => {
728
+ let elementGroup = getFirstLevelElement(elements);
729
+ const { parentElements, abstractIncludedGroups } = divideElementByParent(elementGroup);
730
+ abstractIncludedGroups.forEach((group, index) => {
731
+ const groupParent = parentElements[index];
732
+ setAbstractByElements(board, groupParent, group);
733
+ });
734
+ };
735
+ const setAbstractByElements = (board, groupParent, group) => {
736
+ const indexArray = group.map(child => groupParent.children.indexOf(child)).sort((a, b) => a - b);
737
+ const rightNodeCount = groupParent === null || groupParent === void 0 ? void 0 : groupParent.rightNodeCount;
738
+ const start = indexArray[0], end = indexArray[indexArray.length - 1];
739
+ if (isStandardLayout(MindQueries.getLayoutByElement(groupParent)) &&
740
+ rightNodeCount &&
741
+ start < rightNodeCount &&
742
+ end >= rightNodeCount) {
743
+ const childrenLength = groupParent.children.length;
744
+ const path = [...PlaitBoard.findPath(board, groupParent), childrenLength];
745
+ const leftChildren = indexArray.filter(index => index >= rightNodeCount);
746
+ const rightChildren = indexArray.filter(index => index < rightNodeCount);
747
+ insertAbstractNode(board, path, rightChildren[0], rightChildren[rightChildren.length - 1]);
748
+ insertAbstractNode(board, Path.next(path), leftChildren[0], leftChildren[leftChildren.length - 1]);
749
+ }
750
+ else {
751
+ const path = [...PlaitBoard.findPath(board, groupParent), groupParent.children.length];
752
+ insertAbstractNode(board, path, start, end);
753
+ }
754
+ };
755
+ const insertAbstractNode = (board, path, start, end) => {
756
+ const mindElement = createMindElement('概要', 28, 20, {
757
+ strokeWidth: DefaultAbstractNodeStyle.branch.width,
758
+ branchWidth: DefaultAbstractNodeStyle.branch.width
759
+ });
760
+ mindElement.start = start;
761
+ mindElement.end = end;
762
+ Transforms.insertNode(board, mindElement, path);
763
+ clearSelectedElement(board);
764
+ addSelectedElement(board, mindElement);
765
+ };
766
+
767
+ const setLayout = (board, layout, path) => {
768
+ correctLogicLayoutNode(board, layout, path);
769
+ const element = PlaitNode.get(board, path);
770
+ if (PlaitMind.isMind(element) && isStandardLayout(layout)) {
771
+ MindTransforms.setAbstractByStandardLayout(board, element);
772
+ }
773
+ Transforms.setNode(board, { layout }, path);
774
+ };
775
+ const correctLogicLayoutNode = (board, layout, path) => {
776
+ var _a;
777
+ const node = PlaitNode.get(board, path);
778
+ if (node && layout) {
779
+ (_a = node.children) === null || _a === void 0 ? void 0 : _a.forEach((value, index) => {
780
+ var _a;
781
+ if (value.layout) {
782
+ if ((isHorizontalLogicLayout(layout) && isVerticalLogicLayout(value.layout)) ||
783
+ (isVerticalLogicLayout(layout) && isHorizontalLogicLayout(value.layout))) {
784
+ Transforms.setNode(board, { layout: null }, [...path, index]);
785
+ }
786
+ if ((_a = value.children) === null || _a === void 0 ? void 0 : _a.length) {
787
+ correctLogicLayoutNode(board, layout, [...path, index]);
788
+ }
789
+ }
790
+ });
791
+ }
716
792
  };
717
793
 
718
794
  const separateChildren = (parentElement) => {
@@ -882,84 +958,327 @@ const isChildOfAbstract = (board, element) => {
882
958
  return !!ancestors.find((value) => AbstractNode.isAbstract(value));
883
959
  };
884
960
 
885
- /**
886
- * Processing of branch color, width, style, etc. of the mind node
887
- */
888
- const getBranchColorByMindElement = (board, element) => {
889
- if (AbstractNode.isAbstract(element) || isChildOfAbstract(board, element)) {
890
- return getAbstractBranchColor(board, element);
891
- }
892
- const branchColor = getAvailableProperty(board, element, 'branchColor');
893
- return branchColor || getDefaultBranchColor(board, element);
961
+ const normalizeWidthAndHeight = (board, element, width, height) => {
962
+ const minWidth = NodeSpace.getNodeTopicMinWidth(board, element, element.isRoot);
963
+ const newWidth = width < minWidth * board.viewport.zoom ? minWidth : width / board.viewport.zoom;
964
+ const newHeight = height / board.viewport.zoom;
965
+ return { width: newWidth, height: newHeight };
894
966
  };
895
- const getBranchShapeByMindElement = (board, element) => {
896
- const branchShape = getAvailableProperty(board, element, 'branchShape');
897
- return branchShape || BranchShape.bight;
967
+ const setTopic = (board, element, topic, width, height) => {
968
+ const newElement = Object.assign({ data: Object.assign(Object.assign({}, element.data), { topic }) }, normalizeWidthAndHeight(board, element, width, height));
969
+ const path = PlaitBoard.findPath(board, element);
970
+ Transforms.setNode(board, newElement, path);
898
971
  };
899
- const getBranchWidthByMindElement = (board, element) => {
900
- const branchWidth = getAvailableProperty(board, element, 'branchWidth');
901
- return branchWidth || BRANCH_WIDTH;
972
+ const setNodeManualWidth = (board, element, width, height) => {
973
+ const path = PlaitBoard.findPath(board, element);
974
+ const { width: normalizedWidth, height: normalizedHeight } = normalizeWidthAndHeight(board, element, width, height);
975
+ const newElement = { manualWidth: normalizedWidth, height: normalizedHeight };
976
+ Transforms.setNode(board, newElement, path);
902
977
  };
903
- const getAbstractBranchWidth = (board, element) => {
904
- if (!isNullOrUndefined(element.branchWidth)) {
905
- return element.branchWidth;
978
+ const setTopicSize = (board, element, width, height) => {
979
+ const newElement = Object.assign({}, normalizeWidthAndHeight(board, element, width, height));
980
+ let isEqualWidth = Math.ceil(element.width) === Math.ceil(newElement.width);
981
+ let isEqualHeight = Math.ceil(element.height) === Math.ceil(newElement.height);
982
+ if (element.manualWidth) {
983
+ isEqualWidth = true;
906
984
  }
907
- return DefaultAbstractNodeStyle.branch.width;
908
- };
909
- const getAbstractBranchColor = (board, element) => {
910
- if (element.branchColor) {
911
- return element.branchColor;
985
+ if (!isEqualWidth || !isEqualHeight) {
986
+ const path = PlaitBoard.findPath(board, element);
987
+ Transforms.setNode(board, newElement, path);
912
988
  }
913
- return DefaultAbstractNodeStyle.branch.color;
914
989
  };
915
- const getNextBranchColor = (board, root) => {
916
- const index = root.children.length;
917
- return getDefaultBranchColorByIndex(board, index);
990
+ const removeElements = (board, elements) => {
991
+ const deletableElements = getFirstLevelElement(elements);
992
+ deletableElements
993
+ .map(element => {
994
+ const path = PlaitBoard.findPath(board, element);
995
+ const ref = board.pathRef(path);
996
+ return () => {
997
+ Transforms.removeNode(board, ref.current);
998
+ ref.unref();
999
+ };
1000
+ })
1001
+ .forEach(action => {
1002
+ action();
1003
+ });
918
1004
  };
919
- const getDefaultBranchColor = (board, element) => {
920
- const path = PlaitBoard.findPath(board, element);
921
- return getDefaultBranchColorByIndex(board, path[1]);
1005
+ const insertNodes = (board, elements, path) => {
1006
+ const pathRef = board.pathRef(path);
1007
+ elements.forEach(element => {
1008
+ if (pathRef.current) {
1009
+ Transforms.insertNode(board, element, pathRef.current);
1010
+ }
1011
+ });
1012
+ pathRef.unref();
922
1013
  };
923
- const getDefaultBranchColorByIndex = (board, index) => {
924
- const themeColor = getMindThemeColor(board);
925
- const length = themeColor.branchColors.length;
926
- const remainder = index % length;
927
- return themeColor.branchColors[remainder];
1014
+ const insertAbstractNodes = (board, validAbstractRefs, elements, path) => {
1015
+ var _a;
1016
+ const parent = PlaitNode.get(board, Path$1.parent(path));
1017
+ const abstractPath = [...Path$1.parent(path), (_a = parent.children) === null || _a === void 0 ? void 0 : _a.length];
1018
+ const abstracts = validAbstractRefs.map(refs => {
1019
+ const { start, end } = getRelativeStartEndByAbstractRef(refs, elements);
1020
+ return Object.assign(Object.assign({}, refs.abstract), { start: start + path[path.length - 1], end: end + path[path.length - 1] });
1021
+ });
1022
+ insertNodes(board, abstracts, abstractPath);
928
1023
  };
929
- const getMindThemeColor = (board) => {
930
- const themeColors = PlaitBoard.getThemeColors(board);
931
- const themeColor = themeColors.find(val => val.mode === board.theme.themeColorMode);
932
- if (themeColor && MindThemeColor.isMindThemeColor(themeColor)) {
933
- return themeColor;
934
- }
935
- else {
936
- return MindDefaultThemeColor;
937
- }
1024
+ const setRightNodeCountByRefs = (board, refs) => {
1025
+ refs.forEach(ref => {
1026
+ Transforms.setNode(board, { rightNodeCount: ref.rightNodeCount }, ref.path);
1027
+ });
938
1028
  };
939
1029
 
940
- const getStrokeByMindElement = (board, element) => {
941
- if (PlaitMind.isMind(element)) {
942
- const defaultRootStroke = getMindThemeColor(board).rootFill;
943
- return element.strokeColor || defaultRootStroke;
944
- }
945
- if (AbstractNode.isAbstract(element) || isChildOfAbstract(board, element)) {
946
- return element.strokeColor || DefaultAbstractNodeStyle.shape.strokeColor;
947
- }
948
- return getAvailableProperty(board, element, 'strokeColor') || getDefaultBranchColor(board, element);
949
- };
950
- const getStrokeWidthByElement = (board, element) => {
951
- const strokeWidth = element.strokeWidth ||
952
- (AbstractNode.isAbstract(element) ? DefaultAbstractNodeStyle.shape.strokeWidth : DefaultNodeStyle.shape.strokeWidth);
953
- return strokeWidth;
1030
+ const addEmoji = (board, element, emojiItem) => {
1031
+ const emojis = element.data.emojis || [];
1032
+ const newEmojis = [...emojis];
1033
+ newEmojis.push(emojiItem);
1034
+ const newElement = {
1035
+ data: Object.assign(Object.assign({}, element.data), { emojis: newEmojis })
1036
+ };
1037
+ const path = PlaitBoard.findPath(board, element);
1038
+ Transforms.setNode(board, newElement, path);
954
1039
  };
955
- const getFillByElement = (board, element) => {
956
- if (element.fill) {
957
- return element.fill;
1040
+ const removeEmoji = (board, element, emojiItem) => {
1041
+ const emojis = element.data.emojis.filter(value => value !== emojiItem);
1042
+ const newElement = {
1043
+ data: { topic: element.data.topic }
1044
+ };
1045
+ if (MindElement.hasImage(element)) {
1046
+ newElement.data.image = element.data.image;
958
1047
  }
959
- const defaultRootFill = getMindThemeColor(board).rootFill;
960
- return element.isRoot ? defaultRootFill : DefaultNodeStyle.shape.fill;
1048
+ if (emojis.length > 0) {
1049
+ newElement.data.emojis = emojis;
1050
+ }
1051
+ const path = PlaitBoard.findPath(board, element);
1052
+ Transforms.setNode(board, newElement, path);
961
1053
  };
962
- const getShapeByElement = (board, element) => {
1054
+ const replaceEmoji = (board, element, oldEmoji, newEmoji) => {
1055
+ const newElement = {
1056
+ data: Object.assign({}, element.data)
1057
+ };
1058
+ const newEmojis = element.data.emojis.map(value => {
1059
+ if (value === oldEmoji) {
1060
+ return newEmoji;
1061
+ }
1062
+ return value;
1063
+ });
1064
+ newElement.data.emojis = newEmojis;
1065
+ const path = PlaitBoard.findPath(board, element);
1066
+ Transforms.setNode(board, newElement, path);
1067
+ };
1068
+
1069
+ /**
1070
+ * 1. return new node height if height changed
1071
+ * 2. new height is effected by zoom
1072
+ */
1073
+ const getNewNodeHeight = (board, element, newNodeDynamicWidth) => {
1074
+ const textManage = PlaitElement.getComponent(element).textManage;
1075
+ const { height } = textManage.getSize();
1076
+ textManage.updateWidth(newNodeDynamicWidth);
1077
+ const { height: newHeight } = textManage.getSize();
1078
+ if (!element.manualWidth) {
1079
+ textManage.updateWidth(0);
1080
+ }
1081
+ if (height !== newHeight) {
1082
+ return newHeight;
1083
+ }
1084
+ if (Math.abs(newHeight / board.viewport.zoom - element.height) > 2) {
1085
+ return newHeight;
1086
+ }
1087
+ return undefined;
1088
+ };
1089
+
1090
+ const removeImage = (board, element) => {
1091
+ setImageFocus(board, element, false);
1092
+ const newElement = {
1093
+ data: Object.assign({}, element.data)
1094
+ };
1095
+ delete newElement.data.image;
1096
+ const path = PlaitBoard.findPath(board, element);
1097
+ const newDynamicWidth = NodeSpace.getNodeNewDynamicWidth(board, element, 0);
1098
+ const newHeight = getNewNodeHeight(board, element, newDynamicWidth);
1099
+ if (newHeight) {
1100
+ newElement.height = newHeight / board.viewport.zoom;
1101
+ }
1102
+ Transforms.setNode(board, newElement, path);
1103
+ };
1104
+ const setImage = (board, element, imageItem) => {
1105
+ const newElement = {
1106
+ data: Object.assign(Object.assign({}, element.data), { image: imageItem })
1107
+ };
1108
+ const newDynamicWidth = NodeSpace.getNodeNewDynamicWidth(board, element, imageItem.width);
1109
+ const newHeight = getNewNodeHeight(board, element, newDynamicWidth);
1110
+ if (newHeight) {
1111
+ newElement.height = newHeight / board.viewport.zoom;
1112
+ }
1113
+ const path = PlaitBoard.findPath(board, element);
1114
+ Transforms.setNode(board, newElement, path);
1115
+ };
1116
+
1117
+ const MindTransforms = {
1118
+ setLayout,
1119
+ setTopic,
1120
+ setTopicSize,
1121
+ setNodeManualWidth,
1122
+ addEmoji,
1123
+ removeEmoji,
1124
+ replaceEmoji,
1125
+ insertAbstract,
1126
+ setAbstractsByRefs,
1127
+ setAbstractByStandardLayout,
1128
+ removeElements,
1129
+ insertNodes,
1130
+ insertAbstractNodes,
1131
+ setRightNodeCountByRefs,
1132
+ removeImage,
1133
+ setImage
1134
+ };
1135
+
1136
+ const PICTURE_ACCEPTED_UPLOAD_SIZE = 20;
1137
+ const acceptImageTypes = ['png', 'jpeg', 'gif', 'bmp'];
1138
+ const DEFAULT_IMAGE_WIDTH = 240;
1139
+
1140
+ const BOARD_TO_SELECTED_IMAGE_ELEMENT = new WeakMap();
1141
+ const getSelectedImageElement = (board) => {
1142
+ return BOARD_TO_SELECTED_IMAGE_ELEMENT.get(board);
1143
+ };
1144
+ const addSelectedImageElement = (board, element) => {
1145
+ BOARD_TO_SELECTED_IMAGE_ELEMENT.set(board, element);
1146
+ };
1147
+ const removeSelectedImageElement = (board) => {
1148
+ BOARD_TO_SELECTED_IMAGE_ELEMENT.delete(board);
1149
+ };
1150
+ const setImageFocus = (board, element, isFocus) => {
1151
+ if (isFocus) {
1152
+ addSelectedImageElement(board, element);
1153
+ }
1154
+ else {
1155
+ removeSelectedImageElement(board);
1156
+ }
1157
+ const elementComponent = PlaitElement.getComponent(element);
1158
+ elementComponent.imageDrawer.componentRef.instance.isFocus = isFocus;
1159
+ elementComponent.imageDrawer.componentRef.instance.cdr.markForCheck();
1160
+ };
1161
+ const selectImage = (board, element, acceptImageTypes = ['png', 'jpeg', 'gif', 'bmp']) => {
1162
+ const inputFile = document.createElement('input');
1163
+ inputFile.setAttribute('type', 'file');
1164
+ const acceptImageTypesString = '.' + acceptImageTypes.join(',.');
1165
+ inputFile.setAttribute('accept', acceptImageTypesString);
1166
+ inputFile.onchange = (event) => {
1167
+ buildImage(board, element, event.target.files[0]);
1168
+ };
1169
+ inputFile.click();
1170
+ };
1171
+ const buildImage = (board, element, imageFile) => __awaiter(void 0, void 0, void 0, function* () {
1172
+ let width = 0, height = 0;
1173
+ yield getImageSize(imageFile).then((value) => {
1174
+ width = value.width;
1175
+ height = value.height;
1176
+ });
1177
+ let imageItem = null;
1178
+ const url = URL.createObjectURL(imageFile);
1179
+ const context = PlaitBoard.getComponent(board).viewContainerRef.injector.get(PlaitContextService);
1180
+ context.setUploadingFile({ url, file: imageFile });
1181
+ imageItem = {
1182
+ url,
1183
+ width,
1184
+ height
1185
+ };
1186
+ MindTransforms.setImage(board, element, imageItem);
1187
+ });
1188
+ function getImageSize(file, defaultImageWidth = DEFAULT_IMAGE_WIDTH) {
1189
+ return new Promise((resolve, reject) => {
1190
+ const image = new Image();
1191
+ image.src = URL.createObjectURL(file);
1192
+ image.onload = function () {
1193
+ const width = defaultImageWidth;
1194
+ const height = (defaultImageWidth * image.naturalHeight) / image.naturalWidth;
1195
+ resolve(image.naturalWidth > defaultImageWidth ? { width, height } : { width: image.naturalWidth, height: image.naturalHeight });
1196
+ };
1197
+ });
1198
+ }
1199
+
1200
+ const getAvailableProperty = (board, element, propertyKey) => {
1201
+ return element[propertyKey];
1202
+ };
1203
+
1204
+ /**
1205
+ * Processing of branch color, width, style, etc. of the mind node
1206
+ */
1207
+ const getBranchColorByMindElement = (board, element) => {
1208
+ if (AbstractNode.isAbstract(element) || isChildOfAbstract(board, element)) {
1209
+ return getAbstractBranchColor(board, element);
1210
+ }
1211
+ const branchColor = getAvailableProperty(board, element, 'branchColor');
1212
+ return branchColor || getDefaultBranchColor(board, element);
1213
+ };
1214
+ const getBranchShapeByMindElement = (board, element) => {
1215
+ const branchShape = getAvailableProperty(board, element, 'branchShape');
1216
+ return branchShape || BranchShape.bight;
1217
+ };
1218
+ const getBranchWidthByMindElement = (board, element) => {
1219
+ const branchWidth = getAvailableProperty(board, element, 'branchWidth');
1220
+ return branchWidth || BRANCH_WIDTH;
1221
+ };
1222
+ const getAbstractBranchWidth = (board, element) => {
1223
+ if (!isNullOrUndefined(element.branchWidth)) {
1224
+ return element.branchWidth;
1225
+ }
1226
+ return DefaultAbstractNodeStyle.branch.width;
1227
+ };
1228
+ const getAbstractBranchColor = (board, element) => {
1229
+ if (element.branchColor) {
1230
+ return element.branchColor;
1231
+ }
1232
+ return DefaultAbstractNodeStyle.branch.color;
1233
+ };
1234
+ const getNextBranchColor = (board, root) => {
1235
+ const index = root.children.length;
1236
+ return getDefaultBranchColorByIndex(board, index);
1237
+ };
1238
+ const getDefaultBranchColor = (board, element) => {
1239
+ const path = PlaitBoard.findPath(board, element);
1240
+ return getDefaultBranchColorByIndex(board, path[1]);
1241
+ };
1242
+ const getDefaultBranchColorByIndex = (board, index) => {
1243
+ const themeColor = getMindThemeColor(board);
1244
+ const length = themeColor.branchColors.length;
1245
+ const remainder = index % length;
1246
+ return themeColor.branchColors[remainder];
1247
+ };
1248
+ const getMindThemeColor = (board) => {
1249
+ const themeColors = PlaitBoard.getThemeColors(board);
1250
+ const themeColor = themeColors.find(val => val.mode === board.theme.themeColorMode);
1251
+ if (themeColor && MindThemeColor.isMindThemeColor(themeColor)) {
1252
+ return themeColor;
1253
+ }
1254
+ else {
1255
+ return MindDefaultThemeColor;
1256
+ }
1257
+ };
1258
+
1259
+ const getStrokeByMindElement = (board, element) => {
1260
+ if (PlaitMind.isMind(element)) {
1261
+ const defaultRootStroke = getMindThemeColor(board).rootFill;
1262
+ return element.strokeColor || defaultRootStroke;
1263
+ }
1264
+ if (AbstractNode.isAbstract(element) || isChildOfAbstract(board, element)) {
1265
+ return element.strokeColor || DefaultAbstractNodeStyle.shape.strokeColor;
1266
+ }
1267
+ return getAvailableProperty(board, element, 'strokeColor') || getDefaultBranchColor(board, element);
1268
+ };
1269
+ const getStrokeWidthByElement = (board, element) => {
1270
+ const strokeWidth = element.strokeWidth ||
1271
+ (AbstractNode.isAbstract(element) ? DefaultAbstractNodeStyle.shape.strokeWidth : DefaultNodeStyle.shape.strokeWidth);
1272
+ return strokeWidth;
1273
+ };
1274
+ const getFillByElement = (board, element) => {
1275
+ if (element.fill) {
1276
+ return element.fill;
1277
+ }
1278
+ const defaultRootFill = getMindThemeColor(board).rootFill;
1279
+ return element.isRoot ? defaultRootFill : DefaultNodeStyle.shape.fill;
1280
+ };
1281
+ const getShapeByElement = (board, element) => {
963
1282
  const shape = getAvailableProperty(board, element, 'shape');
964
1283
  return shape || MindElementShape.roundRectangle;
965
1284
  };
@@ -1810,6 +2129,73 @@ const deleteElementsHandleRightNodeCount = (board, deletableElements, effectedRi
1810
2129
  return effectedRightNodeCount;
1811
2130
  };
1812
2131
 
2132
+ const getLayoutOptions = (board) => {
2133
+ function getMainAxle(element, parent) {
2134
+ const strokeWidth = element.strokeWidth || STROKE_WIDTH;
2135
+ if (element.isRoot) {
2136
+ return BASE * 12;
2137
+ }
2138
+ if (parent && parent.isRoot()) {
2139
+ return BASE * 3 + strokeWidth / 2;
2140
+ }
2141
+ return BASE * 3 + strokeWidth / 2;
2142
+ }
2143
+ function getSecondAxle(element, parent) {
2144
+ const strokeWidth = element.strokeWidth || STROKE_WIDTH;
2145
+ if (element.isRoot) {
2146
+ return BASE * 10 + strokeWidth / 2;
2147
+ }
2148
+ return BASE * 6 + strokeWidth / 2;
2149
+ }
2150
+ return {
2151
+ getHeight(element) {
2152
+ return NodeSpace.getNodeHeight(board, element);
2153
+ },
2154
+ getWidth(element) {
2155
+ return NodeSpace.getNodeWidth(board, element);
2156
+ },
2157
+ getHorizontalGap(element, parent) {
2158
+ const _layout = (parent && parent.layout) || getRootLayout(element);
2159
+ const isHorizontal = isHorizontalLayout(_layout);
2160
+ const strokeWidth = element.strokeWidth || STROKE_WIDTH;
2161
+ if (isIndentedLayout(_layout)) {
2162
+ return BASE * 4 + strokeWidth;
2163
+ }
2164
+ if (!isHorizontal) {
2165
+ return getMainAxle(element, parent);
2166
+ }
2167
+ else {
2168
+ return getSecondAxle(element, parent);
2169
+ }
2170
+ },
2171
+ getVerticalGap(element, parent) {
2172
+ const _layout = (parent && parent.layout) || getRootLayout(element);
2173
+ if (isIndentedLayout(_layout)) {
2174
+ return BASE;
2175
+ }
2176
+ const isHorizontal = isHorizontalLayout(_layout);
2177
+ if (isHorizontal) {
2178
+ return getMainAxle(element, parent);
2179
+ }
2180
+ else {
2181
+ return getSecondAxle(element, parent);
2182
+ }
2183
+ },
2184
+ getVerticalConnectingPosition(element, parent) {
2185
+ if (element.shape === MindElementShape.underline && parent && isHorizontalLogicLayout(parent.layout)) {
2186
+ return ConnectingPosition.bottom;
2187
+ }
2188
+ return undefined;
2189
+ },
2190
+ getExtendHeight(node) {
2191
+ return BASE * 6;
2192
+ },
2193
+ getIndentedCrossLevelGap() {
2194
+ return BASE * 2;
2195
+ }
2196
+ };
2197
+ };
2198
+
1813
2199
  /**
1814
2200
  * get correctly layout:
1815
2201
  * 1. root is standard -> left or right
@@ -2110,303 +2496,80 @@ function drawAbstractLink(board, node, isHorizontal) {
2110
2496
  g.appendChild(straightLine);
2111
2497
  return g;
2112
2498
  }
2113
- const link = PlaitBoard.getRoughSVG(board).path(`M${bezierBeginPoint[0]},${bezierBeginPoint[1]} Q${c1[0]},${c1[1]} ${bezierConnectorPoint[0]},${bezierConnectorPoint[1]} Q${c2[0]},${c2[1]} ${bezierEndPoint[0]},${bezierEndPoint[1]} M${abstractConnectorPoint[0]},${abstractConnectorPoint[1]} L${bezierConnectorPoint[0]},${bezierConnectorPoint[1]}`, {
2114
- stroke: branchColor,
2115
- strokeWidth: branchWidth
2116
- });
2117
- return link;
2118
- }
2119
-
2120
- class EmojiDrawer {
2121
- constructor(board, viewContainerRef) {
2122
- this.board = board;
2123
- this.viewContainerRef = viewContainerRef;
2124
- this.componentRef = null;
2125
- }
2126
- draw(emoji, element) {
2127
- this.destroy();
2128
- const componentType = this.board.drawEmoji(emoji, element);
2129
- this.componentRef = this.viewContainerRef.createComponent(componentType);
2130
- this.componentRef.instance.emojiItem = emoji;
2131
- this.componentRef.instance.board = this.board;
2132
- this.componentRef.instance.element = element;
2133
- this.componentRef.instance.fontSize = getEmojiFontSize(element);
2134
- }
2135
- get nativeElement() {
2136
- if (this.componentRef) {
2137
- return this.componentRef.instance.nativeElement;
2138
- }
2139
- else {
2140
- return null;
2141
- }
2142
- }
2143
- destroy() {
2144
- if (this.componentRef) {
2145
- this.componentRef.destroy();
2146
- this.componentRef = null;
2147
- }
2148
- }
2149
- }
2150
- class NodeEmojisDrawer {
2151
- constructor(board, viewContainerRef) {
2152
- this.board = board;
2153
- this.viewContainerRef = viewContainerRef;
2154
- this.emojiDrawers = [];
2155
- }
2156
- drawEmojis(element) {
2157
- this.destroy();
2158
- if (MindElement.hasEmojis(element)) {
2159
- this.g = createG();
2160
- this.g.classList.add('emojis');
2161
- const foreignRectangle = getEmojiForeignRectangle(this.board, element);
2162
- const foreignObject = createForeignObject(foreignRectangle.x, foreignRectangle.y, foreignRectangle.width, foreignRectangle.height);
2163
- this.g.append(foreignObject);
2164
- const container = document.createElement('div');
2165
- container.classList.add('node-emojis-container');
2166
- foreignObject.append(container);
2167
- this.emojiDrawers = element.data.emojis.map(emojiItem => {
2168
- const drawer = new EmojiDrawer(this.board, this.viewContainerRef);
2169
- drawer.draw(emojiItem, element);
2170
- return drawer;
2171
- });
2172
- this.emojiDrawers.forEach(drawer => {
2173
- container.append(drawer.nativeElement);
2174
- });
2175
- return this.g;
2176
- }
2177
- return undefined;
2178
- }
2179
- destroy() {
2180
- if (this.g) {
2181
- this.g.remove();
2182
- }
2183
- this.emojiDrawers.forEach(drawer => drawer.destroy());
2184
- this.emojiDrawers = [];
2185
- }
2186
- }
2187
-
2188
- const setAbstractsByRefs = (board, abstractRefs) => {
2189
- abstractRefs.forEach((newProperty, element) => {
2190
- const start = element.start + newProperty.start;
2191
- const end = element.end + newProperty.end;
2192
- const path = PlaitBoard.findPath(board, element);
2193
- if (start > end) {
2194
- Transforms.removeNode(board, path);
2195
- }
2196
- else {
2197
- Transforms.setNode(board, { start, end }, path);
2198
- }
2199
- });
2200
- };
2201
- const setAbstractByStandardLayout = (board, element) => {
2202
- const rightNodeCount = element.rightNodeCount;
2203
- const abstract = element.children.find(child => {
2204
- return AbstractNode.isAbstract(child) && child.end >= rightNodeCount && child.start < rightNodeCount;
2205
- });
2206
- if (abstract) {
2207
- const path = PlaitBoard.findPath(board, abstract);
2208
- Transforms.setNode(board, { end: rightNodeCount - 1 }, path);
2209
- }
2210
- };
2211
- const insertAbstract = (board, elements) => {
2212
- let elementGroup = getFirstLevelElement(elements);
2213
- const { parentElements, abstractIncludedGroups } = divideElementByParent(elementGroup);
2214
- abstractIncludedGroups.forEach((group, index) => {
2215
- const groupParent = parentElements[index];
2216
- setAbstractByElements(board, groupParent, group);
2217
- });
2218
- };
2219
- const setAbstractByElements = (board, groupParent, group) => {
2220
- const indexArray = group.map(child => groupParent.children.indexOf(child)).sort((a, b) => a - b);
2221
- const rightNodeCount = groupParent === null || groupParent === void 0 ? void 0 : groupParent.rightNodeCount;
2222
- const start = indexArray[0], end = indexArray[indexArray.length - 1];
2223
- if (isStandardLayout(MindQueries.getLayoutByElement(groupParent)) &&
2224
- rightNodeCount &&
2225
- start < rightNodeCount &&
2226
- end >= rightNodeCount) {
2227
- const childrenLength = groupParent.children.length;
2228
- const path = [...PlaitBoard.findPath(board, groupParent), childrenLength];
2229
- const leftChildren = indexArray.filter(index => index >= rightNodeCount);
2230
- const rightChildren = indexArray.filter(index => index < rightNodeCount);
2231
- insertAbstractNode(board, path, rightChildren[0], rightChildren[rightChildren.length - 1]);
2232
- insertAbstractNode(board, Path.next(path), leftChildren[0], leftChildren[leftChildren.length - 1]);
2233
- }
2234
- else {
2235
- const path = [...PlaitBoard.findPath(board, groupParent), groupParent.children.length];
2236
- insertAbstractNode(board, path, start, end);
2237
- }
2238
- };
2239
- const insertAbstractNode = (board, path, start, end) => {
2240
- const mindElement = createMindElement('概要', 28, 20, {
2241
- strokeWidth: DefaultAbstractNodeStyle.branch.width,
2242
- branchWidth: DefaultAbstractNodeStyle.branch.width
2243
- });
2244
- mindElement.start = start;
2245
- mindElement.end = end;
2246
- Transforms.insertNode(board, mindElement, path);
2247
- clearSelectedElement(board);
2248
- addSelectedElement(board, mindElement);
2249
- };
2250
-
2251
- const setLayout = (board, layout, path) => {
2252
- correctLogicLayoutNode(board, layout, path);
2253
- const element = PlaitNode.get(board, path);
2254
- if (PlaitMind.isMind(element) && isStandardLayout(layout)) {
2255
- MindTransforms.setAbstractByStandardLayout(board, element);
2256
- }
2257
- Transforms.setNode(board, { layout }, path);
2258
- };
2259
- const correctLogicLayoutNode = (board, layout, path) => {
2260
- var _a;
2261
- const node = PlaitNode.get(board, path);
2262
- if (node && layout) {
2263
- (_a = node.children) === null || _a === void 0 ? void 0 : _a.forEach((value, index) => {
2264
- var _a;
2265
- if (value.layout) {
2266
- if ((isHorizontalLogicLayout(layout) && isVerticalLogicLayout(value.layout)) ||
2267
- (isVerticalLogicLayout(layout) && isHorizontalLogicLayout(value.layout))) {
2268
- Transforms.setNode(board, { layout: null }, [...path, index]);
2269
- }
2270
- if ((_a = value.children) === null || _a === void 0 ? void 0 : _a.length) {
2271
- correctLogicLayoutNode(board, layout, [...path, index]);
2272
- }
2273
- }
2274
- });
2275
- }
2276
- };
2277
-
2278
- const normalizeWidthAndHeight = (board, element, width, height) => {
2279
- const minWidth = NodeSpace.getNodeTopicMinWidth(board, element, element.isRoot);
2280
- const newWidth = width < minWidth * board.viewport.zoom ? minWidth : width / board.viewport.zoom;
2281
- const newHeight = height / board.viewport.zoom;
2282
- return { width: newWidth, height: newHeight };
2283
- };
2284
- const setTopic = (board, element, topic, width, height) => {
2285
- const newElement = Object.assign({ data: Object.assign(Object.assign({}, element.data), { topic }) }, normalizeWidthAndHeight(board, element, width, height));
2286
- const path = PlaitBoard.findPath(board, element);
2287
- Transforms.setNode(board, newElement, path);
2288
- };
2289
- const setNodeManualWidth = (board, element, width, height) => {
2290
- const path = PlaitBoard.findPath(board, element);
2291
- const { width: normalizedWidth, height: normalizedHeight } = normalizeWidthAndHeight(board, element, width, height);
2292
- const newElement = { manualWidth: normalizedWidth, height: normalizedHeight };
2293
- Transforms.setNode(board, newElement, path);
2294
- };
2295
- const setTopicSize = (board, element, width, height) => {
2296
- const newElement = Object.assign({}, normalizeWidthAndHeight(board, element, width, height));
2297
- let isEqualWidth = Math.ceil(element.width) === Math.ceil(newElement.width);
2298
- let isEqualHeight = Math.ceil(element.height) === Math.ceil(newElement.height);
2299
- if (element.manualWidth) {
2300
- isEqualWidth = true;
2301
- }
2302
- if (!isEqualWidth || !isEqualHeight) {
2303
- const path = PlaitBoard.findPath(board, element);
2304
- Transforms.setNode(board, newElement, path);
2305
- }
2306
- };
2307
- const removeElements = (board, elements) => {
2308
- const deletableElements = getFirstLevelElement(elements);
2309
- deletableElements
2310
- .map(element => {
2311
- const path = PlaitBoard.findPath(board, element);
2312
- const ref = board.pathRef(path);
2313
- return () => {
2314
- Transforms.removeNode(board, ref.current);
2315
- ref.unref();
2316
- };
2317
- })
2318
- .forEach(action => {
2319
- action();
2320
- });
2321
- };
2322
- const insertNodes = (board, elements, path) => {
2323
- const pathRef = board.pathRef(path);
2324
- elements.forEach(element => {
2325
- if (pathRef.current) {
2326
- Transforms.insertNode(board, element, pathRef.current);
2327
- }
2328
- });
2329
- pathRef.unref();
2330
- };
2331
- const insertAbstractNodes = (board, validAbstractRefs, elements, path) => {
2332
- var _a;
2333
- const parent = PlaitNode.get(board, Path$1.parent(path));
2334
- const abstractPath = [...Path$1.parent(path), (_a = parent.children) === null || _a === void 0 ? void 0 : _a.length];
2335
- const abstracts = validAbstractRefs.map(refs => {
2336
- const { start, end } = getRelativeStartEndByAbstractRef(refs, elements);
2337
- return Object.assign(Object.assign({}, refs.abstract), { start: start + path[path.length - 1], end: end + path[path.length - 1] });
2338
- });
2339
- insertNodes(board, abstracts, abstractPath);
2340
- };
2341
- const setRightNodeCountByRefs = (board, refs) => {
2342
- refs.forEach(ref => {
2343
- Transforms.setNode(board, { rightNodeCount: ref.rightNodeCount }, ref.path);
2344
- });
2345
- };
2346
-
2347
- const addEmoji = (board, element, emojiItem) => {
2348
- const emojis = element.data.emojis || [];
2349
- const newEmojis = [...emojis];
2350
- newEmojis.push(emojiItem);
2351
- const newElement = {
2352
- data: Object.assign(Object.assign({}, element.data), { emojis: newEmojis })
2353
- };
2354
- const path = PlaitBoard.findPath(board, element);
2355
- Transforms.setNode(board, newElement, path);
2356
- };
2357
- const removeEmoji = (board, element, emojiItem) => {
2358
- const emojis = element.data.emojis.filter(value => value !== emojiItem);
2359
- const newElement = {
2360
- data: Object.assign({}, element.data)
2361
- };
2362
- if (emojis.length > 0) {
2363
- newElement.data.emojis = emojis;
2364
- }
2365
- const path = PlaitBoard.findPath(board, element);
2366
- Transforms.setNode(board, newElement, path);
2367
- };
2368
- const replaceEmoji = (board, element, oldEmoji, newEmoji) => {
2369
- const newElement = {
2370
- data: Object.assign({}, element.data)
2371
- };
2372
- const newEmojis = element.data.emojis.map(value => {
2373
- if (value === oldEmoji) {
2374
- return newEmoji;
2375
- }
2376
- return value;
2499
+ const link = PlaitBoard.getRoughSVG(board).path(`M${bezierBeginPoint[0]},${bezierBeginPoint[1]} Q${c1[0]},${c1[1]} ${bezierConnectorPoint[0]},${bezierConnectorPoint[1]} Q${c2[0]},${c2[1]} ${bezierEndPoint[0]},${bezierEndPoint[1]} M${abstractConnectorPoint[0]},${abstractConnectorPoint[1]} L${bezierConnectorPoint[0]},${bezierConnectorPoint[1]}`, {
2500
+ stroke: branchColor,
2501
+ strokeWidth: branchWidth
2377
2502
  });
2378
- newElement.data.emojis = newEmojis;
2379
- const path = PlaitBoard.findPath(board, element);
2380
- Transforms.setNode(board, newElement, path);
2381
- };
2382
-
2383
- const removeImage = (board, element) => {
2384
- setImageFocus(board, element, false);
2385
- const newElement = {
2386
- data: Object.assign({}, element.data)
2387
- };
2388
- delete newElement.data.image;
2389
- const path = PlaitBoard.findPath(board, element);
2390
- Transforms.setNode(board, newElement, path);
2391
- };
2503
+ return link;
2504
+ }
2392
2505
 
2393
- const MindTransforms = {
2394
- setLayout,
2395
- setTopic,
2396
- setTopicSize,
2397
- setNodeManualWidth,
2398
- addEmoji,
2399
- removeEmoji,
2400
- replaceEmoji,
2401
- insertAbstract,
2402
- setAbstractsByRefs,
2403
- setAbstractByStandardLayout,
2404
- removeElements,
2405
- insertNodes,
2406
- insertAbstractNodes,
2407
- setRightNodeCountByRefs,
2408
- removeImage
2409
- };
2506
+ class EmojiDrawer {
2507
+ constructor(board, viewContainerRef) {
2508
+ this.board = board;
2509
+ this.viewContainerRef = viewContainerRef;
2510
+ this.componentRef = null;
2511
+ }
2512
+ draw(emoji, element) {
2513
+ this.destroy();
2514
+ const componentType = this.board.drawEmoji(emoji, element);
2515
+ this.componentRef = this.viewContainerRef.createComponent(componentType);
2516
+ this.componentRef.instance.emojiItem = emoji;
2517
+ this.componentRef.instance.board = this.board;
2518
+ this.componentRef.instance.element = element;
2519
+ this.componentRef.instance.fontSize = getEmojiFontSize(element);
2520
+ }
2521
+ get nativeElement() {
2522
+ if (this.componentRef) {
2523
+ return this.componentRef.instance.nativeElement;
2524
+ }
2525
+ else {
2526
+ return null;
2527
+ }
2528
+ }
2529
+ destroy() {
2530
+ if (this.componentRef) {
2531
+ this.componentRef.destroy();
2532
+ this.componentRef = null;
2533
+ }
2534
+ }
2535
+ }
2536
+ class NodeEmojisDrawer {
2537
+ constructor(board, viewContainerRef) {
2538
+ this.board = board;
2539
+ this.viewContainerRef = viewContainerRef;
2540
+ this.emojiDrawers = [];
2541
+ }
2542
+ drawEmojis(element) {
2543
+ this.destroy();
2544
+ if (MindElement.hasEmojis(element)) {
2545
+ this.g = createG();
2546
+ this.g.classList.add('emojis');
2547
+ const foreignRectangle = getEmojiForeignRectangle(this.board, element);
2548
+ const foreignObject = createForeignObject(foreignRectangle.x, foreignRectangle.y, foreignRectangle.width, foreignRectangle.height);
2549
+ this.g.append(foreignObject);
2550
+ const container = document.createElement('div');
2551
+ container.classList.add('node-emojis-container');
2552
+ foreignObject.append(container);
2553
+ this.emojiDrawers = element.data.emojis.map(emojiItem => {
2554
+ const drawer = new EmojiDrawer(this.board, this.viewContainerRef);
2555
+ drawer.draw(emojiItem, element);
2556
+ return drawer;
2557
+ });
2558
+ this.emojiDrawers.forEach(drawer => {
2559
+ container.append(drawer.nativeElement);
2560
+ });
2561
+ return this.g;
2562
+ }
2563
+ return undefined;
2564
+ }
2565
+ destroy() {
2566
+ if (this.g) {
2567
+ this.g.remove();
2568
+ }
2569
+ this.emojiDrawers.forEach(drawer => drawer.destroy());
2570
+ this.emojiDrawers = [];
2571
+ }
2572
+ }
2410
2573
 
2411
2574
  class BaseDrawer {
2412
2575
  constructor(board) {
@@ -2765,36 +2928,6 @@ class CollapseDrawer extends BaseDrawer {
2765
2928
  }
2766
2929
  }
2767
2930
 
2768
- class MindImageBaseComponent {
2769
- get nativeElement() {
2770
- return this.elementRef.nativeElement;
2771
- }
2772
- constructor(elementRef, cdr) {
2773
- this.elementRef = elementRef;
2774
- this.cdr = cdr;
2775
- this.isFocus = false;
2776
- }
2777
- ngOnInit() { }
2778
- }
2779
- MindImageBaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: MindImageBaseComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
2780
- MindImageBaseComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.5", type: MindImageBaseComponent, inputs: { imageItem: "imageItem", board: "board", element: "element", isFocus: "isFocus" }, host: { classAttribute: "mind-node-image" }, ngImport: i0 });
2781
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: MindImageBaseComponent, decorators: [{
2782
- type: Directive,
2783
- args: [{
2784
- host: {
2785
- class: 'mind-node-image'
2786
- }
2787
- }]
2788
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { imageItem: [{
2789
- type: Input
2790
- }], board: [{
2791
- type: Input
2792
- }], element: [{
2793
- type: Input
2794
- }], isFocus: [{
2795
- type: Input
2796
- }] } });
2797
-
2798
2931
  class NodeImageDrawer {
2799
2932
  constructor(board, viewContainerRef) {
2800
2933
  this.board = board;
@@ -2808,9 +2941,9 @@ class NodeImageDrawer {
2808
2941
  }
2809
2942
  this.g = createG();
2810
2943
  const foreignRectangle = getImageForeignRectangle(this.board, element);
2811
- const foreignObject = createForeignObject(foreignRectangle.x, foreignRectangle.y, foreignRectangle.width, foreignRectangle.height);
2812
- this.g.append(foreignObject);
2813
- const componentType = this.board.getPluginOptions(WithMindPluginKey).imageComponentType || MindImageBaseComponent;
2944
+ this.foreignObject = createForeignObject(foreignRectangle.x, foreignRectangle.y, foreignRectangle.width, foreignRectangle.height);
2945
+ this.g.append(this.foreignObject);
2946
+ const componentType = this.board.getPluginOptions(WithMindPluginKey).imageComponentType;
2814
2947
  if (!componentType) {
2815
2948
  throw new Error('Not implement drawEmoji method error.');
2816
2949
  }
@@ -2819,7 +2952,7 @@ class NodeImageDrawer {
2819
2952
  this.componentRef.instance.element = element;
2820
2953
  this.componentRef.instance.imageItem = element.data.image;
2821
2954
  this.componentRef.instance.cdr.markForCheck();
2822
- foreignObject.append(this.componentRef.instance.nativeElement);
2955
+ this.foreignObject.append(this.componentRef.instance.nativeElement);
2823
2956
  nodeG.appendChild(this.g);
2824
2957
  }
2825
2958
  updateImage(nodeG, previous, current) {
@@ -2834,6 +2967,10 @@ class NodeImageDrawer {
2834
2967
  }
2835
2968
  const currentForeignObject = getImageForeignRectangle(this.board, current);
2836
2969
  updateForeignObject(this.g, currentForeignObject.width, currentForeignObject.height, currentForeignObject.x, currentForeignObject.y);
2970
+ // solve image lose on move node
2971
+ if (this.foreignObject.children.length === 0) {
2972
+ this.foreignObject.append(this.componentRef.instance.nativeElement);
2973
+ }
2837
2974
  (_a = this.componentRef) === null || _a === void 0 ? void 0 : _a.instance.cdr.markForCheck();
2838
2975
  }
2839
2976
  destroy() {
@@ -2871,8 +3008,6 @@ class MindNodeComponent extends PlaitPluginElementComponent {
2871
3008
  this.textManage = new TextManage(this.board, this.viewContainerRef, () => {
2872
3009
  const rect = getTopicRectangleByNode(this.board, this.node);
2873
3010
  return rect;
2874
- }, (point) => {
2875
- return isHitMindElement(this.board, point, this.element);
2876
3011
  }, (textManageRef) => {
2877
3012
  const width = textManageRef.width;
2878
3013
  const height = textManageRef.height;
@@ -2997,20 +3132,35 @@ class MindNodeComponent extends PlaitPluginElementComponent {
2997
3132
  this.textManage.draw(this.element.data.topic);
2998
3133
  this.g.append(this.textManage.g);
2999
3134
  if (this.element.manualWidth) {
3000
- const width = NodeSpace.getNodeResizableWidth(this.board, this.element);
3135
+ const width = NodeSpace.getNodeDynamicWidth(this.board, this.element);
3001
3136
  this.textManage.updateWidth(width);
3002
3137
  }
3003
3138
  }
3004
3139
  updateTopic() {
3005
3140
  this.textManage.updateText(this.element.data.topic);
3006
3141
  this.textManage.updateRectangle();
3142
+ if (this.element.manualWidth) {
3143
+ const width = NodeSpace.getNodeDynamicWidth(this.board, this.element);
3144
+ this.textManage.updateWidth(width);
3145
+ }
3007
3146
  }
3008
3147
  editTopic() {
3009
3148
  this.activeDrawer.draw(this.element, this.g, { selected: this.selected, isEditing: true });
3149
+ // update text max-width when image width greater than topic default max width to cover node topic default max width style
3150
+ const defaultMaxWidth = TOPIC_DEFAULT_MAX_WORD_COUNT * (PlaitMind.isMind(this.element) ? ROOT_TOPIC_FONT_SIZE : TOPIC_FONT_SIZE);
3151
+ let hasMaxWidth = false;
3152
+ if (!this.element.manualWidth && MindElement.hasImage(this.element) && this.element.data.image.width > defaultMaxWidth) {
3153
+ const width = NodeSpace.getNodeDynamicWidth(this.board, this.element);
3154
+ this.textManage.updateWidth(width);
3155
+ hasMaxWidth = true;
3156
+ }
3010
3157
  this.textManage.edit((origin) => {
3011
3158
  if (origin === ExitOrigin.default) {
3012
3159
  this.activeDrawer.draw(this.element, this.g, { selected: this.selected, isEditing: false });
3013
3160
  }
3161
+ if (hasMaxWidth) {
3162
+ this.textManage.updateWidth(0);
3163
+ }
3014
3164
  });
3015
3165
  }
3016
3166
  ngOnDestroy() {
@@ -3052,73 +3202,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImpor
3052
3202
  }]
3053
3203
  }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }]; } });
3054
3204
 
3055
- const getLayoutOptions = (board) => {
3056
- function getMainAxle(element, parent) {
3057
- const strokeWidth = element.strokeWidth || STROKE_WIDTH;
3058
- if (element.isRoot) {
3059
- return BASE * 12;
3060
- }
3061
- if (parent && parent.isRoot()) {
3062
- return BASE * 3 + strokeWidth / 2;
3063
- }
3064
- return BASE * 3 + strokeWidth / 2;
3065
- }
3066
- function getSecondAxle(element, parent) {
3067
- const strokeWidth = element.strokeWidth || STROKE_WIDTH;
3068
- if (element.isRoot) {
3069
- return BASE * 10 + strokeWidth / 2;
3070
- }
3071
- return BASE * 6 + strokeWidth / 2;
3072
- }
3073
- return {
3074
- getHeight(element) {
3075
- return NodeSpace.getNodeHeight(board, element);
3076
- },
3077
- getWidth(element) {
3078
- return NodeSpace.getNodeWidth(board, element);
3079
- },
3080
- getHorizontalGap(element, parent) {
3081
- const _layout = (parent && parent.layout) || getRootLayout(element);
3082
- const isHorizontal = isHorizontalLayout(_layout);
3083
- const strokeWidth = element.strokeWidth || STROKE_WIDTH;
3084
- if (isIndentedLayout(_layout)) {
3085
- return BASE * 4 + strokeWidth;
3086
- }
3087
- if (!isHorizontal) {
3088
- return getMainAxle(element, parent);
3089
- }
3090
- else {
3091
- return getSecondAxle(element, parent);
3092
- }
3093
- },
3094
- getVerticalGap(element, parent) {
3095
- const _layout = (parent && parent.layout) || getRootLayout(element);
3096
- if (isIndentedLayout(_layout)) {
3097
- return BASE;
3098
- }
3099
- const isHorizontal = isHorizontalLayout(_layout);
3100
- if (isHorizontal) {
3101
- return getMainAxle(element, parent);
3102
- }
3103
- else {
3104
- return getSecondAxle(element, parent);
3105
- }
3106
- },
3107
- getVerticalConnectingPosition(element, parent) {
3108
- if (element.shape === MindElementShape.underline && parent && isHorizontalLogicLayout(parent.layout)) {
3109
- return ConnectingPosition.bottom;
3110
- }
3111
- return undefined;
3112
- },
3113
- getExtendHeight(node) {
3114
- return BASE * 6;
3115
- },
3116
- getIndentedCrossLevelGap() {
3117
- return BASE * 2;
3118
- }
3119
- };
3120
- };
3121
-
3122
3205
  class PlaitMindComponent extends MindNodeComponent {
3123
3206
  ngOnInit() {
3124
3207
  this.updateMindLayout();
@@ -3845,7 +3928,7 @@ const withNodeHoverDetect = (board) => {
3845
3928
  };
3846
3929
 
3847
3930
  const withNodeImage = (board) => {
3848
- const { keydown, mousedown, globalMouseup } = board;
3931
+ const { keydown, mousedown, globalMouseup, insertFragment } = board;
3849
3932
  board.mousedown = (event) => {
3850
3933
  const selectedImageElement = getSelectedImageElement(board);
3851
3934
  if (PlaitBoard.isReadonly(board) || !isMainPointer(event) || !PlaitBoard.isPointer(board, PlaitPointerType.selection)) {
@@ -3871,7 +3954,6 @@ const withNodeImage = (board) => {
3871
3954
  if (hitImage) {
3872
3955
  temporaryDisableSelection(board);
3873
3956
  setImageFocus(board, hitElements[0], true);
3874
- clearSelectedElement(board);
3875
3957
  }
3876
3958
  mousedown(event);
3877
3959
  };
@@ -3895,6 +3977,21 @@ const withNodeImage = (board) => {
3895
3977
  }
3896
3978
  globalMouseup(event);
3897
3979
  };
3980
+ board.insertFragment = (data, targetPoint) => {
3981
+ const selectedElements = getSelectedElements(board);
3982
+ const isSelectedImage = !!getSelectedImageElement(board);
3983
+ const isSingleSelection = selectedElements.length === 1 && MindElement.isMindElement(board, selectedElements[0]);
3984
+ if ((data === null || data === void 0 ? void 0 : data.files.length) && (isSingleSelection || isSelectedImage)) {
3985
+ const selectedElement = (selectedElements[0] || getSelectedImageElement(board));
3986
+ const acceptImageArray = acceptImageTypes.map(type => 'image/' + type);
3987
+ if (acceptImageArray.includes(data === null || data === void 0 ? void 0 : data.files[0].type)) {
3988
+ const imageFile = data.files[0];
3989
+ buildImage(board, selectedElement, imageFile);
3990
+ return;
3991
+ }
3992
+ }
3993
+ insertFragment(data, targetPoint);
3994
+ };
3898
3995
  return board;
3899
3996
  };
3900
3997
 
@@ -3924,7 +4021,7 @@ const withNodeResize = (board) => {
3924
4021
  addResizing(board, targetElement);
3925
4022
  targetElementRef = {
3926
4023
  minWidth: NodeSpace.getNodeResizableMinWidth(board, targetElement),
3927
- currentWidth: NodeSpace.getNodeResizableWidth(board, targetElement),
4024
+ currentWidth: NodeSpace.getNodeDynamicWidth(board, targetElement),
3928
4025
  path: PlaitBoard.findPath(board, targetElement),
3929
4026
  textManage: PlaitElement.getComponent(targetElement).textManage
3930
4027
  };
@@ -3940,7 +4037,7 @@ const withNodeResize = (board) => {
3940
4037
  const offsetX = endPoint[0] - startPoint[0];
3941
4038
  const zoom = board.viewport.zoom;
3942
4039
  let resizedWidth = targetElementRef.currentWidth + offsetX / zoom;
3943
- if (resizedWidth < targetElementRef.minWidth) {
4040
+ if (resizedWidth <= targetElementRef.minWidth) {
3944
4041
  resizedWidth = targetElementRef.minWidth;
3945
4042
  }
3946
4043
  const newTarget = PlaitNode.get(board, targetElementRef.path);
@@ -4167,6 +4264,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImpor
4167
4264
  args: ['mousedown']
4168
4265
  }] } });
4169
4266
 
4267
+ class MindImageBaseComponent {
4268
+ set imageItem(value) {
4269
+ this.afterImageItemChange(this._imageItem, value);
4270
+ this._imageItem = value;
4271
+ }
4272
+ get imageItem() {
4273
+ return this._imageItem;
4274
+ }
4275
+ get nativeElement() {
4276
+ return this.elementRef.nativeElement;
4277
+ }
4278
+ constructor(elementRef, cdr) {
4279
+ this.elementRef = elementRef;
4280
+ this.cdr = cdr;
4281
+ this.isFocus = false;
4282
+ }
4283
+ }
4284
+ MindImageBaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: MindImageBaseComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
4285
+ MindImageBaseComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.5", type: MindImageBaseComponent, inputs: { imageItem: "imageItem", board: "board", element: "element", isFocus: "isFocus" }, host: { classAttribute: "mind-node-image" }, ngImport: i0 });
4286
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: MindImageBaseComponent, decorators: [{
4287
+ type: Directive,
4288
+ args: [{
4289
+ host: {
4290
+ class: 'mind-node-image'
4291
+ }
4292
+ }]
4293
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { imageItem: [{
4294
+ type: Input
4295
+ }], board: [{
4296
+ type: Input
4297
+ }], element: [{
4298
+ type: Input
4299
+ }], isFocus: [{
4300
+ type: Input
4301
+ }] } });
4302
+
4170
4303
  /*
4171
4304
  * Public API Surface of mind
4172
4305
  */
@@ -4175,5 +4308,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImpor
4175
4308
  * Generated bundle index. Do not edit.
4176
4309
  */
4177
4310
 
4178
- export { ABSTRACT_HANDLE_COLOR, ABSTRACT_HANDLE_LENGTH, ABSTRACT_HANDLE_MASK_WIDTH, ABSTRACT_INCLUDED_OUTLINE_OFFSET, AbstractHandlePosition, AbstractResizeState, BASE, BRANCH_FONT_FAMILY, BRANCH_WIDTH, BaseDrawer, BranchShape, DEFAULT_FONT_FAMILY, DefaultAbstractNodeStyle, DefaultNodeStyle, ELEMENT_TO_NODE, EXTEND_DIAMETER, EXTEND_OFFSET, GRAY_COLOR, INHERIT_ATTRIBUTE_KEYS, IS_DRAGGING, LayoutDirection, LayoutDirectionsMap, MindColorfulThemeColor, MindDarkThemeColor, MindDefaultThemeColor, MindElement, MindElementShape, MindEmojiBaseComponent, MindImageBaseComponent, MindModule, MindNode, MindNodeComponent, MindPointerType, MindQueries, MindRetroThemeColor, MindSoftThemeColor, MindStarryThemeColor, MindThemeColor, MindThemeColors, MindTransforms, PRIMARY_COLOR, PlaitMind, PlaitMindComponent, QUICK_INSERT_CIRCLE_COLOR, QUICK_INSERT_CIRCLE_OFFSET, QUICK_INSERT_INNER_CROSS_COLOR, ROOT_TOPIC_FONT_SIZE, ROOT_TOPIC_HEIGHT, STROKE_WIDTH, TOPIC_COLOR, TOPIC_DEFAULT_MAX_WORD_COUNT, TOPIC_FONT_SIZE, TRANSPARENT, WithMindPluginKey, addActiveOnDragOrigin, addSelectedImageElement, adjustAbstractToNode, adjustNodeToRoot, adjustRootToNode, canSetAbstract, copyNewNode, correctLayoutByDirection, createDefaultMind, createEmptyMind, createMindElement, deleteElementHandleAbstract, deleteElementsHandleRightNodeCount, detectDropTarget, directionCorrector, directionDetector, divideElementByParent, drawFakeDragNode, drawFakeDropNode, editTopic, extractNodesText, findLastChild, findLocationLeftIndex, getAbstractBranchColor, getAbstractBranchWidth, getAbstractHandleRectangle, getAllowedDirection, getAvailableSubLayoutsByLayoutDirections, getBehindAbstracts, getBranchColorByMindElement, getBranchDirectionsByLayouts, getBranchShapeByMindElement, getBranchWidthByMindElement, getChildrenCount, getCorrespondingAbstract, getDefaultBranchColor, getDefaultBranchColorByIndex, getDefaultLayout, getEmojiForeignRectangle, getEmojiRectangle, getFillByElement, getFirstLevelElement, getHitAbstractHandle, getImageForeignRectangle, getInCorrectLayoutDirection, getLayoutDirection$1 as getLayoutDirection, getLayoutReverseDirection, getLocationScope, getMindThemeColor, getNextBranchColor, getOverallAbstracts, getPathByDropTarget, getRectangleByElement, getRectangleByNode, getRectangleByResizingLocation, getRelativeStartEndByAbstractRef, getRootLayout, getSelectedImageElement, getShapeByElement, getStrokeByMindElement, getStrokeWidthByElement, getTopicRectangleByElement, getTopicRectangleByNode, getValidAbstractRefs, handleTouchedAbstract, hasAfterDraw, hasPreviousOrNextOfDropPath, insertElementHandleAbstract, insertElementHandleRightNodeCount, insertMindElement, isChildElement, isChildOfAbstract, isChildRight, isChildUp, isCorrectLayout, isDragging, isDropStandardRight, isHitEmojis, isHitImage, isHitMindElement, isInRightBranchOfStandardLayout, isMixedLayout, isSetAbstract, isValidTarget, isVirtualKey, removeActiveOnDragOrigin, removeSelectedImageElement, separateChildren, setImageFocus, setIsDragging, temporaryDisableSelection, withMind, withMindExtend };
4311
+ export { ABSTRACT_HANDLE_COLOR, ABSTRACT_HANDLE_LENGTH, ABSTRACT_HANDLE_MASK_WIDTH, ABSTRACT_INCLUDED_OUTLINE_OFFSET, AbstractHandlePosition, AbstractResizeState, BASE, BRANCH_FONT_FAMILY, BRANCH_WIDTH, BaseDrawer, BranchShape, DEFAULT_FONT_FAMILY, DefaultAbstractNodeStyle, DefaultNodeStyle, ELEMENT_TO_NODE, EXTEND_DIAMETER, EXTEND_OFFSET, GRAY_COLOR, INHERIT_ATTRIBUTE_KEYS, IS_DRAGGING, LayoutDirection, LayoutDirectionsMap, MindColorfulThemeColor, MindDarkThemeColor, MindDefaultThemeColor, MindElement, MindElementShape, MindEmojiBaseComponent, MindImageBaseComponent, MindModule, MindNode, MindNodeComponent, MindPointerType, MindQueries, MindRetroThemeColor, MindSoftThemeColor, MindStarryThemeColor, MindThemeColor, MindThemeColors, MindTransforms, NodeSpace, PRIMARY_COLOR, PlaitMind, PlaitMindComponent, QUICK_INSERT_CIRCLE_COLOR, QUICK_INSERT_CIRCLE_OFFSET, QUICK_INSERT_INNER_CROSS_COLOR, ROOT_TOPIC_FONT_SIZE, ROOT_TOPIC_HEIGHT, STROKE_WIDTH, TOPIC_COLOR, TOPIC_DEFAULT_MAX_WORD_COUNT, TOPIC_FONT_SIZE, TRANSPARENT, WithMindPluginKey, addActiveOnDragOrigin, addSelectedImageElement, adjustAbstractToNode, adjustNodeToRoot, adjustRootToNode, buildImage, canSetAbstract, copyNewNode, correctLayoutByDirection, createDefaultMind, createEmptyMind, createMindElement, deleteElementHandleAbstract, deleteElementsHandleRightNodeCount, detectDropTarget, directionCorrector, directionDetector, divideElementByParent, drawFakeDragNode, drawFakeDropNode, editTopic, extractNodesText, findLastChild, findLocationLeftIndex, getAbstractBranchColor, getAbstractBranchWidth, getAbstractHandleRectangle, getAllowedDirection, getAvailableSubLayoutsByLayoutDirections, getBehindAbstracts, getBranchColorByMindElement, getBranchDirectionsByLayouts, getBranchShapeByMindElement, getBranchWidthByMindElement, getChildrenCount, getCorrespondingAbstract, getDefaultBranchColor, getDefaultBranchColorByIndex, getDefaultLayout, getEmojiFontSize, getEmojiForeignRectangle, getEmojiRectangle, getEmojisWidthHeight, getFillByElement, getFirstLevelElement, getFontSizeBySlateElement, getHitAbstractHandle, getImageForeignRectangle, getInCorrectLayoutDirection, getLayoutDirection$1 as getLayoutDirection, getLayoutOptions, getLayoutReverseDirection, getLocationScope, getMindThemeColor, getNewNodeHeight, getNextBranchColor, getNodeDefaultFontSize, getOverallAbstracts, getPathByDropTarget, getRectangleByElement, getRectangleByNode, getRectangleByResizingLocation, getRelativeStartEndByAbstractRef, getRootLayout, getSelectedImageElement, getShapeByElement, getStrokeByMindElement, getStrokeWidthByElement, getTopicRectangleByElement, getTopicRectangleByNode, getValidAbstractRefs, handleTouchedAbstract, hasAfterDraw, hasPreviousOrNextOfDropPath, insertElementHandleAbstract, insertElementHandleRightNodeCount, insertMindElement, isChildElement, isChildOfAbstract, isChildRight, isChildUp, isCorrectLayout, isDragging, isDropStandardRight, isHitEmojis, isHitImage, isHitMindElement, isInRightBranchOfStandardLayout, isMixedLayout, isSetAbstract, isValidTarget, isVirtualKey, removeActiveOnDragOrigin, removeSelectedImageElement, selectImage, separateChildren, setImageFocus, setIsDragging, temporaryDisableSelection, withMind, withMindExtend };
4179
4312
  //# sourceMappingURL=plait-mind.mjs.map