@leafer/decorator 1.0.0-alpha.6 → 1.0.0-alpha.9

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/decorator",
3
- "version": "1.0.0-alpha.6",
3
+ "version": "1.0.0-alpha.9",
4
4
  "description": "@leafer/decorator",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -19,10 +19,10 @@
19
19
  "leaferjs"
20
20
  ],
21
21
  "dependencies": {
22
- "@leafer/platform": "1.0.0-alpha.6",
23
- "@leafer/debug": "1.0.0-alpha.6"
22
+ "@leafer/platform": "1.0.0-alpha.9",
23
+ "@leafer/debug": "1.0.0-alpha.9"
24
24
  },
25
25
  "devDependencies": {
26
- "@leafer/interface": "1.0.0-alpha.6"
26
+ "@leafer/interface": "1.0.0-alpha.9"
27
27
  }
28
28
  }
package/src/data.ts CHANGED
@@ -8,7 +8,7 @@ export function aliasType(name: string) {
8
8
  defineKey(target, key, {
9
9
  get() { return this.__get(name) },
10
10
  set(value: __Value) {
11
- this.root ? this.__set(name, value) : this.__[name] = value
11
+ this.__set(name, value)
12
12
  }
13
13
  })
14
14
  }
@@ -19,7 +19,7 @@ export function dataType(defaultValue?: __Value) {
19
19
  defineKey(target, key, {
20
20
  get() { return this.__get(key) },
21
21
  set(value: __Value) {
22
- this.root ? this.__set(key, value) : this.__[key] = value
22
+ this.__set(key, value)
23
23
  }
24
24
  })
25
25
  defineDataProcessor(target, key, defaultValue)
@@ -31,7 +31,7 @@ export function positionType(defaultValue?: __Value) {
31
31
  defineKey(target, key, {
32
32
  get() { return this.__get(key) },
33
33
  set(value: __Value) {
34
- this.root ? this.__set(key, value) : this.__[key] = value
34
+ this.__set(key, value)
35
35
  this.__layout.positionChanged || this.__layout.positionChange()
36
36
  }
37
37
  })
@@ -44,7 +44,7 @@ export function scaleType(defaultValue?: __Value) {
44
44
  defineKey(target, key, {
45
45
  get() { return this.__get(key) },
46
46
  set(value: __Value) {
47
- this.root ? this.__set(key, value) : this.__[key] = value
47
+ this.__set(key, value)
48
48
  this.__layout.scaleChanged || this.__layout.scaleChange()
49
49
  }
50
50
  })
@@ -57,7 +57,7 @@ export function rotationType(defaultValue?: __Value) {
57
57
  defineKey(target, key, {
58
58
  get() { return this.__get(key) },
59
59
  set(value: __Value) {
60
- this.root ? this.__set(key, value) : this.__[key] = value
60
+ this.__set(key, value)
61
61
  this.__layout.rotationChanged || this.__layout.rotationChange()
62
62
 
63
63
  }
@@ -71,7 +71,7 @@ export function boundsType(defaultValue?: __Value) {
71
71
  defineKey(target, key, {
72
72
  get() { return this.__get(key) },
73
73
  set(value: __Value) {
74
- this.root ? this.__set(key, value) : this.__[key] = value
74
+ this.__set(key, value)
75
75
  this.__layout.boxBoundsChanged || this.__layout.boxBoundsChange()
76
76
  }
77
77
  })
@@ -87,7 +87,7 @@ export function affectEventBoundsType(defaultValue?: __Value) {
87
87
  defineKey(target, key, {
88
88
  get() { return this.__get(key) },
89
89
  set(value: __Value) {
90
- this.root ? this.__set(key, value) : this.__[key] = value
90
+ this.__set(key, value)
91
91
  this.__layout.eventBoundsChanged || this.__layout.eventBoundsChange()
92
92
  }
93
93
  })
@@ -100,7 +100,7 @@ export function affectRenderBoundsType(defaultValue?: __Value) {
100
100
  defineKey(target, key, {
101
101
  get() { return this.__get(key) },
102
102
  set(value: __Value) {
103
- this.root ? this.__set(key, value) : this.__[key] = value
103
+ this.__set(key, value)
104
104
  this.__layout.renderBoundsChanged || this.__layout.renderBoundsChange()
105
105
  }
106
106
  })
@@ -113,7 +113,7 @@ export function surfaceType(defaultValue?: __Value) {
113
113
  defineKey(target, key, {
114
114
  get() { return this.__get(key) },
115
115
  set(value: __Value) {
116
- this.root ? this.__set(key, value) : this.__[key] = value
116
+ this.__set(key, value)
117
117
  this.__layout.surfaceChanged || this.__layout.surfaceChange()
118
118
  }
119
119
  })
@@ -139,13 +139,13 @@ export function sortType(defaultValue?: __Value) {
139
139
  defineKey(target, key, {
140
140
  get() { return this.__get(key) },
141
141
  set(value: __Value) {
142
- this.root ? this.__set(key, value) : this.__[key] = value
142
+ this.__set(key, value)
143
143
  this.__layout.surfaceChanged || this.__layout.surfaceChange()
144
144
 
145
145
  if (this.parent) {
146
- this.parent.__layout.childrenSortChanged || (this.parent.__layout.childrenSortChanged = true)
146
+ this.parent.__layout.childrenSortChanged = true
147
147
  } else {
148
- this.__addParentWait(() => { this.parent.__layout.childrenSortChanged || (this.parent.__layout.childrenSortChanged = true) })
148
+ this.__addParentWait(() => { this.parent.__layout.childrenSortChanged = true })
149
149
  }
150
150
  }
151
151
  })
package/src/rewrite.ts CHANGED
@@ -42,16 +42,16 @@ setTimeout(() => doRewrite(true))
42
42
 
43
43
  // class
44
44
 
45
- export function useModule(child: IObject) {
45
+ export function useModule(module: IObject) {
46
46
  return (target: IObject) => {
47
- const names = child.prototype ? getNames(child.prototype) : Object.keys(child)
47
+ const names = module.prototype ? getNames(module.prototype) : Object.keys(module)
48
48
  names.forEach(name => {
49
49
  if (!excludeNames.includes(name)) {
50
- if (child.prototype) {
51
- const d = getDescriptor(child.prototype, name)
52
- if (d.writable) target.prototype[name] = child.prototype[name]
50
+ if (module.prototype) {
51
+ const d = getDescriptor(module.prototype, name)
52
+ if (d.writable) target.prototype[name] = module.prototype[name]
53
53
  } else {
54
- target.prototype[name] = child[name]
54
+ target.prototype[name] = module[name]
55
55
  }
56
56
  }
57
57
  })