@docsearch/js 5.0.0-beta.1 → 5.0.0-beta.3
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 +3 -3
- package/dist/esm/docsearch.d.ts +38 -7
- package/dist/esm/docsearch.js +157 -117
- package/dist/esm/docsearch.js.map +1 -1
- package/dist/esm/index.d.ts +39 -7
- package/dist/esm/index.js +281 -188
- package/dist/esm/index.js.map +1 -1
- package/dist/umd/docsearch.js +10 -10
- package/dist/umd/docsearch.js.map +1 -1
- package/dist/umd/index.js +45 -43
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ import '@docsearch/css';
|
|
|
34
34
|
docsearch({
|
|
35
35
|
container: '#docsearch',
|
|
36
36
|
appId: 'YOUR_APP_ID',
|
|
37
|
-
|
|
37
|
+
indices: ['YOUR_INDEX_NAME'],
|
|
38
38
|
apiKey: 'YOUR_SEARCH_API_KEY',
|
|
39
39
|
});
|
|
40
40
|
```
|
|
@@ -53,7 +53,7 @@ import '@docsearch/css';
|
|
|
53
53
|
docsearch({
|
|
54
54
|
container: '#docsearch',
|
|
55
55
|
appId: 'YOUR_APP_ID',
|
|
56
|
-
|
|
56
|
+
indices: ['YOUR_INDEX_NAME'],
|
|
57
57
|
apiKey: 'YOUR_SEARCH_API_KEY',
|
|
58
58
|
});
|
|
59
59
|
```
|
|
@@ -66,7 +66,7 @@ For a standalone keyword-only script, load the explicit UMD file:
|
|
|
66
66
|
window.docsearch({
|
|
67
67
|
container: '#docsearch',
|
|
68
68
|
appId: 'YOUR_APP_ID',
|
|
69
|
-
|
|
69
|
+
indices: ['YOUR_INDEX_NAME'],
|
|
70
70
|
apiKey: 'YOUR_SEARCH_API_KEY',
|
|
71
71
|
});
|
|
72
72
|
</script>
|
package/dist/esm/docsearch.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @docsearch/js 5.0.0-beta.
|
|
2
|
-
import { DocSearchProps as DocSearchProps$1 } from "@docsearch/react";
|
|
1
|
+
/*! @docsearch/js 5.0.0-beta.3 (UNRELEASED b044250) | MIT License | © Algolia, Inc. and contributors | https://docsearch.algolia.com */
|
|
3
2
|
import { InitialAskAiMessage } from "@docsearch/core";
|
|
3
|
+
import { DocSearchProps as DocSearchProps$1, HitComponentProps, ResultsFooterComponentProps } from "@docsearch/react";
|
|
4
4
|
//#region ../../node_modules/.bun/preact@11.0.0-beta.0/node_modules/preact/src/index.d.ts
|
|
5
5
|
import JSX = JSXInternal;
|
|
6
6
|
//#endregion
|
|
@@ -19,18 +19,49 @@ interface DocSearchCallbacks {
|
|
|
19
19
|
onClose?: () => void;
|
|
20
20
|
interceptAskAiEvent?: (initialMessage: InitialAskAiMessage) => boolean | void;
|
|
21
21
|
}
|
|
22
|
-
type
|
|
22
|
+
type TemplateHelpers = {
|
|
23
|
+
html: typeof html;
|
|
24
|
+
};
|
|
25
|
+
type TemplateFnReturnType = JSX.Element | string | (() => JSX.Element) | null;
|
|
26
|
+
type HitComponentFn = (props: HitComponentProps, helpers: TemplateHelpers) => TemplateFnReturnType;
|
|
27
|
+
type ResultsFooterComponentFn = (props: ResultsFooterComponentProps, helpers: TemplateHelpers) => TemplateFnReturnType;
|
|
28
|
+
type FooterActionFn = (props: never, helpers: TemplateHelpers) => TemplateFnReturnType;
|
|
29
|
+
type DocSearchProps$2<TProps> = DocSearchCallbacks & Omit<TProps, 'onSidepanelClose' | 'onSidepanelOpen' | 'hitComponent' | 'resultsFooterComponent' | 'footerAction'> & {
|
|
23
30
|
container: HTMLElement | string;
|
|
24
31
|
environment?: typeof window;
|
|
32
|
+
/**
|
|
33
|
+
* Custom component to render an individual hit. Supports template patterns:
|
|
34
|
+
*
|
|
35
|
+
* - HTML strings with html helper: (props, { html }) => html`<div>...</div>`
|
|
36
|
+
* - JSX templates: (props) => <div>...</div>
|
|
37
|
+
* - Function-based templates: (props) => string | JSX.Element | Function.
|
|
38
|
+
*/
|
|
39
|
+
hitComponent?: HitComponentFn;
|
|
40
|
+
/**
|
|
41
|
+
* Custom component rendered at the bottom of the results panel. Supports
|
|
42
|
+
* template patterns:
|
|
43
|
+
*
|
|
44
|
+
* - HTML strings with html helper: (props, { html }) => html`<div>...</div>`
|
|
45
|
+
* - JSX templates: (props) => <div>...</div>
|
|
46
|
+
* - Function-based templates: (props) => string | JSX.Element | Function.
|
|
47
|
+
*/
|
|
48
|
+
resultsFooterComponent?: ResultsFooterComponentFn;
|
|
49
|
+
/**
|
|
50
|
+
* A custom action that can be rendered in the Modal's footer before the
|
|
51
|
+
* Algolia logo. The component will be rendered as a child of `<div
|
|
52
|
+
* className="DocSearch-Footer-Action" />`. Supports template patterns:
|
|
53
|
+
*
|
|
54
|
+
* - HTML strings with html helper: (props, { html }) => html`<div>...</div>`
|
|
55
|
+
* - JSX templates: (props) => <div>...</div>
|
|
56
|
+
* - Function-based templates: (props) => string | JSX.Element | Function.
|
|
57
|
+
*/
|
|
58
|
+
footerAction?: FooterActionFn;
|
|
25
59
|
};
|
|
26
60
|
declare const html: (strings: TemplateStringsArray, ...values: unknown[]) => JSX.Element;
|
|
27
|
-
type TemplateHelpers = Record<string, unknown> & {
|
|
28
|
-
html: typeof html;
|
|
29
|
-
};
|
|
30
61
|
//#endregion
|
|
31
62
|
//#region src/docsearchComponent.d.ts
|
|
32
63
|
type DocSearchProps = DocSearchProps$2<DocSearchProps$1>;
|
|
33
64
|
declare const docsearch: (allProps: DocSearchProps) => DocSearchInstance;
|
|
34
65
|
//#endregion
|
|
35
|
-
export { type DocSearchCallbacks, type DocSearchInstance, type DocSearchProps, type TemplateHelpers, docsearch as default };
|
|
66
|
+
export { type DocSearchCallbacks, type DocSearchInstance, type DocSearchProps, type FooterActionFn, type HitComponentFn, type ResultsFooterComponentFn, type TemplateHelpers, docsearch as default };
|
|
36
67
|
//# sourceMappingURL=docsearch.d.ts.map
|