@plait/mind 0.2.2 → 0.3.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.
Files changed (130) hide show
  1. package/{drawer/base/base.d.ts → base/base.drawer.d.ts} +1 -1
  2. package/{plugins/emoji → base}/emoji-base.component.d.ts +2 -2
  3. package/{plugins/emoji → base}/index.d.ts +1 -1
  4. package/draw/abstract.d.ts +2 -1
  5. package/draw/indented-link.d.ts +1 -1
  6. package/draw/link/logic-link.d.ts +1 -1
  7. package/draw/node.d.ts +5 -0
  8. package/draw/topic.d.ts +16 -0
  9. package/{plugins/emoji → drawer}/emoji.drawer.d.ts +3 -3
  10. package/drawer/quick-insert.drawer.d.ts +1 -1
  11. package/esm2020/base/base.drawer.mjs +17 -0
  12. package/esm2020/base/emoji-base.component.mjs +33 -0
  13. package/esm2020/base/index.mjs +3 -0
  14. package/esm2020/draw/abstract.mjs +8 -7
  15. package/esm2020/draw/indented-link.mjs +3 -3
  16. package/esm2020/draw/link/abstract-link.mjs +9 -15
  17. package/esm2020/draw/link/logic-link.mjs +9 -9
  18. package/esm2020/draw/node.mjs +21 -0
  19. package/esm2020/draw/topic.mjs +32 -0
  20. package/esm2020/drawer/emoji.drawer.mjs +73 -0
  21. package/esm2020/drawer/quick-insert.drawer.mjs +3 -3
  22. package/esm2020/interfaces/index.mjs +2 -2
  23. package/esm2020/interfaces/pointer.mjs +5 -0
  24. package/esm2020/mind.component.mjs +2 -2
  25. package/esm2020/mind.module.mjs +5 -5
  26. package/esm2020/node.component.mjs +11 -10
  27. package/esm2020/plugins/with-abstract-resize.board.mjs +12 -0
  28. package/esm2020/plugins/with-abstract-resize.mjs +107 -0
  29. package/esm2020/plugins/with-mind-create.mjs +85 -0
  30. package/esm2020/plugins/with-mind-extend.mjs +11 -0
  31. package/esm2020/plugins/with-mind.board.mjs +2 -0
  32. package/esm2020/plugins/with-mind.mjs +30 -16
  33. package/esm2020/plugins/with-node-dnd.mjs +162 -0
  34. package/esm2020/public-api.mjs +5 -3
  35. package/esm2020/transforms/abstract-node.mjs +3 -2
  36. package/esm2020/transforms/emoji.mjs +37 -0
  37. package/esm2020/transforms/index.mjs +7 -3
  38. package/esm2020/transforms/node.mjs +40 -33
  39. package/esm2020/utils/abstract/common.mjs +64 -31
  40. package/esm2020/utils/abstract/resize.mjs +3 -2
  41. package/esm2020/utils/clipboard.mjs +16 -18
  42. package/esm2020/utils/dnd/common.mjs +35 -0
  43. package/esm2020/utils/dnd/detector.mjs +268 -0
  44. package/esm2020/utils/dnd/draw.mjs +161 -0
  45. package/esm2020/utils/index.mjs +6 -6
  46. package/esm2020/utils/mind.mjs +6 -129
  47. package/esm2020/utils/node/adjust-node.mjs +49 -0
  48. package/esm2020/utils/node/common.mjs +6 -0
  49. package/esm2020/utils/node/create-node.mjs +61 -0
  50. package/esm2020/utils/node/index.mjs +4 -0
  51. package/esm2020/utils/point-placement.mjs +22 -2
  52. package/esm2020/utils/position/emoji.mjs +31 -0
  53. package/esm2020/utils/position/index.mjs +4 -0
  54. package/esm2020/utils/position/node.mjs +34 -0
  55. package/esm2020/utils/position/topic.mjs +14 -0
  56. package/esm2020/utils/space/emoji.mjs +19 -0
  57. package/esm2020/utils/space/layout-options.mjs +72 -0
  58. package/esm2020/utils/space/node-space.mjs +77 -0
  59. package/fesm2015/plait-mind.mjs +1464 -1631
  60. package/fesm2015/plait-mind.mjs.map +1 -1
  61. package/fesm2020/plait-mind.mjs +1486 -1642
  62. package/fesm2020/plait-mind.mjs.map +1 -1
  63. package/interfaces/index.d.ts +1 -1
  64. package/interfaces/pointer.d.ts +3 -0
  65. package/mind.module.d.ts +2 -2
  66. package/node.component.d.ts +3 -3
  67. package/package.json +3 -3
  68. package/{interfaces/abstract.d.ts → plugins/with-abstract-resize.board.d.ts} +2 -2
  69. package/plugins/with-mind-create.d.ts +11 -0
  70. package/plugins/with-mind-extend.d.ts +3 -0
  71. package/plugins/{with-extend-mind.d.ts → with-mind.board.d.ts} +4 -4
  72. package/plugins/with-mind.d.ts +1 -1
  73. package/public-api.d.ts +4 -2
  74. package/styles/styles.scss +5 -2
  75. package/transforms/abstract-node.d.ts +1 -1
  76. package/transforms/emoji.d.ts +6 -0
  77. package/transforms/index.d.ts +3 -0
  78. package/transforms/node.d.ts +5 -5
  79. package/utils/abstract/common.d.ts +19 -4
  80. package/utils/abstract/resize.d.ts +2 -1
  81. package/utils/dnd/common.d.ts +7 -0
  82. package/utils/dnd/detector.d.ts +31 -0
  83. package/utils/dnd/draw.d.ts +9 -0
  84. package/utils/index.d.ts +5 -5
  85. package/utils/mind.d.ts +3 -22
  86. package/utils/node/adjust-node.d.ts +5 -0
  87. package/utils/{node.d.ts → node/common.d.ts} +1 -1
  88. package/utils/node/create-node.d.ts +14 -0
  89. package/utils/node/index.d.ts +3 -0
  90. package/utils/point-placement.d.ts +8 -1
  91. package/utils/position/emoji.d.ts +7 -0
  92. package/utils/position/index.d.ts +3 -0
  93. package/utils/position/node.d.ts +12 -0
  94. package/utils/position/topic.d.ts +16 -0
  95. package/utils/space/emoji.d.ts +7 -0
  96. package/{layout-option.d.ts → utils/space/layout-options.d.ts} +1 -1
  97. package/utils/{node-space.d.ts → space/node-space.d.ts} +4 -4
  98. package/draw/link.d.ts +0 -3
  99. package/draw/richtext.d.ts +0 -15
  100. package/draw/shape.d.ts +0 -3
  101. package/esm2020/draw/link.mjs +0 -160
  102. package/esm2020/draw/richtext.mjs +0 -39
  103. package/esm2020/draw/shape.mjs +0 -18
  104. package/esm2020/drawer/base/base.mjs +0 -17
  105. package/esm2020/interfaces/abstract.mjs +0 -12
  106. package/esm2020/layout-option.mjs +0 -72
  107. package/esm2020/plugins/emoji/emoji-base.component.mjs +0 -33
  108. package/esm2020/plugins/emoji/emoji.drawer.mjs +0 -72
  109. package/esm2020/plugins/emoji/emoji.mjs +0 -47
  110. package/esm2020/plugins/emoji/index.mjs +0 -3
  111. package/esm2020/plugins/with-abstract.mjs +0 -106
  112. package/esm2020/plugins/with-dnd.mjs +0 -179
  113. package/esm2020/plugins/with-extend-mind.mjs +0 -11
  114. package/esm2020/utils/direction-corrector.mjs +0 -54
  115. package/esm2020/utils/direction-detector.mjs +0 -56
  116. package/esm2020/utils/dnd.mjs +0 -122
  117. package/esm2020/utils/draw-placeholder.mjs +0 -313
  118. package/esm2020/utils/drop-target-corrector.mjs +0 -87
  119. package/esm2020/utils/graph.mjs +0 -24
  120. package/esm2020/utils/node-space.mjs +0 -77
  121. package/esm2020/utils/node.mjs +0 -6
  122. package/plugins/emoji/emoji.d.ts +0 -11
  123. package/utils/direction-corrector.d.ts +0 -4
  124. package/utils/direction-detector.d.ts +0 -9
  125. package/utils/dnd.d.ts +0 -16
  126. package/utils/draw-placeholder.d.ts +0 -42
  127. package/utils/drop-target-corrector.d.ts +0 -9
  128. package/utils/graph.d.ts +0 -5
  129. /package/plugins/{with-abstract.d.ts → with-abstract-resize.d.ts} +0 -0
  130. /package/plugins/{with-dnd.d.ts → with-node-dnd.d.ts} +0 -0
@@ -2,4 +2,4 @@ export * from './element';
2
2
  export * from './element-data';
3
3
  export * from './node';
4
4
  export * from './layout';
5
- export * from './abstract';
5
+ export * from './pointer';
@@ -0,0 +1,3 @@
1
+ export declare enum MindPointerType {
2
+ 'mind' = "mind"
3
+ }
package/mind.module.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import * as i1 from "./mind.component";
3
3
  import * as i2 from "./node.component";
4
- import * as i3 from "@angular/platform-browser";
4
+ import * as i3 from "@angular/common";
5
5
  import * as i4 from "@plait/richtext";
6
6
  import * as i5 from "@plait/core";
7
7
  export declare class MindModule {
8
8
  static ɵfac: i0.ɵɵFactoryDeclaration<MindModule, never>;
9
- static ɵmod: i0.ɵɵNgModuleDeclaration<MindModule, [typeof i1.PlaitMindComponent, typeof i2.MindNodeComponent], [typeof i3.BrowserModule, typeof i4.RichtextModule, typeof i5.PlaitModule], [typeof i1.PlaitMindComponent, typeof i2.MindNodeComponent]>;
9
+ static ɵmod: i0.ɵɵNgModuleDeclaration<MindModule, [typeof i1.PlaitMindComponent, typeof i2.MindNodeComponent], [typeof i3.CommonModule, typeof i4.RichtextModule, typeof i5.PlaitModule], [typeof i1.PlaitMindComponent, typeof i2.MindNodeComponent]>;
10
10
  static ɵinj: i0.ɵɵInjectorDeclaration<MindModule>;
11
11
  }
@@ -5,10 +5,10 @@ import { RoughSVG } from 'roughjs/bin/svg';
5
5
  import { Subject } from 'rxjs';
6
6
  import { MindElement } from './interfaces/element';
7
7
  import { MindNode } from './interfaces/node';
8
- import { EmojisDrawer } from './plugins/emoji/emoji.drawer';
9
- import { AbstractHandlePosition } from './interfaces';
8
+ import { EmojisDrawer } from './drawer/emoji.drawer';
10
9
  import { QuickInsertDrawer } from './drawer/quick-insert.drawer';
11
- import { PlaitMindBoard } from './plugins/with-extend-mind';
10
+ import { PlaitMindBoard } from './plugins/with-mind.board';
11
+ import { AbstractHandlePosition } from './plugins/with-abstract-resize.board';
12
12
  import * as i0 from "@angular/core";
13
13
  export declare class MindNodeComponent extends PlaitPluginElementComponent<MindElement, PlaitMindBoard> implements OnInit, OnDestroy, OnContextChanged<MindElement, PlaitMindBoard> {
14
14
  private viewContainerRef;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@plait/mind",
3
- "version": "0.2.2",
3
+ "version": "0.3.1",
4
4
  "peerDependencies": {
5
- "@angular/common": "^13.3.0",
6
- "@angular/core": "^13.3.0"
5
+ "@angular/common": "^15.2.2",
6
+ "@angular/core": "^15.2.2"
7
7
  },
8
8
  "dependencies": {
9
9
  "tslib": "^2.3.0"
@@ -1,5 +1,5 @@
1
1
  import { PlaitBoard } from '@plait/core';
2
- import { MindElement } from './element';
2
+ import { MindElement } from '../interfaces/element';
3
3
  import { AbstractNode } from '@plait/layouts';
4
4
  export declare enum AbstractHandlePosition {
5
5
  start = "start",
@@ -11,6 +11,6 @@ export declare enum AbstractResizeState {
11
11
  end = "end"
12
12
  }
13
13
  export interface PlaitAbstractBoard extends PlaitBoard {
14
- abstractResize?: (state: AbstractResizeState) => void;
14
+ onAbstractResize?: (state: AbstractResizeState) => void;
15
15
  }
16
16
  export type AbstractRefs = Map<MindElement, Pick<AbstractNode, 'start' | 'end'>>;
@@ -0,0 +1,11 @@
1
+ import { PlaitBoard } from '@plait/core';
2
+ import { PlaitMindBoard } from './with-mind.board';
3
+ import { ComponentRef } from '@angular/core';
4
+ import { PlaitRichtextComponent } from '@plait/richtext';
5
+ export interface FakeCreateNodeRef {
6
+ nodeG: SVGGElement;
7
+ instanceRef: ComponentRef<PlaitRichtextComponent>;
8
+ foreignObject: SVGForeignObjectElement;
9
+ topicG: SVGGElement;
10
+ }
11
+ export declare const withCreateMind: (board: PlaitBoard) => PlaitBoard & PlaitMindBoard;
@@ -0,0 +1,3 @@
1
+ import { PlaitBoard } from '@plait/core';
2
+ import { PlaitMindBoard } from './with-mind.board';
3
+ export declare const withMindExtend: (board: PlaitBoard) => PlaitBoard & PlaitMindBoard;
@@ -1,10 +1,10 @@
1
- import { ComponentType, PlaitBoard } from '@plait/core';
1
+ import { ComponentType } from '@plait/core';
2
2
  import { MindElement } from '../interfaces/element';
3
3
  import { EmojiItem } from '../interfaces/element-data';
4
- import { MindEmojiBaseComponent } from './emoji';
5
4
  import { MindOptions } from '../interfaces/options';
6
- export interface PlaitMindBoard extends PlaitBoard {
5
+ import { PlaitAbstractBoard } from './with-abstract-resize.board';
6
+ import { MindEmojiBaseComponent } from '../base/emoji-base.component';
7
+ export interface PlaitMindBoard extends PlaitAbstractBoard {
7
8
  drawEmoji: (emoji: EmojiItem, element: MindElement) => ComponentType<MindEmojiBaseComponent>;
8
9
  getMindOptions: () => MindOptions;
9
10
  }
10
- export declare const withExtendMind: (board: PlaitBoard) => PlaitBoard & PlaitMindBoard;
@@ -1,2 +1,2 @@
1
1
  import { PlaitBoard } from '@plait/core';
2
- export declare const withMind: (board: PlaitBoard) => PlaitBoard & import("./with-extend-mind").PlaitMindBoard;
2
+ export declare const withMind: (board: PlaitBoard) => PlaitBoard & import("@plait/mind").PlaitMindBoard;
package/public-api.d.ts CHANGED
@@ -4,8 +4,10 @@ export * from './mind.module';
4
4
  export * from './utils';
5
5
  export * from './interfaces';
6
6
  export * from './plugins/with-mind';
7
- export * from './plugins/with-extend-mind';
7
+ export * from './plugins/with-mind-extend';
8
8
  export * from './constants';
9
9
  export * from './queries/index';
10
10
  export * from './transforms/index';
11
- export * from './plugins/emoji';
11
+ export * from './base';
12
+ export * from './plugins/with-mind.board';
13
+ export * from './plugins/with-abstract-resize.board';
@@ -28,7 +28,7 @@ g[plait-mindmap='true'] {
28
28
  }
29
29
 
30
30
  .plait-board-container {
31
- &.focused:not(.selection-moving):not(.element-moving):not(.abstract-resizing-horizontal):not(.abstract-resizing-vertical) {
31
+ &.focused:not(.selection-moving):not(.element-moving):not(.abstract-resizing-horizontal):not(.abstract-resizing-vertical):not(.pointer-mind) {
32
32
  .extend {
33
33
  cursor: pointer;
34
34
  &:hover {
@@ -45,7 +45,7 @@ g[plait-mindmap='true'] {
45
45
  }
46
46
  }
47
47
 
48
- &.hand {
48
+ &.pointer-hand {
49
49
  svg {
50
50
  cursor: grab;
51
51
  }
@@ -110,6 +110,9 @@ g[plait-mindmap='true'] {
110
110
  &.dragging {
111
111
  cursor: pointer;
112
112
  opacity: 0.6;
113
+ .plait-richtext-container {
114
+ opacity: 0.6;
115
+ }
113
116
  }
114
117
  }
115
118
  }
@@ -1,5 +1,5 @@
1
1
  import { PlaitBoard, PlaitElement } from '@plait/core';
2
- import { AbstractRefs } from '../interfaces/abstract';
2
+ import { AbstractRefs } from '../plugins/with-abstract-resize.board';
3
3
  import { MindElement } from '../interfaces/element';
4
4
  export declare const setAbstractsByRefs: (board: PlaitBoard, abstractRefs: AbstractRefs) => void;
5
5
  export declare const setAbstractByStandardLayout: (board: PlaitBoard, element: MindElement) => void;
@@ -0,0 +1,6 @@
1
+ import { MindElement } from '../interfaces/element';
2
+ import { PlaitBoard } from '@plait/core';
3
+ import { EmojiData, EmojiItem } from '../interfaces/element-data';
4
+ export declare const addEmoji: (board: PlaitBoard, element: MindElement, emojiItem: EmojiItem) => void;
5
+ export declare const removeEmoji: (board: PlaitBoard, element: MindElement<EmojiData>, emojiItem: EmojiItem) => void;
6
+ export declare const replaceEmoji: (board: PlaitBoard, element: MindElement<EmojiData>, oldEmoji: EmojiItem, newEmoji: EmojiItem) => void;
@@ -8,4 +8,7 @@ export declare const MindTransforms: {
8
8
  insertAbstract: (board: import("@plait/core").PlaitBoard, elements: import("@plait/core").PlaitElement[]) => void;
9
9
  setAbstractsByRefs: (board: import("@plait/core").PlaitBoard, abstractRefs: import("@plait/mind").AbstractRefs) => void;
10
10
  setAbstractByStandardLayout: (board: import("@plait/core").PlaitBoard, element: import("@plait/mind").MindElement<import("@plait/mind").BaseData>) => void;
11
+ removeElements: (board: import("@plait/core").PlaitBoard, elements: import("@plait/mind").MindElement<import("@plait/mind").BaseData>[]) => void;
12
+ insertNodes: (board: import("@plait/core").PlaitBoard, elements: import("@plait/mind").MindElement<import("@plait/mind").BaseData>[], path: import("slate").Path) => void;
13
+ insertAbstractNodes: (board: import("@plait/core").PlaitBoard, validAbstractRefs: import("@plait/mind").AbstractRef[], elements: import("@plait/mind").MindElement<import("@plait/mind").BaseData>[], path: import("slate").Path) => void;
11
14
  };
@@ -1,9 +1,9 @@
1
- import { Element } from 'slate';
1
+ import { Element, Path } from 'slate';
2
2
  import { MindElement } from '../interfaces/element';
3
3
  import { PlaitBoard } from '@plait/core';
4
- import { EmojiData, EmojiItem } from '../interfaces/element-data';
4
+ import { AbstractRef } from '../utils/abstract/common';
5
5
  export declare const setTopic: (board: PlaitBoard, element: MindElement, topic: Element, width: number, height: number) => void;
6
6
  export declare const setTopicSize: (board: PlaitBoard, element: MindElement, width: number, height: number) => void;
7
- export declare const addEmoji: (board: PlaitBoard, element: MindElement, emojiItem: EmojiItem) => void;
8
- export declare const removeEmoji: (board: PlaitBoard, element: MindElement<EmojiData>, emojiItem: EmojiItem) => void;
9
- export declare const replaceEmoji: (board: PlaitBoard, element: MindElement<EmojiData>, oldEmoji: EmojiItem, newEmoji: EmojiItem) => void;
7
+ export declare const removeElements: (board: PlaitBoard, elements: MindElement[]) => void;
8
+ export declare const insertNodes: (board: PlaitBoard, elements: MindElement[], path: Path) => void;
9
+ export declare const insertAbstractNodes: (board: PlaitBoard, validAbstractRefs: AbstractRef[], elements: MindElement[], path: Path) => void;
@@ -7,8 +7,23 @@ export declare const separateChildren: (parentElement: MindElement) => {
7
7
  };
8
8
  export declare const isSetAbstract: (element: PlaitElement) => boolean;
9
9
  export declare const canSetAbstract: (element: PlaitElement) => boolean;
10
- export declare const getCorrespondingAbstract: (parent: MindElement, element: MindElement) => MindElement<import("@plait/mind").BaseData> | undefined;
11
- export declare const getBehindAbstracts: (parent: MindElement, element: MindElement) => MindElement<import("@plait/mind").BaseData>[];
10
+ export declare const getCorrespondingAbstract: (element: MindElement) => MindElement<import("@plait/mind").BaseData> | undefined;
11
+ export declare const getBehindAbstracts: (element: MindElement) => MindElement<import("@plait/mind").BaseData>[];
12
+ /**
13
+ * return corresponding abstract that is not child of elements
14
+ */
12
15
  export declare const getOverallAbstracts: (board: PlaitBoard, elements: MindElement[]) => (MindElement<import("@plait/mind").BaseData> & AbstractNode)[];
13
- export declare const insertElementHandleAbstract: (board: PlaitBoard, path: Path, isExtendPreviousNode?: boolean, abstractRefs?: Map<MindElement<import("@plait/mind").BaseData>, Pick<AbstractNode, "end" | "start">>) => Map<MindElement<import("@plait/mind").BaseData>, Pick<AbstractNode, "end" | "start">>;
14
- export declare const deleteElementHandleAbstract: (board: PlaitBoard, deletableElements: MindElement[], abstractRefs?: Map<MindElement<import("@plait/mind").BaseData>, Pick<AbstractNode, "end" | "start">>) => Map<MindElement<import("@plait/mind").BaseData>, Pick<AbstractNode, "end" | "start">>;
16
+ export interface AbstractRef {
17
+ abstract: MindElement & AbstractNode;
18
+ references: MindElement[];
19
+ }
20
+ /**
21
+ * abstract node is valid when elements contains at least one element it is referenced with
22
+ */
23
+ export declare const getValidAbstractRefs: (board: PlaitBoard, elements: MindElement[]) => AbstractRef[];
24
+ export declare function getRelativeStartEndByAbstractRef(abstractRef: AbstractRef, elements: MindElement[]): {
25
+ start: number;
26
+ end: number;
27
+ };
28
+ export declare const insertElementHandleAbstract: (board: PlaitBoard, path: Path, step?: number, isExtendPreviousNode?: boolean, effectedAbstracts?: Map<MindElement<import("@plait/mind").BaseData>, Pick<AbstractNode, "end" | "start">>) => Map<MindElement<import("@plait/mind").BaseData>, Pick<AbstractNode, "end" | "start">>;
29
+ export declare const deleteElementHandleAbstract: (board: PlaitBoard, deletableElements: MindElement[], effectedAbstracts?: Map<MindElement<import("@plait/mind").BaseData>, Pick<AbstractNode, "end" | "start">>) => Map<MindElement<import("@plait/mind").BaseData>, Pick<AbstractNode, "end" | "start">>;
@@ -1,6 +1,7 @@
1
1
  import { PlaitBoard, PlaitElement, Point, RectangleClient } from '@plait/core';
2
- import { AbstractHandlePosition, MindElement } from '../../interfaces';
2
+ import { MindElement } from '../../interfaces';
3
3
  import { LayoutNode } from '@plait/layouts';
4
+ import { AbstractHandlePosition } from '../../plugins/with-abstract-resize.board';
4
5
  export declare const getRectangleByResizingLocation: (abstractRectangle: RectangleClient, location: number, activeHandlePosition: AbstractHandlePosition, isHorizontal: boolean) => {
5
6
  y: number;
6
7
  height: number;
@@ -0,0 +1,7 @@
1
+ import { MindElement } from '../../interfaces/element';
2
+ import { PlaitBoard } from '@plait/core';
3
+ export declare const IS_DRAGGING: WeakMap<PlaitBoard, boolean>;
4
+ export declare const addActiveOnDragOrigin: (activeElement: MindElement, isOrigin?: boolean) => void;
5
+ export declare const removeActiveOnDragOrigin: (activeElement: MindElement, isOrigin?: boolean) => void;
6
+ export declare const isDragging: (board: PlaitBoard) => boolean;
7
+ export declare const setIsDragging: (board: PlaitBoard, state: boolean) => void;
@@ -0,0 +1,31 @@
1
+ import { MindElement } from '../../interfaces/element';
2
+ import { PlaitBoard, Point, Path } from '@plait/core';
3
+ import { DetectResult, MindNode } from '../../interfaces/node';
4
+ /**
5
+ *
6
+ * @param targetNode
7
+ * @param centerPoint
8
+ * @returns DetectResult[] | null
9
+ */
10
+ export declare const directionCorrector: (board: PlaitBoard, node: MindNode, detectResults: DetectResult[]) => DetectResult[] | null;
11
+ export declare const getAllowedDirection: (detectResults: DetectResult[], illegalDirections: DetectResult[]) => DetectResult[] | null;
12
+ export declare const detectDropTarget: (board: PlaitBoard, detectPoint: Point, dropTarget: {
13
+ target: MindElement;
14
+ detectResult: DetectResult;
15
+ } | null, activeElements: MindElement[]) => {
16
+ target: MindElement;
17
+ detectResult: DetectResult;
18
+ } | null;
19
+ export declare const directionDetector: (targetNode: MindNode, centerPoint: Point) => DetectResult[] | null;
20
+ export declare const readjustmentDropTarget: (board: PlaitBoard, dropTarget: {
21
+ target: MindElement;
22
+ detectResult: DetectResult;
23
+ }) => {
24
+ target: MindElement;
25
+ detectResult: DetectResult;
26
+ };
27
+ export declare const isValidTarget: (origin: MindElement, target: MindElement) => boolean;
28
+ export declare const getPathByDropTarget: (board: PlaitBoard, dropTarget: {
29
+ target: MindElement;
30
+ detectResult: DetectResult;
31
+ }) => Path;
@@ -0,0 +1,9 @@
1
+ import { MindElement } from '../../interfaces';
2
+ import { MindNodeComponent } from '../../node.component';
3
+ import { PlaitBoard, Path } from '@plait/core';
4
+ export declare const drawFakeDragNode: (board: PlaitBoard, activeComponent: MindNodeComponent, offsetX: number, offsetY: number) => SVGGElement;
5
+ export declare const drawFakeDropNodeByPath: (board: PlaitBoard, target: MindElement, path: Path) => SVGGElement;
6
+ export declare const getPreviousAndNextByPath: (parent: MindElement, target: MindElement, path: Path) => {
7
+ hasPreviousNode: boolean;
8
+ hasNextNode: boolean;
9
+ };
package/utils/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- export * from './graph';
1
+ export * from './position';
2
2
  export * from './weak-maps';
3
3
  export * from './mind';
4
4
  export * from './layout';
5
+ export * from './node';
5
6
  export * from './node-style';
6
7
  export * from './is-virtual-key';
7
- export * from './draw-placeholder';
8
- export * from './direction-detector';
9
- export * from './direction-corrector';
10
- export * from './drop-target-corrector';
8
+ export * from './dnd/common';
9
+ export * from './dnd/detector';
10
+ export * from './dnd/draw';
11
11
  export * from './abstract/common';
12
12
  export * from './abstract/resize';
package/utils/mind.d.ts CHANGED
@@ -1,36 +1,17 @@
1
- import { MindLayoutType } from '@plait/layouts';
2
- import { Path, PlaitBoard, Point } from '@plait/core';
3
- import { MindElementShape, MindNode } from '../interfaces';
1
+ import { Path, PlaitBoard } from '@plait/core';
2
+ import { MindNode } from '../interfaces';
4
3
  import { MindElement } from '../interfaces/element';
5
- export declare function findUpElement(element: MindElement): {
6
- root: MindElement;
7
- branch?: MindElement;
8
- };
9
4
  export declare const getChildrenCount: (element: MindElement) => number;
10
5
  export declare const isChildElement: (origin: MindElement, child: MindElement) => boolean;
11
6
  export declare const getFirstLevelElement: (elements: MindElement[]) => MindElement<import("../interfaces").BaseData>[];
12
7
  export declare const isChildRight: (node: MindNode, child: MindNode) => boolean;
13
8
  export declare const isChildUp: (node: MindNode, child: MindNode) => boolean;
14
9
  export declare const copyNewNode: (node: MindElement) => MindElement<import("../interfaces").BaseData>;
15
- export declare const transformRootToNode: (board: PlaitBoard, node: MindElement) => MindElement<import("../interfaces").BaseData>;
16
- export declare const transformAbstractToNode: (node: MindElement) => MindElement<import("../interfaces").BaseData>;
17
- export declare const transformNodeToRoot: (board: PlaitBoard, node: MindElement) => MindElement;
18
10
  export declare const extractNodesText: (node: MindElement) => string;
19
11
  export declare const changeRightNodeCount: (board: PlaitBoard, parentPath: Path, changeNumber: number) => void;
20
- export declare const shouldChangeRightNodeCount: (selectedElement: MindElement) => boolean;
21
- export declare const createDefaultMindMapElement: (point: Point, rightNodeCount: number, layout: MindLayoutType) => MindElement<import("../interfaces").BaseData>;
22
- export declare const createMindElement: (text: string, width: number, height: number, options: {
23
- fill?: string;
24
- strokeColor?: string;
25
- strokeWidth?: number;
26
- shape?: MindElementShape;
27
- layout?: MindLayoutType;
28
- branchColor?: string;
29
- branchWidth?: number;
30
- }) => MindElement<import("../interfaces").BaseData>;
12
+ export declare const isInRightBranchOfStandardLayout: (selectedElement: MindElement) => boolean;
31
13
  export declare const insertMindElement: (board: PlaitBoard, inheritNode: MindElement, path: Path) => void;
32
14
  export declare const findLastChild: (child: MindNode) => MindNode;
33
- export declare const deleteSelectedELements: (board: PlaitBoard, selectedElements: MindElement[]) => void;
34
15
  export declare const divideElementByParent: (elements: MindElement[]) => {
35
16
  parentElements: MindElement<import("../interfaces").BaseData>[];
36
17
  abstractIncludedGroups: MindElement<import("../interfaces").BaseData>[][];
@@ -0,0 +1,5 @@
1
+ import { PlaitBoard } from '@plait/core';
2
+ import { MindElement } from '../../interfaces/element';
3
+ export declare const adjustRootToNode: (board: PlaitBoard, node: MindElement) => MindElement<import("@plait/mind").BaseData>;
4
+ export declare const adjustAbstractToNode: (node: MindElement) => MindElement<import("@plait/mind").BaseData>;
5
+ export declare const adjustNodeToRoot: (board: PlaitBoard, node: MindElement) => MindElement;
@@ -1,2 +1,2 @@
1
- import { MindElement } from '../interfaces/element';
1
+ import { MindElement } from '../../interfaces/element';
2
2
  export declare function enterNodeEditing(element: MindElement): void;
@@ -0,0 +1,14 @@
1
+ import { PlaitBoard, Point } from '@plait/core';
2
+ import { MindLayoutType } from '@plait/layouts';
3
+ import { MindElement, MindElementShape } from '../../interfaces/element';
4
+ export declare const createEmptyMind: (board: PlaitBoard, point: Point) => MindElement<import("@plait/mind").BaseData>;
5
+ export declare const createDefaultMind: (point: Point, rightNodeCount: number, layout: MindLayoutType) => MindElement<import("@plait/mind").BaseData>;
6
+ export declare const createMindElement: (text: string, width: number, height: number, options: {
7
+ fill?: string;
8
+ strokeColor?: string;
9
+ strokeWidth?: number;
10
+ shape?: MindElementShape;
11
+ layout?: MindLayoutType;
12
+ branchColor?: string;
13
+ branchWidth?: number;
14
+ }) => MindElement<import("@plait/mind").BaseData>;
@@ -0,0 +1,3 @@
1
+ export * from './adjust-node';
2
+ export * from './create-node';
3
+ export * from './common';
@@ -3,6 +3,13 @@ import { MindNode } from '../interfaces/node';
3
3
  import { LayoutDirection } from '../interfaces/layout';
4
4
  import { PointPlacement } from '../interfaces/types';
5
5
  export declare const getPointByPlacement: (client: RectangleClient, placement: PointPlacement) => Point;
6
+ export interface PlacementRef {
7
+ placement: PointPlacement;
8
+ client: RectangleClient;
9
+ }
10
+ export declare const getXDistanceBetweenPoint: (point1: Point, point2: Point, isHorizontalLayout: boolean) => number;
11
+ export declare const getYDistanceBetweenPoint: (point1: Point, point2: Point, isHorizontalLayout: boolean) => void;
6
12
  export declare const getLayoutDirection: (node: MindNode, isHorizontal: boolean) => LayoutDirection;
7
- export declare const movePoint: (point: Point, distance: number, direction?: LayoutDirection) => Point;
13
+ export declare const moveXOfPoint: (point: Point, distance: number, direction?: LayoutDirection) => Point;
14
+ export declare const moveYOfPoint: (point: Point, distance: number, direction?: LayoutDirection) => Point;
8
15
  export declare const transformPlacement: (placement: PointPlacement, direction: LayoutDirection) => void;
@@ -0,0 +1,7 @@
1
+ import { PlaitBoard, Point, RectangleClient } from "@plait/core";
2
+ import { MindElement } from "../../interfaces/element";
3
+ import { EmojiData } from "../../interfaces/element-data";
4
+ import { PlaitMindBoard } from "../../plugins/with-mind.board";
5
+ export declare function getEmojiRectangle(board: PlaitMindBoard, element: MindElement<EmojiData>): RectangleClient;
6
+ export declare function getEmojiForeignRectangle(board: PlaitMindBoard, element: MindElement<EmojiData>): RectangleClient;
7
+ export declare const isHitEmojis: (board: PlaitBoard, element: MindElement<EmojiData>, point: Point) => boolean;
@@ -0,0 +1,3 @@
1
+ export * from './node';
2
+ export * from './emoji';
3
+ export * from './topic';
@@ -0,0 +1,12 @@
1
+ import { PlaitBoard, Point, RectangleClient } from '@plait/core';
2
+ import { MindNode } from '../../interfaces/node';
3
+ import { MindElement } from '../../interfaces/element';
4
+ import { PlaitMindBoard } from '../../plugins/with-mind.board';
5
+ export declare function getRectangleByNode(node: MindNode): RectangleClient;
6
+ export declare function getRectangleByElement(board: PlaitMindBoard, originPoint: Point, element: MindElement): {
7
+ x: number;
8
+ y: number;
9
+ width: number;
10
+ height: number;
11
+ };
12
+ export declare function isHitMindElement(board: PlaitBoard, point: Point, element: MindElement): boolean;
@@ -0,0 +1,16 @@
1
+ import { MindElement } from '../../interfaces/element';
2
+ import { MindNode } from '../../interfaces/node';
3
+ import { PlaitMindBoard } from '../../plugins/with-mind.board';
4
+ import { RectangleClient } from '@plait/core';
5
+ export declare function getTopicRectangleByNode(board: PlaitMindBoard, node: MindNode): {
6
+ height: number;
7
+ width: number;
8
+ x: number;
9
+ y: number;
10
+ };
11
+ export declare function getTopicRectangleByElement(board: PlaitMindBoard, nodeRectangle: RectangleClient, element: MindElement): {
12
+ height: number;
13
+ width: number;
14
+ x: number;
15
+ y: number;
16
+ };
@@ -0,0 +1,7 @@
1
+ import { EmojiData, MindElement } from '../../interfaces';
2
+ import { PlaitMindBoard } from '../../plugins/with-mind.board';
3
+ export declare function getEmojisWidthHeight(board: PlaitMindBoard, element: MindElement<EmojiData>): {
4
+ width: number;
5
+ height: number;
6
+ };
7
+ export declare function getEmojiFontSize(element: MindElement<EmojiData>): number;
@@ -1,3 +1,3 @@
1
1
  import { LayoutOptions } from "@plait/layouts";
2
- import { PlaitMindBoard } from "./plugins/with-extend-mind";
2
+ import { PlaitMindBoard } from "../../plugins/with-mind.board";
3
3
  export declare const getLayoutOptions: (board: PlaitMindBoard) => LayoutOptions;
@@ -1,9 +1,9 @@
1
- import { MindElement } from '../interfaces/element';
2
- import { PlaitMindBoard } from '../plugins/with-extend-mind';
3
- import { EmojiData } from '../interfaces/element-data';
1
+ import { MindElement } from '../../interfaces/element';
2
+ import { EmojiData } from '../../interfaces/element-data';
3
+ import { PlaitMindBoard } from '../../plugins/with-mind.board';
4
4
  export declare const NodeSpace: {
5
5
  getNodeWidth(board: PlaitMindBoard, element: MindElement): number;
6
- getNodeHeight(element: MindElement): number;
6
+ getNodeHeight(board: PlaitMindBoard, element: MindElement): number;
7
7
  getTextLeftSpace(board: PlaitMindBoard, element: MindElement): number;
8
8
  getTextTopSpace(element: MindElement): number;
9
9
  getEmojiLeftSpace(board: PlaitMindBoard, element: MindElement<EmojiData>): number;
package/draw/link.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { MindNode } from '../interfaces/node';
2
- import { PlaitBoard } from '@plait/core';
3
- export declare function drawLink(board: PlaitBoard, node: MindNode, child: MindNode, defaultStroke?: string | null, isHorizontal?: boolean, needDrawUnderline?: boolean): SVGGElement;
@@ -1,15 +0,0 @@
1
- import { ViewContainerRef } from '@angular/core';
2
- import { MindNode } from '../interfaces/node';
3
- import { PlaitMindBoard } from '../plugins/with-extend-mind';
4
- export declare function drawMindNodeRichtext(board: PlaitMindBoard, node: MindNode, viewContainerRef: ViewContainerRef): {
5
- richtextComponentRef: import("@angular/core").ComponentRef<import("@plait/richtext").PlaitRichtextComponent>;
6
- richtextG: SVGGElement;
7
- foreignObject: SVGForeignObjectElement;
8
- };
9
- export declare function updateMindNodeTopicSize(board: PlaitMindBoard, node: MindNode, g: SVGGElement, isEditable: boolean): void;
10
- export declare function getRichtextRectangleByNode(board: PlaitMindBoard, node: MindNode): {
11
- height: number;
12
- width: number;
13
- x: number;
14
- y: number;
15
- };
package/draw/shape.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { MindNode } from '../interfaces/node';
2
- import { PlaitBoard } from '@plait/core';
3
- export declare function drawRectangleNode(board: PlaitBoard, node: MindNode): SVGGElement;