astro-accelerator 5.9.11 → 5.9.13

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.9.11",
2
+ "version": "5.9.13",
3
3
  "author": "Steve Fenton",
4
4
  "name": "astro-accelerator",
5
5
  "description": "A super-lightweight, accessible, SEO-friendly starter project for Astro",
@@ -21,9 +21,9 @@
21
21
  },
22
22
  "scripts": {
23
23
  "refresh": "npm version patch && pnpm update && pnpm test",
24
- "img": "node --no-experimental-fetch ./src/themes/accelerator/utilities/img.mjs",
25
- "dev": "node --no-experimental-fetch ./src/themes/accelerator/utilities/img.mjs && astro dev",
26
- "stats": "node --no-experimental-fetch ./src/themes/accelerator/utilities/stats.mjs",
24
+ "img": "node ./src/themes/accelerator/utilities/img.mjs",
25
+ "dev": "node ./src/themes/accelerator/utilities/img.mjs && astro dev",
26
+ "stats": "node ./src/themes/accelerator/utilities/stats.mjs",
27
27
  "spellcheck": "git fetch origin main:refs/remotes/origin/main && git diff origin/main --name-only --diff-filter=ACMRTUXB | cspell --no-must-find-files --file-list stdin",
28
28
  "test": "astro build && npx playwright install --with-deps && npx playwright test",
29
29
  "crawl": "linkinator ./dist --skip \"^(?!http://localhost)\" --skip \"/404/\" --recurse --verbosity error",
@@ -297,8 +297,8 @@ nav.skip-links a:focus {
297
297
  top: 0;
298
298
  z-index: 10;
299
299
  gap: 1rem;
300
- display: flex;
301
- justify-content: space-between;
300
+ display: grid;
301
+ grid-template-columns: auto 40px 40px;
302
302
  align-items: center;
303
303
  }
304
304
 
@@ -316,25 +316,20 @@ nav.skip-links a:focus {
316
316
  .site-header .site-title {
317
317
  letter-spacing: -1px;
318
318
  text-transform: uppercase;
319
+ text-align: left;
319
320
 
320
321
  @media (min-width: 338px) {
321
322
  flex-shrink: 0;
322
323
  }
323
324
  }
324
325
 
325
- .site-header .navigation-icon {
326
+ .site-header .header-icon {
326
327
  --icon-width: 40px;
327
- stroke: var(--link-head);
328
- border: 1px solid var(--link-head);
329
- border-radius: calc(var(--icon-width) / 2);
328
+ stroke: var(--icon-head);
330
329
  width: var(--icon-width);
331
330
  height: var(--icon-width);
332
331
  }
333
332
 
334
- .site-header .search-icon {
335
- stroke: var(--link-head);
336
- }
337
-
338
333
  /* Navigation */
339
334
 
340
335
  nav.site-nav.sticky {
@@ -343,7 +338,7 @@ nav.site-nav.sticky {
343
338
  }
344
339
 
345
340
  nav.site-nav h2 {
346
- margin-top: 0.1em;
341
+ margin-block-start: 0.1em;
347
342
  display: none;
348
343
 
349
344
  @media (max-width: 860px) {
@@ -352,10 +347,11 @@ nav.site-nav h2 {
352
347
  }
353
348
 
354
349
  .site-nav {
355
- margin-top: 2rem;
350
+ margin-block-start: 10rem;
351
+ margin-block-end: 1rem;
356
352
 
357
353
  @media (max-width: 860px) {
358
- grid-row: 2;
354
+ margin-block: 1rem;
359
355
  }
360
356
  }
361
357
 
@@ -464,25 +460,25 @@ nav.site-nav h2 {
464
460
  5vw,
465
461
  50vw
466
462
  );
467
- grid-template-areas:
468
- 'top top top top'
469
- 'left menu content right';
463
+ grid-template-areas: 'left nav content right';
470
464
  gap: var(--grid-gap);
471
465
  padding-top: 0;
472
466
 
473
467
  @media (max-width: 860px) {
474
468
  grid-template-columns: 1.5rem auto 1.5rem;
475
469
  grid-template-rows: auto auto auto;
476
- gap: 0;
477
470
  grid-template-areas:
478
- 'top top top'
479
471
  'left content right'
480
- 'left menu right';
472
+ 'left nav right';
473
+ gap: 0;
481
474
  }
482
475
  }
483
476
 
477
+ .content-group > main {
478
+ grid-area: content;
479
+ }
480
+
484
481
  .content-group header {
485
- grid-area: top;
486
482
  text-align: center;
487
483
  padding-bottom: var(--block-gap);
488
484
  max-width: 100%;
@@ -493,20 +489,15 @@ nav.site-nav h2 {
493
489
  margin: 0 auto;
494
490
  font-size: 2em;
495
491
  color: var(--fore-headings);
492
+ text-wrap: balance;
496
493
  }
497
494
 
498
495
  .content-group nav {
499
- grid-area: menu;
496
+ grid-area: nav;
500
497
  padding: 0 1rem 0 0;
501
498
  }
502
499
 
503
- .content-group main,
504
- .content-group article {
505
- display: contents;
506
- }
507
-
508
500
  .content-group article > .page-content {
509
- grid-area: content;
510
501
  width: calc(var(--content-width) - var(--navigation-width));
511
502
  max-width: calc(var(--grid-max-width) - var(--navigation-width));
512
503
 
@@ -617,169 +608,64 @@ nav.site-nav h2 {
617
608
 
618
609
  /* Site Search */
619
610
 
620
- .site-search-wrapper {
621
- position: relative;
622
- width: 100%;
623
- max-width: 34.75rem;
624
- transition: max-width var(--search-dropdown-duration) ease-in-out;
625
- }
626
-
627
- .site-search-wrapper.is-active {
628
- max-width: 57.8rem;
611
+ .site-search > fieldset {
612
+ height: 100%;
613
+ display: flex;
614
+ align-items: center;
629
615
  }
630
616
 
631
- .site-search {
632
- height: var(--search-height);
633
- border-radius: var(--search-border-radius);
634
- border: 1px solid var(--link-head);
635
- background-color: var(--white);
636
- position: relative;
637
- z-index: 1;
617
+ .site-search-wrapper input,
618
+ .site-search-wrapper button {
619
+ padding: 0.5em;
620
+ font-size: 1.3rem;
621
+ border-radius: var(--block-radius);
638
622
  }
639
623
 
640
- header .site-search-results {
641
- background-color: var(--white);
642
- position: absolute;
643
- top: var(--search-height);
644
- width: 100%;
645
- padding: 0;
646
- border-radius: var(--search-border-radius);
647
- border-radius: 0.9375rem;
648
- list-style-type: none;
649
- transition-property: padding, transform, visibility;
650
- transition-duration: var(--search-dropdown-duration);
651
- transition-timing-function: ease-in-out;
652
- visibility: hidden;
653
- transform: translateY(0) scaleY(0);
654
- z-index: 1;
655
- transform-origin: top;
656
- will-change: transform;
624
+ .site-search-wrapper input {
625
+ width: calc(100% - 110px);
657
626
  }
658
627
 
659
- .site-search.is-active + .site-search-results {
660
- padding: 1rem 0;
661
- transform: translateY(1.37rem) scaleY(1);
662
- visibility: visible;
628
+ .site-search-wrapper button {
629
+ width: 80px;
663
630
  }
664
631
 
665
- .site-search-results ul {
632
+ .site-search-results ul.site-search-results-list {
666
633
  list-style-type: none;
667
- margin-inline-start: 0;
668
- }
669
-
670
- header .site-search-results ul:not(.post-list):not(.result-headings) {
671
634
  margin: 0;
672
- max-height: var(--search-dropdown-height);
673
- overflow-y: scroll;
674
- }
675
-
676
- .site-search-overlay {
677
- opacity: 0;
678
- visibility: hidden;
679
- background: rgba(12, 26, 36, 0.3);
680
- position: fixed;
681
- top: 0;
682
- left: 0;
683
- right: 0;
684
- bottom: 0;
685
- transition: opacity var(--search-dropdown-duration) ease-in-out;
686
- z-index: 1;
687
- }
688
-
689
- .site-search-wrapper.is-active .site-search-overlay {
690
- opacity: 1;
691
- visibility: visible;
692
- }
693
-
694
- .site-search-query {
695
- width: 100%;
696
- background: transparent;
697
- height: 100%;
698
- padding: 0 1rem;
699
- width: calc(100% - 2rem);
700
- font-size: 1.25rem;
701
- color: var(--link-head);
702
- }
703
-
704
- .search-results-heading {
705
- visibility: hidden;
706
- }
707
-
708
- .site-search.is-active + .site-search-results > .search-results-heading {
709
- visibility: visible;
710
635
  }
711
636
 
712
- .site-search-results-item {
713
- background-color: transparent;
714
- transition-property: background-color, border-color;
715
- transition-duration: var(--search-dropdown-duration);
716
- transition-timing-function: ease-in-out;
717
- border-bottom: 0.0625rem solid;
718
- border-color: var(--search-item-border-color);
719
- position: relative;
720
-
721
- @media (max-width: 930px) {
722
- padding: 1rem;
723
- }
637
+ .site-search-results ul.site-search-results-list > li {
638
+ list-style-type: none;
639
+ margin-block: 2rem;
640
+ padding-block-end: 2rem;
724
641
  }
725
642
 
726
- .site-search-results-item:hover,
727
- .site-search-results-item:focus-within {
728
- --hover-color: rgba(13, 128, 216, 0.07);
729
- background-color: var(--hover-color);
730
- border-color: var(--hover-color);
643
+ .site-search-results ul.site-search-results-list > li:not(:last-child) {
644
+ border-bottom: 1px solid var(--fore);
731
645
  }
732
646
 
733
- .site-search-results-item a:hover,
734
- .site-search-results-item a:focus {
735
- color: var(--fore-link-alt);
647
+ .site-search-results-item a {
648
+ text-decoration: none;
736
649
  }
737
650
 
738
- .site-search-results-item::after {
739
- content: '';
651
+ .site-search-results .show-more {
652
+ margin-block-start: 1rem;
740
653
  display: inline-block;
741
- width: 0.75rem;
742
- height: 1.25rem;
743
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='20' viewBox='0 0 12 20' fill='none'%3E%3Cpath d='M2 18L10 10L2 2' stroke='%230D80D8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
744
- background-size: 0.75rem 1.25rem;
745
- background-repeat: no-repeat;
746
- position: absolute;
747
- right: 2rem;
748
- top: 50%;
749
- transform: translateY(-50%) translateX(-1rem);
750
- opacity: 0;
751
- transition-property: opacity, transform;
752
- transition-duration: var(--search-dropdown-duration);
753
- transition-timing-function: ease-in-out;
754
- }
755
-
756
- .site-search-results-item:hover::after {
757
- opacity: 1;
758
- transform: translateY(-50%) translateX(0);
759
- }
760
-
761
- .result-wrapper {
762
- display: flex;
654
+ font-size: 1.2rem;
655
+ border-radius: 100px;
763
656
  text-decoration: none;
764
- flex-direction: column;
765
- gap: 0.56rem;
766
- text-align: left;
767
- @media (max-width: 930px) {
768
- padding: 1rem;
769
- }
770
- }
771
-
772
- header .result-wrapper {
773
- padding: 1.5rem 3.6rem 1.75rem;
774
- }
775
-
776
- .result-wrapper:hover {
777
- background-color: initial;
657
+ text-align: center;
658
+ padding: 0.2em 0.6em 0.3em 0.6em;
659
+ color: var(--aft-link-alt);
660
+ background-color: var(--fore-link);
661
+ cursor: pointer;
778
662
  }
779
663
 
780
664
  .result-wrapper mark,
781
665
  .result-headings mark {
782
- background-color: var(--aft-mark);
666
+ color: unset;
667
+ background-color: unset;
668
+ text-decoration: underline;
783
669
  }
784
670
 
785
671
  .result-path {
@@ -789,6 +675,7 @@ header .result-wrapper {
789
675
  display: flex;
790
676
  gap: 0.5rem;
791
677
  flex-wrap: wrap;
678
+ font-family: monospace;
792
679
  }
793
680
 
794
681
  .result-path-icon {
@@ -801,7 +688,7 @@ header .result-wrapper {
801
688
 
802
689
  .result-title {
803
690
  color: var(--link-head);
804
- font-size: 1.25rem;
691
+ font-size: 1.5rem;
805
692
  font-weight: 700;
806
693
  }
807
694
 
@@ -812,72 +699,6 @@ header .result-wrapper {
812
699
  margin: 0;
813
700
  }
814
701
 
815
- .site-search > fieldset {
816
- height: 100%;
817
- display: flex;
818
- align-items: center;
819
- padding: 0 1rem;
820
- }
821
-
822
- .site-search-remove {
823
- margin-left: auto;
824
- background-color: transparent;
825
- padding: 0.5rem;
826
- cursor: pointer;
827
- visibility: hidden;
828
- transition: transform var(--search-dropdown-duration) ease-in-out;
829
- display: flex;
830
- justify-content: center;
831
- align-items: center;
832
- }
833
-
834
- .site-search-remove:hover {
835
- transform: scale(1.2);
836
- }
837
-
838
- .site-search.is-active .site-search-remove {
839
- visibility: visible;
840
- }
841
-
842
- .site-search-mobile {
843
- display: none;
844
- }
845
-
846
- @media (max-width: 930px) {
847
- .site-header .site-search-wrapper {
848
- max-width: -moz-fit-content;
849
- max-width: fit-content;
850
- }
851
-
852
- .site-header .site-search {
853
- display: none;
854
- }
855
-
856
- .site-header .site-search-mobile {
857
- --search-mobile-size: 40px;
858
- display: flex;
859
- width: var(--search-mobile-size);
860
- height: var(--search-mobile-size);
861
- border: 1px solid var(--link-head);
862
- border-radius: calc(var(--search-mobile-size) / 2);
863
- justify-content: center;
864
- align-items: center;
865
- fill: var(--link-head);
866
- }
867
- }
868
-
869
- .site-search-results .show-more {
870
- display: inline-block;
871
- font-size: 1.2rem;
872
- border-radius: 100px;
873
- text-decoration: none;
874
- text-align: center;
875
- padding: 0.2em 0.6em 0.3em 0.6em;
876
- color: var(--aft-link-alt);
877
- background-color: var(--fore-link);
878
- cursor: pointer;
879
- }
880
-
881
702
  .result-headings {
882
703
  display: grid;
883
704
  grid-template-columns: 1fr 1fr;
@@ -888,57 +709,6 @@ header .result-wrapper {
888
709
  font-size: 1rem;
889
710
  }
890
711
 
891
- header .result-headings li {
892
- padding: 0.1rem 3.6rem;
893
- }
894
-
895
- .show-more {
896
- padding: 0.5em 1em;
897
- background-color: var(--fore-link);
898
- color: var(--aft-link-alt);
899
- }
900
-
901
- /* Search dialog */
902
-
903
- .search-dialog {
904
- margin: auto;
905
- padding: 2rem 3rem;
906
- border-radius: var(--block-radius);
907
- box-shadow: var(--box-shadow);
908
- height: calc(90vh - 4em);
909
- width: calc(80vw - 6em);
910
- max-width: 860px;
911
-
912
- @media (max-width: 860px) {
913
- /* Fallback */
914
- height: calc(100vh - 4rem);
915
- width: calc(100vw - 6rem);
916
- /* Ideal units */
917
- height: calc(100dvh - 4rem);
918
- width: calc(100dvw - 6rem);
919
- }
920
- }
921
-
922
- .search-dialog::backdrop {
923
- background-color: #000;
924
- opacity: 0.5;
925
- }
926
-
927
- .search-dialog form {
928
- margin-top: 2rem;
929
- }
930
-
931
- #site-search-close {
932
- float: right;
933
- position: relative;
934
- top: -1rem;
935
- left: 2.5rem;
936
- background: none;
937
- cursor: pointer;
938
- font-size: 2rem;
939
- stroke: var(--link-head);
940
- }
941
-
942
712
  /* Articles */
943
713
 
944
714
  .post-list {
@@ -17,6 +17,7 @@
17
17
 
18
18
  --fore-head: #333;
19
19
  --aft-head: #e6e8f1;
20
+ --icon-head: #2d4295;
20
21
 
21
22
  --fore-breadcrumb: #333;
22
23
  --aft-breadcrumb: #f3f5ff;
@@ -28,8 +29,6 @@
28
29
  --aft-block: #f3f5ff;
29
30
  --icon-block: #4d71ff;
30
31
 
31
- --aft-mark: #eef;
32
-
33
32
  --fore-table-head: #fdfdfe;
34
33
  --aft-table-head: #2f3141;
35
34
  --fore-table-row-odd: #333;
@@ -59,16 +58,6 @@
59
58
 
60
59
  /* Calculate the mobile width by removing l/r columns and grid gap */
61
60
  --content-width-mobile: calc(100vw - (1rem * 2));
62
-
63
- /* Search variables */
64
- --white: #fff;
65
- --search-height: 3rem;
66
- --search-border-radius: calc(var(--search-height) / 2);
67
- --search-results-padding: 1rem;
68
- --search-border: 0.0625rem solid #76a1c2;
69
- --search-dropdown-height: 65vh;
70
- --search-dropdown-duration: 0.3s;
71
- --search-item-border-color: #dae2e9;
72
61
  }
73
62
 
74
63
  @media (prefers-color-scheme: dark) {
@@ -83,6 +72,7 @@
83
72
 
84
73
  --fore-head: #ccc;
85
74
  --aft-head: #222;
75
+ --icon-head: #abb9ef;
86
76
 
87
77
  --fore-breadcrumb: #ccc;
88
78
  --aft-breadcrumb: #2c2c2c;
@@ -100,10 +90,5 @@
100
90
  --aft-table-row-odd: #333;
101
91
  --fore-table-row-even: #ccc;
102
92
  --aft-table-row-even: #444;
103
-
104
- /* Search variables */
105
- --white: var(--aft);
106
- --search-border: 0.0625rem solid var(--link-alt-head);
107
- --search-item-border-color: var(--link-head);
108
93
  }
109
94
  }
@@ -72,16 +72,23 @@ function unique(value, index, array) {
72
72
  */
73
73
 
74
74
  function initializeSearch() {
75
- const siteSearchInput = qs('[data-site-search-query]');
76
- const siteSearchWrapper = qs('[data-site-search-wrapper]');
77
- const siteSearchElement = qs('[data-site-search]');
78
- const siteSearchResults = qs('[data-site-search-results');
79
- const removeSearchButton = qs('[data-site-search-remove]');
75
+ const siteSearchInput = /** @type {HTMLInputElement} */ (
76
+ qs('.site-search-query')
77
+ );
78
+ const siteSearchWrapper = /** @type {HTMLElement} */ (
79
+ qs('.site-search-wrapper')
80
+ );
81
+ const siteSearchElement = /** @type {HTMLFormElement} */ (
82
+ qs('.site-search-wrapper > form')
83
+ );
84
+ const siteSearchResults = /** @type {HTMLElement} */ (
85
+ qs('.site-search-results')
86
+ );
80
87
 
81
88
  /** @type {SearchEntry[]} */
82
89
  var haystack = [];
83
90
  var currentQuery = '';
84
- var dataUrl = siteSearchElement.dataset.sourcedata;
91
+ var dataUrl = /** @type {string} */ (siteSearchElement.dataset.sourcedata);
85
92
 
86
93
  // Legacy scoring
87
94
  var scoring = {
@@ -105,139 +112,6 @@ function initializeSearch() {
105
112
  };
106
113
 
107
114
  var ready = false;
108
- var scrolled = false;
109
-
110
- siteSearchInput.addEventListener('focus', () => activateInput());
111
-
112
- function deactivate(e) {
113
- if (
114
- !siteSearchElement.contains(e.target) &&
115
- !siteSearchResults.contains(e.target)
116
- ) {
117
- closeDropdown();
118
-
119
- const duration = getComputedStyle(
120
- siteSearchWrapper
121
- ).getPropertyValue('--search-dropdown-duration');
122
-
123
- // Convert duration to milliseconds for setTimeout
124
- const durationMs =
125
- parseFloat(duration) * (duration.endsWith('ms') ? 1 : 1000);
126
-
127
- setTimeout(() => {
128
- deactivateInput();
129
- }, durationMs);
130
- }
131
- }
132
-
133
- // Close the dropdown upon activity outside the search
134
- document.addEventListener('click', deactivate);
135
- document.addEventListener('keydown', deactivate);
136
-
137
- function removeSearch() {
138
- clearInput();
139
- deactivateInput();
140
- debounceSearch();
141
- siteSearchInput.focus();
142
- }
143
-
144
- // Clear the search input
145
- removeSearchButton.addEventListener('click', () => {
146
- removeSearch();
147
- });
148
-
149
- // Dropdown accessibility controls
150
- document.addEventListener('keydown', handleDropdownKeyboardNavigation);
151
-
152
- function activateInput() {
153
- if (
154
- siteSearchWrapper.classList.contains('is-active') ||
155
- siteSearchInput.value.trim().length === 0
156
- ) {
157
- return;
158
- }
159
- siteSearchWrapper.classList.add('is-active');
160
- openDropdown();
161
- }
162
-
163
- function deactivateInput() {
164
- if (!siteSearchWrapper.classList.contains('is-active')) {
165
- return;
166
- }
167
- siteSearchWrapper.classList.remove('is-active');
168
- }
169
-
170
- function openDropdown() {
171
- siteSearchElement.classList.add('is-active');
172
-
173
- requestAnimationFrame(() => {
174
- const dropdownHeightPercentage = parseFloat(
175
- getComputedStyle(siteSearchWrapper).getPropertyValue(
176
- '--search-dropdown-height'
177
- )
178
- );
179
- // Convert vh to pixels
180
- const dropdownHeight =
181
- window.innerHeight * (dropdownHeightPercentage / 100) + 32;
182
- const siteSearchElementRect =
183
- siteSearchElement.getBoundingClientRect();
184
- const offsetFromBottomToElement =
185
- window.innerHeight - siteSearchElementRect.bottom;
186
-
187
- if (offsetFromBottomToElement < dropdownHeight) {
188
- document.body.style.overflow = '';
189
-
190
- // Scroll to the siteSearchElement
191
- siteSearchElement.scrollIntoView({
192
- behavior: 'smooth',
193
- block: 'start',
194
- });
195
-
196
- // Delay the overflow to allow for smooth scrolling
197
- setTimeout(() => {
198
- document.body.style.overflow = 'hidden';
199
- }, 300);
200
- }
201
- });
202
- }
203
-
204
- function closeDropdown() {
205
- siteSearchElement.classList.remove('is-active');
206
- }
207
-
208
- function clearInput() {
209
- closeDropdown();
210
- siteSearchInput.value = '';
211
- }
212
-
213
- function handleDropdownKeyboardNavigation(e) {
214
- // Proceed only if search dropdown is active
215
- if (!siteSearchWrapper.classList.contains('is-active')) return;
216
-
217
- if (e.key === 'Escape') {
218
- removeSearch();
219
- return;
220
- }
221
-
222
- if (e.key === 'Tab') {
223
- const firstElement = siteSearchInput;
224
- const lastElement =
225
- siteSearchResults.querySelector('button') ||
226
- siteSearchResults.querySelector(
227
- '.site-search-results-item:last-child .result-wrapper'
228
- );
229
-
230
- if (e.shiftKey && document.activeElement === firstElement) {
231
- // Shift + Tab: Move focus to the last element if the first element is currently focused
232
- e.preventDefault();
233
- if (lastElement) lastElement.focus();
234
- } else if (!e.shiftKey && document.activeElement === lastElement) {
235
- // Tab: Move focus to the first element if the last element is currently focused
236
- e.preventDefault();
237
- firstElement.focus();
238
- }
239
- }
240
- }
241
115
 
242
116
  /** @type{Synonyms | null} */
243
117
  var _synonyms = null;
@@ -293,15 +167,6 @@ function initializeSearch() {
293
167
  async function search(s, r) {
294
168
  const numberOfResults = r ?? 12;
295
169
 
296
- // Add 'is-active' class when search is performed
297
- if (s && s.trim().length > 0) {
298
- activateInput();
299
- openDropdown();
300
- } else if (siteSearchElement.classList.contains('is-active')) {
301
- // Remove 'is-active' class when search is cleared
302
- closeDropdown();
303
- }
304
-
305
170
  /** @type {SearchEntry[]} */
306
171
  let needles = [];
307
172
 
@@ -464,7 +329,7 @@ function initializeSearch() {
464
329
  const results = siteSearchResults;
465
330
 
466
331
  const ul = document.createElement('ul');
467
- ul.className = 'site-search-results__list';
332
+ ul.className = 'site-search-results-list';
468
333
 
469
334
  const limit = Math.min(needles.length, numberOfResults);
470
335
 
@@ -483,6 +348,7 @@ function initializeSearch() {
483
348
  listElementWrapper.className = 'result-wrapper';
484
349
 
485
350
  const listElementTitle = document.createElement('span');
351
+
486
352
  // Only highlight user query terms, not stemmed terms
487
353
  listElementTitle.innerHTML = highlight(needle.title, queryTerms);
488
354
  listElementTitle.className = 'result-title';
@@ -584,7 +450,7 @@ function initializeSearch() {
584
450
  await search(s, newTotal);
585
451
  window.setTimeout(function () {
586
452
  const previousPosition = qs(
587
- `.site-search-results__list li:nth-child(${oldTotal}) > a`
453
+ `.site-search-results-list li:nth-child(${oldTotal}) > a`
588
454
  );
589
455
  console.log(previousPosition.outerHTML);
590
456
  previousPosition.focus();
@@ -617,7 +483,7 @@ function initializeSearch() {
617
483
  var input = siteSearchInput;
618
484
 
619
485
  if (input == null) {
620
- throw new Error('Cannot find data-site-search-query');
486
+ throw new Error('Cannot find .site-search-query');
621
487
  }
622
488
 
623
489
  // Words chained with . are combined, i.e. System.Text is "systemtext"
@@ -662,7 +528,7 @@ function initializeSearch() {
662
528
 
663
529
  if (siteSearch == null || siteSearchQuery == null) {
664
530
  throw new Error(
665
- 'Cannot find #site-search or data-site-search-query'
531
+ 'Cannot find #site-search or .site-search-query'
666
532
  );
667
533
  }
668
534
 
@@ -674,10 +540,6 @@ function initializeSearch() {
674
540
 
675
541
  siteSearchQuery.addEventListener('keyup', function (e) {
676
542
  e.preventDefault();
677
- if (!scrolled) {
678
- scrolled = true;
679
- this.scrollIntoView(true);
680
- }
681
543
  debounceSearch();
682
544
  return false;
683
545
  });
@@ -704,9 +566,7 @@ function initializeSearch() {
704
566
  }
705
567
 
706
568
  if (document.readyState === 'loading') {
707
- // Loading hasn't finished yet
708
569
  document.addEventListener('DOMContentLoaded', initializeSearch);
709
570
  } else {
710
- // `DOMContentLoaded` has already fired
711
571
  initializeSearch();
712
572
  }
@@ -1,11 +1,10 @@
1
1
  ---
2
2
  // warning: This file is overwritten by Astro Accelerator
3
3
 
4
- import { Accelerator } from "astro-accelerator-utils";
4
+ import { Accelerator, PostFiltering } from "astro-accelerator-utils";
5
5
  import type { Frontmatter } from "astro-accelerator-utils/types/Frontmatter";
6
6
  import { SITE } from "@config";
7
7
  import { Translations, Lang } from "@util/Languages";
8
- import Search from "./Search.astro";
9
8
 
10
9
  const accelerator = new Accelerator(SITE);
11
10
  const stats = new accelerator.statistics("accelerator/components/Header.astro");
@@ -23,31 +22,25 @@ const { lang, showSearch } = Astro.props satisfies Props;
23
22
  // Language
24
23
  const _ = Lang(lang);
25
24
 
25
+ const search = accelerator.posts.all().filter(PostFiltering.isSearch).shift() ?? null;
26
+ const searchUrl = (search && accelerator.urlFormatter.formatAddress(search.url)) || SITE.search.fallbackUrl;
27
+
26
28
  stats.stop();
27
29
  ---
28
30
 
29
31
  <header class="site-header">
30
32
  <a href={ (SITE.subfolder ?? '') + '/' } class="site-title" translate="no">{ SITE.title }</a>
31
- <Search lang={ lang } showSearch={ showSearch } />
32
- <a
33
- href="#site-nav"
34
- data-navigationid="site-nav"
35
- class="navigation-icon"
36
- title={_(Translations.header.toggle_menu)}
37
- ><svg
38
- xmlns="http://www.w3.org/2000/svg"
39
- width="40"
40
- height="40"
41
- viewBox="0 0 24 24"
42
- stroke-width="1.5"
43
- fill="none"
44
- stroke-linecap="round"
45
- stroke-linejoin="round"
46
- >
33
+ <a href={searchUrl} class="header-icon">
34
+ <svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 20 19" stroke-width="1" fill="none" stroke-linecap="round" stroke-linejoin="round">
35
+ <path d="M19.0524 16.4267L15.3727 12.7273C15.2067 12.5603 14.9815 12.4675 14.7453 12.4675H14.1437C15.1624 11.1577 15.7676 9.5102 15.7676 7.718C15.7676 3.45455 12.3316 0 8.09097 0C3.85035 0 0.414307 3.45455 0.414307 7.718C0.414307 11.9814 3.85035 15.436 8.09097 15.436C9.87358 15.436 11.5123 14.8275 12.8151 13.8033V14.4082C12.8151 14.6456 12.9073 14.872 13.0734 15.039L16.7531 18.7384C17.1 19.0872 17.661 19.0872 18.0042 18.7384L19.0487 17.6883C19.3956 17.3395 19.3956 16.7755 19.0524 16.4267ZM8.09097 12.4675C5.48164 12.4675 3.36687 10.3451 3.36687 7.718C3.36687 5.09462 5.47795 2.96846 8.09097 2.96846C10.7003 2.96846 12.8151 5.09091 12.8151 7.718C12.8151 10.3414 10.704 12.4675 8.09097 12.4675Z"></path>
36
+ </svg>
37
+ </a>
38
+ <a href="#site-nav" data-navigationid="site-nav" class="header-icon" title={_(Translations.header.toggle_menu)}>
39
+ <svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 24 24" stroke-width="1.5" fill="none" stroke-linecap="round" stroke-linejoin="round">
47
40
  <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
48
41
  <line x1="4" y1="6" x2="20" y2="6"></line>
49
42
  <line x1="4" y1="12" x2="20" y2="12"></line>
50
43
  <line x1="4" y1="18" x2="20" y2="18"></line>
51
- </svg></a
52
- >
44
+ </svg>
45
+ </a>
53
46
  </header>
@@ -18,86 +18,19 @@ const _ = Lang(lang);
18
18
  // Logic
19
19
  const siteUrl = Astro.site ? Astro.site.href : "";
20
20
  const accelerator = new Accelerator(SITE);
21
- const search =
22
- accelerator.posts.all().filter(PostFiltering.isSearch).shift() ?? null;
23
- const searchUrl =
24
- (search && accelerator.urlFormatter.formatAddress(search.url)) ||
25
- SITE.search.fallbackUrl;
21
+
26
22
  ---
27
- <div class="site-search-wrapper" data-site-search-wrapper>
23
+ <div class="site-search-wrapper">
28
24
  {showSearch &&
29
- <div class="site-search-overlay"></div>
30
- <form
31
- method="GET"
32
- action={SITE.search.fallbackUrl ?? "https://www.google.com/search"}
33
- role="search"
34
- class="site-search"
35
- autocomplete="off"
36
- data-sourcedata={SITE.subfolder + "/search.json"}
37
- data-site-search
38
- >
25
+ <form method="GET" action={SITE.search.fallbackUrl ?? "https://www.google.com/search"} role="search" autocomplete="off" data-sourcedata={SITE.subfolder + "/search.json"}>
39
26
  <fieldset>
40
- <input
41
- type="hidden"
42
- name={SITE.search.fallbackSite ?? "q"}
43
- value={"site:" + siteUrl}
44
- />
45
- <svg
46
- xmlns="http://www.w3.org/2000/svg"
47
- width="20"
48
- height="19"
49
- viewBox="0 0 20 19"
50
- >
51
- <path
52
- d="M19.0524 16.4267L15.3727 12.7273C15.2067 12.5603 14.9815 12.4675 14.7453 12.4675H14.1437C15.1624 11.1577 15.7676 9.5102 15.7676 7.718C15.7676 3.45455 12.3316 0 8.09097 0C3.85035 0 0.414307 3.45455 0.414307 7.718C0.414307 11.9814 3.85035 15.436 8.09097 15.436C9.87358 15.436 11.5123 14.8275 12.8151 13.8033V14.4082C12.8151 14.6456 12.9073 14.872 13.0734 15.039L16.7531 18.7384C17.1 19.0872 17.661 19.0872 18.0042 18.7384L19.0487 17.6883C19.3956 17.3395 19.3956 16.7755 19.0524 16.4267ZM8.09097 12.4675C5.48164 12.4675 3.36687 10.3451 3.36687 7.718C3.36687 5.09462 5.47795 2.96846 8.09097 2.96846C10.7003 2.96846 12.8151 5.09091 12.8151 7.718C12.8151 10.3414 10.704 12.4675 8.09097 12.4675Z"
53
- ></path>
54
- </svg>
55
- <input
56
- type="text"
57
- name={SITE.search.fallbackSite ?? "q"}
58
- class="site-search-query"
59
- placeholder={_(Translations.search.search_for)}
60
- spellcheck="true"
61
- autocomplete="off"
62
- data-site-search-query
63
- />
64
- <button
65
- class="site-search-remove"
66
- type="button"
67
- data-site-search-remove
68
- >
69
- <svg
70
- xmlns="http://www.w3.org/2000/svg"
71
- width="11"
72
- height="11"
73
- viewBox="0 0 11 11"
74
- >
75
- <path
76
- d="M7.585 5.5L10.7122 2.37281C11.0959 1.98906 11.0959 1.36687 10.7122 0.982812L10.0172 0.287813C9.63344 -0.0959375 9.01125 -0.0959375 8.62719 0.287813L5.5 3.415L2.37281 0.287813C1.98906 -0.0959375 1.36688 -0.0959375 0.982813 0.287813L0.287813 0.982812C-0.0959375 1.36656 -0.0959375 1.98875 0.287813 2.37281L3.415 5.5L0.287813 8.62719C-0.0959375 9.01094 -0.0959375 9.63312 0.287813 10.0172L0.982813 10.7122C1.36656 11.0959 1.98906 11.0959 2.37281 10.7122L5.5 7.585L8.62719 10.7122C9.01094 11.0959 9.63344 11.0959 10.0172 10.7122L10.7122 10.0172C11.0959 9.63344 11.0959 9.01125 10.7122 8.62719L7.585 5.5Z"
77
- fill="#355670"></path>
78
- </svg>
79
- </button>
27
+ <input type="hidden" name={SITE.search.fallbackSite ?? "q"} value={"site:" + siteUrl} />
28
+ <input type="text" name={SITE.search.fallbackSite ?? "q"} class="site-search-query" placeholder={_(Translations.search.search_for)} spellcheck="true" autocomplete="off" />
29
+ <button type="submit" set:html={_(Translations.search.submit)}></button>
80
30
  </fieldset>
81
31
  </form>
82
- <div
83
- class="site-search-results"
84
- data-title={_(Translations.search.results_title)}
85
- data-emptytitle={_(Translations.search.no_results_title)}
86
- data-site-search-results
87
- >
32
+ <div class="site-search-results" data-title={_(Translations.search.results_title)} data-emptytitle={_(Translations.search.no_results_title)}>
88
33
  </div>
89
34
  <script src={SITE.subfolder + "/js/search.js"} type="module" async></script>
90
35
  }
91
- <a href={searchUrl} class="site-search-mobile">
92
- <svg
93
- xmlns="http://www.w3.org/2000/svg"
94
- width="20"
95
- height="19"
96
- viewBox="0 0 20 19"
97
- >
98
- <path
99
- d="M19.0524 16.4267L15.3727 12.7273C15.2067 12.5603 14.9815 12.4675 14.7453 12.4675H14.1437C15.1624 11.1577 15.7676 9.5102 15.7676 7.718C15.7676 3.45455 12.3316 0 8.09097 0C3.85035 0 0.414307 3.45455 0.414307 7.718C0.414307 11.9814 3.85035 15.436 8.09097 15.436C9.87358 15.436 11.5123 14.8275 12.8151 13.8033V14.4082C12.8151 14.6456 12.9073 14.872 13.0734 15.039L16.7531 18.7384C17.1 19.0872 17.661 19.0872 18.0042 18.7384L19.0487 17.6883C19.3956 17.3395 19.3956 16.7755 19.0524 16.4267ZM8.09097 12.4675C5.48164 12.4675 3.36687 10.3451 3.36687 7.718C3.36687 5.09462 5.47795 2.96846 8.09097 2.96846C10.7003 2.96846 12.8151 5.09091 12.8151 7.718C12.8151 10.3414 10.704 12.4675 8.09097 12.4675Z"
100
- ></path>
101
- </svg>
102
- </a>
103
36
  </div>
@@ -7,7 +7,7 @@
7
7
  "en": "Site"
8
8
  },
9
9
  "toc": {
10
- "en": "Table of contents"
10
+ "en": "On this page"
11
11
  },
12
12
  "paging": {
13
13
  "en": "Paging"
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "toc": {
50
50
  "title": {
51
- "en": "Table of contents"
51
+ "en": "On this page"
52
52
  }
53
53
  },
54
54
  "footer": {