@plait/core 0.1.2 → 0.1.3
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/board/board.component.d.ts +4 -4
- package/core/element/element.component.d.ts +1 -1
- package/core/element/plugin-element.d.ts +1 -1
- package/core/toolbar/toolbar.component.d.ts +1 -1
- package/esm2020/board/board.component.mjs +57 -43
- package/esm2020/core/element/element.component.mjs +4 -4
- package/esm2020/core/element/plugin-element.mjs +9 -9
- package/esm2020/core/toolbar/toolbar.component.mjs +4 -4
- package/esm2020/interfaces/point.mjs +6 -2
- package/esm2020/interfaces/viewport.mjs +2 -2
- package/esm2020/plait.module.mjs +5 -5
- package/esm2020/plugins/with-hand.mjs +5 -8
- package/esm2020/plugins/with-selection.mjs +6 -2
- package/esm2020/plugins/with-viewport.mjs +22 -4
- package/esm2020/utils/viewport.mjs +62 -25
- package/esm2020/utils/weak-maps.mjs +3 -1
- package/fesm2015/plait-core.mjs +168 -92
- package/fesm2015/plait-core.mjs.map +1 -1
- package/fesm2020/plait-core.mjs +168 -92
- package/fesm2020/plait-core.mjs.map +1 -1
- package/interfaces/custom-types.d.ts +2 -2
- package/interfaces/node.d.ts +1 -1
- package/interfaces/operation.d.ts +7 -7
- package/interfaces/path.d.ts +1 -1
- package/interfaces/plugin.d.ts +1 -1
- package/interfaces/point.d.ts +4 -1
- package/interfaces/viewport.d.ts +3 -2
- package/package.json +3 -3
- package/styles/styles.scss +3 -1
- package/utils/board.d.ts +1 -1
- package/utils/viewport.d.ts +13 -6
- package/utils/weak-maps.d.ts +2 -0
- /package/{plait-core.d.ts → index.d.ts} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Extendable Custom Types Interface
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
type ExtendableTypes = 'Viewport' | 'SetViewportOperation' | 'SetSelectionOperation';
|
|
5
5
|
export interface CustomTypes {
|
|
6
6
|
[key: string]: unknown;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
8
|
+
export type ExtendedType<K extends ExtendableTypes, B> = unknown extends CustomTypes[K] ? B : CustomTypes[K];
|
|
9
9
|
export {};
|
package/interfaces/node.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export interface PlaitNode {
|
|
|
4
4
|
[key: string]: any;
|
|
5
5
|
children?: PlaitNode[];
|
|
6
6
|
}
|
|
7
|
-
export
|
|
7
|
+
export type Ancestor = PlaitBoard | PlaitNode;
|
|
8
8
|
export interface PlaitNodeInterface {
|
|
9
9
|
parent: (board: PlaitBoard, path: Path) => Ancestor;
|
|
10
10
|
get: (board: PlaitBoard, path: Path) => PlaitNode;
|
|
@@ -2,38 +2,38 @@ import { PlaitNode } from './node';
|
|
|
2
2
|
import { Path } from './path';
|
|
3
3
|
import { Selection } from './selection';
|
|
4
4
|
import { Viewport } from './viewport';
|
|
5
|
-
export
|
|
5
|
+
export type InsertNodeOperation = {
|
|
6
6
|
type: 'insert_node';
|
|
7
7
|
path: Path;
|
|
8
8
|
node: PlaitNode;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type RemoveNodeOperation = {
|
|
11
11
|
type: 'remove_node';
|
|
12
12
|
path: Path;
|
|
13
13
|
node: PlaitNode;
|
|
14
14
|
};
|
|
15
|
-
export
|
|
15
|
+
export type MoveNodeOperation = {
|
|
16
16
|
type: 'move_node';
|
|
17
17
|
path: Path;
|
|
18
18
|
newPath: Path;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
20
|
+
export type SetViewportOperation = {
|
|
21
21
|
type: 'set_viewport';
|
|
22
22
|
properties: Partial<Viewport>;
|
|
23
23
|
newProperties: Partial<Viewport>;
|
|
24
24
|
};
|
|
25
|
-
export
|
|
25
|
+
export type SetSelectionOperation = {
|
|
26
26
|
type: 'set_selection';
|
|
27
27
|
properties: Selection | null;
|
|
28
28
|
newProperties: Selection | null;
|
|
29
29
|
};
|
|
30
|
-
export
|
|
30
|
+
export type SetNodeOperation = {
|
|
31
31
|
type: 'set_node';
|
|
32
32
|
path: Path;
|
|
33
33
|
properties: Partial<PlaitNode>;
|
|
34
34
|
newProperties: Partial<PlaitNode>;
|
|
35
35
|
};
|
|
36
|
-
export
|
|
36
|
+
export type PlaitOperation = InsertNodeOperation | SetViewportOperation | SetSelectionOperation | SetNodeOperation | RemoveNodeOperation | MoveNodeOperation;
|
|
37
37
|
export interface PlaitOperationInterface {
|
|
38
38
|
inverse: (op: PlaitOperation) => PlaitOperation;
|
|
39
39
|
isSetViewportOperation: (value: any) => boolean;
|
package/interfaces/path.d.ts
CHANGED
package/interfaces/plugin.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { PlaitBoard } from './board';
|
|
2
|
-
export
|
|
2
|
+
export type PlaitPlugin = (board: PlaitBoard) => PlaitBoard;
|
package/interfaces/point.d.ts
CHANGED
package/interfaces/viewport.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ExtendedType } from './custom-types';
|
|
2
|
+
import { Point } from './point';
|
|
2
3
|
export interface BaseViewport {
|
|
3
4
|
[key: string]: any;
|
|
4
5
|
viewBackgroundColor: string;
|
|
5
6
|
zoom: number;
|
|
6
|
-
origination?:
|
|
7
|
+
origination?: Point;
|
|
7
8
|
}
|
|
8
|
-
export
|
|
9
|
+
export type Viewport = ExtendedType<'Viewport', BaseViewport>;
|
|
9
10
|
export interface ViewportInterface {
|
|
10
11
|
isViewport: (value: any) => value is Viewport;
|
|
11
12
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plait/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "^12.2.0",
|
|
6
6
|
"@angular/core": "^12.2.0"
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"esm2020": "esm2020/plait-core.mjs",
|
|
14
14
|
"fesm2020": "fesm2020/plait-core.mjs",
|
|
15
15
|
"fesm2015": "fesm2015/plait-core.mjs",
|
|
16
|
-
"typings": "
|
|
16
|
+
"typings": "index.d.ts",
|
|
17
17
|
"exports": {
|
|
18
18
|
"./package.json": {
|
|
19
19
|
"default": "./package.json"
|
|
20
20
|
},
|
|
21
21
|
".": {
|
|
22
|
-
"types": "./
|
|
22
|
+
"types": "./index.d.ts",
|
|
23
23
|
"esm2020": "./esm2020/plait-core.mjs",
|
|
24
24
|
"es2020": "./fesm2020/plait-core.mjs",
|
|
25
25
|
"es2015": "./fesm2015/plait-core.mjs",
|
package/styles/styles.scss
CHANGED
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
|
|
20
20
|
// https://stackoverflow.com/questions/51313873/svg-foreignobject-not-working-properly-on-safari
|
|
21
21
|
.plait-richtext-container {
|
|
22
|
-
position
|
|
22
|
+
// chrome show position is not correct, safari not working when don't assigned position property
|
|
23
|
+
// can not assign absolute, because safari can not show correctly position
|
|
24
|
+
position: fixed;
|
|
23
25
|
&[readonly='true'] {
|
|
24
26
|
::selection {
|
|
25
27
|
background: none;
|
package/utils/board.d.ts
CHANGED
package/utils/viewport.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PlaitBoard, RectangleClient } from '../interfaces';
|
|
1
|
+
import { PlaitBoard, Point, RectangleClient } from '../interfaces';
|
|
2
2
|
export declare function getViewportContainerRect(board: PlaitBoard): {
|
|
3
3
|
width: number;
|
|
4
4
|
height: number;
|
|
@@ -19,11 +19,18 @@ export declare function getElementHostBBox(board: PlaitBoard, zoom: number): {
|
|
|
19
19
|
export declare function clampZoomLevel(zoom: number, minZoom?: number, maxZoom?: number): number;
|
|
20
20
|
export declare function getViewBox(board: PlaitBoard, zoom: number): number[];
|
|
21
21
|
export declare function setSVGViewBox(board: PlaitBoard, viewBox: number[]): void;
|
|
22
|
-
export declare function
|
|
23
|
-
export declare function
|
|
24
|
-
export declare function
|
|
25
|
-
export declare function
|
|
26
|
-
export declare function
|
|
22
|
+
export declare function updateViewportOffset(board: PlaitBoard): void;
|
|
23
|
+
export declare function updateViewportContainerScroll(board: PlaitBoard, left: number, top: number): void;
|
|
24
|
+
export declare function initializeViewportContainer(board: PlaitBoard): void;
|
|
25
|
+
export declare function initializeViewBox(board: PlaitBoard): void;
|
|
26
|
+
export declare function initializeViewportOffset(board: PlaitBoard): void;
|
|
27
|
+
export declare function setViewport(board: PlaitBoard, origination: Point, zoom?: number): void;
|
|
27
28
|
export declare function changeZoom(board: PlaitBoard, newZoom: number, isCenter?: boolean): void;
|
|
28
29
|
export declare function fitViewport(board: PlaitBoard): void;
|
|
30
|
+
export declare const updateViewportOrigination: (board: PlaitBoard, origination: Point) => void;
|
|
31
|
+
export declare const clearViewportOrigination: (board: PlaitBoard) => void;
|
|
32
|
+
export declare const getViewportOrigination: (board: PlaitBoard) => Point | undefined;
|
|
33
|
+
export declare const isViewportScrolling: (board: PlaitBoard) => boolean;
|
|
34
|
+
export declare const setViewportScrolling: (board: PlaitBoard) => void;
|
|
35
|
+
export declare const clearViewportScrolling: (board: PlaitBoard) => void;
|
|
29
36
|
export declare function scrollToRectangle(board: PlaitBoard, client: RectangleClient): void;
|
package/utils/weak-maps.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export declare const BOARD_TO_HOST: WeakMap<PlaitBoard, SVGSVGElement>;
|
|
|
12
12
|
export declare const BOARD_TO_ELEMENT_HOST: WeakMap<PlaitBoard, SVGGElement>;
|
|
13
13
|
export declare const BOARD_TO_SELECTED_ELEMENT: WeakMap<PlaitBoard, PlaitElement[]>;
|
|
14
14
|
export declare const BOARD_TO_MOVING_POINT: WeakMap<PlaitBoard, Point>;
|
|
15
|
+
export declare const BOARD_TO_VIEWPORT_ORIGINATION: WeakMap<PlaitBoard, Point>;
|
|
15
16
|
export declare const BOARD_TO_IS_SELECTION_MOVING: WeakMap<PlaitBoard, boolean>;
|
|
16
17
|
export declare const BOARD_TO_TEMPORARY_ELEMENTS: WeakMap<PlaitBoard, PlaitElement[]>;
|
|
17
18
|
export declare const BOARD_TO_MOVING_ELEMENT: WeakMap<PlaitBoard, PlaitElement[]>;
|
|
19
|
+
export declare const BOARD_TO_SCROLLING: WeakMap<PlaitBoard, boolean>;
|
|
File without changes
|