zudoku 0.39.0 → 0.39.2
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/app/entry.server.d.ts +5 -4
- package/dist/app/entry.server.js +2 -2
- package/dist/app/entry.server.js.map +1 -1
- package/dist/cli/cmds/dev.js +1 -7
- package/dist/cli/cmds/dev.js.map +1 -1
- package/dist/config/validators/common.d.ts +17 -0
- package/dist/config/validators/common.js +1 -0
- package/dist/config/validators/common.js.map +1 -1
- package/dist/config/validators/validate.d.ts +7 -0
- package/dist/lib/components/Bootstrap.d.ts +2 -1
- package/dist/lib/components/Bootstrap.js +3 -2
- package/dist/lib/components/Bootstrap.js.map +1 -1
- package/dist/lib/components/Header.js +2 -2
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/Layout.js +1 -1
- package/dist/lib/components/Layout.js.map +1 -1
- package/dist/lib/components/Main.js +1 -1
- package/dist/lib/components/Main.js.map +1 -1
- package/dist/lib/components/MobileTopNavigation.js +6 -3
- package/dist/lib/components/MobileTopNavigation.js.map +1 -1
- package/dist/lib/components/TopNavigation.d.ts +1 -0
- package/dist/lib/components/TopNavigation.js +2 -2
- package/dist/lib/components/TopNavigation.js.map +1 -1
- package/dist/lib/components/Zudoku.js +4 -1
- package/dist/lib/components/Zudoku.js.map +1 -1
- package/dist/lib/components/context/BypassProtectedRoutesContext.d.ts +1 -0
- package/dist/lib/components/context/BypassProtectedRoutesContext.js +3 -0
- package/dist/lib/components/context/BypassProtectedRoutesContext.js.map +1 -0
- package/dist/lib/components/index.d.ts +2 -1
- package/dist/lib/components/navigation/PoweredByZudoku.d.ts +3 -0
- package/dist/lib/components/navigation/PoweredByZudoku.js +6 -0
- package/dist/lib/components/navigation/PoweredByZudoku.js.map +1 -0
- package/dist/lib/components/navigation/SidebarWrapper.js +9 -2
- package/dist/lib/components/navigation/SidebarWrapper.js.map +1 -1
- package/dist/lib/components/navigation/ZudokuLogo.d.ts +6 -0
- package/dist/lib/components/navigation/ZudokuLogo.js +5 -0
- package/dist/lib/components/navigation/ZudokuLogo.js.map +1 -0
- package/dist/lib/core/RouteGuard.d.ts +1 -0
- package/dist/lib/core/RouteGuard.js +9 -3
- package/dist/lib/core/RouteGuard.js.map +1 -1
- package/dist/lib/core/ZudokuContext.d.ts +1 -0
- package/dist/lib/core/ZudokuContext.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupConnector.d.ts +2 -1
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupConnector.js +2 -2
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupConnector.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.js +1 -1
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.js +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
- package/dist/lib/plugins/search-pagefind/PagefindSearch.js +9 -4
- package/dist/lib/plugins/search-pagefind/PagefindSearch.js.map +1 -1
- package/dist/lib/plugins/search-pagefind/ResultList.d.ts +1 -1
- package/dist/lib/plugins/search-pagefind/ResultList.js +6 -12
- package/dist/lib/plugins/search-pagefind/ResultList.js.map +1 -1
- package/dist/lib/plugins/search-pagefind/index.d.ts +1 -3
- package/dist/vite/build.js +1 -9
- package/dist/vite/build.js.map +1 -1
- package/dist/vite/plugin-search.js +1 -1
- package/dist/vite/plugin-search.js.map +1 -1
- package/dist/vite/prerender/FileWritingResponse.d.ts +9 -5
- package/dist/vite/prerender/FileWritingResponse.js +5 -5
- package/dist/vite/prerender/FileWritingResponse.js.map +1 -1
- package/dist/vite/prerender/InMemoryResponse.d.ts +16 -0
- package/dist/vite/prerender/InMemoryResponse.js +32 -0
- package/dist/vite/prerender/InMemoryResponse.js.map +1 -0
- package/dist/vite/prerender/PrerenderResponse.d.ts +10 -0
- package/dist/vite/prerender/PrerenderResponse.js +2 -0
- package/dist/vite/prerender/PrerenderResponse.js.map +1 -0
- package/dist/vite/prerender/prerender.d.ts +1 -0
- package/dist/vite/prerender/prerender.js +18 -0
- package/dist/vite/prerender/prerender.js.map +1 -1
- package/dist/vite/prerender/worker.js +36 -8
- package/dist/vite/prerender/worker.js.map +1 -1
- package/dist/zuplo/with-zuplo.js +4 -0
- package/dist/zuplo/with-zuplo.js.map +1 -1
- package/lib/{Callout-D5frCCJ0.js → Callout-B2vsR09t.js} +2 -2
- package/lib/{Callout-D5frCCJ0.js.map → Callout-B2vsR09t.js.map} +1 -1
- package/lib/{Dialog-Dv6WG8RN.js → Dialog-sbgekbjb.js} +5 -5
- package/lib/{Dialog-Dv6WG8RN.js.map → Dialog-sbgekbjb.js.map} +1 -1
- package/lib/{MdxPage-ZW1StNhp.js → MdxPage-JscVnWM8.js} +22 -21
- package/lib/{MdxPage-ZW1StNhp.js.map → MdxPage-JscVnWM8.js.map} +1 -1
- package/lib/{OasProvider-Cld9RAMQ.js → OasProvider-C4T5TU8Z.js} +2 -2
- package/lib/{OasProvider-Cld9RAMQ.js.map → OasProvider-C4T5TU8Z.js.map} +1 -1
- package/lib/{OperationList-D-OfzJm6.js → OperationList-C-gBHUou.js} +49 -48
- package/lib/{OperationList-D-OfzJm6.js.map → OperationList-C-gBHUou.js.map} +1 -1
- package/lib/{Pagination-CYB3nVYx.js → Pagination-DCCvGq0m.js} +2 -2
- package/lib/{Pagination-CYB3nVYx.js.map → Pagination-DCCvGq0m.js.map} +1 -1
- package/lib/RouteGuard-CqZPoZYJ.js +744 -0
- package/lib/RouteGuard-CqZPoZYJ.js.map +1 -0
- package/lib/{SchemaList-Ci1WxRh0.js → SchemaList-DuN6ThXR.js} +3 -3
- package/lib/{SchemaList-Ci1WxRh0.js.map → SchemaList-DuN6ThXR.js.map} +1 -1
- package/lib/{SchemaView-Brn-YxHY.js → SchemaView-B3fOPR4V.js} +112 -100
- package/lib/SchemaView-B3fOPR4V.js.map +1 -0
- package/lib/{createServer-mMau3eV_.js → createServer-mYvGvmc0.js} +2469 -2443
- package/lib/createServer-mYvGvmc0.js.map +1 -0
- package/lib/index-D6ktNq4i.js +1863 -0
- package/lib/index-D6ktNq4i.js.map +1 -0
- package/lib/{index-CjPMxpOV.js → index-DsdAaiwx.js} +13 -12
- package/lib/{index-CjPMxpOV.js.map → index-DsdAaiwx.js.map} +1 -1
- package/lib/objectEntries-yMIkr2mI.js +5 -0
- package/lib/objectEntries-yMIkr2mI.js.map +1 -0
- package/lib/ui/Command.js +1 -1
- package/lib/useLatest-hmRS46UF.js +11 -0
- package/lib/useLatest-hmRS46UF.js.map +1 -0
- package/lib/zudoku.components.js +15 -14
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.plugin-api-catalog.js +6 -5
- package/lib/zudoku.plugin-api-catalog.js.map +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +1 -1
- package/lib/zudoku.plugin-search-pagefind.js +132 -137
- package/lib/zudoku.plugin-search-pagefind.js.map +1 -1
- package/package.json +3 -3
- package/src/app/entry.server.tsx +6 -3
- package/src/lib/components/Bootstrap.tsx +13 -6
- package/src/lib/components/Header.tsx +2 -2
- package/src/lib/components/Layout.tsx +1 -1
- package/src/lib/components/Main.tsx +3 -2
- package/src/lib/components/MobileTopNavigation.tsx +27 -18
- package/src/lib/components/TopNavigation.tsx +2 -2
- package/src/lib/components/Zudoku.tsx +5 -3
- package/src/lib/components/context/BypassProtectedRoutesContext.ts +3 -0
- package/src/lib/components/navigation/PoweredByZudoku.tsx +23 -0
- package/src/lib/components/navigation/SidebarWrapper.tsx +27 -13
- package/src/lib/components/navigation/ZudokuLogo.tsx +25 -0
- package/src/lib/core/RouteGuard.tsx +26 -4
- package/src/lib/core/ZudokuContext.ts +1 -0
- package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupConnector.tsx +3 -0
- package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.tsx +5 -1
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +6 -1
- package/src/lib/plugins/search-pagefind/PagefindSearch.tsx +11 -4
- package/src/lib/plugins/search-pagefind/ResultList.tsx +5 -16
- package/src/lib/plugins/search-pagefind/index.tsx +1 -1
- package/dist/cli/dev/pagefind-command.d.ts +0 -3
- package/dist/cli/dev/pagefind-command.js +0 -59
- package/dist/cli/dev/pagefind-command.js.map +0 -1
- package/dist/lib/components/context/PluginSystem.d.ts +0 -1
- package/dist/lib/components/context/PluginSystem.js +0 -2
- package/dist/lib/components/context/PluginSystem.js.map +0 -1
- package/lib/SchemaView-Brn-YxHY.js.map +0 -1
- package/lib/createServer-mMau3eV_.js.map +0 -1
- package/lib/index-Bt7MKhZq.js +0 -2514
- package/lib/index-Bt7MKhZq.js.map +0 -1
- package/lib/objectEntries-BS7aAgOm.js +0 -12
- package/lib/objectEntries-BS7aAgOm.js.map +0 -1
- package/src/lib/components/context/PluginSystem.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectEntries-yMIkr2mI.js","sources":["../src/lib/util/objectEntries.ts"],"sourcesContent":["type ValueOf<T> = T[keyof T];\ntype Entries<T> = [keyof T, ValueOf<T>][];\n\nexport const objectEntries = <T extends object>(obj: T): Entries<T> =>\n Object.entries(obj) as Entries<T>;\n"],"names":["objectEntries","obj"],"mappings":"AAGO,MAAMA,IAAgB,CAAmBC,MAC9C,OAAO,QAAQA,CAAG;"}
|
package/lib/ui/Command.js
CHANGED
|
@@ -2,7 +2,7 @@ import { j as o } from "../jsx-runtime-CYK1ROHF.js";
|
|
|
2
2
|
import { V as s } from "../index-gQD2h1wX.js";
|
|
3
3
|
import { Search as n } from "lucide-react";
|
|
4
4
|
import * as d from "react";
|
|
5
|
-
import { D as p, a as l } from "../Dialog-
|
|
5
|
+
import { D as p, a as l } from "../Dialog-sbgekbjb.js";
|
|
6
6
|
import { c as t } from "../cn-qaFjX9_3.js";
|
|
7
7
|
const m = d.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ o.jsx(
|
|
8
8
|
s,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLatest-hmRS46UF.js","sources":["../src/lib/util/useLatest.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\n\n// This hook is useful when you need to store a reference to a variable that changes over time,\n// but you don't want to re-run any callbacks that depend on that variable every time it changes.\n// By using a reference to the latest value, you can ensure that any callbacks only run when necessary,\n// without any unnecessary re-renders.\n\n// Note: It's safe to put the return value of this hook in a dependency array, because it won't change!\nexport const useLatest = <T>(current: T) => {\n const valueRef = useRef(current);\n valueRef.current = current;\n\n useEffect(() => {\n valueRef.current = current;\n }, [current]);\n\n return valueRef;\n};\n"],"names":["useLatest","current","valueRef","useRef","useEffect"],"mappings":";AAQa,MAAAA,IAAY,CAAIC,MAAe;AACpC,QAAAC,IAAWC,EAAOF,CAAO;AAC/B,SAAAC,EAAS,UAAUD,GAEnBG,EAAU,MAAM;AACd,IAAAF,EAAS,UAAUD;AAAA,EAAA,GAClB,CAACA,CAAO,CAAC,GAELC;AACT;"}
|
package/lib/zudoku.components.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./RouteGuard-CqZPoZYJ.js";
|
|
2
2
|
import "./index-DwT-v3zK.js";
|
|
3
3
|
import "./chunk-HA7DTUK3-C4gP41vD.js";
|
|
4
4
|
import "./hook-CqpVYDqN.js";
|
|
5
5
|
import "./SlotletProvider-DXvc0aY6.js";
|
|
6
|
+
import { e as d, f as S, B as k, C as l, j as h, l as B, H as E, d as c, L as H, M as L, g as M, R, S as Z, k as f, i as g, Z as y, a as A, h as b, c as j, m as v, b as w } from "./index-D6ktNq4i.js";
|
|
6
7
|
import "./ui/Button.js";
|
|
7
8
|
import "./ui/Callout.js";
|
|
8
9
|
import "./ClientOnly-E7hGysn1.js";
|
|
9
10
|
import "./Markdown-aF5FdsNi.js";
|
|
10
11
|
import "./Spinner-CE68iCm0.js";
|
|
11
12
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
d as Bootstrap,
|
|
14
|
+
S as BootstrapStatic,
|
|
15
|
+
k as Button,
|
|
16
|
+
l as CACHE_KEYS,
|
|
17
|
+
h as Callout,
|
|
18
|
+
B as ClientOnly,
|
|
19
|
+
E as Head,
|
|
20
|
+
c as Layout,
|
|
21
|
+
H as Link,
|
|
21
22
|
L as Markdown,
|
|
22
23
|
M as RouteGuard,
|
|
23
24
|
R as RouterError,
|
|
@@ -26,9 +27,9 @@ export {
|
|
|
26
27
|
g as StatusPage,
|
|
27
28
|
y as Zudoku,
|
|
28
29
|
A as useAuth,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
b as useCache,
|
|
31
|
+
j as useMDXComponents,
|
|
32
|
+
v as useTheme,
|
|
33
|
+
w as useZudoku
|
|
33
34
|
};
|
|
34
35
|
//# sourceMappingURL=zudoku.components.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zudoku.components.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zudoku.components.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-CYK1ROHF.js";
|
|
2
|
-
import { s as
|
|
2
|
+
import { s as h } from "./index-LNp6rxyU.js";
|
|
3
3
|
import { d as b, m as x } from "./chunk-HA7DTUK3-C4gP41vD.js";
|
|
4
4
|
import { u as j, d as y, f as p } from "./hook-CqpVYDqN.js";
|
|
5
|
-
import { H as v
|
|
5
|
+
import { H as v } from "./RouteGuard-CqZPoZYJ.js";
|
|
6
|
+
import { L as N } from "./index-D6ktNq4i.js";
|
|
6
7
|
import { H as S, M as w } from "./Markdown-aF5FdsNi.js";
|
|
7
8
|
const H = ({
|
|
8
9
|
items: r,
|
|
@@ -55,7 +56,7 @@ const H = ({
|
|
|
55
56
|
]
|
|
56
57
|
}
|
|
57
58
|
);
|
|
58
|
-
}, u = (r, o) =>
|
|
59
|
+
}, u = (r, o) => h(`${r}-${o}`), A = ({
|
|
59
60
|
navigationId: r,
|
|
60
61
|
items: o,
|
|
61
62
|
label: d,
|
|
@@ -87,7 +88,7 @@ const H = ({
|
|
|
87
88
|
badge: {
|
|
88
89
|
label: String(
|
|
89
90
|
o.filter(
|
|
90
|
-
(g) => g.categories.find((
|
|
91
|
+
(g) => g.categories.find((f) => f.tags.includes(c))
|
|
91
92
|
).length
|
|
92
93
|
),
|
|
93
94
|
color: "outline"
|
|
@@ -117,7 +118,7 @@ const H = ({
|
|
|
117
118
|
};
|
|
118
119
|
};
|
|
119
120
|
export {
|
|
120
|
-
|
|
121
|
+
A as apiCatalogPlugin,
|
|
121
122
|
u as getKey
|
|
122
123
|
};
|
|
123
124
|
//# sourceMappingURL=zudoku.plugin-api-catalog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zudoku.plugin-api-catalog.js","sources":["../src/lib/plugins/api-catalog/Catalog.tsx","../src/lib/plugins/api-catalog/index.tsx"],"sourcesContent":["import { useSuspenseQuery } from \"@tanstack/react-query\";\nimport { Helmet } from \"@zudoku/react-helmet-async\";\nimport { useMatch } from \"react-router\";\nimport { Link } from \"zudoku/components\";\nimport { useAuthState } from \"../../authentication/state.js\";\nimport { Heading } from \"../../components/Heading.js\";\nimport { Markdown } from \"../../components/Markdown.js\";\nimport { joinUrl } from \"../../util/joinUrl.js\";\nimport { type ApiCatalogPluginOptions, getKey } from \"./index.js\";\n\nexport const Catalog = ({\n items,\n filterCatalogItems = (items) => items,\n label = \"API Library\",\n categoryLabel,\n}: Omit<ApiCatalogPluginOptions, \"navigationId\"> & {\n categoryLabel?: string;\n}) => {\n const auth = useAuthState();\n const match = useMatch({ path: \"/catalog/:category\" });\n const activeCategory = match?.params.category;\n\n const catalogItems = useSuspenseQuery({\n queryFn: () => filterCatalogItems(items, { auth }),\n queryKey: [\"catalogItems\", auth],\n });\n\n // Only index the overview page, ignore the rest\n const dataSet = activeCategory ? { \"data-pagefind-ignore\": \"all\" } : {};\n\n return (\n <section\n className=\"pt-[--padding-content-top] pb-[--padding-content-bottom]\"\n {...dataSet}\n >\n <Helmet>\n <title>\n {categoryLabel ? `${categoryLabel} - ` : \"\"}\n {label}\n </title>\n </Helmet>\n <div className=\"grid gap-4\">\n <Heading level={2}>\n {label}\n {categoryLabel && ` - ${categoryLabel}`}\n </Heading>\n\n <div className=\"grid grid-cols-2 gap-4\">\n {catalogItems.data\n .filter(\n (api) =>\n !activeCategory ||\n api.categories.find((c) =>\n c.tags.find((t) => getKey(c.label, t) === activeCategory),\n ),\n )\n .map((api) => (\n <Link\n to={joinUrl(api.path)}\n className=\"no-underline hover:!text-foreground\"\n key={api.path}\n >\n <div className=\"border h-full rounded-lg p-4 flex flex-col gap-2 cursor-pointer hover:bg-border/20 font-normal\">\n <span className=\"font-semibold\">{api.label}</span>\n <Markdown\n className=\"text-sm whitespace-pre-wrap mb-6 line-clamp-2\"\n content={api.description}\n />\n </div>\n </Link>\n ))}\n </div>\n </div>\n </section>\n );\n};\n","import slugify from \"@sindresorhus/slugify\";\nimport { matchPath } from \"react-router\";\nimport type { SidebarItem } from \"../../../config/validators/SidebarSchema.js\";\nimport type { AuthState } from \"../../authentication/state.js\";\nimport type { ZudokuPlugin } from \"../../core/plugins.js\";\nimport { joinUrl } from \"../../util/joinUrl.js\";\nimport { Catalog } from \"./Catalog.js\";\n\nexport const getKey = (category: string, tag: string) =>\n slugify(`${category}-${tag}`);\n\nexport type ApiCatalogItem = {\n path: string;\n label: string;\n description: string;\n categories: CatalogCategory[];\n};\n\nexport type CatalogCategory = {\n label: string;\n tags: string[];\n};\n\nexport type ApiCatalogPluginOptions = {\n navigationId: string;\n label: string;\n categories?: CatalogCategory[];\n items: ApiCatalogItem[];\n filterCatalogItems?: filterCatalogItems;\n};\n\nexport type CatalogContext<ProviderData = unknown> = {\n auth: AuthState<ProviderData>;\n};\n\nexport type filterCatalogItems<ProviderData = unknown> = (\n items: ApiCatalogItem[],\n { auth }: CatalogContext<ProviderData>,\n) => ApiCatalogItem[];\n\nexport const apiCatalogPlugin = ({\n navigationId,\n items,\n label,\n categories = [],\n filterCatalogItems,\n}: {\n navigationId: string;\n label: string;\n categories?: CatalogCategory[];\n items: ApiCatalogItem[];\n filterCatalogItems?: filterCatalogItems;\n}): ZudokuPlugin => {\n const paths = Object.fromEntries(\n categories.flatMap((category) =>\n [undefined, ...category.tags].map((tag) => [\n joinUrl(navigationId, tag ? getKey(category.label, tag) : undefined),\n tag,\n ]),\n ),\n );\n\n return {\n getSidebar: async (currentPath) => {\n const matches = Object.keys(paths).some((path) =>\n matchPath(path, currentPath),\n );\n\n if (!matches) {\n return [];\n }\n\n const sidebar: SidebarItem[] = categories.map((category) => ({\n type: \"category\" as const,\n label: category.label,\n collapsible: false,\n items: category.tags.map((tag) => ({\n type: \"doc\" as const,\n id: joinUrl(navigationId, getKey(category.label, tag)),\n label: tag,\n badge: {\n label: String(\n items.filter((api) =>\n api.categories.find((c) => c.tags.includes(tag)),\n ).length,\n ),\n color: \"outline\" as const,\n },\n })),\n }));\n\n sidebar.unshift({\n type: \"doc\" as const,\n id: joinUrl(navigationId),\n label: \"Overview\",\n badge: { label: String(items.length), color: \"outline\" as const },\n });\n\n return sidebar;\n },\n getRoutes: () =>\n Object.entries(paths).map(([path, tag]) => ({\n path,\n element: (\n <Catalog\n label={label}\n categoryLabel={tag}\n items={items}\n filterCatalogItems={filterCatalogItems}\n categories={categories}\n />\n ),\n })),\n };\n};\n"],"names":["Catalog","items","filterCatalogItems","label","categoryLabel","auth","useAuthState","match","useMatch","activeCategory","catalogItems","useSuspenseQuery","dataSet","jsxs","jsx","Helmet","Heading","api","t","getKey","Link","joinUrl","Markdown","category","tag","slugify","apiCatalogPlugin","navigationId","categories","paths","currentPath","path","matchPath","sidebar","c"],"mappings":"
|
|
1
|
+
{"version":3,"file":"zudoku.plugin-api-catalog.js","sources":["../src/lib/plugins/api-catalog/Catalog.tsx","../src/lib/plugins/api-catalog/index.tsx"],"sourcesContent":["import { useSuspenseQuery } from \"@tanstack/react-query\";\nimport { Helmet } from \"@zudoku/react-helmet-async\";\nimport { useMatch } from \"react-router\";\nimport { Link } from \"zudoku/components\";\nimport { useAuthState } from \"../../authentication/state.js\";\nimport { Heading } from \"../../components/Heading.js\";\nimport { Markdown } from \"../../components/Markdown.js\";\nimport { joinUrl } from \"../../util/joinUrl.js\";\nimport { type ApiCatalogPluginOptions, getKey } from \"./index.js\";\n\nexport const Catalog = ({\n items,\n filterCatalogItems = (items) => items,\n label = \"API Library\",\n categoryLabel,\n}: Omit<ApiCatalogPluginOptions, \"navigationId\"> & {\n categoryLabel?: string;\n}) => {\n const auth = useAuthState();\n const match = useMatch({ path: \"/catalog/:category\" });\n const activeCategory = match?.params.category;\n\n const catalogItems = useSuspenseQuery({\n queryFn: () => filterCatalogItems(items, { auth }),\n queryKey: [\"catalogItems\", auth],\n });\n\n // Only index the overview page, ignore the rest\n const dataSet = activeCategory ? { \"data-pagefind-ignore\": \"all\" } : {};\n\n return (\n <section\n className=\"pt-[--padding-content-top] pb-[--padding-content-bottom]\"\n {...dataSet}\n >\n <Helmet>\n <title>\n {categoryLabel ? `${categoryLabel} - ` : \"\"}\n {label}\n </title>\n </Helmet>\n <div className=\"grid gap-4\">\n <Heading level={2}>\n {label}\n {categoryLabel && ` - ${categoryLabel}`}\n </Heading>\n\n <div className=\"grid grid-cols-2 gap-4\">\n {catalogItems.data\n .filter(\n (api) =>\n !activeCategory ||\n api.categories.find((c) =>\n c.tags.find((t) => getKey(c.label, t) === activeCategory),\n ),\n )\n .map((api) => (\n <Link\n to={joinUrl(api.path)}\n className=\"no-underline hover:!text-foreground\"\n key={api.path}\n >\n <div className=\"border h-full rounded-lg p-4 flex flex-col gap-2 cursor-pointer hover:bg-border/20 font-normal\">\n <span className=\"font-semibold\">{api.label}</span>\n <Markdown\n className=\"text-sm whitespace-pre-wrap mb-6 line-clamp-2\"\n content={api.description}\n />\n </div>\n </Link>\n ))}\n </div>\n </div>\n </section>\n );\n};\n","import slugify from \"@sindresorhus/slugify\";\nimport { matchPath } from \"react-router\";\nimport type { SidebarItem } from \"../../../config/validators/SidebarSchema.js\";\nimport type { AuthState } from \"../../authentication/state.js\";\nimport type { ZudokuPlugin } from \"../../core/plugins.js\";\nimport { joinUrl } from \"../../util/joinUrl.js\";\nimport { Catalog } from \"./Catalog.js\";\n\nexport const getKey = (category: string, tag: string) =>\n slugify(`${category}-${tag}`);\n\nexport type ApiCatalogItem = {\n path: string;\n label: string;\n description: string;\n categories: CatalogCategory[];\n};\n\nexport type CatalogCategory = {\n label: string;\n tags: string[];\n};\n\nexport type ApiCatalogPluginOptions = {\n navigationId: string;\n label: string;\n categories?: CatalogCategory[];\n items: ApiCatalogItem[];\n filterCatalogItems?: filterCatalogItems;\n};\n\nexport type CatalogContext<ProviderData = unknown> = {\n auth: AuthState<ProviderData>;\n};\n\nexport type filterCatalogItems<ProviderData = unknown> = (\n items: ApiCatalogItem[],\n { auth }: CatalogContext<ProviderData>,\n) => ApiCatalogItem[];\n\nexport const apiCatalogPlugin = ({\n navigationId,\n items,\n label,\n categories = [],\n filterCatalogItems,\n}: {\n navigationId: string;\n label: string;\n categories?: CatalogCategory[];\n items: ApiCatalogItem[];\n filterCatalogItems?: filterCatalogItems;\n}): ZudokuPlugin => {\n const paths = Object.fromEntries(\n categories.flatMap((category) =>\n [undefined, ...category.tags].map((tag) => [\n joinUrl(navigationId, tag ? getKey(category.label, tag) : undefined),\n tag,\n ]),\n ),\n );\n\n return {\n getSidebar: async (currentPath) => {\n const matches = Object.keys(paths).some((path) =>\n matchPath(path, currentPath),\n );\n\n if (!matches) {\n return [];\n }\n\n const sidebar: SidebarItem[] = categories.map((category) => ({\n type: \"category\" as const,\n label: category.label,\n collapsible: false,\n items: category.tags.map((tag) => ({\n type: \"doc\" as const,\n id: joinUrl(navigationId, getKey(category.label, tag)),\n label: tag,\n badge: {\n label: String(\n items.filter((api) =>\n api.categories.find((c) => c.tags.includes(tag)),\n ).length,\n ),\n color: \"outline\" as const,\n },\n })),\n }));\n\n sidebar.unshift({\n type: \"doc\" as const,\n id: joinUrl(navigationId),\n label: \"Overview\",\n badge: { label: String(items.length), color: \"outline\" as const },\n });\n\n return sidebar;\n },\n getRoutes: () =>\n Object.entries(paths).map(([path, tag]) => ({\n path,\n element: (\n <Catalog\n label={label}\n categoryLabel={tag}\n items={items}\n filterCatalogItems={filterCatalogItems}\n categories={categories}\n />\n ),\n })),\n };\n};\n"],"names":["Catalog","items","filterCatalogItems","label","categoryLabel","auth","useAuthState","match","useMatch","activeCategory","catalogItems","useSuspenseQuery","dataSet","jsxs","jsx","Helmet","Heading","api","t","getKey","Link","joinUrl","Markdown","category","tag","slugify","apiCatalogPlugin","navigationId","categories","paths","currentPath","path","matchPath","sidebar","c"],"mappings":";;;;;;;AAUO,MAAMA,IAAU,CAAC;AAAA,EACtB,OAAAC;AAAA,EACA,oBAAAC,IAAqB,CAACD,MAAUA;AAAAA,EAChC,OAAAE,IAAQ;AAAA,EACR,eAAAC;AACF,MAEM;AACJ,QAAMC,IAAOC,EAAa,GACpBC,IAAQC,EAAS,EAAE,MAAM,sBAAsB,GAC/CC,IAAiBF,KAAA,gBAAAA,EAAO,OAAO,UAE/BG,IAAeC,EAAiB;AAAA,IACpC,SAAS,MAAMT,EAAmBD,GAAO,EAAE,MAAAI,GAAM;AAAA,IACjD,UAAU,CAAC,gBAAgBA,CAAI;AAAA,EAAA,CAChC,GAGKO,IAAUH,IAAiB,EAAE,wBAAwB,UAAU,CAAC;AAGpE,SAAAI,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACT,GAAGD;AAAA,MAEJ,UAAA;AAAA,QAACE,gBAAAA,EAAA,IAAAC,GAAA,EACC,iCAAC,SACE,EAAA,UAAA;AAAA,UAAgBX,IAAA,GAAGA,CAAa,QAAQ;AAAA,UACxCD;AAAA,QAAA,EAAA,CACH,EACF,CAAA;AAAA,QACAU,gBAAAA,EAAAA,KAAC,OAAI,EAAA,WAAU,cACb,UAAA;AAAA,UAACA,gBAAAA,EAAAA,KAAAG,GAAA,EAAQ,OAAO,GACb,UAAA;AAAA,YAAAb;AAAA,YACAC,KAAiB,MAAMA,CAAa;AAAA,UAAA,GACvC;AAAA,UAECU,gBAAAA,EAAA,IAAA,OAAA,EAAI,WAAU,0BACZ,YAAa,KACX;AAAA,YACC,CAACG,MACC,CAACR,KACDQ,EAAI,WAAW;AAAA,cAAK,CAAC,MACnB,EAAE,KAAK,KAAK,CAACC,MAAMC,EAAO,EAAE,OAAOD,CAAC,MAAMT,CAAc;AAAA,YAAA;AAAA,UAC1D,EAEH,IAAI,CAACQ,MACJH,gBAAAA,EAAA;AAAA,YAACM;AAAA,YAAA;AAAA,cACC,IAAIC,EAAQJ,EAAI,IAAI;AAAA,cACpB,WAAU;AAAA,cAGV,UAAAJ,gBAAAA,EAAA,KAAC,OAAI,EAAA,WAAU,kGACb,UAAA;AAAA,gBAAAC,gBAAAA,EAAA,IAAC,QAAK,EAAA,WAAU,iBAAiB,UAAAG,EAAI,OAAM;AAAA,gBAC3CH,gBAAAA,EAAA;AAAA,kBAACQ;AAAA,kBAAA;AAAA,oBACC,WAAU;AAAA,oBACV,SAASL,EAAI;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACf,EACF,CAAA;AAAA,YAAA;AAAA,YARKA,EAAI;AAAA,UAAA,CAUZ,EACL,CAAA;AAAA,QAAA,EACF,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ,GCnEaE,IAAS,CAACI,GAAkBC,MACvCC,EAAQ,GAAGF,CAAQ,IAAIC,CAAG,EAAE,GA+BjBE,IAAmB,CAAC;AAAA,EAC/B,cAAAC;AAAA,EACA,OAAA1B;AAAA,EACA,OAAAE;AAAA,EACA,YAAAyB,IAAa,CAAC;AAAA,EACd,oBAAA1B;AACF,MAMoB;AAClB,QAAM2B,IAAQ,OAAO;AAAA,IACnBD,EAAW;AAAA,MAAQ,CAACL,MAClB,CAAC,QAAW,GAAGA,EAAS,IAAI,EAAE,IAAI,CAACC,MAAQ;AAAA,QACzCH,EAAQM,GAAcH,IAAML,EAAOI,EAAS,OAAOC,CAAG,IAAI,MAAS;AAAA,QACnEA;AAAA,MACD,CAAA;AAAA,IAAA;AAAA,EAEL;AAEO,SAAA;AAAA,IACL,YAAY,OAAOM,MAAgB;AAKjC,UAAI,CAJY,OAAO,KAAKD,CAAK,EAAE;AAAA,QAAK,CAACE,MACvCC,EAAUD,GAAMD,CAAW;AAAA,MAC7B;AAGE,eAAO,CAAC;AAGV,YAAMG,IAAyBL,EAAW,IAAI,CAACL,OAAc;AAAA,QAC3D,MAAM;AAAA,QACN,OAAOA,EAAS;AAAA,QAChB,aAAa;AAAA,QACb,OAAOA,EAAS,KAAK,IAAI,CAACC,OAAS;AAAA,UACjC,MAAM;AAAA,UACN,IAAIH,EAAQM,GAAcR,EAAOI,EAAS,OAAOC,CAAG,CAAC;AAAA,UACrD,OAAOA;AAAA,UACP,OAAO;AAAA,YACL,OAAO;AAAA,cACLvB,EAAM;AAAA,gBAAO,CAACgB,MACZA,EAAI,WAAW,KAAK,CAACiB,MAAMA,EAAE,KAAK,SAASV,CAAG,CAAC;AAAA,cAAA,EAC/C;AAAA,YACJ;AAAA,YACA,OAAO;AAAA,UAAA;AAAA,QACT,EACA;AAAA,MAAA,EACF;AAEF,aAAAS,EAAQ,QAAQ;AAAA,QACd,MAAM;AAAA,QACN,IAAIZ,EAAQM,CAAY;AAAA,QACxB,OAAO;AAAA,QACP,OAAO,EAAE,OAAO,OAAO1B,EAAM,MAAM,GAAG,OAAO,UAAmB;AAAA,MAAA,CACjE,GAEMgC;AAAA,IACT;AAAA,IACA,WAAW,MACT,OAAO,QAAQJ,CAAK,EAAE,IAAI,CAAC,CAACE,GAAMP,CAAG,OAAO;AAAA,MAC1C,MAAAO;AAAA,MACA,SACEjB,gBAAAA,EAAA;AAAA,QAACd;AAAA,QAAA;AAAA,UACC,OAAAG;AAAA,UACA,eAAeqB;AAAA,UACf,OAAAvB;AAAA,UACA,oBAAAC;AAAA,UACA,YAAA0B;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,EAEF;AAAA,EACN;AACF;"}
|
|
@@ -53,7 +53,7 @@ const P = (e) => ({
|
|
|
53
53
|
const u = {
|
|
54
54
|
path: r,
|
|
55
55
|
lazy: async () => {
|
|
56
|
-
const { MdxPage: p } = await import("./MdxPage-
|
|
56
|
+
const { MdxPage: p } = await import("./MdxPage-JscVnWM8.js"), { default: f, ...l } = await i();
|
|
57
57
|
return {
|
|
58
58
|
element: /* @__PURE__ */ d.jsx(
|
|
59
59
|
p,
|
|
@@ -3,7 +3,7 @@ import "lucide-react";
|
|
|
3
3
|
import "./chunk-HA7DTUK3-C4gP41vD.js";
|
|
4
4
|
import "./hook-CqpVYDqN.js";
|
|
5
5
|
import "./ui/Button.js";
|
|
6
|
-
import { U as a, o as e } from "./index-
|
|
6
|
+
import { U as a, o as e } from "./index-DsdAaiwx.js";
|
|
7
7
|
export {
|
|
8
8
|
a as UNTAGGED_PATH,
|
|
9
9
|
e as openApiPlugin
|
|
@@ -1,129 +1,123 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { C as
|
|
3
|
-
import { VisuallyHidden as
|
|
4
|
-
import { u as
|
|
5
|
-
import { useRef as
|
|
6
|
-
import { B as
|
|
7
|
-
import { C as
|
|
8
|
-
import { b as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { j as t } from "./jsx-runtime-CYK1ROHF.js";
|
|
2
|
+
import { C as k } from "./ClientOnly-E7hGysn1.js";
|
|
3
|
+
import { VisuallyHidden as v } from "@radix-ui/react-visually-hidden";
|
|
4
|
+
import { u as N, e as j, m as S, o as _, f as L } from "./hook-CqpVYDqN.js";
|
|
5
|
+
import { useRef as b, useLayoutEffect as T, useState as w } from "react";
|
|
6
|
+
import { B as E } from "./Button-Fp19CMUr.js";
|
|
7
|
+
import { C as R, a as p, b as x, c as F, d as I, e as q, f as P } from "./Callout-B2vsR09t.js";
|
|
8
|
+
import { b as $ } from "./Dialog-sbgekbjb.js";
|
|
9
|
+
import { S as A } from "./RouteGuard-CqZPoZYJ.js";
|
|
10
|
+
import { BracketsIcon as D, FileTextIcon as O } from "lucide-react";
|
|
11
|
+
import { a as B, L as g } from "./chunk-HA7DTUK3-C4gP41vD.js";
|
|
12
|
+
const U = async ({
|
|
13
|
+
search: r,
|
|
14
|
+
options: n,
|
|
15
|
+
auth: s,
|
|
16
|
+
context: o
|
|
16
17
|
}) => {
|
|
17
|
-
const
|
|
18
|
-
search:
|
|
19
|
-
transformFn:
|
|
20
|
-
auth:
|
|
21
|
-
context:
|
|
18
|
+
const c = n.maxResults ?? 10, a = n.transformResults ?? (() => !0), e = [], i = z({
|
|
19
|
+
search: r,
|
|
20
|
+
transformFn: a,
|
|
21
|
+
auth: s,
|
|
22
|
+
context: o
|
|
22
23
|
});
|
|
23
|
-
for await (const
|
|
24
|
-
if (
|
|
25
|
-
return
|
|
24
|
+
for await (const l of i)
|
|
25
|
+
if (e.push(l), e.length >= c) break;
|
|
26
|
+
return e;
|
|
26
27
|
};
|
|
27
|
-
async function*
|
|
28
|
-
search:
|
|
29
|
-
transformFn:
|
|
30
|
-
auth:
|
|
31
|
-
context:
|
|
28
|
+
async function* z({
|
|
29
|
+
search: r,
|
|
30
|
+
transformFn: n,
|
|
31
|
+
auth: s,
|
|
32
|
+
context: o
|
|
32
33
|
}) {
|
|
33
|
-
let
|
|
34
|
-
for (;
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
let a = 0;
|
|
35
|
+
for (; a < r.results.length; ) {
|
|
36
|
+
const e = r.results.slice(
|
|
37
|
+
a,
|
|
38
|
+
a + 5
|
|
38
39
|
);
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
for (const
|
|
42
|
-
const
|
|
43
|
-
|
|
40
|
+
a += e.length;
|
|
41
|
+
const i = await Promise.all(e.map((l) => l.data()));
|
|
42
|
+
for (const l of i) {
|
|
43
|
+
const d = n({ result: l, auth: s, context: o });
|
|
44
|
+
d !== !1 && (d === !0 || d == null ? yield l : yield d);
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
(
|
|
48
|
+
const G = (r, n) => {
|
|
49
|
+
const s = r.weighted_locations.reduce(
|
|
50
|
+
(c, a) => c + a.balanced_score,
|
|
50
51
|
0
|
|
51
52
|
);
|
|
52
|
-
return
|
|
53
|
-
(
|
|
53
|
+
return n.weighted_locations.reduce(
|
|
54
|
+
(c, a) => c + a.balanced_score,
|
|
54
55
|
0
|
|
55
|
-
) -
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
maxSubResults: d = 4
|
|
56
|
+
) - s;
|
|
57
|
+
}, y = "cursor-pointer border border-transparent data-[selected=true]:border-border", H = ({
|
|
58
|
+
searchResults: r,
|
|
59
|
+
searchTerm: n,
|
|
60
|
+
onClose: s,
|
|
61
|
+
maxSubResults: o = 4
|
|
62
62
|
}) => {
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
const c = r.replace(".html", "");
|
|
66
|
-
return t && c.startsWith(t) ? c.slice(t.length) : c;
|
|
67
|
-
},
|
|
68
|
-
[t]
|
|
69
|
-
);
|
|
70
|
-
return w(() => {
|
|
63
|
+
const c = B(), a = b(null);
|
|
64
|
+
return T(() => {
|
|
71
65
|
requestIdleCallback(() => {
|
|
72
|
-
var
|
|
73
|
-
(
|
|
66
|
+
var e;
|
|
67
|
+
(e = a.current) == null || e.scrollTo({ top: 0 });
|
|
74
68
|
});
|
|
75
|
-
}, [
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
}, [n]), /* @__PURE__ */ t.jsxs(R, { className: "max-h-[450px]", ref: a, children: [
|
|
70
|
+
n && r.length > 0 && /* @__PURE__ */ t.jsx(
|
|
71
|
+
p,
|
|
78
72
|
{
|
|
79
73
|
className: "text-sm text-muted-foreground",
|
|
80
|
-
heading: `${
|
|
74
|
+
heading: `${r.length} results for "${n}"`
|
|
81
75
|
}
|
|
82
76
|
),
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
n && r.map((e) => /* @__PURE__ */ t.jsxs(
|
|
78
|
+
p,
|
|
85
79
|
{
|
|
86
80
|
children: [
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
|
|
81
|
+
/* @__PURE__ */ t.jsx(
|
|
82
|
+
x,
|
|
89
83
|
{
|
|
90
84
|
asChild: !0,
|
|
91
|
-
value: `${
|
|
92
|
-
className:
|
|
85
|
+
value: `${e.meta.title}-${e.url}`,
|
|
86
|
+
className: y,
|
|
93
87
|
onSelect: () => {
|
|
94
|
-
|
|
88
|
+
c(e.url), s();
|
|
95
89
|
},
|
|
96
|
-
children: /* @__PURE__ */
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
children: /* @__PURE__ */ t.jsxs(g, { to: e.url, children: [
|
|
91
|
+
e.meta.section === "openapi" ? /* @__PURE__ */ t.jsx(D, {}) : /* @__PURE__ */ t.jsx(O, {}),
|
|
92
|
+
e.meta.title
|
|
99
93
|
] })
|
|
100
94
|
}
|
|
101
95
|
),
|
|
102
|
-
|
|
103
|
-
|
|
96
|
+
e.sub_results.sort(G).slice(0, o).map((i) => /* @__PURE__ */ t.jsx(
|
|
97
|
+
x,
|
|
104
98
|
{
|
|
105
99
|
asChild: !0,
|
|
106
|
-
value: `sub-${
|
|
107
|
-
className:
|
|
100
|
+
value: `sub-${e.meta.title}-${i.url}`,
|
|
101
|
+
className: y,
|
|
108
102
|
onSelect: () => {
|
|
109
|
-
|
|
103
|
+
c(i.url), s();
|
|
110
104
|
},
|
|
111
|
-
children: /* @__PURE__ */
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
-
/* @__PURE__ */
|
|
105
|
+
children: /* @__PURE__ */ t.jsx(g, { to: i.url, onClick: s, children: /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col items-start gap-2 ms-2.5 ps-5 border-l border-muted-foreground/50", children: [
|
|
106
|
+
/* @__PURE__ */ t.jsx("span", { className: "font-bold", children: i.title }),
|
|
107
|
+
/* @__PURE__ */ t.jsx(
|
|
114
108
|
"span",
|
|
115
109
|
{
|
|
116
110
|
className: "text-[13px] [&_mark]:bg-primary [&_mark]:text-primary-foreground",
|
|
117
|
-
dangerouslySetInnerHTML: { __html:
|
|
111
|
+
dangerouslySetInnerHTML: { __html: i.excerpt }
|
|
118
112
|
}
|
|
119
113
|
)
|
|
120
114
|
] }) })
|
|
121
115
|
},
|
|
122
|
-
`sub-${
|
|
116
|
+
`sub-${e.meta.title}-${i.url}`
|
|
123
117
|
))
|
|
124
118
|
]
|
|
125
119
|
},
|
|
126
|
-
[
|
|
120
|
+
[e.meta.title ?? e.excerpt, e.url].join("-")
|
|
127
121
|
))
|
|
128
122
|
] });
|
|
129
123
|
}, u = {
|
|
@@ -135,104 +129,105 @@ const z = (t, o) => {
|
|
|
135
129
|
termSimilarity: 1.2,
|
|
136
130
|
// Slightly lower than default because API docs might have legitimate repetition of terms
|
|
137
131
|
termSaturation: 1.2
|
|
138
|
-
}, K = (
|
|
132
|
+
}, K = (r) => import(
|
|
139
133
|
/* @vite-ignore */
|
|
140
|
-
L(
|
|
141
|
-
),
|
|
142
|
-
const {
|
|
143
|
-
|
|
134
|
+
L(r, "/pagefind/pagefind.js")
|
|
135
|
+
), V = (r) => {
|
|
136
|
+
const {
|
|
137
|
+
options: { basePath: n }
|
|
138
|
+
} = j(), { data: s, ...o } = S({
|
|
139
|
+
queryKey: ["pagefind", r.ranking],
|
|
144
140
|
retry: !1,
|
|
145
141
|
queryFn: async () => {
|
|
146
|
-
var
|
|
147
|
-
const
|
|
148
|
-
return await
|
|
142
|
+
var a, e, i, l;
|
|
143
|
+
const c = await K(n);
|
|
144
|
+
return await c.init(), await c.options({
|
|
149
145
|
ranking: {
|
|
150
|
-
termFrequency: ((
|
|
151
|
-
pageLength: ((
|
|
152
|
-
termSimilarity: ((
|
|
153
|
-
termSaturation: ((l =
|
|
146
|
+
termFrequency: ((a = r.ranking) == null ? void 0 : a.termFrequency) ?? u.termFrequency,
|
|
147
|
+
pageLength: ((e = r.ranking) == null ? void 0 : e.pageLength) ?? u.pageLength,
|
|
148
|
+
termSimilarity: ((i = r.ranking) == null ? void 0 : i.termSimilarity) ?? u.termSimilarity,
|
|
149
|
+
termSaturation: ((l = r.ranking) == null ? void 0 : l.termSaturation) ?? u.termSaturation
|
|
154
150
|
}
|
|
155
|
-
}),
|
|
151
|
+
}), c;
|
|
156
152
|
},
|
|
157
153
|
enabled: typeof window < "u"
|
|
158
154
|
});
|
|
159
|
-
return
|
|
160
|
-
},
|
|
161
|
-
isOpen:
|
|
162
|
-
onClose:
|
|
163
|
-
options:
|
|
155
|
+
return o.isError && o.error.message !== "NOT_BUILT_YET" && console.error(o.error), { ...o, pagefind: s };
|
|
156
|
+
}, Y = ({
|
|
157
|
+
isOpen: r,
|
|
158
|
+
onClose: n,
|
|
159
|
+
options: s
|
|
164
160
|
}) => {
|
|
165
|
-
const { pagefind:
|
|
166
|
-
queryKey: ["pagefind-search",
|
|
161
|
+
const { pagefind: o, error: c, isError: a } = V(s), [e, i] = w(""), l = N(), d = j(), h = b(null), { data: C } = S({
|
|
162
|
+
queryKey: ["pagefind-search", e, l.isAuthenticated],
|
|
167
163
|
queryFn: async () => {
|
|
168
|
-
const m = await (
|
|
169
|
-
return
|
|
164
|
+
const m = l.isAuthenticated ? void 0 : { not: { section: A } }, f = await (o == null ? void 0 : o.search(e, { filters: m }));
|
|
165
|
+
return f ? U({ search: f, options: s, auth: l, context: d }) : [];
|
|
170
166
|
},
|
|
171
|
-
placeholderData:
|
|
172
|
-
enabled: !!
|
|
167
|
+
placeholderData: _,
|
|
168
|
+
enabled: !!o && !!e
|
|
173
169
|
});
|
|
174
|
-
return /* @__PURE__ */
|
|
175
|
-
|
|
170
|
+
return /* @__PURE__ */ t.jsxs(
|
|
171
|
+
F,
|
|
176
172
|
{
|
|
177
173
|
command: { shouldFilter: !1 },
|
|
178
174
|
content: { className: "max-w-[750px]" },
|
|
179
|
-
open:
|
|
180
|
-
onOpenChange:
|
|
175
|
+
open: r,
|
|
176
|
+
onOpenChange: n,
|
|
181
177
|
children: [
|
|
182
|
-
/* @__PURE__ */
|
|
183
|
-
/* @__PURE__ */
|
|
178
|
+
/* @__PURE__ */ t.jsx(v, { children: /* @__PURE__ */ t.jsx($, { children: "Search" }) }),
|
|
179
|
+
/* @__PURE__ */ t.jsx(
|
|
184
180
|
I,
|
|
185
181
|
{
|
|
186
182
|
ref: h,
|
|
187
183
|
placeholder: "Search...",
|
|
188
|
-
value:
|
|
189
|
-
onValueChange:
|
|
190
|
-
disabled:
|
|
184
|
+
value: e,
|
|
185
|
+
onValueChange: i,
|
|
186
|
+
disabled: a
|
|
191
187
|
}
|
|
192
188
|
),
|
|
193
|
-
/* @__PURE__ */
|
|
189
|
+
/* @__PURE__ */ t.jsx(q, { children: e ? /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col items-center", children: [
|
|
194
190
|
"No results found.",
|
|
195
|
-
/* @__PURE__ */
|
|
196
|
-
|
|
191
|
+
/* @__PURE__ */ t.jsx(
|
|
192
|
+
E,
|
|
197
193
|
{
|
|
198
194
|
variant: "link",
|
|
199
195
|
onClick: () => {
|
|
200
196
|
var m;
|
|
201
|
-
|
|
197
|
+
i(""), (m = h.current) == null || m.focus();
|
|
202
198
|
},
|
|
203
199
|
children: "Clear search"
|
|
204
200
|
}
|
|
205
201
|
)
|
|
206
202
|
] }) : "Start typing to search" }),
|
|
207
|
-
|
|
203
|
+
a ? /* @__PURE__ */ t.jsx("div", { className: "p-4 text-sm", children: c.message === "NOT_BUILT_YET" ? /* @__PURE__ */ t.jsxs(P, { type: "info", children: [
|
|
208
204
|
"Search is currently not available in development mode by default.",
|
|
209
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ t.jsx("br", {}),
|
|
210
206
|
"To still use search in development, run ",
|
|
211
|
-
/* @__PURE__ */
|
|
207
|
+
/* @__PURE__ */ t.jsx("code", { children: "zudoku build" }),
|
|
212
208
|
" ",
|
|
213
209
|
"and copy the ",
|
|
214
|
-
/* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */ t.jsx("code", { children: "dist/pagefind" }),
|
|
215
211
|
" directory to your",
|
|
216
212
|
" ",
|
|
217
|
-
/* @__PURE__ */
|
|
213
|
+
/* @__PURE__ */ t.jsx("code", { children: "public" }),
|
|
218
214
|
" directory."
|
|
219
|
-
] }) : "An error occurred while loading search." }) : /* @__PURE__ */
|
|
220
|
-
|
|
215
|
+
] }) : "An error occurred while loading search." }) : /* @__PURE__ */ t.jsx(
|
|
216
|
+
H,
|
|
221
217
|
{
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
maxSubResults: a.maxSubResults
|
|
218
|
+
searchResults: C ?? [],
|
|
219
|
+
searchTerm: e,
|
|
220
|
+
onClose: n,
|
|
221
|
+
maxSubResults: s.maxSubResults
|
|
227
222
|
}
|
|
228
223
|
)
|
|
229
224
|
]
|
|
230
225
|
}
|
|
231
226
|
);
|
|
232
|
-
},
|
|
233
|
-
renderSearch: ({ isOpen:
|
|
227
|
+
}, se = (r) => ({
|
|
228
|
+
renderSearch: ({ isOpen: n, onClose: s }) => /* @__PURE__ */ t.jsx(k, { children: /* @__PURE__ */ t.jsx(Y, { isOpen: n, onClose: s, options: r }) })
|
|
234
229
|
});
|
|
235
230
|
export {
|
|
236
|
-
|
|
231
|
+
se as pagefindSearchPlugin
|
|
237
232
|
};
|
|
238
233
|
//# sourceMappingURL=zudoku.plugin-search-pagefind.js.map
|