@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.
- package/index.d.ts +1464 -3
- package/package.json +1 -1
- package/constants/cursor.d.ts +0 -10
- package/constants/index.d.ts +0 -19
- package/constants/keycodes.d.ts +0 -126
- package/constants/selection.d.ts +0 -5
- package/constants/zoom.d.ts +0 -3
- package/context.d.ts +0 -7
- package/core/element/context-change.d.ts +0 -10
- package/core/element/context.d.ts +0 -14
- package/core/element/element-flavour.d.ts +0 -30
- package/core/element/element-ref.d.ts +0 -5
- package/core/list-render.d.ts +0 -14
- package/differs/default_iterable_differ.d.ts +0 -141
- package/differs/iterable_differs.d.ts +0 -141
- package/interfaces/board.d.ts +0 -113
- package/interfaces/custom-types.d.ts +0 -9
- package/interfaces/direction.d.ts +0 -11
- package/interfaces/element.d.ts +0 -27
- package/interfaces/group.d.ts +0 -7
- package/interfaces/history.d.ts +0 -10
- package/interfaces/index.d.ts +0 -18
- package/interfaces/node.d.ts +0 -21
- package/interfaces/operation.d.ts +0 -53
- package/interfaces/path-ref.d.ts +0 -13
- package/interfaces/path.d.ts +0 -52
- package/interfaces/plugin.d.ts +0 -17
- package/interfaces/point.d.ts +0 -15
- package/interfaces/pointer.d.ts +0 -4
- package/interfaces/rectangle-client.d.ts +0 -49
- package/interfaces/selection.d.ts +0 -10
- package/interfaces/svg-arc-command.d.ts +0 -9
- package/interfaces/theme.d.ts +0 -24
- package/interfaces/viewport.d.ts +0 -18
- package/plugins/create-board.d.ts +0 -3
- package/plugins/index.d.ts +0 -11
- package/plugins/with-board.d.ts +0 -2
- package/plugins/with-hand.d.ts +0 -4
- package/plugins/with-history.d.ts +0 -2
- package/plugins/with-hotkey.d.ts +0 -2
- package/plugins/with-i18n.d.ts +0 -6
- package/plugins/with-moving.d.ts +0 -8
- package/plugins/with-options.d.ts +0 -7
- package/plugins/with-related-fragment.d.ts +0 -2
- package/plugins/with-selection.d.ts +0 -2
- package/public-api.d.ts +0 -12
- package/testing/core/create-board.d.ts +0 -6
- package/testing/core/fake-weak-map.d.ts +0 -4
- package/testing/core/index.d.ts +0 -2
- package/testing/fake-events/event-objects.d.ts +0 -46
- package/testing/fake-events/index.d.ts +0 -1
- package/testing/index.d.ts +0 -2
- package/testing/test-element.d.ts +0 -14
- package/transforms/board.d.ts +0 -25
- package/transforms/element.d.ts +0 -6
- package/transforms/general.d.ts +0 -6
- package/transforms/group.d.ts +0 -11
- package/transforms/index.d.ts +0 -9
- package/transforms/node.d.ts +0 -14
- package/transforms/selection.d.ts +0 -10
- package/transforms/theme.d.ts +0 -7
- package/transforms/viewport.d.ts +0 -7
- package/transforms/z-index.d.ts +0 -13
- package/utils/angle.d.ts +0 -24
- package/utils/board.d.ts +0 -11
- package/utils/clipboard/clipboard.d.ts +0 -5
- package/utils/clipboard/common.d.ts +0 -12
- package/utils/clipboard/data-transfer.d.ts +0 -5
- package/utils/clipboard/index.d.ts +0 -2
- package/utils/clipboard/navigator-clipboard.d.ts +0 -3
- package/utils/clipboard/types.d.ts +0 -24
- package/utils/common.d.ts +0 -13
- package/utils/debug.d.ts +0 -14
- package/utils/dnd.d.ts +0 -4
- package/utils/dom/common.d.ts +0 -23
- package/utils/dom/environment.d.ts +0 -1
- package/utils/dom/foreign.d.ts +0 -3
- package/utils/dom/index.d.ts +0 -3
- package/utils/drawing/arrow.d.ts +0 -8
- package/utils/drawing/circle.d.ts +0 -4
- package/utils/drawing/line.d.ts +0 -6
- package/utils/drawing/rectangle.d.ts +0 -9
- package/utils/element.d.ts +0 -11
- package/utils/environment.d.ts +0 -8
- package/utils/fragment.d.ts +0 -5
- package/utils/group.d.ts +0 -25
- package/utils/helper.d.ts +0 -17
- package/utils/history.d.ts +0 -49
- package/utils/hotkeys.d.ts +0 -37
- package/utils/id-creator.d.ts +0 -1
- package/utils/index.d.ts +0 -34
- package/utils/iterable.d.ts +0 -10
- package/utils/math.d.ts +0 -67
- package/utils/moving-element.d.ts +0 -5
- package/utils/pointer.d.ts +0 -5
- package/utils/position.d.ts +0 -2
- package/utils/selected-element.d.ts +0 -19
- package/utils/selection.d.ts +0 -18
- package/utils/snap/snap-moving.d.ts +0 -5
- package/utils/snap/snap.d.ts +0 -31
- package/utils/to-image.d.ts +0 -22
- package/utils/to-point.d.ts +0 -31
- package/utils/tree.d.ts +0 -7
- package/utils/viewport.d.ts +0 -50
- package/utils/weak-maps.d.ts +0 -43
- package/utils/z-index.d.ts +0 -5
package/package.json
CHANGED
package/constants/cursor.d.ts
DELETED
package/constants/index.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export * from './keycodes';
|
|
2
|
-
export * from './cursor';
|
|
3
|
-
export * from './selection';
|
|
4
|
-
export * from './zoom';
|
|
5
|
-
export declare const HOST_CLASS_NAME = "plait-board-container";
|
|
6
|
-
export declare const ACTIVE_MOVING_CLASS_NAME = "active-with-moving";
|
|
7
|
-
export declare const ROTATE_HANDLE_CLASS_NAME = "rotate-handle";
|
|
8
|
-
export declare const RESIZE_HANDLE_CLASS_NAME = "resize-handle";
|
|
9
|
-
export declare const SCROLL_BAR_WIDTH = 20;
|
|
10
|
-
export declare const MAX_RADIUS = 16;
|
|
11
|
-
export declare const POINTER_BUTTON: {
|
|
12
|
-
readonly MAIN: 0;
|
|
13
|
-
readonly WHEEL: 1;
|
|
14
|
-
readonly SECONDARY: 2;
|
|
15
|
-
readonly TOUCH: -1;
|
|
16
|
-
};
|
|
17
|
-
export declare const PRESS_AND_MOVE_BUFFER = 3;
|
|
18
|
-
export declare const DRAG_SELECTION_PRESS_AND_MOVE_BUFFER = 10;
|
|
19
|
-
export declare const HIT_DISTANCE_BUFFER = 5;
|
package/constants/keycodes.d.ts
DELETED
|
@@ -1,126 +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 const MAC_ENTER = 3;
|
|
9
|
-
export declare const BACKSPACE = 8;
|
|
10
|
-
export declare const TAB = 9;
|
|
11
|
-
export declare const NUM_CENTER = 12;
|
|
12
|
-
export declare const ENTER = 13;
|
|
13
|
-
export declare const SHIFT = 16;
|
|
14
|
-
export declare const CONTROL = 17;
|
|
15
|
-
export declare const ALT = 18;
|
|
16
|
-
export declare const PAUSE = 19;
|
|
17
|
-
export declare const CAPS_LOCK = 20;
|
|
18
|
-
export declare const ESCAPE = 27;
|
|
19
|
-
export declare const SPACE = 32;
|
|
20
|
-
export declare const PAGE_UP = 33;
|
|
21
|
-
export declare const PAGE_DOWN = 34;
|
|
22
|
-
export declare const END = 35;
|
|
23
|
-
export declare const HOME = 36;
|
|
24
|
-
export declare const LEFT_ARROW = 37;
|
|
25
|
-
export declare const UP_ARROW = 38;
|
|
26
|
-
export declare const RIGHT_ARROW = 39;
|
|
27
|
-
export declare const DOWN_ARROW = 40;
|
|
28
|
-
export declare const PLUS_SIGN = 43;
|
|
29
|
-
export declare const PRINT_SCREEN = 44;
|
|
30
|
-
export declare const INSERT = 45;
|
|
31
|
-
export declare const DELETE = 46;
|
|
32
|
-
export declare const ZERO = 48;
|
|
33
|
-
export declare const ONE = 49;
|
|
34
|
-
export declare const TWO = 50;
|
|
35
|
-
export declare const THREE = 51;
|
|
36
|
-
export declare const FOUR = 52;
|
|
37
|
-
export declare const FIVE = 53;
|
|
38
|
-
export declare const SIX = 54;
|
|
39
|
-
export declare const SEVEN = 55;
|
|
40
|
-
export declare const EIGHT = 56;
|
|
41
|
-
export declare const NINE = 57;
|
|
42
|
-
export declare const FF_SEMICOLON = 59;
|
|
43
|
-
export declare const FF_EQUALS = 61;
|
|
44
|
-
export declare const QUESTION_MARK = 63;
|
|
45
|
-
export declare const AT_SIGN = 64;
|
|
46
|
-
export declare const A = 65;
|
|
47
|
-
export declare const B = 66;
|
|
48
|
-
export declare const C = 67;
|
|
49
|
-
export declare const D = 68;
|
|
50
|
-
export declare const E = 69;
|
|
51
|
-
export declare const F = 70;
|
|
52
|
-
export declare const G = 71;
|
|
53
|
-
export declare const H = 72;
|
|
54
|
-
export declare const I = 73;
|
|
55
|
-
export declare const J = 74;
|
|
56
|
-
export declare const K = 75;
|
|
57
|
-
export declare const L = 76;
|
|
58
|
-
export declare const M = 77;
|
|
59
|
-
export declare const N = 78;
|
|
60
|
-
export declare const O = 79;
|
|
61
|
-
export declare const P = 80;
|
|
62
|
-
export declare const Q = 81;
|
|
63
|
-
export declare const R = 82;
|
|
64
|
-
export declare const S = 83;
|
|
65
|
-
export declare const T = 84;
|
|
66
|
-
export declare const U = 85;
|
|
67
|
-
export declare const V = 86;
|
|
68
|
-
export declare const W = 87;
|
|
69
|
-
export declare const X = 88;
|
|
70
|
-
export declare const Y = 89;
|
|
71
|
-
export declare const Z = 90;
|
|
72
|
-
export declare const META = 91;
|
|
73
|
-
export declare const MAC_WK_CMD_LEFT = 91;
|
|
74
|
-
export declare const MAC_WK_CMD_RIGHT = 93;
|
|
75
|
-
export declare const CONTEXT_MENU = 93;
|
|
76
|
-
export declare const NUMPAD_ZERO = 96;
|
|
77
|
-
export declare const NUMPAD_ONE = 97;
|
|
78
|
-
export declare const NUMPAD_TWO = 98;
|
|
79
|
-
export declare const NUMPAD_THREE = 99;
|
|
80
|
-
export declare const NUMPAD_FOUR = 100;
|
|
81
|
-
export declare const NUMPAD_FIVE = 101;
|
|
82
|
-
export declare const NUMPAD_SIX = 102;
|
|
83
|
-
export declare const NUMPAD_SEVEN = 103;
|
|
84
|
-
export declare const NUMPAD_EIGHT = 104;
|
|
85
|
-
export declare const NUMPAD_NINE = 105;
|
|
86
|
-
export declare const NUMPAD_MULTIPLY = 106;
|
|
87
|
-
export declare const NUMPAD_PLUS = 107;
|
|
88
|
-
export declare const NUMPAD_MINUS = 109;
|
|
89
|
-
export declare const NUMPAD_PERIOD = 110;
|
|
90
|
-
export declare const NUMPAD_DIVIDE = 111;
|
|
91
|
-
export declare const F1 = 112;
|
|
92
|
-
export declare const F2 = 113;
|
|
93
|
-
export declare const F3 = 114;
|
|
94
|
-
export declare const F4 = 115;
|
|
95
|
-
export declare const F5 = 116;
|
|
96
|
-
export declare const F6 = 117;
|
|
97
|
-
export declare const F7 = 118;
|
|
98
|
-
export declare const F8 = 119;
|
|
99
|
-
export declare const F9 = 120;
|
|
100
|
-
export declare const F10 = 121;
|
|
101
|
-
export declare const F11 = 122;
|
|
102
|
-
export declare const F12 = 123;
|
|
103
|
-
export declare const NUM_LOCK = 144;
|
|
104
|
-
export declare const SCROLL_LOCK = 145;
|
|
105
|
-
export declare const FIRST_MEDIA = 166;
|
|
106
|
-
export declare const FF_MINUS = 173;
|
|
107
|
-
export declare const MUTE = 173;
|
|
108
|
-
export declare const VOLUME_DOWN = 174;
|
|
109
|
-
export declare const VOLUME_UP = 175;
|
|
110
|
-
export declare const FF_MUTE = 181;
|
|
111
|
-
export declare const FF_VOLUME_DOWN = 182;
|
|
112
|
-
export declare const LAST_MEDIA = 183;
|
|
113
|
-
export declare const FF_VOLUME_UP = 183;
|
|
114
|
-
export declare const SEMICOLON = 186;
|
|
115
|
-
export declare const EQUALS = 187;
|
|
116
|
-
export declare const COMMA = 188;
|
|
117
|
-
export declare const DASH = 189;
|
|
118
|
-
export declare const PERIOD = 190;
|
|
119
|
-
export declare const SLASH = 191;
|
|
120
|
-
export declare const APOSTROPHE = 192;
|
|
121
|
-
export declare const TILDE = 192;
|
|
122
|
-
export declare const OPEN_SQUARE_BRACKET = 219;
|
|
123
|
-
export declare const BACKSLASH = 220;
|
|
124
|
-
export declare const CLOSE_SQUARE_BRACKET = 221;
|
|
125
|
-
export declare const SINGLE_QUOTE = 222;
|
|
126
|
-
export declare const MAC_META = 224;
|
package/constants/selection.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const ATTACHED_ELEMENT_CLASS_NAME = "plait-board-attached";
|
|
2
|
-
export declare const ACTIVE_STROKE_WIDTH = 1;
|
|
3
|
-
export declare const SNAPPING_STROKE_WIDTH = 2;
|
|
4
|
-
export declare const SELECTION_RECTANGLE_CLASS_NAME = "selection-rectangle";
|
|
5
|
-
export declare const SELECTION_RECTANGLE_BOUNDING_CLASS_NAME = "selection-rectangle-bounding";
|
package/constants/zoom.d.ts
DELETED
package/context.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ImageEntry } from './interfaces/element';
|
|
2
|
-
export declare class PlaitBoardContext {
|
|
3
|
-
private uploadingFiles;
|
|
4
|
-
getUploadingFile(url: string): ImageEntry | undefined;
|
|
5
|
-
setUploadingFile(file: ImageEntry): number;
|
|
6
|
-
removeUploadingFile(fileEntry: ImageEntry): void;
|
|
7
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { PlaitBoard, PlaitElement } from '../../interfaces';
|
|
2
|
-
import { PlaitPluginElementContext } from './context';
|
|
3
|
-
export interface BeforeContextChange<T extends PlaitElement = PlaitElement, K extends PlaitBoard = PlaitBoard> {
|
|
4
|
-
beforeContextChange: (value: PlaitPluginElementContext<T>) => void;
|
|
5
|
-
}
|
|
6
|
-
export interface OnContextChanged<T extends PlaitElement = PlaitElement, K extends PlaitBoard = PlaitBoard> {
|
|
7
|
-
onContextChanged: (value: PlaitPluginElementContext<T, K>, previous: PlaitPluginElementContext<T, K>) => void;
|
|
8
|
-
}
|
|
9
|
-
export declare function hasBeforeContextChange<T extends PlaitElement = PlaitElement, K extends PlaitBoard = PlaitBoard>(value: any): value is BeforeContextChange<T, K>;
|
|
10
|
-
export declare function hasOnContextChanged<T extends PlaitElement = PlaitElement, K extends PlaitBoard = PlaitBoard>(value: any): value is OnContextChanged<T, K>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { PlaitBoard, PlaitElement } from '../../interfaces';
|
|
2
|
-
export interface PlaitPluginElementContext<T extends PlaitElement = PlaitElement, K extends PlaitBoard = PlaitBoard> {
|
|
3
|
-
element: T;
|
|
4
|
-
parent: T | K;
|
|
5
|
-
selected: boolean;
|
|
6
|
-
board: K;
|
|
7
|
-
index: number;
|
|
8
|
-
hasThemeChanged: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface PlaitChildrenContext<T extends PlaitElement = PlaitElement, K extends PlaitBoard = PlaitBoard> {
|
|
11
|
-
board: K;
|
|
12
|
-
parentG: SVGGElement;
|
|
13
|
-
parent: T | K;
|
|
14
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 基于 element-flavour 实现元素的绘制,取代 Angular 组件
|
|
3
|
-
*/
|
|
4
|
-
import { PlaitBoard, PlaitElement, PlaitPluginElementContext } from '../../interfaces';
|
|
5
|
-
import { ListRender } from '../list-render';
|
|
6
|
-
import { PlaitElementRef } from './element-ref';
|
|
7
|
-
export declare class ElementFlavour<T extends PlaitElement = PlaitElement, K extends PlaitBoard = PlaitBoard, R extends PlaitElementRef = PlaitElementRef> {
|
|
8
|
-
private ref;
|
|
9
|
-
private _g;
|
|
10
|
-
private _containerG;
|
|
11
|
-
private _rootContainerG?;
|
|
12
|
-
initialized: boolean;
|
|
13
|
-
protected _context: PlaitPluginElementContext<T, K>;
|
|
14
|
-
get hasChildren(): boolean;
|
|
15
|
-
set context(value: PlaitPluginElementContext<T, K>);
|
|
16
|
-
get context(): PlaitPluginElementContext<T, K>;
|
|
17
|
-
get element(): T;
|
|
18
|
-
get board(): K;
|
|
19
|
-
get selected(): boolean;
|
|
20
|
-
listRender?: ListRender;
|
|
21
|
-
getContainerG(): SVGGElement;
|
|
22
|
-
getElementG(): SVGGElement;
|
|
23
|
-
constructor(ref: R);
|
|
24
|
-
initialize(): void;
|
|
25
|
-
initializeListRender(): void;
|
|
26
|
-
getRef(): R;
|
|
27
|
-
private updateListRender;
|
|
28
|
-
private initializeChildrenContext;
|
|
29
|
-
destroy(): void;
|
|
30
|
-
}
|
package/core/list-render.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { PlaitBoard, PlaitChildrenContext, PlaitElement } from '../interfaces';
|
|
2
|
-
export declare class ListRender {
|
|
3
|
-
private board;
|
|
4
|
-
private children;
|
|
5
|
-
private instances;
|
|
6
|
-
private contexts;
|
|
7
|
-
private differ;
|
|
8
|
-
initialized: boolean;
|
|
9
|
-
constructor(board: PlaitBoard);
|
|
10
|
-
initialize(children: PlaitElement[], childrenContext: PlaitChildrenContext): void;
|
|
11
|
-
update(children: PlaitElement[], childrenContext: PlaitChildrenContext): void;
|
|
12
|
-
destroy(): void;
|
|
13
|
-
}
|
|
14
|
-
export declare const mountElementG: (index: number, g: SVGGElement, childrenContext: PlaitChildrenContext, currentIndexForFirstElement?: number | null) => void;
|
|
@@ -1,141 +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
|
-
import { IterableChangeRecord, IterableChanges, IterableDiffer, CustomIterable, TrackByFunction } from './iterable_differs';
|
|
9
|
-
export type Writable<T> = {
|
|
10
|
-
-readonly [K in keyof T]: T[K];
|
|
11
|
-
};
|
|
12
|
-
export declare class DefaultIterableDiffer<V> implements IterableDiffer<V>, IterableChanges<V> {
|
|
13
|
-
readonly length: number;
|
|
14
|
-
readonly collection: V[] | Iterable<V> | null;
|
|
15
|
-
private _linkedRecords;
|
|
16
|
-
private _unlinkedRecords;
|
|
17
|
-
private _previousItHead;
|
|
18
|
-
private _itHead;
|
|
19
|
-
private _itTail;
|
|
20
|
-
private _additionsHead;
|
|
21
|
-
private _additionsTail;
|
|
22
|
-
private _movesHead;
|
|
23
|
-
private _movesTail;
|
|
24
|
-
private _removalsHead;
|
|
25
|
-
private _removalsTail;
|
|
26
|
-
private _identityChangesHead;
|
|
27
|
-
private _identityChangesTail;
|
|
28
|
-
private _trackByFn;
|
|
29
|
-
constructor(trackByFn?: TrackByFunction<V>);
|
|
30
|
-
forEachItem(fn: (record: IterableChangeRecord_<V>) => void): void;
|
|
31
|
-
forEachOperation(fn: (item: IterableChangeRecord<V>, previousIndex: number | null, currentIndex: number | null) => void): void;
|
|
32
|
-
forEachPreviousItem(fn: (record: IterableChangeRecord_<V>) => void): void;
|
|
33
|
-
forEachAddedItem(fn: (record: IterableChangeRecord_<V>) => void): void;
|
|
34
|
-
forEachMovedItem(fn: (record: IterableChangeRecord_<V>) => void): void;
|
|
35
|
-
forEachRemovedItem(fn: (record: IterableChangeRecord_<V>) => void): void;
|
|
36
|
-
forEachIdentityChange(fn: (record: IterableChangeRecord_<V>) => void): void;
|
|
37
|
-
diff(collection: CustomIterable<V> | null | undefined): DefaultIterableDiffer<V> | null;
|
|
38
|
-
onDestroy(): void;
|
|
39
|
-
check(collection: CustomIterable<V>): boolean;
|
|
40
|
-
get isDirty(): boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Reset the state of the change objects to show no changes. This means set previousKey to
|
|
43
|
-
* currentKey, and clear all of the queues (additions, moves, removals).
|
|
44
|
-
* Set the previousIndexes of moved and added items to their currentIndexes
|
|
45
|
-
* Reset the list of additions, moves and removals
|
|
46
|
-
*
|
|
47
|
-
* @internal
|
|
48
|
-
*/
|
|
49
|
-
_reset(): void;
|
|
50
|
-
/**
|
|
51
|
-
* This is the core function which handles differences between collections.
|
|
52
|
-
*
|
|
53
|
-
* - `record` is the record which we saw at this position last time. If null then it is a new
|
|
54
|
-
* item.
|
|
55
|
-
* - `item` is the current item in the collection
|
|
56
|
-
* - `index` is the position of the item in the collection
|
|
57
|
-
*
|
|
58
|
-
* @internal
|
|
59
|
-
*/
|
|
60
|
-
_mismatch(record: IterableChangeRecord_<V> | null, item: V, itemTrackBy: any, index: number): IterableChangeRecord_<V>;
|
|
61
|
-
/**
|
|
62
|
-
* This check is only needed if an array contains duplicates. (Short circuit of nothing dirty)
|
|
63
|
-
*
|
|
64
|
-
* Use case: `[a, a]` => `[b, a, a]`
|
|
65
|
-
*
|
|
66
|
-
* If we did not have this check then the insertion of `b` would:
|
|
67
|
-
* 1) evict first `a`
|
|
68
|
-
* 2) insert `b` at `0` index.
|
|
69
|
-
* 3) leave `a` at index `1` as is. <-- this is wrong!
|
|
70
|
-
* 3) reinsert `a` at index 2. <-- this is wrong!
|
|
71
|
-
*
|
|
72
|
-
* The correct behavior is:
|
|
73
|
-
* 1) evict first `a`
|
|
74
|
-
* 2) insert `b` at `0` index.
|
|
75
|
-
* 3) reinsert `a` at index 1.
|
|
76
|
-
* 3) move `a` at from `1` to `2`.
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* Double check that we have not evicted a duplicate item. We need to check if the item type may
|
|
80
|
-
* have already been removed:
|
|
81
|
-
* The insertion of b will evict the first 'a'. If we don't reinsert it now it will be reinserted
|
|
82
|
-
* at the end. Which will show up as the two 'a's switching position. This is incorrect, since a
|
|
83
|
-
* better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
|
|
84
|
-
* at the end.
|
|
85
|
-
*
|
|
86
|
-
* @internal
|
|
87
|
-
*/
|
|
88
|
-
_verifyReinsertion(record: IterableChangeRecord_<V>, item: V, itemTrackBy: any, index: number): IterableChangeRecord_<V>;
|
|
89
|
-
/**
|
|
90
|
-
* Get rid of any excess {@link IterableChangeRecord_}s from the previous collection
|
|
91
|
-
*
|
|
92
|
-
* - `record` The first excess {@link IterableChangeRecord_}.
|
|
93
|
-
*
|
|
94
|
-
* @internal
|
|
95
|
-
*/
|
|
96
|
-
_truncate(record: IterableChangeRecord_<V> | null): void;
|
|
97
|
-
/** @internal */
|
|
98
|
-
_reinsertAfter(record: IterableChangeRecord_<V>, prevRecord: IterableChangeRecord_<V> | null, index: number): IterableChangeRecord_<V>;
|
|
99
|
-
/** @internal */
|
|
100
|
-
_moveAfter(record: IterableChangeRecord_<V>, prevRecord: IterableChangeRecord_<V> | null, index: number): IterableChangeRecord_<V>;
|
|
101
|
-
/** @internal */
|
|
102
|
-
_addAfter(record: IterableChangeRecord_<V>, prevRecord: IterableChangeRecord_<V> | null, index: number): IterableChangeRecord_<V>;
|
|
103
|
-
/** @internal */
|
|
104
|
-
_insertAfter(record: IterableChangeRecord_<V>, prevRecord: IterableChangeRecord_<V> | null, index: number): IterableChangeRecord_<V>;
|
|
105
|
-
/** @internal */
|
|
106
|
-
_remove(record: IterableChangeRecord_<V>): IterableChangeRecord_<V>;
|
|
107
|
-
/** @internal */
|
|
108
|
-
_unlink(record: IterableChangeRecord_<V>): IterableChangeRecord_<V>;
|
|
109
|
-
/** @internal */
|
|
110
|
-
_addToMoves(record: IterableChangeRecord_<V>, toIndex: number): IterableChangeRecord_<V>;
|
|
111
|
-
private _addToRemovals;
|
|
112
|
-
/** @internal */
|
|
113
|
-
_addIdentityChange(record: IterableChangeRecord_<V>, item: V): IterableChangeRecord_<V>;
|
|
114
|
-
}
|
|
115
|
-
export declare class IterableChangeRecord_<V> implements IterableChangeRecord<V> {
|
|
116
|
-
item: V;
|
|
117
|
-
trackById: any;
|
|
118
|
-
currentIndex: number | null;
|
|
119
|
-
previousIndex: number | null;
|
|
120
|
-
/** @internal */
|
|
121
|
-
_nextPrevious: IterableChangeRecord_<V> | null;
|
|
122
|
-
/** @internal */
|
|
123
|
-
_prev: IterableChangeRecord_<V> | null;
|
|
124
|
-
/** @internal */
|
|
125
|
-
_next: IterableChangeRecord_<V> | null;
|
|
126
|
-
/** @internal */
|
|
127
|
-
_prevDup: IterableChangeRecord_<V> | null;
|
|
128
|
-
/** @internal */
|
|
129
|
-
_nextDup: IterableChangeRecord_<V> | null;
|
|
130
|
-
/** @internal */
|
|
131
|
-
_prevRemoved: IterableChangeRecord_<V> | null;
|
|
132
|
-
/** @internal */
|
|
133
|
-
_nextRemoved: IterableChangeRecord_<V> | null;
|
|
134
|
-
/** @internal */
|
|
135
|
-
_nextAdded: IterableChangeRecord_<V> | null;
|
|
136
|
-
/** @internal */
|
|
137
|
-
_nextMoved: IterableChangeRecord_<V> | null;
|
|
138
|
-
/** @internal */
|
|
139
|
-
_nextIdentityChange: IterableChangeRecord_<V> | null;
|
|
140
|
-
constructor(item: V, trackById: any);
|
|
141
|
-
}
|
|
@@ -1,141 +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
|
-
/**
|
|
9
|
-
* A type describing supported iterable types.
|
|
10
|
-
*
|
|
11
|
-
* @publicApi
|
|
12
|
-
*/
|
|
13
|
-
export type CustomIterable<T> = Array<T> | Iterable<T>;
|
|
14
|
-
/**
|
|
15
|
-
* A strategy for tracking changes over time to an iterable. Used by {@link NgForOf} to
|
|
16
|
-
* respond to changes in an iterable by effecting equivalent changes in the DOM.
|
|
17
|
-
*
|
|
18
|
-
* @publicApi
|
|
19
|
-
*/
|
|
20
|
-
export interface IterableDiffer<V> {
|
|
21
|
-
/**
|
|
22
|
-
* Compute a difference between the previous state and the new `object` state.
|
|
23
|
-
*
|
|
24
|
-
* @param object containing the new value.
|
|
25
|
-
* @returns an object describing the difference. The return value is only valid until the next
|
|
26
|
-
* `diff()` invocation.
|
|
27
|
-
*/
|
|
28
|
-
diff(object: CustomIterable<V> | undefined | null): IterableChanges<V> | null;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* An object describing the changes in the `Iterable` collection since last time
|
|
32
|
-
* `IterableDiffer#diff()` was invoked.
|
|
33
|
-
*
|
|
34
|
-
* @publicApi
|
|
35
|
-
*/
|
|
36
|
-
export interface IterableChanges<V> {
|
|
37
|
-
/**
|
|
38
|
-
* Iterate over all changes. `IterableChangeRecord` will contain information about changes
|
|
39
|
-
* to each item.
|
|
40
|
-
*/
|
|
41
|
-
forEachItem(fn: (record: IterableChangeRecord<V>) => void): void;
|
|
42
|
-
/**
|
|
43
|
-
* Iterate over a set of operations which when applied to the original `Iterable` will produce the
|
|
44
|
-
* new `Iterable`.
|
|
45
|
-
*
|
|
46
|
-
* NOTE: These are not necessarily the actual operations which were applied to the original
|
|
47
|
-
* `Iterable`, rather these are a set of computed operations which may not be the same as the
|
|
48
|
-
* ones applied.
|
|
49
|
-
*
|
|
50
|
-
* @param record A change which needs to be applied
|
|
51
|
-
* @param previousIndex The `IterableChangeRecord#previousIndex` of the `record` refers to the
|
|
52
|
-
* original `Iterable` location, where as `previousIndex` refers to the transient location
|
|
53
|
-
* of the item, after applying the operations up to this point.
|
|
54
|
-
* @param currentIndex The `IterableChangeRecord#currentIndex` of the `record` refers to the
|
|
55
|
-
* original `Iterable` location, where as `currentIndex` refers to the transient location
|
|
56
|
-
* of the item, after applying the operations up to this point.
|
|
57
|
-
*/
|
|
58
|
-
forEachOperation(fn: (record: IterableChangeRecord<V>, previousIndex: number | null, currentIndex: number | null) => void): void;
|
|
59
|
-
/**
|
|
60
|
-
* Iterate over changes in the order of original `Iterable` showing where the original items
|
|
61
|
-
* have moved.
|
|
62
|
-
*/
|
|
63
|
-
forEachPreviousItem(fn: (record: IterableChangeRecord<V>) => void): void;
|
|
64
|
-
/** Iterate over all added items. */
|
|
65
|
-
forEachAddedItem(fn: (record: IterableChangeRecord<V>) => void): void;
|
|
66
|
-
/** Iterate over all moved items. */
|
|
67
|
-
forEachMovedItem(fn: (record: IterableChangeRecord<V>) => void): void;
|
|
68
|
-
/** Iterate over all removed items. */
|
|
69
|
-
forEachRemovedItem(fn: (record: IterableChangeRecord<V>) => void): void;
|
|
70
|
-
/**
|
|
71
|
-
* Iterate over all items which had their identity (as computed by the `TrackByFunction`)
|
|
72
|
-
* changed.
|
|
73
|
-
*/
|
|
74
|
-
forEachIdentityChange(fn: (record: IterableChangeRecord<V>) => void): void;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Record representing the item change information.
|
|
78
|
-
*
|
|
79
|
-
* @publicApi
|
|
80
|
-
*/
|
|
81
|
-
export interface IterableChangeRecord<V> {
|
|
82
|
-
/** Current index of the item in `Iterable` or null if removed. */
|
|
83
|
-
readonly currentIndex: number | null;
|
|
84
|
-
/** Previous index of the item in `Iterable` or null if added. */
|
|
85
|
-
readonly previousIndex: number | null;
|
|
86
|
-
/** The item. */
|
|
87
|
-
readonly item: V;
|
|
88
|
-
/** Track by identity as computed by the `TrackByFunction`. */
|
|
89
|
-
readonly trackById: any;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* A function optionally passed into the `NgForOf` directive to customize how `NgForOf` uniquely
|
|
93
|
-
* identifies items in an iterable.
|
|
94
|
-
*
|
|
95
|
-
* `NgForOf` needs to uniquely identify items in the iterable to correctly perform DOM updates
|
|
96
|
-
* when items in the iterable are reordered, new items are added, or existing items are removed.
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* In all of these scenarios it is usually desirable to only update the DOM elements associated
|
|
100
|
-
* with the items affected by the change. This behavior is important to:
|
|
101
|
-
*
|
|
102
|
-
* - preserve any DOM-specific UI state (like cursor position, focus, text selection) when the
|
|
103
|
-
* iterable is modified
|
|
104
|
-
* - enable animation of item addition, removal, and iterable reordering
|
|
105
|
-
* - preserve the value of the `<select>` element when nested `<option>` elements are dynamically
|
|
106
|
-
* populated using `NgForOf` and the bound iterable is updated
|
|
107
|
-
*
|
|
108
|
-
* A common use for custom `trackBy` functions is when the model that `NgForOf` iterates over
|
|
109
|
-
* contains a property with a unique identifier. For example, given a model:
|
|
110
|
-
*
|
|
111
|
-
* ```ts
|
|
112
|
-
* class User {
|
|
113
|
-
* id: number;
|
|
114
|
-
* name: string;
|
|
115
|
-
* ...
|
|
116
|
-
* }
|
|
117
|
-
* ```
|
|
118
|
-
* a custom `trackBy` function could look like the following:
|
|
119
|
-
* ```ts
|
|
120
|
-
* function userTrackBy(index, user) {
|
|
121
|
-
* return user.id;
|
|
122
|
-
* }
|
|
123
|
-
* ```
|
|
124
|
-
*
|
|
125
|
-
* A custom `trackBy` function must have several properties:
|
|
126
|
-
*
|
|
127
|
-
* - be [idempotent](https://en.wikipedia.org/wiki/Idempotence) (be without side effects, and always
|
|
128
|
-
* return the same value for a given input)
|
|
129
|
-
* - return unique value for all unique inputs
|
|
130
|
-
* - be fast
|
|
131
|
-
*
|
|
132
|
-
* @see [`NgForOf#ngForTrackBy`](api/common/NgForOf#ngForTrackBy)
|
|
133
|
-
* @publicApi
|
|
134
|
-
*/
|
|
135
|
-
export interface TrackByFunction<T> {
|
|
136
|
-
/**
|
|
137
|
-
* @param index The index of the item within the iterable.
|
|
138
|
-
* @param item The item in the iterable.
|
|
139
|
-
*/
|
|
140
|
-
<U extends T>(index: number, item: T & U): any;
|
|
141
|
-
}
|
package/interfaces/board.d.ts
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { PlaitPointerType } from './pointer';
|
|
2
|
-
import { ComponentType, PlaitElement } from './element';
|
|
3
|
-
import { PlaitPluginElementContext } from '../core/element/context';
|
|
4
|
-
import { PlaitHistory } from './history';
|
|
5
|
-
import { PlaitOperation } from './operation';
|
|
6
|
-
import { Selection } from './selection';
|
|
7
|
-
import { Viewport } from './viewport';
|
|
8
|
-
import { RoughSVG } from 'roughjs/bin/svg';
|
|
9
|
-
import { Point } from './point';
|
|
10
|
-
import { RectangleClient } from './rectangle-client';
|
|
11
|
-
import { PathRef, PathRefOptions } from './path-ref';
|
|
12
|
-
import { PlaitNode } from './node';
|
|
13
|
-
import { Path } from './path';
|
|
14
|
-
import { PlaitTheme, ThemeColor } from './theme';
|
|
15
|
-
import { ClipboardData, WritableClipboardContext, WritableClipboardOperationType } from '../utils';
|
|
16
|
-
import { ElementFlavour } from '../core/element/element-flavour';
|
|
17
|
-
import { PlaitBoardContext } from '../context';
|
|
18
|
-
export interface PlaitBoard {
|
|
19
|
-
viewport: Viewport;
|
|
20
|
-
children: PlaitElement[];
|
|
21
|
-
theme: PlaitTheme;
|
|
22
|
-
operations: PlaitOperation[];
|
|
23
|
-
selection: Selection | null;
|
|
24
|
-
pointer: PlaitPointerType | string;
|
|
25
|
-
history: PlaitHistory;
|
|
26
|
-
options: PlaitBoardOptions;
|
|
27
|
-
undo: () => void;
|
|
28
|
-
redo: () => void;
|
|
29
|
-
apply: (operation: PlaitOperation) => void;
|
|
30
|
-
onChange: () => void;
|
|
31
|
-
afterChange: () => void;
|
|
32
|
-
drawSelectionRectangle: () => SVGGElement | null;
|
|
33
|
-
mousedown: (event: MouseEvent) => void;
|
|
34
|
-
mousemove: (event: MouseEvent) => void;
|
|
35
|
-
mouseleave: (event: MouseEvent) => void;
|
|
36
|
-
mouseup: (event: MouseEvent) => void;
|
|
37
|
-
globalMousemove: (event: MouseEvent) => void;
|
|
38
|
-
globalMouseup: (event: MouseEvent) => void;
|
|
39
|
-
keyDown: (event: KeyboardEvent) => void;
|
|
40
|
-
globalKeyDown: (event: KeyboardEvent) => void;
|
|
41
|
-
keyUp: (event: KeyboardEvent) => void;
|
|
42
|
-
buildFragment: (clipboardContext: WritableClipboardContext | null, rectangle: RectangleClient | null, operationType: WritableClipboardOperationType, originData?: PlaitElement[]) => WritableClipboardContext | null;
|
|
43
|
-
insertFragment: (clipboardData: ClipboardData | null, targetPoint: Point, operationType?: WritableClipboardOperationType) => void;
|
|
44
|
-
deleteFragment: (data: PlaitElement[]) => void;
|
|
45
|
-
getDeletedFragment: (data: PlaitElement[]) => PlaitElement[];
|
|
46
|
-
getRelatedFragment: (data: PlaitElement[], originData?: PlaitElement[]) => PlaitElement[];
|
|
47
|
-
dblClick: (event: MouseEvent) => void;
|
|
48
|
-
normalizeElement: (context: PlaitPluginElementContext) => void;
|
|
49
|
-
drawElement: (context: PlaitPluginElementContext) => ComponentType<ElementFlavour>;
|
|
50
|
-
isRectangleHit: (element: PlaitElement, range: Selection) => boolean;
|
|
51
|
-
isHit: (element: PlaitElement, point: Point, isStrict?: boolean) => boolean;
|
|
52
|
-
isInsidePoint: (element: PlaitElement, point: Point) => boolean;
|
|
53
|
-
getOneHitElement: (hitElements: PlaitElement[]) => PlaitElement;
|
|
54
|
-
isRecursion: (element: PlaitElement) => boolean;
|
|
55
|
-
isMovable: (element: PlaitElement) => boolean;
|
|
56
|
-
getRectangle: (element: PlaitElement) => RectangleClient | null;
|
|
57
|
-
isWithinSelection: (element: PlaitElement) => boolean;
|
|
58
|
-
pathRef: (path: Path, options?: PathRefOptions) => PathRef;
|
|
59
|
-
pathRefs: () => Set<PathRef>;
|
|
60
|
-
applyTheme: (element: PlaitElement) => void;
|
|
61
|
-
isAlign: (element: PlaitElement) => boolean;
|
|
62
|
-
isImageBindingAllowed: (element: PlaitElement) => boolean;
|
|
63
|
-
canAddToGroup: (element: PlaitElement) => boolean;
|
|
64
|
-
canSetZIndex: (element: PlaitElement) => boolean;
|
|
65
|
-
isExpanded: (element: PlaitElement) => boolean;
|
|
66
|
-
pointerDown: (pointer: PointerEvent) => void;
|
|
67
|
-
pointerMove: (pointer: PointerEvent) => void;
|
|
68
|
-
pointerUp: (pointer: PointerEvent) => void;
|
|
69
|
-
pointerCancel: (pointer: PointerEvent) => void;
|
|
70
|
-
pointerOut: (pointer: PointerEvent) => void;
|
|
71
|
-
pointerLeave: (pointer: PointerEvent) => void;
|
|
72
|
-
globalPointerMove: (pointer: PointerEvent) => void;
|
|
73
|
-
globalPointerUp: (pointer: PointerEvent) => void;
|
|
74
|
-
drop: (event: DragEvent) => boolean;
|
|
75
|
-
touchStart: (event: TouchEvent) => void;
|
|
76
|
-
touchMove: (event: TouchEvent) => void;
|
|
77
|
-
touchEnd: (event: TouchEvent) => void;
|
|
78
|
-
}
|
|
79
|
-
export interface PlaitBoardOptions {
|
|
80
|
-
readonly?: boolean;
|
|
81
|
-
hideScrollbar?: boolean;
|
|
82
|
-
disabledScrollOnNonFocus?: boolean;
|
|
83
|
-
themeColors?: ThemeColor[];
|
|
84
|
-
}
|
|
85
|
-
export interface PlaitBoardMove {
|
|
86
|
-
x: number;
|
|
87
|
-
y: number;
|
|
88
|
-
}
|
|
89
|
-
export declare const PlaitBoard: {
|
|
90
|
-
isBoard(value: any): value is PlaitBoard;
|
|
91
|
-
isAlive(board: PlaitBoard): boolean;
|
|
92
|
-
findPath(board: PlaitBoard, node: PlaitNode): Path;
|
|
93
|
-
getHost(board: PlaitBoard): SVGSVGElement;
|
|
94
|
-
getElementLowerHost(board: PlaitBoard): SVGSVGElement;
|
|
95
|
-
getElementHost(board: PlaitBoard): SVGSVGElement;
|
|
96
|
-
getElementUpperHost(board: PlaitBoard): SVGSVGElement;
|
|
97
|
-
getElementTopHost(board: PlaitBoard): SVGSVGElement;
|
|
98
|
-
getActiveHost(board: PlaitBoard): SVGSVGElement;
|
|
99
|
-
getRoughSVG(board: PlaitBoard): RoughSVG;
|
|
100
|
-
getBoardContainer(board: PlaitBoard): HTMLElement;
|
|
101
|
-
getBoardContext(board: PlaitBoard): PlaitBoardContext;
|
|
102
|
-
getRectangle(board: PlaitBoard): RectangleClient;
|
|
103
|
-
getViewportContainer(board: PlaitBoard): HTMLElement;
|
|
104
|
-
isFocus(board: PlaitBoard): boolean;
|
|
105
|
-
isReadonly(board: PlaitBoard): boolean | undefined;
|
|
106
|
-
hasBeenTextEditing(board: PlaitBoard): boolean;
|
|
107
|
-
getPointer<T = PlaitPointerType>(board: PlaitBoard): T;
|
|
108
|
-
isPointer<T = PlaitPointerType>(board: PlaitBoard, pointer: T): boolean;
|
|
109
|
-
isInPointer<T = PlaitPointerType>(board: PlaitBoard, pointers: T[]): boolean;
|
|
110
|
-
getMovingPointInBoard(board: PlaitBoard): Point | undefined;
|
|
111
|
-
isMovingPointInBoard(board: PlaitBoard): boolean;
|
|
112
|
-
getThemeColors<T extends ThemeColor = ThemeColor>(board: PlaitBoard): T[];
|
|
113
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extendable Custom Types Interface
|
|
3
|
-
*/
|
|
4
|
-
type ExtendableTypes = 'Viewport' | 'SetViewportOperation' | 'SetSelectionOperation';
|
|
5
|
-
export interface CustomTypes {
|
|
6
|
-
[key: string]: unknown;
|
|
7
|
-
}
|
|
8
|
-
export type ExtendedType<K extends ExtendableTypes, B> = unknown extends CustomTypes[K] ? B : CustomTypes[K];
|
|
9
|
-
export {};
|