hyperclayjs 1.21.0 → 1.22.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 +4 -3
- package/package.json +1 -1
- package/src/custom-attributes/domHelpers.js +26 -0
- package/src/hyperclay.js +5 -1
package/README.md
CHANGED
|
@@ -74,9 +74,10 @@ import 'hyperclayjs/presets/standard.js';
|
|
|
74
74
|
| Module | Size | Description |
|
|
75
75
|
|--------|------|-------------|
|
|
76
76
|
| ajax-elements | 2.6KB | [ajax-form], [ajax-button] for async form submissions |
|
|
77
|
-
| dom-helpers | 6.
|
|
77
|
+
| dom-helpers | 6.8KB | el.nearest, el.val, el.text, el.exec, el.cycle |
|
|
78
78
|
| event-attrs | 4.6KB | [onclickaway], [onclickchildren], [onclone], [onpagemutation], [onrender] |
|
|
79
79
|
| input-helpers | 3.9KB | [prevent-enter], [autosize] for textareas |
|
|
80
|
+
| movable | 2.5KB | Free-positioning drag with [movable] and [movable-handle], edit mode only |
|
|
80
81
|
| onaftersave | 1KB | [onaftersave] attribute - run JS when save status changes |
|
|
81
82
|
| sortable | 3.4KB | Drag-drop sorting with [sortable], lazy-loads ~118KB Sortable.js in edit mode |
|
|
82
83
|
|
|
@@ -137,12 +138,12 @@ Essential features for basic editing
|
|
|
137
138
|
|
|
138
139
|
**Modules:** `save-core`, `snapshot`, `save-system`, `edit-mode-helpers`, `toast`, `save-toast`, `export-to-window`, `view-mode-excludes-edit-modules`
|
|
139
140
|
|
|
140
|
-
### Standard (~
|
|
141
|
+
### Standard (~81.5KB)
|
|
141
142
|
Standard feature set for most use cases
|
|
142
143
|
|
|
143
144
|
**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`
|
|
144
145
|
|
|
145
|
-
### Everything (~
|
|
146
|
+
### Everything (~218.6KB)
|
|
146
147
|
All available features
|
|
147
148
|
|
|
148
149
|
Includes all available modules across all categories.
|
package/package.json
CHANGED
|
@@ -8,7 +8,23 @@ function init () {
|
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
// elem.el.menu returns nearest element with a "menu" attribute (alias for elem.nearest.menu)
|
|
11
12
|
// elem.nearest.project returns nearest element with a "project" attribute
|
|
13
|
+
Object.defineProperty(HTMLElement.prototype, 'el', {
|
|
14
|
+
configurable: true,
|
|
15
|
+
get: function() {
|
|
16
|
+
let element = this;
|
|
17
|
+
|
|
18
|
+
const handler = {
|
|
19
|
+
get(target, prop) {
|
|
20
|
+
return nearest(element, `[${prop}], .${prop}`);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return new Proxy({}, handler);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
12
28
|
Object.defineProperty(HTMLElement.prototype, 'nearest', {
|
|
13
29
|
configurable: true,
|
|
14
30
|
get: function() {
|
|
@@ -183,6 +199,16 @@ function init () {
|
|
|
183
199
|
if (next) this.setAttribute(setAttr, next);
|
|
184
200
|
};
|
|
185
201
|
|
|
202
|
+
Element.prototype.show = function() {
|
|
203
|
+
this.style.display = '';
|
|
204
|
+
return this;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
Element.prototype.hide = function() {
|
|
208
|
+
this.style.display = 'none';
|
|
209
|
+
return this;
|
|
210
|
+
};
|
|
211
|
+
|
|
186
212
|
}
|
|
187
213
|
|
|
188
214
|
// Auto-export to window unless suppressed by loader
|
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.
|
|
4
|
+
* HyperclayJS v1.22.1 - 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.
|
|
@@ -40,6 +40,7 @@ const MODULE_PATHS = {
|
|
|
40
40
|
"event-attrs": "./custom-attributes/events.js",
|
|
41
41
|
"ajax-elements": "./custom-attributes/ajaxElements.js",
|
|
42
42
|
"sortable": "./custom-attributes/sortable.js",
|
|
43
|
+
"movable": "./custom-attributes/movable.js",
|
|
43
44
|
"dom-helpers": "./custom-attributes/domHelpers.js",
|
|
44
45
|
"input-helpers": "./custom-attributes/inputHelpers.js",
|
|
45
46
|
"onaftersave": "./custom-attributes/onaftersave.js",
|
|
@@ -119,6 +120,7 @@ const PRESETS = {
|
|
|
119
120
|
"event-attrs",
|
|
120
121
|
"ajax-elements",
|
|
121
122
|
"sortable",
|
|
123
|
+
"movable",
|
|
122
124
|
"dom-helpers",
|
|
123
125
|
"input-helpers",
|
|
124
126
|
"onaftersave",
|
|
@@ -162,6 +164,7 @@ const PRESETS = {
|
|
|
162
164
|
"event-attrs",
|
|
163
165
|
"ajax-elements",
|
|
164
166
|
"sortable",
|
|
167
|
+
"movable",
|
|
165
168
|
"dom-helpers",
|
|
166
169
|
"input-helpers",
|
|
167
170
|
"onaftersave",
|
|
@@ -203,6 +206,7 @@ const EDIT_MODE_ONLY = new Set([
|
|
|
203
206
|
"persist",
|
|
204
207
|
"snapshot",
|
|
205
208
|
"sortable",
|
|
209
|
+
"movable",
|
|
206
210
|
"onaftersave",
|
|
207
211
|
"cache-bust",
|
|
208
212
|
"hyper-morph",
|