@docsearch/js 4.4.0 → 4.5.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/dist/esm/index.d.ts +38 -3
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/umd/index.js +3 -3
- package/dist/umd/index.js.map +1 -1
- package/package.json +8 -5
package/dist/esm/index.d.ts
CHANGED
|
@@ -2,6 +2,12 @@ import { InsightsMethodMap as InsightsMethodMap$1, InsightsClient as InsightsCli
|
|
|
2
2
|
import React, { JSX } from 'react';
|
|
3
3
|
import { JSX as JSX$1 } from 'preact';
|
|
4
4
|
|
|
5
|
+
type InitialAskAiMessage = {
|
|
6
|
+
query: string;
|
|
7
|
+
messageId?: string;
|
|
8
|
+
suggestedQuestionId?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
5
11
|
type Cache = {
|
|
6
12
|
/**
|
|
7
13
|
* Gets the value of the given `key`.
|
|
@@ -8696,7 +8702,36 @@ type ModalTranslations = Partial<{
|
|
|
8696
8702
|
footer: FooterTranslations;
|
|
8697
8703
|
}> & ScreenStateTranslations;
|
|
8698
8704
|
|
|
8699
|
-
|
|
8705
|
+
/**
|
|
8706
|
+
* Instance returned by docsearch() for programmatic control.
|
|
8707
|
+
*/
|
|
8708
|
+
interface DocSearchInstance {
|
|
8709
|
+
/** Returns true once the component is mounted and ready. */
|
|
8710
|
+
readonly isReady: boolean;
|
|
8711
|
+
/** Returns true if the modal is currently open. */
|
|
8712
|
+
readonly isOpen: boolean;
|
|
8713
|
+
/** Opens the search modal. */
|
|
8714
|
+
open(): void;
|
|
8715
|
+
/** Closes the search modal. */
|
|
8716
|
+
close(): void;
|
|
8717
|
+
/** Opens Ask AI mode (modal). */
|
|
8718
|
+
openAskAi(initialMessage?: InitialAskAiMessage): void;
|
|
8719
|
+
/** Unmounts the DocSearch component and cleans up. */
|
|
8720
|
+
destroy(): void;
|
|
8721
|
+
}
|
|
8722
|
+
/**
|
|
8723
|
+
* Lifecycle callbacks for the DocSearch instance.
|
|
8724
|
+
*/
|
|
8725
|
+
interface DocSearchCallbacks {
|
|
8726
|
+
/** Called once DocSearch is mounted and ready for interaction. */
|
|
8727
|
+
onReady?: () => void;
|
|
8728
|
+
/** Called when the modal opens. */
|
|
8729
|
+
onOpen?: () => void;
|
|
8730
|
+
/** Called when the modal closes. */
|
|
8731
|
+
onClose?: () => void;
|
|
8732
|
+
interceptAskAiEvent?: (initialMessage: InitialAskAiMessage) => boolean | void;
|
|
8733
|
+
}
|
|
8734
|
+
type DocSearchProps = DocSearchCallbacks & Omit<DocSearchProps$1, 'onSidepanelClose' | 'onSidepanelOpen'> & {
|
|
8700
8735
|
container: HTMLElement | string;
|
|
8701
8736
|
environment?: typeof window;
|
|
8702
8737
|
};
|
|
@@ -8704,7 +8739,7 @@ declare const html: (strings: TemplateStringsArray, ...values: unknown[]) => JSX
|
|
|
8704
8739
|
type TemplateHelpers = Record<string, unknown> & {
|
|
8705
8740
|
html: typeof html;
|
|
8706
8741
|
};
|
|
8707
|
-
declare function docsearch(allProps: DocSearchProps):
|
|
8742
|
+
declare function docsearch(allProps: DocSearchProps): DocSearchInstance;
|
|
8708
8743
|
|
|
8709
8744
|
export { docsearch as default };
|
|
8710
|
-
export type { DocSearchProps, TemplateHelpers };
|
|
8745
|
+
export type { DocSearchCallbacks, DocSearchInstance, DocSearchProps, TemplateHelpers };
|