@plait/core 0.91.1 → 0.92.0-next.1

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,31 +0,0 @@
1
- import { PlaitBoard, PlaitElement, Point, RectangleClient } from '../../interfaces';
2
- export interface SnapDelta {
3
- deltaX: number;
4
- deltaY: number;
5
- }
6
- export interface SnapRef extends SnapDelta {
7
- snapG: SVGGElement;
8
- }
9
- export interface GapSnapRef {
10
- before: {
11
- distance: number;
12
- index: number;
13
- }[];
14
- after: {
15
- distance: number;
16
- index: number;
17
- }[];
18
- }
19
- type TripleSnapAxis = [number, number, number];
20
- export declare const SNAP_TOLERANCE = 2;
21
- export declare function getSnapRectangles(board: PlaitBoard, activeElements: PlaitElement[]): RectangleClient[];
22
- export declare function getBarPoint(point: Point, isHorizontal: boolean): number[][];
23
- export declare function getMinPointDelta(pointRectangles: RectangleClient[], axis: number, isHorizontal: boolean): number;
24
- export declare const getNearestDelta: (axis: number, rectangle: RectangleClient, isHorizontal: boolean) => number;
25
- export declare const getTripleAxis: (rectangle: RectangleClient, isHorizontal: boolean) => TripleSnapAxis;
26
- export declare function getNearestPointRectangle(snapRectangles: RectangleClient[], activeRectangle: RectangleClient): RectangleClient;
27
- export declare const isSnapPoint: (axis: number, rectangle: RectangleClient, isHorizontal: boolean) => boolean;
28
- export declare function drawPointSnapLines(board: PlaitBoard, activeRectangle: RectangleClient, snapRectangles: RectangleClient[], drawHorizontal?: boolean, drawVertical?: boolean, snapMiddle?: boolean): SVGGElement;
29
- export declare function drawDashedLines(board: PlaitBoard, lines: [Point, Point][]): SVGGElement;
30
- export declare function drawSolidLines(board: PlaitBoard, lines: Point[][]): SVGGElement;
31
- export {};
@@ -1,22 +0,0 @@
1
- import { PlaitBoard, PlaitElement } from '../interfaces';
2
- export interface ToImageOptions {
3
- elements?: PlaitElement[];
4
- name?: string;
5
- ratio?: number;
6
- padding?: number;
7
- fillStyle?: string;
8
- inlineStyleClassNames?: string;
9
- }
10
- /**
11
- * current board transfer pictures
12
- * @param board board
13
- * @param options parameter configuration
14
- * @returns images in the specified format base64
15
- */
16
- export declare function toImage(board: PlaitBoard, options: ToImageOptions): Promise<string | undefined>;
17
- /**
18
- * download the file with the specified name
19
- * @param url download url
20
- * @param name file name
21
- */
22
- export declare function downloadImage(url: string, name: string): void;
@@ -1,31 +0,0 @@
1
- import { RectangleClient } from '../interfaces';
2
- import { PlaitBoard } from '../interfaces/board';
3
- import { Point } from '../interfaces/point';
4
- export declare const getViewBox: (board: PlaitBoard) => DOMRect;
5
- /**
6
- * Get the screen point starting from the upper left corner of the svg element (based on the svg screen coordinate system)
7
- * reference: https://github.com/worktile/plait/blob/develop/packages/core/src/utils/to-point.md
8
- */
9
- export declare function toHostPoint(board: PlaitBoard, x: number, y: number): Point;
10
- export declare function toActiveRectangleFromViewBoxRectangle(board: PlaitBoard, rectangle: RectangleClient): RectangleClient;
11
- export declare function toActivePointFromViewBoxPoint(board: PlaitBoard, point: Point): Point;
12
- /**
13
- * Get the screen point starting from the upper left corner of the svg element (based on the svg screen coordinate system)
14
- */
15
- export declare function toActivePoint(board: PlaitBoard, x: number, y: number): Point;
16
- export declare function toScreenPointFromActivePoint(board: PlaitBoard, activePoint: Point): Point;
17
- /**
18
- * Get the point in the coordinate system of the svg viewBox
19
- * reference: https://github.com/worktile/plait/blob/develop/packages/core/src/utils/to-point.md
20
- */
21
- export declare function toViewBoxPoint(board: PlaitBoard, hostPoint: Point): Point;
22
- export declare function toViewBoxPoints(board: PlaitBoard, hostPoints: Point[]): Point[];
23
- /**
24
- * `toHostPoint` reverse processing
25
- * Get the screen point starting from the upper left corner of the browser window or the viewport (based on the screen coordinate system)
26
- */
27
- export declare function toScreenPointFromHostPoint(board: PlaitBoard, hostPoint: Point): Point;
28
- /**
29
- * `toViewBoxPoint` reverse processing
30
- */
31
- export declare function toHostPointFromViewBoxPoint(board: PlaitBoard, viewBoxPoint: Point): Point;
package/utils/tree.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import { PlaitBoard } from '../interfaces/board';
2
- import { PlaitElement } from '../interfaces/element';
3
- export declare function depthFirstRecursion<T extends TreeNode = TreeNode>(node: T, callback: (node: T) => void, recursion?: (node: T) => boolean, isReverse?: boolean): void;
4
- export declare const getIsRecursionFunc: (board: PlaitBoard) => (element: PlaitElement | PlaitBoard) => boolean;
5
- export interface TreeNode {
6
- children?: TreeNode[];
7
- }
@@ -1,50 +0,0 @@
1
- import { PlaitBoard, Point, RectangleClient } from '../interfaces';
2
- export declare const VIEWPORT_PADDING_RATIO = 0.75;
3
- export interface ElementHostBBox {
4
- left: number;
5
- right: number;
6
- top: number;
7
- bottom: number;
8
- }
9
- export declare function getViewportContainerRect(board: PlaitBoard): {
10
- width: number;
11
- height: number;
12
- };
13
- export declare function getElementHostBBox(board: PlaitBoard, zoom: number): ElementHostBBox;
14
- /**
15
- * Normalize the scaling ratio, or return the corrected scaling ratio if the limit is exceeded
16
- */
17
- export declare function clampZoomLevel(zoom: number, minZoom?: number, maxZoom?: number): number;
18
- /**
19
- * Prepares element bounding box with minimum size constraints
20
- */
21
- export declare function prepareElementBBox(board: PlaitBoard, zoom: number): {
22
- elementHostBBox: ElementHostBBox;
23
- containerWidth: number;
24
- containerHeight: number;
25
- width: number;
26
- height: number;
27
- };
28
- /**
29
- * Calculates viewBox based on element bounding box with padding
30
- */
31
- export declare function calculateViewBox(elementHostBBox: ElementHostBBox, containerWidth: number, containerHeight: number, width: number, height: number, zoom: number, paddingRatio?: number): number[];
32
- export declare function calcNewViewBox(board: PlaitBoard, zoom: number): number[];
33
- export declare function getViewBoxCenterPoint(board: PlaitBoard): Point;
34
- export declare function setSVGViewBox(board: PlaitBoard, viewBox: number[]): void;
35
- export declare function updateViewportOffset(board: PlaitBoard): void;
36
- export declare function updateViewportContainerScroll(board: PlaitBoard, left: number, top: number, isFromViewportChange?: boolean): void;
37
- export declare function updateViewportByScrolling(board: PlaitBoard, scrollLeft: number, scrollTop: number): void;
38
- export declare function initializeViewportContainer(board: PlaitBoard): void;
39
- export declare function initializeViewBox(board: PlaitBoard): void;
40
- export declare function updateViewBox(board: PlaitBoard): void;
41
- export declare function initializeViewportOffset(board: PlaitBoard): void;
42
- export declare const updateViewportOrigination: (board: PlaitBoard, origination: Point) => void;
43
- export declare const clearViewportOrigination: (board: PlaitBoard) => void;
44
- export declare const getViewportOrigination: (board: PlaitBoard) => Point | undefined;
45
- export declare const isFromScrolling: (board: PlaitBoard) => boolean;
46
- export declare const setIsFromScrolling: (board: PlaitBoard, state: boolean) => void;
47
- export declare const isFromViewportChange: (board: PlaitBoard) => boolean;
48
- export declare const setIsFromViewportChange: (board: PlaitBoard, state: boolean) => void;
49
- export declare const isInVisibleViewport: (board: PlaitBoard, client: RectangleClient, isOpenKeyboard?: boolean) => boolean;
50
- export declare function scrollToVisibleWhenKeyboardOpening(board: PlaitBoard, client: RectangleClient): void;
@@ -1,43 +0,0 @@
1
- import { RoughSVG } from 'roughjs/bin/svg';
2
- import { PlaitElement } from '../interfaces/element';
3
- import { PlaitBoard } from '../interfaces/board';
4
- import { Point } from '../interfaces/point';
5
- import { Ancestor } from '../interfaces/node';
6
- import { PathRef } from '../interfaces/path-ref';
7
- import { PlaitElementRef } from '../core/element/element-ref';
8
- import { PlaitBoardContext } from '../context';
9
- export declare const IS_BOARD_CACHE: WeakMap<Object, boolean>;
10
- export declare const FLUSHING: WeakMap<PlaitBoard, boolean>;
11
- export declare const NODE_TO_INDEX: WeakMap<PlaitElement, number>;
12
- export declare const NODE_TO_PARENT: WeakMap<PlaitElement, Ancestor>;
13
- export declare const KEY_TO_ELEMENT_MAP: WeakMap<PlaitBoard, Map<String, PlaitElement>>;
14
- export declare const NODE_TO_G: WeakMap<PlaitElement, SVGGElement>;
15
- export declare const NODE_TO_CONTAINER_G: WeakMap<PlaitElement, SVGGElement>;
16
- export declare const IS_TEXT_EDITABLE: WeakMap<PlaitBoard, boolean>;
17
- export declare const BOARD_TO_ON_CHANGE: WeakMap<PlaitBoard, () => void>;
18
- export declare const BOARD_TO_AFTER_CHANGE: WeakMap<PlaitBoard, () => void>;
19
- export declare const BOARD_TO_ROUGH_SVG: WeakMap<PlaitBoard, RoughSVG>;
20
- export declare const BOARD_TO_HOST: WeakMap<PlaitBoard, SVGSVGElement>;
21
- export declare const BOARD_TO_CONTEXT: WeakMap<PlaitBoard, PlaitBoardContext>;
22
- export declare const IS_BOARD_ALIVE: WeakMap<PlaitBoard, boolean>;
23
- export declare const BOARD_TO_ELEMENT_HOST: WeakMap<PlaitBoard, {
24
- lowerHost: SVGGElement;
25
- host: SVGGElement;
26
- upperHost: SVGGElement;
27
- topHost: SVGGElement;
28
- activeHost: SVGGElement;
29
- container: HTMLElement;
30
- viewportContainer: HTMLElement;
31
- }>;
32
- export declare const BOARD_TO_SELECTED_ELEMENT: WeakMap<PlaitBoard, PlaitElement[]>;
33
- export declare const BOARD_TO_MOVING_POINT_IN_BOARD: WeakMap<PlaitBoard, Point>;
34
- export declare const BOARD_TO_MOVING_POINT: WeakMap<PlaitBoard, Point>;
35
- export declare const BOARD_TO_VIEWPORT_ORIGINATION: WeakMap<PlaitBoard, Point>;
36
- export declare const BOARD_TO_IS_SELECTION_MOVING: WeakMap<PlaitBoard, boolean>;
37
- export declare const BOARD_TO_TEMPORARY_ELEMENTS: WeakMap<PlaitBoard, {
38
- elements: PlaitElement[];
39
- timeoutId: any;
40
- }>;
41
- export declare const BOARD_TO_MOVING_ELEMENT: WeakMap<PlaitBoard, PlaitElement[]>;
42
- export declare const PATH_REFS: WeakMap<PlaitBoard, Set<PathRef>>;
43
- export declare const ELEMENT_TO_REF: WeakMap<PlaitElement, PlaitElementRef>;
@@ -1,5 +0,0 @@
1
- import { PlaitBoard } from '../interfaces';
2
- import { MoveNodeOption } from './common';
3
- export declare const getOneMoveOptions: (board: PlaitBoard, direction: "down" | "up") => MoveNodeOption[];
4
- export declare const getAllMoveOptions: (board: PlaitBoard, direction: "down" | "up") => MoveNodeOption[];
5
- export declare const canSetZIndex: (board: PlaitBoard) => boolean;