feat: Add CMD+K command palette with ninja-keys integration
Implement a command palette accessible via CMD+K/Ctrl+K using the ninja-keys web component. Features include: - New /api/cmd-k endpoint serving dynamic CV entries (experiences, projects, courses) - Language-aware responses with 1-hour cache headers - Scroll-to-section functionality for quick navigation - Enhanced keyboard shortcuts modal with CMD+K documentation - Comprehensive test coverage for API and UI interactions Also includes cleanup of deprecated debug test files and various UI polish improvements to contact form, themes, and action bar components.
This commit is contained in:
+12
-1
@@ -105,6 +105,9 @@
|
||||
<!-- Hyperscript - Declarative event handling for enhanced interactivity -->
|
||||
<script src="https://unpkg.com/hyperscript.org@0.9.14"></script>
|
||||
|
||||
<!-- Ninja Keys - CMD+K Command Bar -->
|
||||
<script type="module" src="https://unpkg.com/ninja-keys?module"></script>
|
||||
|
||||
<!-- Iconify - Load synchronously for immediate rendering -->
|
||||
<!-- Using unpkg CDN (more reliable than code.iconify.design) -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/iconify-icon@2.1.0/dist/iconify-icon.min.js"></script>
|
||||
@@ -339,7 +342,9 @@
|
||||
on scroll from window call handleScroll()
|
||||
on keydown
|
||||
set tag to event.target.tagName
|
||||
set skip to (tag is 'INPUT' or tag is 'TEXTAREA')
|
||||
set ninjaKeys to document.getElementById('cmd-k-bar')
|
||||
set ninjaOpen to (ninjaKeys is not null and ninjaKeys.opened)
|
||||
set skip to (tag is 'INPUT' or tag is 'TEXTAREA' or ninjaOpen)
|
||||
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
|
||||
@@ -373,16 +378,22 @@
|
||||
{{template "info-button" .}}
|
||||
{{template "download-button" .}}
|
||||
{{template "print-friendly-button" .}}
|
||||
{{template "contact-button" .}}
|
||||
{{template "zoom-toggle-button" .}}
|
||||
{{template "shortcuts-button" .}}
|
||||
{{template "cmd-k-button" .}}
|
||||
{{template "info-modal" .}}
|
||||
{{template "shortcuts-modal" .}}
|
||||
{{template "pdf-modal" .}}
|
||||
{{template "contact-modal" .}}
|
||||
{{template "zoom-control" .}}
|
||||
|
||||
<!-- CMD+K Command Bar -->
|
||||
<ninja-keys id="cmd-k-bar" placeholder="Type a command or search..." hideBreadcrumbs openHotkey="cmd+k,ctrl+k"></ninja-keys>
|
||||
|
||||
<!-- External JavaScript - CSP Compliant -->
|
||||
<script src="/static/js/main.js"></script>
|
||||
<script src="/static/js/ninja-keys-init.js"></script>
|
||||
|
||||
<!-- Matomo Analytics - First-party subdomain to bypass ad blockers -->
|
||||
<script>
|
||||
|
||||
Reference in New Issue
Block a user