@leafer/event 1.0.0-rc.2 → 1.0.0-rc.21
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 +4 -3
- package/src/ChildEvent.ts +1 -0
- package/src/Event.ts +7 -1
- package/src/LayoutEvent.ts +1 -1
- package/src/LeaferEvent.ts +0 -1
- package/src/PropertyEvent.ts +1 -0
- package/src/RenderEvent.ts +2 -0
- package/src/index.ts +0 -1
- package/types/index.d.ts +6 -21
- package/src/TransformEvent.ts +0 -32
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/event",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.21",
|
|
4
4
|
"description": "@leafer/event",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,9 +22,10 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/decorator": "1.0.0-rc.
|
|
25
|
+
"@leafer/decorator": "1.0.0-rc.21",
|
|
26
|
+
"@leafer/platform": "1.0.0-rc.21"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
|
-
"@leafer/interface": "1.0.0-rc.
|
|
29
|
+
"@leafer/interface": "1.0.0-rc.21"
|
|
29
30
|
}
|
|
30
31
|
}
|
package/src/ChildEvent.ts
CHANGED
package/src/Event.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { IEvent, IEventTarget } from '@leafer/interface'
|
|
1
|
+
import { IEvent, IEventTarget, IObject } from '@leafer/interface'
|
|
2
|
+
import { Platform } from '@leafer/platform'
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
export class Event implements IEvent {
|
|
5
6
|
|
|
7
|
+
readonly origin: IObject
|
|
8
|
+
|
|
6
9
|
readonly type: string
|
|
7
10
|
readonly target: IEventTarget
|
|
8
11
|
readonly current: IEventTarget
|
|
@@ -21,14 +24,17 @@ export class Event implements IEvent {
|
|
|
21
24
|
|
|
22
25
|
public stopDefault(): void {
|
|
23
26
|
this.isStopDefault = true
|
|
27
|
+
if (this.origin) Platform.event.stopDefault(this.origin)
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
public stopNow(): void {
|
|
27
31
|
this.isStopNow = true
|
|
28
32
|
this.isStop = true
|
|
33
|
+
if (this.origin) Platform.event.stopNow(this.origin)
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
public stop(): void {
|
|
32
37
|
this.isStop = true
|
|
38
|
+
if (this.origin) Platform.event.stop(this.origin)
|
|
33
39
|
}
|
|
34
40
|
}
|
package/src/LayoutEvent.ts
CHANGED
|
@@ -12,7 +12,7 @@ export class LayoutEvent extends Event implements ILayoutEvent {
|
|
|
12
12
|
static START = 'layout.start'
|
|
13
13
|
|
|
14
14
|
static BEFORE = 'layout.before'
|
|
15
|
-
static LAYOUT = 'layout
|
|
15
|
+
static LAYOUT = 'layout'
|
|
16
16
|
static AFTER = 'layout.after'
|
|
17
17
|
|
|
18
18
|
static AGAIN = 'layout.again'
|
package/src/LeaferEvent.ts
CHANGED
package/src/PropertyEvent.ts
CHANGED
package/src/RenderEvent.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -2,7 +2,6 @@ export { ChildEvent } from './ChildEvent'
|
|
|
2
2
|
export { PropertyEvent } from './PropertyEvent'
|
|
3
3
|
export { ImageEvent } from './ImageEvent'
|
|
4
4
|
export { ResizeEvent } from './ResizeEvent'
|
|
5
|
-
export { TransformEvent } from './TransformEvent'
|
|
6
5
|
export { WatchEvent } from './WatchEvent'
|
|
7
6
|
export { LayoutEvent } from './LayoutEvent'
|
|
8
7
|
export { AnimateEvent } from './AnimateEvent'
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { IEvent, IEventTarget, IChildEvent, ILeaf, IPropertyEvent, IImageEvent, ILeaferImage,
|
|
1
|
+
import { IEvent, IObject, IEventTarget, IChildEvent, ILeaf, IPropertyEvent, IImageEvent, ILeaferImage, IResizeEvent, IScreenSizeData, IWatchEvent, IWatchEventData, ILayoutEvent, ILayoutBlockData, IAnimateEvent, IRenderEvent, IBounds, IRenderOptions, ILeaferEvent } from '@leafer/interface';
|
|
2
2
|
|
|
3
3
|
declare class Event implements IEvent {
|
|
4
|
+
readonly origin: IObject;
|
|
4
5
|
readonly type: string;
|
|
5
6
|
readonly target: IEventTarget;
|
|
6
7
|
readonly current: IEventTarget;
|
|
@@ -18,6 +19,7 @@ declare class Event implements IEvent {
|
|
|
18
19
|
declare class ChildEvent extends Event implements IChildEvent {
|
|
19
20
|
static ADD: string;
|
|
20
21
|
static REMOVE: string;
|
|
22
|
+
static DESTROY: string;
|
|
21
23
|
readonly parent?: ILeaf;
|
|
22
24
|
readonly child?: ILeaf;
|
|
23
25
|
constructor(type: string, child?: ILeaf, parent?: ILeaf);
|
|
@@ -25,6 +27,7 @@ declare class ChildEvent extends Event implements IChildEvent {
|
|
|
25
27
|
|
|
26
28
|
declare class PropertyEvent extends Event implements IPropertyEvent {
|
|
27
29
|
static CHANGE: string;
|
|
30
|
+
static LEAFER_CHANGE: string;
|
|
28
31
|
readonly attrName: string;
|
|
29
32
|
readonly oldValue: unknown;
|
|
30
33
|
readonly newValue: unknown;
|
|
@@ -54,25 +57,6 @@ declare class ResizeEvent extends Event implements IResizeEvent {
|
|
|
54
57
|
constructor(size: IScreenSizeData | string, oldSize?: IScreenSizeData);
|
|
55
58
|
}
|
|
56
59
|
|
|
57
|
-
declare class TransformEvent extends Event implements ITransformEvent {
|
|
58
|
-
static START: string;
|
|
59
|
-
static CHANGE: string;
|
|
60
|
-
static END: string;
|
|
61
|
-
static BEFORE_START: string;
|
|
62
|
-
static BEFORE_CHANGE: string;
|
|
63
|
-
static BEFORE_END: string;
|
|
64
|
-
readonly x: number;
|
|
65
|
-
readonly y: number;
|
|
66
|
-
readonly scaleX: number;
|
|
67
|
-
readonly scaleY: number;
|
|
68
|
-
readonly rotation: number;
|
|
69
|
-
readonly zooming: boolean;
|
|
70
|
-
readonly moving: boolean;
|
|
71
|
-
readonly rotating: boolean;
|
|
72
|
-
readonly changing: boolean;
|
|
73
|
-
constructor(type: string, params?: ITransformEventData);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
60
|
declare class WatchEvent extends Event implements IWatchEvent {
|
|
77
61
|
static REQUEST: string;
|
|
78
62
|
static DATA: string;
|
|
@@ -106,6 +90,7 @@ declare class RenderEvent extends Event implements IRenderEvent {
|
|
|
106
90
|
static AFTER: string;
|
|
107
91
|
static AGAIN: string;
|
|
108
92
|
static END: string;
|
|
93
|
+
static NEXT: string;
|
|
109
94
|
readonly renderBounds: IBounds;
|
|
110
95
|
readonly renderOptions: IRenderOptions;
|
|
111
96
|
readonly times: number;
|
|
@@ -124,4 +109,4 @@ declare class LeaferEvent extends Event implements ILeaferEvent {
|
|
|
124
109
|
static END: string;
|
|
125
110
|
}
|
|
126
111
|
|
|
127
|
-
export { AnimateEvent, ChildEvent, Event, ImageEvent, LayoutEvent, LeaferEvent, PropertyEvent, RenderEvent, ResizeEvent,
|
|
112
|
+
export { AnimateEvent, ChildEvent, Event, ImageEvent, LayoutEvent, LeaferEvent, PropertyEvent, RenderEvent, ResizeEvent, WatchEvent };
|
package/src/TransformEvent.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ITransformEvent, ITransformEventData } from '@leafer/interface'
|
|
2
|
-
|
|
3
|
-
import { Event } from './Event'
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export class TransformEvent extends Event implements ITransformEvent {
|
|
7
|
-
|
|
8
|
-
static START = 'transform.start'
|
|
9
|
-
static CHANGE = 'transform.change'
|
|
10
|
-
static END = 'transform.end'
|
|
11
|
-
|
|
12
|
-
static BEFORE_START = 'transform.before_start'
|
|
13
|
-
static BEFORE_CHANGE = 'transform.before_change'
|
|
14
|
-
static BEFORE_END = 'transform.before_end'
|
|
15
|
-
|
|
16
|
-
readonly x: number
|
|
17
|
-
readonly y: number
|
|
18
|
-
readonly scaleX: number
|
|
19
|
-
readonly scaleY: number
|
|
20
|
-
readonly rotation: number
|
|
21
|
-
|
|
22
|
-
readonly zooming: boolean
|
|
23
|
-
readonly moving: boolean
|
|
24
|
-
readonly rotating: boolean
|
|
25
|
-
readonly changing: boolean
|
|
26
|
-
|
|
27
|
-
constructor(type: string, params?: ITransformEventData) {
|
|
28
|
-
super(type)
|
|
29
|
-
if (params) Object.assign(this, params)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
}
|