hyperclayjs 1.21.0 → 1.22.0

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 CHANGED
@@ -74,7 +74,7 @@ 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.2KB | el.nearest, el.val, el.text, el.exec, el.cycle |
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
80
  | onaftersave | 1KB | [onaftersave] attribute - run JS when save status changes |
@@ -137,12 +137,12 @@ Essential features for basic editing
137
137
 
138
138
  **Modules:** `save-core`, `snapshot`, `save-system`, `edit-mode-helpers`, `toast`, `save-toast`, `export-to-window`, `view-mode-excludes-edit-modules`
139
139
 
140
- ### Standard (~80.9KB)
140
+ ### Standard (~81.5KB)
141
141
  Standard feature set for most use cases
142
142
 
143
143
  **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
144
 
145
- ### Everything (~215.5KB)
145
+ ### Everything (~216.1KB)
146
146
  All available features
147
147
 
148
148
  Includes all available modules across all categories.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperclayjs",
3
- "version": "1.21.0",
3
+ "version": "1.22.0",
4
4
  "description": "Modular JavaScript library for building interactive malleable HTML files with Hyperclay",
5
5
  "type": "module",
6
6
  "main": "src/hyperclay.js",
@@ -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.21.0 - Minimal Browser-Native Loader
4
+ * HyperclayJS v1.22.0 - 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.