hyperclayjs 1.2.0 → 1.3.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 +44 -57
- package/communication/behaviorCollector.js +8 -1
- package/communication/sendMessage.js +8 -2
- package/communication/uploadFile.js +8 -2
- package/core/adminSystem.js +3 -0
- package/core/autosave.js +95 -0
- package/core/editmodeSystem.js +10 -8
- package/core/enablePersistentFormInputValues.js +8 -1
- package/core/optionVisibilityRuleGenerator.js +9 -1
- package/core/savePage.js +28 -71
- package/core/savePageCore.js +7 -14
- package/custom-attributes/ajaxElements.js +4 -0
- package/custom-attributes/domHelpers.js +9 -0
- package/custom-attributes/events.js +3 -0
- package/custom-attributes/inputHelpers.js +3 -0
- package/custom-attributes/sortable.js +9 -1
- package/dom-utilities/All.js +4 -7
- package/dom-utilities/getDataFromForm.js +9 -2
- package/dom-utilities/insertStyleTag.js +9 -2
- package/dom-utilities/onDomReady.js +8 -2
- package/dom-utilities/onLoad.js +8 -2
- package/hyperclay.js +106 -692
- package/module-dependency-graph.json +175 -137
- package/package.json +3 -3
- package/string-utilities/copy-to-clipboard.js +3 -7
- package/string-utilities/emmet-html.js +8 -2
- package/string-utilities/query.js +8 -1
- package/string-utilities/slugify.js +4 -7
- package/ui/info.js +9 -1
- package/ui/prompts.js +19 -12
- package/ui/theModal.js +4 -4
- package/ui/toast-hyperclay.js +5 -9
- package/ui/toast.js +4 -7
- package/utilities/cookie.js +4 -7
- package/utilities/debounce.js +10 -4
- package/utilities/mutation.js +5 -0
- package/utilities/nearest.js +6 -1
- package/utilities/throttle.js +8 -2
- package/vendor/idiomorph.min.js +9 -1
- package/README.template.md +0 -276
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hyperclayjs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Modular JavaScript library for building interactive HTML applications with Hyperclay",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "hyperclay.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"module-dependency-graph.json"
|
|
33
33
|
],
|
|
34
34
|
"scripts": {
|
|
35
|
-
"dev": "npm run build && http-server -p 3535 -o /index.html",
|
|
35
|
+
"dev": "npm run build && http-server -p 3535 -c-1 -o /index.html",
|
|
36
36
|
"build": "npm run generate:deps && npm run build:loader && npm run build:readme && npm run build:load-jsdelivr && npm run build:index-url",
|
|
37
37
|
"generate:deps": "node build/generate-dependency-graph.js",
|
|
38
38
|
"build:loader": "node build/build-loader.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"format": "prettier --write .",
|
|
45
45
|
"release": "./scripts/release.sh",
|
|
46
46
|
"prepublishOnly": "npm run build && npm test",
|
|
47
|
-
"postpublish": "test -n \"$SKIP_POSTPUBLISH\" || open http://127.0.0.1:3535/load-jsdelivr.html"
|
|
47
|
+
"postpublish": "test -n \"$SKIP_POSTPUBLISH\" || open http://127.0.0.1:3535/build/load-jsdelivr.html"
|
|
48
48
|
},
|
|
49
49
|
"repository": {
|
|
50
50
|
"type": "git",
|
|
@@ -24,12 +24,8 @@ function copyToClipboard(text) {
|
|
|
24
24
|
document.body.removeChild(textarea);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
window.hyperclay = {};
|
|
31
|
-
}
|
|
32
|
-
window.hyperclay.copyToClipboard = copyToClipboard;
|
|
33
|
-
}
|
|
27
|
+
// Self-export to hyperclay only
|
|
28
|
+
window.hyperclay = window.hyperclay || {};
|
|
29
|
+
window.hyperclay.copyToClipboard = copyToClipboard;
|
|
34
30
|
|
|
35
31
|
export default copyToClipboard;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
function emmet(strings, ...values) {
|
|
2
2
|
// Extract the Emmet syntax from the first string
|
|
3
3
|
let emmetSyntax = strings[0];
|
|
4
4
|
|
|
@@ -51,4 +51,10 @@ export default function emmet(strings, ...values) {
|
|
|
51
51
|
html += `</${tagName}>`;
|
|
52
52
|
|
|
53
53
|
return html;
|
|
54
|
-
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Self-export to hyperclay only
|
|
57
|
+
window.hyperclay = window.hyperclay || {};
|
|
58
|
+
window.hyperclay.emmet = emmet;
|
|
59
|
+
|
|
60
|
+
export default emmet;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
const query = Object.fromEntries(new URLSearchParams(window.location.search));
|
|
2
|
+
|
|
3
|
+
// Self-export to window and hyperclay
|
|
4
|
+
window.query = query;
|
|
5
|
+
window.hyperclay = window.hyperclay || {};
|
|
6
|
+
window.hyperclay.query = query;
|
|
7
|
+
|
|
8
|
+
export default query;
|
|
@@ -10,12 +10,9 @@ function slugify (text) {
|
|
|
10
10
|
.replace(/-+$/, ''); // trim - from end of text
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
window.hyperclay.slugify = slugify;
|
|
19
|
-
}
|
|
13
|
+
// Self-export to window and hyperclay
|
|
14
|
+
window.slugify = slugify;
|
|
15
|
+
window.hyperclay = window.hyperclay || {};
|
|
16
|
+
window.hyperclay.slugify = slugify;
|
|
20
17
|
|
|
21
18
|
export default slugify;
|
package/ui/info.js
CHANGED
|
@@ -36,4 +36,12 @@ export function init() {
|
|
|
36
36
|
document.body.style.overflow = "";
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
|
-
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Self-export to window and hyperclay
|
|
42
|
+
window.info = info;
|
|
43
|
+
window.hyperclay = window.hyperclay || {};
|
|
44
|
+
window.hyperclay.info = info;
|
|
45
|
+
|
|
46
|
+
// Auto-init when module is imported
|
|
47
|
+
init();
|
package/ui/prompts.js
CHANGED
|
@@ -2,6 +2,7 @@ import themodal from "./theModal.js";
|
|
|
2
2
|
import onDomReady from "../dom-utilities/onDomReady.js";
|
|
3
3
|
import toast from "./toast.js";
|
|
4
4
|
import copyToClipboard from "../string-utilities/copy-to-clipboard.js";
|
|
5
|
+
import { info } from "./info.js";
|
|
5
6
|
|
|
6
7
|
const CLOSE_BUTTON_SVG = `<svg class="group" viewBox="0 0 134 134" fill="none" xmlns="http://www.w3.org/2000/svg"><path class="fill-[#1D2032] group-hover:fill-[#212543]" d="M132 132.5 1 1.5h131v131Z" /><path fill-rule="evenodd" clip-rule="evenodd" d="M0 0h3v1.5h1.5V3H6v1.5h1.5V6H9v1.5h1.5V9H12v1.5h1.5V12H15v1.5h1.5V15H18v1.5h1.5V18H21v1.5h1.5V21H24v1.5h1.5V24H27v1.5h1.5V27H30v1.5h1.5V30H33v1.5h1.5V33H36v1.5h1.5V36H39v1.5h1.5V39H42v1.5h1.5V42H45v1.5h1.5V45H48v1.5h1.5V48H51v1.5h1.5V51H54v1.5h1.5V54H57v1.5h1.5V57H60v1.5h1.5V60H63v1.5h1.5V63H66v1.5h1.5V66H69v1.5h1.5V69H72v1.5h1.5V72H75v1.5h1.5V75H78v1.5h1.5V78H81v1.5h1.5V81H84v1.5h1.5V84H87v1.5h1.5V87H90v1.5h1.5V90H93v1.5h1.5V93H96v1.5h1.5V96H99v1.5h1.5V99h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v3h-3V132H129v-1.5h-1.5V129H126v-1.5h-1.5V126H123v-1.5h-1.5V123H120v-1.5h-1.5V120H117v-1.5h-1.5V117H114v-1.5h-1.5V114H111v-1.5h-1.5V111H108v-1.5h-1.5V108H105v-1.5h-1.5V105H102v-1.5h-1.5V102H99v-1.5h-1.5V99H96v-1.5h-1.5V96H93v-1.5h-1.5V93H90v-1.5h-1.5V90H87v-1.5h-1.5V87H84v-1.5h-1.5V84H81v-1.5h-1.5V81H78v-1.5h-1.5V78H75v-1.5h-1.5V75H72v-1.5h-1.5V72H69v-1.5h-1.5V69H66v-1.5h-1.5V66H63v-1.5h-1.5V63H60v-1.5h-1.5V60H57v-1.5h-1.5V57H54v-1.5h-1.5V54H51v-1.5h-1.5V51H48v-1.5h-1.5V48H45v-1.5h-1.5V45H42v-1.5h-1.5V42H39v-1.5h-1.5V39H36v-1.5h-1.5V36H33v-1.5h-1.5V33H30v-1.5h-1.5V30H27v-1.5h-1.5V27H24v-1.5h-1.5V24H21v-1.5h-1.5V21H18v-1.5h-1.5V18H15v-1.5h-1.5V15H12v-1.5h-1.5V12H9v-1.5H7.5V9H6V7.5H4.5V6H3V4.5H1.5V3H0V0ZM108.8 22h5.2v5.1h-2.6v2.6H109v2.6h-2.6v2.6h-2.6v2.5h-2.6v5.2h2.6V45h2.6v2.6h2.6v2.6h2.5v2.6h2.6V58h-5.1v-2.6h-2.6V53h-2.6v-2.6h-2.6v-2.6h-2.5v-2.6h-5.2v2.6H91v2.6h-2.6v2.6h-2.6v2.5h-2.6V58H78v-5.1h2.6v-2.6H83v-2.6h2.6v-2.6h2.6v-2.5h2.6v-5.2h-2.6V35h-2.6v-2.6h-2.6v-2.6h-2.5v-2.6H78V22h5.2v2.6h2.5V27h2.6v2.6h2.6v2.6h2.5v2.6h5.2v-2.6h2.5v-2.6h2.6v-2.6h2.6v-2.5h2.5V22Z" fill="#fff"/></svg>`;
|
|
7
8
|
const CONFIRM_BUTTON_SVG = `<div style="width: 28px;"><svg viewBox="0 0 60 33" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M34.5 0.75H43.5V5.25H49V9.75H54.5V14.25H60V18.75H54.5V23.25H49V27.75H43.5V32.25H34.5V27.75H40V23.25H45.5V18.75H0V14.25H45.5V9.75H40V5.25H34.5V0.75Z" fill="white"/></svg></div>`;
|
|
@@ -165,15 +166,21 @@ export function init() {
|
|
|
165
166
|
});
|
|
166
167
|
}
|
|
167
168
|
|
|
168
|
-
//
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
169
|
+
// Self-export to window and hyperclay
|
|
170
|
+
window.ask = ask;
|
|
171
|
+
window.consent = consent;
|
|
172
|
+
window.tell = tell;
|
|
173
|
+
window.info = info;
|
|
174
|
+
window.hyperclay = window.hyperclay || {};
|
|
175
|
+
window.hyperclay.ask = ask;
|
|
176
|
+
window.hyperclay.consent = consent;
|
|
177
|
+
window.hyperclay.tell = tell;
|
|
178
|
+
window.hyperclay.info = info;
|
|
179
|
+
window.hyperclay.snippet = snippet;
|
|
180
|
+
window.hyperclay.showApiKey = showApiKey;
|
|
181
|
+
|
|
182
|
+
// Re-export info
|
|
183
|
+
export { info };
|
|
184
|
+
|
|
185
|
+
// Auto-init when module is imported
|
|
186
|
+
init();
|
package/ui/theModal.js
CHANGED
|
@@ -669,9 +669,9 @@ const themodal = (() => {
|
|
|
669
669
|
return themodalMain;
|
|
670
670
|
})();
|
|
671
671
|
|
|
672
|
-
//
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
672
|
+
// Self-export to window and hyperclay
|
|
673
|
+
window.themodal = themodal;
|
|
674
|
+
window.hyperclay = window.hyperclay || {};
|
|
675
|
+
window.hyperclay.themodal = themodal;
|
|
676
676
|
|
|
677
677
|
export default themodal;
|
package/ui/toast-hyperclay.js
CHANGED
|
@@ -13,13 +13,9 @@ import toast from './toast.js';
|
|
|
13
13
|
// Automatically apply legacy styling for Hyperclay platform
|
|
14
14
|
toast.useLegacy();
|
|
15
15
|
|
|
16
|
-
//
|
|
17
|
-
|
|
16
|
+
// Self-export (overwrites modern toast with legacy version)
|
|
17
|
+
window.toast = toast;
|
|
18
|
+
window.hyperclay = window.hyperclay || {};
|
|
19
|
+
window.hyperclay.toast = toast;
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
export function exportToWindow() {
|
|
21
|
-
if (!window.hyperclay) {
|
|
22
|
-
window.hyperclay = {};
|
|
23
|
-
}
|
|
24
|
-
window.hyperclay.toast = toast;
|
|
25
|
-
}
|
|
21
|
+
export default toast;
|
package/ui/toast.js
CHANGED
|
@@ -260,13 +260,10 @@ toast.useLegacy = function() {
|
|
|
260
260
|
// Initialize with default styles when script loads
|
|
261
261
|
injectStyles(defaultStyles);
|
|
262
262
|
|
|
263
|
-
//
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
window.hyperclay.toast = toast;
|
|
269
|
-
}
|
|
263
|
+
// Self-export to window and hyperclay
|
|
264
|
+
window.toast = toast;
|
|
265
|
+
window.hyperclay = window.hyperclay || {};
|
|
266
|
+
window.hyperclay.toast = toast;
|
|
270
267
|
|
|
271
268
|
// toast("Site copied");
|
|
272
269
|
// toast("Site name taken", "error");
|
package/utilities/cookie.js
CHANGED
|
@@ -34,12 +34,9 @@ const cookie = {
|
|
|
34
34
|
remove
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
window.hyperclay.cookie = cookie;
|
|
43
|
-
}
|
|
37
|
+
// Self-export to window and hyperclay
|
|
38
|
+
window.cookie = cookie;
|
|
39
|
+
window.hyperclay = window.hyperclay || {};
|
|
40
|
+
window.hyperclay.cookie = cookie;
|
|
44
41
|
|
|
45
42
|
export default cookie;
|
package/utilities/debounce.js
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
// debounce.js
|
|
2
|
-
|
|
2
|
+
function debounce(callback, delay) {
|
|
3
3
|
let timeoutId;
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
return function (...args) {
|
|
6
6
|
clearTimeout(timeoutId);
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
timeoutId = setTimeout(() => {
|
|
9
9
|
callback.apply(this, args);
|
|
10
10
|
}, delay);
|
|
11
11
|
};
|
|
12
|
-
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Self-export to hyperclay only
|
|
15
|
+
window.hyperclay = window.hyperclay || {};
|
|
16
|
+
window.hyperclay.debounce = debounce;
|
|
17
|
+
|
|
18
|
+
export default debounce;
|
package/utilities/mutation.js
CHANGED
package/utilities/nearest.js
CHANGED
|
@@ -94,4 +94,9 @@ export default function nearest (startElem, selector, elementFoundReturnValue =
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
return null;
|
|
97
|
-
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Self-export to window and hyperclay
|
|
100
|
+
window.nearest = nearest;
|
|
101
|
+
window.hyperclay = window.hyperclay || {};
|
|
102
|
+
window.hyperclay.nearest = nearest;
|
package/utilities/throttle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
function throttle(callback, delay, executeFirst = true) {
|
|
2
2
|
let lastCall = executeFirst ? 0 : Date.now();
|
|
3
3
|
let timeoutId = null;
|
|
4
4
|
|
|
@@ -18,4 +18,10 @@ export default function throttle(callback, delay, executeFirst = true) {
|
|
|
18
18
|
}, remaining);
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Self-export to hyperclay only
|
|
24
|
+
window.hyperclay = window.hyperclay || {};
|
|
25
|
+
window.hyperclay.throttle = throttle;
|
|
26
|
+
|
|
27
|
+
export default throttle;
|
package/vendor/idiomorph.min.js
CHANGED
|
@@ -5,4 +5,12 @@ var morph = function(oldEl, newEl, options = {}) {
|
|
|
5
5
|
key: (el) => el.getAttribute('data-id') || el.id,
|
|
6
6
|
...options
|
|
7
7
|
});
|
|
8
|
-
};
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// Self-export to hyperclay only
|
|
11
|
+
window.hyperclay = window.hyperclay || {};
|
|
12
|
+
window.hyperclay.Idiomorph = Idiomorph;
|
|
13
|
+
window.hyperclay.morph = morph;
|
|
14
|
+
|
|
15
|
+
export { Idiomorph, morph };
|
|
16
|
+
export default Idiomorph;
|
package/README.template.md
DELETED
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
# HyperclayJS
|
|
2
|
-
|
|
3
|
-
A modular JavaScript library for building interactive HTML applications with Hyperclay. Load only what you need with automatic dependency resolution.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- 🎯 **Modular Design** - Pick exactly the features you need
|
|
8
|
-
- 🚀 **Self-detecting Loader** - Automatic dependency resolution from URL params
|
|
9
|
-
- 📦 **Tree-shakeable** - Optimized for modern bundlers
|
|
10
|
-
- 🎨 **Rich Feature Set** - From basic save to advanced UI components
|
|
11
|
-
- 💪 **Zero Dependencies** - Core modules have no external dependencies
|
|
12
|
-
- 🔧 **Visual Configurator** - Interactive tool to build your custom bundle
|
|
13
|
-
|
|
14
|
-
## Quick Start
|
|
15
|
-
|
|
16
|
-
### Using CDN (Self-detecting Loader)
|
|
17
|
-
|
|
18
|
-
The self-detecting loader reads URL parameters and automatically loads the requested features with all dependencies:
|
|
19
|
-
|
|
20
|
-
```html
|
|
21
|
-
<!-- Minimal setup -->
|
|
22
|
-
<script src="https://hyperclay.com/js/hyperclay.js?preset=minimal" type="module"></script>
|
|
23
|
-
|
|
24
|
-
<!-- Standard setup -->
|
|
25
|
-
<script src="https://hyperclay.com/js/hyperclay.js?preset=standard" type="module"></script>
|
|
26
|
-
|
|
27
|
-
<!-- Custom features -->
|
|
28
|
-
<script src="https://hyperclay.com/js/hyperclay.js?features=save,admin,toast,ajax" type="module"></script>
|
|
29
|
-
|
|
30
|
-
<!-- Everything -->
|
|
31
|
-
<script src="https://hyperclay.com/js/hyperclay.js?preset=everything" type="module"></script>
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### Using NPM
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
npm install hyperclayjs
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
```javascript
|
|
41
|
-
// Import specific modules
|
|
42
|
-
import { savePage } from 'hyperclayjs/core/savePage.js';
|
|
43
|
-
import toast from 'hyperclayjs/ui/toast.js';
|
|
44
|
-
|
|
45
|
-
// Or use presets
|
|
46
|
-
import 'hyperclayjs/presets/standard.js';
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Available Modules
|
|
50
|
-
|
|
51
|
-
{{MODULE_TABLES}}
|
|
52
|
-
|
|
53
|
-
## Presets
|
|
54
|
-
|
|
55
|
-
{{PRESET_DESCRIPTIONS}}
|
|
56
|
-
|
|
57
|
-
## Visual Configurator
|
|
58
|
-
|
|
59
|
-
Explore features and build your custom bundle with our interactive configurator:
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
npm run dev
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
This will:
|
|
66
|
-
1. Generate fresh dependency data
|
|
67
|
-
2. Start a local server on port 3535
|
|
68
|
-
3. Open the configurator in your browser
|
|
69
|
-
|
|
70
|
-
The configurator shows:
|
|
71
|
-
- Real-time bundle size calculation
|
|
72
|
-
- Automatic dependency resolution
|
|
73
|
-
- Generated CDN URL
|
|
74
|
-
- Feature descriptions and categories
|
|
75
|
-
|
|
76
|
-
## Development
|
|
77
|
-
|
|
78
|
-
### Project Structure
|
|
79
|
-
|
|
80
|
-
```
|
|
81
|
-
hyperclayjs/
|
|
82
|
-
├── hyperclay.js # Self-detecting module loader
|
|
83
|
-
├── core/ # Core hyperclay features
|
|
84
|
-
├── custom-attributes/ # HTML attribute enhancements
|
|
85
|
-
├── ui/ # UI components (toast, modals, prompts)
|
|
86
|
-
├── utilities/ # General utilities (mutation, cookie, etc.)
|
|
87
|
-
├── dom-utilities/ # DOM manipulation helpers
|
|
88
|
-
├── string-utilities/ # String manipulation tools
|
|
89
|
-
├── communication/ # File upload and messaging
|
|
90
|
-
├── vendor/ # Third-party libraries (Sortable.js, etc.)
|
|
91
|
-
├── scripts/ # Build and generation scripts
|
|
92
|
-
└── starter-kit-configurator.html # Interactive configurator
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
### Setup
|
|
96
|
-
|
|
97
|
-
```bash
|
|
98
|
-
# Install dependencies
|
|
99
|
-
npm install
|
|
100
|
-
|
|
101
|
-
# Generate dependency graph
|
|
102
|
-
npm run generate:deps
|
|
103
|
-
|
|
104
|
-
# Start development server with configurator
|
|
105
|
-
npm run dev
|
|
106
|
-
|
|
107
|
-
# Build bundles
|
|
108
|
-
npm run build
|
|
109
|
-
|
|
110
|
-
# Run tests
|
|
111
|
-
npm test
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
### Automatic Dependency Graph
|
|
115
|
-
|
|
116
|
-
The project uses Madge to automatically analyze dependencies and generate rich metadata:
|
|
117
|
-
|
|
118
|
-
```bash
|
|
119
|
-
npm run generate:deps
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
This creates `module-dependency-graph.json` with:
|
|
123
|
-
- Complete dependency tree
|
|
124
|
-
- Actual file sizes
|
|
125
|
-
- Category assignments
|
|
126
|
-
- Preset configurations
|
|
127
|
-
|
|
128
|
-
The configurator dynamically loads this file to always show accurate information.
|
|
129
|
-
|
|
130
|
-
## Browser Support
|
|
131
|
-
|
|
132
|
-
- Chrome 90+
|
|
133
|
-
- Firefox 88+
|
|
134
|
-
- Safari 14+
|
|
135
|
-
- Edge 90+
|
|
136
|
-
|
|
137
|
-
All features use modern JavaScript (ES2020+). For older browser support, use a transpiler.
|
|
138
|
-
|
|
139
|
-
## API Examples
|
|
140
|
-
|
|
141
|
-
### Save System
|
|
142
|
-
|
|
143
|
-
```javascript
|
|
144
|
-
// Manually save the page
|
|
145
|
-
hyperclay.savePage();
|
|
146
|
-
|
|
147
|
-
// Initialize auto-save
|
|
148
|
-
hyperclay.initSavePageOnChange();
|
|
149
|
-
|
|
150
|
-
// Add save button
|
|
151
|
-
hyperclay.initHyperclaySaveButton(); // Looks for [trigger-save]
|
|
152
|
-
|
|
153
|
-
// Keyboard shortcut
|
|
154
|
-
hyperclay.initSaveKeyboardShortcut(); // CMD/CTRL+S
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
### Toast Notifications
|
|
158
|
-
|
|
159
|
-
```javascript
|
|
160
|
-
toast("Operation successful!", "success");
|
|
161
|
-
toast("Something went wrong", "error");
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
### Dialog Prompts
|
|
165
|
-
|
|
166
|
-
```javascript
|
|
167
|
-
// Ask for input
|
|
168
|
-
const name = await ask("What's your name?");
|
|
169
|
-
|
|
170
|
-
// Get consent
|
|
171
|
-
const agreed = await consent("Do you agree to terms?");
|
|
172
|
-
|
|
173
|
-
// Show message
|
|
174
|
-
tell("Welcome to Hyperclay!");
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
### Custom Attributes
|
|
178
|
-
|
|
179
|
-
```html
|
|
180
|
-
<!-- AJAX form submission -->
|
|
181
|
-
<form ajax-form="/api/submit">
|
|
182
|
-
<input name="email" type="email">
|
|
183
|
-
<button>Submit</button>
|
|
184
|
-
</form>
|
|
185
|
-
|
|
186
|
-
<!-- Auto-resize textarea -->
|
|
187
|
-
<textarea autosize></textarea>
|
|
188
|
-
|
|
189
|
-
<!-- Drag-drop sorting -->
|
|
190
|
-
<ul sortable>
|
|
191
|
-
<li>Item 1</li>
|
|
192
|
-
<li>Item 2</li>
|
|
193
|
-
<li>Item 3</li>
|
|
194
|
-
</ul>
|
|
195
|
-
|
|
196
|
-
<!-- Run code when clicked away -->
|
|
197
|
-
<div onclickaway="console.log('Clicked outside')">
|
|
198
|
-
Click outside this div
|
|
199
|
-
</div>
|
|
200
|
-
|
|
201
|
-
<!-- Persist form values -->
|
|
202
|
-
<input type="text" name="username" persist>
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
### Admin Features
|
|
206
|
-
|
|
207
|
-
```html
|
|
208
|
-
<!-- Only visible/editable in edit mode -->
|
|
209
|
-
<div contenteditable edit-mode-contenteditable>Admin can edit this</div>
|
|
210
|
-
<input type="text" edit-mode-input>
|
|
211
|
-
<script edit-mode-resource>console.log('Admin only');</script>
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
## Module Creation
|
|
215
|
-
|
|
216
|
-
Each module should be a self-contained ES module:
|
|
217
|
-
|
|
218
|
-
```javascript
|
|
219
|
-
// features/my-feature.js
|
|
220
|
-
import dependency from '../utilities/dependency.js';
|
|
221
|
-
|
|
222
|
-
export default function myFeature() {
|
|
223
|
-
// Feature implementation
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
// Export initialization function
|
|
227
|
-
export function init() {
|
|
228
|
-
if (typeof window !== 'undefined') {
|
|
229
|
-
// Auto-initialize on import
|
|
230
|
-
myFeature();
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
// Auto-run if needed
|
|
235
|
-
if (typeof window !== 'undefined') {
|
|
236
|
-
init();
|
|
237
|
-
}
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
## Migration from Monolithic Script
|
|
241
|
-
|
|
242
|
-
### Before
|
|
243
|
-
```html
|
|
244
|
-
<script src="/js/old-hyperclay.js"></script>
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
### After
|
|
248
|
-
```html
|
|
249
|
-
<!-- Use preset -->
|
|
250
|
-
<script src="/js/hyperclay.js?preset=standard" type="module"></script>
|
|
251
|
-
|
|
252
|
-
<!-- Or specific features -->
|
|
253
|
-
<script src="/js/hyperclay.js?features=save,admin,toast" type="module"></script>
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
## Contributing
|
|
257
|
-
|
|
258
|
-
1. Fork the repository
|
|
259
|
-
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
260
|
-
3. Make your changes
|
|
261
|
-
4. Run `npm run generate:deps` to update the dependency graph
|
|
262
|
-
5. Test your changes with `npm run dev`
|
|
263
|
-
6. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
264
|
-
7. Push to the branch (`git push origin feature/amazing-feature`)
|
|
265
|
-
8. Open a Pull Request
|
|
266
|
-
|
|
267
|
-
## License
|
|
268
|
-
|
|
269
|
-
MIT © Hyperclay
|
|
270
|
-
|
|
271
|
-
## Links
|
|
272
|
-
|
|
273
|
-
- [Documentation](https://hyperclay.com/docs)
|
|
274
|
-
- [Examples](https://hyperclay.com/examples)
|
|
275
|
-
- [Configurator](https://hyperclay.com/configurator)
|
|
276
|
-
- [GitHub Issues](https://github.com/hyperclay/hyperclayjs/issues)
|