@plait/draw 0.62.0-next.7 → 0.62.0-next.9

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 (34) hide show
  1. package/constants/geometry.d.ts +1 -0
  2. package/esm2022/constants/geometry.mjs +8 -1
  3. package/esm2022/engines/basic-shapes/ellipse.mjs +5 -3
  4. package/esm2022/engines/basic-shapes/round-comment.mjs +5 -3
  5. package/esm2022/engines/flowchart/or.mjs +5 -3
  6. package/esm2022/engines/flowchart/summing-junction.mjs +5 -3
  7. package/esm2022/engines/table/table.mjs +48 -26
  8. package/esm2022/engines/uml/deletion.mjs +3 -2
  9. package/esm2022/plugins/with-swimlane-create.mjs +4 -7
  10. package/esm2022/plugins/with-table.mjs +15 -6
  11. package/esm2022/transforms/arrow-line.mjs +5 -39
  12. package/esm2022/transforms/common.mjs +36 -0
  13. package/esm2022/transforms/geometry.mjs +4 -26
  14. package/esm2022/transforms/index.mjs +7 -6
  15. package/esm2022/transforms/swimlane.mjs +1 -1
  16. package/esm2022/utils/arrow-line/arrow-line-common.mjs +38 -3
  17. package/esm2022/utils/common.mjs +12 -3
  18. package/esm2022/utils/geometry.mjs +5 -2
  19. package/esm2022/utils/style/stroke.mjs +6 -4
  20. package/esm2022/utils/swimlane.mjs +6 -3
  21. package/esm2022/utils/table.mjs +13 -5
  22. package/fesm2022/plait-draw.mjs +246 -165
  23. package/fesm2022/plait-draw.mjs.map +1 -1
  24. package/package.json +12 -4
  25. package/transforms/arrow-line.d.ts +2 -6
  26. package/transforms/common.d.ts +3 -0
  27. package/transforms/geometry.d.ts +1 -2
  28. package/transforms/index.d.ts +2 -2
  29. package/utils/arrow-line/arrow-line-common.d.ts +5 -1
  30. package/utils/clipboard.d.ts +1 -1
  31. package/utils/common.d.ts +1 -0
  32. package/utils/geometry.d.ts +17 -16
  33. package/utils/hit.d.ts +1 -1
  34. package/utils/swimlane.d.ts +2 -1
package/package.json CHANGED
@@ -1,12 +1,20 @@
1
1
  {
2
2
  "name": "@plait/draw",
3
- "version": "0.62.0-next.7",
4
- "peerDependencies": {
5
- "is-hotkey": "^0.2.0"
6
- },
3
+ "version": "0.62.0-next.9",
4
+ "peerDependencies": {},
7
5
  "dependencies": {
8
6
  "tslib": "^2.3.0"
9
7
  },
8
+ "license": "MIT",
9
+ "repository": "https://github.com/worktile/plait",
10
+ "keywords": [
11
+ "drawing",
12
+ "draw",
13
+ "diagram",
14
+ "flow chart",
15
+ "whiteboard",
16
+ "open-source"
17
+ ],
10
18
  "module": "fesm2022/plait-draw.mjs",
11
19
  "typings": "index.d.ts",
12
20
  "exports": {
@@ -1,12 +1,8 @@
1
1
  import { Path, PlaitBoard } from '@plait/core';
2
- import { ArrowLineHandleKey, ArrowLineMarkerType, ArrowLineText, PlaitArrowLine, PlaitGeometry } from '../interfaces';
2
+ import { ArrowLineHandleKey, ArrowLineMarkerType, ArrowLineText, PlaitArrowLine, PlaitShapeElement } from '../interfaces';
3
3
  export declare const resizeArrowLine: (board: PlaitBoard, options: Partial<PlaitArrowLine>, path: Path) => void;
4
4
  export declare const setArrowLineTexts: (board: PlaitBoard, element: PlaitArrowLine, texts: ArrowLineText[]) => void;
5
5
  export declare const removeArrowLineText: (board: PlaitBoard, element: PlaitArrowLine, index: number) => void;
6
6
  export declare const setArrowLineMark: (board: PlaitBoard, handleKey: ArrowLineHandleKey, marker: ArrowLineMarkerType) => void;
7
7
  export declare const setArrowLineShape: (board: PlaitBoard, newProperties: Partial<PlaitArrowLine>) => void;
8
- export declare const collectArrowLineUpdatedRefsByGeometry: (board: PlaitBoard, geometry: PlaitGeometry, refs: {
9
- property: Partial<PlaitArrowLine>;
10
- path: Path;
11
- }[]) => void;
12
- export declare const connectArrowLineToGeometry: (board: PlaitBoard, lineElement: PlaitArrowLine, handle: ArrowLineHandleKey, geometryElement: PlaitGeometry) => void;
8
+ export declare const connectArrowLineToDraw: (board: PlaitBoard, lineElement: PlaitArrowLine, handle: ArrowLineHandleKey, geometryElement: PlaitShapeElement) => void;
@@ -0,0 +1,3 @@
1
+ import { PlaitBoard, Vector, Point } from '@plait/core';
2
+ import { GeometryShapes, SwimlaneDrawSymbols } from '../interfaces';
3
+ export declare const insertDrawByVector: (board: PlaitBoard, point: Point, shape: GeometryShapes | SwimlaneDrawSymbols, vector: Vector) => import("../interfaces").PlaitCommonGeometry | import("../interfaces").PlaitSwimlane | null;
@@ -1,8 +1,7 @@
1
- import { PlaitBoard, Point, Path, Vector } from '@plait/core';
1
+ import { PlaitBoard, Point, Path } from '@plait/core';
2
2
  import { GeometryShapes } from '../interfaces';
3
3
  import { Element } from 'slate';
4
4
  export declare const insertGeometry: (board: PlaitBoard, points: [Point, Point], shape: GeometryShapes) => import("../interfaces").PlaitCommonGeometry;
5
- export declare const insertGeometryByVector: (board: PlaitBoard, point: Point, shape: GeometryShapes, vector: Vector) => import("../interfaces").PlaitCommonGeometry | null;
6
5
  export declare const insertText: (board: PlaitBoard, point: Point, text: string | Element) => void;
7
6
  export declare const resizeGeometry: (board: PlaitBoard, points: [Point, Point], textHeight: number, path: Path) => void;
8
7
  export declare const switchGeometryShape: (board: PlaitBoard, shape: GeometryShapes) => void;
@@ -11,9 +11,8 @@ export declare const DrawTransforms: {
11
11
  setArrowLineMark: (board: import("@plait/core").PlaitBoard, handleKey: import("@plait/draw").ArrowLineHandleKey, marker: import("@plait/draw").ArrowLineMarkerType) => void;
12
12
  setArrowLineShape: (board: import("@plait/core").PlaitBoard, newProperties: Partial<import("@plait/draw").PlaitArrowLine>) => void;
13
13
  insertImage: (board: import("@plait/core").PlaitBoard, imageItem: import("@plait/common").CommonImageItem, startPoint?: import("@plait/core").Point | undefined) => void;
14
+ connectArrowLineToDraw: (board: import("@plait/core").PlaitBoard, lineElement: import("@plait/draw").PlaitArrowLine, handle: import("@plait/draw").ArrowLineHandleKey, geometryElement: import("@plait/draw").PlaitShapeElement) => void;
14
15
  switchGeometryShape: (board: import("@plait/core").PlaitBoard, shape: import("@plait/draw").GeometryShapes) => void;
15
- connectArrowLineToGeometry: (board: import("@plait/core").PlaitBoard, lineElement: import("@plait/draw").PlaitArrowLine, handle: import("@plait/draw").ArrowLineHandleKey, geometryElement: import("@plait/draw").PlaitGeometry) => void;
16
- insertGeometryByVector: (board: import("@plait/core").PlaitBoard, point: import("@plait/core").Point, shape: import("@plait/draw").GeometryShapes, vector: import("@plait/core").Vector) => import("@plait/draw").PlaitCommonGeometry | null;
17
16
  setTableText: (board: import("@plait/core").PlaitBoard, path: import("@plait/core").Path, cellId: string, text: import("slate").BaseElement, textHeight: number) => void;
18
17
  addSwimlaneRow: (board: import("@plait/core").PlaitBoard, swimlane: import("@plait/draw").PlaitSwimlane, index: number, count?: number) => void;
19
18
  addSwimlaneColumn: (board: import("@plait/core").PlaitBoard, swimlane: import("@plait/draw").PlaitSwimlane, index: number, count?: number) => void;
@@ -21,4 +20,5 @@ export declare const DrawTransforms: {
21
20
  removeSwimlaneColumn: (board: import("@plait/core").PlaitBoard, swimlane: import("@plait/draw").PlaitSwimlane, index: number, count?: number) => void;
22
21
  updateSwimlaneCount: (board: import("@plait/core").PlaitBoard, swimlane: import("@plait/draw").PlaitSwimlane, count: number) => void;
23
22
  setTableFill: (board: import("@plait/core").PlaitBoard, element: import("@plait/draw").PlaitBaseTable, fill: string, path: import("@plait/core").Path) => void;
23
+ insertDrawByVector: (board: import("@plait/core").PlaitBoard, point: import("@plait/core").Point, shape: import("@plait/draw").GeometryShapes | import("@plait/draw").SwimlaneDrawSymbols, vector: import("@plait/core").Vector) => import("@plait/draw").PlaitCommonGeometry | import("@plait/draw").PlaitSwimlane | null;
24
24
  };
@@ -1,4 +1,4 @@
1
- import { Point, PlaitBoard, RectangleClient, PointOfRectangle, Direction, Vector } from '@plait/core';
1
+ import { Point, PlaitBoard, RectangleClient, PointOfRectangle, Direction, Vector, Path } from '@plait/core';
2
2
  import { ArrowLineHandleRefPair, PlaitArrowLine, PlaitShapeElement } from '../../interfaces';
3
3
  export declare const getArrowLineHandleRefPair: (board: PlaitBoard, element: PlaitArrowLine) => ArrowLineHandleRefPair;
4
4
  export declare const getConnectionPoint: (geometry: PlaitShapeElement, connection: Point, direction?: Direction, delta?: number) => Point;
@@ -23,3 +23,7 @@ export declare const getElbowLineRouteOptions: (board: PlaitBoard, element: Plai
23
23
  height: number;
24
24
  };
25
25
  };
26
+ export declare const collectArrowLineUpdatedRefsByGeometry: (board: PlaitBoard, element: PlaitShapeElement, refs: {
27
+ property: Partial<PlaitArrowLine>;
28
+ path: Path;
29
+ }[]) => void;
@@ -1,7 +1,7 @@
1
1
  import { PlaitBoard, Point } from '@plait/core';
2
2
  import { PlaitArrowLine, PlaitDrawElement, PlaitGeometry, PlaitShapeElement } from '../interfaces';
3
3
  import { PlaitTable } from '../interfaces/table';
4
- export declare const buildClipboardData: (board: PlaitBoard, elements: PlaitDrawElement[], startPoint: Point) => (PlaitGeometry | PlaitArrowLine | import("../interfaces").PlaitVectorLine | import("../interfaces").PlaitBaseTable)[];
4
+ export declare const buildClipboardData: (board: PlaitBoard, elements: PlaitDrawElement[], startPoint: Point) => (PlaitGeometry | import("../interfaces").PlaitBaseTable | PlaitArrowLine | import("../interfaces").PlaitVectorLine)[];
5
5
  export declare const insertClipboardData: (board: PlaitBoard, elements: PlaitDrawElement[], startPoint: Point) => void;
6
6
  export declare const insertClipboardTableData: (board: PlaitBoard, elements: PlaitTable[], startPoint: Point, lines: PlaitArrowLine[]) => void;
7
7
  export declare const updateBoundArrowLinesId: (element: PlaitShapeElement, lines: PlaitArrowLine[], newId: string) => void;
package/utils/common.d.ts CHANGED
@@ -14,6 +14,7 @@ export declare const getStrokeWidthByElement: (element: PlaitElement) => any;
14
14
  export declare const insertElement: (board: PlaitBoard, element: PlaitBaseGeometry | PlaitBaseTable) => void;
15
15
  export declare const isDrawElementIncludeText: (element: PlaitDrawElement) => boolean;
16
16
  export declare const isDrawElementsIncludeText: (elements: PlaitDrawElement[]) => boolean;
17
+ export declare const isDrawElementClosed: (element: PlaitDrawElement) => boolean;
17
18
  export declare const getSnappingShape: (board: PlaitBoard, point: Point) => PlaitShapeElement | null;
18
19
  export declare const getSnappingRef: (board: PlaitBoard, hitElement: PlaitShapeElement, point: Point) => {
19
20
  isHitEdge: boolean;
@@ -67,9 +67,6 @@ export declare const getDefaultUMLProperty: (shape: UMLSymbols) => {
67
67
  } | {
68
68
  width: number;
69
69
  height: number;
70
- } | {
71
- width: number;
72
- height: number;
73
70
  } | {
74
71
  width: number;
75
72
  height: number;
@@ -81,25 +78,12 @@ export declare const getDefaultUMLProperty: (shape: UMLSymbols) => {
81
78
  } | {
82
79
  width: number;
83
80
  height: number;
84
- texts: {
85
- key: import("../interfaces").MultipleTextGeometryCommonTextKeys;
86
- text: string;
87
- align: Alignment;
88
- }[];
89
81
  } | {
90
82
  width: number;
91
83
  height: number;
92
- texts: {
93
- text: string;
94
- align: Alignment;
95
- }[];
96
84
  } | {
97
85
  width: number;
98
86
  height: number;
99
- texts: {
100
- text: string;
101
- align: Alignment;
102
- }[];
103
87
  } | {
104
88
  width: number;
105
89
  height: number;
@@ -118,9 +102,25 @@ export declare const getDefaultUMLProperty: (shape: UMLSymbols) => {
118
102
  } | {
119
103
  width: number;
120
104
  height: number;
105
+ texts: {
106
+ key: import("../interfaces").MultipleTextGeometryCommonTextKeys;
107
+ text: string;
108
+ align: Alignment;
109
+ }[];
110
+ } | {
111
+ width: number;
112
+ height: number;
113
+ texts: {
114
+ text: string;
115
+ align: Alignment;
116
+ }[];
121
117
  } | {
122
118
  width: number;
123
119
  height: number;
120
+ texts: {
121
+ text: string;
122
+ align: Alignment;
123
+ }[];
124
124
  };
125
125
  export declare const createDefaultFlowchart: (point: Point) => (PlaitGeometry | import("../interfaces").PlaitArrowLine)[];
126
126
  export declare const getAutoCompletePoints: (element: PlaitShapeElement) => [Point, Point, Point, Point];
@@ -144,3 +144,4 @@ export declare const rerenderGeometryActive: (board: PlaitBoard, element: PlaitG
144
144
  export declare const isGeometryIncludeText: (element: PlaitGeometry) => boolean;
145
145
  export declare const isSingleTextShape: (shape: GeometryShapes) => boolean;
146
146
  export declare const isSingleTextGeometry: (element: PlaitGeometry) => boolean;
147
+ export declare const isGeometryClosed: (element: PlaitGeometry) => boolean;
package/utils/hit.d.ts CHANGED
@@ -9,7 +9,7 @@ export declare const isHitElementText: (element: PlaitCommonGeometry, point: Poi
9
9
  export declare const isRectangleHitDrawElement: (board: PlaitBoard, element: PlaitElement, selection: Selection) => boolean | null;
10
10
  export declare const getDrawHitElement: (board: PlaitBoard, elements: PlaitDrawElement[]) => PlaitElement;
11
11
  export declare const getFirstFilledDrawElement: (board: PlaitBoard, elements: PlaitDrawElement[]) => PlaitGeometry | null;
12
- export declare const getFirstTextOrLineElement: (elements: PlaitDrawElement[]) => PlaitGeometry | PlaitArrowLine | import("../interfaces").PlaitVectorLine | import("../interfaces/image").PlaitImage | import("../interfaces").PlaitBaseTable | null;
12
+ export declare const getFirstTextOrLineElement: (elements: PlaitDrawElement[]) => PlaitGeometry | import("../interfaces").PlaitBaseTable | import("../interfaces/image").PlaitImage | PlaitArrowLine | import("../interfaces").PlaitVectorLine | null;
13
13
  export declare const isHitDrawElement: (board: PlaitBoard, element: PlaitElement, point: Point) => boolean | null;
14
14
  export declare const isHitEdgeOfShape: (board: PlaitBoard, element: PlaitShapeElement, point: Point, hitDistanceBuffer: number) => boolean;
15
15
  export declare const isInsideOfShape: (board: PlaitBoard, element: PlaitShapeElement, point: Point, hitDistanceBuffer: number) => boolean;
@@ -1,4 +1,4 @@
1
- import { Point } from '@plait/core';
1
+ import { PlaitBoard, Point } from '@plait/core';
2
2
  import { PlaitSwimlane, PlaitTableCell, SwimlaneDrawSymbols, SwimlaneSymbols } from '../interfaces';
3
3
  export declare function buildSwimlaneTable(element: PlaitSwimlane): {
4
4
  [x: string]: any;
@@ -35,3 +35,4 @@ export declare const createDefaultCells: (shape: SwimlaneSymbols, rows: {
35
35
  export declare const getSwimlaneCount: (swimlane: PlaitSwimlane) => number;
36
36
  export declare const isSwimlaneWithHeader: (shape: SwimlaneDrawSymbols) => boolean;
37
37
  export declare const adjustSwimlaneShape: (shape: SwimlaneDrawSymbols) => SwimlaneSymbols;
38
+ export declare const isSwimlanePointers: (board: PlaitBoard) => boolean;