hyperclayjs 1.18.0 → 1.19.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 +6 -6
- package/package.json +1 -1
- package/src/core/snapshot.js +8 -0
- package/src/hyperclay.js +1 -1
- package/src/ui/theModal.js +1 -1
- package/src/ui/toast.js +3 -1
package/README.md
CHANGED
|
@@ -65,7 +65,7 @@ import 'hyperclayjs/presets/standard.js';
|
|
|
65
65
|
| save-core | 8.9KB | Basic save function only - hyperclay.savePage() |
|
|
66
66
|
| save-system | 12.1KB | CMD+S, [trigger-save] button, savestatus attribute |
|
|
67
67
|
| save-toast | 0.9KB | Toast notifications for save events |
|
|
68
|
-
| snapshot | 10.
|
|
68
|
+
| snapshot | 10.8KB | Source of truth for page state - captures DOM snapshots for save and sync |
|
|
69
69
|
| tailwind-inject | 1.4KB | Injects tailwind CSS link with cache-bust on save |
|
|
70
70
|
| unsaved-warning | 1.3KB | Warn before leaving page with unsaved changes |
|
|
71
71
|
|
|
@@ -85,8 +85,8 @@ import 'hyperclayjs/presets/standard.js';
|
|
|
85
85
|
| Module | Size | Description |
|
|
86
86
|
|--------|------|-------------|
|
|
87
87
|
| dialogs | 7.7KB | ask(), consent(), tell(), snippet() dialog functions |
|
|
88
|
-
| the-modal |
|
|
89
|
-
| toast | 10.
|
|
88
|
+
| the-modal | 21.1KB | Full modal window creation system - window.theModal |
|
|
89
|
+
| toast | 10.7KB | Success/error message notifications, toast(msg, msgType) |
|
|
90
90
|
|
|
91
91
|
### Utilities (Core utilities (often auto-included))
|
|
92
92
|
|
|
@@ -132,17 +132,17 @@ import 'hyperclayjs/presets/standard.js';
|
|
|
132
132
|
|
|
133
133
|
## Presets
|
|
134
134
|
|
|
135
|
-
### Minimal (~
|
|
135
|
+
### Minimal (~51.3KB)
|
|
136
136
|
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 (~73.
|
|
140
|
+
### Standard (~73.6KB)
|
|
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 (~
|
|
145
|
+
### Everything (~207.4KB)
|
|
146
146
|
All available features
|
|
147
147
|
|
|
148
148
|
Includes all available modules across all categories.
|
package/package.json
CHANGED
package/src/core/snapshot.js
CHANGED
|
@@ -85,6 +85,14 @@ export function captureSnapshot() {
|
|
|
85
85
|
hook(clone);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
for (const el of clone.querySelectorAll('[onbeforesnapshot]')) {
|
|
89
|
+
new Function(el.getAttribute('onbeforesnapshot')).call(el);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
for (const el of clone.querySelectorAll('[snapshot-remove]')) {
|
|
93
|
+
el.remove();
|
|
94
|
+
}
|
|
95
|
+
|
|
88
96
|
return clone;
|
|
89
97
|
}
|
|
90
98
|
|
package/src/hyperclay.js
CHANGED
package/src/ui/theModal.js
CHANGED
|
@@ -595,7 +595,7 @@ const themodal = (() => {
|
|
|
595
595
|
const themodalMain = {
|
|
596
596
|
isShowing: false,
|
|
597
597
|
open() {
|
|
598
|
-
document.body.insertAdjacentHTML("afterbegin", "<div save-remove class='micromodal-parent'>" + modalCss + modalHtml + "</div>");
|
|
598
|
+
document.body.insertAdjacentHTML("afterbegin", "<div save-remove snapshot-remove class='micromodal-parent'>" + modalCss + modalHtml + "</div>");
|
|
599
599
|
|
|
600
600
|
const modalOverlayElem = document.querySelector(".micromodal__overlay");
|
|
601
601
|
const modalContentElem = document.querySelector(".micromodal__content");
|
package/src/ui/toast.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
const defaultIcons = {
|
|
6
6
|
success: `<svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13.9404 23.9475L21.9099 31.224L35.1906 15.9045M3 4.5H44.9804V44.309H3V4.5Z" stroke="#33D131" stroke-width="4.3"/></svg>`,
|
|
7
7
|
error: `<svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M32.7383 14.4045L14 33.1429M32.7451 33.1429L14.0068 14.4046M3.01 4H44.99V43.809H3.01V4Z" stroke="#FF4450" stroke-width="4"/></svg>`,
|
|
8
|
-
warning: `<svg viewBox="0 0
|
|
8
|
+
warning: `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke="#F5A623" stroke-width="2" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"/></svg>`,
|
|
9
9
|
info: `<svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="24" cy="24" r="20" stroke="#4A90D9" stroke-width="4"/><path d="M24 20V32M24 14V16" stroke="#4A90D9" stroke-width="4" stroke-linecap="round"/></svg>`
|
|
10
10
|
};
|
|
11
11
|
|
|
@@ -253,6 +253,7 @@ export function injectToastStyles(styles, theme) {
|
|
|
253
253
|
const styleSheet = document.createElement('style');
|
|
254
254
|
styleSheet.className = `toast-styles-${theme}`;
|
|
255
255
|
styleSheet.setAttribute('save-remove', '');
|
|
256
|
+
styleSheet.setAttribute('snapshot-remove', '');
|
|
256
257
|
styleSheet.textContent = styles;
|
|
257
258
|
document.head.appendChild(styleSheet);
|
|
258
259
|
|
|
@@ -272,6 +273,7 @@ export function toastCore(message, messageType = "success", config = {}) {
|
|
|
272
273
|
toastContainer.className = 'toast-container';
|
|
273
274
|
toastContainer.setAttribute('data-toast-theme', theme);
|
|
274
275
|
toastContainer.setAttribute('save-remove', '');
|
|
276
|
+
toastContainer.setAttribute('snapshot-remove', '');
|
|
275
277
|
document.body.append(toastContainer);
|
|
276
278
|
}
|
|
277
279
|
|