hyperclayjs 1.11.0 → 1.13.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
@@ -75,7 +75,7 @@ import 'hyperclayjs/presets/standard.js';
75
75
  |--------|------|-------------|
76
76
  | ajax-elements | 2.6KB | [ajax-form], [ajax-button] for async form submissions |
77
77
  | dom-helpers | 6.2KB | el.nearest, el.val, el.text, el.exec, el.cycle |
78
- | event-attrs | 4.1KB | [onclickaway], [onclone], [onpagemutation], [onrender] |
78
+ | event-attrs | 4.6KB | [onclickaway], [onclickchildren], [onclone], [onpagemutation], [onrender] |
79
79
  | input-helpers | 1.2KB | [prevent-enter], [autosize] for textareas |
80
80
  | onaftersave | 1KB | [onaftersave] attribute - run JS when save status changes |
81
81
  | sortable | 3.4KB | Drag-drop sorting with [sortable], lazy-loads ~118KB Sortable.js in edit mode |
@@ -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 | 21.8KB | Full modal window creation system - window.theModal |
89
- | toast | 7.7KB | Success/error message notifications, toast(msg, msgType) |
88
+ | the-modal | 20.8KB | Full modal window creation system - window.theModal |
89
+ | toast | 7.9KB | 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 (~30.4KB)
135
+ ### Minimal (~30.6KB)
136
136
  Essential features for basic editing
137
137
 
138
138
  **Modules:** `save-core`, `save-system`, `edit-mode-helpers`, `toast`, `save-toast`, `export-to-window`
139
139
 
140
- ### Standard (~48.4KB)
140
+ ### Standard (~49.1KB)
141
141
  Standard feature set for most use cases
142
142
 
143
143
  **Modules:** `save-core`, `save-system`, `edit-mode-helpers`, `persist`, `option-visibility`, `event-attrs`, `dom-helpers`, `toast`, `save-toast`, `export-to-window`
144
144
 
145
- ### Everything (~178.1KB)
145
+ ### Everything (~177.8KB)
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.11.0",
3
+ "version": "1.13.0",
4
4
  "description": "Modular JavaScript library for building interactive HTML applications with Hyperclay",
5
5
  "type": "module",
6
6
  "main": "src/hyperclay.js",
@@ -1,5 +1,6 @@
1
1
  // Events module - combines all event attribute handlers
2
2
  import { init as initOnclickaway } from './onclickaway.js';
3
+ import { init as initOnclickchildren } from './onclickchildren.js';
3
4
  import { init as initOnclone } from './onclone.js';
4
5
  import { init as initOnmutation } from './onmutation.js';
5
6
  import { init as initOnpagemutation } from './onpagemutation.js';
@@ -7,6 +8,7 @@ import { init as initOnrender } from './onrender.js';
7
8
 
8
9
  function init() {
9
10
  initOnclickaway();
11
+ initOnclickchildren();
10
12
  initOnclone();
11
13
  initOnmutation();
12
14
  initOnpagemutation();
@@ -0,0 +1,12 @@
1
+ function init() {
2
+ document.addEventListener('click', function(event) {
3
+ const parent = event.target.closest('[onclickchildren]');
4
+ if (parent && event.target !== parent) {
5
+ const directChild = event.composedPath().find(el => el.parentNode === parent);
6
+ new Function(parent.getAttribute('onclickchildren')).call(directChild);
7
+ }
8
+ });
9
+ }
10
+
11
+ export { init };
12
+ export default init;
package/src/hyperclay.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * HyperclayJS v1.11.0 - Minimal Browser-Native Loader
2
+ * HyperclayJS v1.13.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.
@@ -318,8 +318,8 @@ const modalCss = `<style class="micromodal-css">
318
318
  .micromodal {
319
319
  display: none;
320
320
  color: #fff;
321
- font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
322
- font-size: 18px;
321
+ font-family: var(--hyperclay-modal-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
322
+ font-size: var(--hyperclay-modal-font-size, 18px);
323
323
  }
324
324
 
325
325
  .micromodal button:not(.custom-button) {
@@ -415,7 +415,7 @@ const modalCss = `<style class="micromodal-css">
415
415
  .micromodal .micromodal__input {
416
416
  width: clamp(300px, calc(100vw - 100px), 420px);
417
417
  padding: 6px 6px 7px;
418
- font-size: 16px;
418
+ font-size: var(--hyperclay-modal-input-font-size, 16px);
419
419
  color: #000;
420
420
  }
421
421
 
@@ -572,19 +572,12 @@ const modalHtml = `<div class="micromodal" id="micromodal" aria-hidden="true">
572
572
  </div>
573
573
  </div>`;
574
574
 
575
- const DEFAULT_FONT_FAMILY = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace";
576
- const DEFAULT_FONT_SIZE = "18px";
577
- const DEFAULT_INPUT_FONT_SIZE = "16px";
578
-
579
575
  const themodal = (() => {
580
576
  let html = "";
581
577
  let yes = "";
582
578
  let no = "";
583
579
  let zIndex = "100";
584
580
  let closeHtml = "";
585
- let fontFamily = DEFAULT_FONT_FAMILY;
586
- let fontSize = DEFAULT_FONT_SIZE;
587
- let inputFontSize = DEFAULT_INPUT_FONT_SIZE;
588
581
 
589
582
  let enableClickOutsideCloses = true;
590
583
  let disableScroll = true;
@@ -612,17 +605,6 @@ const themodal = (() => {
612
605
  modalOverlayElem.style.zIndex = zIndex;
613
606
  modalCloseElem.innerHTML = closeHtml;
614
607
 
615
- // Apply font styles to the modal
616
- const modalElem = document.querySelector("#micromodal");
617
- modalElem.style.fontFamily = fontFamily;
618
- modalElem.style.fontSize = fontSize;
619
-
620
- // Apply input font size
621
- const modalInputElem = document.querySelector(".micromodal__input");
622
- if (modalInputElem) {
623
- modalInputElem.style.fontSize = inputFontSize;
624
- }
625
-
626
608
  // MODIFIED so modal doesn't close if mousedown happened inside the modal
627
609
  let mousedownOnBackdrop = false;
628
610
 
@@ -702,9 +684,6 @@ const themodal = (() => {
702
684
  no = "";
703
685
  zIndex = "100";
704
686
  closeHtml = "";
705
- fontFamily = DEFAULT_FONT_FAMILY;
706
- fontSize = DEFAULT_FONT_SIZE;
707
- inputFontSize = DEFAULT_INPUT_FONT_SIZE;
708
687
 
709
688
  // reset to defaults
710
689
  enableClickOutsideCloses = true;
@@ -768,24 +747,6 @@ const themodal = (() => {
768
747
  set zIndex(newVal) {
769
748
  zIndex = newVal;
770
749
  },
771
- get fontFamily() {
772
- return fontFamily;
773
- },
774
- set fontFamily(newVal) {
775
- fontFamily = newVal;
776
- },
777
- get fontSize() {
778
- return fontSize;
779
- },
780
- set fontSize(newVal) {
781
- fontSize = newVal;
782
- },
783
- get inputFontSize() {
784
- return inputFontSize;
785
- },
786
- set inputFontSize(newVal) {
787
- inputFontSize = newVal;
788
- },
789
750
  get disableFocus() {
790
751
  return disableFocus;
791
752
  },
package/src/ui/toast.js CHANGED
@@ -71,8 +71,8 @@ const modernStyles = `
71
71
  align-items: center;
72
72
  gap: 12px;
73
73
  padding: 16px 24px 16px 16px;
74
- font-size: 16px;
75
- font-family: monospace;
74
+ font-size: var(--hyperclay-toast-font-size, 16px);
75
+ font-family: var(--hyperclay-toast-font-family, monospace);
76
76
  font-weight: bold;
77
77
  color: white;
78
78
  border-width: 1px;
@@ -155,6 +155,8 @@ export const hyperclayStyles = `
155
155
  background-color: #0B0C12;
156
156
  border: 2px dashed rgba(255,255,255,.6);
157
157
  transition: right 0.5s ease-in-out;
158
+ font-size: var(--hyperclay-toast-font-size, inherit);
159
+ font-family: var(--hyperclay-toast-font-family, inherit);
158
160
  }
159
161
 
160
162
  [data-toast-theme="hyperclay"] .toast svg {