aprog 1.3.6 → 1.3.8
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 +3 -1
- package/index.js +3 -2
- package/package.json +1 -1
- package/src/aprog.js +4 -30
- package/src/storage.js +40 -0
package/README.md
CHANGED
|
@@ -148,7 +148,7 @@ onInput: (event) => {
|
|
|
148
148
|
- *encrypt(str), decrypt(encryptedStr)*
|
|
149
149
|
|
|
150
150
|
- *div, span, button, a, img, meta, label, input, select, option, options, form, hr, textarea, table, caption, thead, tbody, tr, th, td, pre*
|
|
151
|
-
- *_get, GUID, apState,
|
|
151
|
+
- *_get, GUID, apState, date, pause, apFetch, chars, elementToObject, copyText, scrollToTop, scrollToBottom, firstKey, checkArrays, ucfirst, deepEqual, nodeListToObject*
|
|
152
152
|
- *isEmpty, isNull, isFloat, isNumeric, isObject, isArray, isNumber, isString, isPromise, isNull, isFloat, isNumeric, isObject*
|
|
153
153
|
|
|
154
154
|
- *router({ routes, main, "Page Not Found" })*
|
|
@@ -157,6 +157,8 @@ onInput: (event) => {
|
|
|
157
157
|
|
|
158
158
|
- *mathInput(event.target)*
|
|
159
159
|
|
|
160
|
+
- *cookie, storage*
|
|
161
|
+
|
|
160
162
|
### Info
|
|
161
163
|
|
|
162
164
|
- Додано безплатний чат із Gemini
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export {
|
|
2
2
|
div, span, button, a, img, meta, label, input, select, option, options, form, hr, textarea,
|
|
3
|
-
table, caption, thead, tbody, tr, th, td, pre, _get, GUID, isEmpty, apState,
|
|
3
|
+
table, caption, thead, tbody, tr, th, td, pre, _get, GUID, isEmpty, apState, date, pause, apFetch,
|
|
4
4
|
chars, isNull, isFloat, isNumeric, isObject, elementToObject, copyText, scrollToTop, scrollToBottom,
|
|
5
5
|
firstKey, isArray, checkArrays, isNumber, isString, isPromise, ucfirst, deepEqual, nodeListToObject
|
|
6
6
|
} from './src/aprog.js';
|
|
@@ -9,4 +9,5 @@ export { redirect, reload } from './src/redirect.js';
|
|
|
9
9
|
export { router, navigateTo } from './src/router.js';
|
|
10
10
|
export { encrypt, decrypt } from './src/shifrator.js';
|
|
11
11
|
export { gemini } from './src/OpenAI.js';
|
|
12
|
-
export { mathInput } from './src/math.js';
|
|
12
|
+
export { mathInput } from './src/math.js';
|
|
13
|
+
export { cookie, storage } from './src/storage.js';
|
package/package.json
CHANGED
package/src/aprog.js
CHANGED
|
@@ -93,14 +93,15 @@ export const isNull = (value) => {
|
|
|
93
93
|
const isHtmlElement = (value) => {
|
|
94
94
|
const htmlElements = [
|
|
95
95
|
'HTMLDivElement', "HTMLAnchorElement", 'HTMLSpanElement',
|
|
96
|
-
'HTMLButtonElement', 'HTMLSelectElement',
|
|
96
|
+
'HTMLButtonElement', 'HTMLSelectElement', "HTMLMainElement",
|
|
97
97
|
'HTMLInputElement', 'HTMLUlElement', "Promise",
|
|
98
|
-
'HTMLListElement', 'HTMLLabelElement',
|
|
98
|
+
'HTMLListElement', 'HTMLLabelElement', "HTMLTableCaptionElement",
|
|
99
99
|
'HTMLHRElement', 'SVGSVGElement', 'HTMLPreElement',
|
|
100
100
|
'Promise', "HTMLTextAreaElement", "HTMLTableElement",
|
|
101
101
|
"HTMLTHeaderElement", "HTMLTBodyElement", "HTMLTRElement",
|
|
102
102
|
"HTMLTHElement", "HTMLTDElement", "HTMLTableSectionElement",
|
|
103
|
-
"HTMLTableRowElement", "HTMLTableCellElement", "HTMLImageElement"
|
|
103
|
+
"HTMLTableRowElement", "HTMLTableCellElement", "HTMLImageElement",
|
|
104
|
+
"HTMLSectionElement"
|
|
104
105
|
]
|
|
105
106
|
|
|
106
107
|
return htmlElements.some((element) => {
|
|
@@ -1323,33 +1324,6 @@ export const GUID = () => {
|
|
|
1323
1324
|
});
|
|
1324
1325
|
}
|
|
1325
1326
|
|
|
1326
|
-
export const cookie = {
|
|
1327
|
-
get(name) {
|
|
1328
|
-
const cookies = document.cookie.split('; ');
|
|
1329
|
-
for (let cookie of cookies) {
|
|
1330
|
-
let [key, value] = cookie.split('=');
|
|
1331
|
-
if (key === name) {
|
|
1332
|
-
return decodeURIComponent(value);
|
|
1333
|
-
}
|
|
1334
|
-
}
|
|
1335
|
-
return null;
|
|
1336
|
-
},
|
|
1337
|
-
|
|
1338
|
-
set(name, value, days = 7) {
|
|
1339
|
-
let expires = "";
|
|
1340
|
-
if (days) {
|
|
1341
|
-
let date = new Date();
|
|
1342
|
-
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
|
|
1343
|
-
expires = "; expires=" + date.toUTCString();
|
|
1344
|
-
}
|
|
1345
|
-
document.cookie = name + "=" + encodeURIComponent(value) + expires + "; path=/";
|
|
1346
|
-
},
|
|
1347
|
-
|
|
1348
|
-
delete(name) {
|
|
1349
|
-
document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
1350
|
-
}
|
|
1351
|
-
};
|
|
1352
|
-
|
|
1353
1327
|
export const checkArrays = (arr1, arr2, checkAll = false) => {
|
|
1354
1328
|
const set1 = new Set(arr1);
|
|
1355
1329
|
if (checkAll) {
|
package/src/storage.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const cookie = {
|
|
2
|
+
get(name) {
|
|
3
|
+
const cookies = document.cookie.split('; ');
|
|
4
|
+
for (let cookie of cookies) {
|
|
5
|
+
let [key, value] = cookie.split('=');
|
|
6
|
+
if (key === name) {
|
|
7
|
+
return decodeURIComponent(value);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
set(name, value, days = 7) {
|
|
14
|
+
let expires = "";
|
|
15
|
+
if (days) {
|
|
16
|
+
let date = new Date();
|
|
17
|
+
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
|
|
18
|
+
expires = "; expires=" + date.toUTCString();
|
|
19
|
+
}
|
|
20
|
+
document.cookie = name + "=" + encodeURIComponent(value) + expires + "; path=/";
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
delete(name) {
|
|
24
|
+
document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const storage = {
|
|
29
|
+
get(key, defaulting = null) {
|
|
30
|
+
return JSON.parse(localStorage.getItem(key)) || defaulting;
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
set(key, data) {
|
|
34
|
+
localStorage.setItem(key, JSON.stringify(data));
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
delete(key) {
|
|
38
|
+
localStorage.removeItem(key);
|
|
39
|
+
}
|
|
40
|
+
};
|