@leafer-ui/external 1.0.5 → 1.0.6

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-ui/external",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "@leafer-ui/external",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,9 +22,9 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/core": "1.0.5"
25
+ "@leafer/core": "1.0.6"
26
26
  },
27
27
  "devDependencies": {
28
- "@leafer-ui/interface": "1.0.5"
28
+ "@leafer-ui/interface": "1.0.6"
29
29
  }
30
30
  }
package/src/index.ts CHANGED
@@ -1,11 +1,21 @@
1
1
  // Implemented in partner
2
- import { IPaintModule, IPaintImageModule, IPaintGradientModule, IEffectModule, ITextConvertModule, IExportModule, IColorConvertModule, IPathArrowModule, IStateModule, IUI, IString, IBoolean, ITransitionModule, ITransitionFunction } from "@leafer-ui/interface"
2
+ import { IPaintModule, IPaintImageModule, IPaintGradientModule, IEffectModule, ITextConvertModule, IExportModule, IColorConvertModule, IPathArrowModule, IStateModule, IUI, IString, IBoolean, IUnitData, ITransitionModule, ITransitionFunction } from "@leafer-ui/interface"
3
3
  import { needPlugin } from '@leafer/core'
4
4
 
5
5
  export const TextConvert = {} as ITextConvertModule
6
6
 
7
7
  export const ColorConvert = {} as IColorConvertModule
8
8
 
9
+ export const UnitConvert = {
10
+
11
+ number(value: number | IUnitData, percentRefer?: number): number {
12
+ if (typeof value === 'object') return value.type === 'percent' ? value.value * percentRefer : value.value
13
+ return value
14
+ }
15
+
16
+ }
17
+
18
+
9
19
  export const PathArrow = {} as IPathArrowModule
10
20
 
11
21
 
package/types/index.d.ts CHANGED
@@ -1,7 +1,10 @@
1
- import { ITextConvertModule, IColorConvertModule, IPathArrowModule, IPaintModule, IPaintImageModule, IPaintGradientModule, IEffectModule, IExportModule, IStateModule, ITransitionModule } from '@leafer-ui/interface';
1
+ import { ITextConvertModule, IColorConvertModule, IUnitData, IPathArrowModule, IPaintModule, IPaintImageModule, IPaintGradientModule, IEffectModule, IExportModule, IStateModule, ITransitionModule } from '@leafer-ui/interface';
2
2
 
3
3
  declare const TextConvert: ITextConvertModule;
4
4
  declare const ColorConvert: IColorConvertModule;
5
+ declare const UnitConvert: {
6
+ number(value: number | IUnitData, percentRefer?: number): number;
7
+ };
5
8
  declare const PathArrow: IPathArrowModule;
6
9
  declare const Paint: IPaintModule;
7
10
  declare const PaintImage: IPaintImageModule;
@@ -11,4 +14,4 @@ declare const Export: IExportModule;
11
14
  declare const State: IStateModule;
12
15
  declare const Transition: ITransitionModule;
13
16
 
14
- export { ColorConvert, Effect, Export, Paint, PaintGradient, PaintImage, PathArrow, State, TextConvert, Transition };
17
+ export { ColorConvert, Effect, Export, Paint, PaintGradient, PaintImage, PathArrow, State, TextConvert, Transition, UnitConvert };