@leafer-ui/node 2.0.0 → 2.0.2
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/dist/node.cjs +69 -39
- package/dist/node.esm.js +57 -41
- package/dist/node.esm.min.js +1 -1
- package/dist/node.esm.min.js.map +1 -1
- package/dist/node.min.cjs +1 -1
- package/dist/node.min.cjs.map +1 -1
- package/package.json +10 -12
- package/src/index.ts +2 -2
- package/types/index.d.ts +1 -8
- package/src/core.ts +0 -73
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/node",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "@leafer-ui/node",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,16 +32,14 @@
|
|
|
32
32
|
"leaferjs"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@leafer/core": "2.0.
|
|
36
|
-
"@leafer/
|
|
37
|
-
"@leafer/
|
|
38
|
-
"@leafer/
|
|
39
|
-
"@leafer/
|
|
40
|
-
"@leafer-ui/
|
|
41
|
-
"@leafer-ui/
|
|
42
|
-
"@leafer-
|
|
43
|
-
"@leafer-
|
|
44
|
-
"@leafer-in/export": "2.0.0",
|
|
45
|
-
"@leafer-in/interface": "2.0.0"
|
|
35
|
+
"@leafer/node-core": "2.0.2",
|
|
36
|
+
"@leafer/partner": "2.0.2",
|
|
37
|
+
"@leafer/interface": "2.0.2",
|
|
38
|
+
"@leafer-ui/draw": "2.0.2",
|
|
39
|
+
"@leafer-ui/core": "2.0.2",
|
|
40
|
+
"@leafer-ui/partner": "2.0.2",
|
|
41
|
+
"@leafer-ui/interface": "2.0.2",
|
|
42
|
+
"@leafer-in/export": "2.0.2",
|
|
43
|
+
"@leafer-in/interface": "2.0.2"
|
|
46
44
|
}
|
|
47
45
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from '@leafer-ui/interface'
|
|
2
2
|
|
|
3
|
-
export * from '
|
|
3
|
+
export * from '@leafer/node-core'
|
|
4
4
|
export * from '@leafer/partner'
|
|
5
5
|
|
|
6
6
|
export * from '@leafer-ui/core'
|
|
@@ -9,7 +9,7 @@ export * from '@leafer-ui/partner'
|
|
|
9
9
|
export * from '@leafer-in/export'
|
|
10
10
|
|
|
11
11
|
import { ICreator } from '@leafer/interface'
|
|
12
|
-
import { Creator, LeaferCanvas } from '
|
|
12
|
+
import { Creator, LeaferCanvas } from '@leafer/node-core'
|
|
13
13
|
import { InteractionBase, HitCanvasManager } from '@leafer-ui/core'
|
|
14
14
|
|
|
15
15
|
|
package/types/index.d.ts
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
export * from '@leafer-ui/interface';
|
|
2
|
-
|
|
2
|
+
export * from '@leafer/node-core';
|
|
3
3
|
export * from '@leafer/partner';
|
|
4
4
|
export * from '@leafer-ui/core';
|
|
5
5
|
export * from '@leafer-ui/partner';
|
|
6
6
|
export * from '@leafer-in/export';
|
|
7
|
-
export * from '@leafer/core';
|
|
8
|
-
export * from '@leafer/canvas-node';
|
|
9
|
-
export * from '@leafer/image-node';
|
|
10
|
-
|
|
11
|
-
declare function useCanvas(canvasType: ICanvasType, power: IObject): void;
|
|
12
|
-
|
|
13
|
-
export { useCanvas };
|
package/src/core.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
export * from '@leafer/core'
|
|
2
|
-
|
|
3
|
-
export * from '@leafer/canvas-node'
|
|
4
|
-
export * from '@leafer/image-node'
|
|
5
|
-
|
|
6
|
-
import { ICanvasType, ICreator, IExportFileType, IExportImageType, IFunction, IObject, ISkiaCanvas, ISkiaNAPICanvas } from '@leafer/interface'
|
|
7
|
-
import { Platform, Creator, FileHelper, defineKey } from '@leafer/core'
|
|
8
|
-
|
|
9
|
-
import { LeaferCanvas } from '@leafer/canvas-node'
|
|
10
|
-
import { LeaferImage } from '@leafer/image-node'
|
|
11
|
-
|
|
12
|
-
import { writeFileSync } from 'fs'
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const { mineType, fileType } = FileHelper
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Object.assign(Creator, {
|
|
19
|
-
canvas: (options?, manager?) => new LeaferCanvas(options, manager),
|
|
20
|
-
image: (options) => new LeaferImage(options)
|
|
21
|
-
} as ICreator)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export function useCanvas(canvasType: ICanvasType, power: IObject): void {
|
|
25
|
-
|
|
26
|
-
Platform.canvasType = canvasType
|
|
27
|
-
|
|
28
|
-
if (!Platform.origin) {
|
|
29
|
-
if (canvasType === 'skia') {
|
|
30
|
-
|
|
31
|
-
const { Canvas, loadImage } = power
|
|
32
|
-
Platform.origin = {
|
|
33
|
-
createCanvas: (width: number, height: number, format?: string) => new Canvas(width, height, format),
|
|
34
|
-
canvasToDataURL: (canvas: ISkiaCanvas, type?: IExportImageType, quality?: number) => canvas.toDataURLSync(type, { quality }),
|
|
35
|
-
canvasToBolb: (canvas: ISkiaCanvas, type?: IExportFileType, quality?: number) => canvas.toBuffer(type, { quality }),
|
|
36
|
-
canvasSaveAs: (canvas: ISkiaCanvas, filename: string, quality?: number) => canvas.saveAs(filename, { quality }),
|
|
37
|
-
download(_url: string, _filename: string): Promise<void> { return undefined },
|
|
38
|
-
loadImage(src: any) { return loadImage(Platform.image.getRealURL(src)) }
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
Platform.roundRectPatch = true
|
|
42
|
-
|
|
43
|
-
} else if (canvasType === 'napi') {
|
|
44
|
-
|
|
45
|
-
const { Canvas, loadImage } = power
|
|
46
|
-
Platform.origin = {
|
|
47
|
-
createCanvas: (width: number, height: number, format?: string) => new Canvas(width, height, format),
|
|
48
|
-
canvasToDataURL: (canvas: ISkiaNAPICanvas, type?: IExportImageType, quality?: number) => canvas.toDataURL(mineType(type), quality),
|
|
49
|
-
canvasToBolb: async (canvas: ISkiaNAPICanvas, type?: IExportFileType, quality?: number) => canvas.toBuffer(mineType(type), quality),
|
|
50
|
-
canvasSaveAs: async (canvas: ISkiaNAPICanvas, filename: string, quality?: number) => writeFileSync(filename, canvas.toBuffer(mineType(fileType(filename)), quality)),
|
|
51
|
-
download(_url: string, _filename: string): Promise<void> { return undefined },
|
|
52
|
-
loadImage(src: any) { return loadImage(Platform.image.getRealURL(src)) }
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
Platform.ellipseToCurve = true
|
|
58
|
-
|
|
59
|
-
Platform.event = {
|
|
60
|
-
stopDefault(_origin: IObject): void { },
|
|
61
|
-
stopNow(_origin: IObject): void { },
|
|
62
|
-
stop(_origin: IObject): void { }
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
Platform.canvas = Creator.canvas()
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
Platform.name = 'node'
|
|
70
|
-
Platform.backgrounder = true
|
|
71
|
-
Platform.requestRender = function (render: IFunction): void { setTimeout(render, 16) }
|
|
72
|
-
defineKey(Platform, 'devicePixelRatio', { get() { return 1 } })
|
|
73
|
-
Platform.conicGradientSupport = true
|