jekyll-theme-amethyst 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d266106998f837dc87b9400d550b909e8d3c34d57bd3b4f0b1f38e3dc5c3d03b
4
- data.tar.gz: e5b5cd9501161c5221b4bd43b336202e0b0b22a77a6b2fcc77a5177e50e93d93
3
+ metadata.gz: 632ca2202b988416ea82997c0c2fb154ab96c7b806256ee2fd4e0e743a59faaf
4
+ data.tar.gz: cccf46ca9b07948abbfee973daba0ddff8fc1203c06ec6e3809109e01b8f39ec
5
5
  SHA512:
6
- metadata.gz: 0e4fa532ac951cbec039e6611db5924e57b50baea29fd8deaa7fc9d24568d3db18cbec26e2bcfe158dd1a46be5b52aad730a748ea2ba66f50e0be9c5f40d927d
7
- data.tar.gz: 70e27c6890f693c2b9c10fc0bf3d13915d2ca0146a916058ddafac5bf82809bc398ea270df69019a98cfde33d5ef38854c47d4f5fa060c3b8ccab57abb58d80d
6
+ metadata.gz: 870a76a617a6e746caf693d670d8a36f9c55de8789f68b4d41b3c7249e3c728aab153987daf0a2df32cbe37355ea1d9b7424099e8b15c50ce304fec00860f657
7
+ data.tar.gz: 56eda079a866dcfad9f3eaf8fe8a77592f873d53044a6b6fe535e91dbd9b0a78a8304decc4e4c237cce8f43e5bd4a756f393b014a787e89508a1874241a793d6
@@ -1,6 +1,6 @@
1
- <form role="search" class="tsmb-form"{% if site.amethyst.typesense.search_only_api_key %} data-origin="{{ site.amethyst.typesense.origin | escape }}" data-collection="{{ site.amethyst.typesense.collection | escape }}" data-key="{{ site.amethyst.typesense.search_only_api_key | escape }}" data-foot="true"{% endif %} action="https://duckduckgo.com">
1
+ <typesense-minibar>
2
+ <form role="search"{% if site.amethyst.typesense.search_only_api_key %} data-origin="{{ site.amethyst.typesense.origin | escape }}" data-collection="{{ site.amethyst.typesense.collection | escape }}" data-key="{{ site.amethyst.typesense.search_only_api_key | escape }}" data-foot="true"{% endif %} action="https://duckduckgo.com">
2
3
  <input type="search" name="q" aria-label="Search" placeholder="Search..." autocomplete="off">
3
4
  <input type="hidden" name="sites" value="{{ site.url | remove_first: 'http://' | remove_first: 'https://' }}">
4
5
  </form>
5
-
6
-
6
+ </typesense-minibar>
@@ -49,7 +49,7 @@
49
49
  </button>
50
50
  <script type="module">
51
51
  const searchToggle = document.querySelector('.search-toggle');
52
- const searchForm = document.querySelector('form[role=search]');
52
+ const searchForm = document.querySelector('typesense-minibar');
53
53
  const searchInput = searchForm.querySelector('input[type=search]');
54
54
  function searchFn(newState) {
55
55
  searchToggle.setAttribute('aria-expanded', String(newState));
data/_sass/amethyst.scss CHANGED
@@ -464,7 +464,7 @@ table {
464
464
 
465
465
  /* Search */
466
466
 
467
- .tsmb-form {
467
+ typesense-minibar {
468
468
  --tsmb-color-base-background: #{lighten($color-accent, 12%)};
469
469
  --tsmb-color-primary30: #{$color-accent};
470
470
  --tsmb-color-primary50: #{$color-vibrant};
@@ -473,22 +473,26 @@ table {
473
473
  --tsmb-color-base50: #{change-color($color-bright, $alpha: 0.6)}; // #a98dc1
474
474
  --tsmb-color-base90: #{change-color($color-bright, $alpha: 0.6)};
475
475
 
476
- width: auto;
477
476
  flex: 1;
478
477
  align-self: center;
479
478
  }
480
- .tsmb-form:not(:focus-within)::before {
479
+ typesense-minibar form {
480
+ width: auto;
481
+ }
482
+ typesense-minibar form:not(:focus-within)::before {
481
483
  filter: unquote("invert()");
482
484
  }
483
- .tsmb-form input[type="search"] {
485
+ typesense-minibar input[type="search"] {
484
486
  border: none;
485
487
  }
486
488
  @media (max-width: $screen-m) {
487
- .tsmb-form {
488
- display: none;
489
+ typesense-minibar {
490
+ --tsmb-size-input: calc( var(--tsmb-size-base) * 2.0 );
491
+
489
492
  flex: 100%;
490
493
  order: 10;
491
- --tsmb-size-input: calc( var(--tsmb-size-base) * 2.0 );
494
+ /* changed by button.search-toggle in wrapper.html */
495
+ display: none;
492
496
  }
493
497
  }
494
498
 
@@ -1,5 +1,6 @@
1
- /*! https://github.com/jquery/typesense-minibar 1.2.0 */
2
- .tsmb-form {
1
+ /*! https://github.com/jquery/typesense-minibar 1.3.1 */
2
+ .tsmb-form,
3
+ typesense-minibar {
3
4
  --tsmb-size-edge: 1px;
4
5
  --tsmb-size-radius: 3px;
5
6
  --tsmb-size-highlight: 2px;
@@ -23,7 +24,10 @@
23
24
  --tsmb-color-primary30: #390f39;
24
25
  --tsmb-color-primary50: #9c3493;
25
26
  --tsmb-color-primary90: #fbdbfb;
27
+ }
26
28
 
29
+ .tsmb-form,
30
+ typesense-minibar form {
27
31
  position: relative;
28
32
  width: 20rem;
29
33
  max-width: 100%;
@@ -31,7 +35,8 @@
31
35
  color: var(--tsmb-color-base30);
32
36
  }
33
37
 
34
- .tsmb-form input[type=search] {
38
+ .tsmb-form input[type=search],
39
+ typesense-minibar input[type=search] {
35
40
  box-sizing: border-box;
36
41
  -webkit-appearance: none;
37
42
  -moz-appearance: none;
@@ -46,31 +51,40 @@
46
51
  line-height: var(--tsmb-size-input);
47
52
  }
48
53
 
49
- .tsmb-form input[type=search]::placeholder {
54
+ .tsmb-form input[type=search]::placeholder,
55
+ typesense-minibar input[type=search]::placeholder {
50
56
  color: var(--tsmb-color-base50);
51
57
  opacity: 1;
52
58
  }
53
59
 
54
- .tsmb-form:focus-within {
60
+ .tsmb-form:focus-within,
61
+ typesense-minibar form:focus-within {
55
62
  color: var(--tsmb-color-focus30);
56
63
  }
57
64
 
58
- .tsmb-form:focus-within input[type=search] {
65
+ .tsmb-form:focus-within input[type=search],
66
+ typesense-minibar:focus-within input[type=search] {
59
67
  background: var(--tsmb-color-focus-background);
60
68
  }
61
69
 
62
- .tsmb-form:focus-within input[type=search]::placeholder {
70
+ .tsmb-form:focus-within input[type=search]::placeholder,
71
+ typesense-minibar:focus-within input[type=search]::placeholder {
63
72
  color: var(--tsmb-color-focus50);
64
73
  }
65
74
 
66
75
  .tsmb-form input[type=search]::-webkit-search-decoration,
67
76
  .tsmb-form input[type=search]::-webkit-search-cancel-button,
68
77
  .tsmb-form input[type=search]::-webkit-search-results-button,
69
- .tsmb-form input[type=search]::-webkit-search-results-decoration {
78
+ .tsmb-form input[type=search]::-webkit-search-results-decoration,
79
+ typesense-minibar input[type=search]::-webkit-search-decoration,
80
+ typesense-minibar input[type=search]::-webkit-search-cancel-button,
81
+ typesense-minibar input[type=search]::-webkit-search-results-button,
82
+ typesense-minibar input[type=search]::-webkit-search-results-decoration {
70
83
  display: none;
71
84
  }
72
85
 
73
- .tsmb-form::before {
86
+ .tsmb-form::before,
87
+ typesense-minibar form::before {
74
88
  content: '';
75
89
  background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='654 -372 1664 1664' width='20' height='20'><path d='M1806,332c0-123.3-43.8-228.8-131.5-316.5C1586.8-72.2,1481.3-116,1358-116s-228.8,43.8-316.5,131.5 C953.8,103.2,910,208.7,910,332s43.8,228.8,131.5,316.5C1129.2,736.2,1234.7,780,1358,780s228.8-43.8,316.5-131.5 C1762.2,560.8,1806,455.3,1806,332z M2318,1164c0,34.7-12.7,64.7-38,90s-55.3,38-90,38c-36,0-66-12.7-90-38l-343-342 c-119.3,82.7-252.3,124-399,124c-95.3,0-186.5-18.5-273.5-55.5s-162-87-225-150s-113-138-150-225S654,427.3,654,332 s18.5-186.5,55.5-273.5s87-162,150-225s138-113,225-150S1262.7-372,1358-372s186.5,18.5,273.5,55.5s162,87,225,150s113,138,150,225 S2062,236.7,2062,332c0,146.7-41.3,279.7-124,399l343,343C2305.7,1098.7,2318,1128.7,2318,1164z'/></svg>") 0 50% / contain no-repeat;
76
90
  position: absolute;
@@ -128,7 +142,8 @@
128
142
  color: var(--tsmb-color-base90);
129
143
  }
130
144
 
131
- .tsmb-form [role=listbox] {
145
+ .tsmb-form [role=listbox],
146
+ typesense-minibar [role=listbox] {
132
147
  position: absolute;
133
148
  z-index: 10;
134
149
  right: var(--tsmb-size-listbox-right);
@@ -149,29 +164,35 @@
149
164
  border-bottom: var(--tsmb-size-edge) solid var(--tsmb-color-focus90);
150
165
  }
151
166
 
152
- .tsmb-form [role=option] a {
167
+ .tsmb-form [role=option] a,
168
+ typesense-minibar [role=option] a {
153
169
  display: block;
154
170
  padding: var(--tsmb-size-base);
155
171
  text-decoration: none;
156
172
  border-left: var(--tsmb-size-highlight) solid transparent;
157
173
  }
158
174
 
159
- .tsmb-form:not([data-group=true]) [role=option]:not(:first-child) a {
175
+ .tsmb-form:not([data-group=true]) [role=option]:not(:first-child) a,
176
+ typesense-minibar form:not([data-group=true]) [role=option]:not(:first-child) a {
160
177
  border-top: var(--tsmb-size-edge) solid var(--tsmb-color-focus90);
161
178
  }
162
179
 
163
- .tsmb-form[data-group=true] [role=option] a {
180
+ .tsmb-form[data-group=true] [role=option] a,
181
+ typesense-minibar form[data-group=true] [role=option] a {
164
182
  margin: 0 var(--tsmb-size-base);
165
183
  padding: var(--tsmb-size-sm);
166
184
  }
167
185
 
168
186
  .tsmb-form [role=option] a:hover,
169
- .tsmb-form [role=option][aria-selected=true] a {
187
+ .tsmb-form [role=option][aria-selected=true] a,
188
+ typesense-minibar [role=option] a:hover,
189
+ typesense-minibar [role=option][aria-selected=true] a {
170
190
  background: var(--tsmb-color-primary90);
171
191
  border-left-color: var(--tsmb-color-primary50);
172
192
  }
173
193
 
174
- .tsmb-form [role=option] mark {
194
+ .tsmb-form [role=option] mark,
195
+ typesense-minibar [role=option] mark {
175
196
  background: none;
176
197
  color: inherit;
177
198
  font-style: normal;
@@ -1,4 +1,4 @@
1
- /*! https://github.com/jquery/typesense-minibar 1.2.0 */
1
+ /*! https://github.com/jquery/typesense-minibar 1.3.1 */
2
2
  globalThis.tsminibar = function tsminibar (form) {
3
3
  const { origin, collection } = form.dataset;
4
4
  const group = !!form.dataset.group;
@@ -42,7 +42,7 @@ globalThis.tsminibar = function tsminibar (form) {
42
42
  input.addEventListener('input', async function () {
43
43
  const query = state.query = input.value;
44
44
  if (!query) {
45
- state.hits = []; // don't leak old hits on focus
45
+ state.hits = [];
46
46
  state.cursor = -1;
47
47
  return close();
48
48
  }
@@ -72,7 +72,7 @@ globalThis.tsminibar = function tsminibar (form) {
72
72
  }
73
73
  });
74
74
  form.addEventListener('submit', function (e) {
75
- e.preventDefault(); // disable fallback
75
+ e.preventDefault();
76
76
  });
77
77
  form.insertAdjacentHTML('beforeend', '<svg viewBox="0 0 12 12" width="20" height="20" aria-hidden="true" class="tsmb-icon-close" style="display: none;"><path d="M9 3L3 9M3 3L9 9"/></svg>');
78
78
  form.querySelector('.tsmb-icon-close').addEventListener('click', function () {
@@ -151,9 +151,7 @@ globalThis.tsminibar = function tsminibar (form) {
151
151
  function render () {
152
152
  listbox.hidden = !state.open;
153
153
  form.classList.toggle('tsmb-form--open', state.open);
154
- if (state.open) {
155
- listbox.innerHTML = (state.hits.map((hit, i) => `<div role="option"${i === state.cursor ? ' aria-selected="true"' : ''}>${hit.lvl0 ? `<div class="tsmb-suggestion_group">${hit.lvl0}</div>` : ''}<a href="${hit.url}" tabindex="-1"><div class="tsmb-suggestion_title">${hit.title}</div><div class="tsmb-suggestion_content">${hit.content}</div></a></div>`).join('') || `<div class="tsmb-empty">${noResults.replace('{}', escape(state.query))}</div>`) + (form.dataset.foot ? '<a href="https://typesense.org" class="tsmb-foot" title="Search by Typesense"></a>' : '');
156
- }
154
+ listbox.innerHTML = (state.hits.map((hit, i) => `<div role="option"${i === state.cursor ? ' aria-selected="true"' : ''}>${hit.lvl0 ? `<div class="tsmb-suggestion_group">${hit.lvl0}</div>` : ''}<a href="${hit.url}" tabindex="-1"><div class="tsmb-suggestion_title">${hit.title}</div><div class="tsmb-suggestion_content">${hit.content}</div></a></div>`).join('') || `<div class="tsmb-empty">${noResults.replace('{}', escape(state.query))}</div>`) + (form.dataset.foot ? '<a href="https://typesense.org" class="tsmb-foot" title="Search by Typesense"></a>' : '');
157
155
  }
158
156
 
159
157
  function moveCursor (offset) {
@@ -166,4 +164,10 @@ globalThis.tsminibar = function tsminibar (form) {
166
164
 
167
165
  return { form, connect, disconnect };
168
166
  };
169
- document.querySelectorAll('.tsmb-form[data-origin]').forEach(form => tsminibar(form));
167
+ document.querySelectorAll('.tsmb-form[data-origin]').forEach(tsminibar);
168
+ window.customElements.define('typesense-minibar', class extends HTMLElement {
169
+ connectedCallback () {
170
+ const form = this.querySelector('form');
171
+ if (form) tsminibar(form);
172
+ }
173
+ });
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-amethyst
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timo Tijhof
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-07-02 00:00:00.000000000 Z
12
+ date: 2024-08-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jekyll