@leafer/decorator 1.0.0-beta.9 → 1.0.0-rc.2

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,12 +1,15 @@
1
1
  {
2
2
  "name": "@leafer/decorator",
3
- "version": "1.0.0-beta.9",
3
+ "version": "1.0.0-rc.2",
4
4
  "description": "@leafer/decorator",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
7
7
  "main": "src/index.ts",
8
+ "types": "types/index.d.ts",
8
9
  "files": [
9
- "src"
10
+ "src",
11
+ "types",
12
+ "dist"
10
13
  ],
11
14
  "repository": {
12
15
  "type": "git",
@@ -19,10 +22,10 @@
19
22
  "leaferjs"
20
23
  ],
21
24
  "dependencies": {
22
- "@leafer/platform": "1.0.0-beta.9",
23
- "@leafer/debug": "1.0.0-beta.9"
25
+ "@leafer/platform": "1.0.0-rc.2",
26
+ "@leafer/debug": "1.0.0-rc.2"
24
27
  },
25
28
  "devDependencies": {
26
- "@leafer/interface": "1.0.0-beta.9"
29
+ "@leafer/interface": "1.0.0-rc.2"
27
30
  }
28
31
  }
package/src/data.ts CHANGED
@@ -74,6 +74,7 @@ export function boundsType(defaultValue?: __Value) {
74
74
  set(value: __Value) {
75
75
  this.__setAttr(key, value)
76
76
  this.__layout.boxChanged || this.__layout.boxChange()
77
+ if (this.__.around) this.__layout.positionChanged || this.__layout.positionChange()
77
78
  }
78
79
  })
79
80
  }
@@ -134,7 +135,7 @@ export function sortType(defaultValue?: __Value) {
134
135
  set(value: __Value) {
135
136
  this.__setAttr(key, value)
136
137
  this.__layout.surfaceChanged || this.__layout.surfaceChange()
137
- this.waitParent(() => { this.parent.__layout.childrenSortChanged = true })
138
+ this.waitParent(() => { this.parent.__layout.childrenSortChange() })
138
139
  }
139
140
  })
140
141
  }
@@ -169,6 +170,18 @@ export function hitType(defaultValue?: __Value) {
169
170
  set(value: __Value) {
170
171
  this.__setAttr(key, value)
171
172
  if (Debug.showHitView) { this.__layout.surfaceChanged || this.__layout.surfaceChange() }
173
+ if (this.leafer) this.leafer.updateCursor()
174
+ }
175
+ })
176
+ }
177
+ }
178
+
179
+ export function cursorType(defaultValue?: __Value) {
180
+ return (target: ILeaf, key: string) => {
181
+ defineLeafAttr(target, key, defaultValue, {
182
+ set(value: __Value) {
183
+ this.__setAttr(key, value)
184
+ if (this.leafer) this.leafer.updateCursor()
172
185
  }
173
186
  })
174
187
  }
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { aliasType, defineLeafAttr, dataType, positionType, boundsType, affectStrokeBoundsType, strokeType, affectRenderBoundsType, scaleType, rotationType, surfaceType, opacityType, sortType, maskType, eraserType, hitType, pathType, dataProcessor, layoutProcessor, setDefaultValue, defineDataProcessor } from './data'
1
+ export { aliasType, defineLeafAttr, dataType, positionType, boundsType, affectStrokeBoundsType, strokeType, affectRenderBoundsType, scaleType, rotationType, surfaceType, opacityType, sortType, maskType, eraserType, hitType, pathType, cursorType, dataProcessor, layoutProcessor, setDefaultValue, defineDataProcessor } from './data'
2
2
  export { useModule, rewrite, rewriteAble } from './rewrite'
3
3
  export { defineKey, getDescriptor } from './object'
4
4
  export { registerUI, registerUIEvent } from './class'
@@ -0,0 +1,36 @@
1
+ import { ILeaf, __Value, IObject, IFunction } from '@leafer/interface';
2
+
3
+ declare function aliasType(name: string): (target: ILeaf, key: string) => void;
4
+ declare function defineLeafAttr(target: ILeaf, key: string, defaultValue?: __Value, mergeDescriptor?: IObject & ThisType<ILeaf>): void;
5
+ declare function dataType(defaultValue?: __Value): (target: ILeaf, key: string) => void;
6
+ declare function positionType(defaultValue?: __Value): (target: ILeaf, key: string) => void;
7
+ declare function scaleType(defaultValue?: __Value): (target: ILeaf, key: string) => void;
8
+ declare function rotationType(defaultValue?: __Value): (target: ILeaf, key: string) => void;
9
+ declare function boundsType(defaultValue?: __Value): (target: ILeaf, key: string) => void;
10
+ declare const pathType: typeof boundsType;
11
+ declare function affectStrokeBoundsType(defaultValue?: __Value): (target: ILeaf, key: string) => void;
12
+ declare const strokeType: typeof affectStrokeBoundsType;
13
+ declare function affectRenderBoundsType(defaultValue?: __Value): (target: ILeaf, key: string) => void;
14
+ declare function surfaceType(defaultValue?: __Value): (target: ILeaf, key: string) => void;
15
+ declare function opacityType(defaultValue?: __Value): (target: ILeaf, key: string) => void;
16
+ declare function sortType(defaultValue?: __Value): (target: ILeaf, key: string) => void;
17
+ declare function maskType(defaultValue?: __Value): (target: ILeaf, key: string) => void;
18
+ declare function eraserType(defaultValue?: __Value): (target: ILeaf, key: string) => void;
19
+ declare function hitType(defaultValue?: __Value): (target: ILeaf, key: string) => void;
20
+ declare function cursorType(defaultValue?: __Value): (target: ILeaf, key: string) => void;
21
+ declare function dataProcessor(processor: IObject): (target: ILeaf, _key: string) => void;
22
+ declare function layoutProcessor(processor: IObject): (target: ILeaf, _key: string) => void;
23
+ declare function setDefaultValue(target: IObject, key: string, defaultValue: __Value): void;
24
+ declare function defineDataProcessor(target: ILeaf, key: string, defaultValue?: __Value): void;
25
+
26
+ declare function rewrite(method: IFunction): (target: IObject, key: string) => void;
27
+ declare function rewriteAble(): (_target: IObject) => void;
28
+ declare function useModule(module: IObject, exclude?: string[]): (target: IObject) => void;
29
+
30
+ declare function defineKey<T>(target: T, key: string, descriptor: IObject & ThisType<T>): void;
31
+ declare function getDescriptor(object: IObject, name: string): PropertyDescriptor;
32
+
33
+ declare function registerUI(): (target: IObject) => void;
34
+ declare function registerUIEvent(): (target: IObject) => void;
35
+
36
+ export { affectRenderBoundsType, affectStrokeBoundsType, aliasType, boundsType, cursorType, dataProcessor, dataType, defineDataProcessor, defineKey, defineLeafAttr, eraserType, getDescriptor, hitType, layoutProcessor, maskType, opacityType, pathType, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, setDefaultValue, sortType, strokeType, surfaceType, useModule };