@leafer/data 1.0.0-rc.22 → 1.0.0-rc.23

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer/data",
3
- "version": "1.0.0-rc.22",
3
+ "version": "1.0.0-rc.23",
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.22"
25
+ "@leafer/interface": "1.0.0-rc.23"
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
@@ -16,7 +16,7 @@ export class LeafData implements ILeafData {
16
16
  public __pathForRender?: IPathCommandData
17
17
 
18
18
  public get __blendMode(): string {
19
- if ((this as ILeafData).eraser) return 'destination-out'
19
+ if ((this as ILeafData).eraser && (this as ILeafData).eraser !== 'path') return 'destination-out'
20
20
  const { blendMode } = (this as ILeafData)
21
21
  return blendMode === 'pass-through' ? null : blendMode
22
22
  }
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 {