@stainless-api/docs-search 0.1.0-beta.3 → 0.1.0-beta.31
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/context.d.ts +1 -2
- package/dist/context.js +30 -3
- package/dist/index-ax9-8vsm.d.ts +1512 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +49 -45
- package/dist/indexer.d.ts +36 -0
- package/dist/{indexer-DBU0POrK.js → indexer.js} +7 -6
- package/dist/mcp.d.ts +4 -7
- package/dist/mcp.js +1 -1
- package/dist/providers/algolia.d.ts +4 -4
- package/dist/providers/algolia.js +81 -2
- package/dist/providers/fuse.d.ts +3 -3
- package/dist/providers/fuse.js +2 -2
- package/dist/providers/pagefind.d.ts +1 -1
- package/dist/providers/pagefind.js +13 -1
- package/dist/providers/walker.d.ts +3 -3
- package/dist/providers/walker.js +2 -2
- package/dist/types.d.ts +90 -1
- package/dist/types.js +33 -1
- package/package.json +18 -14
- package/dist/algolia-BOY-OcxU.js +0 -83
- package/dist/context-CBTWkDal.js +0 -32
- package/dist/pagefind-Dcn-gjDe.js +0 -15
- package/dist/types-BhJLoaNF.js +0 -35
- package/dist/types-Gg968wOz.d.ts +0 -91
package/dist/context.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as React from "react";
|
|
1
|
+
import { ResultType, SearchParams, SearchSettings } from "./types.js";
|
|
3
2
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
3
|
|
|
5
4
|
//#region src/context.d.ts
|
package/dist/context.js
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "
|
|
3
|
-
import {
|
|
1
|
+
import { search } from "./providers/algolia.js";
|
|
2
|
+
import { createContext, useCallback, useContext } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
|
+
//#region src/context.tsx
|
|
6
|
+
function createStrictContext(displayName) {
|
|
7
|
+
const Context = createContext(null);
|
|
8
|
+
Context.displayName = displayName;
|
|
9
|
+
function useStrictContext() {
|
|
10
|
+
const context = useContext(Context);
|
|
11
|
+
if (context === null) throw new Error(`use${displayName} must be used within a ${displayName}Provider`);
|
|
12
|
+
return context;
|
|
13
|
+
}
|
|
14
|
+
return [Context.Provider, useStrictContext];
|
|
15
|
+
}
|
|
16
|
+
const [Provider, useSearchContext] = createStrictContext("SearchContext");
|
|
17
|
+
function useSearch() {
|
|
18
|
+
const { settings } = useSearchContext();
|
|
19
|
+
return useCallback((params) => search({
|
|
20
|
+
settings,
|
|
21
|
+
params
|
|
22
|
+
}), [settings]);
|
|
23
|
+
}
|
|
24
|
+
function SearchProvider({ children, ...props }) {
|
|
25
|
+
return /* @__PURE__ */ jsx(Provider, {
|
|
26
|
+
value: props,
|
|
27
|
+
children
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
5
32
|
export { SearchProvider, useSearch, useSearchContext };
|