@plait/common 0.90.1 → 0.92.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.
- package/index.d.ts +605 -3
- package/package.json +1 -1
- package/algorithms/a-star.d.ts +0 -10
- package/algorithms/data-structures/graph.d.ts +0 -14
- package/algorithms/data-structures/index.d.ts +0 -2
- package/algorithms/data-structures/priority-queue.d.ts +0 -16
- package/algorithms/index.d.ts +0 -2
- package/constants/default.d.ts +0 -10
- package/constants/index.d.ts +0 -4
- package/constants/media.d.ts +0 -6
- package/constants/property.d.ts +0 -5
- package/constants/resize.d.ts +0 -10
- package/core/element-flavour.d.ts +0 -5
- package/core/element-ref.d.ts +0 -13
- package/core/group.component.d.ts +0 -12
- package/core/index.d.ts +0 -4
- package/core/render-component.d.ts +0 -4
- package/generators/active.generator.d.ts +0 -22
- package/generators/generator.d.ts +0 -27
- package/generators/group.generator.d.ts +0 -7
- package/generators/index.d.ts +0 -3
- package/image/image-base.component.d.ts +0 -9
- package/image/image.generator.d.ts +0 -26
- package/image/index.d.ts +0 -3
- package/image/with-image.d.ts +0 -15
- package/plugins/index.d.ts +0 -2
- package/plugins/with-group.d.ts +0 -2
- package/plugins/with-resize.d.ts +0 -4
- package/public-api.d.ts +0 -12
- package/shapes/common.d.ts +0 -2
- package/shapes/index.d.ts +0 -1
- package/text/index.d.ts +0 -4
- package/text/text-manage.d.ts +0 -42
- package/text/text-measure.d.ts +0 -15
- package/text/types.d.ts +0 -28
- package/text/with-text.d.ts +0 -25
- package/transforms/align.d.ts +0 -20
- package/transforms/index.d.ts +0 -2
- package/transforms/property.d.ts +0 -14
- package/types/index.d.ts +0 -2
- package/types/resize.d.ts +0 -34
- package/types/rotate.d.ts +0 -6
- package/utils/animate.d.ts +0 -7
- package/utils/clipboard.d.ts +0 -10
- package/utils/creation-mode.d.ts +0 -9
- package/utils/default-orthogonal-routing.d.ts +0 -2
- package/utils/direction.d.ts +0 -25
- package/utils/drawing/index.d.ts +0 -2
- package/utils/drawing/resize-handle.d.ts +0 -4
- package/utils/drawing/rotate-handle.d.ts +0 -2
- package/utils/elbow-line-route.d.ts +0 -48
- package/utils/elements.d.ts +0 -4
- package/utils/hot-key.d.ts +0 -6
- package/utils/image.d.ts +0 -11
- package/utils/index.d.ts +0 -19
- package/utils/line-path.d.ts +0 -7
- package/utils/math.d.ts +0 -3
- package/utils/memorize.d.ts +0 -3
- package/utils/point-placement.d.ts +0 -5
- package/utils/resize.d.ts +0 -28
- package/utils/rotate.d.ts +0 -6
- package/utils/stroke.d.ts +0 -2
- package/utils/text.d.ts +0 -33
- package/utils/vector.d.ts +0 -6
package/constants/index.d.ts
DELETED
package/constants/media.d.ts
DELETED
package/constants/property.d.ts
DELETED
package/constants/resize.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { ElementFlavour, PlaitBoard, PlaitElement } from '@plait/core';
|
|
2
|
-
import { PlaitCommonElementRef } from './element-ref';
|
|
3
|
-
export declare class CommonElementFlavour<T extends PlaitElement = PlaitElement, K extends PlaitBoard = PlaitBoard, R extends PlaitCommonElementRef = PlaitCommonElementRef> extends ElementFlavour<T, K, R> {
|
|
4
|
-
constructor(elementRef?: PlaitCommonElementRef);
|
|
5
|
-
}
|
package/core/element-ref.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { PlaitElementRef } from '@plait/core';
|
|
2
|
-
import { Generator } from '../generators';
|
|
3
|
-
import { TextManage } from '../text';
|
|
4
|
-
export declare class PlaitCommonElementRef implements PlaitElementRef {
|
|
5
|
-
private textManages;
|
|
6
|
-
private generatorMap;
|
|
7
|
-
addGenerator<T extends Object = Generator>(key: string, generator: T): void;
|
|
8
|
-
getGenerator<T extends Object = Generator>(key: string): T;
|
|
9
|
-
initializeTextManage(textManage: TextManage | TextManage[]): void;
|
|
10
|
-
getTextManages(): TextManage[];
|
|
11
|
-
updateActiveSection: () => void;
|
|
12
|
-
destroyTextManage(): void;
|
|
13
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { OnContextChanged, PlaitBoard, PlaitGroup, PlaitPluginElementContext } from '@plait/core';
|
|
2
|
-
import { GroupGenerator } from '../generators/group.generator';
|
|
3
|
-
import { ActiveGenerator } from '../generators';
|
|
4
|
-
import { CommonElementFlavour } from './element-flavour';
|
|
5
|
-
export declare class GroupComponent extends CommonElementFlavour<PlaitGroup, PlaitBoard> implements OnContextChanged<PlaitGroup, PlaitBoard> {
|
|
6
|
-
constructor();
|
|
7
|
-
activeGenerator: ActiveGenerator<PlaitGroup>;
|
|
8
|
-
groupGenerator: GroupGenerator;
|
|
9
|
-
initializeGenerator(): void;
|
|
10
|
-
initialize(): void;
|
|
11
|
-
onContextChanged(value: PlaitPluginElementContext<PlaitGroup, PlaitBoard>, previous: PlaitPluginElementContext<PlaitGroup, PlaitBoard>): void;
|
|
12
|
-
}
|
package/core/index.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { PlaitBoard, PlaitElement, RectangleClient } from '@plait/core';
|
|
2
|
-
import { Generator, GeneratorOptions } from './generator';
|
|
3
|
-
export interface ActiveGeneratorExtraData {
|
|
4
|
-
selected: boolean;
|
|
5
|
-
}
|
|
6
|
-
export interface ActiveGeneratorOptions<T> extends GeneratorOptions {
|
|
7
|
-
getRectangle: (element: T) => RectangleClient;
|
|
8
|
-
getStrokeWidth: () => number;
|
|
9
|
-
getStrokeOpacity: () => number;
|
|
10
|
-
hasResizeHandle: () => boolean;
|
|
11
|
-
active: true;
|
|
12
|
-
}
|
|
13
|
-
export declare const createActiveGenerator: <T extends PlaitElement = PlaitElement>(board: PlaitBoard, options: Omit<ActiveGeneratorOptions<T>, "active">) => ActiveGenerator<T>;
|
|
14
|
-
export declare class ActiveGenerator<T extends PlaitElement = PlaitElement> extends Generator<T, ActiveGeneratorExtraData, ActiveGeneratorOptions<T>> {
|
|
15
|
-
board: PlaitBoard;
|
|
16
|
-
options: ActiveGeneratorOptions<T>;
|
|
17
|
-
static key: string;
|
|
18
|
-
hasResizeHandle: boolean;
|
|
19
|
-
constructor(board: PlaitBoard, options: ActiveGeneratorOptions<T>);
|
|
20
|
-
canDraw(element: T, data: ActiveGeneratorExtraData): boolean;
|
|
21
|
-
draw(element: T, data: ActiveGeneratorExtraData): SVGGElement;
|
|
22
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { PlaitBoard, PlaitElement } from '@plait/core';
|
|
2
|
-
export interface GeneratorExtraData {
|
|
3
|
-
}
|
|
4
|
-
export interface GeneratorOptions {
|
|
5
|
-
prepend?: boolean;
|
|
6
|
-
active?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare abstract class Generator<T extends PlaitElement = PlaitElement, K extends GeneratorExtraData = GeneratorExtraData, V extends GeneratorOptions = GeneratorOptions, P extends PlaitBoard = PlaitBoard> {
|
|
9
|
-
protected board: P;
|
|
10
|
-
g?: SVGGElement;
|
|
11
|
-
protected options?: V;
|
|
12
|
-
constructor(board: P, options?: V);
|
|
13
|
-
processDrawing(element: T, parentG: SVGGElement, data?: K): void;
|
|
14
|
-
/**
|
|
15
|
-
* abstract function
|
|
16
|
-
*/
|
|
17
|
-
protected abstract canDraw(element: T, data?: K): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* abstract function
|
|
20
|
-
*/
|
|
21
|
-
protected abstract draw(element: T, data?: K): SVGGElement | undefined;
|
|
22
|
-
destroy(): void;
|
|
23
|
-
}
|
|
24
|
-
export interface AfterDraw<T extends PlaitElement = PlaitElement> {
|
|
25
|
-
afterDraw(element: T): void;
|
|
26
|
-
}
|
|
27
|
-
export declare function hasAfterDraw(value: any): value is AfterDraw;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { PlaitGroup } from '@plait/core';
|
|
2
|
-
import { Generator } from './generator';
|
|
3
|
-
export declare class GroupGenerator extends Generator<PlaitGroup> {
|
|
4
|
-
static key: string;
|
|
5
|
-
canDraw(element: PlaitGroup): boolean;
|
|
6
|
-
draw(element: PlaitGroup, partialSelected: boolean): SVGGElement;
|
|
7
|
-
}
|
package/generators/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { PlaitBoard, PlaitElement } from '@plait/core';
|
|
2
|
-
export declare abstract class ImageBaseComponent {
|
|
3
|
-
_isFocus: boolean;
|
|
4
|
-
element: PlaitElement;
|
|
5
|
-
board: PlaitBoard;
|
|
6
|
-
set isFocus(value: boolean);
|
|
7
|
-
get isFocus(): boolean;
|
|
8
|
-
abstract nativeElement(): HTMLElement;
|
|
9
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { PlaitBoard, PlaitElement, RectangleClient } from '@plait/core';
|
|
2
|
-
import { Generator, GeneratorExtraData, GeneratorOptions } from '../generators/generator';
|
|
3
|
-
import { CommonImageItem } from '../utils';
|
|
4
|
-
import { ActiveGenerator } from '../generators/active.generator';
|
|
5
|
-
import { ImageComponentRef } from './with-image';
|
|
6
|
-
export declare const FOREIGN_OBJECT_IMAGE_CLASS_NAME = "foreign-object-image";
|
|
7
|
-
export interface ImageGeneratorOptions<T> {
|
|
8
|
-
getRectangle: (element: T) => RectangleClient;
|
|
9
|
-
getImageItem: (element: T) => CommonImageItem;
|
|
10
|
-
}
|
|
11
|
-
export declare class ImageGenerator<T extends PlaitElement = PlaitElement> extends Generator<T, GeneratorExtraData, ImageGeneratorOptions<T> & GeneratorOptions> {
|
|
12
|
-
board: PlaitBoard;
|
|
13
|
-
options: ImageGeneratorOptions<T>;
|
|
14
|
-
static key: string;
|
|
15
|
-
foreignObject: SVGForeignObjectElement;
|
|
16
|
-
imageComponentRef: ImageComponentRef;
|
|
17
|
-
activeGenerator: ActiveGenerator;
|
|
18
|
-
isFocus: boolean;
|
|
19
|
-
element: T;
|
|
20
|
-
constructor(board: PlaitBoard, options: ImageGeneratorOptions<T>);
|
|
21
|
-
canDraw(element: T): boolean;
|
|
22
|
-
draw(element: T): SVGGElement;
|
|
23
|
-
updateImage(nodeG: SVGGElement, previous: T, current: T): void;
|
|
24
|
-
setFocus(element: PlaitElement, isFocus: boolean): void;
|
|
25
|
-
destroy(): void;
|
|
26
|
-
}
|
package/image/index.d.ts
DELETED
package/image/with-image.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { PlaitBoard, PlaitElement, RectangleClient } from '@plait/core';
|
|
2
|
-
import { RenderComponentRef } from '../core/render-component';
|
|
3
|
-
import { CommonImageItem } from '../utils/image';
|
|
4
|
-
export interface PlaitImageBoard {
|
|
5
|
-
renderImage: (container: Element | DocumentFragment, props: ImageProps) => ImageComponentRef;
|
|
6
|
-
}
|
|
7
|
-
export declare const withImage: <T extends PlaitBoard = PlaitBoard>(board: T) => T & PlaitImageBoard;
|
|
8
|
-
export type ImageComponentRef = RenderComponentRef<ImageProps>;
|
|
9
|
-
export interface ImageProps {
|
|
10
|
-
board: PlaitBoard;
|
|
11
|
-
imageItem: CommonImageItem;
|
|
12
|
-
element: PlaitElement;
|
|
13
|
-
isFocus?: boolean;
|
|
14
|
-
getRectangle: () => RectangleClient;
|
|
15
|
-
}
|
package/plugins/index.d.ts
DELETED
package/plugins/with-group.d.ts
DELETED
package/plugins/with-resize.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { PlaitBoard } from '@plait/core';
|
|
2
|
-
import { ResizeHandle } from '../constants/resize';
|
|
3
|
-
import { PlaitElementOrArray, ResizeOptions, WithResizeOptions } from '../types/resize';
|
|
4
|
-
export declare const withResize: <T extends PlaitElementOrArray = PlaitElementOrArray, K = ResizeHandle, P = ResizeOptions>(board: PlaitBoard, options: WithResizeOptions<T, K, P>) => PlaitBoard;
|
package/public-api.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from './constants';
|
|
2
|
-
export * from './generators';
|
|
3
|
-
export * from './transforms';
|
|
4
|
-
export * from './shapes';
|
|
5
|
-
export * from './plugins';
|
|
6
|
-
export * from './utils';
|
|
7
|
-
export * from './image/image-base.component';
|
|
8
|
-
export * from './core';
|
|
9
|
-
export * from './algorithms';
|
|
10
|
-
export * from './text';
|
|
11
|
-
export * from './image';
|
|
12
|
-
export * from './types';
|
package/shapes/common.d.ts
DELETED
package/shapes/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './common';
|
package/text/index.d.ts
DELETED
package/text/text-manage.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { PlaitBoard, Point, RectangleClient } from '@plait/core';
|
|
2
|
-
import { Editor, Element, Operation } from 'slate';
|
|
3
|
-
import { TextPlugin } from './with-text';
|
|
4
|
-
import { TextComponentRef } from './with-text';
|
|
5
|
-
export interface TextManageChangeData {
|
|
6
|
-
newText?: Element;
|
|
7
|
-
operations?: Operation[];
|
|
8
|
-
width: number;
|
|
9
|
-
height: number;
|
|
10
|
-
}
|
|
11
|
-
export declare class TextManage {
|
|
12
|
-
private board;
|
|
13
|
-
private options;
|
|
14
|
-
isEditing: boolean;
|
|
15
|
-
editor: Editor;
|
|
16
|
-
g: SVGGElement;
|
|
17
|
-
foreignObject: SVGForeignObjectElement;
|
|
18
|
-
textComponentRef: TextComponentRef;
|
|
19
|
-
exitCallback?: () => void;
|
|
20
|
-
constructor(board: PlaitBoard, options: {
|
|
21
|
-
getRectangle: () => RectangleClient;
|
|
22
|
-
onChange?: (data: TextManageChangeData) => void;
|
|
23
|
-
getRenderRectangle?: () => RectangleClient;
|
|
24
|
-
getMaxWidth?: () => number;
|
|
25
|
-
textPlugins?: TextPlugin[];
|
|
26
|
-
});
|
|
27
|
-
draw(text: Element): void;
|
|
28
|
-
updateRectangleWidth(width: number): void;
|
|
29
|
-
updateAngle(centerPoint: Point, angle?: number): void;
|
|
30
|
-
updateRectangle(rectangle?: RectangleClient): void;
|
|
31
|
-
updateText(newText: Element): void;
|
|
32
|
-
edit(callback?: () => void, exitEdit?: (event: Event) => boolean): () => void;
|
|
33
|
-
getSize: (element?: Element, maxWidth?: number) => {
|
|
34
|
-
width: number;
|
|
35
|
-
height: number;
|
|
36
|
-
};
|
|
37
|
-
getText: () => import("slate").Descendant;
|
|
38
|
-
destroy(): void;
|
|
39
|
-
}
|
|
40
|
-
export declare const buildCompositionData: (editor: Editor, data: string) => {
|
|
41
|
-
children: any[];
|
|
42
|
-
} | null;
|
package/text/text-measure.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ElementSize, ParagraphElement } from './types';
|
|
2
|
-
import { PlaitBoard } from '@plait/core';
|
|
3
|
-
export declare const getElementSize: (board: PlaitBoard | null, element: ParagraphElement, options: {
|
|
4
|
-
fontSize: number;
|
|
5
|
-
fontFamily: string;
|
|
6
|
-
}, containerMaxWidth?: number) => ElementSize;
|
|
7
|
-
export declare const updateElementSizeCache: (board: PlaitBoard | null, element: ParagraphElement, size: ElementSize) => void;
|
|
8
|
-
export declare const clearElementSizeCache: (board: PlaitBoard | null, element: ParagraphElement) => void;
|
|
9
|
-
export declare function measureElement(board: PlaitBoard | null, element: ParagraphElement, options: {
|
|
10
|
-
fontSize: number;
|
|
11
|
-
fontFamily: string;
|
|
12
|
-
}, containerMaxWidth?: number): {
|
|
13
|
-
width: number;
|
|
14
|
-
height: number;
|
|
15
|
-
};
|
package/text/types.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { BaseElement } from 'slate';
|
|
2
|
-
export type ElementSize = {
|
|
3
|
-
width: number;
|
|
4
|
-
height: number;
|
|
5
|
-
};
|
|
6
|
-
export declare enum Alignment {
|
|
7
|
-
left = "left",
|
|
8
|
-
center = "center",
|
|
9
|
-
right = "right"
|
|
10
|
-
}
|
|
11
|
-
export type CustomText = {
|
|
12
|
-
bold?: boolean;
|
|
13
|
-
italic?: boolean;
|
|
14
|
-
strike?: boolean;
|
|
15
|
-
code?: boolean;
|
|
16
|
-
text: string;
|
|
17
|
-
underlined?: boolean;
|
|
18
|
-
color?: string;
|
|
19
|
-
[`font-size`]?: string;
|
|
20
|
-
};
|
|
21
|
-
export interface LinkElement extends BaseElement {
|
|
22
|
-
type: 'link';
|
|
23
|
-
url: string;
|
|
24
|
-
}
|
|
25
|
-
export interface ParagraphElement extends BaseElement {
|
|
26
|
-
align?: Alignment;
|
|
27
|
-
}
|
|
28
|
-
export type CustomElement = ParagraphElement | LinkElement;
|
package/text/with-text.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { PlaitBoard, WithPluginOptions } from '@plait/core';
|
|
2
|
-
import { Editor, Operation, Element as SlateElement } from 'slate';
|
|
3
|
-
import { RenderComponentRef } from '../core/render-component';
|
|
4
|
-
export interface PlaitTextBoard {
|
|
5
|
-
renderText: (container: Element | DocumentFragment, props: TextProps) => TextComponentRef;
|
|
6
|
-
}
|
|
7
|
-
export declare const withText: <T extends PlaitBoard = PlaitBoard>(board: T) => T & PlaitTextBoard;
|
|
8
|
-
export type TextComponentRef = RenderComponentRef<TextProps>;
|
|
9
|
-
export interface TextProps {
|
|
10
|
-
board: PlaitBoard;
|
|
11
|
-
text: SlateElement;
|
|
12
|
-
textPlugins?: TextPlugin[];
|
|
13
|
-
readonly?: boolean;
|
|
14
|
-
onChange?: (data: TextChangeData) => void;
|
|
15
|
-
afterInit?: (data: Editor) => void;
|
|
16
|
-
onComposition?: (data: CompositionEvent) => void;
|
|
17
|
-
}
|
|
18
|
-
export type TextChangeData = {
|
|
19
|
-
newText: SlateElement;
|
|
20
|
-
operations: Operation[];
|
|
21
|
-
};
|
|
22
|
-
export interface WithTextPluginOptions extends WithPluginOptions {
|
|
23
|
-
textPlugins?: TextPlugin[];
|
|
24
|
-
}
|
|
25
|
-
export type TextPlugin = (editor: Editor) => Editor;
|
package/transforms/align.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { PlaitBoard } from '@plait/core';
|
|
2
|
-
export declare const alignTop: (board: PlaitBoard) => void;
|
|
3
|
-
export declare const alignBottom: (board: PlaitBoard) => void;
|
|
4
|
-
export declare const alignLeft: (board: PlaitBoard) => void;
|
|
5
|
-
export declare const alignHorizontalCenter: (board: PlaitBoard) => void;
|
|
6
|
-
export declare const alignVerticalCenter: (board: PlaitBoard) => void;
|
|
7
|
-
export declare const alignRight: (board: PlaitBoard) => void;
|
|
8
|
-
export declare const distributeHorizontal: (board: PlaitBoard) => void;
|
|
9
|
-
export declare const distributeVertical: (board: PlaitBoard) => void;
|
|
10
|
-
export interface AlignTransform {
|
|
11
|
-
alignTop: (board: PlaitBoard) => void;
|
|
12
|
-
alignHorizontalCenter: (board: PlaitBoard) => void;
|
|
13
|
-
alignBottom: (board: PlaitBoard) => void;
|
|
14
|
-
alignLeft: (board: PlaitBoard) => void;
|
|
15
|
-
alignVerticalCenter: (board: PlaitBoard) => void;
|
|
16
|
-
alignRight: (board: PlaitBoard) => void;
|
|
17
|
-
distributeHorizontal: (board: PlaitBoard) => void;
|
|
18
|
-
distributeVertical: (board: PlaitBoard) => void;
|
|
19
|
-
}
|
|
20
|
-
export declare const AlignTransform: AlignTransform;
|
package/transforms/index.d.ts
DELETED
package/transforms/property.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Path, PlaitBoard, PlaitElement } from '@plait/core';
|
|
2
|
-
export interface SetOptions<T extends PlaitElement = PlaitElement> {
|
|
3
|
-
callback?: (element: T, path: Path) => void;
|
|
4
|
-
getMemorizeKey?: (element: T) => string;
|
|
5
|
-
match?: (element: T) => boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare const setProperty: <T extends PlaitElement = PlaitElement>(board: PlaitBoard, properties: Partial<T>, options?: SetOptions<T>) => void;
|
|
8
|
-
export declare const PropertyTransforms: {
|
|
9
|
-
setFillColor: (board: PlaitBoard, fill: string | null, options: SetOptions) => void;
|
|
10
|
-
setStrokeStyle: (board: PlaitBoard, strokeStyle: string, options: SetOptions) => void;
|
|
11
|
-
setProperty: <T extends PlaitElement = PlaitElement>(board: PlaitBoard, properties: Partial<T>, options?: SetOptions<T>) => void;
|
|
12
|
-
setStrokeWidth: (board: PlaitBoard, strokeWidth: number, options: SetOptions) => void;
|
|
13
|
-
setStrokeColor: (board: PlaitBoard, strokeColor: string | null, options: SetOptions) => void;
|
|
14
|
-
};
|
package/types/index.d.ts
DELETED
package/types/resize.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Path, PlaitElement, Point, RectangleClient, ResizeCursorClass } from '@plait/core';
|
|
2
|
-
import { ResizeHandle } from '../constants/resize';
|
|
3
|
-
export type PlaitElementOrArray = PlaitElement | PlaitElement[];
|
|
4
|
-
export interface ResizeOptions {
|
|
5
|
-
}
|
|
6
|
-
export interface WithResizeOptions<T extends PlaitElementOrArray = PlaitElementOrArray, K = ResizeHandle, P = ResizeOptions> {
|
|
7
|
-
key: string;
|
|
8
|
-
canResize: () => boolean;
|
|
9
|
-
hitTest: (point: Point) => ResizeHitTestRef<T, K, P> | null;
|
|
10
|
-
onResize: (resizeRef: ResizeRef<T, K, P>, resizeState: ResizeState) => void;
|
|
11
|
-
afterResize?: (resizeRef: ResizeRef<T, K, P>) => void;
|
|
12
|
-
beforeResize?: (resizeRef: ResizeRef<T, K, P>) => void;
|
|
13
|
-
}
|
|
14
|
-
export interface ResizeHitTestRef<T extends PlaitElementOrArray = PlaitElementOrArray, K = ResizeHandle, P = ResizeOptions> {
|
|
15
|
-
element: T;
|
|
16
|
-
rectangle?: RectangleClient;
|
|
17
|
-
handle: K;
|
|
18
|
-
handleIndex?: number;
|
|
19
|
-
cursorClass?: ResizeCursorClass;
|
|
20
|
-
options?: P;
|
|
21
|
-
}
|
|
22
|
-
export interface ResizeState {
|
|
23
|
-
startPoint: Point;
|
|
24
|
-
endPoint: Point;
|
|
25
|
-
isShift: boolean;
|
|
26
|
-
}
|
|
27
|
-
export interface ResizeRef<T extends PlaitElementOrArray = PlaitElementOrArray, K = ResizeHandle, P = ResizeOptions> {
|
|
28
|
-
element: T;
|
|
29
|
-
rectangle?: RectangleClient;
|
|
30
|
-
path: Path | Path[];
|
|
31
|
-
handle: K;
|
|
32
|
-
handleIndex?: number;
|
|
33
|
-
options?: P;
|
|
34
|
-
}
|
package/types/rotate.d.ts
DELETED
package/utils/animate.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export type AnimateOption = {
|
|
2
|
-
stop: () => void;
|
|
3
|
-
start: () => void;
|
|
4
|
-
};
|
|
5
|
-
export declare function animate(tween: (t: number) => void, duration: number, ease: Function, callback: Function): AnimateOption;
|
|
6
|
-
export declare function getTimestamp(): number;
|
|
7
|
-
export declare function linear(t: number): number;
|
package/utils/clipboard.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { PlaitBoard, PlaitElement, Point } from '@plait/core';
|
|
2
|
-
export declare const buildClipboardData: (board: PlaitBoard, elements: PlaitElement[], startPoint: Point, elementBuilder?: (element: PlaitElement) => PlaitElement | undefined) => (PlaitElement | {
|
|
3
|
-
points: number[][];
|
|
4
|
-
id: string;
|
|
5
|
-
children?: PlaitElement[];
|
|
6
|
-
type?: string;
|
|
7
|
-
groupId?: string;
|
|
8
|
-
angle?: number;
|
|
9
|
-
})[];
|
|
10
|
-
export declare const insertClipboardData: (board: PlaitBoard, elements: PlaitElement[], startPoint: Point, elementHandler?: (element: PlaitElement, idsMap: Record<string, string>) => void) => void;
|
package/utils/creation-mode.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { PlaitBoard } from '@plait/core';
|
|
2
|
-
export declare enum BoardCreationMode {
|
|
3
|
-
'dnd' = "dnd",
|
|
4
|
-
'drawing' = "drawing"
|
|
5
|
-
}
|
|
6
|
-
export declare const getCreationMode: (board: PlaitBoard) => BoardCreationMode | undefined;
|
|
7
|
-
export declare const setCreationMode: (board: PlaitBoard, mode: BoardCreationMode) => void;
|
|
8
|
-
export declare const isDndMode: (board: PlaitBoard) => boolean;
|
|
9
|
-
export declare const isDrawingMode: (board: PlaitBoard) => boolean;
|
package/utils/direction.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Direction, DirectionFactor, Point, PointOfRectangle, Vector } from '@plait/core';
|
|
2
|
-
export declare function getOppositeDirection(direction: Direction): Direction;
|
|
3
|
-
export declare function getDirectionByPointOfRectangle(point: PointOfRectangle): Direction | undefined;
|
|
4
|
-
/**
|
|
5
|
-
* this function accepts vector parameter, the vector parameter vector is based on the screen coordinate system
|
|
6
|
-
* vector[0] and vector[1] are the x and y components of the vector respectively.
|
|
7
|
-
* if the vector has only one direction, the function returns a string in that direction, such as 'right', 'top', 'bottom' or 'left'.
|
|
8
|
-
* if the vector has two directions, the function will return the string in which direction it is closer.
|
|
9
|
-
*/
|
|
10
|
-
export declare function getDirectionByVector(vector: Vector): Direction | null;
|
|
11
|
-
export declare function getDirectionBetweenPointAndPoint(source: Point, target: Point): Direction;
|
|
12
|
-
export declare function getDirectionFactor(direction: Direction): {
|
|
13
|
-
x: number;
|
|
14
|
-
y: number;
|
|
15
|
-
} | {
|
|
16
|
-
x: number;
|
|
17
|
-
y: number;
|
|
18
|
-
} | {
|
|
19
|
-
x: number;
|
|
20
|
-
y: number;
|
|
21
|
-
} | {
|
|
22
|
-
x: number;
|
|
23
|
-
y: number;
|
|
24
|
-
};
|
|
25
|
-
export declare function getDirectionFactorByDirectionComponent(directionComponent: number): DirectionFactor;
|
package/utils/drawing/index.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { PlaitBoard, Point } from '@plait/core';
|
|
2
|
-
export declare const drawHandle: (board: PlaitBoard, centerPoint: Point) => SVGGElement;
|
|
3
|
-
export declare function drawFillPrimaryHandle(board: PlaitBoard, point: Point): SVGGElement;
|
|
4
|
-
export declare function drawPrimaryHandle(board: PlaitBoard, point: Point): SVGGElement;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Direction, PlaitBoard, Point, RectangleClient } from '@plait/core';
|
|
2
|
-
import { PointGraph } from '../algorithms';
|
|
3
|
-
export interface ElbowLineRouteOptions {
|
|
4
|
-
sourcePoint: Point;
|
|
5
|
-
nextSourcePoint: Point;
|
|
6
|
-
sourceRectangle: RectangleClient;
|
|
7
|
-
sourceOuterRectangle: RectangleClient;
|
|
8
|
-
targetPoint: Point;
|
|
9
|
-
nextTargetPoint: Point;
|
|
10
|
-
targetOuterRectangle: RectangleClient;
|
|
11
|
-
targetRectangle: RectangleClient;
|
|
12
|
-
}
|
|
13
|
-
export interface RouteAdjustOptions {
|
|
14
|
-
centerX?: number;
|
|
15
|
-
centerY?: number;
|
|
16
|
-
sourceRectangle: RectangleClient;
|
|
17
|
-
targetRectangle: RectangleClient;
|
|
18
|
-
}
|
|
19
|
-
export interface AdjustOptions {
|
|
20
|
-
parallelPaths: [Point, Point][];
|
|
21
|
-
pointOfHit: Point;
|
|
22
|
-
sourceRectangle: RectangleClient;
|
|
23
|
-
targetRectangle: RectangleClient;
|
|
24
|
-
}
|
|
25
|
-
export declare const generateElbowLineRoute: (options: ElbowLineRouteOptions, board?: PlaitBoard) => Point[];
|
|
26
|
-
export declare const routeAdjust: (path: Point[], options: RouteAdjustOptions, board?: PlaitBoard) => Point[];
|
|
27
|
-
export declare const getGraphPoints: (options: ElbowLineRouteOptions) => Point[];
|
|
28
|
-
export declare const createGraph: (points: Point[]) => PointGraph;
|
|
29
|
-
export declare const reduceRouteMargin: (sourceRectangle: RectangleClient, targetRectangle: RectangleClient) => {
|
|
30
|
-
sourceOffset: number[];
|
|
31
|
-
targetOffset: number[];
|
|
32
|
-
};
|
|
33
|
-
export declare const getNextPoint: (point: Point, outerRectangle: RectangleClient, direction: Direction) => Point;
|
|
34
|
-
export declare const getSourceAndTargetOuterRectangle: (sourceRectangle: RectangleClient, targetRectangle: RectangleClient) => {
|
|
35
|
-
sourceOuterRectangle: {
|
|
36
|
-
x: number;
|
|
37
|
-
y: number;
|
|
38
|
-
width: number;
|
|
39
|
-
height: number;
|
|
40
|
-
};
|
|
41
|
-
targetOuterRectangle: {
|
|
42
|
-
x: number;
|
|
43
|
-
y: number;
|
|
44
|
-
width: number;
|
|
45
|
-
height: number;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
export declare const isSourceAndTargetIntersect: (options: ElbowLineRouteOptions) => boolean;
|
package/utils/elements.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { PlaitBoard, PlaitElement } from '@plait/core';
|
|
2
|
-
export declare const getElementArea: (board: PlaitBoard, element: PlaitElement) => number;
|
|
3
|
-
export declare const sortElementsByArea: (board: PlaitBoard, elements: PlaitElement[], direction?: "desc" | "asc") => PlaitElement[];
|
|
4
|
-
export declare const isFilled: (fill: string) => boolean | "";
|
package/utils/hot-key.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare function isVirtualKey(e: KeyboardEvent): boolean;
|
|
2
|
-
export declare const isExpandHotkey: (event: KeyboardEvent) => boolean;
|
|
3
|
-
export declare const isTabHotkey: (event: KeyboardEvent) => boolean;
|
|
4
|
-
export declare const isEnterHotkey: (event: KeyboardEvent) => boolean;
|
|
5
|
-
export declare const isSpaceHotkey: (event: KeyboardEvent) => boolean;
|
|
6
|
-
export declare const isDelete: (event: KeyboardEvent) => boolean;
|
package/utils/image.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { PlaitBoard, PlaitElement } from '@plait/core';
|
|
2
|
-
export interface CommonImageItem {
|
|
3
|
-
url: string;
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
}
|
|
7
|
-
export declare const selectImage: (board: PlaitBoard, defaultImageWidth: number, handle: (commonImage: CommonImageItem) => void, acceptImageTypes?: string[]) => void;
|
|
8
|
-
export declare const buildImage: (board: PlaitBoard, imageFile: File, defaultImageWidth: number, handle: (commonImage: CommonImageItem) => void) => Promise<void>;
|
|
9
|
-
export declare const getElementOfFocusedImage: (board: PlaitBoard) => PlaitElement | undefined;
|
|
10
|
-
export declare const addElementOfFocusedImage: (board: PlaitBoard, element: PlaitElement) => void;
|
|
11
|
-
export declare const removeElementOfFocusedImage: (board: PlaitBoard) => void;
|
package/utils/index.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export * from './resize';
|
|
2
|
-
export * from './line-path';
|
|
3
|
-
export * from './default-orthogonal-routing';
|
|
4
|
-
export * from './hot-key';
|
|
5
|
-
export * from './creation-mode';
|
|
6
|
-
export * from './direction';
|
|
7
|
-
export * from './text';
|
|
8
|
-
export * from './image';
|
|
9
|
-
export * from './elbow-line-route';
|
|
10
|
-
export * from './memorize';
|
|
11
|
-
export * from './vector';
|
|
12
|
-
export * from './math';
|
|
13
|
-
export * from './drawing';
|
|
14
|
-
export * from './rotate';
|
|
15
|
-
export * from './elements';
|
|
16
|
-
export * from './animate';
|
|
17
|
-
export * from './stroke';
|
|
18
|
-
export * from './clipboard';
|
|
19
|
-
export * from './point-placement';
|
package/utils/line-path.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Point } from '@plait/core';
|
|
2
|
-
export declare function getPointOnPolyline(points: Point[], ratio: number): number[];
|
|
3
|
-
export declare function calculatePolylineLength(points: Point[]): number;
|
|
4
|
-
export declare function getRatioByPoint(points: Point[], point: Point): number;
|
|
5
|
-
export declare const removeDuplicatePoints: (points: Point[]) => Point[];
|
|
6
|
-
export declare function simplifyOrthogonalPoints(points: Point[]): Point[];
|
|
7
|
-
export declare const getExtendPoint: (source: Point, target: Point, extendDistance: number) => Point;
|
package/utils/math.d.ts
DELETED