@leafer/node 1.0.0-rc.9 → 1.0.1
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 +5 -6
- package/src/index.ts +8 -11
- package/types/index.d.ts +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/node",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "@leafer/node",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,12 +22,11 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/core": "1.0.
|
|
26
|
-
"@leafer/
|
|
27
|
-
"@leafer/
|
|
28
|
-
"@leafer/image-node": "1.0.0-rc.9"
|
|
25
|
+
"@leafer/core": "1.0.1",
|
|
26
|
+
"@leafer/canvas-node": "1.0.1",
|
|
27
|
+
"@leafer/image-node": "1.0.1"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
|
-
"@leafer/interface": "1.0.
|
|
30
|
+
"@leafer/interface": "1.0.1"
|
|
32
31
|
}
|
|
33
32
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
export * from '@leafer/core'
|
|
2
2
|
|
|
3
|
-
export * from '@leafer/partner'
|
|
4
|
-
|
|
5
3
|
export * from '@leafer/canvas-node'
|
|
6
|
-
export * from '@leafer/image-
|
|
4
|
+
export * from '@leafer/image-node'
|
|
7
5
|
|
|
8
6
|
import { ICanvasType, ICreator, IExportFileType, IExportImageType, IFunction, IObject, ISkiaCanvas, ISkiaNAPICanvas } from '@leafer/interface'
|
|
9
|
-
import { Platform, Creator,
|
|
7
|
+
import { Platform, Creator, FileHelper, defineKey } from '@leafer/core'
|
|
10
8
|
|
|
11
9
|
import { LeaferCanvas } from '@leafer/canvas-node'
|
|
12
10
|
import { LeaferImage } from '@leafer/image-node'
|
|
@@ -19,10 +17,7 @@ const { mineType, fileType } = FileHelper
|
|
|
19
17
|
|
|
20
18
|
Object.assign(Creator, {
|
|
21
19
|
canvas: (options?, manager?) => new LeaferCanvas(options, manager),
|
|
22
|
-
image: (options) => new LeaferImage(options)
|
|
23
|
-
hitCanvas: (options?, manager?) => new LeaferCanvas(options, manager),
|
|
24
|
-
|
|
25
|
-
interaction: (target, canvas, selector, options?) => { return new InteractionBase(target, canvas, selector, options) }
|
|
20
|
+
image: (options) => new LeaferImage(options)
|
|
26
21
|
} as ICreator)
|
|
27
22
|
|
|
28
23
|
|
|
@@ -39,7 +34,8 @@ export function useCanvas(canvasType: ICanvasType, power: IObject): void {
|
|
|
39
34
|
canvasToDataURL: (canvas: ISkiaCanvas, type?: IExportImageType, quality?: number) => canvas.toDataURLSync(type, { quality }),
|
|
40
35
|
canvasToBolb: (canvas: ISkiaCanvas, type?: IExportFileType, quality?: number) => canvas.toBuffer(type, { quality }),
|
|
41
36
|
canvasSaveAs: (canvas: ISkiaCanvas, filename: string, quality?: number) => canvas.saveAs(filename, { quality }),
|
|
42
|
-
|
|
37
|
+
download(_url: string, _filename: string): Promise<void> { return undefined },
|
|
38
|
+
loadImage(src: any) { return loadImage(Platform.image.getRealURL(src)) }
|
|
43
39
|
}
|
|
44
40
|
|
|
45
41
|
Platform.roundRectPatch = true
|
|
@@ -52,7 +48,8 @@ export function useCanvas(canvasType: ICanvasType, power: IObject): void {
|
|
|
52
48
|
canvasToDataURL: (canvas: ISkiaNAPICanvas, type?: IExportImageType, quality?: number) => canvas.toDataURL(mineType(type), quality),
|
|
53
49
|
canvasToBolb: async (canvas: ISkiaNAPICanvas, type?: IExportFileType, quality?: number) => canvas.toBuffer(mineType(type), quality),
|
|
54
50
|
canvasSaveAs: async (canvas: ISkiaNAPICanvas, filename: string, quality?: number) => writeFileSync(filename, canvas.toBuffer(mineType(fileType(filename)), quality)),
|
|
55
|
-
|
|
51
|
+
download(_url: string, _filename: string): Promise<void> { return undefined },
|
|
52
|
+
loadImage(src: any) { return loadImage(Platform.image.getRealURL(src)) }
|
|
56
53
|
}
|
|
57
54
|
|
|
58
55
|
}
|
|
@@ -71,5 +68,5 @@ export function useCanvas(canvasType: ICanvasType, power: IObject): void {
|
|
|
71
68
|
|
|
72
69
|
Platform.name = 'node'
|
|
73
70
|
Platform.requestRender = function (render: IFunction): void { setTimeout(render) }
|
|
74
|
-
Platform
|
|
71
|
+
defineKey(Platform, 'devicePixelRatio', { get() { return 1 } })
|
|
75
72
|
Platform.conicGradientSupport = true
|
package/types/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from '@leafer/core';
|
|
2
|
-
export * from '@leafer/partner';
|
|
3
2
|
export * from '@leafer/canvas-node';
|
|
4
|
-
export * from '@leafer/image-
|
|
3
|
+
export * from '@leafer/image-node';
|
|
5
4
|
import { ICanvasType, IObject } from '@leafer/interface';
|
|
6
5
|
|
|
7
6
|
declare function useCanvas(canvasType: ICanvasType, power: IObject): void;
|