aprog 2.2.3 → 2.2.4
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/README.md +1 -0
- package/index.js +4 -2
- package/package.json +1 -1
- package/src/classes/AbortError.js +11 -0
- package/src/classes/SmartWrapper.js +139 -139
- package/src/classes/StateWrapper.js +53 -53
- package/src/classes/Toast.js +158 -0
- package/src/constructs/ButtonConstructor.js +36 -35
- package/src/constructs/InputConstructor.js +43 -42
- package/src/constructs/SelectConstructor.js +36 -35
- package/src/general.js +1281 -1250
- package/src/helper.js +9 -0
- package/src/html.js +64 -64
|
@@ -6,42 +6,43 @@ import {button, GUID} from "aprog";
|
|
|
6
6
|
* Copyright (c) 2025 AlexProger.
|
|
7
7
|
*/
|
|
8
8
|
export const ButtonConstructor = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
/**
|
|
10
|
+
* create HTMLElement
|
|
11
|
+
*/
|
|
12
|
+
constructor() {
|
|
13
|
+
const instance = Object.create(this);
|
|
14
|
+
instance.class = GUID();
|
|
15
|
+
return instance;
|
|
16
|
+
},
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
...props
|
|
29
|
-
} = {}) {
|
|
30
|
-
return this.is = button({
|
|
31
|
-
id: id || GUID(),
|
|
32
|
-
class: `${this.class} btn ${className} disabled`.trim(),
|
|
33
|
-
style: style,
|
|
34
|
-
...(type && {type: type}),
|
|
35
|
-
value: text,
|
|
36
|
-
onClick: callback,
|
|
37
|
-
...props
|
|
38
|
-
});
|
|
18
|
+
/**
|
|
19
|
+
* set HTMLElement
|
|
20
|
+
*/
|
|
21
|
+
element({
|
|
22
|
+
id = undefined,
|
|
23
|
+
className = "",
|
|
24
|
+
style = {},
|
|
25
|
+
type = undefined,
|
|
26
|
+
text = "",
|
|
27
|
+
callback = () => {
|
|
39
28
|
},
|
|
29
|
+
...props
|
|
30
|
+
} = {}) {
|
|
31
|
+
return this.is = button({
|
|
32
|
+
id: id || GUID(),
|
|
33
|
+
class: `${this.class} btn ${className} disabled`.trim(),
|
|
34
|
+
style: style,
|
|
35
|
+
...(type && {type: type}),
|
|
36
|
+
value: text,
|
|
37
|
+
onClick: callback,
|
|
38
|
+
...props
|
|
39
|
+
});
|
|
40
|
+
},
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
/**
|
|
43
|
+
* get target [HTMLElement]
|
|
44
|
+
*/
|
|
45
|
+
get target() {
|
|
46
|
+
return this?.is;
|
|
47
|
+
}
|
|
47
48
|
};
|
|
@@ -6,49 +6,50 @@ import {GUID, input} from "aprog";
|
|
|
6
6
|
* Copyright (c) 2025 AlexProger.
|
|
7
7
|
*/
|
|
8
8
|
export const InputConstructor = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* set HTMLElement
|
|
20
|
-
*/
|
|
21
|
-
element({
|
|
22
|
-
id = undefined,
|
|
23
|
-
className = "",
|
|
24
|
-
style = {},
|
|
25
|
-
type = undefined,
|
|
26
|
-
focus = false,
|
|
27
|
-
placeholder = undefined,
|
|
28
|
-
value = undefined,
|
|
29
|
-
nameCallback = "onInput",
|
|
30
|
-
callback = () => {},
|
|
31
|
-
...props
|
|
32
|
-
} = {}) {
|
|
33
|
-
this.is = input({
|
|
34
|
-
id: id || GUID(),
|
|
35
|
-
class: `${this.class} input ${className}`.trim(),
|
|
36
|
-
style: style,
|
|
37
|
-
...(type && {type: type}),
|
|
38
|
-
...(placeholder && {placeholder: placeholder}),
|
|
39
|
-
...(value && {value: value}),
|
|
40
|
-
[nameCallback]: callback,
|
|
41
|
-
...props
|
|
42
|
-
});
|
|
9
|
+
/**
|
|
10
|
+
* create HTMLElement
|
|
11
|
+
*/
|
|
12
|
+
constructor() {
|
|
13
|
+
const instance = Object.create(this);
|
|
14
|
+
instance.class = GUID();
|
|
15
|
+
return instance;
|
|
16
|
+
},
|
|
43
17
|
|
|
44
|
-
|
|
45
|
-
|
|
18
|
+
/**
|
|
19
|
+
* set HTMLElement
|
|
20
|
+
*/
|
|
21
|
+
element({
|
|
22
|
+
id = undefined,
|
|
23
|
+
className = "",
|
|
24
|
+
style = {},
|
|
25
|
+
type = undefined,
|
|
26
|
+
focus = false,
|
|
27
|
+
placeholder = undefined,
|
|
28
|
+
value = undefined,
|
|
29
|
+
nameCallback = "onInput",
|
|
30
|
+
callback = () => {
|
|
46
31
|
},
|
|
32
|
+
...props
|
|
33
|
+
} = {}) {
|
|
34
|
+
this.is = input({
|
|
35
|
+
id: id || GUID(),
|
|
36
|
+
class: `${this.class} input ${className}`.trim(),
|
|
37
|
+
style: style,
|
|
38
|
+
...(type && {type: type}),
|
|
39
|
+
...(placeholder && {placeholder: placeholder}),
|
|
40
|
+
...(value && {value: value}),
|
|
41
|
+
[nameCallback]: callback,
|
|
42
|
+
...props
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
if (focus) queueMicrotask(() => this.is.focus());
|
|
46
|
+
return this.is;
|
|
47
|
+
},
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
/**
|
|
50
|
+
* get target [HTMLElement]
|
|
51
|
+
*/
|
|
52
|
+
get target() {
|
|
53
|
+
return this?.is;
|
|
54
|
+
}
|
|
54
55
|
};
|
|
@@ -6,42 +6,43 @@ import {GUID, select} from "aprog";
|
|
|
6
6
|
* Copyright (c) 2025 AlexProger.
|
|
7
7
|
*/
|
|
8
8
|
export const SelectConstructor = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
/**
|
|
10
|
+
* create HTMLElement
|
|
11
|
+
*/
|
|
12
|
+
constructor() {
|
|
13
|
+
const instance = Object.create(this);
|
|
14
|
+
instance.class = GUID();
|
|
15
|
+
return instance;
|
|
16
|
+
},
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
...props
|
|
29
|
-
} = {}) {
|
|
30
|
-
return this.is = select({
|
|
31
|
-
id: id || GUID(),
|
|
32
|
-
class: `${this.class} input ${className}`.trim(),
|
|
33
|
-
style: style,
|
|
34
|
-
...(option && {option: option}),
|
|
35
|
-
...(options && {options: options}),
|
|
36
|
-
onChange: callback,
|
|
37
|
-
...props
|
|
38
|
-
});
|
|
18
|
+
/**
|
|
19
|
+
* set HTMLElement
|
|
20
|
+
*/
|
|
21
|
+
element({
|
|
22
|
+
id = undefined,
|
|
23
|
+
className = "",
|
|
24
|
+
style = {},
|
|
25
|
+
option = undefined,
|
|
26
|
+
options = undefined,
|
|
27
|
+
callback = () => {
|
|
39
28
|
},
|
|
29
|
+
...props
|
|
30
|
+
} = {}) {
|
|
31
|
+
return this.is = select({
|
|
32
|
+
id: id || GUID(),
|
|
33
|
+
class: `${this.class} input ${className}`.trim(),
|
|
34
|
+
style: style,
|
|
35
|
+
...(option && {option: option}),
|
|
36
|
+
...(options && {options: options}),
|
|
37
|
+
onChange: callback,
|
|
38
|
+
...props
|
|
39
|
+
});
|
|
40
|
+
},
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
/**
|
|
43
|
+
* get target [HTMLElement]
|
|
44
|
+
*/
|
|
45
|
+
get target() {
|
|
46
|
+
return this?.is;
|
|
47
|
+
}
|
|
47
48
|
};
|