hyperclayjs 1.24.2 → 1.24.3
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 +2 -2
- package/package.json +1 -1
- package/src/communication/behaviorCollector.js +2 -2
- package/src/core/adminSystem.js +4 -0
- package/src/custom-attributes/ajaxElements.js +7 -5
- package/src/dom-utilities/getDataFromForm.js +1 -1
- package/src/hyperclay.js +1 -1
- package/src/utilities/cookie.js +1 -1
package/README.md
CHANGED
|
@@ -73,7 +73,7 @@ import 'hyperclayjs/presets/standard.js';
|
|
|
73
73
|
|
|
74
74
|
| Module | Size | Description |
|
|
75
75
|
|--------|------|-------------|
|
|
76
|
-
| ajax-elements | 2.
|
|
76
|
+
| ajax-elements | 2.8KB | [ajax-form], [ajax-button] for async form submissions |
|
|
77
77
|
| dom-helpers | 6.8KB | el.nearest, el.val, el.text, el.exec, el.cycle |
|
|
78
78
|
| event-attrs | 5.3KB | [onclickaway], [onclickchildren], [onclone], [onpagemutation], [onrender] |
|
|
79
79
|
| input-helpers | 3.9KB | [prevent-enter], [autosize] for textareas |
|
|
@@ -144,7 +144,7 @@ Standard feature set for most use cases
|
|
|
144
144
|
|
|
145
145
|
**Modules:** `save-core`, `snapshot`, `save-system`, `unsaved-warning`, `edit-mode-helpers`, `persist`, `option-visibility`, `event-attrs`, `dom-helpers`, `toast`, `save-toast`, `export-to-window`, `view-mode-excludes-edit-modules`
|
|
146
146
|
|
|
147
|
-
### Everything (~225.
|
|
147
|
+
### Everything (~225.5KB)
|
|
148
148
|
All available features
|
|
149
149
|
|
|
150
150
|
Includes all available modules across all categories.
|
package/package.json
CHANGED
|
@@ -84,7 +84,7 @@ const behaviorCollector = (() => {
|
|
|
84
84
|
const scrollEvent = {
|
|
85
85
|
position: position,
|
|
86
86
|
timestamp: now,
|
|
87
|
-
direction: position > data.navigation.lastScrollPosition ? 'down' : 'up',
|
|
87
|
+
direction: position === data.navigation.lastScrollPosition ? null : (position > data.navigation.lastScrollPosition ? 'down' : 'up'),
|
|
88
88
|
isTrusted: e.isTrusted
|
|
89
89
|
};
|
|
90
90
|
|
|
@@ -96,7 +96,7 @@ const behaviorCollector = (() => {
|
|
|
96
96
|
|
|
97
97
|
if (data.scrollEvents.length > 1) {
|
|
98
98
|
const lastEvent = data.scrollEvents[data.scrollEvents.length - 2];
|
|
99
|
-
if (lastEvent.direction !== scrollEvent.direction) {
|
|
99
|
+
if (lastEvent.direction && scrollEvent.direction && lastEvent.direction !== scrollEvent.direction) {
|
|
100
100
|
data.navigation.scrollDirectionChanges++;
|
|
101
101
|
}
|
|
102
102
|
}
|
package/src/core/adminSystem.js
CHANGED
|
@@ -4,7 +4,11 @@ import { init as initInputs } from './adminInputs.js';
|
|
|
4
4
|
import { init as initOnClick } from './adminOnClick.js';
|
|
5
5
|
import { init as initResources } from './adminResources.js';
|
|
6
6
|
|
|
7
|
+
let initialized = false;
|
|
8
|
+
|
|
7
9
|
function init() {
|
|
10
|
+
if (initialized) return;
|
|
11
|
+
initialized = true;
|
|
8
12
|
initContenteditable();
|
|
9
13
|
initInputs();
|
|
10
14
|
initOnClick();
|
|
@@ -49,11 +49,13 @@ function submitAjax(elem) {
|
|
|
49
49
|
},
|
|
50
50
|
body: JSON.stringify(data)
|
|
51
51
|
})
|
|
52
|
-
.then(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
.then(async (res) => {
|
|
53
|
+
const contentType = res.headers.get('content-type') || '';
|
|
54
|
+
let resData = {};
|
|
55
|
+
if (res.status !== 204 && contentType.includes('application/json')) {
|
|
56
|
+
resData = await res.json();
|
|
57
|
+
}
|
|
58
|
+
handleResponse(elem, { ...resData, ok: res.ok, msgType: res.ok ? "success" : "error" });
|
|
57
59
|
})
|
|
58
60
|
.catch(error => console.error('Error:', error));
|
|
59
61
|
});
|
|
@@ -5,7 +5,7 @@ function getDataFromForm(container) {
|
|
|
5
5
|
// Helper function to process a single element
|
|
6
6
|
const processElement = (elem) => {
|
|
7
7
|
const name = elem.getAttribute('name');
|
|
8
|
-
const value = elem.
|
|
8
|
+
const value = elem.value || elem.getAttribute('value');
|
|
9
9
|
|
|
10
10
|
// Skip elements without a name or with a disabled attribute
|
|
11
11
|
if (!name || elem.disabled) return;
|
package/src/hyperclay.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* DO NOT EDIT THIS FILE DIRECTLY — it is generated from build/hyperclay.template.js
|
|
3
3
|
*
|
|
4
|
-
* HyperclayJS v1.24.
|
|
4
|
+
* HyperclayJS v1.24.3 - Minimal Browser-Native Loader
|
|
5
5
|
*
|
|
6
6
|
* Modules auto-init when imported (no separate init call needed).
|
|
7
7
|
* Include `export-to-window` feature to export to window.hyperclay.
|
package/src/utilities/cookie.js
CHANGED
|
@@ -3,7 +3,7 @@ function get (cookieName) {
|
|
|
3
3
|
const cookies = document.cookie.split('; ');
|
|
4
4
|
const cookie = cookies.find(row => row.startsWith(`${cookieName}=`));
|
|
5
5
|
if (!cookie) return null;
|
|
6
|
-
const cookieValue = cookie.
|
|
6
|
+
const cookieValue = cookie.slice(cookieName.length + 1);
|
|
7
7
|
try {
|
|
8
8
|
return JSON.parse(decodeURIComponent(cookieValue));
|
|
9
9
|
} catch (err) {
|