@leafer/data 1.0.0-rc.22 → 1.0.0-rc.24
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/package.json +2 -2
- package/src/DataHelper.ts +7 -1
- package/src/LeafData.ts +5 -1
- package/types/index.d.ts +4 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/data",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.24",
|
|
4
4
|
"description": "@leafer/data",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@leafer/interface": "1.0.0-rc.
|
|
25
|
+
"@leafer/interface": "1.0.0-rc.24"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/src/DataHelper.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IObject } from '@leafer/interface'
|
|
1
|
+
import { IBooleanMap, IObject } from '@leafer/interface'
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
export const DataHelper = {
|
|
@@ -30,6 +30,12 @@ export const DataHelper = {
|
|
|
30
30
|
|
|
31
31
|
clone(data: unknown): IObject {
|
|
32
32
|
return JSON.parse(JSON.stringify(data))
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
toMap(list: string[]): IBooleanMap {
|
|
36
|
+
const map = {} as IBooleanMap
|
|
37
|
+
for (let i = 0, len = list.length; i < len; i++) map[list[i]] = true
|
|
38
|
+
return map
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
}
|
package/src/LeafData.ts
CHANGED
|
@@ -15,8 +15,12 @@ export class LeafData implements ILeafData {
|
|
|
15
15
|
public __pathInputed?: number
|
|
16
16
|
public __pathForRender?: IPathCommandData
|
|
17
17
|
|
|
18
|
+
public get __useNaturalRatio() { return true }
|
|
19
|
+
|
|
20
|
+
public get __isLinePath(): boolean { return (this as ILeafData).path && (this as ILeafData).path.length === 6 }
|
|
21
|
+
|
|
18
22
|
public get __blendMode(): string {
|
|
19
|
-
if ((this as ILeafData).eraser) return 'destination-out'
|
|
23
|
+
if ((this as ILeafData).eraser && (this as ILeafData).eraser !== 'path') return 'destination-out'
|
|
20
24
|
const { blendMode } = (this as ILeafData)
|
|
21
25
|
return blendMode === 'pass-through' ? null : blendMode
|
|
22
26
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { IObject, ILeafData, ILeaf, IPathCommandData } from '@leafer/interface';
|
|
1
|
+
import { IObject, IBooleanMap, ILeafData, ILeaf, IPathCommandData } from '@leafer/interface';
|
|
2
2
|
|
|
3
3
|
declare const DataHelper: {
|
|
4
4
|
default<T>(t: T, defaultData: IObject): T;
|
|
5
5
|
assign(t: IObject, merge: IObject): void;
|
|
6
6
|
copyAttrs(t: IObject, from: IObject, include: string[]): IObject;
|
|
7
7
|
clone(data: unknown): IObject;
|
|
8
|
+
toMap(list: string[]): IBooleanMap;
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
declare class LeafData implements ILeafData {
|
|
@@ -16,6 +17,8 @@ declare class LeafData implements ILeafData {
|
|
|
16
17
|
__naturalHeight?: number;
|
|
17
18
|
__pathInputed?: number;
|
|
18
19
|
__pathForRender?: IPathCommandData;
|
|
20
|
+
get __useNaturalRatio(): boolean;
|
|
21
|
+
get __isLinePath(): boolean;
|
|
19
22
|
get __blendMode(): string;
|
|
20
23
|
constructor(leaf: ILeaf);
|
|
21
24
|
__get(name: string): any;
|