@plait/draw 0.62.0-next.4 → 0.62.0-next.5.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 (41) hide show
  1. package/esm2022/constants/geometry.mjs +3 -3
  2. package/esm2022/engines/basic-shapes/ellipse.mjs +5 -3
  3. package/esm2022/engines/basic-shapes/round-comment.mjs +5 -3
  4. package/esm2022/engines/flowchart/note-curly-left.mjs +2 -2
  5. package/esm2022/engines/flowchart/note-curly-right.mjs +7 -7
  6. package/esm2022/engines/flowchart/note-square.mjs +2 -2
  7. package/esm2022/engines/flowchart/or.mjs +5 -3
  8. package/esm2022/engines/flowchart/summing-junction.mjs +5 -3
  9. package/esm2022/engines/table/table.mjs +48 -26
  10. package/esm2022/engines/uml/deletion.mjs +3 -2
  11. package/esm2022/engines/uml/required-interface.mjs +3 -2
  12. package/esm2022/interfaces/index.mjs +6 -3
  13. package/esm2022/line.component.mjs +5 -3
  14. package/esm2022/plugins/with-draw-resize.mjs +11 -4
  15. package/esm2022/plugins/with-draw.mjs +10 -3
  16. package/esm2022/plugins/with-geometry-resize.mjs +1 -1
  17. package/esm2022/plugins/with-line-text.mjs +4 -3
  18. package/esm2022/plugins/with-swimlane.mjs +1 -20
  19. package/esm2022/plugins/with-table.mjs +34 -7
  20. package/esm2022/table.component.mjs +3 -3
  21. package/esm2022/transforms/index.mjs +5 -4
  22. package/esm2022/transforms/swimlane.mjs +1 -29
  23. package/esm2022/transforms/table-text.mjs +5 -5
  24. package/esm2022/transforms/table.mjs +30 -0
  25. package/esm2022/utils/hit.mjs +54 -31
  26. package/esm2022/utils/memorize.mjs +1 -2
  27. package/esm2022/utils/style/stroke.mjs +2 -2
  28. package/esm2022/utils/swimlane.mjs +11 -5
  29. package/esm2022/utils/table-selected.mjs +3 -4
  30. package/esm2022/utils/table.mjs +28 -5
  31. package/fesm2022/plait-draw.mjs +278 -166
  32. package/fesm2022/plait-draw.mjs.map +1 -1
  33. package/package.json +1 -1
  34. package/plugins/with-swimlane.d.ts +1 -2
  35. package/transforms/index.d.ts +2 -2
  36. package/transforms/swimlane.d.ts +1 -3
  37. package/transforms/table-text.d.ts +2 -3
  38. package/transforms/table.d.ts +3 -0
  39. package/utils/hit.d.ts +5 -2
  40. package/utils/swimlane.d.ts +1 -1
  41. package/utils/table.d.ts +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plait/draw",
3
- "version": "0.62.0-next.4",
3
+ "version": "0.62.0-next.5.1",
4
4
  "peerDependencies": {
5
5
  "is-hotkey": "^0.2.0"
6
6
  },
@@ -1,3 +1,2 @@
1
- import { PlaitBoard } from '@plait/core';
2
1
  import { PlaitTableBoard } from '../interfaces/table';
3
- export declare const withSwimlane: (board: PlaitTableBoard) => PlaitBoard;
2
+ export declare const withSwimlane: (board: PlaitTableBoard) => import("@plait/core").PlaitBoard;
@@ -14,11 +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("@plait/draw").PlaitTable, cellId: string, text: import("slate").BaseElement, textWidth: number, textHeight: number) => void;
17
+ setTableText: (board: import("@plait/core").PlaitBoard, path: import("@plait/core").Path, cellId: string, text: import("slate").BaseElement, textHeight: number) => void;
18
18
  addSwimlaneRow: (board: import("@plait/core").PlaitBoard, swimlane: import("@plait/draw").PlaitSwimlane, index: number, count?: number) => void;
19
19
  addSwimlaneColumn: (board: import("@plait/core").PlaitBoard, swimlane: import("@plait/draw").PlaitSwimlane, index: number, count?: number) => void;
20
20
  removeSwimlaneRow: (board: import("@plait/core").PlaitBoard, swimlane: import("@plait/draw").PlaitSwimlane, index: number, count?: number) => void;
21
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
22
  updateSwimlaneCount: (board: import("@plait/core").PlaitBoard, swimlane: import("@plait/draw").PlaitSwimlane, count: number) => void;
23
+ setTableFill: (board: import("@plait/core").PlaitBoard, element: import("@plait/draw").PlaitBaseTable, fill: string, path: import("@plait/core").Path) => void;
24
24
  };
@@ -1,9 +1,7 @@
1
- import { Path, PlaitBoard } from '@plait/core';
1
+ import { PlaitBoard } from '@plait/core';
2
2
  import { PlaitSwimlane } from '../interfaces';
3
- import { PlaitBaseTable } from '../interfaces/table';
4
3
  export declare const updateSwimlaneCount: (board: PlaitBoard, swimlane: PlaitSwimlane, count: number) => void;
5
4
  export declare const addSwimlaneRow: (board: PlaitBoard, swimlane: PlaitSwimlane, index: number, count?: number) => void;
6
5
  export declare const addSwimlaneColumn: (board: PlaitBoard, swimlane: PlaitSwimlane, index: number, count?: number) => void;
7
6
  export declare const removeSwimlaneRow: (board: PlaitBoard, swimlane: PlaitSwimlane, index: number, count?: number) => void;
8
7
  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,4 +1,3 @@
1
- import { PlaitBoard } from '@plait/core';
1
+ import { Path, PlaitBoard } from '@plait/core';
2
2
  import { Element } from 'slate';
3
- import { PlaitTable } from '../interfaces/table';
4
- export declare const setTableText: (board: PlaitBoard, table: PlaitTable, cellId: string, text: Element, textWidth: number, textHeight: number) => void;
3
+ export declare const setTableText: (board: PlaitBoard, path: Path, cellId: string, text: Element, textHeight: number) => void;
@@ -0,0 +1,3 @@
1
+ import { Path, PlaitBoard } from '@plait/core';
2
+ import { PlaitBaseTable } from '../interfaces';
3
+ export declare const setTableFill: (board: PlaitBoard, element: PlaitBaseTable, fill: string, path: Path) => void;
package/utils/hit.d.ts CHANGED
@@ -1,12 +1,15 @@
1
1
  import { PlaitElement, RectangleClient, Selection, PlaitBoard, Point } from '@plait/core';
2
- import { PlaitCommonGeometry, PlaitGeometry, PlaitLine, PlaitShapeElement } from '../interfaces';
2
+ import { PlaitCommonGeometry, PlaitDrawElement, PlaitGeometry, PlaitLine, PlaitShapeElement } from '../interfaces';
3
3
  export declare const isTextExceedingBounds: (geometry: PlaitGeometry) => boolean;
4
4
  export declare const isHitLineText: (board: PlaitBoard, element: PlaitLine, point: Point) => boolean;
5
5
  export declare const isHitPolyLine: (pathPoints: Point[], point: Point) => boolean;
6
6
  export declare const isHitLine: (board: PlaitBoard, element: PlaitLine, point: Point) => boolean;
7
- export declare const isHitElementText: (element: PlaitCommonGeometry, point: Point) => boolean;
8
7
  export declare const isRectangleHitElementText: (element: PlaitCommonGeometry, rectangle: RectangleClient) => boolean;
8
+ export declare const isHitElementText: (element: PlaitCommonGeometry, point: Point) => boolean;
9
9
  export declare const isRectangleHitDrawElement: (board: PlaitBoard, element: PlaitElement, selection: Selection) => boolean | null;
10
+ export declare const getDrawHitElement: (board: PlaitBoard, elements: PlaitDrawElement[]) => PlaitElement;
11
+ export declare const getFirstFilledDrawElement: (board: PlaitBoard, elements: PlaitDrawElement[]) => PlaitGeometry | null;
12
+ export declare const getFirstTextOrLineElement: (elements: PlaitDrawElement[]) => PlaitGeometry | import("../interfaces").PlaitBaseTable | import("../interfaces/image").PlaitImage | PlaitLine | null;
10
13
  export declare const isHitDrawElement: (board: PlaitBoard, element: PlaitElement, point: Point) => boolean | null;
11
14
  export declare const isHitEdgeOfShape: (board: PlaitBoard, element: PlaitShapeElement, point: Point, hitDistanceBuffer: number) => boolean;
12
15
  export declare const isInsideOfShape: (board: PlaitBoard, element: PlaitShapeElement, point: Point, hitDistanceBuffer: number) => boolean;
@@ -22,7 +22,7 @@ export declare function buildSwimlaneTable(element: PlaitSwimlane): {
22
22
  };
23
23
  export declare const getDefaultSwimlanePoints: (pointer: SwimlaneDrawSymbols, centerPoint: Point) => [Point, Point];
24
24
  export declare const createDefaultSwimlane: (shape: SwimlaneDrawSymbols, points: [Point, Point]) => PlaitSwimlane;
25
- export declare const createDefaultRowsOrColumns: (shape: SwimlaneSymbols, type: 'row' | 'column', header: boolean) => {
25
+ export declare const createDefaultRowsOrColumns: (shape: SwimlaneSymbols, type: 'row' | 'column', header: boolean, size: number) => {
26
26
  id: string;
27
27
  }[];
28
28
  export declare const createDefaultCells: (shape: SwimlaneSymbols, rows: {
package/utils/table.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { PlaitBoard, Point, RectangleClient } from '@plait/core';
2
2
  import { PlaitBaseTable, PlaitTable, PlaitTableBoard, PlaitTableCell, PlaitTableCellWithPoints } from '../interfaces/table';
3
+ import { BaseEditor } from 'slate';
3
4
  export declare function getCellsWithPoints(board: PlaitBoard, element: PlaitBaseTable): PlaitTableCellWithPoints[];
4
5
  export declare function getCellWithPoints(board: PlaitBoard, table: PlaitBaseTable, cellId: string): PlaitTableCellWithPoints;
5
6
  export declare function getHitCell(board: PlaitTableBoard, element: PlaitBaseTable, point: Point): PlaitTableCell | null | undefined;
@@ -25,3 +26,4 @@ export declare function updateCellIds(cells: PlaitTableCell[]): void;
25
26
  export declare function isCellIncludeText(cell: PlaitTableCell): number | undefined;
26
27
  export declare function getCellsRectangle(board: PlaitTableBoard, element: PlaitTable, cells: PlaitTableCell[]): RectangleClient;
27
28
  export declare const createCell: (rowId: string, columnId: string, text?: string | null) => PlaitTableCell;
29
+ export declare const getSelectedTableCellsEditor: (board: PlaitBoard) => BaseEditor[] | undefined;