@plait/mind 0.2.0-next.7 → 0.2.0-next.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/draw/richtext.d.ts +4 -3
- package/esm2020/draw/richtext.mjs +7 -7
- package/esm2020/interfaces/options.mjs +2 -0
- package/esm2020/layout-option.mjs +3 -3
- package/esm2020/mind.component.mjs +2 -2
- package/esm2020/node.component.mjs +5 -5
- package/esm2020/plugins/emoji/emoji.drawer.mjs +3 -4
- package/esm2020/plugins/emoji/emoji.mjs +7 -3
- package/esm2020/plugins/emoji/index.mjs +1 -2
- package/esm2020/plugins/with-dnd.mjs +2 -2
- package/esm2020/plugins/with-extend-mind.mjs +11 -0
- package/esm2020/plugins/with-mind.mjs +3 -3
- package/esm2020/public-api.mjs +2 -1
- package/esm2020/utils/node-space.mjs +5 -5
- package/fesm2015/plait-mind.mjs +39 -33
- package/fesm2015/plait-mind.mjs.map +1 -1
- package/fesm2020/plait-mind.mjs +39 -33
- package/fesm2020/plait-mind.mjs.map +1 -1
- package/interfaces/options.d.ts +4 -0
- package/layout-option.d.ts +2 -1
- package/mind.component.d.ts +2 -2
- package/node.component.d.ts +5 -4
- package/package.json +1 -1
- package/plugins/emoji/emoji.d.ts +2 -1
- package/plugins/emoji/emoji.drawer.d.ts +3 -3
- package/plugins/emoji/index.d.ts +0 -1
- package/plugins/with-extend-mind.d.ts +10 -0
- package/plugins/with-mind.d.ts +1 -1
- package/public-api.d.ts +1 -0
- package/styles/styles.scss +0 -3
- package/utils/node-space.d.ts +3 -2
- package/esm2020/plugins/emoji/with-mind-emoji.mjs +0 -8
- package/plugins/emoji/with-mind-emoji.d.ts +0 -8
package/fesm2020/plait-mind.mjs
CHANGED
|
@@ -1902,10 +1902,14 @@ function drawLogicLink(board, node, parent, isHorizontal) {
|
|
|
1902
1902
|
return PlaitBoard.getRoughSVG(board).curve(points, { stroke: branchColor, strokeWidth });
|
|
1903
1903
|
}
|
|
1904
1904
|
|
|
1905
|
-
function getEmojisRectangle(element) {
|
|
1905
|
+
function getEmojisRectangle(board, element) {
|
|
1906
|
+
const options = board.getMindOptions();
|
|
1906
1907
|
const count = element.data.emojis.length;
|
|
1907
1908
|
const fontSize = getEmojiFontSize(element);
|
|
1908
|
-
return {
|
|
1909
|
+
return {
|
|
1910
|
+
width: fontSize * count + count * 2 * options.emojiPadding + (count - 1) * options.spaceBetweenEmojis,
|
|
1911
|
+
height: element.height
|
|
1912
|
+
};
|
|
1909
1913
|
}
|
|
1910
1914
|
function getEmojiFontSize(element) {
|
|
1911
1915
|
if (PlaitMind.isMind(element)) {
|
|
@@ -1950,10 +1954,10 @@ const getVerticalSpaceBetweenNodeAndText = (element) => {
|
|
|
1950
1954
|
return nodeAndText;
|
|
1951
1955
|
};
|
|
1952
1956
|
const NodeSpace = {
|
|
1953
|
-
getNodeWidth(element) {
|
|
1957
|
+
getNodeWidth(board, element) {
|
|
1954
1958
|
const nodeAndText = getHorizontalSpaceBetweenNodeAndText(element);
|
|
1955
1959
|
if (MindElement.hasEmojis(element)) {
|
|
1956
|
-
return nodeAndText + getEmojisRectangle(element).width + getHorizontalSpaceEmojiAndText(element) + element.width + nodeAndText;
|
|
1960
|
+
return nodeAndText + getEmojisRectangle(board, element).width + getHorizontalSpaceEmojiAndText(element) + element.width + nodeAndText;
|
|
1957
1961
|
}
|
|
1958
1962
|
return nodeAndText + element.width + nodeAndText;
|
|
1959
1963
|
},
|
|
@@ -1961,10 +1965,10 @@ const NodeSpace = {
|
|
|
1961
1965
|
const nodeAndText = getVerticalSpaceBetweenNodeAndText(element);
|
|
1962
1966
|
return nodeAndText + element.height + nodeAndText;
|
|
1963
1967
|
},
|
|
1964
|
-
getTextHorizontalSpace(element) {
|
|
1968
|
+
getTextHorizontalSpace(board, element) {
|
|
1965
1969
|
const nodeAndText = getHorizontalSpaceBetweenNodeAndText(element);
|
|
1966
1970
|
if (MindElement.hasEmojis(element)) {
|
|
1967
|
-
return nodeAndText + getEmojisRectangle(element).width + getHorizontalSpaceEmojiAndText(element);
|
|
1971
|
+
return nodeAndText + getEmojisRectangle(board, element).width + getHorizontalSpaceEmojiAndText(element);
|
|
1968
1972
|
}
|
|
1969
1973
|
else {
|
|
1970
1974
|
return nodeAndText;
|
|
@@ -1984,8 +1988,8 @@ const NodeSpace = {
|
|
|
1984
1988
|
}
|
|
1985
1989
|
};
|
|
1986
1990
|
|
|
1987
|
-
function drawMindNodeRichtext(node, viewContainerRef) {
|
|
1988
|
-
const { x, y } = getRichtextRectangleByNode(node);
|
|
1991
|
+
function drawMindNodeRichtext(board, node, viewContainerRef) {
|
|
1992
|
+
const { x, y } = getRichtextRectangleByNode(board, node);
|
|
1989
1993
|
const classList = [];
|
|
1990
1994
|
if (node.origin.isRoot) {
|
|
1991
1995
|
classList.push('root-node');
|
|
@@ -2000,8 +2004,8 @@ function drawMindNodeRichtext(node, viewContainerRef) {
|
|
|
2000
2004
|
// COMPAT: last character can not show in safari browser
|
|
2001
2005
|
return drawRichtext(x, y, Math.ceil(node.origin.width), Math.ceil(node.origin.height), node.origin.data.topic, viewContainerRef, classList);
|
|
2002
2006
|
}
|
|
2003
|
-
function updateMindNodeTopicSize(node, g, isEditable) {
|
|
2004
|
-
const { x, y, width, height } = getRichtextRectangleByNode(node);
|
|
2007
|
+
function updateMindNodeTopicSize(board, node, g, isEditable) {
|
|
2008
|
+
const { x, y, width, height } = getRichtextRectangleByNode(board, node);
|
|
2005
2009
|
if (isEditable) {
|
|
2006
2010
|
// add 999, avoid changing lines when paste more text
|
|
2007
2011
|
updateForeignObject(g, width + 999, height + 999, x, y);
|
|
@@ -2011,9 +2015,9 @@ function updateMindNodeTopicSize(node, g, isEditable) {
|
|
|
2011
2015
|
updateForeignObject(g, Math.ceil(node.origin.width), Math.ceil(node.origin.height), x, y);
|
|
2012
2016
|
}
|
|
2013
2017
|
}
|
|
2014
|
-
function getRichtextRectangleByNode(node) {
|
|
2018
|
+
function getRichtextRectangleByNode(board, node) {
|
|
2015
2019
|
let { x, y, width, height } = getRectangleByNode(node);
|
|
2016
|
-
x = x + NodeSpace.getTextHorizontalSpace(node.origin);
|
|
2020
|
+
x = x + NodeSpace.getTextHorizontalSpace(board, node.origin);
|
|
2017
2021
|
y = y + NodeSpace.getTextVerticalSpace(node.origin);
|
|
2018
2022
|
return { width, height, x, y };
|
|
2019
2023
|
}
|
|
@@ -2112,9 +2116,8 @@ class EmojisDrawer {
|
|
|
2112
2116
|
this.g.classList.add('emojis');
|
|
2113
2117
|
let { x, y } = getRectangleByNode(MindElement.getNode(element));
|
|
2114
2118
|
x = x + NodeSpace.getEmojiHorizontalSpace(element);
|
|
2115
|
-
|
|
2116
|
-
const
|
|
2117
|
-
const foreignObject = createForeignObject(x, y, width, height);
|
|
2119
|
+
const { width, height } = getEmojisRectangle(this.board, element);
|
|
2120
|
+
const foreignObject = createForeignObject(x, y, width, height + NodeSpace.getEmojiVerticalSpace(element) * 2);
|
|
2118
2121
|
this.g.append(foreignObject);
|
|
2119
2122
|
const container = document.createElement('div');
|
|
2120
2123
|
container.classList.add('node-emojis-container');
|
|
@@ -2756,7 +2759,7 @@ class MindNodeComponent extends PlaitPluginElementComponent {
|
|
|
2756
2759
|
}
|
|
2757
2760
|
}
|
|
2758
2761
|
drawRichtext() {
|
|
2759
|
-
const { richtextG, richtextComponentRef, foreignObject } = drawMindNodeRichtext(this.node, this.viewContainerRef);
|
|
2762
|
+
const { richtextG, richtextComponentRef, foreignObject } = drawMindNodeRichtext(this.board, this.node, this.viewContainerRef);
|
|
2760
2763
|
this.richtextComponentRef = richtextComponentRef;
|
|
2761
2764
|
this.richtextG = richtextG;
|
|
2762
2765
|
this.foreignObject = foreignObject;
|
|
@@ -2898,7 +2901,7 @@ class MindNodeComponent extends PlaitPluginElementComponent {
|
|
|
2898
2901
|
}
|
|
2899
2902
|
updateRichtext() {
|
|
2900
2903
|
updateRichText(this.node.origin.data.topic, this.richtextComponentRef);
|
|
2901
|
-
updateMindNodeTopicSize(this.node, this.richtextG, this.isEditable);
|
|
2904
|
+
updateMindNodeTopicSize(this.board, this.node, this.richtextG, this.isEditable);
|
|
2902
2905
|
}
|
|
2903
2906
|
startEditText(isEnd, isClear) {
|
|
2904
2907
|
if (!this.richtextComponentRef) {
|
|
@@ -2908,7 +2911,7 @@ class MindNodeComponent extends PlaitPluginElementComponent {
|
|
|
2908
2911
|
this.isEditable = true;
|
|
2909
2912
|
IS_TEXT_EDITABLE.set(this.board, true);
|
|
2910
2913
|
this.disabledMaskG();
|
|
2911
|
-
updateMindNodeTopicSize(this.node, this.richtextG, this.isEditable);
|
|
2914
|
+
updateMindNodeTopicSize(this.board, this.node, this.richtextG, this.isEditable);
|
|
2912
2915
|
if (richtextInstance.plaitReadonly) {
|
|
2913
2916
|
richtextInstance.plaitReadonly = false;
|
|
2914
2917
|
this.richtextComponentRef.changeDetectorRef.detectChanges();
|
|
@@ -3011,7 +3014,7 @@ class MindNodeComponent extends PlaitPluginElementComponent {
|
|
|
3011
3014
|
richtextInstance.plaitReadonly = true;
|
|
3012
3015
|
this.richtextComponentRef?.changeDetectorRef.markForCheck();
|
|
3013
3016
|
this.isEditable = false;
|
|
3014
|
-
updateMindNodeTopicSize(this.node, this.richtextG, this.isEditable);
|
|
3017
|
+
updateMindNodeTopicSize(this.board, this.node, this.richtextG, this.isEditable);
|
|
3015
3018
|
IS_TEXT_EDITABLE.set(this.board, false);
|
|
3016
3019
|
};
|
|
3017
3020
|
}
|
|
@@ -3053,7 +3056,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImpor
|
|
|
3053
3056
|
}]
|
|
3054
3057
|
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }, { type: i0.Renderer2 }]; } });
|
|
3055
3058
|
|
|
3056
|
-
const getLayoutOptions = () => {
|
|
3059
|
+
const getLayoutOptions = (board) => {
|
|
3057
3060
|
function getMainAxle(element, parent) {
|
|
3058
3061
|
const strokeWidth = element.strokeWidth || STROKE_WIDTH;
|
|
3059
3062
|
if (element.isRoot) {
|
|
@@ -3076,7 +3079,7 @@ const getLayoutOptions = () => {
|
|
|
3076
3079
|
return NodeSpace.getNodeHeight(element);
|
|
3077
3080
|
},
|
|
3078
3081
|
getWidth(element) {
|
|
3079
|
-
return NodeSpace.getNodeWidth(element);
|
|
3082
|
+
return NodeSpace.getNodeWidth(board, element);
|
|
3080
3083
|
},
|
|
3081
3084
|
getHorizontalGap(element, parent) {
|
|
3082
3085
|
const _layout = (parent && parent.layout) || getRootLayout(element);
|
|
@@ -3132,7 +3135,7 @@ class PlaitMindComponent extends MindNodeComponent {
|
|
|
3132
3135
|
}
|
|
3133
3136
|
updateMindLayout(element = this.element) {
|
|
3134
3137
|
const mindLayoutType = element.layout || getDefaultLayout();
|
|
3135
|
-
this.root = GlobalLayout.layout(element, getLayoutOptions(), mindLayoutType);
|
|
3138
|
+
this.root = GlobalLayout.layout(element, getLayoutOptions(this.board), mindLayoutType);
|
|
3136
3139
|
this.updateMindNodeLocation(element);
|
|
3137
3140
|
}
|
|
3138
3141
|
updateMindNodeLocation(element) {
|
|
@@ -3253,7 +3256,7 @@ const withDnd = (board) => {
|
|
|
3253
3256
|
x: activeComponent.node.x + offsetX,
|
|
3254
3257
|
y: activeComponent.node.y + offsetY
|
|
3255
3258
|
};
|
|
3256
|
-
const textRectangle = getRichtextRectangleByNode(activeComponent.node);
|
|
3259
|
+
const textRectangle = getRichtextRectangleByNode(board, activeComponent.node);
|
|
3257
3260
|
const fakeNodeG = drawRectangleNode(board, fakeDraggingNode);
|
|
3258
3261
|
const richtextG = activeComponent.richtextG?.cloneNode(true);
|
|
3259
3262
|
updateForeignObject(richtextG, textRectangle.width + BASE * 10, textRectangle.height, textRectangle.x + offsetX, textRectangle.y + offsetY);
|
|
@@ -3515,14 +3518,6 @@ const insertClipboardText = (board, parentElement, text, width, height) => {
|
|
|
3515
3518
|
return;
|
|
3516
3519
|
};
|
|
3517
3520
|
|
|
3518
|
-
const withEmoji = (board) => {
|
|
3519
|
-
const newBoard = board;
|
|
3520
|
-
newBoard.drawEmoji = (emoji, element) => {
|
|
3521
|
-
throw new Error('Not implement drawEmoji method error.');
|
|
3522
|
-
};
|
|
3523
|
-
return newBoard;
|
|
3524
|
-
};
|
|
3525
|
-
|
|
3526
3521
|
const withAbstract = (board) => {
|
|
3527
3522
|
const newBoard = board;
|
|
3528
3523
|
const { mousedown, mousemove, mouseup } = board;
|
|
@@ -3623,6 +3618,17 @@ const withAbstract = (board) => {
|
|
|
3623
3618
|
return board;
|
|
3624
3619
|
};
|
|
3625
3620
|
|
|
3621
|
+
const withExtendMind = (board) => {
|
|
3622
|
+
const newBoard = board;
|
|
3623
|
+
newBoard.drawEmoji = (emoji, element) => {
|
|
3624
|
+
throw new Error('Not implement drawEmoji method error.');
|
|
3625
|
+
};
|
|
3626
|
+
newBoard.getMindOptions = () => {
|
|
3627
|
+
return { spaceBetweenEmojis: 4, emojiPadding: 0 };
|
|
3628
|
+
};
|
|
3629
|
+
return newBoard;
|
|
3630
|
+
};
|
|
3631
|
+
|
|
3626
3632
|
const withMind = (board) => {
|
|
3627
3633
|
const { drawElement, dblclick, keydown, insertFragment, setFragment, deleteFragment, isHitSelection, getRectangle, isMovable, isRecursion } = board;
|
|
3628
3634
|
board.drawElement = (context) => {
|
|
@@ -3790,7 +3796,7 @@ const withMind = (board) => {
|
|
|
3790
3796
|
deleteSelectedELements(board, selectedElements);
|
|
3791
3797
|
deleteFragment(data);
|
|
3792
3798
|
};
|
|
3793
|
-
return
|
|
3799
|
+
return withExtendMind(withAbstract(withDnd(board)));
|
|
3794
3800
|
};
|
|
3795
3801
|
|
|
3796
3802
|
class MindEmojiBaseComponent {
|
|
@@ -3832,5 +3838,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImpor
|
|
|
3832
3838
|
* Generated bundle index. Do not edit.
|
|
3833
3839
|
*/
|
|
3834
3840
|
|
|
3835
|
-
export { ABSTRACT_HANDLE_COLOR, ABSTRACT_HANDLE_LENGTH, ABSTRACT_HANDLE_MASK_WIDTH, ABSTRACT_INCLUDED_OUTLINE_OFFSET, AbstractHandlePosition, AbstractResizeState, BASE, COLORS, ELEMENT_TO_NODE, EXTEND_OFFSET, EXTEND_RADIUS, GRAY_COLOR, LayoutDirection, LayoutDirectionsMap, MAX_RADIUS, MINDMAP_KEY, MindElement, MindEmojiBaseComponent, MindModule, MindNode, MindNodeComponent, MindNodeShape, MindQueries, MindTransforms, NODE_FILL, NODE_MIN_WIDTH, PRIMARY_COLOR, PlaitMind, PlaitMindComponent, QUICK_INSERT_CIRCLE_COLOR, QUICK_INSERT_CIRCLE_OFFSET, QUICK_INSERT_INNER_CROSS_COLOR, ROOT_NODE_FILL, ROOT_NODE_STROKE, ROOT_TOPIC_FONT_SIZE, STROKE_WIDTH, TOPIC_COLOR, TOPIC_DEFAULT_MAX_WORD_COUNT, TOPIC_FONT_SIZE, TRANSPARENT, canSetAbstract, changeRightNodeCount, copyNewNode, correctLayoutByDirection, createDefaultMindMapElement, createMindElement, deleteSelectedELements, directionCorrector, directionDetector, divideElementByParent, drawCurvePlaceholderDropNodeG, drawIndentNodeG, drawPlaceholderDropNodeG, drawStraightDropNodeG, extractNodesText, filterChildElement, findLastChild, findLocationLeftIndex, findParentElement, findUpElement, getAbstractHandleRectangle, getAllowedDirection, getAvailableSubLayoutsByLayoutDirections, getBehindAbstracts, getBranchColorByMindElement, getBranchDirectionsByLayouts, getChildrenCount, getCorrespondingAbstract, getDefaultLayout, getEmojiFontSize, getEmojisRectangle, getHitAbstractHandle, getHorizontalFakeY, getInCorrectLayoutDirection, getIndentedFakePoint, getLayoutDirection$1 as getLayoutDirection, getLayoutReverseDirection, getLocationScope, getNextBranchColor, getNodeShapeByElement, getRectangleByNode, getRectangleByResizingLocation, getRootLayout, getStrokeByMindElement, handleAbstractIncluded, handleTouchedAbstract, hitMindElement, insertAbstractNode, insertMindElement, insertSiblingElementHandleAbstract, isChildElement, isChildRight, isChildUp, isCorrectLayout, isMixedLayout, isSetAbstract, isVirtualKey, moveAbstractPosition, readjustmentDropTarget, separateChildren, setAbstract, setAbstractByElements, shouldChangeRightNodeCount, transformAbstractToNode, transformNodeToRoot, transformRootToNode,
|
|
3841
|
+
export { ABSTRACT_HANDLE_COLOR, ABSTRACT_HANDLE_LENGTH, ABSTRACT_HANDLE_MASK_WIDTH, ABSTRACT_INCLUDED_OUTLINE_OFFSET, AbstractHandlePosition, AbstractResizeState, BASE, COLORS, ELEMENT_TO_NODE, EXTEND_OFFSET, EXTEND_RADIUS, GRAY_COLOR, LayoutDirection, LayoutDirectionsMap, MAX_RADIUS, MINDMAP_KEY, MindElement, MindEmojiBaseComponent, MindModule, MindNode, MindNodeComponent, MindNodeShape, MindQueries, MindTransforms, NODE_FILL, NODE_MIN_WIDTH, PRIMARY_COLOR, PlaitMind, PlaitMindComponent, QUICK_INSERT_CIRCLE_COLOR, QUICK_INSERT_CIRCLE_OFFSET, QUICK_INSERT_INNER_CROSS_COLOR, ROOT_NODE_FILL, ROOT_NODE_STROKE, ROOT_TOPIC_FONT_SIZE, STROKE_WIDTH, TOPIC_COLOR, TOPIC_DEFAULT_MAX_WORD_COUNT, TOPIC_FONT_SIZE, TRANSPARENT, canSetAbstract, changeRightNodeCount, copyNewNode, correctLayoutByDirection, createDefaultMindMapElement, createMindElement, deleteSelectedELements, directionCorrector, directionDetector, divideElementByParent, drawCurvePlaceholderDropNodeG, drawIndentNodeG, drawPlaceholderDropNodeG, drawStraightDropNodeG, extractNodesText, filterChildElement, findLastChild, findLocationLeftIndex, findParentElement, findUpElement, getAbstractHandleRectangle, getAllowedDirection, getAvailableSubLayoutsByLayoutDirections, getBehindAbstracts, getBranchColorByMindElement, getBranchDirectionsByLayouts, getChildrenCount, getCorrespondingAbstract, getDefaultLayout, getEmojiFontSize, getEmojisRectangle, getHitAbstractHandle, getHorizontalFakeY, getInCorrectLayoutDirection, getIndentedFakePoint, getLayoutDirection$1 as getLayoutDirection, getLayoutReverseDirection, getLocationScope, getNextBranchColor, getNodeShapeByElement, getRectangleByNode, getRectangleByResizingLocation, getRootLayout, getStrokeByMindElement, handleAbstractIncluded, handleTouchedAbstract, hitMindElement, insertAbstractNode, insertMindElement, insertSiblingElementHandleAbstract, isChildElement, isChildRight, isChildUp, isCorrectLayout, isMixedLayout, isSetAbstract, isVirtualKey, moveAbstractPosition, readjustmentDropTarget, separateChildren, setAbstract, setAbstractByElements, shouldChangeRightNodeCount, transformAbstractToNode, transformNodeToRoot, transformRootToNode, withExtendMind, withMind };
|
|
3836
3842
|
//# sourceMappingURL=plait-mind.mjs.map
|