@seqera/docusaurus-theme-seqera 1.0.25 → 1.0.26-next.85
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/lib/getSwizzleConfig.js +0 -9
- package/lib/theme/SearchPage/generalUtils.d.ts +4 -0
- package/lib/theme/SearchPage/generalUtils.js +19 -0
- package/lib/theme/SearchPage/index.d.ts +1 -0
- package/lib/theme/SearchPage/index.js +836 -0
- package/lib/theme/SearchPage/styles.module.css +325 -0
- package/lib/theme/SearchPage/useSearchPage.d.ts +7 -0
- package/lib/theme/SearchPage/useSearchPage.js +68 -0
- package/package.json +3 -1
- package/src/getSwizzleConfig.ts +0 -10
- package/src/theme/SearchPage/generalUtils.ts +20 -0
- package/src/theme/SearchPage/index.tsx +943 -0
- package/src/theme/SearchPage/styles.module.css +325 -0
- package/src/theme/SearchPage/useSearchPage.ts +67 -0
- package/src/theme-seqera.d.ts +3 -0
- package/lib/theme/SearchBar.d.ts +0 -1
- package/lib/theme/SearchBar.js +0 -5
- package/src/theme/SearchBar.tsx +0 -8
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
.searchQueryInput,
|
|
9
|
+
.searchVersionInput {
|
|
10
|
+
border-radius: 0.5rem;
|
|
11
|
+
border: 1px solid #d1d5db;
|
|
12
|
+
font-size: 0.875rem;
|
|
13
|
+
height: 2.25rem;
|
|
14
|
+
padding: 0 0.75rem;
|
|
15
|
+
width: 100%;
|
|
16
|
+
background: white;
|
|
17
|
+
color: #111827;
|
|
18
|
+
margin-bottom: 0.5rem;
|
|
19
|
+
transition: border-color 0.15s;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.searchQueryInput:focus,
|
|
23
|
+
.searchVersionInput:focus {
|
|
24
|
+
border-color: #6b7280;
|
|
25
|
+
outline: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.searchQueryInput::placeholder {
|
|
29
|
+
color: #6b7280;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
[data-theme='dark'] .searchQueryInput,
|
|
33
|
+
[data-theme='dark'] .searchVersionInput {
|
|
34
|
+
background: #111827;
|
|
35
|
+
border-color: #374151;
|
|
36
|
+
color: white;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[data-theme='dark'] .searchQueryInput:focus,
|
|
40
|
+
[data-theme='dark'] .searchVersionInput:focus {
|
|
41
|
+
border-color: #4b5563;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
[data-theme='dark'] .searchQueryInput::placeholder {
|
|
45
|
+
color: #6b7280;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.searchInputRow {
|
|
49
|
+
display: flex;
|
|
50
|
+
gap: 0.5rem;
|
|
51
|
+
align-items: center;
|
|
52
|
+
flex-wrap: wrap;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.searchInputRow .searchQueryInput {
|
|
56
|
+
flex: 1;
|
|
57
|
+
margin-bottom: 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* At narrow widths the input takes the full first row;
|
|
61
|
+
the filter and search button drop together to the next row */
|
|
62
|
+
@media (max-width: 640px) {
|
|
63
|
+
.searchInputRow .searchQueryInput {
|
|
64
|
+
flex: 0 0 100%;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.searchQueryButton {
|
|
69
|
+
border-radius: 4px;
|
|
70
|
+
transition: all 0.3s;
|
|
71
|
+
color: black;
|
|
72
|
+
background: var(--color-nextflow-500);
|
|
73
|
+
border: 1px solid var(--color-nextflow-700);
|
|
74
|
+
font-weight: 500;
|
|
75
|
+
font-size: 0.9rem;
|
|
76
|
+
text-align: center;
|
|
77
|
+
padding: 0.3rem 1rem;
|
|
78
|
+
cursor: pointer;
|
|
79
|
+
white-space: nowrap;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.searchQueryButton:hover {
|
|
83
|
+
background: var(--color-nextflow-700);
|
|
84
|
+
border-color: var(--color-nextflow-700);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
[data-theme='dark'] .searchQueryButton {
|
|
88
|
+
color: black;
|
|
89
|
+
background: var(--color-nextflow-400);
|
|
90
|
+
border: 1px solid var(--color-nextflow-400);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
[data-theme='dark'] .searchQueryButton:hover {
|
|
94
|
+
background: var(--color-nextflow-600);
|
|
95
|
+
border-color: var(--color-nextflow-700);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.filterSelectWrapper {
|
|
99
|
+
position: relative;
|
|
100
|
+
width: 16.25rem;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Matches VersionSwitcher: rounded-lg border border-gray-300 overflow-hidden bg-white */
|
|
104
|
+
.filterBox {
|
|
105
|
+
border-radius: 0.5rem;
|
|
106
|
+
border: 1px solid #d1d5db;
|
|
107
|
+
overflow: hidden;
|
|
108
|
+
background: white;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* Matches VersionSwitcher: rounded-b-none when open */
|
|
112
|
+
.filterBoxOpen {
|
|
113
|
+
border-bottom-left-radius: 0;
|
|
114
|
+
border-bottom-right-radius: 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* Matches VersionSwitcher trigger: h-9 px-3 text-sm text-gray-900 bg-transparent hover:bg-gray-100 */
|
|
118
|
+
.filterTrigger {
|
|
119
|
+
display: flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
justify-content: space-between;
|
|
122
|
+
gap: 0.5rem;
|
|
123
|
+
height: 2.25rem;
|
|
124
|
+
width: 100%;
|
|
125
|
+
padding: 0 0.75rem;
|
|
126
|
+
background: transparent;
|
|
127
|
+
border: none;
|
|
128
|
+
color: #111827;
|
|
129
|
+
font-size: 0.875rem;
|
|
130
|
+
text-align: left;
|
|
131
|
+
cursor: pointer;
|
|
132
|
+
white-space: nowrap;
|
|
133
|
+
transition: background 0.15s;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.filterTrigger:hover {
|
|
137
|
+
background: #f3f4f6;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.filterTrigger:focus {
|
|
141
|
+
outline: none;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.filterTriggerChevron {
|
|
145
|
+
display: block;
|
|
146
|
+
width: 1.25rem;
|
|
147
|
+
height: 1.25rem;
|
|
148
|
+
flex-shrink: 0;
|
|
149
|
+
transition: transform 0.2s;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.filterTriggerChevronOpen {
|
|
153
|
+
transform: rotate(0deg);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.filterTriggerChevronClosed {
|
|
157
|
+
transform: rotate(-90deg);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* Matches VersionSwitcher dropdown: bg-white border-gray-300 border-t-gray-200 rounded-b-lg */
|
|
161
|
+
.filterDropdown {
|
|
162
|
+
position: absolute;
|
|
163
|
+
top: 100%;
|
|
164
|
+
left: 0;
|
|
165
|
+
min-width: 100%;
|
|
166
|
+
margin: -1px 0 0;
|
|
167
|
+
padding: 0;
|
|
168
|
+
list-style: none;
|
|
169
|
+
background: white;
|
|
170
|
+
border: 1px solid #d1d5db;
|
|
171
|
+
border-top-color: #e5e7eb;
|
|
172
|
+
border-bottom-left-radius: 0.5rem;
|
|
173
|
+
border-bottom-right-radius: 0.5rem;
|
|
174
|
+
overflow: hidden;
|
|
175
|
+
z-index: 50;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* Matches VersionSwitcher items: h-9 px-3 text-sm text-gray-900 border-t border-gray-200 hover:bg-gray-100 */
|
|
179
|
+
.filterOption {
|
|
180
|
+
display: flex;
|
|
181
|
+
align-items: center;
|
|
182
|
+
justify-content: space-between;
|
|
183
|
+
height: 2.25rem;
|
|
184
|
+
padding: 0 0.75rem;
|
|
185
|
+
font-size: 0.875rem;
|
|
186
|
+
color: #111827;
|
|
187
|
+
cursor: pointer;
|
|
188
|
+
white-space: nowrap;
|
|
189
|
+
user-select: none;
|
|
190
|
+
border-top: 1px solid #e5e7eb;
|
|
191
|
+
transition: background 0.15s;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.filterOption:first-child {
|
|
195
|
+
border-top: none;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.filterOption:hover {
|
|
199
|
+
background: #f3f4f6;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.filterOptionActive {
|
|
203
|
+
color: var(--ifm-color-primary);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.filterExpandChevron {
|
|
207
|
+
display: block;
|
|
208
|
+
width: 1.25rem;
|
|
209
|
+
height: 1.25rem;
|
|
210
|
+
margin-left: 0.5rem;
|
|
211
|
+
flex-shrink: 0;
|
|
212
|
+
transition: transform 0.2s;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.filterSubOption {
|
|
216
|
+
padding-left: 1.5rem;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/* Dark mode — matches VersionSwitcher: dark:bg-gray-900 dark:border-gray-700 dark:text-white dark:hover:bg-gray-800 */
|
|
220
|
+
[data-theme='dark'] .filterBox {
|
|
221
|
+
background: #111827;
|
|
222
|
+
border-color: #374151;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
[data-theme='dark'] .filterTrigger {
|
|
226
|
+
color: white;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
[data-theme='dark'] .filterTrigger:hover {
|
|
230
|
+
background: #1f2937;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
[data-theme='dark'] .filterDropdown {
|
|
234
|
+
background: #111827;
|
|
235
|
+
border-color: #374151;
|
|
236
|
+
border-top-color: #4b5563;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
[data-theme='dark'] .filterOption {
|
|
240
|
+
color: white;
|
|
241
|
+
border-top-color: #374151;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
[data-theme='dark'] .filterOption:hover {
|
|
245
|
+
background: #1f2937;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.searchResultsColumn {
|
|
249
|
+
font-size: 0.9rem;
|
|
250
|
+
font-weight: bold;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.algoliaLogo {
|
|
254
|
+
max-width: 150px;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.algoliaLogoPathFill {
|
|
258
|
+
fill: var(--ifm-font-color-base);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.searchResultItem {
|
|
262
|
+
padding: 1rem 0;
|
|
263
|
+
border-bottom: 1px solid var(--ifm-toc-border-color);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.searchResultItemHeading {
|
|
267
|
+
font-weight: 400;
|
|
268
|
+
margin-bottom: 0;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.searchResultItemPath {
|
|
272
|
+
font-size: 0.8rem;
|
|
273
|
+
color: var(--ifm-font-color-base);
|
|
274
|
+
--ifm-breadcrumb-separator-size-multiplier: 1;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.searchResultItemPath :global(.breadcrumbs__item:not(:last-child))::after {
|
|
278
|
+
margin: 0 0.1875rem;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.searchResultItemSummary {
|
|
282
|
+
margin: 0.5rem 0 0;
|
|
283
|
+
font-style: italic;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
@media only screen and (max-width: 996px) {
|
|
287
|
+
.searchResultsColumn {
|
|
288
|
+
max-width: 60% !important;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.searchLogoColumn {
|
|
292
|
+
max-width: 40% !important;
|
|
293
|
+
padding-left: 0 !important;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.loadingSpinner {
|
|
298
|
+
width: 3rem;
|
|
299
|
+
height: 3rem;
|
|
300
|
+
border: 0.4em solid #eee;
|
|
301
|
+
border-top-color: var(--ifm-color-primary);
|
|
302
|
+
border-radius: 50%;
|
|
303
|
+
animation: loading-spin 1s linear infinite;
|
|
304
|
+
margin: 2rem auto 0;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
@keyframes loading-spin {
|
|
308
|
+
100% {
|
|
309
|
+
transform: rotate(360deg);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.loader {
|
|
314
|
+
margin-top: 6rem;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
:global(.search-page-wrapper .theme-layout-main) {
|
|
318
|
+
width: 100%;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
:global(.search-result-match) {
|
|
322
|
+
color: var(--docsearch-hit-color);
|
|
323
|
+
background: rgb(255 215 142 / 25%);
|
|
324
|
+
padding: 0.09em 0;
|
|
325
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
// Source: https://github.com/facebook/docusaurus/blob/a308fb7c81832cca354192fe2984f52749441249/packages/docusaurus-theme-common/src/hooks/useSearchPage.ts
|
|
8
|
+
// Context: https://github.com/typesense/docusaurus-theme-search-typesense/issues/27#issuecomment-1415757477
|
|
9
|
+
import {useState, useEffect, useCallback} from 'react';
|
|
10
|
+
import {useHistory} from '@docusaurus/router';
|
|
11
|
+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
12
|
+
const SEARCH_PARAM_QUERY = 'q';
|
|
13
|
+
const SEARCH_PARAM_FILTER = 'filter';
|
|
14
|
+
export function useSearchPage() {
|
|
15
|
+
const history = useHistory();
|
|
16
|
+
const {
|
|
17
|
+
siteConfig: {baseUrl},
|
|
18
|
+
} = useDocusaurusContext();
|
|
19
|
+
const [searchQuery, setSearchQueryState] = useState('');
|
|
20
|
+
const [selectedFilter, setSelectedFilterState] = useState('');
|
|
21
|
+
// Init search query and filter just after React hydration
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const params = new URLSearchParams(window.location.search);
|
|
24
|
+
setSearchQueryState(params.get(SEARCH_PARAM_QUERY) ?? '');
|
|
25
|
+
setSelectedFilterState(params.get(SEARCH_PARAM_FILTER) ?? '');
|
|
26
|
+
}, []);
|
|
27
|
+
const setSearchQuery = useCallback(
|
|
28
|
+
(newSearchQuery) => {
|
|
29
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
30
|
+
if (newSearchQuery) {
|
|
31
|
+
searchParams.set(SEARCH_PARAM_QUERY, newSearchQuery);
|
|
32
|
+
} else {
|
|
33
|
+
searchParams.delete(SEARCH_PARAM_QUERY);
|
|
34
|
+
}
|
|
35
|
+
history.replace({search: searchParams.toString()});
|
|
36
|
+
setSearchQueryState(newSearchQuery);
|
|
37
|
+
},
|
|
38
|
+
[history],
|
|
39
|
+
);
|
|
40
|
+
const setSelectedFilter = useCallback(
|
|
41
|
+
(newFilter) => {
|
|
42
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
43
|
+
if (newFilter) {
|
|
44
|
+
searchParams.set(SEARCH_PARAM_FILTER, newFilter);
|
|
45
|
+
} else {
|
|
46
|
+
searchParams.delete(SEARCH_PARAM_FILTER);
|
|
47
|
+
}
|
|
48
|
+
history.replace({search: searchParams.toString()});
|
|
49
|
+
setSelectedFilterState(newFilter);
|
|
50
|
+
},
|
|
51
|
+
[history],
|
|
52
|
+
);
|
|
53
|
+
const generateSearchPageLink = useCallback(
|
|
54
|
+
(targetSearchQuery) =>
|
|
55
|
+
// Refer to https://github.com/facebook/docusaurus/pull/2838
|
|
56
|
+
`${baseUrl}search?${SEARCH_PARAM_QUERY}=${encodeURIComponent(
|
|
57
|
+
targetSearchQuery,
|
|
58
|
+
)}`,
|
|
59
|
+
[baseUrl],
|
|
60
|
+
);
|
|
61
|
+
return {
|
|
62
|
+
searchQuery,
|
|
63
|
+
setSearchQuery,
|
|
64
|
+
selectedFilter,
|
|
65
|
+
setSelectedFilter,
|
|
66
|
+
generateSearchPageLink,
|
|
67
|
+
};
|
|
68
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seqera/docusaurus-theme-seqera",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.26-next.85",
|
|
4
4
|
"description": "Seqera docs theme for Docusaurus",
|
|
5
5
|
"author": "Seqera docs team <education@seqera.io>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,7 +31,9 @@
|
|
|
31
31
|
"@docusaurus/utils-validation": "3.9.2",
|
|
32
32
|
"@mdx-js/react": "^3.0.0",
|
|
33
33
|
"@tailwindcss/postcss": "^4.1.17",
|
|
34
|
+
"algoliasearch-helper": "^3.0.0",
|
|
34
35
|
"clsx": "^2.0.0",
|
|
36
|
+
"typesense-instantsearch-adapter": "^2.0.0",
|
|
35
37
|
"infima": "0.2.0-alpha.45",
|
|
36
38
|
"lodash": "^4.17.21",
|
|
37
39
|
"nprogress": "^0.2.0",
|
package/src/getSwizzleConfig.ts
CHANGED
|
@@ -402,16 +402,6 @@ export default function getSwizzleConfig(): SwizzleConfig {
|
|
|
402
402
|
description:
|
|
403
403
|
'The global 404 page of your site, meant to be ejected and customized',
|
|
404
404
|
},
|
|
405
|
-
SearchBar: {
|
|
406
|
-
actions: {
|
|
407
|
-
eject: 'safe',
|
|
408
|
-
wrap: 'safe',
|
|
409
|
-
},
|
|
410
|
-
// TODO how to describe this one properly?
|
|
411
|
-
// By default it's an empty placeholder for the user to fill
|
|
412
|
-
description:
|
|
413
|
-
'The search bar component of your site, appearing in the navbar.',
|
|
414
|
-
},
|
|
415
405
|
SkipToContent: {
|
|
416
406
|
actions: {
|
|
417
407
|
eject: 'safe',
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
// Source: https://github.com/facebook/docusaurus/blob/a308fb7c81832cca354192fe2984f52749441249/packages/docusaurus-theme-common/src/utils/generalUtils.ts
|
|
8
|
+
// Context: https://github.com/typesense/docusaurus-theme-search-typesense/issues/27#issuecomment-1415757477
|
|
9
|
+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Formats the page's title based on relevant site config and other contexts.
|
|
13
|
+
*/
|
|
14
|
+
export function useTitleFormatter(title?: string): string {
|
|
15
|
+
const {siteConfig} = useDocusaurusContext();
|
|
16
|
+
const {title: siteTitle, titleDelimiter} = siteConfig;
|
|
17
|
+
return title?.trim().length
|
|
18
|
+
? `${title.trim()} ${titleDelimiter} ${siteTitle}`
|
|
19
|
+
: siteTitle;
|
|
20
|
+
}
|