This is an automated email from the ASF dual-hosted git repository.
jeffreyh pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/develop by this push:
new 0d5ffd8570 fix: fix search error (#1435)
0d5ffd8570 is described below
commit 0d5ffd8570eb222673bf22bbcd46b64a1e815e9f
Author: Jeffrey <[email protected]>
AuthorDate: Mon Dec 2 21:03:02 2024 +0800
fix: fix search error (#1435)
- fix search error
- fix warning
---
.env | 1 +
author.yml | 5 +
babel.config.js | 3 -
docusaurus.config.js | 3 +-
package.json | 8 +-
src/components/collapse-box/collapse-box.tsx | 1 -
src/pages/download/index.tsx | 1 -
src/pages/index.tsx | 1 -
src/scss/components/navbar.scss | 10 +-
src/scss/components/pagination-nav.scss | 10 +-
src/scss/custom.scss | 21 +-
src/theme/BlogPostItem/Header/Info/index.tsx | 1 -
src/theme/DocSidebarItem/Category/index.tsx | 1 -
src/theme/Navbar/Content/index.tsx | 6 -
src/theme/SearchBar/EmptyTemplate.js | 12 -
src/theme/SearchBar/SearchBar.jsx | 322 ---------------------------
src/theme/SearchBar/SearchBar.module.css | 265 ----------------------
src/theme/SearchBar/SuggestionTemplate.js | 54 -----
src/theme/SearchBar/__mocks__/icons.js | 7 -
src/theme/SearchBar/fetchIndexes.js | 50 -----
src/theme/SearchBar/icons.js | 7 -
src/theme/SearchBar/index.js | 13 +-
src/theme/SearchBar/interfaces.js | 8 -
yarn.lock | 48 ++--
24 files changed, 78 insertions(+), 780 deletions(-)
diff --git a/.env b/.env
new file mode 100644
index 0000000000..1abbb874f5
--- /dev/null
+++ b/.env
@@ -0,0 +1 @@
+TEST_ENV_URL="http://localhost:3000"
\ No newline at end of file
diff --git a/author.yml b/author.yml
new file mode 100644
index 0000000000..1fca6d6e4b
--- /dev/null
+++ b/author.yml
@@ -0,0 +1,5 @@
+ApacheDoris:
+ name: Apache Doris
+ # other author properties...
+ socials:
+ x: doris_apache
\ No newline at end of file
diff --git a/babel.config.js b/babel.config.js
deleted file mode 100644
index e00595dae7..0000000000
--- a/babel.config.js
+++ /dev/null
@@ -1,3 +0,0 @@
-module.exports = {
- presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
-};
diff --git a/docusaurus.config.js b/docusaurus.config.js
index 9fb43015c8..a5b59c05dd 100644
--- a/docusaurus.config.js
+++ b/docusaurus.config.js
@@ -201,6 +201,7 @@ const config = {
postsPerPage: 'ALL',
blogSidebarCount: 0,
showReadingTime: false,
+ onUntruncatedBlogPosts: "ignore"
},
theme: {
customCss: require.resolve('./src/scss/custom.scss'),
@@ -221,7 +222,7 @@ const config = {
highlightSearchTermsOnTargetPage: true,
// indexPages: true,
indexDocs: true,
- docsRouteBasePath: '/',
+ // docsRouteBasePath: '/docs',
indexBlog: false,
explicitSearchResultPath: true,
searchBarShortcut: true,
diff --git a/package.json b/package.json
index 2c52f4bf05..41de552938 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
"docusaurus": "docusaurus",
"start": "docusaurus start",
"start:zh-CN": "docusaurus start --locale zh-CN",
- "build": "NODE_OPTIONS=--max_old_space_size=8192
PWA_SERVICE_WORKER_URL=https://doris.apache.org/sw.js docusaurus build",
+ "build": "TEST_ENV_URL='http://localhost:3000'
NODE_OPTIONS=--max_old_space_size=8192
PWA_SERVICE_WORKER_URL=https://doris.apache.org/sw.js docusaurus build",
"build:version": "docusaurus set-versions && docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
@@ -24,7 +24,7 @@
"@docusaurus/plugin-client-redirects": "3.6.3",
"@docusaurus/plugin-pwa": "3.6.3",
"@docusaurus/preset-classic": "3.6.3",
- "@easyops-cn/docusaurus-search-local": "^0.45.0",
+ "@easyops-cn/docusaurus-search-local": "^0.46.1",
"@mdx-js/react": "^3.0.0",
"antd": "^5.12.2",
"autoprefixer": "^10.4.16",
@@ -38,6 +38,7 @@
"react-dom": "^18.2.0",
"react-github-button": "^0.1.11",
"sass": "^1.63.2",
+ "sass-migrator": "^2.2.1",
"swiper": "^9.0.5",
"tailwindcss": "^3.3.6",
"vitpress-generate-pdf": "^1.1.4"
@@ -67,5 +68,6 @@
},
"engines": {
"node": ">=18.0"
- }
+ },
+ "packageManager":
"[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
diff --git a/src/components/collapse-box/collapse-box.tsx
b/src/components/collapse-box/collapse-box.tsx
index fd001e734d..8cf1dd296f 100644
--- a/src/components/collapse-box/collapse-box.tsx
+++ b/src/components/collapse-box/collapse-box.tsx
@@ -31,7 +31,6 @@ export default function CollapseBox({
className,
disabledExpand = false,
}: CollapseBoxProps) {
- console.log(popTrue,'poptrue')
return (
<div className={`mt-[5.5rem] w-full rounded-lg border border-[#DFE5F0]
${className}`}>
<CollapseBoxHeader title={title} defaultExpand={expand}
disabled={disabledExpand} popTrue={popTrue}/>
diff --git a/src/pages/download/index.tsx b/src/pages/download/index.tsx
index c1fac935d0..b189de045d 100644
--- a/src/pages/download/index.tsx
+++ b/src/pages/download/index.tsx
@@ -103,7 +103,6 @@ export default function Download() {
}
function onValuesChange(values: any) {
- console.log(values.version, 'values.version')
setReleaseFlag(values.version[0] === '1.1' ? false : true)
if (!toDocsRelease(values.version[1])) {
setReleaseNote('https://github.com/apache/doris/releases');
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index 4c38070f59..4f024ee45e 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -381,7 +381,6 @@ export default function Home(): JSX.Element {
href: 'https://www.youtube.com/@apachedoris/channels',
},
];
- console.log(siteConfig, 'siteConfig')
return (
<Layout
title={translate({ id: 'homepage.title', message: 'Apache Doris:
Open source data warehouse for real time data analytics' })}
diff --git a/src/scss/components/navbar.scss b/src/scss/components/navbar.scss
index ee629aacb4..647e29495a 100644
--- a/src/scss/components/navbar.scss
+++ b/src/scss/components/navbar.scss
@@ -81,10 +81,12 @@
padding: var(--ifm-navbar-item-padding-vertical) 1rem;
}
- transition: {
- property: color;
- timing-function: ease-out;
- duration: 0.3s;
+ & {
+ transition: {
+ property: color;
+ timing-function: ease-out;
+ duration: 0.3s;
+ }
}
&:hover {
diff --git a/src/scss/components/pagination-nav.scss
b/src/scss/components/pagination-nav.scss
index 3dad1924e3..3cc2da2b30 100644
--- a/src/scss/components/pagination-nav.scss
+++ b/src/scss/components/pagination-nav.scss
@@ -9,10 +9,12 @@
padding: 0;
color: var(--ifm-color-primary);
- transition: {
- property: color;
- timing-function: ease-out;
- duration: 0.3s;
+ & {
+ transition: {
+ property: color;
+ timing-function: ease-out;
+ duration: 0.3s;
+ }
}
}
diff --git a/src/scss/custom.scss b/src/scss/custom.scss
index aaca69a696..8a6ecc65a5 100644
--- a/src/scss/custom.scss
+++ b/src/scss/custom.scss
@@ -1,3 +1,4 @@
+@use "sass:meta";
/**
* Any CSS included here will be global. The classic template
* bundles Infima by default. Infima is a CSS framework designed to
@@ -8,16 +9,16 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
-@import './variables';
-@import './components/sidebar';
-@import './components/breadcrumbs';
-@import './components/markdown';
-@import './components/pagination-nav';
-@import './components/navbar';
-@import './components/blog';
-@import './components/search';
-@import './components/toc.scss';
-@import './common';
+@include meta.load-css('variables');
+@include meta.load-css('components/sidebar');
+@include meta.load-css('components/breadcrumbs');
+@include meta.load-css('components/markdown');
+@include meta.load-css('components/pagination-nav');
+@include meta.load-css('components/navbar');
+@include meta.load-css('components/blog');
+@include meta.load-css('components/search');
+@include meta.load-css('components/toc.scss');
+@include meta.load-css('common');
@layer utilities {
.transition-slide {
diff --git a/src/theme/BlogPostItem/Header/Info/index.tsx
b/src/theme/BlogPostItem/Header/Info/index.tsx
index 5c300e7fb9..930fcd4835 100644
--- a/src/theme/BlogPostItem/Header/Info/index.tsx
+++ b/src/theme/BlogPostItem/Header/Info/index.tsx
@@ -36,7 +36,6 @@ function DateTime({ date, formattedDate }: { date: string;
formattedDate: string
export default function BlogPostItemHeaderInfo({ className }: Props):
JSX.Element {
const { metadata } = useBlogPost();
- console.log('metadata', metadata);
const { date, readingTime, authors } = metadata;
diff --git a/src/theme/DocSidebarItem/Category/index.tsx
b/src/theme/DocSidebarItem/Category/index.tsx
index 83f2ca91c7..8df61ce952 100644
--- a/src/theme/DocSidebarItem/Category/index.tsx
+++ b/src/theme/DocSidebarItem/Category/index.tsx
@@ -139,7 +139,6 @@ export default function DocSidebarItemCategory({
setCollapsed(true);
}
}, [collapsible, expandedItem, index, setCollapsed,
autoCollapseCategories]);
- console.log('length',length,'level',level);
return (
<li
diff --git a/src/theme/Navbar/Content/index.tsx
b/src/theme/Navbar/Content/index.tsx
index dbf7e90ce7..ba0b449ed9 100644
--- a/src/theme/Navbar/Content/index.tsx
+++ b/src/theme/Navbar/Content/index.tsx
@@ -139,12 +139,6 @@ export default function NavbarContent(): JSX.Element {
function getNavItem(type: string) {
return items.find(item => item.type === type);
}
- console.log('leftItems',leftItems);
- console.log('rightItems',rightItems);
- console.log('leftDocItems',leftDocItems);
- console.log('isDocsPage',isDocsPage);
- console.log('rightDocItems',rightDocItems);
- console.log('star',star);
return (
diff --git a/src/theme/SearchBar/EmptyTemplate.js
b/src/theme/SearchBar/EmptyTemplate.js
deleted file mode 100644
index 0c67ba65f4..0000000000
--- a/src/theme/SearchBar/EmptyTemplate.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import { translate } from "@docusaurus/Translate";
-import { iconNoResults } from "./icons";
-import styles from "./SearchBar.module.css";
-export function EmptyTemplate() {
- if (process.env.NODE_ENV === "production") {
- return `<span class="${styles.noResults}"><span
class="${styles.noResultsIcon}">${iconNoResults}</span><span>${translate({
- id: "theme.SearchBar.noResultsText",
- message: "No results",
- })}</span></span>`;
- }
- return `<span class="${styles.noResults}">⚠️ The search index is only
available when you run docusaurus build!</span>`;
-}
diff --git a/src/theme/SearchBar/SearchBar.jsx
b/src/theme/SearchBar/SearchBar.jsx
deleted file mode 100644
index 126134d8ec..0000000000
--- a/src/theme/SearchBar/SearchBar.jsx
+++ /dev/null
@@ -1,322 +0,0 @@
-import React, { useCallback, useEffect, useRef, useState } from 'react';
-import clsx from 'clsx';
-import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
-import useIsBrowser from '@docusaurus/useIsBrowser';
-import { useHistory, useLocation } from '@docusaurus/router';
-import { translate } from '@docusaurus/Translate';
-import { ReactContextError, useDocsPreferredVersion } from
'@docusaurus/theme-common';
-import { useActivePlugin } from '@docusaurus/plugin-content-docs/client';
-import { fetchIndexes } from './fetchIndexes';
-import { SearchSourceFactory } from '../../utils/SearchSourceFactory';
-import { SuggestionTemplate } from './SuggestionTemplate';
-import { EmptyTemplate } from './EmptyTemplate';
-import {
- searchResultLimits,
- Mark,
- searchBarShortcut,
- searchBarShortcutHint,
- searchBarPosition,
- docsPluginIdForPreferredVersion,
- indexDocs,
- searchContextByPaths,
- hideSearchBarWithNoSearchContext,
- useAllContextsWithNoSearchContext,
-} from '../../utils/proxiedGenerated';
-import LoadingRing from '../LoadingRing/LoadingRing';
-import styles from './SearchBar.module.css';
-async function fetchAutoCompleteJS() {
- const autoCompleteModule = await import('@easyops-cn/autocomplete.js');
- const autoComplete = autoCompleteModule.default;
- if (autoComplete.noConflict) {
- // For webpack v5 since docusaurus v2.0.0-alpha.75
- autoComplete.noConflict();
- } else if (autoCompleteModule.noConflict) {
- // For webpack v4 before docusaurus v2.0.0-alpha.74
- autoCompleteModule.noConflict();
- }
- return autoComplete;
-}
-const SEARCH_PARAM_HIGHLIGHT = '_highlight';
-export default function SearchBar({ handleSearchBarToggle }) {
- const isBrowser = useIsBrowser();
- const {
- siteConfig: { baseUrl },
- i18n: { currentLocale },
- } = useDocusaurusContext();
- // It returns undefined for non-docs pages
- const activePlugin = useActivePlugin();
- let versionUrl = baseUrl;
- // For non-docs pages while using plugin-content-docs with custom ids,
- // this will throw an error of:
- // > Docusaurus plugin global data not found for
"docusaurus-plugin-content-docs" plugin with id "default".
- // It seems that we can not get the correct id for non-docs pages.
- try {
- // The try-catch is a hack because useDocsPreferredVersion just throws
an
- // exception when versions are not used.
- // The same hack is used in SearchPage.tsx
- // eslint-disable-next-line react-hooks/rules-of-hooks
- const { preferredVersion } =
useDocsPreferredVersion(activePlugin?.pluginId ??
docsPluginIdForPreferredVersion);
- if (preferredVersion && !preferredVersion.isLast) {
- versionUrl = preferredVersion.path + '/';
- }
- } catch (e) {
- if (indexDocs) {
- if (e instanceof ReactContextError) {
- /* ignore, happens when website doesn't use versions */
- } else {
- throw e;
- }
- }
- }
- const history = useHistory();
- const location = useLocation();
- const searchBarRef = useRef(null);
- const indexStateMap = useRef(new Map());
- // Should the input be focused after the index is loaded?
- const focusAfterIndexLoaded = useRef(false);
- const [loading, setLoading] = useState(false);
- const [inputChanged, setInputChanged] = useState(false);
- const [inputValue, setInputValue] = useState('');
- const search = useRef(null);
- const prevSearchContext = useRef('');
- const [searchContext, setSearchContext] = useState('');
- useEffect(() => {
- if (!Array.isArray(searchContextByPaths)) {
- return;
- }
- let nextSearchContext = '';
- if (location.pathname.startsWith(versionUrl)) {
- const uri = location.pathname.substring(versionUrl.length);
- let matchedPath;
- for (const _path of searchContextByPaths) {
- const path = typeof _path === 'string' ? _path : _path.path;
- if (uri === path || uri.startsWith(`${path}/`)) {
- matchedPath = path;
- break;
- }
- }
- if (matchedPath) {
- nextSearchContext = matchedPath;
- }
- }
- if (prevSearchContext.current !== nextSearchContext) {
- // Reset index state map once search context is changed.
- indexStateMap.current.delete(nextSearchContext);
- prevSearchContext.current = nextSearchContext;
- }
- setSearchContext(nextSearchContext);
- }, [location.pathname, versionUrl]);
- const hidden = !!hideSearchBarWithNoSearchContext &&
Array.isArray(searchContextByPaths) && searchContext === '';
- const loadIndex = useCallback(async () => {
- if (hidden || indexStateMap.current.get(searchContext)) {
- // Do not load the index (again) if its already loaded or in the
process of being loaded.
- return;
- }
- indexStateMap.current.set(searchContext, 'loading');
- search.current?.autocomplete.destroy();
- setLoading(true);
- const [{ wrappedIndexes, zhDictionary }, autoComplete] = await
Promise.all([
- fetchIndexes(versionUrl, searchContext),
- fetchAutoCompleteJS(),
- ]);
- search.current = autoComplete(
- searchBarRef.current,
- {
- hint: false,
- autoselect: true,
- openOnFocus: true,
- cssClasses: {
- root: clsx(styles.searchBar, {
- [styles.searchBarLeft]: searchBarPosition === 'left',
- }),
- noPrefix: true,
- dropdownMenu: styles.dropdownMenu,
- input: styles.input,
- hint: styles.hint,
- suggestions: styles.suggestions,
- suggestion: styles.suggestion,
- cursor: styles.cursor,
- dataset: styles.dataset,
- empty: styles.empty,
- },
- },
- [
- {
- source: SearchSourceFactory(wrappedIndexes, zhDictionary,
searchResultLimits),
- templates: {
- suggestion: SuggestionTemplate,
- empty: EmptyTemplate,
- footer: ({ query, isEmpty }) => {
- if (isEmpty) {
- return;
- }
- const a = document.createElement('a');
- const url =
`${baseUrl}search?q=${encodeURIComponent(query)}`;
- a.href = url;
- a.textContent = translate({
- id: 'theme.SearchBar.seeAll',
- message: 'See all results',
- });
- a.addEventListener('click', e => {
- if (!e.ctrlKey && !e.metaKey) {
- e.preventDefault();
- search.current.autocomplete.close();
- history.push(url);
- }
- });
- const div = document.createElement('div');
- div.className = styles.hitFooter;
- div.appendChild(a);
- return div;
- },
- },
- },
- ],
- )
- .on('autocomplete:selected', function (event, { document: { u, h
}, tokens }) {
- searchBarRef.current?.blur();
- let url = u;
- if (Mark && tokens.length > 0) {
- const params = new URLSearchParams();
- for (const token of tokens) {
- params.append(SEARCH_PARAM_HIGHLIGHT, token);
- }
- url += `?${params.toString()}`;
- }
- if (h) {
- url += h;
- }
- history.push(url);
- })
- .on('autocomplete:closed', () => {
- searchBarRef.current?.blur();
- });
- indexStateMap.current.set(searchContext, 'done');
- setLoading(false);
- if (focusAfterIndexLoaded.current) {
- const input = searchBarRef.current;
- if (input.value) {
- search.current?.autocomplete.open();
- }
- input.focus();
- }
- }, [hidden, searchContext, versionUrl, baseUrl, history]);
- useEffect(() => {
- if (!Mark) {
- return;
- }
- const keywords = isBrowser ? new
URLSearchParams(location.search).getAll(SEARCH_PARAM_HIGHLIGHT) : [];
- // A workaround to fix an issue of highlighting in code blocks.
- // See https://github.com/easyops-cn/docusaurus-search-local/issues/92
- // Code blocks will be re-rendered after this `useEffect` ran.
- // So we make the marking run after a macro task.
- setTimeout(() => {
- const root = document.querySelector('article');
- if (!root) {
- return;
- }
- const mark = new Mark(root);
- mark.unmark();
- if (keywords.length !== 0) {
- mark.mark(keywords);
- }
- // Apply any keywords to the search input so that we can clear
marks in case we loaded a page with a highlight in the url
- setInputValue(keywords.join(' '));
- search.current?.autocomplete.setVal(keywords.join(' '));
- });
- }, [isBrowser, location.search, location.pathname]);
- const [focused, setFocused] = useState(false);
- const onInputFocus = useCallback(() => {
- focusAfterIndexLoaded.current = true;
- loadIndex();
- setFocused(true);
- handleSearchBarToggle?.(true);
- }, [handleSearchBarToggle, loadIndex]);
- const onInputBlur = useCallback(() => {
- setFocused(false);
- handleSearchBarToggle?.(false);
- }, [handleSearchBarToggle]);
- const onInputMouseEnter = useCallback(() => {
- loadIndex();
- }, [loadIndex]);
- const onInputChange = useCallback(event => {
- setInputValue(event.target.value);
- if (event.target.value) {
- setInputChanged(true);
- }
- }, []);
- // Implement hint icons for the search shortcuts on mac and the rest
operating systems.
- const isMac = isBrowser ? /mac/i.test(navigator.userAgentData?.platform ??
navigator.platform) : false;
- useEffect(() => {
- if (!searchBarShortcut) {
- return;
- }
- // Add shortcuts command/ctrl + K
- const handleShortcut = event => {
- if ((isMac ? event.metaKey : event.ctrlKey) && (event.key === 'k'
|| event.key === 'K')) {
- event.preventDefault();
- searchBarRef.current?.focus();
- onInputFocus();
- }
- };
- document.addEventListener('keydown', handleShortcut);
- return () => {
- document.removeEventListener('keydown', handleShortcut);
- };
- }, [isMac, onInputFocus]);
- const onClearSearch = useCallback(() => {
- const params = new URLSearchParams(location.search);
- params.delete(SEARCH_PARAM_HIGHLIGHT);
- const paramsStr = params.toString();
- const searchUrl = location.pathname + (paramsStr != '' ?
`?${paramsStr}` : '') + location.hash;
- if (searchUrl != location.pathname + location.search + location.hash) {
- history.push(searchUrl);
- }
- // We always clear these here because in case no match was selected
the above history push wont happen
- setInputValue('');
- search.current?.autocomplete.setVal('');
- }, [location.pathname, location.search, location.hash, history]);
- return (
- <div
- className={clsx('navbar__search', styles.searchBarContainer, {
- [styles.searchIndexLoading]: loading && inputChanged,
- [styles.focused]: focused,
- })}
- // hidden={hidden}
- // // Manually make the search bar be LTR even if in RTL
- // dir="ltr"
- >
- <input
- style={{ width: '100% !important' }}
- placeholder={translate({
- id: 'theme.SearchBar.label',
- message: 'Search',
- description: 'The ARIA label and placeholder for search
button',
- })}
- aria-label="Search"
- className={clsx('navbar__search-input',
styles.navbarSearchInput)}
- onMouseEnter={onInputMouseEnter}
- onFocus={onInputFocus}
- onBlur={onInputBlur}
- onChange={onInputChange}
- ref={searchBarRef}
- value={inputValue}
- />
- <LoadingRing className={styles.searchBarLoadingRing} />
- {searchBarShortcut &&
- searchBarShortcutHint &&
- (inputValue !== '' ? (
- <button className={styles.searchClearButton}
onClick={onClearSearch}>
- ✕
- </button>
- ) : (
- isBrowser && (
- <div className={styles.searchHintContainer}>
- <kbd className={styles.searchHint}>{isMac ? '⌘' :
'ctrl'}</kbd>
- <kbd className={styles.searchHint}>K</kbd>
- </div>
- )
- ))}
- </div>
- );
-}
diff --git a/src/theme/SearchBar/SearchBar.module.css
b/src/theme/SearchBar/SearchBar.module.css
deleted file mode 100644
index 9702830a93..0000000000
--- a/src/theme/SearchBar/SearchBar.module.css
+++ /dev/null
@@ -1,265 +0,0 @@
-.searchBar .dropdownMenu {
- left: auto !important;
- right: 0 !important;
-
- background: var(--search-local-modal-background, #f5f6f7);
- border-radius: 6px;
- box-shadow: var(--search-local-modal-shadow, inset 1px 1px 0 0 hsla(0, 0%,
100%, 0.5), 0 3px 8px 0 #555a64);
- margin-top: 8px;
- width: var(--search-local-modal-width, 560px);
- position: relative;
- padding: var(--search-local-spacing, 12px);
-}
-
-.searchBar {
- width: 100% !important;
-}
-
-.navbarSearchInput {
- width: 100% !important;
- border: none !important;
- background-color: #f7f9fe !important;
- background-image: url('/static/images/search-icon.svg');
- height: 2.5rem !important;
- background-position: 0.625rem center !important;
- padding-left: 2.25rem !important;
- color: #4c576c !important;
- border-radius: 0.5rem;
-}
-
-@media (max-width: 996px) {
- :global(.navbar__search-input):not(:focus) {
- width: 2rem;
- }
-
- .searchBar .dropdownMenu {
- width: 100%;
- }
-}
-
-html[data-theme='dark'] .searchBar .dropdownMenu {
- background: var(--search-local-modal-background,
var(--ifm-background-color));
- box-shadow: var(--search-local-modal-shadow, inset 1px 1px 0 0 #2c2e40, 0
3px 8px 0 #000309);
-}
-
-.searchBar .dropdownMenu .suggestion {
- cursor: pointer;
- background: var(--search-local-hit-background, #fff);
- border-radius: 4px;
- box-shadow: var(--search-local-hit-shadow, 0 1px 3px 0 #d4d9e1);
- padding: 0 var(--search-local-spacing, 12px);
- width: 100%;
-
- align-items: center;
- color: var(--search-local-hit-color, #444950);
- display: flex;
- flex-direction: row;
- height: var(--search-local-hit-height, 56px);
-}
-
-html[data-theme='dark'] .dropdownMenu .suggestion {
- background: var(--search-local-hit-background,
var(--ifm-color-emphasis-100));
- box-shadow: var(--search-local-hit-shadow, none);
- color: var(--search-local-hit-color, var(--ifm-font-color-base));
-}
-
-.searchBar .dropdownMenu .suggestion:not(:last-child) {
- margin-bottom: 4px;
-}
-
-.searchBar .dropdownMenu .suggestion.cursor {
- background-color: var(--search-local-highlight-color,
var(--ifm-color-primary));
-}
-
-.hitTree,
-.hitIcon,
-.hitPath,
-.noResultsIcon,
-.hitFooter a {
- color: var(--search-local-muted-color, #969faf);
-}
-
-html[data-theme='dark'] .hitTree,
-html[data-theme='dark'] .hitIcon,
-html[data-theme='dark'] .hitPath,
-html[data-theme='dark'] .noResultsIcon {
- color: var(--search-local-muted-color, var(--ifm-color-secondary-darkest));
-}
-
-.hitTree {
- display: flex;
- align-items: center;
-}
-
-.hitTree>svg {
- height: var(--search-local-hit-height, 56px);
- opacity: 0.5;
- strokeWidth: var(--search-local-icon-strokeWidth, 1.4);
- width: 24px;
-}
-
-.hitIcon {
- strokeWidth: var(--search-local-icon-strokeWidth, 1.4);
-
- height: 20px;
- width: 20px;
-}
-
-.hitWrapper {
- flex: 1 1 auto;
- display: flex;
- flex-direction: column;
- font-weight: 500;
- justify-content: center;
- margin: 0 8px;
- overflow-x: hidden;
- width: 80%;
-}
-
-.hitWrapper mark {
- background: none;
- color: var(--search-local-highlight-color, var(--ifm-color-primary));
-}
-
-.hitTitle {
- font-size: 0.9em;
-}
-
-.hitPath {
- font-size: 0.75em;
-}
-
-.hitPath,
-.hitTitle {
- white-space: nowrap;
- overflow-x: hidden;
- text-overflow: ellipsis;
-}
-
-.hitAction {
- height: 20px;
- width: 20px;
-}
-
-.hideAction>svg {
- display: none;
-}
-
-.noResults {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- padding: var(--search-local-spacing, 12px) 0;
-}
-
-.noResultsIcon {
- margin-bottom: var(--search-local-spacing, 12px);
-}
-
-.hitFooter {
- text-align: center;
- margin-top: var(--search-local-spacing, 12px);
- font-size: 0.85em;
-}
-
-.hitFooter a {
- text-decoration: underline;
-}
-
-.cursor .hideAction>svg {
- display: block;
-}
-
-.suggestion.cursor,
-.suggestion.cursor mark,
-.suggestion.cursor .hitTree,
-.suggestion.cursor .hitIcon,
-.suggestion.cursor .hitPath {
- color: var(--search-local-hit-active-color, var(--ifm-color-white))
!important;
-}
-
-.suggestion.cursor mark {
- text-decoration: underline;
-}
-
-.searchBarContainer {
- margin-left: 16px;
-}
-
-.searchBarContainer .searchBarLoadingRing {
- display: none;
- position: absolute;
- left: 10px;
- top: 10px;
-}
-
-.searchBarContainer .searchClearButton {
- position: absolute;
- right: 0.8rem;
- top: 50%;
- transform: translate(0, -50%);
- padding: 0;
- background: none;
- border: none;
- line-height: 1rem;
- color: #4c576c;
- font-size: 14px;
-}
-
-:global(.navbar__search) {
- position: relative;
-}
-
-.searchIndexLoading :global(.navbar__search-input) {
- background-image: none;
-}
-
-.searchBarContainer.searchIndexLoading .searchBarLoadingRing {
- display: inline-block;
-}
-
-.searchHintContainer {
- position: absolute;
- right: 10px;
- top: 50%;
- transform: translateY(-50%);
- display: flex !important;
- align-items: center;
- justify-content: center;
- pointer-events: none;
- border: 1px solid #edf2fa;
- padding: 5px 7px;
- background-color: #ffffff;
- gap: 2px;
-}
-
-.searchHint {
- color: #8592a6;
- background-color: #ffffff;
- border: none;
- border-radius: none;
- box-shadow: none;
- font-size: 12px;
- padding: 0;
-}
-
-@media (max-width: 576px) {
-
- .searchBarContainer:not(.focused) .searchClearButton,
- .searchHintContainer {
- display: none !important;
- }
-}
-
-.input {}
-
-.hint {}
-
-.suggestions {}
-
-.dataset {}
-
-.empty {}
-
-/**/
\ No newline at end of file
diff --git a/src/theme/SearchBar/SuggestionTemplate.js
b/src/theme/SearchBar/SuggestionTemplate.js
deleted file mode 100644
index 35735ae811..0000000000
--- a/src/theme/SearchBar/SuggestionTemplate.js
+++ /dev/null
@@ -1,54 +0,0 @@
-import { SearchDocumentType, } from "./interfaces";
-import { concatDocumentPath } from "../../utils/concatDocumentPath";
-import { getStemmedPositions } from "../../utils/getStemmedPositions";
-import { highlight } from "../../utils/highlight";
-import { highlightStemmed } from "../../utils/highlightStemmed";
-import { explicitSearchResultPath } from "../../utils/proxiedGenerated";
-import { iconAction, iconContent, iconHeading, iconTitle, iconTreeInter,
iconTreeLast, } from "./icons";
-import styles from "./SearchBar.module.css";
-export function SuggestionTemplate({ document, type, page, metadata, tokens,
isInterOfTree, isLastOfTree, }) {
- const isTitle = type === SearchDocumentType.Title;
- const isKeywords = type === SearchDocumentType.Keywords;
- const isTitleRelated = isTitle || isKeywords;
- const isHeading = type === SearchDocumentType.Heading;
- const tree = [];
- if (isInterOfTree) {
- tree.push(iconTreeInter);
- }
- else if (isLastOfTree) {
- tree.push(iconTreeLast);
- }
- const treeWrapper = tree.map((item) => `<span
class="${styles.hitTree}">${item}</span>`);
- const icon = `<span class="${styles.hitIcon}">${isTitleRelated ? iconTitle
: isHeading ? iconHeading : iconContent}</span>`;
- const wrapped = [
- `<span class="${styles.hitTitle}">${isKeywords
- ? highlight(document.s, tokens)
- : highlightStemmed(document.t, getStemmedPositions(metadata, "t"),
tokens)}</span>`,
- ];
- const needsExplicitHitPath = !isInterOfTree && !isLastOfTree &&
explicitSearchResultPath;
- if (needsExplicitHitPath) {
- const pathItems = page
- ? page.b
- ?.concat(page.t)
- .concat(!document.s || document.s === page.t ? [] : document.s)
- : document.b;
- wrapped.push(`<span
class="${styles.hitPath}">${concatDocumentPath(pathItems ?? [])}</span>`);
- }
- else if (!isTitleRelated) {
- wrapped.push(`<span class="${styles.hitPath}">${highlight(page.t ||
- // Todo(weareoutman): This is for EasyOps only.
- // istanbul ignore next
- (document.u.startsWith("/docs/api-reference/")
- ? "API Reference"
- : ""), tokens)}</span>`);
- }
- const action = `<span class="${styles.hitAction}">${iconAction}</span>`;
- return [
- ...treeWrapper,
- icon,
- `<span class="${styles.hitWrapper}">`,
- ...wrapped,
- "</span>",
- action,
- ].join("");
-}
diff --git a/src/theme/SearchBar/__mocks__/icons.js
b/src/theme/SearchBar/__mocks__/icons.js
deleted file mode 100644
index 7c2f79e134..0000000000
--- a/src/theme/SearchBar/__mocks__/icons.js
+++ /dev/null
@@ -1,7 +0,0 @@
-export const iconTitle = '<svg class="icon-title"></svg>';
-export const iconHeading = '<svg class="icon-heading"></svg>';
-export const iconContent = '<svg class="icon-content"></svg>';
-export const iconAction = '<svg class="icon-action"></svg>';
-export const iconNoResults = '<svg class="icon-no-results"></svg>';
-export const iconTreeInter = '<svg class="icon-tree-inner"></svg>';
-export const iconTreeLast = '<svg class="icon-tree-last"></svg>';
diff --git a/src/theme/SearchBar/fetchIndexes.js
b/src/theme/SearchBar/fetchIndexes.js
deleted file mode 100644
index 463cdd9bca..0000000000
--- a/src/theme/SearchBar/fetchIndexes.js
+++ /dev/null
@@ -1,50 +0,0 @@
-import lunr from 'lunr';
-import { searchIndexUrl } from '../../utils/proxiedGenerated';
-const cache = new Map();
-
-export function fetchIndexes(baseUrl, searchContext) {
- const cacheKey = `${baseUrl}${searchContext}`;
- let promise = cache.get(cacheKey);
- if (!promise) {
- promise = legacyFetchIndexes(baseUrl, searchContext);
- cache.set(cacheKey, promise);
- }
- return promise;
-}
-export async function legacyFetchIndexes(baseUrl, searchContext) {
- if (process.env.NODE_ENV === 'production') {
- const host = process.env.TEST_ENV_URL || 'https://cdnd.selectdb.com';
- const url = `${host}${baseUrl}${searchIndexUrl.replace(
- '{dir}',
- searchContext ? `-${searchContext.replace(/\//g, '-')}` : '',
- )}`;
- // Catch potential attacks.
- const fullUrl = new URL(url, location.origin);
- if (fullUrl.origin !== location.origin) {
- throw new Error('Unexpected version url');
- }
- const json = await (await fetch(url)).json();
- const wrappedIndexes = json.map(({ documents, index }, type) => ({
- type: type,
- documents,
- index: lunr.Index.load(index),
- }));
- const zhDictionary = json.reduce((acc, item) => {
- for (const tuple of item.index.invertedIndex) {
- if (/\p{Unified_Ideograph}/u.test(tuple[0][0])) {
- acc.add(tuple[0]);
- }
- }
- return acc;
- }, new Set());
- return {
- wrappedIndexes,
- zhDictionary: Array.from(zhDictionary),
- };
- }
- // The index does not exist in development, therefore load a dummy index
here.
- return {
- wrappedIndexes: [],
- zhDictionary: [],
- };
-}
diff --git a/src/theme/SearchBar/icons.js b/src/theme/SearchBar/icons.js
deleted file mode 100644
index d5380213e9..0000000000
--- a/src/theme/SearchBar/icons.js
+++ /dev/null
@@ -1,7 +0,0 @@
-export const iconTitle = '<svg width="20" height="20" viewBox="0 0 20
20"><path d="M17 6v12c0 .52-.2 1-1 1H4c-.7 0-1-.33-1-1V2c0-.55.42-1 1-1h8l5
5zM14 8h-3.13c-.51 0-.87-.34-.87-.87V4" stroke="currentColor" fill="none"
fill-rule="evenodd" stroke-linejoin="round"></path></svg>';
-export const iconHeading = '<svg width="20" height="20" viewBox="0 0 20
20"><path d="M13 13h4-4V8H7v5h6v4-4H7V8H3h4V3v5h6V3v5h4-4v5zm-6 0v4-4H3h4z"
stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round"
stroke-linejoin="round"></path></svg>';
-export const iconContent = '<svg width="20" height="20" viewBox="0 0 20
20"><path d="M17 5H3h14zm0 5H3h14zm0 5H3h14z" stroke="currentColor" fill="none"
fill-rule="evenodd" stroke-linejoin="round"></path></svg>';
-export const iconAction = '<svg width="20" height="20" viewBox="0 0 20 20"><g
stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round"
stroke-linejoin="round"><path d="M18 3v4c0 2-2 4-4 4H2"></path><path d="M8
17l-6-6 6-6"></path></g></svg>';
-export const iconNoResults = '<svg width="40" height="40" viewBox="0 0 20 20"
fill="none" fill-rule="evenodd" stroke="currentColor" stroke-linecap="round"
stroke-linejoin="round"><path d="M15.5 4.8c2 3 1.7 7-1 9.7h0l4.3
4.3-4.3-4.3a7.8 7.8 0 01-9.8 1m-2.2-2.2A7.8 7.8 0 0113.2 2.4M2 18L18
2"></path></svg>';
-export const iconTreeInter = '<svg viewBox="0 0 24 54"><g
stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round"
stroke-linejoin="round"><path d="M8 6v42M20 27H8.3"></path></g></svg>';
-export const iconTreeLast = '<svg viewBox="0 0 24 54"><g stroke="currentColor"
fill="none" fill-rule="evenodd" stroke-linecap="round"
stroke-linejoin="round"><path d="M8 6v21M20 27H8.3"></path></g></svg>';
diff --git a/src/theme/SearchBar/index.js b/src/theme/SearchBar/index.js
index 369df710bf..381d9012c0 100644
--- a/src/theme/SearchBar/index.js
+++ b/src/theme/SearchBar/index.js
@@ -1,3 +1,10 @@
-import "../../utils/proxiedGenerated";
-import SearchBar from "./SearchBar";
-export default SearchBar;
+import React from 'react';
+import SearchBar from '@theme-original/SearchBar';
+
+export default function SearchBarWrapper(props) {
+ return (
+ <>
+ <SearchBar {...props} />
+ </>
+ );
+}
diff --git a/src/theme/SearchBar/interfaces.js
b/src/theme/SearchBar/interfaces.js
deleted file mode 100644
index f4037df8f9..0000000000
--- a/src/theme/SearchBar/interfaces.js
+++ /dev/null
@@ -1,8 +0,0 @@
-export var SearchDocumentType;
-(function (SearchDocumentType) {
- SearchDocumentType[SearchDocumentType["Title"] = 0] = "Title";
- SearchDocumentType[SearchDocumentType["Heading"] = 1] = "Heading";
- SearchDocumentType[SearchDocumentType["Description"] = 2] = "Description";
- SearchDocumentType[SearchDocumentType["Keywords"] = 3] = "Keywords";
- SearchDocumentType[SearchDocumentType["Content"] = 4] = "Content";
-})(SearchDocumentType || (SearchDocumentType = {}));
diff --git a/yarn.lock b/yarn.lock
index 4ce042073b..c0f3e466d7 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2121,10 +2121,10 @@
cssesc "^3.0.0"
immediate "^3.2.3"
-"@easyops-cn/docusaurus-search-local@^0.45.0":
- version "0.45.0"
- resolved
"https://registry.npmmirror.com/@easyops-cn/docusaurus-search-local/-/docusaurus-search-local-0.45.0.tgz#7101d59c9359b50b1add306d2504a09bd7176adb"
- integrity
sha512-ccJjeYmBHrv2v8Y9eQnH79S0PEKcogACKkEatEKPcad7usQj/14jA9POUUUYW/yougLSXghwe+uIncbuUBuBFg==
+"@easyops-cn/docusaurus-search-local@^0.46.1":
+ version "0.46.1"
+ resolved
"https://registry.npmmirror.com/@easyops-cn/docusaurus-search-local/-/docusaurus-search-local-0.46.1.tgz#7fac1a14417de680b5af7088814192a153d7334d"
+ integrity
sha512-kgenn5+pctVlJg8s1FOAm9KuZLRZvkBTMMGJvTTcvNTmnFIHVVYzYfA2Eg+yVefzsC8/cSZGKKJ0kLf8I+mQyw==
dependencies:
"@docusaurus/plugin-content-docs" "^2 || ^3"
"@docusaurus/theme-translations" "^2 || ^3"
@@ -2135,6 +2135,7 @@
"@node-rs/jieba" "^1.6.0"
cheerio "^1.0.0"
clsx "^1.1.1"
+ comlink "^4.4.2"
debug "^4.2.0"
fs-extra "^10.0.0"
klaw-sync "^6.0.0"
@@ -3321,11 +3322,11 @@
"@types/node" "*"
"@types/node@*":
- version "22.9.3"
- resolved
"https://registry.npmmirror.com/@types/node/-/node-22.9.3.tgz#08f3d64b3bc6d74b162d36f60213e8a6704ef2b4"
- integrity
sha512-F3u1fs/fce3FFk+DAxbxc78DF8x0cY09RRL8GnXLmkJ1jvx3TtPdWoTT5/NiYfI5ASqXBmfqJi9dZ3gxMx4lzw==
+ version "22.10.1"
+ resolved
"https://registry.npmmirror.com/@types/node/-/node-22.10.1.tgz#41ffeee127b8975a05f8c4f83fb89bcb2987d766"
+ integrity
sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==
dependencies:
- undici-types "~6.19.8"
+ undici-types "~6.20.0"
"@types/node@^17.0.5":
version "17.0.45"
@@ -4203,11 +4204,16 @@ caniuse-api@^3.0.0:
lodash.memoize "^4.1.2"
lodash.uniq "^4.5.0"
-caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001616, caniuse-lite@^1.0.30001646,
caniuse-lite@^1.0.30001669:
+caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001616, caniuse-lite@^1.0.30001646:
version "1.0.30001684"
resolved
"https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001684.tgz#0eca437bab7d5f03452ff0ef9de8299be6b08e16"
integrity
sha512-G1LRwLIQjBQoyq0ZJGqGIJUXzJ8irpbjHLpVRXDvBEScFJ9b17sgK6vlx0GAJFE21okD7zXl08rRRUfq6HdoEQ==
+caniuse-lite@^1.0.30001669:
+ version "1.0.30001685"
+ resolved
"https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001685.tgz#2d10d36c540a9a5d47ad6ab9e1ed5f61fdeadd8c"
+ integrity
sha512-e/kJN1EMyHQzgcMEEgoo+YTCO1NGCmIYHk5Qk8jT6AazWemS5QFKJ5ShCJlH3GZrNIdZofcNCEwZqbMjjKzmnA==
+
ccount@^2.0.0:
version "2.0.1"
resolved
"https://registry.npmmirror.com/ccount/-/ccount-2.0.1.tgz#17a3bf82302e0870d6da43a01311a8bc02a3ecf5"
@@ -4390,6 +4396,11 @@ combine-promises@^1.1.0:
resolved
"https://registry.npmmirror.com/combine-promises/-/combine-promises-1.2.0.tgz#5f2e68451862acf85761ded4d9e2af7769c2ca6a"
integrity
sha512-VcQB1ziGD0NXrhKxiwyNbCDmRzs/OShMs2GqW2DlU2A/Sd0nQxE1oWDAE5O0ygSx5mgQOn9eIFh7yKPgFRVkPQ==
+comlink@^4.4.2:
+ version "4.4.2"
+ resolved
"https://registry.npmmirror.com/comlink/-/comlink-4.4.2.tgz#cbbcd82742fbebc06489c28a183eedc5c60a2bca"
+ integrity
sha512-OxGdvBmJuNKSCMO4NTl1L47VRp6xn2wG4F/2hYzB6tiCb709otOxtEYCSvK80PtjODfXXZu8ds+Nw5kVCjqd2g==
+
comma-separated-tokens@^2.0.0:
version "2.0.3"
resolved
"https://registry.npmmirror.com/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz#4e89c9458acb61bc8fef19f4529973b2392839ee"
@@ -5184,9 +5195,9 @@ ejs@^3.1.6:
jake "^10.8.5"
electron-to-chromium@^1.5.41:
- version "1.5.64"
- resolved
"https://registry.npmmirror.com/electron-to-chromium/-/electron-to-chromium-1.5.64.tgz#ac8c4c89075d35a1514b620f47dfe48a71ec3697"
- integrity
sha512-IXEuxU+5ClW2IGEYFC2T7szbyVgehupCWQe5GNh+H065CD6U6IFN0s4KeAMFGNmQolRU4IV7zGBWSYMmZ8uuqQ==
+ version "1.5.67"
+ resolved
"https://registry.npmmirror.com/electron-to-chromium/-/electron-to-chromium-1.5.67.tgz#66ebd2be4a77469ac2760ef5e9e460ba9a43a845"
+ integrity
sha512-nz88NNBsD7kQSAGGJyp8hS6xSPtWwqNogA0mjtc2nUYeEf3nURK9qpV18TuBdDmEDgVWotS8Wkzf+V52dSQ/LQ==
emoji-regex@^8.0.0:
version "8.0.0"
@@ -10324,6 +10335,11 @@ sass-loader@^10.1.1:
schema-utils "^3.0.0"
semver "^7.3.2"
+sass-migrator@^2.2.1:
+ version "2.2.1"
+ resolved
"https://registry.npmmirror.com/sass-migrator/-/sass-migrator-2.2.1.tgz#803a3d534f804eb5c8ab9a0c05a4b7a9b1c267e8"
+ integrity
sha512-Sa2sVC2MeL4cVcEPpd8z/R5/c8LOA0B6K39IGrJl/8WQ24lI1tLF4P8WcQJSCt/lDmJCyOmFGZTC3Rf7/6tVfQ==
+
sass@^1.63.2:
version "1.81.0"
resolved
"https://registry.npmmirror.com/sass/-/sass-1.81.0.tgz#a9010c0599867909dfdbad057e4a6fbdd5eec941"
@@ -11275,10 +11291,10 @@ [email protected]:
buffer "^5.2.1"
through "^2.3.8"
-undici-types@~6.19.8:
- version "6.19.8"
- resolved
"https://registry.npmmirror.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02"
- integrity
sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==
+undici-types@~6.20.0:
+ version "6.20.0"
+ resolved
"https://registry.npmmirror.com/undici-types/-/undici-types-6.20.0.tgz#8171bf22c1f588d1554d55bf204bc624af388433"
+ integrity
sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==
unicode-canonical-property-names-ecmascript@^2.0.0:
version "2.0.1"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]