@leafer/web 1.5.3 → 1.6.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer/web",
3
- "version": "1.5.3",
3
+ "version": "1.6.1",
4
4
  "description": "@leafer/web",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,11 +22,24 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/core": "1.5.3",
26
- "@leafer/canvas-web": "1.5.3",
27
- "@leafer/image-web": "1.5.3"
28
- },
29
- "devDependencies": {
30
- "@leafer/interface": "1.5.3"
25
+ "leafer-ui": "1.6.1",
26
+ "@leafer-in/editor": "1.6.1",
27
+ "@leafer-in/text-editor": "1.6.1",
28
+ "@leafer-in/viewport": "1.6.1",
29
+ "@leafer-in/view": "1.6.1",
30
+ "@leafer-in/scroll": "1.6.1",
31
+ "@leafer-in/html": "1.6.1",
32
+ "@leafer-in/arrow": "1.6.1",
33
+ "@leafer-in/flow": "1.6.1",
34
+ "@leafer-in/animate": "1.6.1",
35
+ "@leafer-in/motion-path": "1.6.1",
36
+ "@leafer-in/state": "1.6.1",
37
+ "@leafer-in/robot": "1.6.1",
38
+ "@leafer-in/find": "1.6.1",
39
+ "@leafer-in/export": "1.6.1",
40
+ "@leafer-in/filter": "1.6.1",
41
+ "@leafer-in/color": "1.6.1",
42
+ "@leafer-in/resize": "1.6.1",
43
+ "@leafer-in/interface": "1.6.1"
31
44
  }
32
45
  }
package/src/index.ts CHANGED
@@ -1,102 +1,26 @@
1
- export * from '@leafer/core'
1
+ export * from 'leafer-ui'
2
2
 
3
- export * from '@leafer/canvas-web'
4
- export * from '@leafer/image-web'
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
- import { ICreator, IFunction, IExportImageType, IExportFileType, IObject, ICanvasType } from '@leafer/interface'
7
- import { Platform, Creator, FileHelper, defineKey } from '@leafer/core'
9
+ export * from '@leafer-in/html'
10
+ export * from '@leafer-in/arrow'
11
+ export * from '@leafer-in/flow'
8
12
 
9
- import { LeaferCanvas } from '@leafer/canvas-web'
10
- import { LeaferImage } from '@leafer/image-web'
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
 
18
+ export * from '@leafer-in/find'
19
+ export * from '@leafer-in/export'
12
20
 
13
- const { mineType, fileType } = FileHelper
21
+ export * from '@leafer-in/filter'
14
22
 
15
- Object.assign(Creator, {
16
- canvas: (options?, manager?) => new LeaferCanvas(options, manager),
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): HTMLCanvasElement {
24
- const canvas = document.createElement('canvas')
25
- canvas.width = width
26
- canvas.height = height
27
- return canvas
28
- },
29
- canvasToDataURL: (canvas: HTMLCanvasElement, type?: IExportImageType, quality?: number) => {
30
- const imageType = mineType(type), url = canvas.toDataURL(imageType, quality)
31
- return imageType === 'image/bmp' ? url.replace('image/png;', 'image/bmp;') : url
32
- },
33
- canvasToBolb: (canvas: HTMLCanvasElement, type?: IExportFileType, quality?: number) => new Promise((resolve) => canvas.toBlob(resolve, mineType(type), quality)),
34
- canvasSaveAs: (canvas: HTMLCanvasElement, filename: string, quality?: any) => {
35
- const url = canvas.toDataURL(mineType(fileType(filename)), quality)
36
- return Platform.origin.download(url, filename)
37
- },
38
- download(url: string, filename: string): Promise<void> {
39
- return new Promise((resolve) => {
40
- let el = document.createElement('a')
41
- el.href = url
42
- el.download = filename
43
- document.body.appendChild(el)
44
- el.click()
45
- document.body.removeChild(el)
46
- resolve()
47
- })
48
- },
49
- loadImage(src: any): Promise<HTMLImageElement> {
50
- return new Promise((resolve, reject) => {
51
- const img = new Platform.origin.Image()
52
- const { crossOrigin } = Platform.image
53
- if (crossOrigin) {
54
- img.setAttribute('crossOrigin', crossOrigin)
55
- img.crossOrigin = crossOrigin
56
- }
57
- img.onload = () => { resolve(img) }
58
- img.onerror = (e: any) => { reject(e) }
59
- img.src = Platform.image.getRealURL(src)
60
- })
61
- },
62
- Image,
63
- PointerEvent,
64
- DragEvent
65
- }
66
-
67
- Platform.event = {
68
- stopDefault(origin: Event): void { origin.preventDefault() },
69
- stopNow(origin: Event): void { origin.stopImmediatePropagation() },
70
- stop(origin: Event): void { origin.stopPropagation() }
71
- }
72
-
73
- Platform.canvas = Creator.canvas()
74
- Platform.conicGradientSupport = !!Platform.canvas.context.createConicGradient
75
- }
76
-
77
- Platform.name = 'web'
78
- Platform.isMobile = 'ontouchstart' in window
79
- Platform.requestRender = function (render: IFunction): void { window.requestAnimationFrame(render) }
80
- defineKey(Platform, 'devicePixelRatio', { get() { return devicePixelRatio } })
81
-
82
-
83
- // same as worker
84
-
85
- const { userAgent } = navigator
86
-
87
- if (userAgent.indexOf("Firefox") > -1) {
88
- Platform.conicGradientRotate90 = true
89
- Platform.intWheelDeltaY = true
90
- Platform.syncDomFont = true
91
- } else if (userAgent.indexOf("AppleWebKit") > -1) {
92
- Platform.fullImageShadow = true // 苹果内核渲染阴影
93
- }
94
-
95
- if (userAgent.indexOf('Windows') > -1) {
96
- Platform.os = 'Windows'
97
- Platform.intWheelDeltaY = true
98
- } else if (userAgent.indexOf('Mac') > -1) {
99
- Platform.os = 'Mac'
100
- } else if (userAgent.indexOf('Linux') > -1) {
101
- Platform.os = 'Linux'
102
- }
26
+ export * from '@leafer-in/interface'
package/types/index.d.ts CHANGED
@@ -1,8 +1,19 @@
1
- export * from '@leafer/core';
2
- export * from '@leafer/canvas-web';
3
- export * from '@leafer/image-web';
4
- import { ICanvasType, IObject } from '@leafer/interface';
5
-
6
- declare function useCanvas(_canvasType: ICanvasType, _power?: IObject): void;
7
-
8
- export { useCanvas };
1
+ export * from 'leafer-ui';
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';