@plait/draw 0.60.0 → 0.62.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.
Files changed (92) hide show
  1. package/constants/geometry.d.ts +41 -13
  2. package/constants/index.d.ts +2 -1
  3. package/constants/line.d.ts +1 -0
  4. package/constants/pointer.d.ts +2 -2
  5. package/constants/swimlane.d.ts +21 -0
  6. package/constants/text.d.ts +1 -0
  7. package/engines/uml/assembly.d.ts +2 -0
  8. package/engines/uml/component-box.d.ts +2 -0
  9. package/engines/uml/component.d.ts +2 -0
  10. package/engines/uml/provided-interface.d.ts +2 -0
  11. package/engines/uml/required-interface.d.ts +2 -0
  12. package/engines/uml/template.d.ts +2 -0
  13. package/esm2022/constants/geometry.mjs +30 -17
  14. package/esm2022/constants/index.mjs +3 -2
  15. package/esm2022/constants/line.mjs +2 -1
  16. package/esm2022/constants/pointer.mjs +3 -3
  17. package/esm2022/constants/swimlane.mjs +25 -0
  18. package/esm2022/constants/text.mjs +2 -0
  19. package/esm2022/engines/index.mjs +14 -2
  20. package/esm2022/engines/table/table.mjs +9 -3
  21. package/esm2022/engines/uml/assembly.mjs +56 -0
  22. package/esm2022/engines/uml/component-box.mjs +61 -0
  23. package/esm2022/engines/uml/component.mjs +72 -0
  24. package/esm2022/engines/uml/provided-interface.mjs +47 -0
  25. package/esm2022/engines/uml/required-interface.mjs +36 -0
  26. package/esm2022/engines/uml/template.mjs +47 -0
  27. package/esm2022/generators/single-text.generator.mjs +3 -3
  28. package/esm2022/generators/table.generator.mjs +1 -1
  29. package/esm2022/generators/text.generator.mjs +10 -13
  30. package/esm2022/geometry.component.mjs +12 -14
  31. package/esm2022/image.component.mjs +6 -8
  32. package/esm2022/interfaces/geometry.mjs +7 -10
  33. package/esm2022/interfaces/index.mjs +18 -8
  34. package/esm2022/interfaces/swimlane.mjs +13 -0
  35. package/esm2022/interfaces/table.mjs +5 -1
  36. package/esm2022/line.component.mjs +12 -13
  37. package/esm2022/plugins/with-draw-fragment.mjs +5 -2
  38. package/esm2022/plugins/with-draw.mjs +1 -1
  39. package/esm2022/plugins/with-geometry-create.mjs +4 -10
  40. package/esm2022/plugins/with-line-text.mjs +7 -8
  41. package/esm2022/plugins/with-swimlane-create.mjs +4 -4
  42. package/esm2022/plugins/with-swimlane.mjs +21 -2
  43. package/esm2022/plugins/with-table-resize.mjs +6 -5
  44. package/esm2022/plugins/with-table.mjs +28 -10
  45. package/esm2022/table.component.mjs +31 -12
  46. package/esm2022/transforms/geometry-text.mjs +8 -6
  47. package/esm2022/transforms/image.mjs +3 -3
  48. package/esm2022/transforms/index.mjs +5 -3
  49. package/esm2022/transforms/line.mjs +1 -1
  50. package/esm2022/transforms/multi-text-geometry-text.mjs +1 -1
  51. package/esm2022/transforms/swimlane.mjs +129 -37
  52. package/esm2022/utils/clipboard.mjs +27 -21
  53. package/esm2022/utils/common.mjs +6 -7
  54. package/esm2022/utils/geometry.mjs +4 -4
  55. package/esm2022/utils/hit.mjs +2 -2
  56. package/esm2022/utils/index.mjs +4 -1
  57. package/esm2022/utils/multi-text-geometry.mjs +2 -2
  58. package/esm2022/utils/selected.mjs +3 -8
  59. package/esm2022/utils/swimlane.mjs +66 -77
  60. package/esm2022/utils/table-selected.mjs +26 -0
  61. package/esm2022/utils/table.mjs +26 -1
  62. package/esm2022/utils/uml.mjs +2 -2
  63. package/fesm2022/plait-draw.mjs +848 -309
  64. package/fesm2022/plait-draw.mjs.map +1 -1
  65. package/generators/single-text.generator.d.ts +3 -4
  66. package/generators/table.generator.d.ts +2 -2
  67. package/generators/text.generator.d.ts +3 -6
  68. package/image.component.d.ts +0 -1
  69. package/interfaces/geometry.d.ts +15 -24
  70. package/interfaces/index.d.ts +11 -6
  71. package/interfaces/swimlane.d.ts +22 -0
  72. package/interfaces/table.d.ts +13 -4
  73. package/line.component.d.ts +1 -2
  74. package/package.json +1 -3
  75. package/plugins/with-geometry-create.d.ts +1 -1
  76. package/plugins/with-swimlane-create.d.ts +1 -1
  77. package/plugins/with-swimlane.d.ts +3 -2
  78. package/plugins/with-table-resize.d.ts +1 -1
  79. package/plugins/with-table.d.ts +1 -4
  80. package/transforms/index.d.ts +7 -5
  81. package/transforms/swimlane.d.ts +8 -5
  82. package/utils/clipboard.d.ts +4 -3
  83. package/utils/common.d.ts +5 -5
  84. package/utils/geometry.d.ts +16 -1
  85. package/utils/index.d.ts +3 -0
  86. package/utils/selected.d.ts +2 -4
  87. package/utils/shape.d.ts +1 -1
  88. package/utils/swimlane.d.ts +11 -26
  89. package/utils/table-selected.d.ts +9 -0
  90. package/utils/table.d.ts +10 -9
  91. package/constants/draw.d.ts +0 -1
  92. package/esm2022/constants/draw.mjs +0 -2
@@ -1,11 +1,10 @@
1
1
  import { PlaitBoard, PlaitElement } from '@plait/core';
2
- import { ParagraphElement } from '@plait/text';
3
2
  import { PlaitGeometry } from '../interfaces';
4
- import { ViewContainerRef } from '@angular/core';
5
3
  import { PlaitDrawShapeText, TextGenerator, TextGeneratorOptions } from './text.generator';
4
+ import { ParagraphElement } from '@plait/common';
6
5
  export declare class SingleTextGenerator<T extends PlaitElement = PlaitGeometry> extends TextGenerator<T> {
7
- get textManage(): import("@plait/text").TextManage;
8
- constructor(board: PlaitBoard, element: T, text: ParagraphElement, viewContainerRef: ViewContainerRef, options: TextGeneratorOptions<T>);
6
+ get textManage(): import("@plait/common").TextManage;
7
+ constructor(board: PlaitBoard, element: T, text: ParagraphElement, options: TextGeneratorOptions<T>);
9
8
  update(element: T, previousDrawShapeTexts: PlaitDrawShapeText[], currentDrawShapeTexts: PlaitDrawShapeText[], elementG: SVGElement): void;
10
9
  update(element: T, previousText: ParagraphElement, currentText: ParagraphElement, elementG: SVGElement): void;
11
10
  }
@@ -1,9 +1,9 @@
1
1
  import { Generator } from '@plait/common';
2
2
  import { PlaitElement } from '@plait/core';
3
- import { PlaitTable } from '../interfaces/table';
3
+ import { PlaitBaseTable } from '../interfaces/table';
4
4
  export interface TableData {
5
5
  }
6
- export declare class TableGenerator<T extends PlaitElement = PlaitTable> extends Generator<T, TableData> {
6
+ export declare class TableGenerator<T extends PlaitElement = PlaitBaseTable> extends Generator<T, TableData> {
7
7
  canDraw(element: T, data: TableData): boolean;
8
8
  draw(element: T, data: TableData): SVGGElement;
9
9
  }
@@ -1,7 +1,6 @@
1
+ import { ParagraphElement, TextManage, TextManageChangeData } from '@plait/common';
1
2
  import { PlaitBoard, PlaitElement, RectangleClient } from '@plait/core';
2
- import { TextManageRef, TextManage, ParagraphElement } from '@plait/text';
3
3
  import { DrawShapes, EngineExtraData, PlaitGeometry } from '../interfaces';
4
- import { ViewContainerRef } from '@angular/core';
5
4
  export interface PlaitDrawShapeText extends EngineExtraData {
6
5
  key: string;
7
6
  text: ParagraphElement;
@@ -9,7 +8,7 @@ export interface PlaitDrawShapeText extends EngineExtraData {
9
8
  board?: PlaitBoard;
10
9
  }
11
10
  export interface TextGeneratorOptions<T> {
12
- onValueChangeHandle: (element: T, textChangeRef: TextManageRef, text: PlaitDrawShapeText) => void;
11
+ onChange: (element: T, textChangeRef: TextManageChangeData, text: PlaitDrawShapeText) => void;
13
12
  getRenderRectangle?: (element: T, text: PlaitDrawShapeText) => RectangleClient;
14
13
  getMaxWidth?: () => number;
15
14
  }
@@ -21,11 +20,10 @@ export declare class TextGenerator<T extends PlaitElement = PlaitGeometry> {
21
20
  protected board: PlaitBoard;
22
21
  protected element: T;
23
22
  protected texts: PlaitDrawShapeText[];
24
- protected viewContainerRef: ViewContainerRef;
25
23
  protected options: TextGeneratorOptions<T>;
26
24
  textManages: TextManage[];
27
25
  get shape(): DrawShapes;
28
- constructor(board: PlaitBoard, element: T, texts: PlaitDrawShapeText[], viewContainerRef: ViewContainerRef, options: TextGeneratorOptions<T>);
26
+ constructor(board: PlaitBoard, element: T, texts: PlaitDrawShapeText[], options: TextGeneratorOptions<T>);
29
27
  initialize(): void;
30
28
  draw(elementG: SVGElement): void;
31
29
  update(element: T, previousDrawShapeTexts: PlaitDrawShapeText[], currentDrawShapeTexts: PlaitDrawShapeText[], elementG: SVGElement): void;
@@ -36,7 +34,6 @@ export declare class TextGenerator<T extends PlaitElement = PlaitGeometry> {
36
34
  x: any;
37
35
  y: number;
38
36
  };
39
- onValueChangeHandle(textManageRef: TextManageRef, text: PlaitDrawShapeText): void;
40
37
  getMaxWidth(text: PlaitDrawShapeText): number;
41
38
  destroy(): void;
42
39
  }
@@ -3,7 +3,6 @@ import { CommonElementFlavour, ImageGenerator } from '@plait/common';
3
3
  import { PlaitImage } from './interfaces/image';
4
4
  import { LineAutoCompleteGenerator } from './generators/line-auto-complete.generator';
5
5
  export declare class ImageComponent extends CommonElementFlavour<PlaitImage, PlaitBoard> implements OnContextChanged<PlaitImage, PlaitBoard> {
6
- get activeGenerator(): import("@plait/common").ActiveGenerator<import("@plait/core").PlaitElement>;
7
6
  imageGenerator: ImageGenerator<PlaitImage>;
8
7
  lineAutoCompleteGenerator: LineAutoCompleteGenerator<PlaitImage>;
9
8
  constructor();
@@ -1,8 +1,7 @@
1
1
  import { PlaitElement, Point } from '@plait/core';
2
- import { ParagraphElement } from '@plait/text';
3
2
  import { StrokeStyle } from './element';
4
- import { PlaitTable } from './table';
5
3
  import { PlaitDrawShapeText } from '../generators/text.generator';
4
+ import { ParagraphElement } from '@plait/common';
6
5
  export declare enum BasicShapes {
7
6
  rectangle = "rectangle",
8
7
  ellipse = "ellipse",
@@ -52,13 +51,6 @@ export declare enum FlowchartSymbols {
52
51
  noteSquare = "noteSquare",
53
52
  display = "display"
54
53
  }
55
- export declare enum TableSymbols {
56
- table = "table"
57
- }
58
- export declare enum SwimlaneSymbols {
59
- swimlaneVertical = "swimlaneVertical",
60
- swimlaneHorizontal = "swimlaneHorizontal"
61
- }
62
54
  export declare enum UMLSymbols {
63
55
  actor = "actor",
64
56
  useCase = "useCase",
@@ -73,25 +65,33 @@ export declare enum UMLSymbols {
73
65
  class = "class",
74
66
  interface = "interface",
75
67
  object = "object",
68
+ component = "component",
69
+ componentBox = "componentBox",
70
+ template = "template",
76
71
  activation = "activation",
77
- deletion = "deletion"
72
+ deletion = "deletion",
73
+ assembly = "assembly",
74
+ providedInterface = "providedInterface",
75
+ requiredInterface = "requiredInterface"
78
76
  }
79
77
  export declare enum MultipleTextGeometryCommonTextKeys {
80
78
  name = "name",
81
79
  content = "content"
82
80
  }
83
- export type GeometryShapes = BasicShapes | FlowchartSymbols | SwimlaneSymbols | UMLSymbols;
81
+ export type GeometryShapes = BasicShapes | FlowchartSymbols | UMLSymbols;
84
82
  export type SwimlaneDirection = 'horizontal' | 'vertical';
85
- export interface PlaitCommonGeometry extends PlaitElement {
86
- points: [Point, Point];
83
+ export interface PlaitBaseGeometry extends PlaitElement {
87
84
  type: 'geometry';
85
+ points: [Point, Point];
88
86
  shape: GeometryShapes;
87
+ }
88
+ export interface PlaitCommonGeometry extends PlaitBaseGeometry {
89
89
  fill?: string;
90
90
  strokeColor?: string;
91
91
  strokeWidth?: number;
92
92
  strokeStyle?: StrokeStyle;
93
- angle: number;
94
- opacity: number;
93
+ angle?: number;
94
+ opacity?: number;
95
95
  }
96
96
  export interface PlaitMultipleTextGeometry extends PlaitCommonGeometry {
97
97
  texts: PlaitDrawShapeText[];
@@ -109,13 +109,4 @@ export interface PlaitEllipse extends PlaitGeometry {
109
109
  export interface PlaitDiamond extends PlaitGeometry {
110
110
  shape: BasicShapes.diamond;
111
111
  }
112
- export interface PlaitSwimlane extends PlaitTable {
113
- shape: SwimlaneSymbols;
114
- }
115
- export interface PlaitSwimlaneVertical extends PlaitSwimlane {
116
- shape: SwimlaneSymbols.swimlaneVertical;
117
- }
118
- export interface PlaitSwimlaneHorizontal extends PlaitSwimlane {
119
- shape: SwimlaneSymbols.swimlaneHorizontal;
120
- }
121
112
  export declare const PlaitGeometry: {};
@@ -1,16 +1,19 @@
1
- import { GeometryShapes, PlaitGeometry, TableSymbols } from './geometry';
1
+ import { GeometryShapes, PlaitGeometry } from './geometry';
2
2
  import { PlaitImage } from './image';
3
3
  import { PlaitLine } from './line';
4
- import { PlaitTable } from './table';
4
+ import { PlaitSwimlane, SwimlaneSymbols } from './swimlane';
5
+ import { PlaitBaseTable, PlaitTable, TableSymbols } from './table';
5
6
  import { PlaitText } from './text';
6
7
  export * from './line';
7
8
  export * from './geometry';
8
9
  export * from './text';
9
10
  export * from './element';
10
11
  export * from './engine';
11
- export type PlaitDrawElement = PlaitGeometry | PlaitLine | PlaitImage | PlaitTable;
12
- export type PlaitShapeElement = PlaitGeometry | PlaitImage | PlaitTable;
13
- export type DrawShapes = GeometryShapes | TableSymbols;
12
+ export * from './swimlane';
13
+ export * from './table';
14
+ export type PlaitDrawElement = PlaitGeometry | PlaitLine | PlaitImage | PlaitBaseTable | PlaitSwimlane;
15
+ export type PlaitShapeElement = PlaitGeometry | PlaitImage | PlaitTable | PlaitSwimlane;
16
+ export type DrawShapes = GeometryShapes | TableSymbols | SwimlaneSymbols;
14
17
  export declare const PlaitDrawElement: {
15
18
  isGeometry: (value: any) => value is PlaitGeometry;
16
19
  isLine: (value: any) => value is PlaitLine;
@@ -22,8 +25,10 @@ export declare const PlaitDrawElement: {
22
25
  isBasicShape: (value: any) => boolean;
23
26
  isFlowchart: (value: any) => boolean;
24
27
  isUML: (value: any) => boolean;
25
- isSwimlane: (value: any) => boolean;
28
+ isSwimlane: (value: any) => value is PlaitSwimlane;
26
29
  isVerticalSwimlane: (value: any) => boolean;
27
30
  isHorizontalSwimlane: (value: any) => boolean;
28
31
  isUMLClassOrInterface: (value: any) => boolean;
32
+ isGeometryByTable: (value: any) => value is PlaitBaseTable;
33
+ isElementByTable: (value: any) => value is PlaitBaseTable;
29
34
  };
@@ -0,0 +1,22 @@
1
+ import { PlaitBaseTable } from './table';
2
+ export declare enum SwimlaneSymbols {
3
+ swimlaneVertical = "swimlaneVertical",
4
+ swimlaneHorizontal = "swimlaneHorizontal"
5
+ }
6
+ export declare enum SwimlaneDrawSymbols {
7
+ swimlaneVertical = "swimlaneVertical",
8
+ swimlaneHorizontal = "swimlaneHorizontal",
9
+ swimlaneVerticalWithHeader = "swimlaneVerticalWithHeader",
10
+ swimlaneHorizontalWithHeader = "swimlaneHorizontalWithHeader"
11
+ }
12
+ export interface PlaitSwimlane extends PlaitBaseTable {
13
+ type: 'swimlane';
14
+ shape: SwimlaneSymbols;
15
+ header?: boolean;
16
+ }
17
+ export interface PlaitSwimlaneVertical extends PlaitSwimlane {
18
+ shape: SwimlaneSymbols.swimlaneVertical;
19
+ }
20
+ export interface PlaitSwimlaneHorizontal extends PlaitSwimlane {
21
+ shape: SwimlaneSymbols.swimlaneHorizontal;
22
+ }
@@ -1,10 +1,15 @@
1
- import { PlaitElement, Point } from '@plait/core';
1
+ import { PlaitBoard, PlaitElement, Point } from '@plait/core';
2
2
  import { EngineExtraData } from './engine';
3
- import { ParagraphElement } from '@plait/text';
4
- export interface PlaitTable extends PlaitElement {
3
+ import { ParagraphElement } from '@plait/common';
4
+ export declare enum TableSymbols {
5
+ table = "table"
6
+ }
7
+ export interface PlaitTableBoard extends PlaitBoard {
8
+ buildTable: (element: PlaitBaseTable) => PlaitBaseTable;
9
+ }
10
+ export interface PlaitBaseTable extends PlaitElement {
5
11
  id: string;
6
12
  points: Point[];
7
- type: 'table';
8
13
  rows: {
9
14
  id: string;
10
15
  height?: number;
@@ -16,6 +21,9 @@ export interface PlaitTable extends PlaitElement {
16
21
  cells: PlaitTableCell[];
17
22
  groupId?: string;
18
23
  }
24
+ export interface PlaitTable extends PlaitBaseTable {
25
+ type: 'table';
26
+ }
19
27
  export interface PlaitTableCell {
20
28
  id: string;
21
29
  rowId: string;
@@ -24,6 +32,7 @@ export interface PlaitTableCell {
24
32
  rowspan?: number;
25
33
  text?: PlaitTableCellParagraph;
26
34
  textHeight?: number;
35
+ fill?: string;
27
36
  }
28
37
  export interface PlaitTableDrawOptions extends EngineExtraData {
29
38
  element: PlaitTable;
@@ -1,9 +1,8 @@
1
1
  import { PlaitBoard, PlaitPluginElementContext, OnContextChanged } from '@plait/core';
2
2
  import { LineText, PlaitGeometry, PlaitLine } from './interfaces';
3
- import { TextManage } from '@plait/text';
4
3
  import { LineShapeGenerator } from './generators/line.generator';
5
4
  import { LineActiveGenerator } from './generators/line-active.generator';
6
- import { CommonElementFlavour } from '@plait/common';
5
+ import { CommonElementFlavour, TextManage } from '@plait/common';
7
6
  interface BoundedElements {
8
7
  source?: PlaitGeometry;
9
8
  target?: PlaitGeometry;
package/package.json CHANGED
@@ -1,9 +1,7 @@
1
1
  {
2
2
  "name": "@plait/draw",
3
- "version": "0.60.0",
3
+ "version": "0.62.0-next.0",
4
4
  "peerDependencies": {
5
- "@angular/common": "^17.2.4",
6
- "@angular/core": "^17.2.4",
7
5
  "is-hotkey": "^0.2.0"
8
6
  },
9
7
  "dependencies": {
@@ -1,5 +1,5 @@
1
1
  import { PlaitBoard } from '@plait/core';
2
- import { TextManage } from '@plait/text';
2
+ import { TextManage } from '@plait/common';
3
3
  export interface FakeCreateTextRef {
4
4
  g: SVGGElement;
5
5
  textManage: TextManage;
@@ -1,5 +1,5 @@
1
1
  import { PlaitBoard } from '@plait/core';
2
- import { TextManage } from '@plait/text';
2
+ import { TextManage } from '@plait/common';
3
3
  export interface FakeCreateTextRef {
4
4
  g: SVGGElement;
5
5
  textManage: TextManage;
@@ -1,2 +1,3 @@
1
- import { PlaitTableBoard } from './with-table';
2
- export declare const withSwimlane: (board: PlaitTableBoard) => import("@plait/core").PlaitBoard;
1
+ import { PlaitBoard } from '@plait/core';
2
+ import { PlaitTableBoard } from '../interfaces/table';
3
+ export declare const withSwimlane: (board: PlaitTableBoard) => PlaitBoard;
@@ -1,2 +1,2 @@
1
- import { PlaitTableBoard } from './with-table';
1
+ import { PlaitTableBoard } from '../interfaces/table';
2
2
  export declare function withTableResize(board: PlaitTableBoard): PlaitTableBoard;
@@ -1,6 +1,3 @@
1
- import { PlaitTable } from '../interfaces/table';
1
+ import { PlaitTableBoard } from '../interfaces/table';
2
2
  import { PlaitBoard } from '@plait/core';
3
- export interface PlaitTableBoard extends PlaitBoard {
4
- buildTable: (element: PlaitTable) => PlaitTable;
5
- }
6
3
  export declare const withTable: (board: PlaitBoard) => PlaitTableBoard;
@@ -14,9 +14,11 @@ export declare const DrawTransforms: {
14
14
  switchGeometryShape: (board: import("@plait/core").PlaitBoard, shape: import("@plait/draw").GeometryShapes) => void;
15
15
  connectLineToGeometry: (board: import("@plait/core").PlaitBoard, lineElement: import("@plait/draw").PlaitLine, handle: import("@plait/draw").LineHandleKey, geometryElement: import("@plait/draw").PlaitGeometry) => void;
16
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
- setTableText: (board: import("@plait/core").PlaitBoard, table: import("../interfaces/table").PlaitTable, cellId: string, text: import("slate").BaseElement, textWidth: number, textHeight: number) => void;
18
- addSwimlaneRow: (board: import("@plait/core").PlaitBoard, swimlane: import("@plait/draw").PlaitSwimlane, index: number) => void;
19
- addSwimlaneColumn: (board: import("@plait/core").PlaitBoard, swimlane: import("@plait/draw").PlaitSwimlane, index: number) => void;
20
- removeSwimlaneRow: (board: import("@plait/core").PlaitBoard, swimlane: import("@plait/draw").PlaitSwimlane, index: number) => void;
21
- removeSwimlaneColumn: (board: import("@plait/core").PlaitBoard, swimlane: import("@plait/draw").PlaitSwimlane, index: number) => void;
17
+ setTableText: (board: import("@plait/core").PlaitBoard, table: import("@plait/draw").PlaitTable, cellId: string, text: import("slate").BaseElement, textWidth: number, textHeight: number) => void;
18
+ addSwimlaneRow: (board: import("@plait/core").PlaitBoard, swimlane: import("@plait/draw").PlaitSwimlane, index: number, count?: number) => void;
19
+ addSwimlaneColumn: (board: import("@plait/core").PlaitBoard, swimlane: import("@plait/draw").PlaitSwimlane, index: number, count?: number) => void;
20
+ removeSwimlaneRow: (board: import("@plait/core").PlaitBoard, swimlane: import("@plait/draw").PlaitSwimlane, index: number, count?: number) => void;
21
+ removeSwimlaneColumn: (board: import("@plait/core").PlaitBoard, swimlane: import("@plait/draw").PlaitSwimlane, index: number, count?: number) => void;
22
+ setSwimlaneFill: (board: import("@plait/core").PlaitBoard, element: import("@plait/draw").PlaitBaseTable, fill: string, path: import("@plait/core").Path) => void;
23
+ updateSwimlaneCount: (board: import("@plait/core").PlaitBoard, swimlane: import("@plait/draw").PlaitSwimlane, count: number) => void;
22
24
  };
@@ -1,6 +1,9 @@
1
- import { PlaitBoard } from '@plait/core';
1
+ import { Path, PlaitBoard } from '@plait/core';
2
2
  import { PlaitSwimlane } from '../interfaces';
3
- export declare const addSwimlaneRow: (board: PlaitBoard, swimlane: PlaitSwimlane, index: number) => void;
4
- export declare const addSwimlaneColumn: (board: PlaitBoard, swimlane: PlaitSwimlane, index: number) => void;
5
- export declare const removeSwimlaneRow: (board: PlaitBoard, swimlane: PlaitSwimlane, index: number) => void;
6
- export declare const removeSwimlaneColumn: (board: PlaitBoard, swimlane: PlaitSwimlane, index: number) => void;
3
+ import { PlaitBaseTable } from '../interfaces/table';
4
+ export declare const updateSwimlaneCount: (board: PlaitBoard, swimlane: PlaitSwimlane, count: number) => void;
5
+ export declare const addSwimlaneRow: (board: PlaitBoard, swimlane: PlaitSwimlane, index: number, count?: number) => void;
6
+ export declare const addSwimlaneColumn: (board: PlaitBoard, swimlane: PlaitSwimlane, index: number, count?: number) => void;
7
+ export declare const removeSwimlaneRow: (board: PlaitBoard, swimlane: PlaitSwimlane, index: number, count?: number) => void;
8
+ export declare const removeSwimlaneColumn: (board: PlaitBoard, swimlane: PlaitSwimlane, index: number, count?: number) => void;
9
+ export declare const setSwimlaneFill: (board: PlaitBoard, element: PlaitBaseTable, fill: string, path: Path) => void;
@@ -1,6 +1,7 @@
1
1
  import { PlaitBoard, Point } from '@plait/core';
2
- import { PlaitDrawElement, PlaitGeometry, PlaitLine } from '../interfaces';
2
+ import { PlaitDrawElement, PlaitGeometry, PlaitLine, PlaitShapeElement } from '../interfaces';
3
3
  import { PlaitTable } from '../interfaces/table';
4
- export declare const buildClipboardData: (board: PlaitBoard, elements: PlaitDrawElement[], startPoint: Point) => (PlaitGeometry | PlaitLine)[];
4
+ export declare const buildClipboardData: (board: PlaitBoard, elements: PlaitDrawElement[], startPoint: Point) => (PlaitGeometry | import("../interfaces").PlaitBaseTable | PlaitLine)[];
5
5
  export declare const insertClipboardData: (board: PlaitBoard, elements: PlaitDrawElement[], startPoint: Point) => void;
6
- export declare const insertClipboardTableData: (board: PlaitBoard, elements: PlaitTable[], startPoint: Point) => void;
6
+ export declare const insertClipboardTableData: (board: PlaitBoard, elements: PlaitTable[], startPoint: Point, lines: PlaitLine[]) => void;
7
+ export declare const updateBoundLinesId: (element: PlaitShapeElement, lines: PlaitLine[], newId: string) => void;
package/utils/common.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { PlaitBoard, PlaitElement, Point, RectangleClient } from '@plait/core';
2
- import { DrawShapes, EngineExtraData, PlaitCommonGeometry, PlaitDrawElement, PlaitGeometry, PlaitShapeElement } from '../interfaces';
2
+ import { DrawShapes, EngineExtraData, PlaitBaseGeometry, PlaitCommonGeometry, PlaitDrawElement, PlaitGeometry, PlaitShapeElement } from '../interfaces';
3
+ import { Alignment } from '@plait/common';
3
4
  import { Options } from 'roughjs/bin/core';
4
- import { PlaitTable } from '../interfaces/table';
5
+ import { PlaitBaseTable } from '../interfaces/table';
5
6
  import { PlaitDrawShapeText } from '../generators/text.generator';
6
- import { Alignment } from '@plait/text';
7
7
  export declare const getTextRectangle: <T extends PlaitElement = PlaitGeometry>(element: T) => {
8
8
  height: any;
9
9
  width: number;
@@ -11,7 +11,7 @@ export declare const getTextRectangle: <T extends PlaitElement = PlaitGeometry>(
11
11
  y: number;
12
12
  };
13
13
  export declare const getStrokeWidthByElement: (element: PlaitElement) => any;
14
- export declare const insertElement: (board: PlaitBoard, element: PlaitCommonGeometry | PlaitTable) => void;
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
17
  export declare const getSnappingShape: (board: PlaitBoard, point: Point) => PlaitShapeElement | null;
@@ -29,4 +29,4 @@ export declare const drawBoundReaction: (board: PlaitBoard, element: PlaitShapeE
29
29
  hasConnector: boolean;
30
30
  }) => SVGGElement;
31
31
  export declare const getTextKey: <T extends PlaitElement = PlaitGeometry>(element: T, text: PlaitDrawShapeText) => string;
32
- export declare const getGeometryAlign: (element: PlaitCommonGeometry | PlaitTable) => Alignment;
32
+ export declare const getGeometryAlign: (board: PlaitBoard, element: PlaitCommonGeometry | PlaitBaseTable) => Alignment;
@@ -1,8 +1,8 @@
1
1
  import { PlaitBoard, Point, RectangleClient, ThemeColorMode } from '@plait/core';
2
2
  import { GeometryShapes, BasicShapes, PlaitGeometry, FlowchartSymbols, UMLSymbols } from '../interfaces/geometry';
3
- import { Alignment, CustomText } from '@plait/text';
4
3
  import { Element } from 'slate';
5
4
  import { DrawPointerType } from '../constants';
5
+ import { Alignment, CustomText } from '@plait/common';
6
6
  import { Options } from 'roughjs/bin/core';
7
7
  import { PlaitShapeElement } from '../interfaces';
8
8
  import { PlaitDrawShapeText } from '../generators/text.generator';
@@ -64,6 +64,9 @@ export declare const getDefaultUMLProperty: (shape: UMLSymbols) => {
64
64
  } | {
65
65
  width: number;
66
66
  height: number;
67
+ } | {
68
+ width: number;
69
+ height: number;
67
70
  } | {
68
71
  width: number;
69
72
  height: number;
@@ -84,6 +87,18 @@ export declare const getDefaultUMLProperty: (shape: UMLSymbols) => {
84
87
  } | {
85
88
  width: number;
86
89
  height: number;
90
+ } | {
91
+ width: number;
92
+ height: number;
93
+ } | {
94
+ width: number;
95
+ height: number;
96
+ } | {
97
+ width: number;
98
+ height: number;
99
+ } | {
100
+ width: number;
101
+ height: number;
87
102
  } | {
88
103
  width: number;
89
104
  height: number;
package/utils/index.d.ts CHANGED
@@ -8,3 +8,6 @@ export * from './hit';
8
8
  export * from './memorize';
9
9
  export * from './common';
10
10
  export * from './snap-resizing';
11
+ export * from './table';
12
+ export * from './table-selected';
13
+ export * from './swimlane';
@@ -1,11 +1,9 @@
1
1
  import { PlaitBoard, PlaitElement } from '@plait/core';
2
- import { PlaitDrawElement, PlaitGeometry, PlaitLine } from '../interfaces';
2
+ import { PlaitDrawElement, PlaitGeometry, PlaitLine, PlaitSwimlane } from '../interfaces';
3
3
  import { PlaitImage } from '../interfaces/image';
4
- import { PlaitTable } from '../interfaces/table';
5
4
  export declare const getSelectedDrawElements: (board: PlaitBoard, elements?: PlaitElement[]) => PlaitDrawElement[];
6
5
  export declare const getSelectedGeometryElements: (board: PlaitBoard) => PlaitGeometry[];
7
6
  export declare const getSelectedLineElements: (board: PlaitBoard) => PlaitLine[];
8
7
  export declare const getSelectedImageElements: (board: PlaitBoard) => PlaitImage[];
9
8
  export declare const isSingleSelectSwimlane: (board: PlaitBoard) => boolean;
10
- export declare const isSingleSelectTable: (board: PlaitBoard) => boolean;
11
- export declare const getSelectedTableElements: (board: PlaitBoard, elements?: PlaitElement[]) => PlaitTable[];
9
+ export declare const getSelectedSwimlane: (board: PlaitBoard) => PlaitSwimlane;
package/utils/shape.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  import { PlaitShapeElement, TableSymbols } from '../interfaces';
2
- export declare const getElementShape: (value: PlaitShapeElement) => import("../interfaces").GeometryShapes | TableSymbols.table;
2
+ export declare const getElementShape: (value: PlaitShapeElement) => import("../interfaces").GeometryShapes | TableSymbols.table | import("../interfaces").SwimlaneSymbols;
@@ -1,12 +1,12 @@
1
1
  import { Point } from '@plait/core';
2
- import { DrawPointerType } from '../constants';
3
- import { PlaitSwimlane, SwimlaneSymbols } from '../interfaces';
2
+ import { PlaitSwimlane, PlaitTableCell, SwimlaneDrawSymbols, SwimlaneSymbols } from '../interfaces';
4
3
  export declare function buildSwimlaneTable(element: PlaitSwimlane): {
5
4
  [x: string]: any;
5
+ type: "swimlane";
6
6
  shape: SwimlaneSymbols;
7
+ header?: boolean | undefined;
7
8
  id: string;
8
9
  points: Point[];
9
- type: "table";
10
10
  rows: {
11
11
  id: string;
12
12
  height?: number | undefined;
@@ -15,32 +15,14 @@ export declare function buildSwimlaneTable(element: PlaitSwimlane): {
15
15
  id: string;
16
16
  width?: number | undefined;
17
17
  }[];
18
- cells: import("../interfaces/table").PlaitTableCell[];
18
+ cells: PlaitTableCell[];
19
19
  groupId?: string | undefined;
20
20
  children?: import("@plait/core").PlaitElement[] | undefined;
21
21
  angle?: number | undefined;
22
22
  };
23
- export declare const getDefaultSWimlanePoints: (pointer: DrawPointerType, centerPoint: Point) => [Point, Point];
24
- export declare const createDefaultSwimlane: (shape: SwimlaneSymbols, points: [Point, Point]) => {
25
- [x: string]: any;
26
- shape: SwimlaneSymbols;
27
- id: string;
28
- points: Point[];
29
- type: "table";
30
- rows: {
31
- id: string;
32
- height?: number | undefined;
33
- }[];
34
- columns: {
35
- id: string;
36
- width?: number | undefined;
37
- }[];
38
- cells: import("../interfaces/table").PlaitTableCell[];
39
- groupId?: string | undefined;
40
- children?: import("@plait/core").PlaitElement[] | undefined;
41
- angle?: number | undefined;
42
- };
43
- export declare const createDefaultRowsOrColumns: (shape: SwimlaneSymbols, type: 'row' | 'column') => {
23
+ export declare const getDefaultSwimlanePoints: (pointer: SwimlaneDrawSymbols, centerPoint: Point) => [Point, Point];
24
+ export declare const createDefaultSwimlane: (shape: SwimlaneDrawSymbols, points: [Point, Point]) => PlaitSwimlane;
25
+ export declare const createDefaultRowsOrColumns: (shape: SwimlaneSymbols, type: 'row' | 'column', header: boolean) => {
44
26
  id: string;
45
27
  }[];
46
28
  export declare const createDefaultCells: (shape: SwimlaneSymbols, rows: {
@@ -49,4 +31,7 @@ export declare const createDefaultCells: (shape: SwimlaneSymbols, rows: {
49
31
  }[], columns: {
50
32
  id: string;
51
33
  width?: number;
52
- }[]) => any[];
34
+ }[], header: boolean) => PlaitTableCell[];
35
+ export declare const getSwimlaneCount: (swimlane: PlaitSwimlane) => number;
36
+ export declare const isSwimlaneWithHeader: (shape: SwimlaneDrawSymbols) => boolean;
37
+ export declare const adjustSwimlaneShape: (shape: SwimlaneDrawSymbols) => SwimlaneSymbols;
@@ -0,0 +1,9 @@
1
+ import { PlaitBoard, PlaitElement } from '@plait/core';
2
+ import { PlaitTableCell, PlaitBaseTable, PlaitTable } from '../interfaces/table';
3
+ export declare const isSingleSelectTable: (board: PlaitBoard) => boolean;
4
+ export declare const isSingleSelectElementByTable: (board: PlaitBoard) => boolean;
5
+ export declare const getSelectedTableElements: (board: PlaitBoard, elements?: PlaitElement[]) => PlaitTable[];
6
+ export declare const SELECTED_CELLS: WeakMap<PlaitBaseTable, PlaitTableCell[]>;
7
+ export declare function getSelectedCells(element: PlaitBaseTable): PlaitTableCell[] | undefined;
8
+ export declare function setSelectedCells(element: PlaitBaseTable, cells: PlaitTableCell[]): WeakMap<PlaitBaseTable, PlaitTableCell[]>;
9
+ export declare function clearSelectedCells(element: PlaitBaseTable): boolean;
package/utils/table.d.ts CHANGED
@@ -1,19 +1,18 @@
1
- import { PlaitBoard, Point } from '@plait/core';
2
- import { PlaitTable, PlaitTableCell, PlaitTableCellWithPoints } from '../interfaces/table';
3
- import { PlaitTableBoard } from '../plugins/with-table';
4
- export declare function getCellsWithPoints(board: PlaitBoard, element: PlaitTable): PlaitTableCellWithPoints[];
5
- export declare function getCellWithPoints(board: PlaitBoard, table: PlaitTable, cellId: string): PlaitTableCellWithPoints;
6
- export declare function getHitCell(board: PlaitTableBoard, element: PlaitTable, point: Point): PlaitTableCell | null | undefined;
1
+ import { PlaitBoard, Point, RectangleClient } from '@plait/core';
2
+ import { PlaitBaseTable, PlaitTable, PlaitTableBoard, PlaitTableCell, PlaitTableCellWithPoints } from '../interfaces/table';
3
+ export declare function getCellsWithPoints(board: PlaitBoard, element: PlaitBaseTable): PlaitTableCellWithPoints[];
4
+ export declare function getCellWithPoints(board: PlaitBoard, table: PlaitBaseTable, cellId: string): PlaitTableCellWithPoints;
5
+ export declare function getHitCell(board: PlaitTableBoard, element: PlaitBaseTable, point: Point): PlaitTableCell | null | undefined;
7
6
  export declare function editCell(cell: PlaitTableCell): void;
8
- export declare function getTextManageByCell(cell: PlaitTableCell): import("@plait/text").TextManage | undefined;
9
- export declare const updateColumns: (table: PlaitTable, columnId: string, width: number, offset: number) => {
7
+ export declare function getTextManageByCell(cell: PlaitTableCell): import("@plait/common").TextManage | undefined;
8
+ export declare const updateColumns: (table: PlaitBaseTable, columnId: string, width: number, offset: number) => {
10
9
  columns: {
11
10
  id: string;
12
11
  width?: number | undefined;
13
12
  }[];
14
13
  points: Point[];
15
14
  };
16
- export declare const updateRows: (table: PlaitTable, rowId: string, height: number, offset: number) => {
15
+ export declare const updateRows: (table: PlaitBaseTable, rowId: string, height: number, offset: number) => {
17
16
  rows: {
18
17
  id: string;
19
18
  height?: number | undefined;
@@ -24,3 +23,5 @@ export declare function updateCellIdsByRowOrColumn(cells: PlaitTableCell[], oldI
24
23
  export declare function updateRowOrColumnIds(element: PlaitTable, type: 'row' | 'column'): void;
25
24
  export declare function updateCellIds(cells: PlaitTableCell[]): void;
26
25
  export declare function isCellIncludeText(cell: PlaitTableCell): number | undefined;
26
+ export declare function getCellsRectangle(board: PlaitTableBoard, element: PlaitTable, cells: PlaitTableCell[]): RectangleClient;
27
+ export declare const createCell: (rowId: string, columnId: string, text?: string | null) => PlaitTableCell;
@@ -1 +0,0 @@
1
- export declare const DEFAULT_TEXT_HEIGHT = 20;
@@ -1,2 +0,0 @@
1
- export const DEFAULT_TEXT_HEIGHT = 20;
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHJhdy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3BhY2thZ2VzL2RyYXcvc3JjL2NvbnN0YW50cy9kcmF3LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE1BQU0sQ0FBQyxNQUFNLG1CQUFtQixHQUFHLEVBQUUsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBERUZBVUxUX1RFWFRfSEVJR0hUID0gMjA7XG4iXX0=