diff --git a/doc/4-HYPERSCRIPT-RULES.md b/doc/4-HYPERSCRIPT-RULES.md index ce1c97c..0306b49 100644 --- a/doc/4-HYPERSCRIPT-RULES.md +++ b/doc/4-HYPERSCRIPT-RULES.md @@ -134,8 +134,9 @@ static/hyperscript/ ├── utils._hs → Core utilities (scroll, print, etc.) ├── toggles._hs → Toggle functions (CV length, icons, theme) ├── hover-sync._hs → Hover sync functions (PDF, print, zoom) -├── navigation._hs → Navigation functions (scroll-to-section) [2025-11-20] -└── keyboard._hs → Keyboard handler reference (inline in body tag) +├── keyboard._hs → Keyboard shortcut helpers (handleToggleShortcut, openModalShortcut) +├── zoom._hs → Zoom control helpers (handleZoomInput, handleZoomReset, initZoomControl) +└── pdf-modal._hs → PDF modal helpers (selectPdfCard, handlePdfCardKey) ``` ### Load Order in templates/index.html: @@ -144,7 +145,8 @@ static/hyperscript/ - + + ``` @@ -180,20 +182,20 @@ static/hyperscript/ - Reduces HTML payload size - Cleaner separation of concerns -### Hyperscript 0.9.12 Limitation -- Parser breaks with >3 `def` in single file -- MUST split into multiple files -- Each file: ≤3 `def` statements +### Historical Note: Hyperscript Def Limit +- **Hyperscript 0.9.12** had a 3-def limit per file (FIXED in 0.9.14+) +- **Hyperscript 0.9.14+** has NO def limit - tested with 5+ defs +- Multi-file organization is still recommended for maintainability, not required ## Common Mistakes to Avoid -❌ **DON'T**: Put all functions in one file if you have >3 defs -❌ **DON'T**: Write long inline hyperscript in HTML -❌ **DON'T**: Delete functions to work around the 3-def limit +❌ **DON'T**: Write long inline hyperscript in HTML (maintainability issue) +❌ **DON'T**: Try to externalize event handlers that inspect `event.key` or `event.target` +❌ **DON'T**: Forget to test after refactoring (syntax errors look like bugs) -✅ **DO**: Split functions across multiple .\_hs files +✅ **DO**: Split functions across multiple .\_hs files for organization ✅ **DO**: Keep HTML clean with function calls -✅ **DO**: Maintain all required functions for clean architecture +✅ **DO**: Test all keyboard shortcuts after any hyperscript changes ## Testing After Changes @@ -206,6 +208,21 @@ static/hyperscript/ ## Recent Changes +### 2025-11-30: Major Inline Hyperscript Refactoring +- ✅ **REFACTORED**: Body tag keyboard handlers → `keyboard._hs` helper functions +- ✅ **REFACTORED**: Zoom control handlers → `zoom._hs` helper functions +- ✅ **REFACTORED**: PDF modal card selection (3 identical blocks) → `pdf-modal._hs` +- ✅ **ADDED**: `zoom._hs` - Zoom control helpers (handleZoomInput, handleZoomReset, initZoomControl) +- ✅ **ADDED**: `pdf-modal._hs` - PDF modal helpers (selectPdfCard, handlePdfCardKey) +- ✅ **TESTED**: All functionality verified with comprehensive tests + +### 2025-11-30: Multi-File Loading Bug Investigation +- ✅ **CONFIRMED**: Multiple ` - - - + + + - - - - - + + @@ -144,23 +141,13 @@ _="on load call initScrollBehavior() on scroll from window call handleScroll() on keydown - set tagName to event.target.tagName - set isInputField to (tagName is 'INPUT' or tagName is 'TEXTAREA') - if event.key is '?' and not event.ctrlKey and not event.metaKey and not event.altKey and not isInputField - halt the event then set modal to #shortcuts-modal then if modal then call modal.showModal() end - end - if (event.key is 'l' or event.key is 'L') and not event.ctrlKey and not event.metaKey and not event.altKey and not isInputField - halt the event then set lengthToggle to (#lengthToggle or #lengthToggleMenu) - then if lengthToggle then set lengthToggle's checked to (not lengthToggle's checked) then send change to lengthToggle end - end - if (event.key is 'i' or event.key is 'I') and not event.ctrlKey and not event.metaKey and not event.altKey and not isInputField - halt the event then set iconToggle to (#iconToggle or #iconToggleMenu) - then if iconToggle then set iconToggle's checked to (not iconToggle's checked) then send change to iconToggle end - end - if (event.key is 'v' or event.key is 'V') and not event.ctrlKey and not event.metaKey and not event.altKey and not isInputField - halt the event then set themeToggle to (#themeToggle or #themeToggleMenu) - then if themeToggle then set themeToggle's checked to (not themeToggle's checked) then send change to themeToggle end - end + set tag to event.target.tagName + set skip to (tag is 'INPUT' or tag is 'TEXTAREA') + set noMod to (not event.ctrlKey and not event.metaKey and not event.altKey) + if event.key is '?' and noMod and not skip then halt the event then call openModalShortcut('shortcuts-modal') end + if (event.key is 'l' or event.key is 'L') and noMod and not skip then halt the event then call handleToggleShortcut('lengthToggle', 'lengthToggleMenu') end + if (event.key is 'i' or event.key is 'I') and noMod and not skip then halt the event then call handleToggleShortcut('iconToggle', 'iconToggleMenu') end + if (event.key is 'v' or event.key is 'V') and noMod and not skip then halt the event then call handleToggleShortcut('themeToggle', 'themeToggleMenu') end end">
diff --git a/templates/partials/cv/page-footer.html b/templates/partials/cv/page-footer.html index f087870..59c1e0c 100644 --- a/templates/partials/cv/page-footer.html +++ b/templates/partials/cv/page-footer.html @@ -1,6 +1,8 @@ {{define "page-footer"}} -