@plait/draw 0.72.0 → 0.74.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.
@@ -1,11 +1,9 @@
1
1
  import { ParagraphElement, TextManage, TextManageChangeData } from '@plait/common';
2
2
  import { PlaitBoard, PlaitElement, RectangleClient } from '@plait/core';
3
- import { DrawShapes, EngineExtraData, PlaitGeometry } from '../interfaces';
4
- export interface DrawTextInfo extends EngineExtraData {
5
- id: string;
3
+ import { DrawShapes, PlaitGeometry, TextRectangleOptions } from '../interfaces';
4
+ export interface DrawTextInfo extends TextRectangleOptions {
6
5
  text: ParagraphElement;
7
6
  textHeight: number;
8
- board?: PlaitBoard;
9
7
  }
10
8
  export interface TextGeneratorOptions<T> {
11
9
  onChange: (element: T, textChangeRef: TextManageChangeData, text: DrawTextInfo) => void;
@@ -1,9 +1,14 @@
1
1
  import { RectangleClient, PointOfRectangle, Vector, PlaitBoard, Point, PlaitElement } from '@plait/core';
2
2
  import { Options } from 'roughjs/bin/core';
3
3
  import { PlaitGeometry } from './geometry';
4
- export interface EngineExtraData {
4
+ export interface DrawOptions {
5
+ element: PlaitElement;
5
6
  }
6
- export interface ShapeEngine<T extends PlaitElement = PlaitGeometry, P extends EngineExtraData = EngineExtraData, K extends EngineExtraData = EngineExtraData> {
7
+ export interface TextRectangleOptions {
8
+ id: string;
9
+ board?: PlaitBoard;
10
+ }
11
+ export interface ShapeEngine<T extends PlaitElement = PlaitGeometry, P extends DrawOptions = DrawOptions, K extends TextRectangleOptions = TextRectangleOptions> {
7
12
  isInsidePoint: (rectangle: RectangleClient, point: Point) => boolean;
8
13
  getNearestPoint: (rectangle: RectangleClient, point: Point) => Point;
9
14
  getNearestCrossingPoint?: (rectangle: RectangleClient, point: Point) => Point;
@@ -1,6 +1,6 @@
1
1
  import { PlaitBoard, PlaitElement, Point } from '@plait/core';
2
- import { EngineExtraData } from './engine';
3
2
  import { ParagraphElement } from '@plait/common';
3
+ import { DrawOptions } from './engine';
4
4
  export declare enum TableSymbols {
5
5
  table = "table"
6
6
  }
@@ -34,7 +34,7 @@ export interface PlaitTableCell {
34
34
  textHeight?: number;
35
35
  fill?: string;
36
36
  }
37
- export interface PlaitTableDrawOptions extends EngineExtraData {
37
+ export interface PlaitTableDrawOptions extends DrawOptions {
38
38
  element: PlaitTable;
39
39
  }
40
40
  export interface PlaitTableCellWithPoints extends PlaitTableCell {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plait/draw",
3
- "version": "0.72.0",
3
+ "version": "0.74.0",
4
4
  "peerDependencies": {},
5
5
  "dependencies": {
6
6
  "tslib": "^2.3.0"
package/utils/common.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PlaitBoard, PlaitElement, Point, RectangleClient } from '@plait/core';
2
- import { DrawShapes, EngineExtraData, PlaitBaseGeometry, PlaitCommonGeometry, PlaitCustomGeometry, PlaitDrawElement, PlaitGeometry, PlaitShapeElement } from '../interfaces';
2
+ import { DrawOptions, DrawShapes, PlaitBaseGeometry, PlaitCommonGeometry, PlaitCustomGeometry, PlaitDrawElement, PlaitGeometry, PlaitShapeElement } from '../interfaces';
3
3
  import { Alignment } from '@plait/common';
4
4
  import { Options } from 'roughjs/bin/core';
5
5
  import { PlaitBaseTable } from '../interfaces/table';
@@ -25,7 +25,7 @@ export declare const getSnappingRef: (board: PlaitBoard, hitElement: PlaitShapeE
25
25
  };
26
26
  export declare const getHitShape: (board: PlaitBoard, point: Point, offset?: number) => PlaitShapeElement | null;
27
27
  export declare const traverseDrawShapes: (board: PlaitBoard, callback: (element: PlaitShapeElement) => void) => void;
28
- export declare const drawShape: (board: PlaitBoard, outerRectangle: RectangleClient, shape: DrawShapes, roughOptions: Options, drawOptions: EngineExtraData) => SVGGElement;
28
+ export declare const drawShape: (board: PlaitBoard, outerRectangle: RectangleClient, shape: DrawShapes, roughOptions: Options, drawOptions?: DrawOptions) => SVGGElement;
29
29
  export declare const drawBoundReaction: (board: PlaitBoard, element: PlaitShapeElement, roughOptions?: {
30
30
  hasMask: boolean;
31
31
  hasConnector: boolean;
@@ -126,7 +126,7 @@ export declare const createDefaultFlowchart: (point: Point) => (PlaitGeometry |
126
126
  export declare const getAutoCompletePoints: (element: PlaitShapeElement) => [Point, Point, Point, Point];
127
127
  export declare const getHitIndexOfAutoCompletePoint: (movingPoint: Point, points: Point[]) => number;
128
128
  export declare const getDrawDefaultStrokeColor: (theme: ThemeColorMode) => string;
129
- export declare const getDefaultFill: (theme: ThemeColorMode) => string;
129
+ export declare const getFlowchartDefaultFill: (theme: ThemeColorMode) => string;
130
130
  export declare const getTextShapeProperty: (board: PlaitBoard, text?: string | Element, fontSize?: number | string) => {
131
131
  width: number;
132
132
  height: number;