You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@leafer-ui/interface

Package Overview
Dependencies
Maintainers
1
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@leafer-ui/interface - npm Package Compare versions

Comparing version
1.0.2
to
1.0.3
+168
src/IAnimation.ts
import { IEventer, IEventMap, IObject, IPercentData } from '@leafer/interface'
import { IUIInputData, IUI } from './IUI'
export type IAnimation = IStyleAnimation | IKeyframesAnimation
export type ITransition = IAnimateOptions | IAnimateEasingName | number | boolean
export type IAnimateType = 'all' | 'animation' | 'transition' | 'animate'
export interface IStyleAnimation extends IAnimateOptions {
style: IUIInputData
}
export interface IKeyframesAnimation extends IAnimateOptions {
keyframes: IKeyframe[]
}
export interface IAnimateOptions {
easing?: IAnimateEasing
delay?: number
duration?: number
ending?: IAnimateEnding
reverse?: boolean
swing?: boolean
loop?: boolean | number
loopDelay?: number
speed?: number
join?: boolean
autoplay?: boolean
attrs?: string[]
event?: IAnimateEvents
}
export type IKeyframe = IUIInputData | IAnimateKeyframe
export type IKeyframeId = number
export interface IAnimateKeyframe {
style: IUIInputData
easing?: IAnimateEasing
delay?: number
duration?: number
autoDelay?: number
autoDuration?: number
}
export interface IComputedKeyframe {
style: IUIInputData
beforeStyle: IUIInputData
betweenStyle?: IUIInputData
easingFn?: IAnimateEasingFunction
delay?: number
duration?: number
autoDelay?: number
autoDuration?: number
totalTime?: number // 存在delay 时, 才会有这个属性
}
export interface IAnimateEasingFunction {
(t: number): number
}
export interface ICustomEasingFunction {
(...arg: any): IAnimateEasingFunction
}
export type IAnimateEasing =
| IAnimateEasingName
| ICubicBezierEasing
| IStepsEasing
| IObject
export interface ICubicBezierEasing {
name: 'cubic-bezier',
value: [number, number, number, number]
}
export interface IStepsEasing {
name: 'steps',
value: number | [number, 'floor' | 'round' | 'ceil']
}
export type IAnimateEasingName =
| 'linear'
| 'ease'
| 'ease-in' | 'ease-out' | 'ease-in-out'
| 'sine-in' | 'sine-out' | 'sine-in-out'
| 'quad-in' | 'quad-out' | 'quad-in-out'
| 'cubic-in' | 'cubic-out' | 'cubic-in-out'
| 'quart-in' | 'quart-out' | 'quart-in-out'
| 'quint-in' | 'quint-out' | 'quint-in-out'
| 'expo-in' | 'expo-out' | 'expo-in-out'
| 'circ-in' | 'circ-out' | 'circ-in-out'
| 'back-in' | 'back-out' | 'back-in-out'
| 'elastic-in' | 'elastic-out' | 'elastic-in-out'
| 'bounce-in' | 'bounce-out' | 'bounce-in-out'
export type IAnimateEnding = 'auto' | 'from' | 'to'
export interface IAnimateEvents {
created?: IAnimateEventFunction
play?: IAnimateEventFunction
pause?: IAnimateEventFunction
stop?: IAnimateEventFunction
seek?: IAnimateEventFunction
update?: IAnimateEventFunction
completed?: IAnimateEventFunction
}
export interface IAnimateEventFunction {
(animate?: IAnimate): any
}
export interface IAnimate extends IAnimateOptions, IEventer {
target: IUI
keyframes: IKeyframe[]
config?: IAnimateOptions
event?: IEventMap
readonly frames: IComputedKeyframe[]
readonly fromStyle: IUIInputData
readonly toStyle: IUIInputData
readonly endingStyle: IUIInputData
readonly started: boolean
readonly running: boolean
readonly completed: boolean
readonly destroyed: boolean
readonly time: number
readonly looped: number
readonly realEnding: IAnimateEnding
init(target: IUI, keyframe: IUIInputData | IKeyframe[], options?: ITransition, isTemp?: boolean): void
play(): void
pause(): void
stop(): void
seek(time: number | IPercentData): void
kill(): void
destroy(complete?: boolean): void
}
import { IObject } from '@leafer/interface'
import { IColor, IGradientPaint } from '../type/IType'
export interface ITransitionModule {
list: ITransitionMap
register(attrName: string, fn: ITransitionFunction): void
get(attrName: string): ITransitionFunction
value(from: any, to: any, t: number, target?: IObject): any
number(from: number, to: number, t: number, roundValue?: number): number
color(from: IColor, to: IColor, t: number): string
gradient(from: IGradientPaint, to: IGradientPaint, t: number, target: IObject): IGradientPaint
}
export interface ITransitionMap {
[name: string]: ITransitionFunction
}
export interface ITransitionFunction {
(from: any, to: any, t: number, target?: any): any
}
+2
-2
{
"name": "@leafer-ui/interface",
"version": "1.0.2",
"version": "1.0.3",
"description": "@leafer-ui/interface",

@@ -25,4 +25,4 @@ "author": "Chao (Leafer) Wan",

"dependencies": {
"@leafer/interface": "1.0.2"
"@leafer/interface": "1.0.3"
}
}

@@ -20,2 +20,5 @@ export * from '@leafer/interface'

IFlow, IFlowInputData, IFlowData,
IVideo, IVideoInputData, IVideoData,
IGIF, IGIFInputData, IGIFData,
IRobot, IRobotInputData, IRobotData, IRobotActions, IRobotActionName, IRobotKeyframe, IRobotComputedKeyframe, IRobotAnimation,
IBox, IBoxInputData, IBoxData,

@@ -26,6 +29,6 @@ IGroup, IGroupInputData, IGroupData,

IUI, IUIBaseInputData, IUIData, IFindUIMethod,
IUITag, IUIInputData, IUIJSONData
IUITag, IUIInputData, IUIJSONData, IStateStyle, IStates, IStateName
} from './IUI'
export { IVectorPath, IShadowEffect, IBlurEffect, IGrayscaleEffect, IFill, IStroke, IPaintAttr, IStrokeAlign, IStrokeJoin, IStrokeCap, IArrowType, IPathDataArrow, IPathDataArrowMap, IRGB, IRGBA, IColor, IColorStop, IPaint, IGradientPaint, IImagePaint, IImagePaintMode, IFontWeight, ITextCase, ITextDecoration, ITextAlign, IVerticalAlign, IOverflow, ITextWrap, IRepeat } from './type/IType'
export { IVectorPath, IShadowEffect, IBlurEffect, IGrayscaleEffect, IFill, IStroke, IPaintAttr, IStrokeAlign, IStrokeJoin, IStrokeCap, IArrowType, IPathDataArrow, IPathDataArrowMap, IRGB, IRGBA, IColor, IColorStop, IPaint, IGradientPaint, IImagePaint, IImagePaintMode, IFontWeight, IFontWeightNumer, IFontWeightString, ITextCase, ITextDecoration, ITextAlign, IVerticalAlign, IOverflow, ITextWrap, IRepeat, IGradientType, IPaintType, IImageFilters, IPathDataArrowOffset, ISolidPaint, IPaintBase } from './type/IType'
export { ICornerRadiusString, IStrokeWidthString, IPaintString, IShadowString, IPercent, IDashPatternString, IColorString } from './type/IStringType'

@@ -35,2 +38,4 @@ export { ILeafFill, ILeafPaint, ILeafPaintPatternData, ILeafPaintColor, ILeafStrokePaint, ILeafShadowEffect } from './type/IComputedType'

export { IAnimation, ITransition, IAnimate, IAnimateType, IKeyframe, IKeyframeId, IAnimateEasing, ICubicBezierEasing, IStepsEasing, IAnimateEasingFunction, IAnimateEasingName, IAnimateEnding, IAnimateEvents, IAnimateEventFunction, ICustomEasingFunction, IAnimateKeyframe, IComputedKeyframe, IStyleAnimation, IKeyframesAnimation, IAnimateOptions } from './IAnimation'
export { IUIRenderModule, IRectRenderModule, IImageRenderModule, ITextRenderModule, IGroupRenderModule, IFrameRenderModule } from './module/IUIRender'

@@ -40,2 +45,3 @@ export { IUIBoundsModule } from './module/IUIBounds'

export { IPathArrowModule } from './module/IPathArrow'
export { ITransitionModule, ITransitionMap, ITransitionFunction } from './module/ITransition'
export { ITextConvertModule } from './module/ITextConvert'

@@ -42,0 +48,0 @@ export { IColorConvertModule } from './module/IColorConvert'

+148
-66

@@ -1,2 +0,2 @@

import { ILeaf, ILeafComputedData, ILeafData, ILeafInputData, ILeaferCanvas, IRenderOptions, IExportOptions, IExportResult, IPathDrawer, IPointData, IPathCommandData, ILeaferImageConfig, IBoundsData, IObject, IPathString, ILeaferImage, IPathCreator, IAnswer, IPickOptions, IPickResult, IValue, ICanvasContext2DSettings, IFourNumber, IFindCondition, IBoolean, ICanvasContext2D, IJSONOptions, IMatrixData } from '@leafer/interface'
import { ILeaf, ILeafComputedData, ILeafData, ILeafInputData, ILeaferCanvas, IRenderOptions, IExportOptions, IExportResult, IPathDrawer, IPointData, IPathCommandData, IBoundsData, IObject, IPathString, ILeaferImage, IPathCreator, IAnswer, IPickOptions, IPickResult, IValue, ICanvasContext2DSettings, IFourNumber, IFindCondition, IBoolean, ICanvasContext2D, IJSONOptions, IMatrixData, ISizeData } from '@leafer/interface'

@@ -12,2 +12,3 @@ import {

import { IOverflow } from './type/IType'
import { IAnimation, IAnimate, IKeyframe, IKeyframeId, ITransition, IAnimateType } from './IAnimation'
import { ILeafer } from './app/ILeafer'

@@ -17,7 +18,4 @@ import { IEditorConfig } from './editor/IEditor'

// Line
export interface ILine extends IUI {
export interface ILine extends ILineAttrData, IUI {
__: ILineData
toPoint?: IPointData
points?: number[]
curve?: boolean | number
}

@@ -57,2 +55,84 @@

// Video
export interface IVideo extends IPlayerMethods, IRect {
__: IVideoData
}
interface IPlayerMethods {
play(): void
pause(): void
stop(): void
}
interface IVideoAttrData {
url?: string
}
export interface IVideoData extends IVideoAttrData, IRectData { }
export interface IVideoInputData extends IVideoAttrData, IRectInputData { }
// GIF
export interface IGIF extends IPlayerMethods, IRect {
__: IGIFData
}
interface IGIFAttrData {
url?: string
}
export interface IGIFData extends IGIFAttrData, IRectData { }
export interface IGIFInputData extends IGIFAttrData, IRectInputData { }
// Robot
export interface IRobot extends IRobotAttrData, IPlayerMethods, IRect {
__: IRobotData
readonly running: boolean
readonly nowFrame?: IRobotComputedKeyframe
readonly robotFrames?: IRobotComputedKeyframe[]
__updateRobot(): void
__updateAction(): void
}
interface IRobotAttrData {
robot?: IRobotKeyframe | IRobotKeyframe[]
actions?: IRobotActions
action?: IRobotActionName
now?: number
FPS?: number
loop?: boolean
}
export interface IRobotActions {
[name: string]: IKeyframeId | IKeyframeId[] | IRobotAnimation
}
export interface IRobotAnimation {
keys: IKeyframeId[]
loop?: boolean | number
speed?: number
}
export type IRobotActionName = string
export interface IRobotKeyframe {
mode?: 'normal' | 'clip'
url: string
offset?: IPointData
size?: number | ISizeData
total?: number
}
export interface IRobotComputedKeyframe extends IBoundsData {
view: any
}
export interface IRobotData extends IRobotAttrData, IRectData { }
export interface IRobotInputData extends IRobotAttrData, IRectInputData { }
// Rect

@@ -67,7 +147,4 @@ export interface IRect extends IUI {

// Ellipse
export interface IEllipse extends IUI {
export interface IEllipse extends IUI, IEllipseAttrData {
__: IEllipseData
startAngle?: number
endAngle?: number
innerRadius?: number
}

@@ -84,7 +161,4 @@ interface IEllipseAttrData {

// Polygon
export interface IPolygon extends IUI {
export interface IPolygon extends IPolygonAttrData, IUI {
__: IPolygonData
sides?: number
points?: number[]
curve?: boolean | number
}

@@ -101,6 +175,4 @@ interface IPolygonAttrData {

// Star
export interface IStar extends IUI {
export interface IStar extends IStarAttrData, IUI {
__: IStarData
corners?: number
innerRadius?: number
}

@@ -139,7 +211,4 @@ interface IStarAttrData {

// Text
export interface IText extends ITextStyleAttrData, IUI {
export interface IText extends ITextAttrData, ITextStyleAttrData, IUI {
__: ITextData
text?: string
padding?: IFourNumber
resizeFontSize?: IBoolean
}

@@ -209,5 +278,4 @@ interface ITextAttrData {

// Image
export interface IImage extends IRect, ILeaferImageConfig {
export interface IImage extends IImageAttrData, IRect {
__: IImageData
url: string
ready: boolean

@@ -224,6 +292,4 @@ image?: ILeaferImage

export interface ICanvas extends IRect {
export interface ICanvas extends ICanvasAttrData, IRect {
__: ICanvasData
smooth?: boolean
contextSettings?: ICanvasContext2DSettings
canvas?: ILeaferCanvas

@@ -271,17 +337,14 @@ context?: ICanvasContext2D

// Box
export interface IBox extends IGroup {
export interface IBox extends IBoxAttrData, IGroup {
__: IBoxData
resizeChildren?: IBoolean
overflow?: IOverflow
__updateRectRenderBounds(): void
__renderGroup(canvas: ILeaferCanvas, options: IRenderOptions): void
}
export interface IBoxData extends IGroupData {
resizeChildren?: boolean
interface IBoxAttrData {
overflow?: IOverflow
resizeChildren?: IBoolean
}
export interface IBoxInputData extends IGroupInputData {
resizeChildren?: boolean
overflow?: IOverflow
}
export interface IBoxData extends IBoxAttrData, IGroupData { }
export interface IBoxInputData extends IBoxAttrData, IGroupInputData { }

@@ -307,3 +370,3 @@

// UI
export interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
export interface IUI extends IUIAttrData, IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf {
__: IUIData

@@ -320,8 +383,4 @@

normalStyle?: IUIInputData
hoverStyle?: IUIInputData
pressStyle?: IUIInputData
focusStyle?: IUIInputData
selectedStyle?: IUIInputData
disabledStyle?: IUIInputData
animation?: IAnimation
animationOut?: IAnimation

@@ -334,2 +393,4 @@ editConfig?: IEditorConfig

__animate?: IAnimate
readonly pen: IPathCreator

@@ -339,3 +400,3 @@

set(data: IUIInputData): void
set(data: IUIInputData, isTemp?: boolean): void
toJSON(options?: IJSONOptions): IUIJSONData

@@ -360,6 +421,40 @@

animate(keyframe?: IUIInputData | IKeyframe[] | IAnimation, options?: ITransition, type?: IAnimateType, isTemp?: boolean): IAnimate
killAnimate(type?: IAnimateType): void
export(filename: string, options?: IExportOptions | number | boolean): Promise<IExportResult>
clone(): IUI
clone(newData?: IUIInputData): IUI
}
export interface IStateStyle extends IUIInputData {
}
export interface IStates {
[name: string]: IStateStyle
}
export type IStateName = string
interface IUIAttrData {
animation?: IAnimation
animationOut?: IAnimation
transition?: ITransition
transitionOut?: ITransition
states?: IStates
state?: IStateName
hoverStyle?: IStateStyle
pressStyle?: IStateStyle
focusStyle?: IStateStyle
selectedStyle?: IStateStyle
disabledStyle?: IStateStyle
}
export interface IFindUIMethod {

@@ -369,13 +464,6 @@ (leaf: IUI, options?: any): IAnswer

export interface IUIData extends IUIComputedData, ILeafData {
export interface IUIData extends IUIAttrData, IUIComputedData, ILeafData {
padding?: number | number[]
readonly scale: number | IPointData
normalStyle?: IUIInputData
hoverStyle?: IUIInputData
pressStyle?: IUIInputData
focusStyle?: IUIInputData
selectedStyle?: IUIInputData
disabledStyle?: IUIInputData
// 非数据属性, 自动计算的缓存数据

@@ -408,18 +496,8 @@ __isFills?: boolean

__computePaint(): void
}
export interface IUIComputedData extends IUIAttrData, IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
}
export interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
padding?: number | number[]
}
export interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
padding?: number | number[]
normalStyle?: IUIInputData
hoverStyle?: IUIInputData
pressStyle?: IUIInputData
focusStyle?: IUIInputData
selectedStyle?: IUIInputData
disabledStyle?: IUIInputData
export interface IUIBaseInputData extends IUIAttrData, IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
children?: IUIInputData[]

@@ -445,5 +523,9 @@ }

| 'Box'
| 'Arrow'
| 'Robot'
| 'GIF'
| 'Video'
export interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IUIBaseInputData, IObject {
export interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IArrowInputData, IGIFInputData, IVideoInputData, IRobotInputData, IUIBaseInputData, IObject {
children?: IUIInputData[]

@@ -450,0 +532,0 @@ }

@@ -1,5 +0,6 @@

import { IColor } from '../type/IType'
import { IColor, IRGBA } from '../type/IType'
export interface IColorConvertModule {
string(color: IColor, opacity?: number): string
object(color: IColor, opacity?: number): IRGBA
}

@@ -1,11 +0,25 @@

import { ILeaf, IStateStyleType } from '@leafer/interface'
import { ILeaf, IBoolean, IString, IObject, IStateName, IStateStyle } from '@leafer-ui/interface'
export interface IStateModule {
isHover(leaf: ILeaf): boolean
isPress(leaf: ILeaf): boolean
isFocus(leaf: ILeaf): boolean
isDrag(leaf: ILeaf): boolean
setStyle(leaf: ILeaf, stateType: IStateStyleType, value: boolean): void
canAnimate: boolean
animateExcludes: IObject // 动画中排除的状态属性
isState(state: IStateName, leaf: ILeaf, button?: ILeaf | boolean): boolean
isSelected(leaf: ILeaf, button?: ILeaf | boolean): boolean
isDisabled(leaf: ILeaf, button?: ILeaf | boolean): boolean
isFocus(leaf: ILeaf, button?: ILeaf | boolean): boolean
isHover(leaf: ILeaf, button?: ILeaf | boolean): boolean
isPress(leaf: ILeaf, button?: ILeaf | boolean): boolean
isDrag(leaf: ILeaf, button?: boolean | ILeaf): boolean
setStyleName(leaf: ILeaf, styleName: IString, value: IBoolean): void
set(leaf: ILeaf, stateName: IString): void
getStyle(leaf: ILeaf): IStateStyle
updateStyle(leaf: ILeaf, style?: IStateStyle, type?: 'in' | 'out'): void
updateEventStyle(leaf: ILeaf, eventType: string): void
}

@@ -89,3 +89,3 @@ import { IPointData, IPathCommandData, IWindingRule, IBlendMode, IExportFileType, ISizeData, IFourNumber, IAlign, IUnitPointData } from '@leafer/interface'

}
export type IImagePaintMode = 'normal' | 'cover' | 'fit' | 'strench' | 'clip' | 'repeat'
export type IImagePaintMode = 'normal' | 'cover' | 'fit' | 'stretch' | 'clip' | 'repeat'
export type IRepeat = boolean | 'x' | 'y'

@@ -92,0 +92,0 @@

@@ -1,4 +0,4 @@

import { IAlign, IUnitPointData, IExportFileType, IFourNumber, IPointData, ISizeData, IPathCommandData, IWindingRule, IBlendMode, IMatrixData, ILeaferImage, ITaskItem, IBoolean, INumber, IString, IUnitData, IPathCreator, IBoundsData as IBoundsData$1, ILeaferImageConfig, ICanvasContext2DSettings, ILeaferCanvas, ICanvasContext2D, IRenderOptions, IPickOptions, IPickResult, ILeaf as ILeaf$1, IJSONOptions, IValue, IFindCondition, IPathString, IPathDrawer, IExportOptions, IExportResult, IAnswer, ILeafData, ILeafComputedData, ILeafInputData, IObject as IObject$1, ILeaferAttrData, IControl, ILeaferConfig, ILeaferType, ILeafRender, ILeafBounds, ILeafHit, IStateStyleType, ICachedLeaf, IBooleanMap, IAround } from '@leafer/interface';
import { IBlendMode, IAlign, IUnitPointData, IExportFileType, IFourNumber, IPointData, ISizeData, IPathCommandData, IWindingRule, IMatrixData, ILeaferImage, ITaskItem, IBoolean, INumber, IString, IUnitData, IObject, IEventer, IEventMap, IPercentData, IBoundsData as IBoundsData$1, IPathCreator, ILeaferCanvas, ICanvasContext2D, ICanvasContext2DSettings, IRenderOptions, IPickOptions, IPickResult, ILeaf as ILeaf$1, IJSONOptions, IValue, IFindCondition, IPathString, IPathDrawer, IExportOptions, IExportResult, IAnswer, ILeafData, ILeafComputedData, ILeafInputData, ILeaferAttrData, IControl, ILeaferConfig, ILeaferType, ILeafRender, ILeafBounds, ILeafHit, ICachedLeaf, IBooleanMap, IAround } from '@leafer/interface';
export * from '@leafer/interface';
import { IGroup as IGroup$1, ISelectorProxy, IUI as IUI$1, ILeafList, IObject, ILeaf, IEditSize, IDragEvent, IZoomEvent, IRotateEvent, IGroupInputData as IGroupInputData$1, IStroke as IStroke$1, IFill as IFill$1, IBoxInputData as IBoxInputData$1, IRectInputData as IRectInputData$1, IColorString as IColorString$1, IDirection4, ICursorType, IImageCursor, IAlign as IAlign$1, IUnitPointData as IUnitPointData$1, IUIInputData as IUIInputData$1, IBox as IBox$1, IRect as IRect$1, IBoundsData, IKeyEvent } from '@leafer-ui/interface';
import { IGroup as IGroup$1, ISelectorProxy, IUI as IUI$1, ILeafList, IObject as IObject$1, ILeaf, IEditSize, IDragEvent, IZoomEvent, IRotateEvent, IGroupInputData as IGroupInputData$1, IStroke as IStroke$1, IFill as IFill$1, IBoxInputData as IBoxInputData$1, IRectInputData as IRectInputData$1, IColorString as IColorString$1, IDirection4, ICursorType, IImageCursor, IAlign as IAlign$1, IUnitPointData as IUnitPointData$1, IUIInputData as IUIInputData$1, IBox as IBox$1, IRect as IRect$1, IBoundsData, IKeyEvent, IStateName as IStateName$1, IString as IString$1, IBoolean as IBoolean$1, IStateStyle as IStateStyle$1 } from '@leafer-ui/interface';

@@ -77,3 +77,3 @@ type IPercent = string;

}
type IImagePaintMode = 'normal' | 'cover' | 'fit' | 'strench' | 'clip' | 'repeat';
type IImagePaintMode = 'normal' | 'cover' | 'fit' | 'stretch' | 'clip' | 'repeat';
type IRepeat = boolean | 'x' | 'y';

@@ -307,2 +307,101 @@ type IStrokeAlign = 'inside' | 'outside' | 'center';

type IAnimation = IStyleAnimation | IKeyframesAnimation;
type ITransition = IAnimateOptions | IAnimateEasingName | number | boolean;
type IAnimateType = 'all' | 'animation' | 'transition' | 'animate';
interface IStyleAnimation extends IAnimateOptions {
style: IUIInputData;
}
interface IKeyframesAnimation extends IAnimateOptions {
keyframes: IKeyframe[];
}
interface IAnimateOptions {
easing?: IAnimateEasing;
delay?: number;
duration?: number;
ending?: IAnimateEnding;
reverse?: boolean;
swing?: boolean;
loop?: boolean | number;
loopDelay?: number;
speed?: number;
join?: boolean;
autoplay?: boolean;
attrs?: string[];
event?: IAnimateEvents;
}
type IKeyframe = IUIInputData | IAnimateKeyframe;
type IKeyframeId = number;
interface IAnimateKeyframe {
style: IUIInputData;
easing?: IAnimateEasing;
delay?: number;
duration?: number;
autoDelay?: number;
autoDuration?: number;
}
interface IComputedKeyframe {
style: IUIInputData;
beforeStyle: IUIInputData;
betweenStyle?: IUIInputData;
easingFn?: IAnimateEasingFunction;
delay?: number;
duration?: number;
autoDelay?: number;
autoDuration?: number;
totalTime?: number;
}
interface IAnimateEasingFunction {
(t: number): number;
}
interface ICustomEasingFunction {
(...arg: any): IAnimateEasingFunction;
}
type IAnimateEasing = IAnimateEasingName | ICubicBezierEasing | IStepsEasing | IObject;
interface ICubicBezierEasing {
name: 'cubic-bezier';
value: [number, number, number, number];
}
interface IStepsEasing {
name: 'steps';
value: number | [number, 'floor' | 'round' | 'ceil'];
}
type IAnimateEasingName = 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'sine-in' | 'sine-out' | 'sine-in-out' | 'quad-in' | 'quad-out' | 'quad-in-out' | 'cubic-in' | 'cubic-out' | 'cubic-in-out' | 'quart-in' | 'quart-out' | 'quart-in-out' | 'quint-in' | 'quint-out' | 'quint-in-out' | 'expo-in' | 'expo-out' | 'expo-in-out' | 'circ-in' | 'circ-out' | 'circ-in-out' | 'back-in' | 'back-out' | 'back-in-out' | 'elastic-in' | 'elastic-out' | 'elastic-in-out' | 'bounce-in' | 'bounce-out' | 'bounce-in-out';
type IAnimateEnding = 'auto' | 'from' | 'to';
interface IAnimateEvents {
created?: IAnimateEventFunction;
play?: IAnimateEventFunction;
pause?: IAnimateEventFunction;
stop?: IAnimateEventFunction;
seek?: IAnimateEventFunction;
update?: IAnimateEventFunction;
completed?: IAnimateEventFunction;
}
interface IAnimateEventFunction {
(animate?: IAnimate): any;
}
interface IAnimate extends IAnimateOptions, IEventer {
target: IUI;
keyframes: IKeyframe[];
config?: IAnimateOptions;
event?: IEventMap;
readonly frames: IComputedKeyframe[];
readonly fromStyle: IUIInputData;
readonly toStyle: IUIInputData;
readonly endingStyle: IUIInputData;
readonly started: boolean;
readonly running: boolean;
readonly completed: boolean;
readonly destroyed: boolean;
readonly time: number;
readonly looped: number;
readonly realEnding: IAnimateEnding;
init(target: IUI, keyframe: IUIInputData | IKeyframe[], options?: ITransition, isTemp?: boolean): void;
play(): void;
pause(): void;
stop(): void;
seek(time: number | IPercentData): void;
kill(): void;
destroy(complete?: boolean): void;
}
interface IEditorBase extends IGroup$1, ISelectorProxy {

@@ -327,4 +426,4 @@ config: IEditorConfig;

editBox: IEditBoxBase;
editTool?: IObject;
innerEditor?: IObject;
editTool?: IObject$1;
innerEditor?: IObject$1;
select(target: IUI$1 | IUI$1[]): void;

@@ -438,7 +537,4 @@ cancel(): void;

interface ILine extends IUI {
interface ILine extends ILineAttrData, IUI {
__: ILineData;
toPoint?: IPointData;
points?: number[];
curve?: boolean | number;
}

@@ -472,2 +568,66 @@ interface ILineAttrData {

}
interface IVideo extends IPlayerMethods, IRect {
__: IVideoData;
}
interface IPlayerMethods {
play(): void;
pause(): void;
stop(): void;
}
interface IVideoAttrData {
url?: string;
}
interface IVideoData extends IVideoAttrData, IRectData {
}
interface IVideoInputData extends IVideoAttrData, IRectInputData {
}
interface IGIF extends IPlayerMethods, IRect {
__: IGIFData;
}
interface IGIFAttrData {
url?: string;
}
interface IGIFData extends IGIFAttrData, IRectData {
}
interface IGIFInputData extends IGIFAttrData, IRectInputData {
}
interface IRobot extends IRobotAttrData, IPlayerMethods, IRect {
__: IRobotData;
readonly running: boolean;
readonly nowFrame?: IRobotComputedKeyframe;
readonly robotFrames?: IRobotComputedKeyframe[];
__updateRobot(): void;
__updateAction(): void;
}
interface IRobotAttrData {
robot?: IRobotKeyframe | IRobotKeyframe[];
actions?: IRobotActions;
action?: IRobotActionName;
now?: number;
FPS?: number;
loop?: boolean;
}
interface IRobotActions {
[name: string]: IKeyframeId | IKeyframeId[] | IRobotAnimation;
}
interface IRobotAnimation {
keys: IKeyframeId[];
loop?: boolean | number;
speed?: number;
}
type IRobotActionName = string;
interface IRobotKeyframe {
mode?: 'normal' | 'clip';
url: string;
offset?: IPointData;
size?: number | ISizeData;
total?: number;
}
interface IRobotComputedKeyframe extends IBoundsData$1 {
view: any;
}
interface IRobotData extends IRobotAttrData, IRectData {
}
interface IRobotInputData extends IRobotAttrData, IRectInputData {
}
interface IRect extends IUI {

@@ -480,7 +640,4 @@ __: IRectData;

}
interface IEllipse extends IUI {
interface IEllipse extends IUI, IEllipseAttrData {
__: IEllipseData;
startAngle?: number;
endAngle?: number;
innerRadius?: number;
}

@@ -496,7 +653,4 @@ interface IEllipseAttrData {

}
interface IPolygon extends IUI {
interface IPolygon extends IPolygonAttrData, IUI {
__: IPolygonData;
sides?: number;
points?: number[];
curve?: boolean | number;
}

@@ -512,6 +666,4 @@ interface IPolygonAttrData {

}
interface IStar extends IUI {
interface IStar extends IStarAttrData, IUI {
__: IStarData;
corners?: number;
innerRadius?: number;
}

@@ -544,7 +696,4 @@ interface IStarAttrData {

}
interface IText extends ITextStyleAttrData, IUI {
interface IText extends ITextAttrData, ITextStyleAttrData, IUI {
__: ITextData;
text?: string;
padding?: IFourNumber;
resizeFontSize?: IBoolean;
}

@@ -604,5 +753,4 @@ interface ITextAttrData {

}
interface IImage extends IRect, ILeaferImageConfig {
interface IImage extends IImageAttrData, IRect {
__: IImageData;
url: string;
ready: boolean;

@@ -619,6 +767,4 @@ image?: ILeaferImage;

}
interface ICanvas extends IRect {
interface ICanvas extends ICanvasAttrData, IRect {
__: ICanvasData;
smooth?: boolean;
contextSettings?: ICanvasContext2DSettings;
canvas?: ILeaferCanvas;

@@ -652,17 +798,15 @@ context?: ICanvasContext2D;

}
interface IBox extends IGroup {
interface IBox extends IBoxAttrData, IGroup {
__: IBoxData;
resizeChildren?: IBoolean;
overflow?: IOverflow;
__updateRectRenderBounds(): void;
__renderGroup(canvas: ILeaferCanvas, options: IRenderOptions): void;
}
interface IBoxData extends IGroupData {
resizeChildren?: boolean;
interface IBoxAttrData {
overflow?: IOverflow;
resizeChildren?: IBoolean;
}
interface IBoxInputData extends IGroupInputData {
resizeChildren?: boolean;
overflow?: IOverflow;
interface IBoxData extends IBoxAttrData, IGroupData {
}
interface IBoxInputData extends IBoxAttrData, IGroupInputData {
}
interface IGroup extends IUI {

@@ -685,3 +829,3 @@ __: IGroupData;

}
interface IUI extends IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf$1 {
interface IUI extends IUIAttrData, IFillAttrData, IStrokeAttrData, ICornerRadiusAttrData, IEffectAttrData, ILeaf$1 {
__: IUIData;

@@ -695,8 +839,4 @@ readonly app: ILeafer;

__proxyData?: IUIInputData;
normalStyle?: IUIInputData;
hoverStyle?: IUIInputData;
pressStyle?: IUIInputData;
focusStyle?: IUIInputData;
selectedStyle?: IUIInputData;
disabledStyle?: IUIInputData;
animation?: IAnimation;
animationOut?: IAnimation;
editConfig?: IEditorConfig;

@@ -706,5 +846,6 @@ editOuter: string;

children?: IUI[];
__animate?: IAnimate;
readonly pen: IPathCreator;
reset(data?: IUIInputData): void;
set(data: IUIInputData): void;
set(data: IUIInputData, isTemp?: boolean): void;
toJSON(options?: IJSONOptions): IUIJSONData;

@@ -723,16 +864,31 @@ get(name?: string | string[] | IUIInputData): IUIInputData | IValue;

__drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void;
animate(keyframe?: IUIInputData | IKeyframe[] | IAnimation, options?: ITransition, type?: IAnimateType, isTemp?: boolean): IAnimate;
killAnimate(type?: IAnimateType): void;
export(filename: string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
clone(): IUI;
clone(newData?: IUIInputData): IUI;
}
interface IStateStyle extends IUIInputData {
}
interface IStates {
[name: string]: IStateStyle;
}
type IStateName = string;
interface IUIAttrData {
animation?: IAnimation;
animationOut?: IAnimation;
transition?: ITransition;
transitionOut?: ITransition;
states?: IStates;
state?: IStateName;
hoverStyle?: IStateStyle;
pressStyle?: IStateStyle;
focusStyle?: IStateStyle;
selectedStyle?: IStateStyle;
disabledStyle?: IStateStyle;
}
interface IFindUIMethod {
(leaf: IUI, options?: any): IAnswer;
}
interface IUIData extends IUIComputedData, ILeafData {
padding?: number | number[];
normalStyle?: IUIInputData;
hoverStyle?: IUIInputData;
pressStyle?: IUIInputData;
focusStyle?: IUIInputData;
selectedStyle?: IUIInputData;
disabledStyle?: IUIInputData;
interface IUIData extends IUIAttrData, IUIComputedData, ILeafData {
readonly scale: number | IPointData;
__isFills?: boolean;

@@ -756,17 +912,9 @@ __isStrokes?: boolean;

}
interface IUIComputedData extends IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
padding?: number | number[];
interface IUIComputedData extends IUIAttrData, IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
}
interface IUIBaseInputData extends IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
padding?: number | number[];
normalStyle?: IUIInputData;
hoverStyle?: IUIInputData;
pressStyle?: IUIInputData;
focusStyle?: IUIInputData;
selectedStyle?: IUIInputData;
disabledStyle?: IUIInputData;
interface IUIBaseInputData extends IUIAttrData, IFillInputData, IStrokeInputData, ITextStyleInputData, ICornerRadiusInputData, IEffectInputData, ILeafInputData {
children?: IUIInputData[];
}
type IUITag = 'App' | 'Leafer' | 'Rect' | 'Ellipse' | 'Polygon' | 'Star' | 'Line' | 'Path' | 'Pen' | 'Text' | 'Image' | 'Canvas' | 'Group' | 'Frame' | 'Box';
interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IUIBaseInputData, IObject$1 {
type IUITag = 'App' | 'Leafer' | 'Rect' | 'Ellipse' | 'Polygon' | 'Star' | 'Line' | 'Path' | 'Pen' | 'Text' | 'Image' | 'Canvas' | 'Group' | 'Frame' | 'Box' | 'Arrow' | 'Robot' | 'GIF' | 'Video';
interface IUIInputData extends IRectInputData, IEllipseInputData, IPolygonInputData, IStarInputData, ILineInputData, IPathInputData, ITextInputData, IImageInputData, IGroupInputData, IFrameInputData, IArrowInputData, IGIFInputData, IVideoInputData, IRobotInputData, IUIBaseInputData, IObject {
children?: IUIInputData[];

@@ -835,2 +983,18 @@ }

interface ITransitionModule {
list: ITransitionMap;
register(attrName: string, fn: ITransitionFunction): void;
get(attrName: string): ITransitionFunction;
value(from: any, to: any, t: number, target?: IObject): any;
number(from: number, to: number, t: number, roundValue?: number): number;
color(from: IColor, to: IColor, t: number): string;
gradient(from: IGradientPaint, to: IGradientPaint, t: number, target: IObject): IGradientPaint;
}
interface ITransitionMap {
[name: string]: ITransitionFunction;
}
interface ITransitionFunction {
(from: any, to: any, t: number, target?: any): any;
}
interface ITextConvertModule {

@@ -842,2 +1006,3 @@ getDrawData(content: string, style: ITextData): ITextDrawData;

string(color: IColor, opacity?: number): string;
object(color: IColor, opacity?: number): IRGBA;
}

@@ -851,8 +1016,16 @@

interface IStateModule {
isHover(leaf: ILeaf$1): boolean;
isPress(leaf: ILeaf$1): boolean;
isFocus(leaf: ILeaf$1): boolean;
isDrag(leaf: ILeaf$1): boolean;
setStyle(leaf: ILeaf$1, stateType: IStateStyleType, value: boolean): void;
updateEventStyle(leaf: ILeaf$1, eventType: string): void;
canAnimate: boolean;
animateExcludes: IObject$1;
isState(state: IStateName$1, leaf: ILeaf, button?: ILeaf | boolean): boolean;
isSelected(leaf: ILeaf, button?: ILeaf | boolean): boolean;
isDisabled(leaf: ILeaf, button?: ILeaf | boolean): boolean;
isFocus(leaf: ILeaf, button?: ILeaf | boolean): boolean;
isHover(leaf: ILeaf, button?: ILeaf | boolean): boolean;
isPress(leaf: ILeaf, button?: ILeaf | boolean): boolean;
isDrag(leaf: ILeaf, button?: boolean | ILeaf): boolean;
setStyleName(leaf: ILeaf, styleName: IString$1, value: IBoolean$1): void;
set(leaf: ILeaf, stateName: IString$1): void;
getStyle(leaf: ILeaf): IStateStyle$1;
updateStyle(leaf: ILeaf, style?: IStateStyle$1, type?: 'in' | 'out'): void;
updateEventStyle(leaf: ILeaf, eventType: string): void;
}

@@ -903,2 +1076,2 @@

export type { IApp, IAppConfig, IAppData, IAppInputData, IArrow, IArrowData, IArrowInputData, IArrowType, IBlurEffect, IBox, IBoxData, IBoxInputData, ICachedShape, ICanvas, ICanvasData, ICanvasInputData, IColor, IColorConvertModule, IColorStop, IColorString, ICornerRadiusString, IDashPatternString, IEditBoxBase, IEditPoint, IEditPointInputData, IEditPointType, IEditToolFunction, IEditorBase, IEditorConfig, IEditorConfigFunction, IEffectAttrData, IEffectComputedData, IEffectInputData, IEffectModule, IEllipse, IEllipseData, IEllipseInputData, IExportModule, IFill, IFindUIMethod, IFlow, IFlowData, IFlowInputData, IFontWeight, IFrame, IFrameData, IFrameInputData, IFrameRenderModule, IGradientPaint, IGrayscaleEffect, IGroup, IGroupData, IGroupInputData, IGroupRenderModule, IImage, IImageData, IImageInputData, IImagePaint, IImagePaintMode, IImageRenderModule, ILeafFill, ILeafPaint, ILeafPaintColor, ILeafPaintPatternData, ILeafShadowEffect, ILeafStrokePaint, ILeafer, ILeaferData, ILeaferInputData, ILine, ILineData, ILineInputData, IOverflow, IPaint, IPaintAttr, IPaintGradientModule, IPaintImageModule, IPaintModule, IPaintString, IPath, IPathArrowModule, IPathData, IPathDataArrow, IPathDataArrowMap, IPathInputData, IPen, IPenData, IPenInputData, IPercent, IPolygon, IPolygonData, IPolygonInputData, IRGB, IRGBA, IRect, IRectData, IRectInputData, IRectRenderModule, IRepeat, IShadowEffect, IShadowString, IStar, IStarData, IStarInputData, IStateModule, IStroke, IStrokeAlign, IStrokeAttrData, IStrokeCap, IStrokeComputedData, IStrokeInputData, IStrokeJoin, IStrokeWidthString, IText, ITextAlign, ITextCase, ITextCharData, ITextConvertModule, ITextData, ITextDecoration, ITextDrawData, ITextInputData, ITextRenderModule, ITextRowData, ITextStyleAttrData, ITextStyleComputedData, ITextStyleInputData, ITextWordData, ITextWrap, IUI, IUIBaseInputData, IUIBoundsModule, IUIData, IUIHitModule, IUIInputData, IUIJSONData, IUIRenderModule, IUITag, IVectorPath, IVerticalAlign };
export type { IAnimate, IAnimateEasing, IAnimateEasingFunction, IAnimateEasingName, IAnimateEnding, IAnimateEventFunction, IAnimateEvents, IAnimateKeyframe, IAnimateOptions, IAnimateType, IAnimation, IApp, IAppConfig, IAppData, IAppInputData, IArrow, IArrowData, IArrowInputData, IArrowType, IBlurEffect, IBox, IBoxData, IBoxInputData, ICachedShape, ICanvas, ICanvasData, ICanvasInputData, IColor, IColorConvertModule, IColorStop, IColorString, IComputedKeyframe, ICornerRadiusString, ICubicBezierEasing, ICustomEasingFunction, IDashPatternString, IEditBoxBase, IEditPoint, IEditPointInputData, IEditPointType, IEditToolFunction, IEditorBase, IEditorConfig, IEditorConfigFunction, IEffectAttrData, IEffectComputedData, IEffectInputData, IEffectModule, IEllipse, IEllipseData, IEllipseInputData, IExportModule, IFill, IFindUIMethod, IFlow, IFlowData, IFlowInputData, IFontWeight, IFontWeightNumer, IFontWeightString, IFrame, IFrameData, IFrameInputData, IFrameRenderModule, IGIF, IGIFData, IGIFInputData, IGradientPaint, IGradientType, IGrayscaleEffect, IGroup, IGroupData, IGroupInputData, IGroupRenderModule, IImage, IImageData, IImageFilters, IImageInputData, IImagePaint, IImagePaintMode, IImageRenderModule, IKeyframe, IKeyframeId, IKeyframesAnimation, ILeafFill, ILeafPaint, ILeafPaintColor, ILeafPaintPatternData, ILeafShadowEffect, ILeafStrokePaint, ILeafer, ILeaferData, ILeaferInputData, ILine, ILineData, ILineInputData, IOverflow, IPaint, IPaintAttr, IPaintBase, IPaintGradientModule, IPaintImageModule, IPaintModule, IPaintString, IPaintType, IPath, IPathArrowModule, IPathData, IPathDataArrow, IPathDataArrowMap, IPathDataArrowOffset, IPathInputData, IPen, IPenData, IPenInputData, IPercent, IPolygon, IPolygonData, IPolygonInputData, IRGB, IRGBA, IRect, IRectData, IRectInputData, IRectRenderModule, IRepeat, IRobot, IRobotActionName, IRobotActions, IRobotAnimation, IRobotComputedKeyframe, IRobotData, IRobotInputData, IRobotKeyframe, IShadowEffect, IShadowString, ISolidPaint, IStar, IStarData, IStarInputData, IStateModule, IStateName, IStateStyle, IStates, IStepsEasing, IStroke, IStrokeAlign, IStrokeAttrData, IStrokeCap, IStrokeComputedData, IStrokeInputData, IStrokeJoin, IStrokeWidthString, IStyleAnimation, IText, ITextAlign, ITextCase, ITextCharData, ITextConvertModule, ITextData, ITextDecoration, ITextDrawData, ITextInputData, ITextRenderModule, ITextRowData, ITextStyleAttrData, ITextStyleComputedData, ITextStyleInputData, ITextWordData, ITextWrap, ITransition, ITransitionFunction, ITransitionMap, ITransitionModule, IUI, IUIBaseInputData, IUIBoundsModule, IUIData, IUIHitModule, IUIInputData, IUIJSONData, IUIRenderModule, IUITag, IVectorPath, IVerticalAlign, IVideo, IVideoData, IVideoInputData };