@plait/core 0.91.0 → 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 (106) hide show
  1. package/index.d.ts +1464 -3
  2. package/package.json +1 -1
  3. package/constants/cursor.d.ts +0 -10
  4. package/constants/index.d.ts +0 -19
  5. package/constants/keycodes.d.ts +0 -126
  6. package/constants/selection.d.ts +0 -5
  7. package/constants/zoom.d.ts +0 -3
  8. package/context.d.ts +0 -7
  9. package/core/element/context-change.d.ts +0 -10
  10. package/core/element/context.d.ts +0 -14
  11. package/core/element/element-flavour.d.ts +0 -30
  12. package/core/element/element-ref.d.ts +0 -5
  13. package/core/list-render.d.ts +0 -14
  14. package/differs/default_iterable_differ.d.ts +0 -141
  15. package/differs/iterable_differs.d.ts +0 -141
  16. package/interfaces/board.d.ts +0 -113
  17. package/interfaces/custom-types.d.ts +0 -9
  18. package/interfaces/direction.d.ts +0 -11
  19. package/interfaces/element.d.ts +0 -27
  20. package/interfaces/group.d.ts +0 -7
  21. package/interfaces/history.d.ts +0 -10
  22. package/interfaces/index.d.ts +0 -18
  23. package/interfaces/node.d.ts +0 -21
  24. package/interfaces/operation.d.ts +0 -53
  25. package/interfaces/path-ref.d.ts +0 -13
  26. package/interfaces/path.d.ts +0 -52
  27. package/interfaces/plugin.d.ts +0 -17
  28. package/interfaces/point.d.ts +0 -15
  29. package/interfaces/pointer.d.ts +0 -4
  30. package/interfaces/rectangle-client.d.ts +0 -49
  31. package/interfaces/selection.d.ts +0 -10
  32. package/interfaces/svg-arc-command.d.ts +0 -9
  33. package/interfaces/theme.d.ts +0 -24
  34. package/interfaces/viewport.d.ts +0 -18
  35. package/plugins/create-board.d.ts +0 -3
  36. package/plugins/index.d.ts +0 -11
  37. package/plugins/with-board.d.ts +0 -2
  38. package/plugins/with-hand.d.ts +0 -4
  39. package/plugins/with-history.d.ts +0 -2
  40. package/plugins/with-hotkey.d.ts +0 -2
  41. package/plugins/with-i18n.d.ts +0 -6
  42. package/plugins/with-moving.d.ts +0 -8
  43. package/plugins/with-options.d.ts +0 -7
  44. package/plugins/with-related-fragment.d.ts +0 -2
  45. package/plugins/with-selection.d.ts +0 -2
  46. package/public-api.d.ts +0 -12
  47. package/testing/core/create-board.d.ts +0 -6
  48. package/testing/core/fake-weak-map.d.ts +0 -4
  49. package/testing/core/index.d.ts +0 -2
  50. package/testing/fake-events/event-objects.d.ts +0 -46
  51. package/testing/fake-events/index.d.ts +0 -1
  52. package/testing/index.d.ts +0 -2
  53. package/testing/test-element.d.ts +0 -14
  54. package/transforms/board.d.ts +0 -25
  55. package/transforms/element.d.ts +0 -6
  56. package/transforms/general.d.ts +0 -6
  57. package/transforms/group.d.ts +0 -11
  58. package/transforms/index.d.ts +0 -9
  59. package/transforms/node.d.ts +0 -14
  60. package/transforms/selection.d.ts +0 -10
  61. package/transforms/theme.d.ts +0 -7
  62. package/transforms/viewport.d.ts +0 -7
  63. package/transforms/z-index.d.ts +0 -13
  64. package/utils/angle.d.ts +0 -24
  65. package/utils/board.d.ts +0 -11
  66. package/utils/clipboard/clipboard.d.ts +0 -5
  67. package/utils/clipboard/common.d.ts +0 -12
  68. package/utils/clipboard/data-transfer.d.ts +0 -5
  69. package/utils/clipboard/index.d.ts +0 -2
  70. package/utils/clipboard/navigator-clipboard.d.ts +0 -3
  71. package/utils/clipboard/types.d.ts +0 -24
  72. package/utils/common.d.ts +0 -13
  73. package/utils/debug.d.ts +0 -14
  74. package/utils/dnd.d.ts +0 -4
  75. package/utils/dom/common.d.ts +0 -23
  76. package/utils/dom/environment.d.ts +0 -1
  77. package/utils/dom/foreign.d.ts +0 -3
  78. package/utils/dom/index.d.ts +0 -3
  79. package/utils/drawing/arrow.d.ts +0 -8
  80. package/utils/drawing/circle.d.ts +0 -4
  81. package/utils/drawing/line.d.ts +0 -6
  82. package/utils/drawing/rectangle.d.ts +0 -9
  83. package/utils/element.d.ts +0 -11
  84. package/utils/environment.d.ts +0 -8
  85. package/utils/fragment.d.ts +0 -5
  86. package/utils/group.d.ts +0 -25
  87. package/utils/helper.d.ts +0 -17
  88. package/utils/history.d.ts +0 -49
  89. package/utils/hotkeys.d.ts +0 -37
  90. package/utils/id-creator.d.ts +0 -1
  91. package/utils/index.d.ts +0 -34
  92. package/utils/iterable.d.ts +0 -10
  93. package/utils/math.d.ts +0 -67
  94. package/utils/moving-element.d.ts +0 -5
  95. package/utils/pointer.d.ts +0 -5
  96. package/utils/position.d.ts +0 -2
  97. package/utils/selected-element.d.ts +0 -19
  98. package/utils/selection.d.ts +0 -18
  99. package/utils/snap/snap-moving.d.ts +0 -5
  100. package/utils/snap/snap.d.ts +0 -31
  101. package/utils/to-image.d.ts +0 -22
  102. package/utils/to-point.d.ts +0 -31
  103. package/utils/tree.d.ts +0 -7
  104. package/utils/viewport.d.ts +0 -50
  105. package/utils/weak-maps.d.ts +0 -43
  106. package/utils/z-index.d.ts +0 -5
@@ -1,10 +0,0 @@
1
- import { PlaitBoard } from '../interfaces/board';
2
- import { Selection } from '../interfaces/selection';
3
- import { PlaitElement } from '../interfaces/element';
4
- export declare function setSelection(board: PlaitBoard, selection: Selection | null): void;
5
- export interface SelectionTransforms {
6
- setSelection: (board: PlaitBoard, selection: Selection | null) => void;
7
- addSelectionWithTemporaryElements: (board: PlaitBoard, elements: PlaitElement[]) => void;
8
- }
9
- export declare const SelectionTransforms: SelectionTransforms;
10
- export declare function addSelectionWithTemporaryElements(board: PlaitBoard, elements: PlaitElement[]): void;
@@ -1,7 +0,0 @@
1
- import { PlaitBoard } from '../interfaces/board';
2
- import { PlaitTheme } from '../interfaces';
3
- export declare function setTheme(board: PlaitBoard, themeColorMode: PlaitTheme): void;
4
- export interface ThemeTransforms {
5
- setTheme: (board: PlaitBoard, themeColorMode: PlaitTheme) => void;
6
- }
7
- export declare const ViewportTransforms: ThemeTransforms;
@@ -1,7 +0,0 @@
1
- import { PlaitBoard } from '../interfaces/board';
2
- import { Viewport } from '../interfaces/viewport';
3
- export declare function setViewport(board: PlaitBoard, viewport: Viewport): void;
4
- export interface ViewportTransforms {
5
- setViewport: (board: PlaitBoard, viewport: Viewport) => void;
6
- }
7
- export declare const ViewportTransforms: ViewportTransforms;
@@ -1,13 +0,0 @@
1
- import { PlaitBoard } from '../interfaces';
2
- export interface ZIndexTransforms {
3
- moveUp: (board: PlaitBoard) => void;
4
- moveDown: (board: PlaitBoard) => void;
5
- moveToTop: (board: PlaitBoard) => void;
6
- moveToBottom: (board: PlaitBoard) => void;
7
- }
8
- export declare const ZIndexTransforms: {
9
- moveUp: (board: PlaitBoard) => void;
10
- moveDown: (board: PlaitBoard) => void;
11
- moveToTop: (board: PlaitBoard) => void;
12
- moveToBottom: (board: PlaitBoard) => void;
13
- };
package/utils/angle.d.ts DELETED
@@ -1,24 +0,0 @@
1
- import { PlaitBoard, PlaitElement, Point, RectangleClient } from '../interfaces';
2
- export declare const rotatePoints: <T>(points: T, centerPoint: Point, angle?: number) => T;
3
- export declare const getSelectionAngle: (elements: PlaitElement[]) => number;
4
- export declare const hasSameAngle: (elements: PlaitElement[]) => boolean;
5
- export declare const getRotatedBoundingRectangle: (rectanglesCornerPoints: [Point, Point, Point, Point][], angle: number) => RectangleClient;
6
- export declare const getOffsetAfterRotate: (rectangle: RectangleClient, rotateCenterPoint: Point, angle: number) => {
7
- offsetX: number;
8
- offsetY: number;
9
- };
10
- export declare const rotatedDataPoints: (points: Point[], rotateCenterPoint: Point, angle: number) => Point[];
11
- export declare const hasValidAngle: (node: PlaitElement) => boolean | 0 | undefined;
12
- export declare const isValidAngle: (angle: undefined | number) => boolean | 0 | undefined;
13
- export declare const rotatePointsByElement: <T>(points: T, element: PlaitElement) => T | null;
14
- export declare const rotatePointsByAngle: (points: Point[], angle: number | undefined) => Point[] | null;
15
- export declare const rotateAntiPointsByElement: <T>(board: PlaitBoard, points: T, element: PlaitElement, isToActive?: boolean) => T | null;
16
- export declare const getRectangleByAngle: (rectangle: RectangleClient, angle: number) => RectangleClient;
17
- export declare const isAxisChangedByAngle: (angle: number) => boolean;
18
- export declare function degreesToRadians(d: number): number;
19
- export declare function radiansToDegrees(r: number): number;
20
- export declare function rotateElements(board: PlaitBoard, elements: PlaitElement[], angle: number): void;
21
- export declare const normalizeAngle: (angle: number) => number;
22
- export declare const getAngleBetweenPoints: (startPoint: Point, endPoint: Point, centerPoint: Point) => number;
23
- export declare const getAngleByElement: (element: PlaitElement) => number | undefined;
24
- export declare const setAngleForG: (g: SVGGElement, centerPoint: Point, angle: number) => void;
package/utils/board.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import { PlaitBoard } from '../interfaces/board';
2
- export type ViewBox = {
3
- minX: number;
4
- minY: number;
5
- width: number;
6
- height: number;
7
- viewportWidth: number;
8
- viewportHeight: number;
9
- };
10
- export declare function isInPlaitBoard(board: PlaitBoard, x: number, y: number): boolean;
11
- export declare function getRealScrollBarWidth(board: PlaitBoard): number;
@@ -1,5 +0,0 @@
1
- import { ClipboardData, WritableClipboardContext } from './types';
2
- export declare const cacheClipboardData: (clipboardData: ClipboardData) => void;
3
- export declare const getCachedClipboardData: () => any;
4
- export declare const getClipboardData: (dataTransfer: DataTransfer | null) => Promise<ClipboardData | null>;
5
- export declare const setClipboardData: (dataTransfer: DataTransfer | null, clipboardContext: WritableClipboardContext | null) => Promise<void>;
@@ -1,12 +0,0 @@
1
- import { ClipboardData, WritableClipboardContext, WritableClipboardData, WritableClipboardType } from './types';
2
- export declare const buildPlaitHtml: (type: WritableClipboardType, data: WritableClipboardData) => string;
3
- export declare const getClipboardFromHtml: (html: string) => ClipboardData | null;
4
- export declare const stripHtml: (html: string) => string;
5
- export declare const getProbablySupportsClipboardWrite: () => boolean;
6
- export declare const getProbablySupportsClipboardWriteText: () => boolean;
7
- export declare const getProbablySupportsClipboardRead: () => boolean;
8
- export declare const createClipboardContext: (type: WritableClipboardType, elements: WritableClipboardData, text: string) => WritableClipboardContext;
9
- export declare const addClipboardContext: (clipboardContext: WritableClipboardContext, addition: WritableClipboardContext) => WritableClipboardContext;
10
- export declare const addOrCreateClipboardContext: (clipboardContext: WritableClipboardContext | null, addition: WritableClipboardContext) => WritableClipboardContext;
11
- export declare const replaceAngleBrackets: (str: string) => string;
12
- export declare const reverseReplaceAngleBrackets: (str: string) => string;
@@ -1,5 +0,0 @@
1
- import { ClipboardData, WritableClipboardData, WritableClipboardType } from './types';
2
- export declare const setDataTransferClipboard: (dataTransfer: DataTransfer | null, type: WritableClipboardType, data: WritableClipboardData) => void;
3
- export declare const setDataTransferClipboardText: (data: DataTransfer | null, text: string) => void;
4
- export declare const getDataTransferClipboard: (data: DataTransfer | null) => ClipboardData;
5
- export declare const getDataTransferClipboardText: (data: DataTransfer | null) => ClipboardData;
@@ -1,2 +0,0 @@
1
- export * from './data-transfer';
2
- export * from './types';
@@ -1,3 +0,0 @@
1
- import { ClipboardData, WritableClipboardData, WritableClipboardType } from './types';
2
- export declare const setNavigatorClipboard: (type: WritableClipboardType, data: WritableClipboardData, text?: string) => Promise<void>;
3
- export declare const getNavigatorClipboard: () => Promise<ClipboardData>;
@@ -1,24 +0,0 @@
1
- import { PlaitElement } from '../../interfaces';
2
- export declare enum WritableClipboardType {
3
- 'medias' = "medias",
4
- 'elements' = "elements"
5
- }
6
- export declare enum WritableClipboardOperationType {
7
- 'copy' = "copy",
8
- 'cut' = "cut",
9
- 'duplicate' = "duplicate",
10
- 'paste' = "paste"
11
- }
12
- export type WritableClipboardData = PlaitElement[] | any[];
13
- export interface WritableClipboardContext {
14
- text: string;
15
- type: WritableClipboardType;
16
- elements: WritableClipboardData;
17
- }
18
- export interface ClipboardData {
19
- files?: File[];
20
- elements?: PlaitElement[];
21
- medias?: any[];
22
- text?: string;
23
- operationType?: WritableClipboardOperationType;
24
- }
package/utils/common.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import { Path, PlaitElement } from '../interfaces';
2
- import { PlaitBoard } from '../interfaces/board';
3
- export interface MoveNodeOption {
4
- element: PlaitElement;
5
- newPath: Path;
6
- }
7
- export declare const throttleRAF: (board: PlaitBoard, key: string, fn: () => void) => void;
8
- export declare const debounce: <T>(func: (args?: T) => void, wait: number, options?: {
9
- leading: boolean;
10
- }) => (args?: T) => void;
11
- export declare const getElementsIndices: (board: PlaitBoard, elements: PlaitElement[]) => number[];
12
- export declare const getHighestIndexOfElement: (board: PlaitBoard, elements: PlaitElement[]) => number;
13
- export declare const moveElementsToNewPath: (board: PlaitBoard, moveOptions: MoveNodeOption[]) => void;
package/utils/debug.d.ts DELETED
@@ -1,14 +0,0 @@
1
- import { Options } from 'roughjs/bin/core';
2
- import { PlaitBoard, Point, RectangleClient } from '../interfaces';
3
- export declare class DebugGenerator {
4
- private debugKey;
5
- constructor(debugKey: string);
6
- isDebug(): boolean;
7
- clear(): void;
8
- drawPolygon(board: PlaitBoard, points: Point[], options?: Options): SVGGElement | undefined;
9
- drawLine(board: PlaitBoard, points: Point[], options?: Options): SVGGElement | undefined;
10
- drawRectangle(board: PlaitBoard, data: Point[] | RectangleClient, options?: Options): SVGGElement | undefined;
11
- drawCircles(board: PlaitBoard, points: Point[], diameter?: number, isCumulativeDiameter?: boolean, options?: Options): SVGGElement[] | undefined;
12
- }
13
- export declare const createDebugGenerator: (debugKey: string) => DebugGenerator;
14
- export declare const isDebug: (key?: string) => boolean;
package/utils/dnd.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { PlaitBoard } from "../interfaces/board";
2
- export declare const IS_DRAGGING: WeakMap<PlaitBoard, boolean>;
3
- export declare const isDragging: (board: PlaitBoard) => boolean;
4
- export declare const setDragging: (board: PlaitBoard, state: boolean) => void;
@@ -1,23 +0,0 @@
1
- import { Options } from 'roughjs/bin/core';
2
- import { RectangleClient } from '../../interfaces';
3
- export declare const NS = "http://www.w3.org/2000/svg";
4
- export declare function createG(): SVGGElement;
5
- export declare function createPath(): SVGPathElement;
6
- export declare function createRect(rectangle: RectangleClient, options?: Options): SVGRectElement;
7
- export declare const setStrokeLinecap: (g: SVGGElement, value: "round" | "square") => void;
8
- export declare const setPathStrokeLinecap: (g: SVGGElement, value: "round" | "square") => void;
9
- export declare function createMask(): SVGMaskElement;
10
- export declare function createSVG(): SVGSVGElement;
11
- export declare function createText(x: number, y: number, fill: string, textContent: string): SVGTextElement;
12
- /**
13
- * Check if a DOM node is an element node.
14
- */
15
- export declare const isDOMElement: (value: any) => value is Element;
16
- /**
17
- * Check if a value is a DOM node.
18
- */
19
- export declare const isDOMNode: (value: any) => value is Node;
20
- export declare const hasInputOrTextareaTarget: (target: EventTarget | null) => boolean;
21
- export declare const isSecondaryPointer: (event: MouseEvent) => boolean;
22
- export declare const isMainPointer: (event: MouseEvent) => boolean;
23
- export declare const isWheelPointer: (event: MouseEvent) => boolean;
@@ -1 +0,0 @@
1
- export declare const IS_MAC: boolean;
@@ -1,3 +0,0 @@
1
- export declare function createForeignObject(x: number, y: number, width: number, height: number): SVGForeignObjectElement;
2
- export declare function updateForeignObject(target: SVGForeignObjectElement | SVGGElement, width: number, height: number, x: number, y: number): void;
3
- export declare function updateForeignObjectWidth(target: SVGForeignObjectElement | SVGGElement, width: number): void;
@@ -1,3 +0,0 @@
1
- export * from './common';
2
- export * from './foreign';
3
- export * from './environment';
@@ -1,8 +0,0 @@
1
- import { RoughSVG } from 'roughjs/bin/svg';
2
- import { Options } from 'roughjs/bin/core';
3
- import { Point } from '../../interfaces';
4
- export declare function arrowPoints(start: Point, end: Point, degree?: number): {
5
- pointLeft: Point;
6
- pointRight: Point;
7
- };
8
- export declare function drawArrow(rs: RoughSVG, start: Point, end: Point, options: Options, maxHypotenuseLength?: number, degree?: number): SVGGElement[];
@@ -1,4 +0,0 @@
1
- import { RoughSVG } from 'roughjs/bin/svg';
2
- import { Point } from '../../interfaces/point';
3
- import { Options } from 'roughjs/bin/core';
4
- export declare function drawCircle(roughSVG: RoughSVG, point: Point, diameter: number, options: Options): SVGGElement;
@@ -1,6 +0,0 @@
1
- import { RoughSVG } from 'roughjs/bin/svg';
2
- import { Point } from '../../interfaces/point';
3
- import { Options } from 'roughjs/bin/core';
4
- export declare function drawLine(rs: RoughSVG, start: Point, end: Point, options: Options): SVGGElement;
5
- export declare function drawLinearPath(points: Point[], options?: Options, closePath?: boolean): SVGGElement;
6
- export declare function drawBezierPath(points: Point[], options?: Options): SVGGElement;
@@ -1,9 +0,0 @@
1
- import { Options } from 'roughjs/bin/core';
2
- import { RoughSVG } from 'roughjs/bin/svg';
3
- import { PlaitBoard } from '../../interfaces/board';
4
- import { RectangleClient } from '../../interfaces/rectangle-client';
5
- /**
6
- * drawRoundRectangle
7
- */
8
- export declare function drawRoundRectangle(rs: RoughSVG, x1: number, y1: number, x2: number, y2: number, options: Options, outline?: boolean, borderRadius?: number): SVGGElement;
9
- export declare const drawRectangle: (board: PlaitBoard, rectangle: RectangleClient, options: Options) => SVGGElement;
@@ -1,11 +0,0 @@
1
- import { PlaitBoard, PlaitElement, RectangleClient } from '../interfaces';
2
- export declare function getRectangleByElements(board: PlaitBoard, elements: PlaitElement[], recursion: boolean): RectangleClient;
3
- export declare function getBoundingRectangleByElements(board: PlaitBoard, elements: PlaitElement[], recursion: boolean): RectangleClient;
4
- export declare function getBoardRectangle(board: PlaitBoard): RectangleClient;
5
- export declare function getElementById<T extends PlaitElement = PlaitElement>(board: PlaitBoard, id: string, dataSource?: PlaitElement[]): T | undefined;
6
- export declare function getElementMap(board: PlaitBoard): Map<String, PlaitElement>;
7
- export declare function findElements<T extends PlaitElement = PlaitElement>(board: PlaitBoard, options: {
8
- match: (element: PlaitElement) => boolean;
9
- recursion: (element: PlaitElement) => boolean;
10
- isReverse?: boolean;
11
- }): T[];
@@ -1,8 +0,0 @@
1
- export declare const IS_IOS: boolean;
2
- export declare const IS_APPLE: boolean;
3
- export declare const IS_FIREFOX: boolean;
4
- export declare const IS_SAFARI: boolean;
5
- export declare const IS_EDGE_LEGACY: boolean;
6
- export declare const IS_CHROME: boolean;
7
- export declare const IS_CHROME_LEGACY: boolean;
8
- export declare const IS_WINDOWS: boolean;
@@ -1,5 +0,0 @@
1
- import { PlaitBoard, PlaitElement, Point } from '../interfaces';
2
- import { WritableClipboardOperationType } from './clipboard';
3
- export declare const deleteFragment: (board: PlaitBoard) => void;
4
- export declare const setFragment: (board: PlaitBoard, operationType: WritableClipboardOperationType, clipboardData: DataTransfer | null) => void;
5
- export declare const duplicateElements: (board: PlaitBoard, elements?: PlaitElement[], point?: Point) => void;
package/utils/group.d.ts DELETED
@@ -1,25 +0,0 @@
1
- import { Path, PlaitBoard, PlaitElement, PlaitGroup, RectangleClient } from '../interfaces';
2
- export declare const getElementsInGroup: (board: PlaitBoard, group: PlaitGroup, recursion?: boolean, includeGroup?: boolean) => PlaitElement[];
3
- export declare const getAllElementsInGroup: (board: PlaitBoard, group: PlaitGroup, recursion?: boolean, includeGroup?: boolean) => PlaitElement[];
4
- export declare const getRectangleByGroup: (board: PlaitBoard, group: PlaitGroup, recursion?: boolean) => RectangleClient;
5
- export declare const getGroupByElement: (board: PlaitBoard, element: PlaitElement, recursion?: boolean, originElements?: PlaitElement[]) => PlaitGroup | PlaitGroup[] | null;
6
- export declare const getHighestGroup: (board: PlaitBoard, element: PlaitElement) => PlaitGroup | null;
7
- export declare const getElementsInGroupByElement: (board: PlaitBoard, element: PlaitElement) => PlaitElement[];
8
- export declare const getAllGroups: (board: PlaitBoard) => PlaitGroup[];
9
- export declare const isSelectedElementOrGroup: (board: PlaitBoard, element: PlaitElement, elements?: PlaitElement[]) => boolean;
10
- export declare const isSelectedAllElementsInGroup: (board: PlaitBoard, group: PlaitGroup, elements?: PlaitElement[]) => boolean;
11
- export declare const filterSelectedGroups: (board: PlaitBoard, groups: PlaitGroup[], elements?: PlaitElement[]) => PlaitGroup[];
12
- export declare const getSelectedGroups: (board: PlaitBoard, elements?: PlaitElement[], originElements?: PlaitElement[]) => PlaitGroup[];
13
- export declare const getHighestSelectedGroup: (board: PlaitBoard, element: PlaitElement, elements?: PlaitElement[], originElements?: PlaitElement[]) => PlaitGroup | null;
14
- export declare const getHighestSelectedGroups: (board: PlaitBoard, elements?: PlaitElement[], originElements?: PlaitElement[]) => PlaitGroup[];
15
- export declare const getSelectedIsolatedElements: (board: PlaitBoard, elements?: PlaitElement[]) => PlaitElement[];
16
- export declare const getSelectedIsolatedElementsCanAddToGroup: (board: PlaitBoard, elements?: PlaitElement[]) => PlaitElement[];
17
- export declare const getHighestSelectedElements: (board: PlaitBoard, elements?: PlaitElement[]) => PlaitElement[];
18
- export declare const createGroupRectangleG: (board: PlaitBoard, elements: PlaitElement[]) => SVGGElement | null;
19
- export declare const createGroup: (groupId?: string) => PlaitGroup;
20
- export declare const nonGroupInHighestSelectedElements: (elements: PlaitElement[]) => boolean;
21
- export declare const hasSelectedElementsInSameGroup: (elements: PlaitElement[]) => boolean;
22
- export declare const canAddGroup: (board: PlaitBoard, elements?: PlaitElement[]) => boolean;
23
- export declare const canRemoveGroup: (board: PlaitBoard, elements?: PlaitElement[], originElements?: PlaitElement[]) => boolean;
24
- export declare const getEditingGroup: (board: PlaitBoard, element: PlaitElement) => PlaitGroup | null;
25
- export declare const moveElementsToNewPathAfterAddGroup: (board: PlaitBoard, selectedElements: PlaitElement[], newPath: Path) => void;
package/utils/helper.d.ts DELETED
@@ -1,17 +0,0 @@
1
- import { PlaitElement } from '../interfaces';
2
- export declare function isNullOrUndefined(value: any): boolean;
3
- /**
4
- * get {x,y} point
5
- * @param point
6
- * @returns point
7
- */
8
- export declare function normalizePoint(point: number[]): {
9
- x: number;
10
- y: number;
11
- };
12
- export declare const rgbaToHEX: (rgb: string, opacity: number) => string;
13
- export declare function isContextmenu(event: MouseEvent): boolean;
14
- export declare function uniqueById(elements: PlaitElement[]): any[];
15
- export declare const findLastIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
16
- export declare const findIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
17
- export declare const isIndicesContinuous: (indexes: number[]) => boolean;
@@ -1,49 +0,0 @@
1
- import { PlaitBoard, PlaitOperation } from '../interfaces';
2
- /**
3
- * Check whether to merge an operation into the previous operation.
4
- */
5
- export declare const shouldMerge: (op: PlaitOperation, prev: PlaitOperation | undefined) => boolean;
6
- /**
7
- * Check whether an operation needs to be saved to the history.
8
- */
9
- export declare const shouldSave: (op: PlaitOperation, prev: PlaitOperation | undefined) => boolean;
10
- /**
11
- * Check whether an operation should clear the redos stack.
12
- */
13
- export declare const shouldClear: (op: PlaitOperation) => boolean;
14
- export declare const PlaitHistoryBoard: {
15
- /**
16
- * Get the saving flag's current value.
17
- */
18
- isSaving(board: PlaitBoard): boolean | undefined;
19
- /**
20
- * Get the merge flag's current value.
21
- */
22
- isMerging(board: PlaitBoard): boolean | undefined;
23
- /**
24
- * Get the splitting once flag's current value.
25
- */
26
- isSplittingOnce(board: PlaitBoard): boolean | undefined;
27
- setSplittingOnce(board: PlaitBoard, value: boolean | undefined): void;
28
- /**
29
- * Apply a series of changes inside a synchronous `fn`, These operations will
30
- * be merged into the previous history.
31
- */
32
- withMerging(board: PlaitBoard, fn: () => void): void;
33
- /**
34
- * Apply a series of changes inside a synchronous `fn`, ensuring that the first
35
- * operation starts a new batch in the history. Subsequent operations will be
36
- * merged as usual.
37
- */
38
- withNewBatch(board: PlaitBoard, fn: () => void): void;
39
- /**
40
- * Apply a series of changes inside a synchronous `fn`, without merging any of
41
- * the new operations into previous save point in the history.
42
- */
43
- withoutMerging(board: PlaitBoard, fn: () => void): void;
44
- /**
45
- * Apply a series of changes inside a synchronous `fn`, without saving any of
46
- * their operations into the history.
47
- */
48
- withoutSaving(board: PlaitBoard, fn: () => void): void;
49
- };
@@ -1,37 +0,0 @@
1
- /**
2
- * Hotkeys.
3
- */
4
- declare const hotkeys: {
5
- isBold: (event: KeyboardEvent) => boolean;
6
- isCompose: (event: KeyboardEvent) => boolean;
7
- isArrow: (event: KeyboardEvent) => boolean;
8
- isMoveBackward: (event: KeyboardEvent) => boolean;
9
- isMoveForward: (event: KeyboardEvent) => boolean;
10
- isMoveUp: (event: KeyboardEvent) => boolean;
11
- isMoveDown: (event: KeyboardEvent) => boolean;
12
- isDeleteBackward: (event: KeyboardEvent) => boolean;
13
- isDeleteForward: (event: KeyboardEvent) => boolean;
14
- isDeleteLineBackward: (event: KeyboardEvent) => boolean;
15
- isDeleteLineForward: (event: KeyboardEvent) => boolean;
16
- isDeleteWordBackward: (event: KeyboardEvent) => boolean;
17
- isDeleteWordForward: (event: KeyboardEvent) => boolean;
18
- isExtendBackward: (event: KeyboardEvent) => boolean;
19
- isExtendForward: (event: KeyboardEvent) => boolean;
20
- isExtendUp: (event: KeyboardEvent) => boolean;
21
- isExtendDown: (event: KeyboardEvent) => boolean;
22
- isExtendArrow: (event: KeyboardEvent) => boolean;
23
- isExtendLineBackward: (event: KeyboardEvent) => boolean;
24
- isExtendLineForward: (event: KeyboardEvent) => boolean;
25
- isItalic: (event: KeyboardEvent) => boolean;
26
- isMoveLineBackward: (event: KeyboardEvent) => boolean;
27
- isMoveLineForward: (event: KeyboardEvent) => boolean;
28
- isMoveWordBackward: (event: KeyboardEvent) => boolean;
29
- isMoveWordForward: (event: KeyboardEvent) => boolean;
30
- isRedo: (event: KeyboardEvent) => boolean;
31
- isSplitBlock: (event: KeyboardEvent) => boolean;
32
- isTransposeCharacter: (event: KeyboardEvent) => boolean;
33
- isUndo: (event: KeyboardEvent) => boolean;
34
- isShift: (event: KeyboardEvent) => boolean;
35
- };
36
- export default hotkeys;
37
- export { hotkeys };
@@ -1 +0,0 @@
1
- export declare function idCreator(length?: number): string;
package/utils/index.d.ts DELETED
@@ -1,34 +0,0 @@
1
- export * from './board';
2
- export * from './dom';
3
- export * from './environment';
4
- export * from './helper';
5
- export * from './history';
6
- export * from './hotkeys';
7
- export * from './id-creator';
8
- export * from './math';
9
- export * from './weak-maps';
10
- export * from './selected-element';
11
- export * from './drawing/rectangle';
12
- export * from './drawing/arrow';
13
- export * from './drawing/circle';
14
- export * from './drawing/line';
15
- export * from './tree';
16
- export * from './element';
17
- export * from './viewport';
18
- export * from './common';
19
- export * from './moving-element';
20
- export * from './to-image';
21
- export * from './clipboard/types';
22
- export * from './clipboard/clipboard';
23
- export * from './clipboard/common';
24
- export * from './clipboard';
25
- export * from './dnd';
26
- export * from './to-point';
27
- export * from './group';
28
- export * from './selection';
29
- export * from './angle';
30
- export * from './fragment';
31
- export * from './snap/snap';
32
- export * from './z-index';
33
- export * from './position';
34
- export * from './pointer';
@@ -1,10 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- export declare function isListLikeIterable(obj: any): boolean;
9
- export declare function isJsObject(o: any): boolean;
10
- export declare function iterateListLike<T>(obj: Iterable<T>, fn: (p: T) => void): void;
package/utils/math.d.ts DELETED
@@ -1,67 +0,0 @@
1
- import { Point, SVGArcCommand } from '../interfaces';
2
- import { RectangleClient } from '../interfaces/rectangle-client';
3
- export declare function distanceBetweenPointAndSegment(x: number, y: number, x1: number, y1: number, x2: number, y2: number): number;
4
- export declare function getNearestPointBetweenPointAndSegment(point: Point, linePoints: [Point, Point]): Point;
5
- export declare function distanceBetweenPointAndSegments(point: Point, points: Point[]): number;
6
- export declare function getNearestPointBetweenPointAndSegments(point: Point, points: Point[], isClose?: Boolean): Point;
7
- export declare function getNearestPointBetweenPointAndDiscreteSegments(point: Point, segments: [Point, Point][]): Point;
8
- export declare function getNearestPointBetweenPointAndEllipse(point: Point, center: Point, rx: number, ry: number): Point;
9
- export declare function rotate(x1: number, y1: number, x2: number, y2: number, angle: number): number[];
10
- export declare function distanceBetweenPointAndPoint(x1: number, y1: number, x2: number, y2: number): number;
11
- export declare function distanceBetweenPointAndRectangle(x: number, y: number, rect: RectangleClient): number;
12
- export declare const isLineHitLine: (a: Point, b: Point, c: Point, d: Point) => boolean;
13
- export declare const isLineHitRectangle: (points: Point[], rectangle: RectangleClient) => boolean;
14
- export declare const isLineHitRectangleEdge: (points: Point[], rectangle: RectangleClient, isClose?: boolean) => boolean;
15
- export declare const isSingleLineHitRectangleEdge: (p1: Point, p2: Point, rectangle: RectangleClient) => boolean;
16
- export declare const isPointInPolygon: (point: Point, points: Point[]) => boolean;
17
- export declare const isPointInEllipse: (point: Point, center: Point, rx: number, ry: number, angle?: number) => boolean;
18
- export declare const isPointInRoundRectangle: (point: Point, rectangle: RectangleClient, radius: number, angle?: number) => boolean;
19
- export declare const catmullRomFitting: (points: Point[]) => Point[];
20
- /**
21
- * the result of slope is based on Cartesian coordinate system
22
- * x, y are based on the position in the Cartesian coordinate system
23
- */
24
- export declare function getEllipseTangentSlope(x: number, y: number, a: number, b: number): number;
25
- /**
26
- * x, y are based on the position in the Cartesian coordinate system
27
- */
28
- export declare function getVectorFromPointAndSlope(x: number, y: number, slope: number): Point;
29
- /**
30
- * The DOM likes values to be fixed to 3 decimal places
31
- */
32
- export declare function toDomPrecision(v: number): number;
33
- export declare function toFixed(v: number): number;
34
- export declare function ceilToDecimal(value: number, decimalPlaces: number): number;
35
- /**
36
- * Whether two numbers numbers a and b are approximately equal.
37
- *
38
- * @param a - The first point.
39
- * @param b - The second point.
40
- * @public
41
- */
42
- export declare function approximately(a: number, b: number, precision?: number): boolean;
43
- export declare function getCrossingPointsBetweenEllipseAndSegment(startPoint: Point, endPoint: Point, cx: number, cy: number, rx: number, ry: number, segment_only?: boolean): number[][];
44
- /**
45
- * Get a point between two points.
46
- * @param x0 The x-axis coordinate of the first point.
47
- * @param y0 The y-axis coordinate of the first point.
48
- * @param x1 The x-axis coordinate of the second point.
49
- * @param y1 The y-axis coordinate of the second point.
50
- * @param d Normalized
51
- */
52
- export declare function getPointBetween(x0: number, y0: number, x1: number, y1: number, d?: number): number[];
53
- /**
54
- * 获取点到半椭圆弧段的最近点
55
- * @param point 目标点
56
- * @param startPoint 弧段起点
57
- * @param arcCommand SVG 弧形命令参数
58
- */
59
- /**
60
- * 计算椭圆弧的中心点和实际半径
61
- */
62
- export declare function getEllipseArcCenter(startPoint: Point, arcCommand: SVGArcCommand): {
63
- center: Point;
64
- rx: number;
65
- ry: number;
66
- };
67
- export declare function getNearestPointBetweenPointAndArc(point: Point, startPoint: Point, arcCommand: SVGArcCommand): Point;
@@ -1,5 +0,0 @@
1
- import { PlaitBoard, PlaitElement } from '../interfaces';
2
- export declare const getMovingElements: (board: PlaitBoard) => PlaitElement[];
3
- export declare const isMovingElements: (board: PlaitBoard) => boolean;
4
- export declare const removeMovingElements: (board: PlaitBoard) => void;
5
- export declare const cacheMovingElements: (board: PlaitBoard, elements: PlaitElement[]) => void;
@@ -1,5 +0,0 @@
1
- export declare const isMobileDeviceEvent: (event: PointerEvent) => boolean;
2
- export declare const isPencilEvent: (event: PointerEvent) => boolean;
3
- export declare const isTouchEvent: (event: PointerEvent) => boolean;
4
- export declare const isMouseEvent: (event: PointerEvent) => boolean;
5
- export declare const isTouchDevice: () => number | true;
@@ -1,2 +0,0 @@
1
- import { PlaitBoard, PlaitElement } from '../interfaces';
2
- export declare const sortElements: (board: PlaitBoard, elements: PlaitElement[], ascendingOrder?: boolean) => PlaitElement[];
@@ -1,19 +0,0 @@
1
- import { PlaitBoard } from '../interfaces/board';
2
- import { Selection } from '../interfaces/selection';
3
- import { PlaitElement } from '../interfaces/element';
4
- import { Point } from '../interfaces/point';
5
- import { PlaitOptionsBoard } from '../plugins/with-options';
6
- export declare const getHitElementsBySelection: (board: PlaitBoard, selection?: Selection, match?: (element: PlaitElement) => boolean) => PlaitElement[];
7
- export declare const getHitElementsByPoint: (board: PlaitBoard, point: Point, match?: (element: PlaitElement) => boolean, isStrict?: boolean) => PlaitElement[];
8
- export declare const getHitElementByPoint: (board: PlaitBoard, point: Point, match?: (element: PlaitElement) => boolean, isStrict?: boolean) => undefined | PlaitElement;
9
- export declare const getHitSelectedElements: (board: PlaitBoard, point: Point) => PlaitElement[];
10
- export declare const cacheSelectedElements: (board: PlaitBoard, selectedElements: PlaitElement[]) => void;
11
- export declare const getSelectedElements: (board: PlaitBoard) => PlaitElement[];
12
- export declare const addSelectedElement: (board: PlaitBoard, element: PlaitElement | PlaitElement[]) => void;
13
- export declare const removeSelectedElement: (board: PlaitBoard, element: PlaitElement, isRemoveChildren?: boolean) => void;
14
- export declare const replaceSelectedElement: (board: PlaitBoard, element: PlaitElement, newElement: PlaitElement) => void;
15
- export declare const clearSelectedElement: (board: PlaitBoard) => void;
16
- export declare const isSelectedElement: (board: PlaitBoard, element: PlaitElement) => boolean;
17
- export declare const temporaryDisableSelection: (board: PlaitOptionsBoard) => void;
18
- export declare const isHitSelectedRectangle: (board: PlaitBoard, point: Point) => boolean;
19
- export declare const isHitElement: (board: PlaitBoard, point: Point) => boolean;
@@ -1,18 +0,0 @@
1
- import { PlaitBoard, PlaitElement, PlaitGroup, WithSelectionPluginOptions } from '../interfaces';
2
- export declare function isSelectionMoving(board: PlaitBoard): boolean;
3
- export declare function setSelectionMoving(board: PlaitBoard): void;
4
- export declare function clearSelectionMoving(board: PlaitBoard): void;
5
- export declare function isHandleSelection(board: PlaitBoard): boolean;
6
- export declare function hasSetSelectionOperation(board: PlaitBoard): boolean;
7
- export declare function getTemporaryElements(board: PlaitBoard): PlaitElement[] | undefined;
8
- export declare function getTemporaryRef(board: PlaitBoard): {
9
- elements: PlaitElement[];
10
- timeoutId: any;
11
- } | undefined;
12
- export declare function deleteTemporaryElements(board: PlaitBoard): void;
13
- export declare function drawSelectionRectangleG(board: PlaitBoard): SVGGElement | null;
14
- export declare function setSelectedElementsWithGroup(board: PlaitBoard, elements: PlaitElement[], isShift: boolean): void;
15
- export declare function cacheSelectedElementsWithGroupOnShift(board: PlaitBoard, elements: PlaitElement[], isSelectGroupElement: boolean, elementsInHighestGroup: PlaitElement[]): void;
16
- export declare function cacheSelectedElementsWithGroup(board: PlaitBoard, elements: PlaitElement[], isSelectGroupElement: boolean, hitElementGroups: PlaitGroup[]): void;
17
- export declare const getSelectionOptions: (board: PlaitBoard) => WithSelectionPluginOptions;
18
- export declare const setSelectionOptions: (board: PlaitBoard, options: Partial<WithSelectionPluginOptions>) => void;
@@ -1,5 +0,0 @@
1
- import { PlaitBoard } from '../../interfaces/board';
2
- import { PlaitElement } from '../../interfaces/element';
3
- import { RectangleClient } from '../../interfaces';
4
- import { SnapRef } from './snap';
5
- export declare function getSnapMovingRef(board: PlaitBoard, activeRectangle: RectangleClient, activeElements: PlaitElement[]): SnapRef;