@docsearch/js 4.6.2 → 5.0.0-beta.0
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/README.md +37 -4
- package/dist/esm/docsearch.d.ts +36 -0
- package/dist/esm/docsearch.js +16942 -0
- package/dist/esm/docsearch.js.map +1 -0
- package/dist/esm/index.d.ts +30 -8775
- package/dist/esm/index.js +32569 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/umd/docsearch.js +34 -0
- package/dist/umd/docsearch.js.map +1 -0
- package/dist/umd/index.js +176 -7
- package/dist/umd/index.js.map +1 -1
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -5,9 +5,7 @@ JavaScript package for [DocSearch](http://docsearch.algolia.com/), the best sear
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
|
|
9
|
-
# or
|
|
10
|
-
npm install @docsearch/js@4
|
|
8
|
+
npm install @docsearch/js@5
|
|
11
9
|
```
|
|
12
10
|
|
|
13
11
|
## Get started
|
|
@@ -15,7 +13,7 @@ npm install @docsearch/js@4
|
|
|
15
13
|
If you don’t want to use a package manager, you can use a standalone endpoint:
|
|
16
14
|
|
|
17
15
|
```html
|
|
18
|
-
<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@
|
|
16
|
+
<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@5"></script>
|
|
19
17
|
```
|
|
20
18
|
|
|
21
19
|
To get started, you need a [`container`](https://docsearch.algolia.com/docs/api#container) for your DocSearch component to go in. If you don’t have one already, you can insert one into your markup:
|
|
@@ -41,6 +39,41 @@ docsearch({
|
|
|
41
39
|
});
|
|
42
40
|
```
|
|
43
41
|
|
|
42
|
+
The default entry includes keyword search and Ask AI. Configure `askAi` or call `openAskAi()` on the returned instance when using Ask AI.
|
|
43
|
+
|
|
44
|
+
## Keyword-only entry
|
|
45
|
+
|
|
46
|
+
Use the `docsearch` subpath when your integration only needs keyword search. This entry excludes Ask AI code.
|
|
47
|
+
|
|
48
|
+
```js app.js
|
|
49
|
+
import docsearch from '@docsearch/js/docsearch';
|
|
50
|
+
|
|
51
|
+
import '@docsearch/css';
|
|
52
|
+
|
|
53
|
+
docsearch({
|
|
54
|
+
container: '#docsearch',
|
|
55
|
+
appId: 'YOUR_APP_ID',
|
|
56
|
+
indexName: 'YOUR_INDEX_NAME',
|
|
57
|
+
apiKey: 'YOUR_SEARCH_API_KEY',
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
For a standalone keyword-only script, load the explicit UMD file:
|
|
62
|
+
|
|
63
|
+
```html
|
|
64
|
+
<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@5/dist/umd/docsearch.js"></script>
|
|
65
|
+
<script>
|
|
66
|
+
window.docsearch({
|
|
67
|
+
container: '#docsearch',
|
|
68
|
+
appId: 'YOUR_APP_ID',
|
|
69
|
+
indexName: 'YOUR_INDEX_NAME',
|
|
70
|
+
apiKey: 'YOUR_SEARCH_API_KEY',
|
|
71
|
+
});
|
|
72
|
+
</script>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Both UMD entries expose callable `window.docsearch`. Load only one of them: the package default loads the AI-capable `dist/umd/index.js`, while `dist/umd/docsearch.js` is keyword-only.
|
|
76
|
+
|
|
44
77
|
## Documentation
|
|
45
78
|
|
|
46
79
|
[Read documentation →](https://docsearch.algolia.com/docs/docsearch-v3)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*! @docsearch/js 5.0.0-beta.0 (UNRELEASED 1b6607c) | MIT License | © Algolia, Inc. and contributors | https://docsearch.algolia.com */
|
|
2
|
+
import { DocSearchProps as DocSearchProps$1 } from "@docsearch/react";
|
|
3
|
+
import { InitialAskAiMessage } from "@docsearch/core";
|
|
4
|
+
//#region ../../node_modules/.bun/preact@11.0.0-beta.0/node_modules/preact/src/index.d.ts
|
|
5
|
+
import JSX = JSXInternal;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/createDocSearch.d.ts
|
|
8
|
+
interface DocSearchInstance {
|
|
9
|
+
readonly isReady: boolean;
|
|
10
|
+
readonly isOpen: boolean;
|
|
11
|
+
open(): void;
|
|
12
|
+
close(): void;
|
|
13
|
+
openAskAi(initialMessage?: InitialAskAiMessage): void;
|
|
14
|
+
destroy(): void;
|
|
15
|
+
}
|
|
16
|
+
interface DocSearchCallbacks {
|
|
17
|
+
onReady?: () => void;
|
|
18
|
+
onOpen?: () => void;
|
|
19
|
+
onClose?: () => void;
|
|
20
|
+
interceptAskAiEvent?: (initialMessage: InitialAskAiMessage) => boolean | void;
|
|
21
|
+
}
|
|
22
|
+
type DocSearchProps$2<TProps> = DocSearchCallbacks & Omit<TProps, 'onSidepanelClose' | 'onSidepanelOpen'> & {
|
|
23
|
+
container: HTMLElement | string;
|
|
24
|
+
environment?: typeof window;
|
|
25
|
+
};
|
|
26
|
+
declare const html: (strings: TemplateStringsArray, ...values: unknown[]) => JSX.Element;
|
|
27
|
+
type TemplateHelpers = Record<string, unknown> & {
|
|
28
|
+
html: typeof html;
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/docsearchComponent.d.ts
|
|
32
|
+
type DocSearchProps = DocSearchProps$2<DocSearchProps$1>;
|
|
33
|
+
declare const docsearch: (allProps: DocSearchProps) => DocSearchInstance;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { type DocSearchCallbacks, type DocSearchInstance, type DocSearchProps, type TemplateHelpers, docsearch as default };
|
|
36
|
+
//# sourceMappingURL=docsearch.d.ts.map
|