diff --git a/composer.json b/composer.json index ad143ded..9c9f4827 100644 --- a/composer.json +++ b/composer.json @@ -8,8 +8,8 @@ "scripts": { "test": "parallel-lint --exclude vendor/ .", "deps": [ - "curl -O -q --output-dir themes/jquery/lib/typesense-minibar 'https://raw.githubusercontent.com/jquery/typesense-minibar/1.3.2/{typesense-minibar.css,typesense-minibar.js,LICENSE.txt}'", - "curl -q https://raw.githubusercontent.com/jquery/typesense-minibar/1.3.2/typesense-minibar-foot.css >> themes/jquery/lib/typesense-minibar/typesense-minibar.css", + "curl -O -q --output-dir themes/jquery/lib/typesense-minibar 'https://raw.githubusercontent.com/jquery/typesense-minibar/1.3.4/{typesense-minibar.css,typesense-minibar.js,LICENSE.txt}'", + "curl -q https://raw.githubusercontent.com/jquery/typesense-minibar/1.3.4/typesense-minibar-foot.css >> themes/jquery/lib/typesense-minibar/typesense-minibar.css", "curl -O -q --output-dir plugins/memcached 'https://raw.githubusercontent.com/Automattic/wp-memcached/35e1ea16f6b8cb8a1e6fbca124e33a44db21fa74/{object-cache.php,readme.txt,LICENSE}'" ] } diff --git a/themes/jquery/header.php b/themes/jquery/header.php index eebd91fd..322acb48 100755 --- a/themes/jquery/header.php +++ b/themes/jquery/header.php @@ -18,7 +18,7 @@ - + @@ -27,7 +27,7 @@ - + ") 0 50% / contain no-repeat; position: absolute; - top: calc(var(--tsmb-size-sm) + var(--tsmb-size-edge)); + top: calc(var(--tsmb-size-edge) + var(--tsmb-size-sm)); left: var(--tsmb-size-sm); width: var(--tsmb-size-base); height: var(--tsmb-size-input); @@ -104,7 +106,7 @@ typesense-minibar form::before { .tsmb-icon-close { box-sizing: border-box; position: absolute; - top: calc(50% - var(--tsmb-size-base)/2); + top: calc(var(--tsmb-size-edge) + var(--tsmb-size-sm) + (var(--tsmb-size-input)/2) - (var(--tsmb-size-base)/2)); right: var(--tsmb-size-base); width: var(--tsmb-size-base); height: var(--tsmb-size-base); @@ -115,11 +117,7 @@ typesense-minibar form::before { cursor: pointer; } -.tsmb-form--open .tsmb-icon-close { - display: block !important; -} - -.tsmb-form--slash::after { +form:not(.tsmb-form--open) .tsmb-icon-close { display: none; } @@ -245,7 +243,7 @@ typesense-minibar[data-group=true] .tsmb-suggestion_title { content: ' Typesense'; color: #0300b0; } -/*! https://github.com/jquery/typesense-minibar 1.3.2 */ +/*! https://github.com/jquery/typesense-minibar 1.3.4 */ .tsmb-foot::after { content: ""; display: inline-block; diff --git a/themes/jquery/lib/typesense-minibar/typesense-minibar.js b/themes/jquery/lib/typesense-minibar/typesense-minibar.js index 535e48d4..f73dfebc 100644 --- a/themes/jquery/lib/typesense-minibar/typesense-minibar.js +++ b/themes/jquery/lib/typesense-minibar/typesense-minibar.js @@ -1,4 +1,4 @@ -/*! https://github.com/jquery/typesense-minibar 1.3.2 */ +/*! https://github.com/jquery/typesense-minibar 1.3.4 */ globalThis.tsminibar = function tsminibar (form, dataset = form.dataset) { const cache = new Map(); const state = { query: '', cursor: -1, open: false, hits: [] }; @@ -41,7 +41,6 @@ globalThis.tsminibar = function tsminibar (form, dataset = form.dataset) { const query = state.query = input.value; if (!query) { state.hits = []; - state.cursor = -1; return close(); } const hits = await search(query); @@ -62,7 +61,10 @@ globalThis.tsminibar = function tsminibar (form, dataset = form.dataset) { if (!e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey) { if (e.code === 'ArrowDown') moveCursor(1); if (e.code === 'ArrowUp') moveCursor(-1); - if (e.code === 'Escape') close(); + if (e.code === 'Escape') { + close(); + input.blur(); + } if (e.code === 'Enter') { const url = state.hits[state.cursor]?.url; if (url) location.href = url; @@ -72,11 +74,12 @@ globalThis.tsminibar = function tsminibar (form, dataset = form.dataset) { form.addEventListener('submit', function (e) { e.preventDefault(); }); - form.insertAdjacentHTML('beforeend', ''); + form.insertAdjacentHTML('beforeend', ''); form.querySelector('.tsmb-icon-close').addEventListener('click', function () { input.value = ''; - input.focus(); + state.hits = []; close(); + input.focus(); }); connect(); @@ -117,7 +120,7 @@ globalThis.tsminibar = function tsminibar (form, dataset = form.dataset) { let hits = cache.get(query); if (hits) { cache.delete(query); - cache.set(query, hits); // LRU + cache.set(query, hits); return hits; } searchParams.set('q', query);