@leafer/worker 1.5.3 → 1.6.0
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/worker.cjs +132 -0
- package/dist/worker.cjs.map +1 -0
- package/dist/worker.esm.js +19 -0
- package/dist/worker.esm.js.map +1 -0
- package/dist/worker.esm.min.js +2 -0
- package/dist/worker.esm.min.js.map +1 -0
- package/dist/worker.js +18162 -0
- package/dist/worker.js.map +1 -0
- package/dist/worker.min.cjs +2 -0
- package/dist/worker.min.cjs.map +1 -0
- package/dist/worker.min.js +2 -0
- package/dist/worker.min.js.map +1 -0
- package/dist/worker.module.js +17940 -0
- package/dist/worker.module.js.map +1 -0
- package/dist/worker.module.min.js +2 -0
- package/dist/worker.module.min.js.map +1 -0
- package/package.json +29 -8
- package/src/index.ts +19 -79
- package/types/index.d.ts +19 -8
package/package.json
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/worker",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "@leafer/worker",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "dist/worker.esm.min.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
"import": "./dist/worker.esm.min.js",
|
|
11
|
+
"require": "./dist/worker.min.cjs",
|
|
12
|
+
"types": "./types/index.d.ts"
|
|
13
|
+
},
|
|
8
14
|
"types": "types/index.d.ts",
|
|
15
|
+
"unpkg": "dist/worker.min.js",
|
|
16
|
+
"jsdelivr": "dist/worker.min.js",
|
|
9
17
|
"files": [
|
|
10
18
|
"src",
|
|
11
19
|
"types",
|
|
@@ -22,11 +30,24 @@
|
|
|
22
30
|
"leaferjs"
|
|
23
31
|
],
|
|
24
32
|
"dependencies": {
|
|
25
|
-
"@leafer/
|
|
26
|
-
"@leafer/
|
|
27
|
-
"@leafer/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"@leafer/
|
|
33
|
+
"@leafer-ui/worker": "1.6.0",
|
|
34
|
+
"@leafer-in/editor": "1.6.0",
|
|
35
|
+
"@leafer-in/text-editor": "1.6.0",
|
|
36
|
+
"@leafer-in/viewport": "1.6.0",
|
|
37
|
+
"@leafer-in/view": "1.6.0",
|
|
38
|
+
"@leafer-in/scroll": "1.6.0",
|
|
39
|
+
"@leafer-in/html": "1.6.0",
|
|
40
|
+
"@leafer-in/arrow": "1.6.0",
|
|
41
|
+
"@leafer-in/flow": "1.6.0",
|
|
42
|
+
"@leafer-in/animate": "1.6.0",
|
|
43
|
+
"@leafer-in/motion-path": "1.6.0",
|
|
44
|
+
"@leafer-in/state": "1.6.0",
|
|
45
|
+
"@leafer-in/robot": "1.6.0",
|
|
46
|
+
"@leafer-in/find": "1.6.0",
|
|
47
|
+
"@leafer-in/export": "1.6.0",
|
|
48
|
+
"@leafer-in/filter": "1.6.0",
|
|
49
|
+
"@leafer-in/color": "1.6.0",
|
|
50
|
+
"@leafer-in/resize": "1.6.0",
|
|
51
|
+
"@leafer-in/interface": "1.6.0"
|
|
31
52
|
}
|
|
32
53
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,86 +1,26 @@
|
|
|
1
|
-
export * from '@leafer/
|
|
1
|
+
export * from '@leafer-ui/worker'
|
|
2
2
|
|
|
3
|
-
export * from '@leafer/
|
|
4
|
-
export * from '@leafer/
|
|
3
|
+
export * from '@leafer-in/editor'
|
|
4
|
+
export * from '@leafer-in/text-editor'
|
|
5
|
+
export * from '@leafer-in/viewport'
|
|
6
|
+
export * from '@leafer-in/view'
|
|
7
|
+
export * from '@leafer-in/scroll'
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
export * from '@leafer-in/html'
|
|
10
|
+
export * from '@leafer-in/arrow'
|
|
11
|
+
export * from '@leafer-in/flow'
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
export * from '@leafer-in/animate'
|
|
14
|
+
export * from '@leafer-in/motion-path'
|
|
15
|
+
export * from '@leafer-in/state'
|
|
16
|
+
export * from '@leafer-in/robot'
|
|
11
17
|
|
|
12
|
-
|
|
18
|
+
export * from '@leafer-in/find'
|
|
19
|
+
export * from '@leafer-in/export'
|
|
13
20
|
|
|
21
|
+
export * from '@leafer-in/filter'
|
|
14
22
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
image: (options) => new LeaferImage(options)
|
|
18
|
-
} as ICreator)
|
|
23
|
+
export * from '@leafer-in/color'
|
|
24
|
+
export * from '@leafer-in/resize'
|
|
19
25
|
|
|
20
|
-
|
|
21
|
-
export function useCanvas(_canvasType: ICanvasType, _power?: IObject): void {
|
|
22
|
-
Platform.origin = {
|
|
23
|
-
createCanvas: (width: number, height: number): OffscreenCanvas => new OffscreenCanvas(width, height),
|
|
24
|
-
canvasToDataURL: (canvas: OffscreenCanvas, type?: IExportImageType, quality?: number) => {
|
|
25
|
-
return new Promise((resolve, reject) => {
|
|
26
|
-
(canvas as any).convertToBlob({ type: mineType(type), quality }).then((blob: Blob) => {
|
|
27
|
-
var reader = new FileReader()
|
|
28
|
-
reader.onload = (e) => resolve(e.target.result as string)
|
|
29
|
-
reader.onerror = (e) => reject(e)
|
|
30
|
-
reader.readAsDataURL(blob)
|
|
31
|
-
}).catch((e: any) => {
|
|
32
|
-
reject(e)
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
},
|
|
36
|
-
canvasToBolb: (canvas: OffscreenCanvas, type?: IExportFileType, quality?: number) => (canvas as any).convertToBlob({ type: mineType(type), quality }),
|
|
37
|
-
canvasSaveAs: (_canvas: OffscreenCanvas, _filename: string, _quality?: any) => new Promise((resolve) => resolve()),
|
|
38
|
-
download(_url: string, _filename: string): Promise<void> { return undefined },
|
|
39
|
-
loadImage(src: any): Promise<ImageBitmap> {
|
|
40
|
-
return new Promise((resolve, reject) => {
|
|
41
|
-
let req = new XMLHttpRequest()
|
|
42
|
-
req.open('GET', Platform.image.getRealURL(src), true)
|
|
43
|
-
req.responseType = "blob"
|
|
44
|
-
req.onload = () => {
|
|
45
|
-
createImageBitmap(req.response).then(img => {
|
|
46
|
-
resolve(img)
|
|
47
|
-
}).catch(e => {
|
|
48
|
-
reject(e)
|
|
49
|
-
})
|
|
50
|
-
}
|
|
51
|
-
req.onerror = (e) => reject(e)
|
|
52
|
-
req.send()
|
|
53
|
-
})
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
Platform.canvas = Creator.canvas()
|
|
58
|
-
Platform.conicGradientSupport = !!Platform.canvas.context.createConicGradient
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
Platform.name = 'web'
|
|
62
|
-
Platform.isWorker = true
|
|
63
|
-
Platform.backgrounder = true
|
|
64
|
-
Platform.requestRender = function (render: IFunction): void { requestAnimationFrame(render) }
|
|
65
|
-
defineKey(Platform, 'devicePixelRatio', { get() { return 1 } })
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// same as web
|
|
69
|
-
|
|
70
|
-
const { userAgent } = navigator
|
|
71
|
-
|
|
72
|
-
if (userAgent.indexOf("Firefox") > -1) {
|
|
73
|
-
Platform.conicGradientRotate90 = true
|
|
74
|
-
Platform.intWheelDeltaY = true
|
|
75
|
-
} else if (userAgent.indexOf("Safari") > -1 && userAgent.indexOf("Chrome") === -1) {
|
|
76
|
-
Platform.fullImageShadow = true
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (userAgent.indexOf('Windows') > -1) {
|
|
80
|
-
Platform.os = 'Windows'
|
|
81
|
-
Platform.intWheelDeltaY = true
|
|
82
|
-
} else if (userAgent.indexOf('Mac') > -1) {
|
|
83
|
-
Platform.os = 'Mac'
|
|
84
|
-
} else if (userAgent.indexOf('Linux') > -1) {
|
|
85
|
-
Platform.os = 'Linux'
|
|
86
|
-
}
|
|
26
|
+
export * from '@leafer-in/interface'
|
package/types/index.d.ts
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
export * from '@leafer/
|
|
2
|
-
export * from '@leafer/
|
|
3
|
-
export * from '@leafer/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
1
|
+
export * from '@leafer-ui/worker';
|
|
2
|
+
export * from '@leafer-in/editor';
|
|
3
|
+
export * from '@leafer-in/text-editor';
|
|
4
|
+
export * from '@leafer-in/viewport';
|
|
5
|
+
export * from '@leafer-in/view';
|
|
6
|
+
export * from '@leafer-in/scroll';
|
|
7
|
+
export * from '@leafer-in/html';
|
|
8
|
+
export * from '@leafer-in/arrow';
|
|
9
|
+
export * from '@leafer-in/flow';
|
|
10
|
+
export * from '@leafer-in/animate';
|
|
11
|
+
export * from '@leafer-in/motion-path';
|
|
12
|
+
export * from '@leafer-in/state';
|
|
13
|
+
export * from '@leafer-in/robot';
|
|
14
|
+
export * from '@leafer-in/find';
|
|
15
|
+
export * from '@leafer-in/export';
|
|
16
|
+
export * from '@leafer-in/filter';
|
|
17
|
+
export * from '@leafer-in/color';
|
|
18
|
+
export * from '@leafer-in/resize';
|
|
19
|
+
export * from '@leafer-in/interface';
|