@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.
Files changed (64) hide show
  1. package/index.d.ts +605 -3
  2. package/package.json +1 -1
  3. package/algorithms/a-star.d.ts +0 -10
  4. package/algorithms/data-structures/graph.d.ts +0 -14
  5. package/algorithms/data-structures/index.d.ts +0 -2
  6. package/algorithms/data-structures/priority-queue.d.ts +0 -16
  7. package/algorithms/index.d.ts +0 -2
  8. package/constants/default.d.ts +0 -10
  9. package/constants/index.d.ts +0 -4
  10. package/constants/media.d.ts +0 -6
  11. package/constants/property.d.ts +0 -5
  12. package/constants/resize.d.ts +0 -10
  13. package/core/element-flavour.d.ts +0 -5
  14. package/core/element-ref.d.ts +0 -13
  15. package/core/group.component.d.ts +0 -12
  16. package/core/index.d.ts +0 -4
  17. package/core/render-component.d.ts +0 -4
  18. package/generators/active.generator.d.ts +0 -22
  19. package/generators/generator.d.ts +0 -27
  20. package/generators/group.generator.d.ts +0 -7
  21. package/generators/index.d.ts +0 -3
  22. package/image/image-base.component.d.ts +0 -9
  23. package/image/image.generator.d.ts +0 -26
  24. package/image/index.d.ts +0 -3
  25. package/image/with-image.d.ts +0 -15
  26. package/plugins/index.d.ts +0 -2
  27. package/plugins/with-group.d.ts +0 -2
  28. package/plugins/with-resize.d.ts +0 -4
  29. package/public-api.d.ts +0 -12
  30. package/shapes/common.d.ts +0 -2
  31. package/shapes/index.d.ts +0 -1
  32. package/text/index.d.ts +0 -4
  33. package/text/text-manage.d.ts +0 -42
  34. package/text/text-measure.d.ts +0 -15
  35. package/text/types.d.ts +0 -28
  36. package/text/with-text.d.ts +0 -25
  37. package/transforms/align.d.ts +0 -20
  38. package/transforms/index.d.ts +0 -2
  39. package/transforms/property.d.ts +0 -14
  40. package/types/index.d.ts +0 -2
  41. package/types/resize.d.ts +0 -34
  42. package/types/rotate.d.ts +0 -6
  43. package/utils/animate.d.ts +0 -7
  44. package/utils/clipboard.d.ts +0 -10
  45. package/utils/creation-mode.d.ts +0 -9
  46. package/utils/default-orthogonal-routing.d.ts +0 -2
  47. package/utils/direction.d.ts +0 -25
  48. package/utils/drawing/index.d.ts +0 -2
  49. package/utils/drawing/resize-handle.d.ts +0 -4
  50. package/utils/drawing/rotate-handle.d.ts +0 -2
  51. package/utils/elbow-line-route.d.ts +0 -48
  52. package/utils/elements.d.ts +0 -4
  53. package/utils/hot-key.d.ts +0 -6
  54. package/utils/image.d.ts +0 -11
  55. package/utils/index.d.ts +0 -19
  56. package/utils/line-path.d.ts +0 -7
  57. package/utils/math.d.ts +0 -3
  58. package/utils/memorize.d.ts +0 -3
  59. package/utils/point-placement.d.ts +0 -5
  60. package/utils/resize.d.ts +0 -28
  61. package/utils/rotate.d.ts +0 -6
  62. package/utils/stroke.d.ts +0 -2
  63. package/utils/text.d.ts +0 -33
  64. package/utils/vector.d.ts +0 -6
@@ -1,4 +0,0 @@
1
- export * from './default';
2
- export * from './media';
3
- export * from './resize';
4
- export * from './property';
@@ -1,6 +0,0 @@
1
- export declare enum MediaKeys {
2
- image = "image"
3
- }
4
- export declare const PICTURE_ACCEPTED_UPLOAD_SIZE = 20;
5
- export declare const acceptImageTypes: string[];
6
- export declare const WithCommonPluginKey = "plait-common-plugin-key";
@@ -1,5 +0,0 @@
1
- export declare enum StrokeStyle {
2
- solid = "solid",
3
- dashed = "dashed",
4
- dotted = "dotted"
5
- }
@@ -1,10 +0,0 @@
1
- export declare enum ResizeHandle {
2
- nw = "0",
3
- n = "4",
4
- ne = "1",
5
- e = "5",
6
- se = "2",
7
- s = "6",
8
- sw = "3",
9
- w = "7"
10
- }
@@ -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
- }
@@ -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,4 +0,0 @@
1
- export * from './element-flavour';
2
- export * from './element-ref';
3
- export * from './group.component';
4
- export * from './render-component';
@@ -1,4 +0,0 @@
1
- export interface RenderComponentRef<T> {
2
- destroy: () => void;
3
- update: (props: Partial<T>) => void;
4
- }
@@ -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
- }
@@ -1,3 +0,0 @@
1
- export * from './generator';
2
- export * from './active.generator';
3
- export * from '../image/image.generator';
@@ -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
@@ -1,3 +0,0 @@
1
- export * from './image-base.component';
2
- export * from './image.generator';
3
- export * from './with-image';
@@ -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
- }
@@ -1,2 +0,0 @@
1
- export * from './with-resize';
2
- export * from './with-group';
@@ -1,2 +0,0 @@
1
- import { PlaitBoard } from '@plait/core';
2
- export declare function withGroup(board: PlaitBoard): PlaitBoard;
@@ -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';
@@ -1,2 +0,0 @@
1
- import { Point } from '@plait/core';
2
- export declare const normalizeShapePoints: (points: [Point, Point], shift?: boolean) => [Point, Point];
package/shapes/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './common';
package/text/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from './text-manage';
2
- export * from './with-text';
3
- export * from './text-measure';
4
- export * from './types';
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -1,2 +0,0 @@
1
- export * from './property';
2
- export * from './align';
@@ -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
@@ -1,2 +0,0 @@
1
- export * from './resize';
2
- export * from './rotate';
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
@@ -1,6 +0,0 @@
1
- import { PlaitElement, Point } from '@plait/core';
2
- export interface RotateRef<T extends PlaitElement = PlaitElement> {
3
- elements: T[];
4
- startPoint: Point;
5
- angle?: number;
6
- }
@@ -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;
@@ -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;
@@ -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;
@@ -1,2 +0,0 @@
1
- import { Direction, Point } from "@plait/core";
2
- export declare const getPoints: (source: Point, sourcePosition: Direction, target: Point, targetPosition: Direction, offset: number) => Point[];
@@ -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;
@@ -1,2 +0,0 @@
1
- export * from './resize-handle';
2
- export * from './rotate-handle';
@@ -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,2 +0,0 @@
1
- import { PlaitBoard, RectangleClient } from '@plait/core';
2
- export declare const drawRotateHandle: (board: PlaitBoard, rectangle: RectangleClient) => 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;
@@ -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 | "";
@@ -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';
@@ -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
@@ -1,3 +0,0 @@
1
- import { Point } from '@plait/core';
2
- export declare function isPointOnSegment(point: Point, startPoint: Point, endPoint: Point): boolean;
3
- export declare const getCrossingPointsBetweenPointAndSegment: (point: Point, startPoint: Point, endPoint: Point) => Point[];