@lukoweb/plugin-search-algolia 0.1.37

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,8 @@
1
+ import * as _lukoweb_apitogo0 from "@lukoweb/apitogo";
2
+ import "@docsearch/css";
3
+ import { DocSearchModalProps } from "@docsearch/modal";
4
+
5
+ //#region src/index.d.ts
6
+ declare const algoliaSearchPlugin: (config: DocSearchModalProps) => _lukoweb_apitogo0.ApitogoPlugin;
7
+ //#endregion
8
+ export { algoliaSearchPlugin };
package/dist/index.mjs ADDED
@@ -0,0 +1,34 @@
1
+ import { createPlugin } from "@lukoweb/apitogo";
2
+ import { ClientOnly } from "@lukoweb/apitogo/components";
3
+ import { lazy, useEffect, useRef } from "react";
4
+ import "@docsearch/css";
5
+ import { jsx } from "react/jsx-runtime";
6
+
7
+ //#region src/index.tsx
8
+ const DocSearchWrapper = lazy(async () => {
9
+ const [{ DocSearch }, { DocSearchModal }] = await Promise.all([import("@docsearch/core"), import("@docsearch/modal")]);
10
+ const Wrapper = ({ isOpen, onClose, config }) => {
11
+ const ref = useRef(null);
12
+ useEffect(() => {
13
+ if (isOpen) ref.current?.open();
14
+ }, [isOpen]);
15
+ return /* @__PURE__ */ jsx(DocSearch, {
16
+ ref,
17
+ onClose,
18
+ keyboardShortcuts: {
19
+ "Ctrl/Cmd+K": false,
20
+ "/": false
21
+ },
22
+ children: /* @__PURE__ */ jsx(DocSearchModal, { ...config })
23
+ });
24
+ };
25
+ return { default: Wrapper };
26
+ });
27
+ const algoliaSearchPlugin = createPlugin((config) => ({ renderSearch: ({ isOpen, onClose }) => /* @__PURE__ */ jsx(ClientOnly, { children: /* @__PURE__ */ jsx(DocSearchWrapper, {
28
+ isOpen,
29
+ onClose,
30
+ config
31
+ }) }) }));
32
+
33
+ //#endregion
34
+ export { algoliaSearchPlugin };
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@lukoweb/plugin-search-algolia",
3
+ "version": "0.1.37",
4
+ "type": "module",
5
+ "main": "./src/index.tsx",
6
+ "types": "./src/index.tsx",
7
+ "exports": {
8
+ ".": "./src/index.tsx"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "vite.config.ts"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsdown src/index.tsx",
16
+ "dev": "tsdown --watch",
17
+ "prepublishOnly": "pnpm build"
18
+ },
19
+ "publishConfig": {
20
+ "main": "./dist/index.mjs",
21
+ "types": "./dist/index.d.mts",
22
+ "exports": {
23
+ ".": {
24
+ "import": "./dist/index.mjs",
25
+ "types": "./dist/index.d.mts"
26
+ }
27
+ },
28
+ "access": "public"
29
+ },
30
+ "dependencies": {
31
+ "@docsearch/core": "^4.6.0",
32
+ "@docsearch/css": "^4.6.0",
33
+ "@docsearch/modal": "^4.6.0"
34
+ },
35
+ "devDependencies": {
36
+ "@types/react": "19.2.14",
37
+ "@types/react-dom": "19.2.3",
38
+ "react": "19.2.4",
39
+ "react-dom": "19.2.4",
40
+ "tsdown": "0.20.3",
41
+ "@lukoweb/apitogo": "0.1.37"
42
+ },
43
+ "peerDependencies": {
44
+ "react": ">=19.2.0",
45
+ "react-dom": ">=19.2.0",
46
+ "@lukoweb/apitogo": "*"
47
+ }
48
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,10 @@
1
+ import type { UserConfig } from "@lukoweb/apitogo/vite";
2
+
3
+ export default {
4
+ optimizeDeps: {
5
+ include: [
6
+ "@zudoku/plugin-search-algolia > @docsearch/core",
7
+ "@zudoku/plugin-search-algolia > @docsearch/modal",
8
+ ],
9
+ },
10
+ } satisfies UserConfig;