This commit is contained in:
NoryiE
2025-02-16 14:12:49 +00:00
parent c6a89e5b35
commit e0aeb9b06e
2737 changed files with 5220 additions and 1039045 deletions

View File

@@ -1 +0,0 @@
export declare function groupBy<TValue extends Record<string, unknown>>(values: TValue[], predicate: (value: TValue) => string, maxResultsPerGroup?: number): Record<string, TValue[]>;

View File

@@ -1,17 +0,0 @@
export function groupBy(values, predicate, maxResultsPerGroup) {
return values.reduce(function (acc, item) {
var key = predicate(item);
if (!acc.hasOwnProperty(key)) {
acc[key] = [];
} // We limit each section to show 5 hits maximum.
// This acts as a frontend alternative to `distinct`.
if (acc[key].length < (maxResultsPerGroup || 5)) {
acc[key].push(item);
}
return acc;
}, {});
}

View File

@@ -1 +0,0 @@
export declare function identity<TParam>(x: TParam): TParam;

View File

@@ -1,3 +0,0 @@
export function identity(x) {
return x;
}

View File

@@ -1,5 +0,0 @@
export * from './groupBy';
export * from './identity';
export * from './isModifierEvent';
export * from './noop';
export * from './removeHighlightTags';

View File

@@ -1,5 +0,0 @@
export * from './groupBy';
export * from './identity';
export * from './isModifierEvent';
export * from './noop';
export * from './removeHighlightTags';

View File

@@ -1,5 +0,0 @@
/**
* Detect when an event is modified with a special key to let the browser
* trigger its default behavior.
*/
export declare function isModifierEvent<TEvent extends KeyboardEvent | MouseEvent>(event: TEvent): boolean;

View File

@@ -1,8 +0,0 @@
/**
* Detect when an event is modified with a special key to let the browser
* trigger its default behavior.
*/
export function isModifierEvent(event) {
var isMiddleClick = event.button === 1;
return isMiddleClick || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
}

View File

@@ -1 +0,0 @@
export declare function noop(..._args: any[]): void;

View File

@@ -1 +0,0 @@
export function noop() {}

View File

@@ -1,2 +0,0 @@
import type { DocSearchHit, InternalDocSearchHit } from '../types';
export declare function removeHighlightTags(hit: DocSearchHit | InternalDocSearchHit): string;

View File

@@ -1,16 +0,0 @@
var regexHighlightTags = /(<mark>|<\/mark>)/g;
var regexHasHighlightTags = RegExp(regexHighlightTags.source);
export function removeHighlightTags(hit) {
var _internalDocSearchHit, _hit$_highlightResult;
var internalDocSearchHit = hit;
if (!internalDocSearchHit.__docsearch_parent && !hit._highlightResult) {
return hit.hierarchy.lvl0;
}
var _ref = (internalDocSearchHit.__docsearch_parent ? (_internalDocSearchHit = internalDocSearchHit.__docsearch_parent) === null || _internalDocSearchHit === void 0 || (_internalDocSearchHit = _internalDocSearchHit._highlightResult) === null || _internalDocSearchHit === void 0 || (_internalDocSearchHit = _internalDocSearchHit.hierarchy) === null || _internalDocSearchHit === void 0 ? void 0 : _internalDocSearchHit.lvl0 : (_hit$_highlightResult = hit._highlightResult) === null || _hit$_highlightResult === void 0 || (_hit$_highlightResult = _hit$_highlightResult.hierarchy) === null || _hit$_highlightResult === void 0 ? void 0 : _hit$_highlightResult.lvl0) || {},
value = _ref.value;
return value && regexHasHighlightTags.test(value) ? value.replace(regexHighlightTags, '') : value;
}