hyperclayjs 1.25.0 → 1.26.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 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 | 13.4KB | CMD+S, [trigger-save] button, savestatus attribute |
67
67
  | save-toast | 0.9KB | Toast notifications for save events |
68
- | snapshot | 10.8KB | Source of truth for page state - captures DOM snapshots for save and sync |
68
+ | snapshot | 11KB | Source of truth for page state - captures DOM snapshots for save and sync |
69
69
  | unsaved-warning | 1.3KB | Warn before leaving page with unsaved changes |
70
70
 
71
71
  ### Custom Attributes (HTML enhancements)
@@ -86,7 +86,7 @@ import 'hyperclayjs/presets/standard.js';
86
86
 
87
87
  | Module | Size | Description |
88
88
  |--------|------|-------------|
89
- | dialogs | 7.7KB | ask(), consent(), tell(), snippet() dialog functions |
89
+ | dialogs | 8.1KB | ask(), consent(), tell(), snippet() dialog functions |
90
90
  | the-modal | 22.4KB | Full modal window creation system - window.theModal |
91
91
  | toast | 15.8KB | Success/error message notifications, toast(msg, msgType) |
92
92
 
@@ -134,17 +134,17 @@ import 'hyperclayjs/presets/standard.js';
134
134
 
135
135
  ## Presets
136
136
 
137
- ### Minimal (~57KB)
137
+ ### Minimal (~57.2KB)
138
138
  Essential features for basic editing
139
139
 
140
140
  **Modules:** `save-core`, `snapshot`, `save-system`, `edit-mode-helpers`, `toast`, `save-toast`, `export-to-window`, `view-mode-excludes-edit-modules`
141
141
 
142
- ### Standard (~83.9KB)
142
+ ### Standard (~84.1KB)
143
143
  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.4KB)
147
+ ### Everything (~226KB)
148
148
  All available features
149
149
 
150
150
  Includes all available modules across all categories.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperclayjs",
3
- "version": "1.25.0",
3
+ "version": "1.26.1",
4
4
  "description": "Modular JavaScript library for building interactive malleable HTML files with Hyperclay",
5
5
  "type": "module",
6
6
  "main": "src/hyperclay.js",
@@ -78,8 +78,15 @@ export const beforeSave = onPrepareForSave;
78
78
  *
79
79
  * @returns {HTMLElement} Cloned document element with snapshot hooks applied
80
80
  */
81
+ function clonePreventingOnclone(node) {
82
+ const prev = window.__preventOnclone;
83
+ window.__preventOnclone = true;
84
+ try { return node.cloneNode(true); }
85
+ finally { window.__preventOnclone = prev; }
86
+ }
87
+
81
88
  export function captureSnapshot() {
82
- const clone = document.documentElement.cloneNode(true);
89
+ const clone = clonePreventingOnclone(document.documentElement);
83
90
 
84
91
  for (const hook of snapshotHooks) {
85
92
  hook(clone);
@@ -196,7 +203,7 @@ export function captureForSaveAndComparison({ emitForSync = true } = {}) {
196
203
  }
197
204
 
198
205
  // Clone for comparison before stripping (cheaper than cloning live DOM)
199
- const compareClone = clone.cloneNode(true);
206
+ const compareClone = clonePreventingOnclone(clone);
200
207
 
201
208
  // Save clone: strip [save-remove], then run hooks
202
209
  for (const el of clone.querySelectorAll('[save-remove]')) {
@@ -13,8 +13,10 @@ function init() {
13
13
  const clonedNode = originalCloneNode.call(this, deep);
14
14
 
15
15
  if (clonedNode.nodeType === Node.ELEMENT_NODE) {
16
- processOnclone(clonedNode);
17
- clonedNode.querySelectorAll('[onclone]').forEach(processOnclone);
16
+ if (!window.__preventOnclone) {
17
+ processOnclone(clonedNode);
18
+ clonedNode.querySelectorAll('[onclone]').forEach(processOnclone);
19
+ }
18
20
 
19
21
  // Patch textareas: the persist module writes live values to data-value
20
22
  // on every keystroke (because writing textContent on a focused textarea
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.25.0 - Minimal Browser-Native Loader
4
+ * HyperclayJS v1.26.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.
package/src/ui/prompts.js CHANGED
@@ -50,6 +50,19 @@ function createModal(promptText, yesCallback, extraContent = "", includeInput =
50
50
 
51
51
  themodal.open();
52
52
 
53
+ setTimeout(() => {
54
+ const modalContainer = document.querySelector('.micromodal-parent');
55
+ if (modalContainer) {
56
+ modalContainer.addEventListener('click', (event) => {
57
+ const btn = event.target.closest('[data-copy]');
58
+ if (btn) {
59
+ copyToClipboard(btn.dataset.copy);
60
+ toast('Copied', 'success');
61
+ }
62
+ });
63
+ }
64
+ }, 0);
65
+
53
66
  return promise;
54
67
  }
55
68