@leafer/decorator 1.0.0-rc.11 → 1.0.0-rc.16
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 -4
- package/src/data.ts +35 -3
- package/src/index.ts +1 -1
- package/types/index.d.ts +5 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/decorator",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.16",
|
|
4
4
|
"description": "@leafer/decorator",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/platform": "1.0.0-rc.
|
|
26
|
-
"@leafer/debug": "1.0.0-rc.
|
|
25
|
+
"@leafer/platform": "1.0.0-rc.16",
|
|
26
|
+
"@leafer/debug": "1.0.0-rc.16"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@leafer/interface": "1.0.0-rc.
|
|
29
|
+
"@leafer/interface": "1.0.0-rc.16"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/src/data.ts
CHANGED
|
@@ -75,8 +75,36 @@ export function boundsType(defaultValue?: IValue) {
|
|
|
75
75
|
defineLeafAttr(target, key, defaultValue, {
|
|
76
76
|
set(value: IValue) {
|
|
77
77
|
this.__setAttr(key, value)
|
|
78
|
-
this
|
|
79
|
-
|
|
78
|
+
doBoundsType(this)
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function naturalBoundsType(defaultValue?: IValue) {
|
|
85
|
+
return (target: ILeaf, key: string) => {
|
|
86
|
+
defineLeafAttr(target, key, defaultValue, {
|
|
87
|
+
set(value: IValue) {
|
|
88
|
+
this.__setAttr(key, value)
|
|
89
|
+
doBoundsType(this)
|
|
90
|
+
this.__.__removeNaturalSize()
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function doBoundsType(leaf: ILeaf): void {
|
|
97
|
+
leaf.__layout.boxChanged || leaf.__layout.boxChange()
|
|
98
|
+
if (leaf.__hasAutoLayout) leaf.__layout.matrixChanged || leaf.__layout.matrixChange()
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function pathInputType(defaultValue?: IValue) {
|
|
102
|
+
return (target: ILeaf, key: string) => {
|
|
103
|
+
defineLeafAttr(target, key, defaultValue, {
|
|
104
|
+
set(value: IValue) {
|
|
105
|
+
if (this.__.__pathInputed !== 2) this.__.__pathInputed = value ? 1 : 0
|
|
106
|
+
this.__setAttr(key, value)
|
|
107
|
+
doBoundsType(this)
|
|
80
108
|
}
|
|
81
109
|
})
|
|
82
110
|
}
|
|
@@ -90,12 +118,16 @@ export function affectStrokeBoundsType(defaultValue?: IValue) {
|
|
|
90
118
|
defineLeafAttr(target, key, defaultValue, {
|
|
91
119
|
set(value: IValue) {
|
|
92
120
|
this.__setAttr(key, value)
|
|
93
|
-
this
|
|
121
|
+
doStrokeType(this)
|
|
94
122
|
}
|
|
95
123
|
})
|
|
96
124
|
}
|
|
97
125
|
}
|
|
98
126
|
|
|
127
|
+
export function doStrokeType(leaf: ILeaf): void {
|
|
128
|
+
leaf.__layout.strokeChanged || leaf.__layout.strokeChange()
|
|
129
|
+
}
|
|
130
|
+
|
|
99
131
|
export const strokeType = affectStrokeBoundsType
|
|
100
132
|
|
|
101
133
|
export function affectRenderBoundsType(defaultValue?: IValue) {
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { defineLeafAttr, dataType, positionType, autoLayoutType, boundsType, affectStrokeBoundsType, strokeType, affectRenderBoundsType, scaleType, rotationType, surfaceType, opacityType, sortType, maskType, eraserType, hitType, pathType, cursorType, dataProcessor, layoutProcessor, defineDataProcessor } from './data'
|
|
1
|
+
export { defineLeafAttr, dataType, positionType, autoLayoutType, boundsType, doBoundsType, naturalBoundsType, affectStrokeBoundsType, doStrokeType, strokeType, affectRenderBoundsType, scaleType, rotationType, surfaceType, opacityType, sortType, maskType, eraserType, hitType, pathType, pathInputType, cursorType, dataProcessor, layoutProcessor, 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'
|
package/types/index.d.ts
CHANGED
|
@@ -7,8 +7,12 @@ declare function autoLayoutType(defaultValue?: IValue): (target: ILeaf, key: str
|
|
|
7
7
|
declare function scaleType(defaultValue?: IValue): (target: ILeaf, key: string) => void;
|
|
8
8
|
declare function rotationType(defaultValue?: IValue): (target: ILeaf, key: string) => void;
|
|
9
9
|
declare function boundsType(defaultValue?: IValue): (target: ILeaf, key: string) => void;
|
|
10
|
+
declare function naturalBoundsType(defaultValue?: IValue): (target: ILeaf, key: string) => void;
|
|
11
|
+
declare function doBoundsType(leaf: ILeaf): void;
|
|
12
|
+
declare function pathInputType(defaultValue?: IValue): (target: ILeaf, key: string) => void;
|
|
10
13
|
declare const pathType: typeof boundsType;
|
|
11
14
|
declare function affectStrokeBoundsType(defaultValue?: IValue): (target: ILeaf, key: string) => void;
|
|
15
|
+
declare function doStrokeType(leaf: ILeaf): void;
|
|
12
16
|
declare const strokeType: typeof affectStrokeBoundsType;
|
|
13
17
|
declare function affectRenderBoundsType(defaultValue?: IValue): (target: ILeaf, key: string) => void;
|
|
14
18
|
declare function surfaceType(defaultValue?: IValue): (target: ILeaf, key: string) => void;
|
|
@@ -32,4 +36,4 @@ declare function getDescriptor(object: IObject, name: string): PropertyDescripto
|
|
|
32
36
|
declare function registerUI(): (target: IObject) => void;
|
|
33
37
|
declare function registerUIEvent(): (target: IObject) => void;
|
|
34
38
|
|
|
35
|
-
export { affectRenderBoundsType, affectStrokeBoundsType, autoLayoutType, boundsType, cursorType, dataProcessor, dataType, defineDataProcessor, defineKey, defineLeafAttr, eraserType, getDescriptor, hitType, layoutProcessor, maskType, opacityType, pathType, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, useModule };
|
|
39
|
+
export { affectRenderBoundsType, affectStrokeBoundsType, autoLayoutType, boundsType, cursorType, dataProcessor, dataType, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, eraserType, getDescriptor, hitType, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, useModule };
|