@plait/angular-board 0.62.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.
- package/README.md +1 -0
- package/board/board.component.d.ts +57 -0
- package/board/board.component.interface.d.ts +9 -0
- package/esm2022/board/board.component.interface.mjs +2 -0
- package/esm2022/board/board.component.mjs +433 -0
- package/esm2022/island/island-base.component.mjs +72 -0
- package/esm2022/plait-angular-board.mjs +5 -0
- package/esm2022/plugins/angular-board.mjs +2 -0
- package/esm2022/plugins/with-angular.mjs +50 -0
- package/esm2022/public-api.mjs +8 -0
- package/esm2022/utils/weak-maps.mjs +2 -0
- package/fesm2022/plait-angular-board.mjs +561 -0
- package/fesm2022/plait-angular-board.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/island/island-base.component.d.ts +35 -0
- package/package.json +32 -0
- package/plugins/angular-board.d.ts +18 -0
- package/plugins/with-angular.d.ts +4 -0
- package/public-api.d.ts +4 -0
- package/styles/mixins.scss +18 -0
- package/styles/styles.scss +84 -0
- package/utils/weak-maps.d.ts +3 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ChangeDetectorRef, OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { PlaitBoard } from '@plait/core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare abstract class PlaitIslandBaseComponent {
|
|
5
|
+
protected cdr: ChangeDetectorRef;
|
|
6
|
+
board: PlaitBoard;
|
|
7
|
+
constructor(cdr: ChangeDetectorRef);
|
|
8
|
+
initialize(board: PlaitBoard): void;
|
|
9
|
+
markForCheck(): void;
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PlaitIslandBaseComponent, never>;
|
|
11
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<PlaitIslandBaseComponent, never, never, {}, {}, never, never, false, never>;
|
|
12
|
+
}
|
|
13
|
+
export declare abstract class PlaitIslandPopoverBaseComponent implements OnInit, OnDestroy {
|
|
14
|
+
cdr: ChangeDetectorRef;
|
|
15
|
+
board: PlaitBoard;
|
|
16
|
+
private subscription?;
|
|
17
|
+
constructor(cdr: ChangeDetectorRef);
|
|
18
|
+
initialize(board: PlaitBoard): void;
|
|
19
|
+
ngOnInit(): void;
|
|
20
|
+
ngOnDestroy(): void;
|
|
21
|
+
/**
|
|
22
|
+
* use islandOnInit replace ngOnInit to avoid ngOnInit being overridden
|
|
23
|
+
*/
|
|
24
|
+
abstract islandOnInit(): void;
|
|
25
|
+
/**
|
|
26
|
+
* use islandOnDestroy replace ngOnDestroy to avoid ngOnDestroy being overridden
|
|
27
|
+
*/
|
|
28
|
+
abstract islandOnDestroy(): void;
|
|
29
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PlaitIslandPopoverBaseComponent, never>;
|
|
30
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<PlaitIslandPopoverBaseComponent, never, never, { "board": { "alias": "board"; "required": false; }; }, {}, never, never, false, never>;
|
|
31
|
+
}
|
|
32
|
+
export interface OnBoardChange {
|
|
33
|
+
onBoardChange: () => void;
|
|
34
|
+
}
|
|
35
|
+
export declare const hasOnBoardChange: (value: any) => value is OnBoardChange;
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@plait/angular-board",
|
|
3
|
+
"version": "0.62.0-next.0",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^17.2.4",
|
|
6
|
+
"@angular/core": "^17.2.4",
|
|
7
|
+
"is-hotkey": "^0.2.0"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"tslib": "^2.3.0"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
"./styles/styles": {
|
|
14
|
+
"sass": "./styles/styles.scss"
|
|
15
|
+
},
|
|
16
|
+
"./styles/*": {
|
|
17
|
+
"sass": "./styles/*"
|
|
18
|
+
},
|
|
19
|
+
"./package.json": {
|
|
20
|
+
"default": "./package.json"
|
|
21
|
+
},
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./index.d.ts",
|
|
24
|
+
"esm2022": "./esm2022/plait-angular-board.mjs",
|
|
25
|
+
"esm": "./esm2022/plait-angular-board.mjs",
|
|
26
|
+
"default": "./fesm2022/plait-angular-board.mjs"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"module": "fesm2022/plait-angular-board.mjs",
|
|
30
|
+
"typings": "index.d.ts",
|
|
31
|
+
"sideEffects": false
|
|
32
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PlaitElement, PlaitOperation, PlaitTheme, Viewport, Selection, ComponentType } from '@plait/core';
|
|
2
|
+
import { RenderComponentRef } from '@plait/common';
|
|
3
|
+
import { ComponentRef } from '@angular/core';
|
|
4
|
+
export interface AngularBoard {
|
|
5
|
+
renderComponent: <T, K extends {
|
|
6
|
+
nativeElement: () => HTMLElement;
|
|
7
|
+
}>(type: ComponentType<K>, container: Element | DocumentFragment, props: T) => {
|
|
8
|
+
ref: RenderComponentRef<T>;
|
|
9
|
+
componentRef: ComponentRef<K>;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface OnChangeData {
|
|
13
|
+
children: PlaitElement[];
|
|
14
|
+
operations: PlaitOperation[];
|
|
15
|
+
viewport: Viewport;
|
|
16
|
+
selection: Selection | null;
|
|
17
|
+
theme: PlaitTheme;
|
|
18
|
+
}
|
package/public-api.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@mixin board-background-color {
|
|
2
|
+
&.theme-colorful .board-host-svg,
|
|
3
|
+
&.theme-default .board-host-svg {
|
|
4
|
+
background-color: #ffffff;
|
|
5
|
+
}
|
|
6
|
+
&.theme-soft .board-host-svg {
|
|
7
|
+
background-color: #f5f5f5;
|
|
8
|
+
}
|
|
9
|
+
&.theme-retro .board-host-svg {
|
|
10
|
+
background-color: #f9f8ed;
|
|
11
|
+
}
|
|
12
|
+
&.theme-dark .board-host-svg {
|
|
13
|
+
background-color: #141414;
|
|
14
|
+
}
|
|
15
|
+
&.theme-starry .board-host-svg {
|
|
16
|
+
background-color: #0d2537;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
@use './mixins.scss' as mixins;
|
|
2
|
+
|
|
3
|
+
.plait-board-container {
|
|
4
|
+
display: block;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
position: relative;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
|
|
10
|
+
// safari can not set this style, it will prevent text being from selected in edit mode
|
|
11
|
+
// resolve the issue text being selected when user drag and move on board in firefox
|
|
12
|
+
&.firefox {
|
|
13
|
+
user-select: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.viewport-container {
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 100%;
|
|
19
|
+
overflow: auto;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&.disabled-scroll {
|
|
23
|
+
.viewport-container {
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
svg {
|
|
29
|
+
transform: matrix(1, 0, 0, 1, 0, 0);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// https://stackoverflow.com/questions/51313873/svg-foreignobject-not-working-properly-on-safari
|
|
33
|
+
.plait-text-container {
|
|
34
|
+
// chrome show position is not correct, safari not working when don't assigned position property
|
|
35
|
+
// can not assign absolute, because safari can not show correctly position
|
|
36
|
+
position: initial;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.plait-toolbar {
|
|
40
|
+
position: absolute;
|
|
41
|
+
display: flex;
|
|
42
|
+
height: 30px;
|
|
43
|
+
z-index: 100;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&.element-moving {
|
|
47
|
+
.element-active-host {
|
|
48
|
+
& > g:not(.active-with-moving) {
|
|
49
|
+
display: none;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&.element-rotating {
|
|
55
|
+
.element-active-host {
|
|
56
|
+
g.resize-handle,
|
|
57
|
+
g[class^='line-auto-complete-'] {
|
|
58
|
+
display: none;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&.pointer-selection {
|
|
64
|
+
cursor: default;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&.ns-resize {
|
|
68
|
+
cursor: ns-resize;
|
|
69
|
+
}
|
|
70
|
+
&.ew-resize {
|
|
71
|
+
cursor: ew-resize;
|
|
72
|
+
}
|
|
73
|
+
&.nwse-resize {
|
|
74
|
+
cursor: nwse-resize;
|
|
75
|
+
}
|
|
76
|
+
&.nesw-resize {
|
|
77
|
+
cursor: nesw-resize;
|
|
78
|
+
}
|
|
79
|
+
&.crosshair {
|
|
80
|
+
cursor: crosshair;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@include mixins.board-background-color();
|
|
84
|
+
}
|