@conboai/storybook.components 0.5.67 → 0.5.68
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.
- package/dist/components/Shapes/CrossLineArrow/index.d.ts +18 -0
- package/dist/components/Shapes/CrossLineArrow/types.d.ts +7 -0
- package/dist/components/Shapes/CrossLineArrow/useDirectionState.d.ts +3 -0
- package/dist/components/Shapes/CrossLineArrow/utils.d.ts +5 -0
- package/dist/components/Shapes/Menu/styles.d.ts +2 -2
- package/dist/components/Shapes/Menu/types.d.ts +1 -1
- package/dist/components/Shapes/MousePoint/index.d.ts +5 -1
- package/dist/components/Shapes/Shapes.d.ts +2 -2
- package/dist/components/Shapes/constants.d.ts +1 -0
- package/dist/components/Shapes/types.d.ts +12 -2
- package/dist/components/Shapes/utils.d.ts +5 -2
- package/dist/storybook.components.mjs +23324 -23216
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface Point {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}
|
|
7
|
+
interface ICrossLineArrowProps {
|
|
8
|
+
points: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
}[];
|
|
12
|
+
rect: DOMRect | null;
|
|
13
|
+
color: string;
|
|
14
|
+
onClick: () => void;
|
|
15
|
+
direction?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare const CrossLineArrow: FC<ICrossLineArrowProps>;
|
|
18
|
+
export {};
|
|
@@ -4,7 +4,7 @@ export declare const defaultStyle: {
|
|
|
4
4
|
color: string;
|
|
5
5
|
borderRadius: string;
|
|
6
6
|
border: string;
|
|
7
|
-
|
|
7
|
+
"&:hover": {
|
|
8
8
|
backgroundColor: string;
|
|
9
9
|
cursor: string;
|
|
10
10
|
color: string;
|
|
@@ -14,7 +14,7 @@ export declare const disabledStyle: {
|
|
|
14
14
|
color: string;
|
|
15
15
|
opacity: number;
|
|
16
16
|
backgroundColor: string;
|
|
17
|
-
|
|
17
|
+
"&:hover": {
|
|
18
18
|
cursor: string;
|
|
19
19
|
filter: string;
|
|
20
20
|
};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { Point } from '../types';
|
|
3
3
|
|
|
4
|
-
export declare const MousePoint: ({ coordinates, rect, isInFov }: {
|
|
4
|
+
export declare const MousePoint: ({ coordinates, rect, isInFov, styles }: {
|
|
5
5
|
coordinates: Point;
|
|
6
6
|
rect: DOMRect | null;
|
|
7
7
|
isInFov?: boolean;
|
|
8
|
+
styles?: {
|
|
9
|
+
fill?: string;
|
|
10
|
+
stroke?: string;
|
|
11
|
+
};
|
|
8
12
|
}) => React.JSX.Element | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IShapesProps } from './types';
|
|
2
1
|
import { default as React } from 'react';
|
|
2
|
+
import { IShapesProps } from './types';
|
|
3
3
|
|
|
4
|
-
declare const Shapes: ({ children, mode: modeFromProps, onModeChange: _onModeChange, shapes: shapesFromProps, selected, onShapeChange, onShapeSelect, onMouseMove, menu, showNumbers, showId, showOnlyPoints, showPoints, showDirection, selectedShapeZIndex, styles,
|
|
4
|
+
declare const Shapes: ({ children, mode: modeFromProps, onModeChange: _onModeChange, shapes: shapesFromProps, selected: selectedShapeFromProps, onShapeChange, onShapeSelect, onMouseMove, menu, showNumbers, showId, showOnlyPoints, showPoints, showDirection, selectedShapeZIndex, snapToBoundaries, styles, polygonMaxLength, polylineMaxLength, polylineProps }: IShapesProps) => React.JSX.Element;
|
|
5
5
|
export default Shapes;
|
|
@@ -12,14 +12,21 @@ export declare enum ShapeType {
|
|
|
12
12
|
export declare enum ShapeMode {
|
|
13
13
|
View = 0,
|
|
14
14
|
Edit = 1,
|
|
15
|
-
CreatePolygon = 2
|
|
15
|
+
CreatePolygon = 2,
|
|
16
|
+
CreatePolyline = 3
|
|
16
17
|
}
|
|
17
18
|
export interface Shape {
|
|
18
19
|
id: string;
|
|
20
|
+
name?: string;
|
|
19
21
|
type: ShapeType;
|
|
22
|
+
isCompleted?: boolean;
|
|
20
23
|
points: Point[];
|
|
21
24
|
isInFov?: boolean;
|
|
22
25
|
styles?: Record<string, any>;
|
|
26
|
+
crossLine?: {
|
|
27
|
+
direction: number;
|
|
28
|
+
isBidirectional: boolean;
|
|
29
|
+
};
|
|
23
30
|
header?: {
|
|
24
31
|
text: string;
|
|
25
32
|
};
|
|
@@ -39,15 +46,18 @@ export interface IShapesProps {
|
|
|
39
46
|
delete: boolean;
|
|
40
47
|
};
|
|
41
48
|
};
|
|
42
|
-
onShapeChange?: <T extends Shape>(updatedShape: T | null, updatedShapesList: T[]) => void;
|
|
49
|
+
onShapeChange?: <T extends Shape>(updatedShape: T | null, updatedShapesList: T[], rect?: DOMRect) => void;
|
|
43
50
|
onShapeSelect?: <T extends Shape>(selectedShape: T | null, shapesList: T[]) => void;
|
|
44
51
|
onMouseMove?: (mousePoint: Point) => void;
|
|
45
52
|
showDirection?: boolean;
|
|
46
53
|
showNumbers?: boolean;
|
|
47
54
|
showOnlyPoints?: boolean;
|
|
48
55
|
selectedShapeZIndex?: boolean;
|
|
56
|
+
snapToBoundaries?: boolean;
|
|
49
57
|
showPoints?: boolean;
|
|
50
58
|
styles?: any;
|
|
59
|
+
polygonMaxLength?: number;
|
|
60
|
+
polylineMaxLength?: number;
|
|
51
61
|
polylineProps?: {
|
|
52
62
|
startMarkerLabel?: string;
|
|
53
63
|
endMarkerLabel?: string;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { Point, Shape } from './types';
|
|
2
2
|
|
|
3
3
|
export declare const generateRainbowColor: (id: string, total: number) => string;
|
|
4
|
+
export declare const _snapToBoundaries: (point: Point, threshold?: number) => Point;
|
|
4
5
|
export declare const toNormalizedCoords: (x: number, y: number, rect: DOMRect) => Point;
|
|
5
6
|
export declare const toPixelCoords: (x: number, y: number, rect: DOMRect) => Point;
|
|
6
7
|
export declare const calculateCoordinates: (points: Point[], rect: DOMRect | null) => string | undefined;
|
|
7
|
-
export declare const
|
|
8
|
+
export declare const getLineOrientation: (p1: Point, p2: Point, rect: DOMRect) => "horizontal" | "vertical";
|
|
9
|
+
export declare const isPointNearTargetPoint: (point: Point, targetPoint: Point, threshold?: number) => boolean;
|
|
8
10
|
export declare const calculateDistanceToSegment: (point: Point, segmentStart: Point, segmentEnd: Point) => number;
|
|
9
11
|
export declare const shapePointsToArray: (shapePoints: Point[]) => Array<[number, number]>;
|
|
10
|
-
export declare const arrayToShapePoints: (pixelsList?:
|
|
12
|
+
export declare const arrayToShapePoints: (pixelsList?: number[][] | undefined) => Point[];
|
|
11
13
|
export declare const getAspectRatio: (width?: number, height?: number) => string;
|
|
12
14
|
export declare const calculateArea: (polygon: Shape) => number;
|
|
13
15
|
export declare const findClickedShapes: (clickX: number, clickY: number, shapes: Shape[], svgRect: DOMRect) => Shape[];
|
|
@@ -15,3 +17,4 @@ export declare const findSmallestShape: (shapes: Shape[]) => Shape;
|
|
|
15
17
|
export declare function sortPolygonsByArea(polygons: Shape[]): Shape[];
|
|
16
18
|
export declare const removeSamePoint: (coordinates?: Point[]) => Point[];
|
|
17
19
|
export declare const pointInPolygon: (polygon: Point[], point: Point) => boolean;
|
|
20
|
+
export declare const getPolygonCenter: (points?: Point[]) => Point;
|