@seekora-ai/docsearch-js 1.0.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.
@@ -0,0 +1,65 @@
1
+ import { DocSearchHit, DocSearchSuggestion, DocSearchProps } from '@seekora/docsearch-react';
2
+ export { DocSearchHit, DocSearchProps, DocSearchSuggestion } from '@seekora/docsearch-react';
3
+
4
+ interface DocSearchOptions {
5
+ /** Container element or CSS selector */
6
+ container: string | HTMLElement;
7
+ /** API endpoint for search (e.g., "https://api.example.com/v1/docs") */
8
+ apiEndpoint: string;
9
+ /** Optional API key for authentication */
10
+ apiKey?: string;
11
+ /** Index name (optional) */
12
+ indexName?: string;
13
+ /** Placeholder text for the search input */
14
+ placeholder?: string;
15
+ /** Maximum number of results to show */
16
+ maxResults?: number;
17
+ /** Debounce delay in milliseconds */
18
+ debounceMs?: number;
19
+ /** Callback when a result is selected */
20
+ onSelect?: (hit: DocSearchHit | DocSearchSuggestion) => void;
21
+ /** Callback when the modal is closed */
22
+ onClose?: () => void;
23
+ /** Custom translations */
24
+ translations?: DocSearchProps['translations'];
25
+ /** Whether to render the button trigger (default: true) */
26
+ renderButton?: boolean;
27
+ /** Initial open state */
28
+ initialOpen?: boolean;
29
+ /** Disable keyboard shortcut (Cmd/Ctrl+K) */
30
+ disableShortcut?: boolean;
31
+ /** Custom keyboard shortcut key (default: 'k') */
32
+ shortcutKey?: string;
33
+ }
34
+ interface DocSearchInstance {
35
+ /** Destroy the DocSearch instance and cleanup */
36
+ destroy: () => void;
37
+ /** Open the search modal programmatically */
38
+ open: () => void;
39
+ /** Close the search modal programmatically */
40
+ close: () => void;
41
+ /** Update options */
42
+ update: (options: Partial<DocSearchOptions>) => void;
43
+ }
44
+ /**
45
+ * Initialize DocSearch on a container element.
46
+ *
47
+ * @example
48
+ * ```js
49
+ * import docsearch from '@seekora/docsearch-js';
50
+ * import '@seekora/docsearch-css';
51
+ *
52
+ * const search = docsearch({
53
+ * container: '#docsearch',
54
+ * apiEndpoint: 'https://api.example.com/v1/docs',
55
+ * });
56
+ *
57
+ * // Later, if needed:
58
+ * search.open();
59
+ * search.destroy();
60
+ * ```
61
+ */
62
+ declare function docsearch(options: DocSearchOptions): DocSearchInstance;
63
+
64
+ export { docsearch as default, docsearch };
65
+ export type { DocSearchInstance, DocSearchOptions };