@leafer/image 1.0.0-beta.12 → 1.0.0-beta.16

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,12 +1,15 @@
1
1
  {
2
2
  "name": "@leafer/image",
3
- "version": "1.0.0-beta.12",
3
+ "version": "1.0.0-beta.16",
4
4
  "description": "@leafer/image",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
7
7
  "main": "src/index.ts",
8
+ "types": "types/index.d.ts",
8
9
  "files": [
9
- "src"
10
+ "src",
11
+ "types",
12
+ "dist"
10
13
  ],
11
14
  "repository": {
12
15
  "type": "git",
@@ -19,10 +22,10 @@
19
22
  "leaferjs"
20
23
  ],
21
24
  "dependencies": {
22
- "@leafer/task": "1.0.0-beta.12",
23
- "@leafer/platform": "1.0.0-beta.12"
25
+ "@leafer/task": "1.0.0-beta.16",
26
+ "@leafer/platform": "1.0.0-beta.16"
24
27
  },
25
28
  "devDependencies": {
26
- "@leafer/interface": "1.0.0-beta.12"
29
+ "@leafer/interface": "1.0.0-beta.16"
27
30
  }
28
31
  }
@@ -1,12 +1,13 @@
1
1
  import { ILeaferImage, ILeaferImageConfig, IFunction, IObject, InnerId } from '@leafer/interface'
2
2
  import { Platform } from '@leafer/platform'
3
3
  import { IncrementId } from '@leafer/math'
4
+
4
5
  import { ImageManager } from './ImageManager'
5
6
 
6
7
 
7
8
  const { IMAGE, create } = IncrementId
8
9
 
9
- export class LeaferImageBase implements ILeaferImage {
10
+ export class LeaferImage implements ILeaferImage {
10
11
 
11
12
  public readonly innerId: InnerId
12
13
  public get url() { return this.config.url }
@@ -39,6 +40,7 @@ export class LeaferImageBase implements ILeaferImage {
39
40
  } else {
40
41
  if (url.includes('.svg')) this.isSVG = true
41
42
  }
43
+ if (this.config.format === 'svg') this.isSVG = true
42
44
  }
43
45
 
44
46
  public load(onSuccess: IFunction, onError: IFunction): number {
package/src/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { LeaferImageBase } from './LeaferImageBase'
1
+ export { LeaferImage } from './LeaferImage'
2
2
  export { ImageManager } from './ImageManager'
@@ -0,0 +1,27 @@
1
+ import { ILeaferImage, InnerId, IObject, ILeaferImageConfig, IFunction, IImageManager } from '@leafer/interface';
2
+
3
+ declare class LeaferImage implements ILeaferImage {
4
+ readonly innerId: InnerId;
5
+ get url(): string;
6
+ view: any;
7
+ width: number;
8
+ height: number;
9
+ isSVG: boolean;
10
+ get completed(): boolean;
11
+ ready: boolean;
12
+ error: IObject;
13
+ loading: boolean;
14
+ use: number;
15
+ config: ILeaferImageConfig;
16
+ protected waitComplete: IFunction[];
17
+ constructor(config: ILeaferImageConfig);
18
+ load(onSuccess: IFunction, onError: IFunction): number;
19
+ unload(index: number, stopEvent?: boolean): void;
20
+ protected onComplete(isSuccess: boolean): void;
21
+ getCanvas(width: number, height: number, opacity?: number, _filters?: IObject): any;
22
+ destroy(): void;
23
+ }
24
+
25
+ declare const ImageManager: IImageManager;
26
+
27
+ export { ImageManager, LeaferImage };