@carlsebastian/jsu 1.0.34
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/LICENSE +201 -0
- package/package.json +58 -0
- package/src/global.js +7 -0
- package/src/types/api/api.d.ts +147 -0
- package/src/types/api/element.d.ts +55 -0
- package/src/types/custom/custom.d.ts +8 -0
- package/src/types/custom/error/builder/error.builder.d.ts +78 -0
- package/src/types/custom/error/constructor/error.base.d.ts +4 -0
- package/src/types/custom/error/constructor/error.custom.d.ts +34 -0
- package/src/types/custom/error/constructor/error.meta.d.ts +18 -0
- package/src/types/custom/error/error.d.ts +5 -0
- package/src/types/custom/utils/custom.utils.d.ts +42 -0
- package/src/types/custom/utils/generator/generator.d.ts +92 -0
- package/src/types/dom/attr/attr.class.d.ts +81 -0
- package/src/types/dom/attr/attr.id.d.ts +23 -0
- package/src/types/dom/attr/attr.style.d.ts +32 -0
- package/src/types/dom/dom.d.ts +8 -0
- package/src/types/dom/element/create/element.create.d.ts +67 -0
- package/src/types/dom/element/getElementBy/dom.getElementBy.d.ts +71 -0
- package/src/types/dom/element/tag-verifier/verifier.d.ts +16 -0
- package/src/types/global.d.ts +13 -0
- package/src/types/guards/data-types/data-types.d.ts +5 -0
- package/src/types/guards/formats/formats.d.ts +5 -0
- package/src/types/guards/guards.d.ts +8 -0
- package/src/types/primitives/obj/obj.accessor.d.ts +5 -0
- package/src/types/primitives/obj/obj.iterator.d.ts +5 -0
- package/src/types/primitives/primitives.d.ts +8 -0
- package/src/types/primitives/str/str.d.ts +26 -0
- package/src/types/storage/local/storage.local.d.ts +86 -0
- package/src/types/storage/session/storage.session.d.ts +86 -0
- package/src/types/storage/storage.d.ts +8 -0
- package/src/utils/custom/custom.js +20 -0
- package/src/utils/custom/error/builder/error.builder.js +181 -0
- package/src/utils/custom/error/constructor/error.base.js +71 -0
- package/src/utils/custom/error/constructor/error.custom.js +107 -0
- package/src/utils/custom/error/error.js +23 -0
- package/src/utils/custom/utils/custom.utils.js +150 -0
- package/src/utils/custom/utils/generator/generator.js +222 -0
- package/src/utils/dom/attr/attr.class.js +186 -0
- package/src/utils/dom/attr/attr.id.js +64 -0
- package/src/utils/dom/attr/attr.style.js +128 -0
- package/src/utils/dom/dom.js +29 -0
- package/src/utils/dom/element/create/element.create.js +312 -0
- package/src/utils/dom/element/getElementBy/dom.getElementBy.js +171 -0
- package/src/utils/dom/element/query/dom.query.js +75 -0
- package/src/utils/dom/element/tag-verifier/verifier.js +60 -0
- package/src/utils/dom/lifecycle/mount.js +48 -0
- package/src/utils/dom/lifecycle/unmount.js +43 -0
- package/src/utils/guards/data-types/data-types.js +201 -0
- package/src/utils/guards/formats/formats.js +274 -0
- package/src/utils/guards/guards.js +21 -0
- package/src/utils/primitives/obj/obj.accessor.js +242 -0
- package/src/utils/primitives/obj/obj.iterator.js +148 -0
- package/src/utils/primitives/primitives.js +23 -0
- package/src/utils/primitives/str/str.js +52 -0
- package/src/utils/storage/local/storage.local.js +236 -0
- package/src/utils/storage/session/storage.session.js +236 -0
- package/src/utils/storage/storage.js +59 -0
- package/src/utils/variables.js +78 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@carlsebastian/jsu",
|
|
3
|
+
"version": "1.0.34",
|
|
4
|
+
"description": "A ready-to-use JavaScripts custom utilities such as types validations, formats validations, formatter, and many more!",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"src"
|
|
8
|
+
],
|
|
9
|
+
"types": "./src/types/global.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"require": "./src/global.js",
|
|
13
|
+
"types": "./src/types/global.d.ts"
|
|
14
|
+
},
|
|
15
|
+
"./custom": {
|
|
16
|
+
"require": "./src/utils/custom/custom.js",
|
|
17
|
+
"types": "./src/types/custom/custom.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./custom/error": {
|
|
20
|
+
"require": "./src/utils/custom/error/error.js",
|
|
21
|
+
"types": "./src/types/custom/error/error.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"./dom": {
|
|
24
|
+
"require": "./src/utils/dom/dom.js",
|
|
25
|
+
"types": "./src/types/dom/dom.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"./guards": {
|
|
28
|
+
"require": "./src/utils/guards/guards.js",
|
|
29
|
+
"types": "./src/types/guards/guards.d.ts"
|
|
30
|
+
},
|
|
31
|
+
"./primitives": {
|
|
32
|
+
"require": "./src/utils/primitives/primitives.js",
|
|
33
|
+
"types": "./src/types/primitives/primitives.d.ts"
|
|
34
|
+
},
|
|
35
|
+
"./storage": {
|
|
36
|
+
"require": "./src/utils/storage/storage.js",
|
|
37
|
+
"types": "./src/types/storage/storage.d.ts"
|
|
38
|
+
},
|
|
39
|
+
"./variables": {
|
|
40
|
+
"require": "./src/utils/variables.js"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"dev": "node ./src/index.js"
|
|
45
|
+
},
|
|
46
|
+
"keywords": [],
|
|
47
|
+
"author": "",
|
|
48
|
+
"license": "ISC",
|
|
49
|
+
"type": "module",
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git+https://github.com/Sebastian-Carl/JSU.git"
|
|
53
|
+
},
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/Sebastian-Carl/JSU/issues"
|
|
56
|
+
},
|
|
57
|
+
"homepage": "https://github.com/Sebastian-Carl/JSU#readme"
|
|
58
|
+
}
|
package/src/global.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
type CustomAPI = & {
|
|
2
|
+
[K in keyof CustomUtilitiesAPI]: CustomUtilitiesAPI[K];
|
|
3
|
+
} & {
|
|
4
|
+
Generator: typeof GeneratorAPI;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
interface DomAPI {
|
|
8
|
+
/**
|
|
9
|
+
* Access the element's `DOMTokenList` and returns set collection of for it.
|
|
10
|
+
*
|
|
11
|
+
* @param element - The element to access the `DOMTokenList`.
|
|
12
|
+
*/
|
|
13
|
+
ClassOf(element: Element): DOMClassOfAPI;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A collection of customized and enhanced `create` of `DocumentObjectModel`.
|
|
17
|
+
*/
|
|
18
|
+
Create: DOMCreateAPI;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Access the element's `id` attribute and returns a set of for it.
|
|
22
|
+
*
|
|
23
|
+
* @param element - The element to access the `id` attribute.
|
|
24
|
+
*/
|
|
25
|
+
IdOf(element: Element): DOMIdOfAPI;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A enhanced version collection of element retrieval methods.
|
|
29
|
+
*/
|
|
30
|
+
GetElementBy: DOMGetElementByAPI;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Mounts the given `childNode` to its given `parentNode`.
|
|
34
|
+
*
|
|
35
|
+
* @param parentNode - The parent node to mount the given child node.
|
|
36
|
+
* @param childNode - The given child node to mount.
|
|
37
|
+
*/
|
|
38
|
+
Mount(parentNode: ParentNode, childNode: ChildNode): void;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Mounts the given `childNode` collection to its given `parentNode`.
|
|
42
|
+
*
|
|
43
|
+
* @param parentNode - The parent node to mount the given collection of child node.
|
|
44
|
+
* @param childNodes - The given collection of child nodes to mount.
|
|
45
|
+
*/
|
|
46
|
+
Mount(parentNode: ParentNode, ...childNodes: ChildNode[]): void;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Search and retrieves the first element to match the given selector.
|
|
50
|
+
*
|
|
51
|
+
* @param selector - The selector of element to search.
|
|
52
|
+
* @returns The element that matches the given selector.
|
|
53
|
+
*/
|
|
54
|
+
Select<T extends keyof ElementTags>(selector: T): ResolveTag<T>;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Search and retrieves the first element to match the given selector.
|
|
58
|
+
*
|
|
59
|
+
* @param selector - The selector of element to search.
|
|
60
|
+
* @param root - The parent element to search the given element selector at. (Default: Document)
|
|
61
|
+
* @returns The element that matches the given selector.
|
|
62
|
+
*/
|
|
63
|
+
Select<T extends keyof ElementTags>(selector: T, root: ParentNode): ResolveTag<T>;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Search and retrieves the collection of elements that matches the given selector.
|
|
67
|
+
*
|
|
68
|
+
* @param selector - The selector of elements to search.
|
|
69
|
+
* @returns The collection of elements that matches the given selector.
|
|
70
|
+
*/
|
|
71
|
+
SelectAll<T extends keyof ElementTags>(selector: T): ResolveTag<T>;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Search and retrieves the collection of elements that matches the given selector.
|
|
75
|
+
*
|
|
76
|
+
* @param selector - The selector of elements to search.
|
|
77
|
+
* @param root - The parent element to search the given element selector at. (Default: Document)
|
|
78
|
+
* @returns The collection of elements that matches the given selector.
|
|
79
|
+
*/
|
|
80
|
+
SelectAll<T extends keyof ElementTags>(selector: T, root?: ParentNode): ResolveTag<T>;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Access the element's `CSSStyleDeclaration` and returns a set collection of for it.
|
|
84
|
+
*
|
|
85
|
+
* @param element - The element to access its `CSSStyleDeclaration`.
|
|
86
|
+
*/
|
|
87
|
+
StyleOf(element: Element): DOMStyleOfAPI;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Unmounts the given `childNode` from its `parentNode`.
|
|
91
|
+
*
|
|
92
|
+
* @param childNode - The child node to unmount.
|
|
93
|
+
*/
|
|
94
|
+
Unmount(childNode: ChildNode): void;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Unmounts the given `childNode` collection from their `parentNode`.
|
|
98
|
+
*
|
|
99
|
+
* @param childNodes - The collection of child nodes to unmount.
|
|
100
|
+
*/
|
|
101
|
+
Unmount(...childNodes: ChildNode[]): void;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Verifies the given tag of element.
|
|
105
|
+
*
|
|
106
|
+
* @param tag - The tag of element to verify.
|
|
107
|
+
*
|
|
108
|
+
* @throw {ArgumentError} - When parameter tag is not in string format.
|
|
109
|
+
*/
|
|
110
|
+
VerifyTag<KTag extends keyof ElementTags>(tag: KTag): VerifierTagAPI<KTag>;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
interface ErrorAPI {
|
|
114
|
+
Constructors: ErrorConstructorAPI;
|
|
115
|
+
Emit: ErrorEmitterAPI;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
type GuardsAPI = GuardsDataTypesAPI & GuardsFormatAPI;
|
|
119
|
+
|
|
120
|
+
type PrimitivesAPI = PrimitivesIteratorAPI & PrimitivesObjAccessorAPI & { Str: PrimitivesStrAPI };
|
|
121
|
+
|
|
122
|
+
interface StorageAPI {
|
|
123
|
+
/**
|
|
124
|
+
* Indicates whether if the `StorageAPI` is supported on your or user's browser environment version.
|
|
125
|
+
*/
|
|
126
|
+
IS_SUPPORTED(): boolean;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* A enhanced version of `localStorage` API.
|
|
130
|
+
*/
|
|
131
|
+
LOCAL: LocalStorageAPI;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* A enhanced version of `sessionStorage` API.
|
|
135
|
+
*/
|
|
136
|
+
SESSION: SessionStorageAPI;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
interface EnhancedGlobalUtilsAPI {
|
|
140
|
+
readonly Custom: CustomAPI;
|
|
141
|
+
readonly DOM: DomAPI;
|
|
142
|
+
readonly ERROR: ErrorAPI;
|
|
143
|
+
readonly Guards: GuardsAPI;
|
|
144
|
+
readonly Primitives: PrimitivesAPI;
|
|
145
|
+
readonly STORAGE: StorageAPI;
|
|
146
|
+
readonly GetElementBy: DOMGetElementByAPI;
|
|
147
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
type HTMLElementTags = HTMLElementTagNameMap;
|
|
2
|
+
type MathElementTags = MathMLElementTagNameMap;
|
|
3
|
+
type SVGElementTags = SVGElementTagNameMap;
|
|
4
|
+
type ElementTags = HTMLElementTags & MathElementTags & SVGElementTags;
|
|
5
|
+
type CSSDeclaration = CSSStyleDeclaration;
|
|
6
|
+
|
|
7
|
+
type XMLNameSpace = "http://www.w3.org/1998/Math/MathML" | "http://www.w3.org/1999/xhtml" | "http://www.w3.org/2000/svg";
|
|
8
|
+
|
|
9
|
+
type HTMLElementConfig = {
|
|
10
|
+
ClassNames?: string | string[];
|
|
11
|
+
Id?: string;
|
|
12
|
+
Text?: string;
|
|
13
|
+
Styles?: CSSDeclaration;
|
|
14
|
+
[OtherAttr: string]: any;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type MathElementConfig = {
|
|
18
|
+
Data?: {
|
|
19
|
+
[DataCustomKey: string]: string;
|
|
20
|
+
},
|
|
21
|
+
Dir?: "ltr" | "rtl";
|
|
22
|
+
DisplayStyle?: boolean;
|
|
23
|
+
Href?: string;
|
|
24
|
+
/** @deprecated */
|
|
25
|
+
MathBackground?: string;
|
|
26
|
+
/** @deprecated */
|
|
27
|
+
MathColor?: string;
|
|
28
|
+
/** @deprecated */
|
|
29
|
+
MathSize?: string;
|
|
30
|
+
ScriptLevel?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
type SVGElementConfig = {
|
|
34
|
+
ClassNames?: string | string[];
|
|
35
|
+
Id?: string;
|
|
36
|
+
Styles?: CSSDeclaration;
|
|
37
|
+
XML_Language?: string;
|
|
38
|
+
TabIndex?: number;
|
|
39
|
+
XML_Space?: "default" | "preserve";
|
|
40
|
+
[OtherAttr: string]: any;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type ResolveTag<T extends keyof ElementTags> =
|
|
44
|
+
T extends keyof HTMLElementTags ? HTMLElementTags[T] :
|
|
45
|
+
T extends keyof MathElementTags ? MathElementTags[T] :
|
|
46
|
+
T extends keyof SVGElementTags ? SVGElementTags[T] : null;
|
|
47
|
+
|
|
48
|
+
type ResolveTagNS<NS extends XMLNameSpace, T extends keyof ElementTags> =
|
|
49
|
+
NS extends "http://www.w3.org/1998/Math/MathML" ?
|
|
50
|
+
T extends keyof MathElementTags ? MathElementTags[T] : MathMLElement :
|
|
51
|
+
NS extends "http://www.w3.org/1999/xhtml" ?
|
|
52
|
+
T extends keyof HTMLElementTags ? HTMLElementTags[T] : HTMLElement :
|
|
53
|
+
NS extends "http://www.w3.org/2000/svg" ?
|
|
54
|
+
T extends keyof SVGElementTags ? SVGElementTags[T] : SVGElement :
|
|
55
|
+
never;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A collection of customized error emitter contents for `ErrorConstructorAPI`.
|
|
3
|
+
*/
|
|
4
|
+
type ErrorEmitterAPI = {
|
|
5
|
+
/**
|
|
6
|
+
* Builds and emit the contents of `ArgumentError`.
|
|
7
|
+
*
|
|
8
|
+
* @param emitter_id - The object id that called this error.
|
|
9
|
+
* @param argument_id - The argument of the source emitter that cause the error.
|
|
10
|
+
* @param received_arg - The received argument data.
|
|
11
|
+
* @param expected_args - The expected argument(s) of emitter to receive.
|
|
12
|
+
*/
|
|
13
|
+
_ArgumentError(emitter_id: string, argument_id?: string, received_arg?: string, ...expected_args?: string[]): never;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Builds and emit the contents of `IndexOutOfBoundsError`.
|
|
17
|
+
*
|
|
18
|
+
* @param emitter_id - The object id that called this error.
|
|
19
|
+
* @param argument_id - The argument of the source emitter that cause the error.
|
|
20
|
+
* @param index - The received index position that overlapped the maximum bound position or argument.
|
|
21
|
+
* @param maximum_bound - The maximum bound index position of an index can be.
|
|
22
|
+
*/
|
|
23
|
+
_IndexOutOfBoundsError(emitter_id: string, argument_id?: string, index?: number, maximum_bound?: number): never;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Builds and emit the contents of `InvalidPropertyError`.
|
|
27
|
+
*
|
|
28
|
+
* @param emitter_id - The object id that called this error.
|
|
29
|
+
* @param argument_id - The argument of the source emitter that cause the error.
|
|
30
|
+
* @param property_id - The invalid property of argument.
|
|
31
|
+
*/
|
|
32
|
+
_InvalidPropertyError(emitter_id: string, argument_id?: string, property_id?: string): never;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Builds and emit the contents of `MissingParameterError`.
|
|
36
|
+
*
|
|
37
|
+
* @param emitter_id - The object id that called this error.
|
|
38
|
+
* @param argument_id - The argument of the source emitter that cause the error.
|
|
39
|
+
* @param arg_value - The current state value of the missing argument.
|
|
40
|
+
*/
|
|
41
|
+
_MissingParameterError(emitter_id: string, argument_id?: string, arg_value?: string): never;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Builds and emit the contents of `MissingPropertyError`.
|
|
45
|
+
*
|
|
46
|
+
* @param emitter_id - The object id that called this error.
|
|
47
|
+
* @param argument_id - The argument of the source emitter that cause the error.
|
|
48
|
+
* @param property_id - The missing property id of argument.
|
|
49
|
+
*/
|
|
50
|
+
_MissingPropertyError(emitter_id: string, argument_id?: string, property_id?: string): never;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Builds and emit the contents of `NoSuchElementTagError`.
|
|
54
|
+
*
|
|
55
|
+
* @param emitter_id - The object id that called this error.
|
|
56
|
+
* @param argument_id - The argument of the source emitter that cause the error.
|
|
57
|
+
* @param tag - The received unqualified tag of argument.
|
|
58
|
+
* @param tagOf - The instance that is trying to verify the tag.
|
|
59
|
+
*/
|
|
60
|
+
_NoSuchElementTagError(emitter_id: string, argument_id?: string, tag?: string, tagOf?: "HTMLElement" | "MathMLElement" | "SVGElement"): never;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Builds and emit the contents of `NotSupportedError`.
|
|
64
|
+
*
|
|
65
|
+
* @param emitter_id - The object id that called this error.
|
|
66
|
+
* @param unsupported_id - The unsupported argument id of the source emitter that cause the error.
|
|
67
|
+
*/
|
|
68
|
+
_NotSupportedError(emitter_id: string, unsupported_id?: string): never;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Builds and emit the contents of `UnknownPropertyError`.
|
|
72
|
+
*
|
|
73
|
+
* @param emitter_id - The object id that called this error.
|
|
74
|
+
* @param argument_id - The argument of the source emitter that cause the error.
|
|
75
|
+
* @param property_id - The unknown property of argument that is trying to accessed.
|
|
76
|
+
*/
|
|
77
|
+
_UnknownPropertyError(emitter_id: string, argument_id?: string, property_id?: string): never;
|
|
78
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
type ErrorConstructorAPI = {
|
|
2
|
+
/**
|
|
3
|
+
* A customized and enhanced `TypeError`.
|
|
4
|
+
*/
|
|
5
|
+
ArgumentError: typeof import("../../../../utils/custom/error/constructor/error.custom.js").ArgumentError;
|
|
6
|
+
/**
|
|
7
|
+
* A customized and enhanced `RangeError`.
|
|
8
|
+
*/
|
|
9
|
+
IndexOutOfBoundsError: typeof import("../../../../utils/custom/error/constructor/error.custom.js").IndexOutOfBoundsError;
|
|
10
|
+
/**
|
|
11
|
+
* A customized error for invalid properties.
|
|
12
|
+
*/
|
|
13
|
+
InvalidPropertyError: typeof import("../../../../utils/custom/error/constructor/error.custom.js").InvalidPropertyError;
|
|
14
|
+
/**
|
|
15
|
+
* A customized error for missing parameter value.
|
|
16
|
+
*/
|
|
17
|
+
MissingParameterError: typeof import("../../../../utils/custom/error/constructor/error.custom.js").MissingParameterError;
|
|
18
|
+
/**
|
|
19
|
+
* A customized error for missing property.
|
|
20
|
+
*/
|
|
21
|
+
MissingPropertyError: typeof import("../../../../utils/custom/error/constructor/error.custom.js").MissingPropertyError;
|
|
22
|
+
/**
|
|
23
|
+
* A customized error for unqualified element's tag.
|
|
24
|
+
*/
|
|
25
|
+
NoSuchElementTagError: typeof import("../../../../utils/custom/error/constructor/error.custom.js").NoSuchElementTagError;
|
|
26
|
+
/**
|
|
27
|
+
* A customized error for not supported objects, etc.
|
|
28
|
+
*/
|
|
29
|
+
NotSupportedError: typeof import("../../../../utils/custom/error/constructor/error.custom.js").NotSupportedError;
|
|
30
|
+
/**
|
|
31
|
+
* A customized error for unknown property.
|
|
32
|
+
*/
|
|
33
|
+
UnknownPropertyError: typeof import("../../../../utils/custom/error/constructor/error.custom.js").UnknownPropertyError;
|
|
34
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default meta data of custom error constructors.
|
|
3
|
+
*/
|
|
4
|
+
type BaseMeta<OtherArguments extends {} = {}> = {
|
|
5
|
+
Message: string;
|
|
6
|
+
Context?: { Message?: string; Emitter: string };
|
|
7
|
+
Args?: { Id: string } & OtherArguments;
|
|
8
|
+
Guide?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type ArgumentErrorMeta = BaseMeta<{ ReceivedArgument: string, ExpectedArguments: string[] }>;
|
|
12
|
+
type IndexOutOfBoundsErrorMeta = BaseMeta<{ Index: number, MaxBound: number }>;
|
|
13
|
+
type InvalidPropertyError = BaseMeta<{ PropertyId: string }>;
|
|
14
|
+
type MissingParameterError = BaseMeta<{ Value: string }>;
|
|
15
|
+
type MissingPropertyError = BaseMeta<{ PropertyId: string }>;
|
|
16
|
+
type NoSuchElementTagError = BaseMeta<{ Tag: string, TagOf: "HTMLElement" | "MathMLElement" | "SVGElement" }>;
|
|
17
|
+
type NotSupportedError = BaseMeta;
|
|
18
|
+
type UnknownPropertyError = BaseMeta<{ PropertyId: string }>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A collection of customized utilities (`ad-hoc`).
|
|
3
|
+
*/
|
|
4
|
+
type CustomUtilitiesAPI = {
|
|
5
|
+
/**
|
|
6
|
+
* Clamps the current numeric value into its `minimum` and/or `maximum` numeric value.
|
|
7
|
+
*
|
|
8
|
+
* ***Notes***:
|
|
9
|
+
* - If `minimum` is greater than `maximum`, its value will be automatically swapped. (min -> max, max -> min)
|
|
10
|
+
*
|
|
11
|
+
* @param value - The current numeric value to clamp.
|
|
12
|
+
* @param min - The `minimum` numeric value of current numeric value it can be. (Default: 0)
|
|
13
|
+
* @param max - The `maximum` numeric value of current numeric value it can be. (Default: 1)
|
|
14
|
+
* @returns The clamped numeric value.
|
|
15
|
+
*/
|
|
16
|
+
Clamp(value: number, min?: number, max?: number): number;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves the `constructor` or `type` of the specified argument.
|
|
20
|
+
*
|
|
21
|
+
* ***Notes***:
|
|
22
|
+
* - Preferred to return the `constructor` of argument as possible if available, or
|
|
23
|
+
* default to `type` of argument if also available, or else `undefined`.
|
|
24
|
+
*
|
|
25
|
+
* @param arg - The argument to retrieve its `constructor` or `type`.
|
|
26
|
+
* @returns The `constructor` or `type` of the argument in string format.
|
|
27
|
+
*/
|
|
28
|
+
ConstructorOrTypeOf(arg: any): string | undefined;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves the `name` property of the specified object.
|
|
32
|
+
*
|
|
33
|
+
* ***Notes***:
|
|
34
|
+
* - Retrieves the `name` property of the specified object in any case format it can be and returns it.
|
|
35
|
+
* (E.g. Name, NAme, naME, NaMe)
|
|
36
|
+
* - Supports any object that contains a `name` property.
|
|
37
|
+
*
|
|
38
|
+
* @param obj - The object to retrieve `name` property.
|
|
39
|
+
* @returns The `name` property value of the object.
|
|
40
|
+
*/
|
|
41
|
+
NameOf(obj: {}): string;
|
|
42
|
+
}
|