devstar插件
This commit is contained in:
43
node_modules/@docsearch/react/README.md
generated
vendored
Normal file
43
node_modules/@docsearch/react/README.md
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
# @docsearch/react
|
||||
|
||||
React package for [DocSearch](http://docsearch.algolia.com/), the best search experience for docs.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
yarn add @docsearch/react@3
|
||||
# or
|
||||
npm install @docsearch/react@3
|
||||
```
|
||||
|
||||
If you don’t want to use a package manager, you can use a standalone endpoint:
|
||||
|
||||
```html
|
||||
<script src="https://cdn.jsdelivr.net/npm/@docsearch/react@3"></script>
|
||||
```
|
||||
|
||||
## Get started
|
||||
|
||||
DocSearch generates a fully accessible search box for you.
|
||||
|
||||
```jsx App.js
|
||||
import { DocSearch } from '@docsearch/react';
|
||||
|
||||
import '@docsearch/css';
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<DocSearch
|
||||
appId="YOUR_APP_ID"
|
||||
indexName="YOUR_INDEX_NAME"
|
||||
apiKey="YOUR_SEARCH_API_KEY"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
[Read documentation →](https://docsearch.algolia.com/docs/docsearch-v3)
|
1
node_modules/@docsearch/react/button.js
generated
vendored
Normal file
1
node_modules/@docsearch/react/button.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { DocSearchButton } from './dist/esm';
|
208
node_modules/@docsearch/react/dist/esm/index.d.ts
generated
vendored
Normal file
208
node_modules/@docsearch/react/dist/esm/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,208 @@
|
||||
import { BaseItem, AutocompleteState, AutocompleteContext, AutocompleteInsightsApi, AutocompleteOptions } from '@algolia/autocomplete-core';
|
||||
import { LiteClient, SearchParamsObject } from 'algoliasearch/lite';
|
||||
import React from 'react';
|
||||
|
||||
type ContentType = 'content' | 'lvl0' | 'lvl1' | 'lvl2' | 'lvl3' | 'lvl4' | 'lvl5' | 'lvl6';
|
||||
interface DocSearchHitAttributeHighlightResult {
|
||||
value: string;
|
||||
matchLevel: 'full' | 'none' | 'partial';
|
||||
matchedWords: string[];
|
||||
fullyHighlighted?: boolean;
|
||||
}
|
||||
interface DocSearchHitHighlightResultHierarchy {
|
||||
lvl0: DocSearchHitAttributeHighlightResult;
|
||||
lvl1: DocSearchHitAttributeHighlightResult;
|
||||
lvl2: DocSearchHitAttributeHighlightResult;
|
||||
lvl3: DocSearchHitAttributeHighlightResult;
|
||||
lvl4: DocSearchHitAttributeHighlightResult;
|
||||
lvl5: DocSearchHitAttributeHighlightResult;
|
||||
lvl6: DocSearchHitAttributeHighlightResult;
|
||||
}
|
||||
interface DocSearchHitHighlightResult {
|
||||
content: DocSearchHitAttributeHighlightResult;
|
||||
hierarchy: DocSearchHitHighlightResultHierarchy;
|
||||
hierarchy_camel: DocSearchHitHighlightResultHierarchy[];
|
||||
}
|
||||
interface DocSearchHitAttributeSnippetResult {
|
||||
value: string;
|
||||
matchLevel: 'full' | 'none' | 'partial';
|
||||
}
|
||||
interface DocSearchHitSnippetResult {
|
||||
content: DocSearchHitAttributeSnippetResult;
|
||||
hierarchy: DocSearchHitHighlightResultHierarchy;
|
||||
hierarchy_camel: DocSearchHitHighlightResultHierarchy[];
|
||||
}
|
||||
declare type DocSearchHit = {
|
||||
objectID: string;
|
||||
content: string | null;
|
||||
url: string;
|
||||
url_without_anchor: string;
|
||||
type: ContentType;
|
||||
anchor: string | null;
|
||||
hierarchy: {
|
||||
lvl0: string;
|
||||
lvl1: string;
|
||||
lvl2: string | null;
|
||||
lvl3: string | null;
|
||||
lvl4: string | null;
|
||||
lvl5: string | null;
|
||||
lvl6: string | null;
|
||||
};
|
||||
_highlightResult: DocSearchHitHighlightResult;
|
||||
_snippetResult: DocSearchHitSnippetResult;
|
||||
_rankingInfo?: {
|
||||
promoted: boolean;
|
||||
nbTypos: number;
|
||||
firstMatchedWord: number;
|
||||
proximityDistance?: number;
|
||||
geoDistance: number;
|
||||
geoPrecision?: number;
|
||||
nbExactWords: number;
|
||||
words: number;
|
||||
filters: number;
|
||||
userScore: number;
|
||||
matchedGeoLocation?: {
|
||||
lat: number;
|
||||
lng: number;
|
||||
distance: number;
|
||||
};
|
||||
};
|
||||
_distinctSeqID?: number;
|
||||
__autocomplete_indexName?: string;
|
||||
__autocomplete_queryID?: string;
|
||||
__autocomplete_algoliaCredentials?: {
|
||||
appId: string;
|
||||
apiKey: string;
|
||||
};
|
||||
__autocomplete_id?: number;
|
||||
};
|
||||
|
||||
interface DocSearchContext extends AutocompleteContext {
|
||||
algoliaInsightsPlugin?: {
|
||||
insights: AutocompleteInsightsApi;
|
||||
};
|
||||
}
|
||||
interface DocSearchState<TItem extends BaseItem> extends AutocompleteState<TItem> {
|
||||
context: DocSearchContext;
|
||||
}
|
||||
|
||||
type InternalDocSearchHit = DocSearchHit & {
|
||||
__docsearch_parent: InternalDocSearchHit | null;
|
||||
};
|
||||
|
||||
type StoredDocSearchHit = Omit<DocSearchHit, '_highlightResult' | '_snippetResult'>;
|
||||
|
||||
type DocSearchTranslations = Partial<{
|
||||
button: ButtonTranslations;
|
||||
modal: ModalTranslations;
|
||||
}>;
|
||||
type DocSearchTransformClient = {
|
||||
search: LiteClient['search'];
|
||||
addAlgoliaAgent: LiteClient['addAlgoliaAgent'];
|
||||
transporter: Pick<LiteClient['transporter'], 'algoliaAgent'>;
|
||||
};
|
||||
interface DocSearchProps {
|
||||
appId: string;
|
||||
apiKey: string;
|
||||
indexName: string;
|
||||
placeholder?: string;
|
||||
searchParameters?: SearchParamsObject;
|
||||
maxResultsPerGroup?: number;
|
||||
transformItems?: (items: DocSearchHit[]) => DocSearchHit[];
|
||||
hitComponent?: (props: {
|
||||
hit: InternalDocSearchHit | StoredDocSearchHit;
|
||||
children: React.ReactNode;
|
||||
}) => JSX.Element;
|
||||
resultsFooterComponent?: (props: {
|
||||
state: AutocompleteState<InternalDocSearchHit>;
|
||||
}) => JSX.Element | null;
|
||||
transformSearchClient?: (searchClient: DocSearchTransformClient) => DocSearchTransformClient;
|
||||
disableUserPersonalization?: boolean;
|
||||
initialQuery?: string;
|
||||
navigator?: AutocompleteOptions<InternalDocSearchHit>['navigator'];
|
||||
translations?: DocSearchTranslations;
|
||||
getMissingResultsUrl?: ({ query }: {
|
||||
query: string;
|
||||
}) => string;
|
||||
insights?: AutocompleteOptions<InternalDocSearchHit>['insights'];
|
||||
}
|
||||
declare function DocSearch(props: DocSearchProps): JSX.Element;
|
||||
|
||||
type ButtonTranslations = Partial<{
|
||||
buttonText: string;
|
||||
buttonAriaLabel: string;
|
||||
}>;
|
||||
type DocSearchButtonProps = React.ComponentProps<'button'> & {
|
||||
translations?: ButtonTranslations;
|
||||
};
|
||||
declare const DocSearchButton: React.ForwardRefExoticComponent<Omit<DocSearchButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
||||
|
||||
type FooterTranslations = Partial<{
|
||||
selectText: string;
|
||||
selectKeyAriaLabel: string;
|
||||
navigateText: string;
|
||||
navigateUpKeyAriaLabel: string;
|
||||
navigateDownKeyAriaLabel: string;
|
||||
closeText: string;
|
||||
closeKeyAriaLabel: string;
|
||||
searchByText: string;
|
||||
}>;
|
||||
|
||||
type ErrorScreenTranslations = Partial<{
|
||||
titleText: string;
|
||||
helpText: string;
|
||||
}>;
|
||||
|
||||
type NoResultsScreenTranslations = Partial<{
|
||||
noResultsText: string;
|
||||
suggestedQueryText: string;
|
||||
reportMissingResultsText: string;
|
||||
reportMissingResultsLinkText: string;
|
||||
}>;
|
||||
|
||||
type StartScreenTranslations = Partial<{
|
||||
recentSearchesTitle: string;
|
||||
noRecentSearchesText: string;
|
||||
saveRecentSearchButtonTitle: string;
|
||||
removeRecentSearchButtonTitle: string;
|
||||
favoriteSearchesTitle: string;
|
||||
removeFavoriteSearchButtonTitle: string;
|
||||
}>;
|
||||
|
||||
type ScreenStateTranslations = Partial<{
|
||||
errorScreen: ErrorScreenTranslations;
|
||||
startScreen: StartScreenTranslations;
|
||||
noResultsScreen: NoResultsScreenTranslations;
|
||||
}>;
|
||||
|
||||
type SearchBoxTranslations = Partial<{
|
||||
resetButtonTitle: string;
|
||||
resetButtonAriaLabel: string;
|
||||
cancelButtonText: string;
|
||||
cancelButtonAriaLabel: string;
|
||||
searchInputLabel: string;
|
||||
}>;
|
||||
|
||||
type ModalTranslations = Partial<{
|
||||
searchBox: SearchBoxTranslations;
|
||||
footer: FooterTranslations;
|
||||
}> & ScreenStateTranslations;
|
||||
type DocSearchModalProps = DocSearchProps & {
|
||||
initialScrollY: number;
|
||||
onClose?: () => void;
|
||||
translations?: ModalTranslations;
|
||||
};
|
||||
declare function DocSearchModal({ appId, apiKey, indexName, placeholder, searchParameters, maxResultsPerGroup, onClose, transformItems, hitComponent, resultsFooterComponent, navigator, initialScrollY, transformSearchClient, disableUserPersonalization, initialQuery: initialQueryFromProp, translations, getMissingResultsUrl, insights, }: DocSearchModalProps): JSX.Element;
|
||||
|
||||
interface UseDocSearchKeyboardEventsProps {
|
||||
isOpen: boolean;
|
||||
onOpen: () => void;
|
||||
onClose: () => void;
|
||||
onInput?: (event: KeyboardEvent) => void;
|
||||
searchButtonRef?: React.RefObject<HTMLButtonElement>;
|
||||
}
|
||||
declare function useDocSearchKeyboardEvents({ isOpen, onOpen, onClose, onInput, searchButtonRef, }: UseDocSearchKeyboardEventsProps): void;
|
||||
|
||||
declare const version = "3.8.2";
|
||||
|
||||
export { type ButtonTranslations, DocSearch, DocSearchButton, type DocSearchButtonProps, type DocSearchHit, DocSearchModal, type DocSearchModalProps, type DocSearchProps, type DocSearchState, type DocSearchTransformClient, type DocSearchTranslations, type InternalDocSearchHit, type ModalTranslations, type StoredDocSearchHit, type UseDocSearchKeyboardEventsProps, useDocSearchKeyboardEvents, version };
|
1
node_modules/@docsearch/react/dist/esm/index.js
generated
vendored
Normal file
1
node_modules/@docsearch/react/dist/esm/index.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/@docsearch/react/dist/umd/index.js
generated
vendored
Normal file
3
node_modules/@docsearch/react/dist/umd/index.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@docsearch/react/dist/umd/index.js.map
generated
vendored
Normal file
1
node_modules/@docsearch/react/dist/umd/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@docsearch/react/modal.js
generated
vendored
Normal file
1
node_modules/@docsearch/react/modal.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { DocSearchModal } from './dist/esm';
|
70
node_modules/@docsearch/react/package.json
generated
vendored
Normal file
70
node_modules/@docsearch/react/package.json
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"name": "@docsearch/react",
|
||||
"description": "React package for DocSearch, the best search experience for docs.",
|
||||
"version": "3.8.2",
|
||||
"license": "MIT",
|
||||
"homepage": "https://docsearch.algolia.com",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/algolia/docsearch.git",
|
||||
"directory": "packages/docsearch-react"
|
||||
},
|
||||
"author": {
|
||||
"name": "Algolia, Inc.",
|
||||
"url": "https://www.algolia.com"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"files": [
|
||||
"dist/",
|
||||
"style/",
|
||||
"button.js",
|
||||
"modal.js"
|
||||
],
|
||||
"source": "src/index.ts",
|
||||
"types": "dist/esm/index.d.ts",
|
||||
"module": "dist/esm/index.js",
|
||||
"main": "dist/umd/index.js",
|
||||
"umd:main": "dist/umd/index.js",
|
||||
"unpkg": "dist/umd/index.js",
|
||||
"jsdelivr": "dist/umd/index.js",
|
||||
"scripts": {
|
||||
"build:clean": "rm -rf ./dist",
|
||||
"build:clean-types": "rm -rf ./dist/esm/types",
|
||||
"build:types": "tsc -p ./tsconfig.declaration.json --outDir ./dist/esm/types",
|
||||
"build": "yarn build:clean && yarn build:types && rollup --config --bundleConfigAsCjs && yarn build:clean-types",
|
||||
"on:change": "yarn build",
|
||||
"watch": "watch \"yarn on:change\" --ignoreDirectoryPattern \"/dist/\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@algolia/autocomplete-core": "1.17.7",
|
||||
"@algolia/autocomplete-preset-algolia": "1.17.7",
|
||||
"@docsearch/css": "3.8.2",
|
||||
"algoliasearch": "^5.14.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-replace": "6.0.1",
|
||||
"@testing-library/jest-dom": "6.6.3",
|
||||
"@testing-library/react": "16.0.1",
|
||||
"vitest": "2.1.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": ">= 16.8.0 < 19.0.0",
|
||||
"react": ">= 16.8.0 < 19.0.0",
|
||||
"react-dom": ">= 16.8.0 < 19.0.0",
|
||||
"search-insights": ">= 1 < 3"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
},
|
||||
"react": {
|
||||
"optional": true
|
||||
},
|
||||
"react-dom": {
|
||||
"optional": true
|
||||
},
|
||||
"search-insights": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
1
node_modules/@docsearch/react/style/button.js
generated
vendored
Normal file
1
node_modules/@docsearch/react/style/button.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from '@docsearch/css/dist/button.css';
|
1
node_modules/@docsearch/react/style/index.js
generated
vendored
Normal file
1
node_modules/@docsearch/react/style/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from '@docsearch/css';
|
1
node_modules/@docsearch/react/style/modal.js
generated
vendored
Normal file
1
node_modules/@docsearch/react/style/modal.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from '@docsearch/css/dist/modal.css';
|
1
node_modules/@docsearch/react/style/variables.js
generated
vendored
Normal file
1
node_modules/@docsearch/react/style/variables.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from '@docsearch/css/dist/_variables.css';
|
Reference in New Issue
Block a user