@rspress-theme-anatole/theme-default 0.7.54 → 0.7.56
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/dist/bundle.js +95 -57
- package/package.json +3 -3
package/dist/bundle.js
CHANGED
|
@@ -6591,26 +6591,85 @@ function SuggestItem({ suggestion, query, closeSearch, isCurrent, setCurrentSugg
|
|
|
6591
6591
|
children: cleanDisplayLink
|
|
6592
6592
|
});
|
|
6593
6593
|
};
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6594
|
+
const BREADCRUMB_SKIPPED_SEGMENTS = new Set([
|
|
6595
|
+
'en',
|
|
6596
|
+
'ja',
|
|
6597
|
+
'product-page',
|
|
6598
|
+
'solution-pages',
|
|
6599
|
+
'index',
|
|
6600
|
+
'index.html'
|
|
6601
|
+
]);
|
|
6602
|
+
const formatBreadcrumbLabel = (segment) => {
|
|
6603
|
+
if (!segment) return '';
|
|
6604
|
+
const raw = decodeURIComponent(segment).replace(/\.html$/i, '').trim();
|
|
6605
|
+
if (!raw) return '';
|
|
6606
|
+
const normalized = raw.toLowerCase();
|
|
6607
|
+
if (BREADCRUMB_SKIPPED_SEGMENTS.has(normalized)) return '';
|
|
6608
|
+
if ('iaas-paas' === normalized) return 'IAAS & PAAS';
|
|
6609
|
+
const words = raw.split(/[-_]+/).filter(Boolean);
|
|
6610
|
+
const acronyms = new Set([
|
|
6611
|
+
'iaas',
|
|
6612
|
+
'paas',
|
|
6613
|
+
'api',
|
|
6614
|
+
'sql',
|
|
6615
|
+
'vm',
|
|
6616
|
+
'sso',
|
|
6617
|
+
'kb',
|
|
6618
|
+
'aws',
|
|
6619
|
+
'gcp'
|
|
6620
|
+
]);
|
|
6621
|
+
const lowerCaseWords = new Set([
|
|
6622
|
+
'a',
|
|
6623
|
+
'an',
|
|
6624
|
+
'and',
|
|
6625
|
+
'as',
|
|
6626
|
+
'at',
|
|
6627
|
+
'by',
|
|
6628
|
+
'for',
|
|
6629
|
+
'from',
|
|
6630
|
+
'in',
|
|
6631
|
+
'of',
|
|
6632
|
+
'on',
|
|
6633
|
+
'or',
|
|
6634
|
+
'the',
|
|
6635
|
+
'to',
|
|
6636
|
+
'via',
|
|
6637
|
+
'with'
|
|
6638
|
+
]);
|
|
6639
|
+
return words.map((word, index) => {
|
|
6640
|
+
const lower = word.toLowerCase();
|
|
6641
|
+
if (acronyms.has(lower)) return lower.toUpperCase();
|
|
6642
|
+
if (/^[a-z]+\d+$/i.test(word)) {
|
|
6643
|
+
return lower.charAt(0).toUpperCase() + lower.slice(1);
|
|
6644
|
+
}
|
|
6645
|
+
if (index > 0 && lowerCaseWords.has(lower)) return lower;
|
|
6646
|
+
return lower.charAt(0).toUpperCase() + lower.slice(1);
|
|
6647
|
+
}).join(' ');
|
|
6648
|
+
};
|
|
6649
|
+
const buildBreadcrumbFromLink = () => {
|
|
6650
|
+
const stripHtmlSuffix = (value) => 'string' == typeof value ? value.replace(/\.html(?=$|[?#\s])/gi, '').replace(/\?/g, '').trim() : value;
|
|
6651
|
+
const displayLink = removeDomain(suggestion.link || '');
|
|
6652
|
+
if (!displayLink) return '';
|
|
6653
|
+
const sanitized = displayLink.replace(/([?&])kb_highlight=[^&#]*/g, '$1').replace(/[?&]$/, '');
|
|
6654
|
+
const [pathWithQuery, hashPartRaw] = sanitized.split('#');
|
|
6655
|
+
const pathPart = pathWithQuery.split('?')[0];
|
|
6656
|
+
const pathSegments = pathPart.split('/').filter(Boolean).map(formatBreadcrumbLabel).filter(Boolean);
|
|
6657
|
+
let hashPart = hashPartRaw ? stripHtmlSuffix(formatBreadcrumbLabel(hashPartRaw)) : '';
|
|
6658
|
+
if (hashPartRaw && suggestion.header) {
|
|
6659
|
+
hashPart = stripHtmlSuffix(suggestion.header);
|
|
6660
|
+
}
|
|
6661
|
+
const parts = hashPart ? [...pathSegments, hashPart] : pathSegments;
|
|
6662
|
+
return parts.map(stripHtmlSuffix).join(' > ');
|
|
6663
|
+
};
|
|
6664
|
+
const hitContent = (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
|
|
6665
|
+
children: [
|
|
6666
|
+
renderStatementMatch(),
|
|
6667
|
+
(0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("p", {
|
|
6668
|
+
className: Search_index_module.titleForContent,
|
|
6669
|
+
children: buildBreadcrumbFromLink()
|
|
6670
|
+
})
|
|
6671
|
+
]
|
|
6672
|
+
});
|
|
6614
6673
|
return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("li", {
|
|
6615
6674
|
className: `rspress-search-suggest-item ${Search_index_module.suggestItem} ${isCurrent ? Search_index_module.current : ''}`,
|
|
6616
6675
|
onMouseEnter: setCurrentSuggestionIndex,
|
|
@@ -6638,7 +6697,7 @@ function SuggestItem({ suggestion, query, closeSearch, isCurrent, setCurrentSugg
|
|
|
6638
6697
|
(0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
|
|
6639
6698
|
children: hitContent
|
|
6640
6699
|
}),
|
|
6641
|
-
renderLink()
|
|
6700
|
+
// renderLink()
|
|
6642
6701
|
]
|
|
6643
6702
|
}),
|
|
6644
6703
|
(0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
@@ -6922,37 +6981,16 @@ function SearchPanel({ focused, setFocused }) {
|
|
|
6922
6981
|
]);
|
|
6923
6982
|
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(() => {
|
|
6924
6983
|
if (focused) {
|
|
6984
|
+
// typesense-only focus flow: opening search must not initialize the browser search index.
|
|
6985
|
+
// typesense-only result visibility: mark search ready without PageSearcher init.
|
|
6986
|
+
setInitStatus('inited');
|
|
6925
6987
|
setSearchResult(DEFAULT_RESULT);
|
|
6926
|
-
initSearch();
|
|
6927
6988
|
} else setQuery('');
|
|
6928
6989
|
}, [
|
|
6929
6990
|
focused
|
|
6930
6991
|
]);
|
|
6931
6992
|
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(() => {
|
|
6932
|
-
|
|
6933
|
-
let idleCallbackId;
|
|
6934
|
-
const prewarm = () => {
|
|
6935
|
-
ensureSearcherReady().catch(() => {});
|
|
6936
|
-
};
|
|
6937
|
-
const onPrewarm = () => {
|
|
6938
|
-
prewarm();
|
|
6939
|
-
};
|
|
6940
|
-
window.addEventListener(SEARCH_PREWARM_EVENT, onPrewarm);
|
|
6941
|
-
if (!pageSearcherRef.current) {
|
|
6942
|
-
if ('requestIdleCallback' in window) idleCallbackId = window.requestIdleCallback(() => {
|
|
6943
|
-
prewarm();
|
|
6944
|
-
});
|
|
6945
|
-
else idleCallbackId = window.setTimeout(() => {
|
|
6946
|
-
prewarm();
|
|
6947
|
-
}, 300);
|
|
6948
|
-
}
|
|
6949
|
-
return () => {
|
|
6950
|
-
window.removeEventListener(SEARCH_PREWARM_EVENT, onPrewarm);
|
|
6951
|
-
if (void 0 !== idleCallbackId) {
|
|
6952
|
-
if ('cancelIdleCallback' in window) window.cancelIdleCallback(idleCallbackId);
|
|
6953
|
-
else window.clearTimeout(idleCallbackId);
|
|
6954
|
-
}
|
|
6955
|
-
};
|
|
6993
|
+
// typesense-only prewarm removal: Gateway search does not use PageSearcher indexes.
|
|
6956
6994
|
}, []);
|
|
6957
6995
|
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(() => {
|
|
6958
6996
|
if (!pageSearcherConfigRef.current) return;
|
|
@@ -7229,18 +7267,18 @@ function SearchPanel({ focused, setFocused }) {
|
|
|
7229
7267
|
});
|
|
7230
7268
|
};
|
|
7231
7269
|
const getScopedPlaceholder = () => {
|
|
7232
|
-
if (!searchScope || !searchScope.scopeType) return searchPlaceholderText;
|
|
7270
|
+
// if (!searchScope || !searchScope.scopeType) return searchPlaceholderText;
|
|
7233
7271
|
|
|
7234
|
-
if (searchScope.scopeType === 'product') {
|
|
7235
|
-
|
|
7236
|
-
}
|
|
7237
|
-
if (searchScope.scopeType === 'solution') {
|
|
7238
|
-
|
|
7239
|
-
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
}
|
|
7272
|
+
// if (searchScope.scopeType === 'product') {
|
|
7273
|
+
// return `${scopedSearchPrefixText} ${searchScope.productName.toUpperCase()}...`;
|
|
7274
|
+
// }
|
|
7275
|
+
// if (searchScope.scopeType === 'solution') {
|
|
7276
|
+
// const formattedName = searchScope.solutionName
|
|
7277
|
+
// .split('-')
|
|
7278
|
+
// .map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
7279
|
+
// .join(' ');
|
|
7280
|
+
// return `${scopedSearchPrefixText} ${formattedName}...`;
|
|
7281
|
+
// }
|
|
7244
7282
|
return searchPlaceholderText;
|
|
7245
7283
|
};
|
|
7246
7284
|
return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress-theme-anatole/theme-default",
|
|
3
3
|
"author": "Anatole Tong",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.56",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"*.css",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"types": "./dist/bundle.d.ts",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@mdx-js/react": "2.3.0",
|
|
24
|
-
"@rspress-theme-anatole/rspress-plugin-mermaid": "0.7.
|
|
25
|
-
"@rspress-theme-anatole/shared": "0.7.
|
|
24
|
+
"@rspress-theme-anatole/rspress-plugin-mermaid": "0.7.56",
|
|
25
|
+
"@rspress-theme-anatole/shared": "0.7.56",
|
|
26
26
|
"@rspress/runtime": "1.43.8",
|
|
27
27
|
"body-scroll-lock": "4.0.0-beta.0",
|
|
28
28
|
"copy-to-clipboard": "^3.3.3",
|