@plait/mind 0.84.0 → 0.85.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.
@@ -2,13 +2,9 @@ import { MindLayoutType } from '@plait/layouts';
2
2
  import { PlaitBoard, PlaitElement, Point } from '@plait/core';
3
3
  import { BaseData, EmojiData, ImageData } from './element-data';
4
4
  import { StrokeStyle } from '@plait/common';
5
- export interface MindElement<T = BaseData> extends PlaitElement {
6
- data: T;
7
- children: MindElement[];
5
+ export interface BaseMindElement extends PlaitElement {
8
6
  rightNodeCount?: number;
9
- width: number;
10
7
  manualWidth?: number;
11
- height: number;
12
8
  isRoot?: boolean;
13
9
  fill?: string;
14
10
  strokeColor?: string;
@@ -23,8 +19,13 @@ export interface MindElement<T = BaseData> extends PlaitElement {
23
19
  start?: number;
24
20
  end?: number;
25
21
  }
26
- export interface PlaitMind extends MindElement {
27
- type: 'mindmap';
22
+ export interface MindElement<T = BaseData> extends BaseMindElement {
23
+ type: 'mind_child' | 'mind' | 'mindmap';
24
+ children: MindElement[];
25
+ data: T;
26
+ }
27
+ export interface PlaitMind<T = BaseData> extends MindElement<T> {
28
+ type: 'mind' | 'mindmap';
28
29
  points: Point[];
29
30
  }
30
31
  export declare const PlaitMind: {
@@ -33,7 +34,7 @@ export declare const PlaitMind: {
33
34
  export declare const MindElement: {
34
35
  hasLayout(value: MindElement, layout: MindLayoutType): boolean;
35
36
  isIndentedLayout(value: MindElement): boolean;
36
- isMindElement(board: PlaitBoard, element: PlaitElement): element is MindElement;
37
+ isMindElement(board: PlaitBoard | null, element: PlaitElement): element is MindElement;
37
38
  getParent(node: MindElement): MindElement<BaseData>;
38
39
  findParent(node: MindElement): MindElement<BaseData> | undefined;
39
40
  getRoot(board: PlaitBoard, element: MindElement): PlaitMind;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plait/mind",
3
- "version": "0.84.0",
3
+ "version": "0.85.0",
4
4
  "peerDependencies": {},
5
5
  "dependencies": {
6
6
  "tslib": "^2.3.0"
@@ -4,9 +4,8 @@ export declare const MindTransforms: {
4
4
  setBranchShape: (board: import("@plait/core").PlaitBoard, branchShape: import("@plait/mind").BranchShape) => void;
5
5
  setBranchWidth: (board: import("@plait/core").PlaitBoard, branchWidth: number) => void;
6
6
  setBranchColor: (board: import("@plait/core").PlaitBoard, branchColor: string) => void;
7
- setTopic: (board: import("@plait/mind").PlaitMindBoard, element: import("@plait/mind").MindElement, topic: import("slate").Element, width: number, height: number) => void;
8
- setTopicSize: (board: import("@plait/mind").PlaitMindBoard, element: import("@plait/mind").MindElement, width: number, height: number) => void;
9
- setNodeManualWidth: (board: import("@plait/mind").PlaitMindBoard, element: import("@plait/mind").MindElement, width: number, height: number) => void;
7
+ setTopic: (board: import("@plait/mind").PlaitMindBoard, element: import("@plait/mind").MindElement, topic?: import("slate").Element) => void;
8
+ setNodeManualWidth: (board: import("@plait/mind").PlaitMindBoard, element: import("@plait/mind").MindElement, width: number) => void;
10
9
  addEmoji: (board: import("@plait/core").PlaitBoard, element: import("@plait/mind").MindElement, emojiItem: import("@plait/mind").EmojiItem) => void;
11
10
  removeEmoji: (board: import("@plait/core").PlaitBoard, element: import("@plait/mind").MindElement<import("@plait/mind").EmojiData>, emojiItem: import("@plait/mind").EmojiItem) => void;
12
11
  replaceEmoji: (board: import("@plait/core").PlaitBoard, element: import("@plait/mind").MindElement<import("@plait/mind").EmojiData>, oldEmoji: import("@plait/mind").EmojiItem, newEmoji: import("@plait/mind").EmojiItem) => void;
@@ -4,9 +4,8 @@ import { PlaitBoard } from '@plait/core';
4
4
  import { AbstractRef } from '../utils/abstract/common';
5
5
  import { RightNodeCountRef } from '../utils/node/right-node-count';
6
6
  import { PlaitMindBoard } from '../plugins/with-mind.board';
7
- export declare const setTopic: (board: PlaitMindBoard, element: MindElement, topic: Element, width: number, height: number) => void;
8
- export declare const setNodeManualWidth: (board: PlaitMindBoard, element: MindElement, width: number, height: number) => void;
9
- export declare const setTopicSize: (board: PlaitMindBoard, element: MindElement, width: number, height: number) => void;
7
+ export declare const setTopic: (board: PlaitMindBoard, element: MindElement, topic?: Element) => void;
8
+ export declare const setNodeManualWidth: (board: PlaitMindBoard, element: MindElement, width: number) => void;
10
9
  export declare const insertNodes: (board: PlaitBoard, elements: MindElement[], path: Path) => void;
11
10
  export declare const insertAbstractNodes: (board: PlaitBoard, validAbstractRefs: AbstractRef[], elements: MindElement[], path: Path) => void;
12
11
  export declare const setRightNodeCountByRefs: (board: PlaitBoard, refs: RightNodeCountRef[]) => void;
@@ -5,7 +5,3 @@ import { PlaitMindBoard } from '../plugins/with-mind.board';
5
5
  export declare const buildClipboardData: (board: PlaitBoard, selectedElements: MindElement[], startPoint: Point) => MindElement<import("../interfaces").BaseData>[];
6
6
  export declare const insertClipboardData: (board: PlaitMindBoard, elements: PlaitElement[], targetPoint: Point, operationType?: WritableClipboardOperationType) => void;
7
7
  export declare const insertClipboardText: (board: PlaitMindBoard, targetParent: PlaitElement, text: string | Element) => void;
8
- export declare const getTopicSizeByElement: (board: PlaitBoard, element: MindElement, parentElement?: MindElement) => {
9
- width: number;
10
- height: number;
11
- };
package/utils/common.d.ts CHANGED
@@ -1,10 +1,5 @@
1
1
  import { PlaitBoard } from '@plait/core';
2
- import { ParagraphElement } from '@plait/common';
3
2
  export declare const MIND_CENTRAL_TEXT = "\u4E2D\u5FC3\u4E3B\u9898";
4
3
  export declare const ABSTRACT_NODE_TEXT = "\u6982\u8981";
5
4
  export declare const getDefaultMindNameText: (board: PlaitBoard) => string;
6
5
  export declare const getAbstractNodeText: (board: PlaitBoard) => string;
7
- export declare const getTopicSize: (board: PlaitBoard | null, isRoot: boolean, isBranch: boolean, topic: ParagraphElement, manualWidth?: number) => {
8
- width: number;
9
- height: number;
10
- };
package/utils/mind.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Path, PlaitBoard } from '@plait/core';
1
+ import { Path } from '@plait/core';
2
2
  import { MindElement } from '../interfaces/element';
3
3
  import { MindNode } from '../interfaces/node';
4
4
  import { PlaitMindBoard } from '../plugins/with-mind.board';
@@ -14,4 +14,4 @@ export declare const divideElementByParent: (elements: MindElement[]) => {
14
14
  parentElements: MindElement<import("@plait/mind").BaseData>[];
15
15
  abstractIncludedGroups: MindElement<import("@plait/mind").BaseData>[][];
16
16
  };
17
- export declare const getDefaultMindElementFontSize: (board: PlaitBoard, element: MindElement) => 18 | 14;
17
+ export declare const getDefaultFontSizeForMindElement: (element: MindElement) => 18 | 14;
@@ -3,7 +3,7 @@ import { MindLayoutType } from '@plait/layouts';
3
3
  import { BranchShape, MindElement, MindElementShape } from '../../interfaces/element';
4
4
  import { Element } from 'slate';
5
5
  export declare const createEmptyMind: (board: PlaitBoard, point: Point) => MindElement<import("@plait/mind").BaseData>;
6
- export declare const createMindElement: (text: string | Element, width: number, height: number, options: InheritAttribute) => MindElement<import("@plait/mind").BaseData>;
6
+ export declare const createMindElement: (text: string | Element, options: InheritAttribute) => MindElement<import("@plait/mind").BaseData>;
7
7
  export interface InheritAttribute {
8
8
  fill?: string;
9
9
  strokeColor?: string;
@@ -1,5 +1,3 @@
1
1
  import { MindElement } from '../interfaces/element';
2
2
  export declare const isNormalizedData: (element: MindElement) => boolean;
3
- export declare const isNormalizedWidthAndHeight: (element: MindElement) => boolean;
4
3
  export declare const fixMindElementData: (element: MindElement) => void;
5
- export declare const fixMindElementWidthAndHeight: (element: MindElement) => void;
@@ -2,6 +2,6 @@ import { EmojiData, MindElement } from '../../interfaces';
2
2
  import { PlaitMindBoard } from '../../plugins/with-mind.board';
3
3
  export declare function getEmojisWidthHeight(board: PlaitMindBoard, element: MindElement<EmojiData>): {
4
4
  width: number;
5
- height: number;
5
+ height: any;
6
6
  };
7
7
  export declare function getEmojiFontSize(element: MindElement<EmojiData>): number;
@@ -1,17 +1,13 @@
1
1
  import { MindElement } from '../../interfaces/element';
2
2
  import { EmojiData } from '../../interfaces/element-data';
3
3
  import { PlaitMindBoard } from '../../plugins/with-mind.board';
4
- import { Element } from 'slate';
4
+ import { PlaitBoard } from '@plait/core';
5
5
  export declare const NodeSpace: {
6
6
  getNodeWidth(board: PlaitMindBoard, element: MindElement): number;
7
7
  getNodeHeight(board: PlaitMindBoard, element: MindElement): number;
8
8
  getTopicDynamicWidth(board: PlaitMindBoard, element: MindElement): number;
9
9
  getTopicHeight(board: PlaitMindBoard, element: MindElement): number;
10
10
  getTopicMaxDynamicWidth(board: PlaitMindBoard, element: MindElement): number;
11
- /**
12
- * use it when upload image first or resize image
13
- */
14
- getNodeNewDynamicWidth(board: PlaitMindBoard, element: MindElement, imageWidth: number): number;
15
11
  getNodeResizableMinWidth(board: PlaitMindBoard, element: MindElement): number;
16
12
  getNodeTopicMinWidth(board: PlaitMindBoard, element: MindElement): number;
17
13
  getTextLeftSpace(board: PlaitMindBoard, element: MindElement): number;
@@ -20,7 +16,7 @@ export declare const NodeSpace: {
20
16
  getEmojiLeftSpace(board: PlaitMindBoard, element: MindElement<EmojiData>): number;
21
17
  getEmojiTopSpace(board: PlaitMindBoard, element: MindElement): number;
22
18
  };
23
- export declare const getFontSizeBySlateElement: (text: string | Element) => number;
19
+ export declare const getFontSizeByMindElement: (board: PlaitBoard, element: MindElement) => number;
24
20
  export declare const normalizeWidthAndHeight: (board: PlaitMindBoard, element: MindElement, width: number, height: number) => {
25
21
  width: number;
26
22
  height: number;
@@ -1,3 +1,3 @@
1
1
  import { MindElement } from '../interfaces/element';
2
2
  import { MindNode } from '../interfaces/node';
3
- export declare const ELEMENT_TO_NODE: WeakMap<MindElement<import("@plait/mind").BaseData>, MindNode>;
3
+ export declare const MIND_ELEMENT_TO_NODE: WeakMap<MindElement<import("@plait/mind").BaseData>, MindNode>;