aprog 1.5.9 → 1.6.1
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 +22 -22
- package/index.js +3 -2
- package/package.json +1 -1
- package/src/aprog.js +14 -4
- package/src/paginate.js +6 -2
package/README.md
CHANGED
|
@@ -54,27 +54,6 @@ document.addEventListener("DOMContentLoaded", async function() {
|
|
|
54
54
|
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
Створення Pages:
|
|
58
|
-
|
|
59
|
-
```shell
|
|
60
|
-
|
|
61
|
-
const NamePage = () => {
|
|
62
|
-
return div({
|
|
63
|
-
class: "w-full h-screen flex flex-col items-center justify-center text-3xl",
|
|
64
|
-
value: [
|
|
65
|
-
div({
|
|
66
|
-
class: "text-red font-bold text-5xl",
|
|
67
|
-
value: "Блок №1"
|
|
68
|
-
}),
|
|
69
|
-
div({value: "Блок №2"})
|
|
70
|
-
]
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export default NamePage;
|
|
75
|
-
|
|
76
|
-
```
|
|
77
|
-
|
|
78
57
|
Приклад використання методів формування HTML елементів:
|
|
79
58
|
|
|
80
59
|
```shell
|
|
@@ -96,6 +75,27 @@ document.body.appendChild(elDiv);
|
|
|
96
75
|
|
|
97
76
|
```
|
|
98
77
|
|
|
78
|
+
Створення Pages:
|
|
79
|
+
|
|
80
|
+
```shell
|
|
81
|
+
|
|
82
|
+
const NamePage = () => {
|
|
83
|
+
return div({
|
|
84
|
+
class: "w-full h-screen flex flex-col items-center justify-center text-3xl",
|
|
85
|
+
value: [
|
|
86
|
+
div({
|
|
87
|
+
class: "text-red font-bold text-5xl",
|
|
88
|
+
value: "Блок №1"
|
|
89
|
+
}),
|
|
90
|
+
div({value: "Блок №2"})
|
|
91
|
+
]
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export default NamePage;
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
|
|
99
99
|
Приклад використання методів дебагу:
|
|
100
100
|
|
|
101
101
|
```shell
|
|
@@ -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, attachCustomTitle*
|
|
151
|
-
- *_get, GUID, apState, date, pause, apFetch, chars, elementToObject, copyText, scrollToTop, scrollToBottom, firstKey, checkArrays, ucfirst, deepEqual, nodeListToObject*
|
|
151
|
+
- *_get, _getAll, 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" })*
|
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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,
|
|
3
|
+
table, caption, thead, tbody, tr, th, td, pre,
|
|
4
|
+
attachCustomTitle, _get, _getAll, GUID, isEmpty, apState, date, pause, apFetch,
|
|
4
5
|
chars, isNull, isFloat, isNumeric, isObject, elementToObject, copyText, scrollToTop, scrollToBottom,
|
|
5
6
|
firstKey, isArray, checkArrays, isNumber, isString, isPromise, ucfirst, deepEqual, nodeListToObject
|
|
6
7
|
} from './src/aprog.js';
|
|
@@ -11,4 +12,4 @@ export { encrypt, decrypt } from './src/shifrator.js';
|
|
|
11
12
|
export { gemini } from './src/OpenAI.js';
|
|
12
13
|
export { mathInput } from './src/math.js';
|
|
13
14
|
export { cookie, storage } from './src/storage.js';
|
|
14
|
-
export { paginate, parseData } from './src/
|
|
15
|
+
export { paginate, parseData } from './src/paginate.js';
|
package/package.json
CHANGED
package/src/aprog.js
CHANGED
|
@@ -1314,7 +1314,17 @@ export const _get = (name, defaulting = null) => {
|
|
|
1314
1314
|
: searchParams.get(name);
|
|
1315
1315
|
}
|
|
1316
1316
|
return defaulting;
|
|
1317
|
-
}
|
|
1317
|
+
};
|
|
1318
|
+
|
|
1319
|
+
export const _getAll = () => {
|
|
1320
|
+
let url = new URL(window.location.href);
|
|
1321
|
+
let searchParams = new URLSearchParams(url.search);
|
|
1322
|
+
let params = {};
|
|
1323
|
+
searchParams.forEach((value, key) => {
|
|
1324
|
+
params[key] = isFloat(value) || isNumeric(value) ? parseFloat(value) : value;
|
|
1325
|
+
});
|
|
1326
|
+
return params;
|
|
1327
|
+
};
|
|
1318
1328
|
|
|
1319
1329
|
export const GUID = () => {
|
|
1320
1330
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (char) {
|
|
@@ -1322,7 +1332,7 @@ export const GUID = () => {
|
|
|
1322
1332
|
const value = char === 'x' ? random : (random & 0x3 | 0x8);
|
|
1323
1333
|
return value.toString(16);
|
|
1324
1334
|
});
|
|
1325
|
-
}
|
|
1335
|
+
};
|
|
1326
1336
|
|
|
1327
1337
|
export const checkArrays = (arr1, arr2, checkAll = false) => {
|
|
1328
1338
|
const set1 = new Set(arr1);
|
|
@@ -1331,7 +1341,7 @@ export const checkArrays = (arr1, arr2, checkAll = false) => {
|
|
|
1331
1341
|
} else {
|
|
1332
1342
|
return arr2.some(item => set1.has(item));
|
|
1333
1343
|
}
|
|
1334
|
-
}
|
|
1344
|
+
};
|
|
1335
1345
|
|
|
1336
1346
|
const customTitle = (text) => {
|
|
1337
1347
|
const title = div({
|
|
@@ -1351,7 +1361,7 @@ const customTitle = (text) => {
|
|
|
1351
1361
|
},
|
|
1352
1362
|
value: text
|
|
1353
1363
|
});
|
|
1354
|
-
document.body.
|
|
1364
|
+
document.body.appendChild(title);
|
|
1355
1365
|
|
|
1356
1366
|
return title;
|
|
1357
1367
|
};
|
package/src/paginate.js
CHANGED
|
@@ -119,9 +119,13 @@ export const paginate = ({ count = 0, currentPage = 1, onPageChange = () => {},
|
|
|
119
119
|
|
|
120
120
|
const navigateTo = (path) => {
|
|
121
121
|
window.history.pushState("", "", path);
|
|
122
|
-
}
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
let url = new URL(window.location.href);
|
|
125
|
+
let searchParams = new URLSearchParams(url.search);
|
|
123
126
|
|
|
124
|
-
|
|
127
|
+
searchParams.set("page", String(currentPage || 1));
|
|
128
|
+
navigateTo(`${window.location.pathname}?${searchParams.toString()}`);
|
|
125
129
|
|
|
126
130
|
return div({
|
|
127
131
|
class: "paginate-block",
|