@futdevpro/fsm-dynamo 1.7.3 → 1.7.6
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/.eslintrc.json +138 -0
- package/lib/_constants/error-defaults.const.d.ts.map +1 -1
- package/lib/_constants/error-defaults.const.js.map +1 -1
- package/lib/_constants/module-settings/usage-module-settings.const.js +1 -1
- package/lib/_constants/module-settings/usage-module-settings.const.js.map +1 -1
- package/lib/_enums/day-of-week.enum.d.ts +13 -0
- package/lib/_enums/day-of-week.enum.d.ts.map +1 -0
- package/lib/_enums/day-of-week.enum.js +25 -0
- package/lib/_enums/day-of-week.enum.js.map +1 -0
- package/lib/_enums/index.d.ts +4 -0
- package/lib/_enums/index.d.ts.map +1 -1
- package/lib/_enums/index.js +4 -0
- package/lib/_enums/index.js.map +1 -1
- package/lib/_enums/month.enum.d.ts +15 -0
- package/lib/_enums/month.enum.d.ts.map +1 -0
- package/lib/_enums/month.enum.js +19 -0
- package/lib/_enums/month.enum.js.map +1 -0
- package/lib/_enums/relative-date.enum.d.ts +9 -0
- package/lib/_enums/relative-date.enum.d.ts.map +1 -0
- package/lib/_enums/relative-date.enum.js +13 -0
- package/lib/_enums/relative-date.enum.js.map +1 -0
- package/lib/_models/control-models/daily-usage-data.control-model.d.ts +1 -1
- package/lib/_models/control-models/daily-usage-data.control-model.js.map +1 -1
- package/lib/_models/control-models/data-params.control-model.js.map +1 -1
- package/lib/_models/control-models/data-property-params.control-model.d.ts +4 -2
- package/lib/_models/control-models/data-property-params.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/data-property-params.control-model.js +6 -3
- package/lib/_models/control-models/data-property-params.control-model.js.map +1 -1
- package/lib/_models/control-models/error.control-model.d.ts +28 -24
- package/lib/_models/control-models/error.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/error.control-model.js +39 -16
- package/lib/_models/control-models/error.control-model.js.map +1 -1
- package/lib/_models/control-models/error.control-model.spec.js +3 -2
- package/lib/_models/control-models/error.control-model.spec.js.map +1 -1
- package/lib/_models/control-models/poll.control-model.d.ts +2 -2
- package/lib/_models/control-models/poll.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/poll.control-model.js +2 -1
- package/lib/_models/control-models/poll.control-model.js.map +1 -1
- package/lib/_models/control-models/range-value.control-model.d.ts +25 -2
- package/lib/_models/control-models/range-value.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/range-value.control-model.js +83 -1
- package/lib/_models/control-models/range-value.control-model.js.map +1 -1
- package/lib/_models/control-models/usage-action.control-model.js +0 -1
- package/lib/_models/control-models/usage-action.control-model.js.map +1 -1
- package/lib/_models/control-models/usage-data.control-model.js.map +1 -1
- package/lib/_models/data-models/custom-data.data-model.d.ts.map +1 -1
- package/lib/_models/data-models/custom-data.data-model.js.map +1 -1
- package/lib/_models/data-models/metadata.data-model.d.ts.map +1 -1
- package/lib/_models/data-models/metadata.data-model.js.map +1 -1
- package/lib/_models/data-models/usage-session.data-model.d.ts.map +1 -1
- package/lib/_models/data-models/usage-session.data-model.js.map +1 -1
- package/lib/_models/interfaces/paged.interace.d.ts +8 -0
- package/lib/_models/interfaces/paged.interace.d.ts.map +1 -0
- package/lib/_models/interfaces/paged.interace.js +3 -0
- package/lib/_models/interfaces/paged.interace.js.map +1 -0
- package/lib/_modules/usage-module.index.d.ts +1 -0
- package/lib/_modules/usage-module.index.d.ts.map +1 -1
- package/lib/_modules/usage-module.index.js +1 -0
- package/lib/_modules/usage-module.index.js.map +1 -1
- package/lib/_utils/array.util.d.ts +5 -0
- package/lib/_utils/array.util.d.ts.map +1 -1
- package/lib/_utils/array.util.js +26 -0
- package/lib/_utils/array.util.js.map +1 -1
- package/lib/_utils/array.util.spec.js.map +1 -1
- package/lib/_utils/box-bounds.util.d.ts +18 -0
- package/lib/_utils/box-bounds.util.d.ts.map +1 -0
- package/lib/_utils/box-bounds.util.js +57 -0
- package/lib/_utils/box-bounds.util.js.map +1 -0
- package/lib/_utils/index.d.ts +3 -0
- package/lib/_utils/index.d.ts.map +1 -1
- package/lib/_utils/index.js +3 -0
- package/lib/_utils/index.js.map +1 -1
- package/lib/_utils/location.util.d.ts.map +1 -1
- package/lib/_utils/location.util.js +4 -2
- package/lib/_utils/location.util.js.map +1 -1
- package/lib/_utils/log.util.d.ts.map +1 -1
- package/lib/_utils/log.util.js +4 -1
- package/lib/_utils/log.util.js.map +1 -1
- package/lib/_utils/math.util.d.ts +10 -0
- package/lib/_utils/math.util.d.ts.map +1 -0
- package/lib/_utils/math.util.js +32 -0
- package/lib/_utils/math.util.js.map +1 -0
- package/lib/_utils/metadata.util.d.ts.map +1 -1
- package/lib/_utils/metadata.util.js.map +1 -1
- package/lib/_utils/random.util.d.ts.map +1 -1
- package/lib/_utils/random.util.js +8 -4
- package/lib/_utils/random.util.js.map +1 -1
- package/lib/_utils/regex/password-regex.util.d.ts +3 -0
- package/lib/_utils/regex/password-regex.util.d.ts.map +1 -0
- package/lib/_utils/regex/password-regex.util.js +49 -0
- package/lib/_utils/regex/password-regex.util.js.map +1 -0
- package/lib/_utils/regex/username-regex.util.d.ts +2 -0
- package/lib/_utils/regex/username-regex.util.d.ts.map +1 -0
- package/lib/_utils/regex/username-regex.util.js +32 -0
- package/lib/_utils/regex/username-regex.util.js.map +1 -0
- package/lib/_utils/regex.util.d.ts.map +1 -1
- package/lib/_utils/regex.util.js +1 -1
- package/lib/_utils/regex.util.js.map +1 -1
- package/lib/_utils/regions.util.d.ts.map +1 -1
- package/lib/_utils/regions.util.js +5 -5
- package/lib/_utils/regions.util.js.map +1 -1
- package/lib/_utils/round-list.util.d.ts.map +1 -1
- package/lib/_utils/round-list.util.js.map +1 -1
- package/lib/_utils/shared.static-service.d.ts.map +1 -1
- package/lib/_utils/shared.static-service.js +1 -1
- package/lib/_utils/shared.static-service.js.map +1 -1
- package/lib/_utils/time.util.d.ts +82 -0
- package/lib/_utils/time.util.d.ts.map +1 -1
- package/lib/_utils/time.util.js +135 -0
- package/lib/_utils/time.util.js.map +1 -1
- package/lib/_utils/trigonometry.util.d.ts.map +1 -1
- package/lib/_utils/trigonometry.util.js +3 -1
- package/lib/_utils/trigonometry.util.js.map +1 -1
- package/lib/_utils/type-cloning-facility.util.d.ts +27 -0
- package/lib/_utils/type-cloning-facility.util.d.ts.map +1 -0
- package/lib/_utils/type-cloning-facility.util.js +77 -0
- package/lib/_utils/type-cloning-facility.util.js.map +1 -0
- package/lib/_utils/utilities.util.d.ts +3 -2
- package/lib/_utils/utilities.util.d.ts.map +1 -1
- package/lib/_utils/utilities.util.js +8 -4
- package/lib/_utils/utilities.util.js.map +1 -1
- package/lib/_utils/vector2.util.d.ts +22 -2
- package/lib/_utils/vector2.util.d.ts.map +1 -1
- package/lib/_utils/vector2.util.js +64 -14
- package/lib/_utils/vector2.util.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/nodemon.json +1 -1
- package/package.json +5 -1
- package/src/_constants/error-defaults.const.ts +1 -1
- package/src/_constants/module-settings/usage-module-settings.const.ts +1 -1
- package/src/_enums/day-of-week.enum.ts +27 -0
- package/src/_enums/index.ts +4 -0
- package/src/_enums/month.enum.ts +16 -0
- package/src/_enums/relative-date.enum.ts +13 -0
- package/src/_models/control-models/daily-usage-data.control-model.ts +1 -1
- package/src/_models/control-models/data-property-params.control-model.ts +12 -4
- package/src/_models/control-models/error.control-model.spec.ts +189 -178
- package/src/_models/control-models/error.control-model.ts +118 -57
- package/src/_models/control-models/poll.control-model.ts +15 -9
- package/src/_models/control-models/range-value.control-model.ts +119 -4
- package/src/_models/control-models/usage-action.control-model.ts +1 -1
- package/src/_models/control-models/usage-data.control-model.ts +1 -1
- package/src/_models/data-models/custom-data.data-model.ts +1 -1
- package/src/_models/data-models/metadata.data-model.ts +5 -0
- package/src/_models/data-models/usage-session.data-model.ts +1 -1
- package/src/_models/interfaces/paged.interace.ts +11 -0
- package/src/_modules/usage-module.index.ts +1 -0
- package/src/_utils/array.util.spec.ts +8 -7
- package/src/_utils/array.util.ts +48 -3
- package/src/_utils/box-bounds.util.ts +71 -0
- package/src/_utils/index.ts +3 -0
- package/src/_utils/location.util.ts +11 -3
- package/src/_utils/log.util.ts +51 -23
- package/src/_utils/math.util.ts +53 -0
- package/src/_utils/metadata.util.ts +1 -0
- package/src/_utils/random.util.ts +18 -7
- package/src/_utils/regex/password-regex.util.ts +53 -0
- package/src/_utils/regex/username-regex.util.ts +33 -0
- package/src/_utils/regex.util.ts +1 -1
- package/src/_utils/regions.util.ts +19 -7
- package/src/_utils/round-list.util.ts +1 -0
- package/src/_utils/shared.static-service.ts +30 -5
- package/src/_utils/time.util.ts +163 -4
- package/src/_utils/trigonometry.util.ts +8 -1
- package/src/_utils/type-cloning-facility.util.ts +121 -0
- package/src/_utils/utilities.util.ts +33 -8
- package/src/_utils/vector2.util.ts +83 -16
|
@@ -2,32 +2,40 @@
|
|
|
2
2
|
import { Dynamo_Trigonometry } from './trigonometry.util';
|
|
3
3
|
|
|
4
4
|
export class Vector2 {
|
|
5
|
-
|
|
5
|
+
readonly isVector2: boolean = true;
|
|
6
|
+
|
|
7
|
+
private _x: number = 0;
|
|
6
8
|
set x (value: number) {
|
|
7
9
|
this._x = value;
|
|
10
|
+
|
|
8
11
|
this.calcMagnitude();
|
|
9
|
-
}
|
|
12
|
+
}
|
|
10
13
|
get x (): number {
|
|
11
14
|
return this._x;
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
private _y: number;
|
|
17
|
+
private _y: number = 0;
|
|
15
18
|
set y (value: number) {
|
|
16
19
|
this._y = value;
|
|
20
|
+
|
|
17
21
|
this.calcMagnitude();
|
|
18
|
-
}
|
|
22
|
+
}
|
|
19
23
|
get y (): number {
|
|
20
24
|
return this._y;
|
|
21
25
|
}
|
|
22
26
|
|
|
23
|
-
private _magintude: number;
|
|
27
|
+
private _magintude: number = 0;
|
|
24
28
|
get magintude (): number {
|
|
25
29
|
return this._magintude;
|
|
26
30
|
}
|
|
27
31
|
|
|
28
|
-
constructor(
|
|
32
|
+
constructor(
|
|
33
|
+
x: number = 0,
|
|
34
|
+
y: number = 0
|
|
35
|
+
) {
|
|
29
36
|
this._x = x;
|
|
30
37
|
this._y = y;
|
|
38
|
+
|
|
31
39
|
this.calcMagnitude();
|
|
32
40
|
}
|
|
33
41
|
|
|
@@ -48,21 +56,32 @@ export class Vector2 {
|
|
|
48
56
|
return this.plus(a, this.negative(b));
|
|
49
57
|
}
|
|
50
58
|
minus(vector: Vector2): void {
|
|
51
|
-
this.
|
|
59
|
+
this.newValues(Vector2.minus(this, vector));
|
|
52
60
|
}
|
|
53
61
|
|
|
54
62
|
static plus(a: Vector2, b: Vector2): Vector2 {
|
|
55
63
|
return new Vector2(a.x + b.x, a.y + b.y);
|
|
56
64
|
}
|
|
57
65
|
plus(vector: Vector2): void {
|
|
58
|
-
this.
|
|
66
|
+
this.newValues(Vector2.plus(this, vector));
|
|
59
67
|
}
|
|
68
|
+
static add = this.plus;
|
|
69
|
+
add = this.plus;
|
|
60
70
|
|
|
71
|
+
/** returns new multiplied Vector2 */
|
|
61
72
|
static multiply(v: Vector2, n: number): Vector2 {
|
|
62
73
|
return new Vector2(v.x * n, v.y * n);
|
|
63
74
|
}
|
|
64
75
|
multiply(n: number): void {
|
|
65
|
-
this.
|
|
76
|
+
this.newValues(Vector2.multiply(this, n));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** returns new divided Vector2 */
|
|
80
|
+
static divide(v: Vector2, n: number): Vector2 {
|
|
81
|
+
return new Vector2(v.x / n, v.y / n);
|
|
82
|
+
}
|
|
83
|
+
divide(n: number): void {
|
|
84
|
+
this.newValues(Vector2.divide(this, n));
|
|
66
85
|
}
|
|
67
86
|
|
|
68
87
|
static negative(v: Vector2): Vector2 {
|
|
@@ -72,18 +91,19 @@ export class Vector2 {
|
|
|
72
91
|
return Vector2.negative(this);
|
|
73
92
|
}
|
|
74
93
|
negate(): void {
|
|
75
|
-
this.
|
|
94
|
+
this.newValues(Vector2.negative(this));
|
|
76
95
|
}
|
|
77
96
|
|
|
78
97
|
static rebase(v: Vector2, baseFrom: Vector2, baseTo: Vector2): Vector2 {
|
|
79
98
|
return this.plus(v, this.minus(baseTo, baseFrom));
|
|
80
99
|
}
|
|
81
100
|
rebase(baseFrom: Vector2, baseTo: Vector2): void {
|
|
82
|
-
this.
|
|
101
|
+
this.newValues(Vector2.rebase(this, baseFrom, baseTo));
|
|
83
102
|
}
|
|
84
103
|
|
|
85
104
|
static rotate(vector: Vector2, angle: number): Vector2 {
|
|
86
105
|
const rad = Dynamo_Trigonometry.angleToRadians(angle);
|
|
106
|
+
|
|
87
107
|
return this.rotateRad(vector, rad);
|
|
88
108
|
}
|
|
89
109
|
static rotateRad(vector: Vector2, rad: number): Vector2 {
|
|
@@ -91,29 +111,76 @@ export class Vector2 {
|
|
|
91
111
|
const sin = Math.sin(rad);
|
|
92
112
|
const newX = (vector.x * cos) - (vector.y * sin);
|
|
93
113
|
const newY = (vector.x * sin) + (vector.y * cos);
|
|
114
|
+
|
|
94
115
|
return new Vector2(newX, newY);
|
|
95
116
|
}
|
|
96
117
|
rotate(angle: number): void {
|
|
97
|
-
this.
|
|
118
|
+
this.newValues(Vector2.rotate(this, angle));
|
|
98
119
|
}
|
|
99
120
|
rotateRad(rad: number): void {
|
|
100
|
-
this.
|
|
121
|
+
this.newValues(Vector2.rotateRad(this, rad));
|
|
101
122
|
}
|
|
102
123
|
|
|
103
|
-
private
|
|
124
|
+
private newValues(newV: Vector2): void {
|
|
104
125
|
this.newXY(newV.x, newV.y);
|
|
105
126
|
}
|
|
106
127
|
newXY(newX: number, newY: number): void {
|
|
107
128
|
this._x = newX;
|
|
108
129
|
this._y = newY;
|
|
130
|
+
|
|
109
131
|
this.calcMagnitude();
|
|
110
132
|
}
|
|
111
133
|
|
|
112
|
-
|
|
134
|
+
//// AI-ed
|
|
135
|
+
angle(from: Vector2, to: Vector2): number {
|
|
136
|
+
return Vector2.angle(from, to);
|
|
137
|
+
}
|
|
138
|
+
static angle(from: Vector2, to: Vector2): number {
|
|
139
|
+
return Dynamo_Trigonometry.radiansToAngle(Vector2.angleRad(from, to));
|
|
140
|
+
}
|
|
141
|
+
static angleRad(from: Vector2, to: Vector2): number {
|
|
142
|
+
return Math.atan2(to.y - from.y, to.x - from.x);
|
|
143
|
+
}
|
|
144
|
+
deg(): number {
|
|
145
|
+
return Vector2.deg(this);
|
|
146
|
+
}
|
|
147
|
+
static deg(vector: Vector2): number {
|
|
148
|
+
return Dynamo_Trigonometry.radiansToAngle(Vector2.rad(vector));
|
|
149
|
+
}
|
|
150
|
+
static rad(vector: Vector2): number {
|
|
151
|
+
return Math.atan2(vector.y, vector.x);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
floor(): Vector2 {
|
|
155
|
+
return Vector2.floor(this);
|
|
156
|
+
}
|
|
157
|
+
static floor(v: Vector2): Vector2 {
|
|
158
|
+
return new Vector2(Math.floor(v.x), Math.floor(v.y));
|
|
159
|
+
}
|
|
160
|
+
/////
|
|
161
|
+
|
|
162
|
+
direction(to: Vector2): Vector2 {
|
|
163
|
+
return Vector2.direction(this, to);
|
|
164
|
+
}
|
|
165
|
+
static direction(from: Vector2, to: Vector2): Vector2 {
|
|
166
|
+
return Vector2.minus(to, from);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
static normalize(v: Vector2): Vector2 {
|
|
170
|
+
return Vector2.multiply(v, 1 / v.magintude);
|
|
171
|
+
}
|
|
172
|
+
normalize(): void {
|
|
173
|
+
this.newValues(Vector2.normalize(this));
|
|
174
|
+
}
|
|
175
|
+
normalized(): Vector2 {
|
|
176
|
+
return Vector2.normalize(this);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
private calcMagnitude(): void {
|
|
113
180
|
this._magintude = Dynamo_Trigonometry.getHypotenuse(this._x, this._y);
|
|
114
181
|
}
|
|
115
182
|
|
|
116
|
-
clone() {
|
|
183
|
+
clone(): Vector2 {
|
|
117
184
|
return new Vector2(this._x, this._y);
|
|
118
185
|
}
|
|
119
186
|
}
|