@leafer/event 1.0.0-rc.1 → 1.0.0-rc.10

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/event",
3
- "version": "1.0.0-rc.1",
3
+ "version": "1.0.0-rc.10",
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.1"
25
+ "@leafer/decorator": "1.0.0-rc.10",
26
+ "@leafer/platform": "1.0.0-rc.10"
26
27
  },
27
28
  "devDependencies": {
28
- "@leafer/interface": "1.0.0-rc.1"
29
+ "@leafer/interface": "1.0.0-rc.10"
29
30
  }
30
31
  }
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
  }
@@ -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.layout'
15
+ static LAYOUT = 'layout'
16
16
  static AFTER = 'layout.after'
17
17
 
18
18
  static AGAIN = 'layout.again'
@@ -6,6 +6,7 @@ import { Event } from './Event'
6
6
  export class PropertyEvent extends Event implements IPropertyEvent {
7
7
 
8
8
  static CHANGE = 'property.change'
9
+ static LEAFER_CHANGE = 'property.leafer_change'
9
10
 
10
11
  readonly attrName: string
11
12
  readonly oldValue: unknown
@@ -17,6 +17,8 @@ export class RenderEvent extends Event implements IRenderEvent {
17
17
 
18
18
  static END = 'render.end'
19
19
 
20
+ static NEXT = 'render.next'
21
+
20
22
  readonly renderBounds: IBounds
21
23
  readonly renderOptions: IRenderOptions
22
24
  readonly times: number
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, IObject, IResizeEvent, IScreenSizeData, ITransformEvent, ITransformEventData, IWatchEvent, IWatchEventData, ILayoutEvent, ILayoutBlockData, IAnimateEvent, IRenderEvent, IBounds, IRenderOptions, ILeaferEvent } from '@leafer/interface';
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;
@@ -25,6 +26,7 @@ declare class ChildEvent extends Event implements IChildEvent {
25
26
 
26
27
  declare class PropertyEvent extends Event implements IPropertyEvent {
27
28
  static CHANGE: string;
29
+ static LEAFER_CHANGE: string;
28
30
  readonly attrName: string;
29
31
  readonly oldValue: unknown;
30
32
  readonly newValue: unknown;
@@ -54,25 +56,6 @@ declare class ResizeEvent extends Event implements IResizeEvent {
54
56
  constructor(size: IScreenSizeData | string, oldSize?: IScreenSizeData);
55
57
  }
56
58
 
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
59
  declare class WatchEvent extends Event implements IWatchEvent {
77
60
  static REQUEST: string;
78
61
  static DATA: string;
@@ -106,6 +89,7 @@ declare class RenderEvent extends Event implements IRenderEvent {
106
89
  static AFTER: string;
107
90
  static AGAIN: string;
108
91
  static END: string;
92
+ static NEXT: string;
109
93
  readonly renderBounds: IBounds;
110
94
  readonly renderOptions: IRenderOptions;
111
95
  readonly times: number;
@@ -124,4 +108,4 @@ declare class LeaferEvent extends Event implements ILeaferEvent {
124
108
  static END: string;
125
109
  }
126
110
 
127
- export { AnimateEvent, ChildEvent, Event, ImageEvent, LayoutEvent, LeaferEvent, PropertyEvent, RenderEvent, ResizeEvent, TransformEvent, WatchEvent };
111
+ export { AnimateEvent, ChildEvent, Event, ImageEvent, LayoutEvent, LeaferEvent, PropertyEvent, RenderEvent, ResizeEvent, WatchEvent };
@@ -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
- }