hyperclayjs 1.13.0 → 1.14.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
@@ -85,7 +85,7 @@ 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 | 20.8KB | Full modal window creation system - window.theModal |
88
+ | the-modal | 21KB | Full modal window creation system - window.theModal |
89
89
  | toast | 7.9KB | Success/error message notifications, toast(msg, msgType) |
90
90
 
91
91
  ### Utilities (Core utilities (often auto-included))
@@ -132,17 +132,17 @@ import 'hyperclayjs/presets/standard.js';
132
132
 
133
133
  ## Presets
134
134
 
135
- ### Minimal (~30.6KB)
135
+ ### Minimal (~38.1KB)
136
136
  Essential features for basic editing
137
137
 
138
- **Modules:** `save-core`, `save-system`, `edit-mode-helpers`, `toast`, `save-toast`, `export-to-window`
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 (~49.1KB)
140
+ ### Standard (~57.4KB)
141
141
  Standard feature set for most use cases
142
142
 
143
- **Modules:** `save-core`, `save-system`, `edit-mode-helpers`, `persist`, `option-visibility`, `event-attrs`, `dom-helpers`, `toast`, `save-toast`, `export-to-window`
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 (~177.8KB)
145
+ ### Everything (~178KB)
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.13.0",
3
+ "version": "1.14.0",
4
4
  "description": "Modular JavaScript library for building interactive HTML applications with Hyperclay",
5
5
  "type": "module",
6
6
  "main": "src/hyperclay.js",
@@ -5,9 +5,10 @@ function init() {
5
5
  const currentResource = cookie.get('currentResource');
6
6
  if (!currentResource) return;
7
7
 
8
- const href = `/tailwindcss/${currentResource}`;
8
+ const href = `/tailwindcss/${currentResource}.css`;
9
9
  insertStyles(href, (link) => {
10
10
  link.setAttribute('onaftersave', 'cacheBust(this)');
11
+ link.setAttribute('mutations-ignore', '');
11
12
  });
12
13
  }
13
14
 
package/src/hyperclay.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * HyperclayJS v1.13.0 - Minimal Browser-Native Loader
2
+ * HyperclayJS v1.14.0 - Minimal Browser-Native Loader
3
3
  *
4
4
  * Modules auto-init when imported (no separate init call needed).
5
5
  * Include `export-to-window` feature to export to window.hyperclay.
@@ -73,11 +73,13 @@ const PRESETS = {
73
73
  "description": "Essential features for basic editing",
74
74
  "modules": [
75
75
  "save-core",
76
+ "snapshot",
76
77
  "save-system",
77
78
  "edit-mode-helpers",
78
79
  "toast",
79
80
  "save-toast",
80
- "export-to-window"
81
+ "export-to-window",
82
+ "view-mode-excludes-edit-modules"
81
83
  ]
82
84
  },
83
85
  "standard": {
@@ -85,7 +87,9 @@ const PRESETS = {
85
87
  "description": "Standard feature set for most use cases",
86
88
  "modules": [
87
89
  "save-core",
90
+ "snapshot",
88
91
  "save-system",
92
+ "unsaved-warning",
89
93
  "edit-mode-helpers",
90
94
  "persist",
91
95
  "option-visibility",
@@ -93,7 +97,8 @@ const PRESETS = {
93
97
  "dom-helpers",
94
98
  "toast",
95
99
  "save-toast",
96
- "export-to-window"
100
+ "export-to-window",
101
+ "view-mode-excludes-edit-modules"
97
102
  ]
98
103
  },
99
104
  "everything": {
@@ -140,7 +145,8 @@ const PRESETS = {
140
145
  "file-upload",
141
146
  "live-sync",
142
147
  "tailwind-inject",
143
- "export-to-window"
148
+ "export-to-window",
149
+ "view-mode-excludes-edit-modules"
144
150
  ]
145
151
  }
146
152
  };
@@ -166,8 +166,10 @@ const MicroModal = (() => {
166
166
  }
167
167
 
168
168
  removeEventListeners () {
169
- this.modal.removeEventListener('touchstart', this.onClick)
170
- this.modal.removeEventListener('click', this.onClick)
169
+ if (this.modal) {
170
+ this.modal.removeEventListener('touchstart', this.onClick)
171
+ this.modal.removeEventListener('click', this.onClick)
172
+ }
171
173
  document.removeEventListener('keydown', this.onKeydown)
172
174
  }
173
175
 
@@ -303,7 +305,9 @@ const MicroModal = (() => {
303
305
  }
304
306
 
305
307
  const close = targetModal => {
308
+ if (!activeModal) return
306
309
  targetModal ? activeModal.closeModalById(targetModal) : activeModal.closeModal()
310
+ activeModal = null
307
311
  }
308
312
 
309
313
  return { init, show, close }
@@ -364,6 +368,7 @@ const modalCss = `<style class="micromodal-css">
364
368
 
365
369
  .micromodal__container {
366
370
  position: relative;
371
+ max-width: 600px;
367
372
  box-sizing: border-box;
368
373
  overflow-y: auto;
369
374
  padding: 26px 40px 40px 40px;
@@ -465,7 +470,7 @@ const modalCss = `<style class="micromodal-css">
465
470
  background-color: #1D1F2F;
466
471
  color: #E5E7EB;
467
472
  font-family: inherit;
468
- font-size: 16px;
473
+ font-size: inherit;
469
474
  font-weight: bold;
470
475
  }
471
476
 
@@ -495,7 +500,7 @@ const modalCss = `<style class="micromodal-css">
495
500
 
496
501
  .micromodal .snippet-code-block pre {
497
502
  color: white;
498
- font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
503
+ font-family: var(--hyperclay-modal-code-font-family, var(--hyperclay-modal-font-family, monospace));
499
504
  font-size: 0.875rem;
500
505
  white-space: nowrap;
501
506
  margin: 0;
@@ -540,21 +545,21 @@ const modalCss = `<style class="micromodal-css">
540
545
  }
541
546
 
542
547
  .micromodal .micromodal__tell-title {
543
- font-size: 20px;
548
+ font-size: var(--hyperclay-modal-title-font-size, 20px);
544
549
  font-weight: bold;
545
550
  }
546
551
 
547
552
  .micromodal .micromodal__tell-content {
548
- font-size: 16px;
553
+ font-size: var(--hyperclay-modal-font-size, 16px);
549
554
  font-weight: normal;
550
555
  }
551
556
 
552
557
  @media (min-width: 640px) {
553
558
  .micromodal .micromodal__tell-title {
554
- font-size: 22px;
559
+ font-size: var(--hyperclay-modal-title-font-size, 22px);
555
560
  }
556
561
  .micromodal .micromodal__tell-content {
557
- font-size: 18px;
562
+ font-size: var(--hyperclay-modal-font-size, 18px);
558
563
  }
559
564
  }
560
565
  </style>`;
@@ -2,10 +2,11 @@
2
2
  // Cache-bust an element's href or src attribute by adding/updating a version query param
3
3
 
4
4
  function cacheBust(el) {
5
- const attr = el.href !== undefined ? 'href' : 'src';
6
- const url = new URL(el[attr], location.href);
5
+ const attr = el.hasAttribute('href') ? 'href' : 'src';
6
+ const currentValue = el.getAttribute(attr);
7
+ const url = new URL(currentValue, location.href);
7
8
  url.searchParams.set('v', Date.now());
8
- el[attr] = url.href;
9
+ el.setAttribute(attr, url.href);
9
10
  }
10
11
 
11
12
  // Auto-export to window unless suppressed by loader