@plait/mind 0.90.1 → 0.92.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/plait-mind.mjs +13 -34
- package/fesm2022/plait-mind.mjs.map +1 -1
- package/index.d.ts +601 -3
- package/package.json +1 -1
- package/constants/abstract-node.d.ts +0 -4
- package/constants/default.d.ts +0 -18
- package/constants/index.d.ts +0 -4
- package/constants/node-style.d.ts +0 -20
- package/constants/node-topic-style.d.ts +0 -3
- package/constants/theme.d.ts +0 -6
- package/emoji/emoji-base.component.d.ts +0 -10
- package/emoji/index.d.ts +0 -2
- package/emoji/with-emoji.d.ts +0 -15
- package/generators/node-active.generator.d.ts +0 -13
- package/generators/node-emojis.generator.d.ts +0 -22
- package/generators/node-more.generator.d.ts +0 -43
- package/generators/node-shape.generator.d.ts +0 -12
- package/interfaces/element-data.d.ts +0 -15
- package/interfaces/element.d.ts +0 -54
- package/interfaces/index.d.ts +0 -7
- package/interfaces/layout.d.ts +0 -10
- package/interfaces/node.d.ts +0 -32
- package/interfaces/options.d.ts +0 -5
- package/interfaces/pointer.d.ts +0 -3
- package/interfaces/theme-color.d.ts +0 -17
- package/interfaces/types.d.ts +0 -11
- package/mind-node.component.d.ts +0 -34
- package/mind.component.d.ts +0 -11
- package/plugins/with-abstract-resize.board.d.ts +0 -16
- package/plugins/with-abstract-resize.d.ts +0 -2
- package/plugins/with-mind-create.d.ts +0 -9
- package/plugins/with-mind-extend.d.ts +0 -3
- package/plugins/with-mind-fragment.d.ts +0 -5
- package/plugins/with-mind-hotkey.d.ts +0 -3
- package/plugins/with-mind.board.d.ts +0 -3
- package/plugins/with-mind.d.ts +0 -2
- package/plugins/with-node-dnd.d.ts +0 -2
- package/plugins/with-node-image-resize.d.ts +0 -2
- package/plugins/with-node-image.d.ts +0 -2
- package/plugins/with-node-more.d.ts +0 -14
- package/plugins/with-node-resize.d.ts +0 -6
- package/public-api.d.ts +0 -12
- package/queries/get-available-sublayouts-by-element.d.ts +0 -4
- package/queries/get-branch-layouts.d.ts +0 -4
- package/queries/get-correct-layout-by-element.d.ts +0 -10
- package/queries/get-layout-by-element.d.ts +0 -3
- package/queries/index.d.ts +0 -6
- package/transforms/abstract-node.d.ts +0 -6
- package/transforms/emoji.d.ts +0 -6
- package/transforms/image.d.ts +0 -5
- package/transforms/index.d.ts +0 -23
- package/transforms/layout.d.ts +0 -3
- package/transforms/node.d.ts +0 -14
- package/transforms/property.d.ts +0 -8
- package/utils/abstract/common.d.ts +0 -30
- package/utils/abstract/resize.d.ts +0 -23
- package/utils/clipboard.d.ts +0 -7
- package/utils/common.d.ts +0 -5
- package/utils/dnd/common.d.ts +0 -17
- package/utils/dnd/detector.d.ts +0 -18
- package/utils/draw/abstract-outline.d.ts +0 -12
- package/utils/draw/node-dnd.d.ts +0 -7
- package/utils/draw/node-link/abstract-link.d.ts +0 -3
- package/utils/draw/node-link/draw-link.d.ts +0 -4
- package/utils/draw/node-link/indented-link.d.ts +0 -4
- package/utils/draw/node-link/logic-link.d.ts +0 -4
- package/utils/draw/node-shape.d.ts +0 -5
- package/utils/index.d.ts +0 -16
- package/utils/layout.d.ts +0 -12
- package/utils/mind.d.ts +0 -17
- package/utils/node/adjust-node.d.ts +0 -6
- package/utils/node/common.d.ts +0 -4
- package/utils/node/create-node.d.ts +0 -18
- package/utils/node/dynamic-width.d.ts +0 -7
- package/utils/node/image.d.ts +0 -5
- package/utils/node/index.d.ts +0 -5
- package/utils/node/right-node-count.d.ts +0 -9
- package/utils/node-style/branch.d.ts +0 -15
- package/utils/node-style/common.d.ts +0 -3
- package/utils/node-style/index.d.ts +0 -3
- package/utils/node-style/shape.d.ts +0 -8
- package/utils/normalize.d.ts +0 -3
- package/utils/path.d.ts +0 -6
- package/utils/point-placement.d.ts +0 -12
- package/utils/position/emoji.d.ts +0 -7
- package/utils/position/image.d.ts +0 -16
- package/utils/position/index.d.ts +0 -4
- package/utils/position/node.d.ts +0 -12
- package/utils/position/topic.d.ts +0 -16
- package/utils/space/emoji.d.ts +0 -7
- package/utils/space/index.d.ts +0 -3
- package/utils/space/layout-options.d.ts +0 -3
- package/utils/space/node-space.d.ts +0 -23
- package/utils/weak-maps.d.ts +0 -3
package/fesm2022/plait-mind.mjs
CHANGED
|
@@ -1552,7 +1552,7 @@ function drawLogicLink(board, parent, node, isHorizontal, defaultStrokeColor = n
|
|
|
1552
1552
|
}
|
|
1553
1553
|
|
|
1554
1554
|
function drawLink(board, parentNode, node, isHorizontal, needDrawUnderline, defaultStrokeColor, defaultStrokeWidth, defaultStrokeStyle) {
|
|
1555
|
-
return MindElement.isIndentedLayout(parentNode.origin)
|
|
1555
|
+
return MindElement.isIndentedLayout(board, parentNode.origin)
|
|
1556
1556
|
? drawIndentedLink(board, parentNode, node, needDrawUnderline, defaultStrokeColor, defaultStrokeWidth, defaultStrokeStyle)
|
|
1557
1557
|
: drawLogicLink(board, parentNode, node, isHorizontal, defaultStrokeColor, defaultStrokeWidth, defaultStrokeStyle);
|
|
1558
1558
|
}
|
|
@@ -1654,7 +1654,7 @@ const drawFakeDropNode = (board, dropTarget, path) => {
|
|
|
1654
1654
|
const target = dropTarget.target;
|
|
1655
1655
|
const fakeDropNodeG = createG();
|
|
1656
1656
|
const parent = PlaitNode.get(board, Path.parent(path));
|
|
1657
|
-
const layout = MindQueries.
|
|
1657
|
+
const layout = MindQueries.getCorrectLayoutByElement(board, parent);
|
|
1658
1658
|
const isHorizontal = isHorizontalLayout(layout);
|
|
1659
1659
|
const { hasNextNode, hasPreviousNode } = hasPreviousOrNextOfDropPath(parent, dropTarget, path);
|
|
1660
1660
|
const width = 30;
|
|
@@ -1699,7 +1699,7 @@ const drawFakeDropNode = (board, dropTarget, path) => {
|
|
|
1699
1699
|
const placement = [HorizontalPlacement.left, VerticalPlacement.top];
|
|
1700
1700
|
transformPlacement(placement, linkDirection);
|
|
1701
1701
|
let offset = -height;
|
|
1702
|
-
if (MindElement.isIndentedLayout(parent)) {
|
|
1702
|
+
if (MindElement.isIndentedLayout(board, parent)) {
|
|
1703
1703
|
offset = isTopLayout(layout) ? offset / 2 + basicNode.height - basicNode.vGap : 0;
|
|
1704
1704
|
}
|
|
1705
1705
|
centerPoint = getPointByPlacement(nextRect, placement);
|
|
@@ -1713,7 +1713,7 @@ const drawFakeDropNode = (board, dropTarget, path) => {
|
|
|
1713
1713
|
const placement = [HorizontalPlacement.left, VerticalPlacement.bottom];
|
|
1714
1714
|
transformPlacement(placement, linkDirection);
|
|
1715
1715
|
let offset = height;
|
|
1716
|
-
if (MindElement.isIndentedLayout(parent)) {
|
|
1716
|
+
if (MindElement.isIndentedLayout(board, parent)) {
|
|
1717
1717
|
offset = isTopLayout(layout) ? -offset - (basicNode.height - basicNode.vGap) : offset;
|
|
1718
1718
|
}
|
|
1719
1719
|
centerPoint = getPointByPlacement(previousRect, placement);
|
|
@@ -1749,8 +1749,8 @@ const drawFakeDropNode = (board, dropTarget, path) => {
|
|
|
1749
1749
|
y,
|
|
1750
1750
|
width,
|
|
1751
1751
|
height,
|
|
1752
|
-
hGap: MindElement.isIndentedLayout(parent) ? BASE * 4 + (basicNode.origin.strokeWidth || STROKE_WIDTH) : 0,
|
|
1753
|
-
vGap: MindElement.isIndentedLayout(parent) ? BASE : 0
|
|
1752
|
+
hGap: MindElement.isIndentedLayout(board, parent) ? BASE * 4 + (basicNode.origin.strokeWidth || STROKE_WIDTH) : 0,
|
|
1753
|
+
vGap: MindElement.isIndentedLayout(board, parent) ? BASE : 0
|
|
1754
1754
|
};
|
|
1755
1755
|
const fakeRectangleG = drawRoundRectangle(PlaitBoard.getRoughSVG(board), fakeNode.x, fakeNode.y, fakeNode.x + width, fakeNode.y + height, {
|
|
1756
1756
|
stroke: PRIMARY_COLOR,
|
|
@@ -2240,25 +2240,9 @@ const getAvailableSubLayoutsByElement = (board, element) => {
|
|
|
2240
2240
|
return undefined;
|
|
2241
2241
|
};
|
|
2242
2242
|
|
|
2243
|
-
const getLayoutByElement = (element) => {
|
|
2244
|
-
const layout = element.layout;
|
|
2245
|
-
if (layout) {
|
|
2246
|
-
return layout;
|
|
2247
|
-
}
|
|
2248
|
-
const parent = !PlaitMind.isMind(element) && MindElement.getParent(element);
|
|
2249
|
-
if (AbstractNode.isAbstract(element) && parent) {
|
|
2250
|
-
return getAbstractLayout(getLayoutByElement(parent));
|
|
2251
|
-
}
|
|
2252
|
-
if (parent) {
|
|
2253
|
-
return getLayoutByElement(parent);
|
|
2254
|
-
}
|
|
2255
|
-
return getDefaultLayout();
|
|
2256
|
-
};
|
|
2257
|
-
|
|
2258
2243
|
const MindQueries = {
|
|
2259
2244
|
getAvailableSubLayoutsByElement,
|
|
2260
2245
|
getBranchLayouts,
|
|
2261
|
-
getLayoutByElement,
|
|
2262
2246
|
getCorrectLayoutByElement
|
|
2263
2247
|
};
|
|
2264
2248
|
|
|
@@ -2269,12 +2253,8 @@ const PlaitMind = {
|
|
|
2269
2253
|
}
|
|
2270
2254
|
};
|
|
2271
2255
|
const MindElement = {
|
|
2272
|
-
|
|
2273
|
-
const _layout = MindQueries.
|
|
2274
|
-
return _layout === layout;
|
|
2275
|
-
},
|
|
2276
|
-
isIndentedLayout(value) {
|
|
2277
|
-
const _layout = MindQueries.getLayoutByElement(value);
|
|
2256
|
+
isIndentedLayout(board, value) {
|
|
2257
|
+
const _layout = MindQueries.getCorrectLayoutByElement(board, value);
|
|
2278
2258
|
return isIndentedLayout(_layout);
|
|
2279
2259
|
},
|
|
2280
2260
|
isMindElement(board, element) {
|
|
@@ -2446,7 +2426,7 @@ const setAbstractByElements = (board, groupParent, group) => {
|
|
|
2446
2426
|
const indexArray = group.map((child) => groupParent.children.indexOf(child)).sort((a, b) => a - b);
|
|
2447
2427
|
const rightNodeCount = groupParent?.rightNodeCount;
|
|
2448
2428
|
const start = indexArray[0], end = indexArray[indexArray.length - 1];
|
|
2449
|
-
if (isStandardLayout(MindQueries.
|
|
2429
|
+
if (isStandardLayout(MindQueries.getCorrectLayoutByElement(board, groupParent)) &&
|
|
2450
2430
|
rightNodeCount &&
|
|
2451
2431
|
start < rightNodeCount &&
|
|
2452
2432
|
end >= rightNodeCount) {
|
|
@@ -2880,7 +2860,7 @@ const getNodeMoreKeyPosition = (board, element) => {
|
|
|
2880
2860
|
};
|
|
2881
2861
|
const getNodeMoreLayoutDirection = (board, element) => {
|
|
2882
2862
|
const node = MindElement.getNode(element);
|
|
2883
|
-
const layout = MindQueries.
|
|
2863
|
+
const layout = MindQueries.getCorrectLayoutByElement(board, element);
|
|
2884
2864
|
const isHorizontal = isHorizontalLayout(layout);
|
|
2885
2865
|
let layoutDirection = getLayoutDirection(node, isHorizontal);
|
|
2886
2866
|
if (isIndentedLayout(layout)) {
|
|
@@ -2898,8 +2878,7 @@ const getNodeMoreStartPoint = (board, element, linkLineDirection, isLeft = false
|
|
|
2898
2878
|
}
|
|
2899
2879
|
transformPlacement(placement, linkLineDirection);
|
|
2900
2880
|
// underline shape and horizontal
|
|
2901
|
-
const
|
|
2902
|
-
const isHorizontal = isHorizontalLayout(layout);
|
|
2881
|
+
const isHorizontal = linkLineDirection === LayoutDirection.left || linkLineDirection === LayoutDirection.right;
|
|
2903
2882
|
if (isHorizontal && isUnderlineShape && !PlaitMind.isMind(element)) {
|
|
2904
2883
|
placement[1] = VerticalPlacement.bottom;
|
|
2905
2884
|
}
|
|
@@ -3032,7 +3011,7 @@ class MindNodeComponent extends CommonElementFlavour {
|
|
|
3032
3011
|
if (this.linkLineG) {
|
|
3033
3012
|
this.linkLineG.remove();
|
|
3034
3013
|
}
|
|
3035
|
-
const layout = MindQueries.
|
|
3014
|
+
const layout = MindQueries.getCorrectLayoutByElement(this.board, parent);
|
|
3036
3015
|
if (AbstractNode.isAbstract(this.node.origin)) {
|
|
3037
3016
|
this.linkLineG = drawAbstractLink(this.board, this.node, isHorizontalLayout(layout));
|
|
3038
3017
|
}
|
|
@@ -3293,7 +3272,7 @@ const withAbstract = (board) => {
|
|
|
3293
3272
|
const isHorizontal = isHorizontalLayout(nodeLayout);
|
|
3294
3273
|
const parentElement = MindElement.getParent(activeAbstractElement);
|
|
3295
3274
|
let children = parentElement.children;
|
|
3296
|
-
const parentLayout = MindQueries.
|
|
3275
|
+
const parentLayout = MindQueries.getCorrectLayoutByElement(board, parentElement);
|
|
3297
3276
|
if (isStandardLayout(parentLayout)) {
|
|
3298
3277
|
const rightNodeCount = parentElement.rightNodeCount;
|
|
3299
3278
|
const { leftChildren, rightChildren } = separateChildren(parentElement);
|