@leafer/event 1.0.0-alpha.7 → 1.0.0-bate
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 +3 -3
- package/src/ChildEvent.ts +0 -2
- package/src/Event.ts +0 -1
- package/src/ImageEvent.ts +24 -0
- package/src/LayoutEvent.ts +12 -8
- package/src/LeaferEvent.ts +22 -0
- package/src/{AttrEvent.ts → PropertyEvent.ts} +3 -5
- package/src/RenderEvent.ts +17 -7
- package/src/ResizeEvent.ts +0 -2
- package/src/TransformEvent.ts +5 -7
- package/src/WatchEvent.ts +0 -2
- package/src/index.ts +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/event",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-bate",
|
|
4
4
|
"description": "@leafer/event",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"leaferjs"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@leafer/decorator": "1.0.0-
|
|
22
|
+
"@leafer/decorator": "1.0.0-bate"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@leafer/interface": "1.0.0-
|
|
25
|
+
"@leafer/interface": "1.0.0-bate"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/src/ChildEvent.ts
CHANGED
package/src/Event.ts
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IImageEvent, IObject, IEventTarget, ILeaferImage } from '@leafer/interface'
|
|
2
|
+
|
|
3
|
+
import { Event } from './Event'
|
|
4
|
+
|
|
5
|
+
export class ImageEvent extends Event implements IImageEvent {
|
|
6
|
+
|
|
7
|
+
static LOADED = 'image.loaded'
|
|
8
|
+
static ERROR = 'image.error'
|
|
9
|
+
|
|
10
|
+
readonly image: ILeaferImage
|
|
11
|
+
readonly error: string | IObject
|
|
12
|
+
|
|
13
|
+
readonly attrName?: string
|
|
14
|
+
readonly attrValue?: IObject
|
|
15
|
+
|
|
16
|
+
constructor(type: string, target: IEventTarget, image: ILeaferImage, attrName?: string, attrValue?: IObject, error?: string | IObject) {
|
|
17
|
+
super(type, target)
|
|
18
|
+
this.image = image
|
|
19
|
+
this.attrName = attrName
|
|
20
|
+
this.attrValue = attrValue
|
|
21
|
+
if (error) this.error = error
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
package/src/LayoutEvent.ts
CHANGED
|
@@ -1,30 +1,34 @@
|
|
|
1
1
|
import { ILayoutEvent, ILayoutBlockData } from '@leafer/interface'
|
|
2
|
-
import { registerEvent } from '@leafer/decorator'
|
|
3
2
|
|
|
4
3
|
import { Event } from './Event'
|
|
5
4
|
|
|
6
5
|
|
|
7
|
-
@registerEvent()
|
|
8
6
|
export class LayoutEvent extends Event implements ILayoutEvent {
|
|
9
7
|
|
|
8
|
+
static CHECK_UPDATE = 'layout.check_update'
|
|
9
|
+
|
|
10
10
|
static REQUEST = 'layout.request'
|
|
11
11
|
|
|
12
12
|
static START = 'layout.start'
|
|
13
13
|
|
|
14
|
-
static
|
|
15
|
-
static
|
|
16
|
-
static
|
|
14
|
+
static BEFORE = 'layout.before'
|
|
15
|
+
static LAYOUT = 'layout.layout'
|
|
16
|
+
static AFTER = 'layout.after'
|
|
17
17
|
|
|
18
18
|
static AGAIN = 'layout.again'
|
|
19
19
|
|
|
20
|
-
static LAYOUT = 'layout'
|
|
21
20
|
static END = 'layout.end'
|
|
22
21
|
|
|
23
22
|
readonly data: ILayoutBlockData[]
|
|
23
|
+
readonly times: number
|
|
24
24
|
|
|
25
|
-
constructor(type: string, data?: ILayoutBlockData[]) {
|
|
25
|
+
constructor(type: string, data?: ILayoutBlockData[], times?: number) {
|
|
26
26
|
super(type)
|
|
27
|
-
if (data)
|
|
27
|
+
if (data) {
|
|
28
|
+
this.data = data
|
|
29
|
+
this.times = times
|
|
30
|
+
}
|
|
31
|
+
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ILeaferEvent } from '@leafer/interface'
|
|
2
|
+
|
|
3
|
+
import { Event } from './Event'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export class LeaferEvent extends Event implements ILeaferEvent {
|
|
7
|
+
|
|
8
|
+
static START = 'leafer.start'
|
|
9
|
+
|
|
10
|
+
static BEFORE_READY = 'leafer.before_ready'
|
|
11
|
+
static READY = 'leafer.ready'
|
|
12
|
+
static AFTER_READY = 'leafer.after_ready'
|
|
13
|
+
|
|
14
|
+
static VIEW_READY = 'leafer.view_ready'
|
|
15
|
+
|
|
16
|
+
static STOP = 'leafer.stop'
|
|
17
|
+
static RESTART = 'leafer.restart'
|
|
18
|
+
|
|
19
|
+
static END = 'leafer.end'
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { registerEvent } from '@leafer/decorator'
|
|
1
|
+
import { IPropertyEvent, IEventTarget } from '@leafer/interface'
|
|
3
2
|
|
|
4
3
|
import { Event } from './Event'
|
|
5
4
|
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
export class AttrEvent extends Event implements IAttrEvent {
|
|
6
|
+
export class PropertyEvent extends Event implements IPropertyEvent {
|
|
9
7
|
|
|
10
|
-
static CHANGE = '
|
|
8
|
+
static CHANGE = 'property.change'
|
|
11
9
|
|
|
12
10
|
readonly attrName: string
|
|
13
11
|
readonly oldValue: unknown
|
package/src/RenderEvent.ts
CHANGED
|
@@ -1,23 +1,33 @@
|
|
|
1
|
-
import { IRenderEvent } from '@leafer/interface'
|
|
2
|
-
import { registerEvent } from '@leafer/decorator'
|
|
1
|
+
import { IBounds, IRenderEvent, IRenderOptions } from '@leafer/interface'
|
|
3
2
|
|
|
4
3
|
import { Event } from './Event'
|
|
5
4
|
|
|
6
5
|
|
|
7
|
-
@registerEvent()
|
|
8
6
|
export class RenderEvent extends Event implements IRenderEvent {
|
|
9
7
|
|
|
10
8
|
static REQUEST = 'render.request'
|
|
11
9
|
|
|
12
10
|
static START = 'render.start'
|
|
13
11
|
|
|
14
|
-
static
|
|
15
|
-
static
|
|
16
|
-
static
|
|
12
|
+
static BEFORE = 'render.before'
|
|
13
|
+
static RENDER = 'render'
|
|
14
|
+
static AFTER = 'render.after'
|
|
17
15
|
|
|
18
16
|
static AGAIN = 'render.again'
|
|
19
17
|
|
|
20
|
-
static RENDER = 'render'
|
|
21
18
|
static END = 'render.end'
|
|
22
19
|
|
|
20
|
+
readonly renderBounds: IBounds
|
|
21
|
+
readonly renderOptions: IRenderOptions
|
|
22
|
+
readonly times: number
|
|
23
|
+
|
|
24
|
+
constructor(type: string, times?: number, bounds?: IBounds, options?: IRenderOptions) {
|
|
25
|
+
super(type)
|
|
26
|
+
if (times) this.times = times
|
|
27
|
+
if (bounds) {
|
|
28
|
+
this.renderBounds = bounds
|
|
29
|
+
this.renderOptions = options
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
23
33
|
}
|
package/src/ResizeEvent.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { IResizeEvent, IScreenSizeData } from '@leafer/interface'
|
|
2
|
-
import { registerEvent } from '@leafer/decorator'
|
|
3
2
|
|
|
4
3
|
import { Event } from './Event'
|
|
5
4
|
|
|
6
5
|
|
|
7
|
-
@registerEvent()
|
|
8
6
|
export class ResizeEvent extends Event implements IResizeEvent {
|
|
9
7
|
|
|
10
8
|
static RESIZE: string = 'resize'
|
package/src/TransformEvent.ts
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { ITransformEvent, ITransformEventData } from '@leafer/interface'
|
|
2
|
-
import { registerEvent } from '@leafer/decorator'
|
|
3
2
|
|
|
4
3
|
import { Event } from './Event'
|
|
5
4
|
|
|
6
5
|
|
|
7
|
-
@registerEvent()
|
|
8
6
|
export class TransformEvent extends Event implements ITransformEvent {
|
|
9
7
|
|
|
10
|
-
static
|
|
8
|
+
static START = 'transform.start'
|
|
11
9
|
static CHANGE = 'transform.change'
|
|
12
|
-
static
|
|
10
|
+
static END = 'transform.end'
|
|
13
11
|
|
|
14
|
-
static
|
|
15
|
-
static
|
|
16
|
-
static
|
|
12
|
+
static BEFORE_START = 'transform.before_start'
|
|
13
|
+
static BEFORE_CHANGE = 'transform.before_change'
|
|
14
|
+
static BEFORE_END = 'transform.before_end'
|
|
17
15
|
|
|
18
16
|
readonly x: number
|
|
19
17
|
readonly y: number
|
package/src/WatchEvent.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { IWatchEvent, IWatchEventData } from '@leafer/interface'
|
|
2
|
-
import { registerEvent } from '@leafer/decorator'
|
|
3
2
|
|
|
4
3
|
import { Event } from './Event'
|
|
5
4
|
|
|
6
5
|
|
|
7
|
-
@registerEvent()
|
|
8
6
|
export class WatchEvent extends Event implements IWatchEvent {
|
|
9
7
|
|
|
10
8
|
static REQUEST = 'watch.request'
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export { ChildEvent } from './ChildEvent'
|
|
2
|
-
export {
|
|
2
|
+
export { PropertyEvent } from './PropertyEvent'
|
|
3
|
+
export { ImageEvent } from './ImageEvent'
|
|
3
4
|
export { ResizeEvent } from './ResizeEvent'
|
|
4
5
|
export { TransformEvent } from './TransformEvent'
|
|
5
6
|
export { WatchEvent } from './WatchEvent'
|
|
6
7
|
export { LayoutEvent } from './LayoutEvent'
|
|
7
8
|
export { RenderEvent } from './RenderEvent'
|
|
9
|
+
export { LeaferEvent } from './LeaferEvent'
|
|
8
10
|
|
|
9
11
|
export { Event } from './Event'
|
|
10
12
|
|