@leafer-ui/external 1.0.0-beta.9 → 1.0.0-rc.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,12 +1,15 @@
1
1
  {
2
2
  "name": "@leafer-ui/external",
3
- "version": "1.0.0-beta.9",
3
+ "version": "1.0.0-rc.1",
4
4
  "description": "@leafer-ui/external",
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",
@@ -18,11 +21,7 @@
18
21
  "leafer-ui",
19
22
  "leaferjs"
20
23
  ],
21
- "dependencies": {
22
- "@leafer-ui/paint": "1.0.0-beta.9",
23
- "@leafer-ui/effect": "1.0.0-beta.9"
24
- },
25
24
  "devDependencies": {
26
- "@leafer-ui/interface": "1.0.0-beta.9"
25
+ "@leafer-ui/interface": "1.0.0-rc.1"
27
26
  }
28
27
  }
package/src/index.ts CHANGED
@@ -1,13 +1,14 @@
1
- export { Effect } from './Effect'
2
- export { Paint } from './Paint'
1
+ // Implemented in partner
2
+ import { IPaintModule, IEffectModule, ITextConvertModule, IExportModule, IColorConvertModule } from "@leafer-ui/interface"
3
3
 
4
- export { Animate } from './Animate'
5
- export { Export } from './Export'
4
+ export const Effect: IEffectModule = {}
6
5
 
7
- import { Effect } from './Effect'
8
- import { Paint } from './Paint'
9
- import * as UIEffect from '@leafer-ui/effect'
10
- import * as UIPaint from '@leafer-ui/paint'
6
+ export const Paint: IPaintModule = {}
11
7
 
12
- Object.assign(Effect, UIEffect)
13
- Object.assign(Paint, UIPaint)
8
+ export const Animate = {}
9
+
10
+ export const TextConvert: ITextConvertModule = {}
11
+
12
+ export const ColorConvert: IColorConvertModule = {}
13
+
14
+ export const Export: IExportModule = {}
@@ -0,0 +1,10 @@
1
+ import { IEffectModule, IPaintModule, ITextConvertModule, IColorConvertModule, IExportModule } from '@leafer-ui/interface';
2
+
3
+ declare const Effect: IEffectModule;
4
+ declare const Paint: IPaintModule;
5
+ declare const Animate: {};
6
+ declare const TextConvert: ITextConvertModule;
7
+ declare const ColorConvert: IColorConvertModule;
8
+ declare const Export: IExportModule;
9
+
10
+ export { Animate, ColorConvert, Effect, Export, Paint, TextConvert };
package/src/Animate.ts DELETED
@@ -1,3 +0,0 @@
1
- export const Animate = {
2
-
3
- }
package/src/Effect.ts DELETED
@@ -1,6 +0,0 @@
1
- import { IEffectModule } from "@leafer-ui/interface"
2
-
3
-
4
- export const Effect: IEffectModule = {
5
-
6
- }
package/src/Export.ts DELETED
@@ -1,82 +0,0 @@
1
- import { ILeaf, IExportFileType, IBlob, IFunction } from '@leafer/interface'
2
- import { TaskProcessor } from '@leafer/core'
3
-
4
- import { IExportModule, IExportOptions, IExportResult, IExportResultFunction } from '@leafer-ui/interface'
5
-
6
-
7
- export const Export: IExportModule = {
8
-
9
- export(leaf: ILeaf, filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise<IExportResult> {
10
-
11
- return addTask((success: IExportResultFunction) =>
12
-
13
- new Promise((resolve: IFunction) => {
14
-
15
- const { leafer } = leaf
16
- if (leafer) {
17
-
18
- leafer.waitViewLoaded(async () => {
19
-
20
- let quality, blob: boolean
21
- let { canvas } = leafer
22
- let { unreal } = canvas
23
-
24
- if (unreal) {
25
- canvas = canvas.getSameCanvas()
26
- canvas.backgroundColor = leafer.config.fill
27
- leafer.__render(canvas, {})
28
- }
29
-
30
- switch (typeof options) {
31
- case 'object':
32
- if (options.quality) quality = options.quality
33
- if (options.blob) blob = true
34
- break
35
- case 'number':
36
- quality = options
37
- break
38
- case 'boolean':
39
- blob = options
40
- }
41
-
42
- let data: IBlob | string | boolean
43
-
44
- if (filename.includes('.')) {
45
- data = await canvas.saveAs(filename, quality)
46
- } else if (blob) {
47
- data = await canvas.toBlob(filename, quality)
48
- } else {
49
- data = canvas.toDataURL(filename, quality)
50
- }
51
-
52
- success({ data })
53
- resolve()
54
-
55
- if (unreal) canvas.recycle()
56
-
57
- })
58
-
59
- } else {
60
- success({ data: false })
61
- resolve()
62
- }
63
-
64
- })
65
-
66
- )
67
-
68
- }
69
-
70
- }
71
-
72
-
73
- let tasker: TaskProcessor
74
-
75
- function addTask(task: IFunction): Promise<IExportResult> {
76
- if (!tasker) tasker = new TaskProcessor()
77
-
78
- return new Promise((resolve: IExportResultFunction) => {
79
- tasker.add(async () => await task(resolve))
80
- if (!tasker.running) tasker.start()
81
- })
82
- }
package/src/Paint.ts DELETED
@@ -1,6 +0,0 @@
1
- import { IPaintModule } from "@leafer-ui/interface"
2
-
3
-
4
- export const Paint: IPaintModule = {
5
-
6
- }