zudoku 0.80.0 → 0.81.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/cli/cli.js +53 -10
- package/dist/declarations/config/validators/ZudokuConfig.d.ts +28 -0
- package/dist/declarations/lib/components/context/ZudokuContext.d.ts +1 -1
- package/dist/declarations/lib/components/navigation/SidebarToggle.d.ts +1 -0
- package/dist/declarations/lib/components/navigation/sidebarStore.d.ts +6 -0
- package/dist/declarations/lib/core/ZudokuContext.d.ts +5 -0
- package/dist/declarations/lib/hooks/index.d.ts +1 -0
- package/dist/declarations/lib/plugins/markdown/index.d.ts +2 -1
- package/dist/declarations/lib/plugins/search-inkeep/index.d.ts +8 -2
- package/dist/declarations/vite/index.d.ts +1 -0
- package/dist/flat-config.d.ts +10 -0
- package/dist/vite/index.js +87 -0
- package/docs/components/callout.mdx +11 -18
- package/docs/configuration/search.md +36 -0
- package/docs/configuration/site.md +38 -0
- package/docs/customization/colors-theme.mdx +51 -40
- package/package.json +7 -6
- package/src/app/main.css +4 -1
- package/src/config/validators/ZudokuConfig.ts +24 -0
- package/src/lib/components/Layout.tsx +6 -1
- package/src/lib/components/Main.tsx +4 -0
- package/src/lib/components/NotFoundPage.tsx +1 -1
- package/src/lib/components/navigation/NavigationCategory.tsx +4 -2
- package/src/lib/components/navigation/NavigationItem.tsx +4 -4
- package/src/lib/components/navigation/NavigationWrapper.tsx +9 -2
- package/src/lib/components/navigation/SidebarToggle.tsx +68 -0
- package/src/lib/components/navigation/sidebarStore.ts +8 -0
- package/src/lib/core/ZudokuContext.ts +5 -0
- package/src/lib/hooks/index.ts +1 -0
- package/src/lib/plugins/markdown/MdxPage.tsx +8 -1
- package/src/lib/plugins/markdown/index.tsx +2 -0
- package/src/lib/plugins/openapi/SchemaInfo.tsx +7 -1
- package/src/lib/plugins/search-inkeep/index.tsx +45 -14
- package/src/vite/index.ts +1 -0
- package/src/vite/mdx/remark-link-rewrite.ts +39 -2
- package/src/vite/plugin-markdown-export.ts +19 -14
- package/src/vite/plugin-mdx.ts +18 -1
package/dist/cli/cli.js
CHANGED
|
@@ -3023,6 +3023,7 @@ var init_ZudokuConfig = __esm({
|
|
|
3023
3023
|
showVersionSelect: z7.enum(["always", "if-available", "hide"]),
|
|
3024
3024
|
expandAllTags: z7.boolean(),
|
|
3025
3025
|
showInfoPage: z7.boolean(),
|
|
3026
|
+
disableSecurity: z7.boolean(),
|
|
3026
3027
|
schemaDownload: z7.object({
|
|
3027
3028
|
enabled: z7.boolean(),
|
|
3028
3029
|
fileName: z7.string().regex(/^[A-Za-z0-9_-]+$/).optional()
|
|
@@ -3184,6 +3185,7 @@ var init_ZudokuConfig = __esm({
|
|
|
3184
3185
|
disablePager: z7.boolean(),
|
|
3185
3186
|
showLastModified: z7.boolean(),
|
|
3186
3187
|
fullWidth: z7.boolean().optional(),
|
|
3188
|
+
centered: z7.boolean().optional(),
|
|
3187
3189
|
suggestEdit: z7.object({
|
|
3188
3190
|
url: z7.string(),
|
|
3189
3191
|
text: z7.string().optional()
|
|
@@ -3204,7 +3206,10 @@ var init_ZudokuConfig = __esm({
|
|
|
3204
3206
|
integrationId: z7.string(),
|
|
3205
3207
|
organizationId: z7.string(),
|
|
3206
3208
|
primaryBrandColor: z7.string(),
|
|
3207
|
-
organizationDisplayName: z7.string()
|
|
3209
|
+
organizationDisplayName: z7.string(),
|
|
3210
|
+
searchSettings: z7.custom().optional(),
|
|
3211
|
+
aiChatSettings: z7.custom().optional(),
|
|
3212
|
+
modalSettings: z7.custom().optional()
|
|
3208
3213
|
}),
|
|
3209
3214
|
z7.object({
|
|
3210
3215
|
type: z7.literal("pagefind"),
|
|
@@ -3389,6 +3394,11 @@ var init_ZudokuConfig = __esm({
|
|
|
3389
3394
|
);
|
|
3390
3395
|
ThemeConfigSchema = z7.object({
|
|
3391
3396
|
registryUrl: z7.string().url().optional(),
|
|
3397
|
+
/**
|
|
3398
|
+
* @deprecated Import a `.css` file from your `zudoku.config.ts` instead.
|
|
3399
|
+
* Inline CSS via this option still works but requires a dev server restart
|
|
3400
|
+
* on every change and provides no editor tooling.
|
|
3401
|
+
*/
|
|
3392
3402
|
customCss: z7.union([z7.string(), CssObject]).optional(),
|
|
3393
3403
|
light: ThemeSchema.optional(),
|
|
3394
3404
|
dark: ThemeSchema.optional(),
|
|
@@ -3401,6 +3411,11 @@ var init_ZudokuConfig = __esm({
|
|
|
3401
3411
|
dir: z7.enum(["ltr", "rtl"]).optional(),
|
|
3402
3412
|
logo: LogoSchema,
|
|
3403
3413
|
showPoweredBy: z7.boolean().optional(),
|
|
3414
|
+
sidebar: z7.object({
|
|
3415
|
+
collapsible: z7.boolean().optional(),
|
|
3416
|
+
toggleVisibility: z7.enum(["always", "hover"]).optional(),
|
|
3417
|
+
togglePosition: z7.enum(["top", "center", "bottom"]).optional()
|
|
3418
|
+
}).optional(),
|
|
3404
3419
|
notFoundPage: z7.custom(),
|
|
3405
3420
|
banner: z7.object({
|
|
3406
3421
|
message: z7.custom(),
|
|
@@ -6670,6 +6685,7 @@ var plugin_docs_default = viteDocsPlugin;
|
|
|
6670
6685
|
// src/vite/plugin-markdown-export.ts
|
|
6671
6686
|
init_loader();
|
|
6672
6687
|
init_ProtectedRoutesSchema();
|
|
6688
|
+
init_ZudokuConfig();
|
|
6673
6689
|
init_joinUrl();
|
|
6674
6690
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
6675
6691
|
import path13 from "node:path";
|
|
@@ -6711,8 +6727,9 @@ var viteMarkdownExportPlugin = () => {
|
|
|
6711
6727
|
},
|
|
6712
6728
|
async buildStart() {
|
|
6713
6729
|
const config = getCurrentConfig();
|
|
6714
|
-
const
|
|
6715
|
-
const
|
|
6730
|
+
const docsConfig = DocsConfigSchema.parse(config.docs ?? {});
|
|
6731
|
+
const llmsConfig = docsConfig.llms ?? {};
|
|
6732
|
+
const needsMdFiles = docsConfig.publishMarkdown || llmsConfig.llmsTxt || llmsConfig.llmsTxtFull;
|
|
6716
6733
|
if (config.__meta.mode === "standalone" || !needsMdFiles) {
|
|
6717
6734
|
return;
|
|
6718
6735
|
}
|
|
@@ -6736,8 +6753,9 @@ var viteMarkdownExportPlugin = () => {
|
|
|
6736
6753
|
},
|
|
6737
6754
|
async configureServer(server) {
|
|
6738
6755
|
const config = getCurrentConfig();
|
|
6739
|
-
const
|
|
6740
|
-
const
|
|
6756
|
+
const docsConfig = DocsConfigSchema.parse(config.docs ?? {});
|
|
6757
|
+
const llmsConfig = docsConfig.llms ?? {};
|
|
6758
|
+
const needsMdFiles = docsConfig.publishMarkdown || llmsConfig.llmsTxt || llmsConfig.llmsTxtFull;
|
|
6741
6759
|
if (!needsMdFiles) return;
|
|
6742
6760
|
markdownFiles = await resolveCustomNavigationPaths(
|
|
6743
6761
|
config,
|
|
@@ -6763,8 +6781,9 @@ var viteMarkdownExportPlugin = () => {
|
|
|
6763
6781
|
},
|
|
6764
6782
|
async closeBundle() {
|
|
6765
6783
|
const config = getCurrentConfig();
|
|
6766
|
-
const
|
|
6767
|
-
const
|
|
6784
|
+
const docsConfig = DocsConfigSchema.parse(config.docs ?? {});
|
|
6785
|
+
const llmsConfig = docsConfig.llms ?? {};
|
|
6786
|
+
const needsMdFiles = docsConfig.publishMarkdown || llmsConfig.llmsTxt || llmsConfig.llmsTxtFull;
|
|
6768
6787
|
if (process.env.NODE_ENV !== "production" || Object.keys(markdownFiles).length === 0 || !needsMdFiles) {
|
|
6769
6788
|
return;
|
|
6770
6789
|
}
|
|
@@ -6795,7 +6814,7 @@ var viteMarkdownExportPlugin = () => {
|
|
|
6795
6814
|
console.warn(`Failed to export markdown for ${routePath}:`, error);
|
|
6796
6815
|
}
|
|
6797
6816
|
}
|
|
6798
|
-
if (
|
|
6817
|
+
if (llmsConfig.llmsTxt || llmsConfig.llmsTxtFull) {
|
|
6799
6818
|
const markdownInfoPath = path13.join(
|
|
6800
6819
|
config.__meta.rootDir,
|
|
6801
6820
|
"node_modules/.zudoku/markdown-info.json"
|
|
@@ -7039,11 +7058,27 @@ var remarkLastModified = () => {
|
|
|
7039
7058
|
// src/vite/mdx/remark-link-rewrite.ts
|
|
7040
7059
|
import path15 from "node:path";
|
|
7041
7060
|
import { visit as visit5 } from "unist-util-visit";
|
|
7042
|
-
var
|
|
7061
|
+
var markdownExtension = /\.mdx?$/;
|
|
7062
|
+
var resolveToRoute = (url, filePath, routesByFile) => {
|
|
7063
|
+
const [, pathname = "", suffix = ""] = url.match(/^([^#?]*)(.*)$/) ?? [];
|
|
7064
|
+
if (!markdownExtension.test(pathname) || pathname.startsWith("/")) {
|
|
7065
|
+
return void 0;
|
|
7066
|
+
}
|
|
7067
|
+
const targetFile = path15.resolve(path15.dirname(filePath), pathname).replace(markdownExtension, "");
|
|
7068
|
+
const route = routesByFile.get(targetFile);
|
|
7069
|
+
if (route === void 0) return void 0;
|
|
7070
|
+
return `${route}${suffix}`;
|
|
7071
|
+
};
|
|
7072
|
+
var remarkLinkRewrite = (basePath = "", routesByFile = /* @__PURE__ */ new Map()) => (tree, vfile) => {
|
|
7043
7073
|
visit5(tree, "link", (node) => {
|
|
7044
7074
|
if (!node.url) return;
|
|
7045
7075
|
if (node.url.startsWith("http") || node.url.startsWith("mailto:")) return;
|
|
7046
7076
|
node.url = node.url.replace(/\\/g, "/");
|
|
7077
|
+
const resolved = resolveToRoute(node.url, vfile.path, routesByFile);
|
|
7078
|
+
if (resolved !== void 0) {
|
|
7079
|
+
node.url = resolved;
|
|
7080
|
+
return;
|
|
7081
|
+
}
|
|
7047
7082
|
const base = path15.posix.join(basePath);
|
|
7048
7083
|
if (basePath && node.url.startsWith(base)) {
|
|
7049
7084
|
node.url = node.url.slice(base.length);
|
|
@@ -7218,6 +7253,14 @@ var viteMdxPlugin = async () => {
|
|
|
7218
7253
|
const config = getCurrentConfig();
|
|
7219
7254
|
const buildConfig = await getBuildConfig();
|
|
7220
7255
|
const highlighter = await highlighterPromise;
|
|
7256
|
+
const routesByFile = /* @__PURE__ */ new Map();
|
|
7257
|
+
const fileMapping = await resolveCustomNavigationPaths(
|
|
7258
|
+
config,
|
|
7259
|
+
await globMarkdownFiles(config, { absolute: true })
|
|
7260
|
+
);
|
|
7261
|
+
for (const [route, filePath] of Object.entries(fileMapping)) {
|
|
7262
|
+
routesByFile.set(filePath.replace(/\.mdx?$/, ""), route);
|
|
7263
|
+
}
|
|
7221
7264
|
const defaultRemarkPlugins = [
|
|
7222
7265
|
remarkStaticGeneration,
|
|
7223
7266
|
[remarkInjectFilepath, config.__meta.rootDir],
|
|
@@ -7232,7 +7275,7 @@ var viteMdxPlugin = async () => {
|
|
|
7232
7275
|
remarkDirective,
|
|
7233
7276
|
remarkDirectiveRehype,
|
|
7234
7277
|
remarkCodeTabs,
|
|
7235
|
-
[remarkLinkRewrite, config.basePath],
|
|
7278
|
+
[remarkLinkRewrite, config.basePath, routesByFile],
|
|
7236
7279
|
[remarkNormalizeImageUrl, config.basePath],
|
|
7237
7280
|
...config.build?.remarkPlugins ?? []
|
|
7238
7281
|
];
|
|
@@ -57,6 +57,7 @@ declare const ApiOptionsSchema: z.ZodObject<{
|
|
|
57
57
|
}>>;
|
|
58
58
|
expandAllTags: z.ZodOptional<z.ZodBoolean>;
|
|
59
59
|
showInfoPage: z.ZodOptional<z.ZodBoolean>;
|
|
60
|
+
disableSecurity: z.ZodOptional<z.ZodBoolean>;
|
|
60
61
|
schemaDownload: z.ZodOptional<z.ZodObject<{
|
|
61
62
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
62
63
|
fileName: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
@@ -92,6 +93,7 @@ declare const ApiSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
92
93
|
}>>;
|
|
93
94
|
expandAllTags: z.ZodOptional<z.ZodBoolean>;
|
|
94
95
|
showInfoPage: z.ZodOptional<z.ZodBoolean>;
|
|
96
|
+
disableSecurity: z.ZodOptional<z.ZodBoolean>;
|
|
95
97
|
schemaDownload: z.ZodOptional<z.ZodObject<{
|
|
96
98
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
97
99
|
fileName: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
@@ -127,6 +129,7 @@ declare const ApiSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
127
129
|
}>>;
|
|
128
130
|
expandAllTags: z.ZodOptional<z.ZodBoolean>;
|
|
129
131
|
showInfoPage: z.ZodOptional<z.ZodBoolean>;
|
|
132
|
+
disableSecurity: z.ZodOptional<z.ZodBoolean>;
|
|
130
133
|
schemaDownload: z.ZodOptional<z.ZodObject<{
|
|
131
134
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
132
135
|
fileName: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
@@ -162,6 +165,7 @@ declare const ApiSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
162
165
|
}>>;
|
|
163
166
|
expandAllTags: z.ZodOptional<z.ZodBoolean>;
|
|
164
167
|
showInfoPage: z.ZodOptional<z.ZodBoolean>;
|
|
168
|
+
disableSecurity: z.ZodOptional<z.ZodBoolean>;
|
|
165
169
|
schemaDownload: z.ZodOptional<z.ZodObject<{
|
|
166
170
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
167
171
|
fileName: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
@@ -302,6 +306,7 @@ export declare const DocsConfigSchema: z.ZodObject<{
|
|
|
302
306
|
disablePager: z.ZodOptional<z.ZodBoolean>;
|
|
303
307
|
showLastModified: z.ZodOptional<z.ZodBoolean>;
|
|
304
308
|
fullWidth: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
309
|
+
centered: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
305
310
|
suggestEdit: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
306
311
|
url: z.ZodString;
|
|
307
312
|
text: z.ZodOptional<z.ZodString>;
|
|
@@ -524,6 +529,18 @@ export declare const ZudokuConfig: z.ZodObject<{
|
|
|
524
529
|
reloadDocument: z.ZodOptional<z.ZodBoolean>;
|
|
525
530
|
}, z.core.$strip>>;
|
|
526
531
|
showPoweredBy: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
532
|
+
sidebar: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
533
|
+
collapsible: z.ZodOptional<z.ZodBoolean>;
|
|
534
|
+
toggleVisibility: z.ZodOptional<z.ZodEnum<{
|
|
535
|
+
always: "always";
|
|
536
|
+
hover: "hover";
|
|
537
|
+
}>>;
|
|
538
|
+
togglePosition: z.ZodOptional<z.ZodEnum<{
|
|
539
|
+
center: "center";
|
|
540
|
+
top: "top";
|
|
541
|
+
bottom: "bottom";
|
|
542
|
+
}>>;
|
|
543
|
+
}, z.core.$strip>>>;
|
|
527
544
|
notFoundPage: z.ZodOptional<z.ZodCustom<NonNullable<ReactNode>, NonNullable<ReactNode>>>;
|
|
528
545
|
banner: z.ZodOptional<z.ZodObject<{
|
|
529
546
|
message: z.ZodCustom<NonNullable<ReactNode>, NonNullable<ReactNode>>;
|
|
@@ -6861,6 +6878,9 @@ export declare const ZudokuConfig: z.ZodObject<{
|
|
|
6861
6878
|
organizationId: z.ZodString;
|
|
6862
6879
|
primaryBrandColor: z.ZodString;
|
|
6863
6880
|
organizationDisplayName: z.ZodString;
|
|
6881
|
+
searchSettings: z.ZodOptional<z.ZodCustom<import("@inkeep/cxkit-types").InkeepSearchSettings & Record<string, unknown>, import("@inkeep/cxkit-types").InkeepSearchSettings & Record<string, unknown>>>;
|
|
6882
|
+
aiChatSettings: z.ZodOptional<z.ZodCustom<import("@inkeep/cxkit-types").InkeepAIChatSettings & Record<string, unknown>, import("@inkeep/cxkit-types").InkeepAIChatSettings & Record<string, unknown>>>;
|
|
6883
|
+
modalSettings: z.ZodOptional<z.ZodCustom<import("@inkeep/cxkit-types").InkeepModalSettings & Record<string, unknown>, import("@inkeep/cxkit-types").InkeepModalSettings & Record<string, unknown>>>;
|
|
6864
6884
|
}, z.core.$loose>, z.ZodObject<{
|
|
6865
6885
|
type: z.ZodLiteral<"pagefind">;
|
|
6866
6886
|
ranking: z.ZodOptional<z.ZodObject<{
|
|
@@ -6890,6 +6910,7 @@ export declare const ZudokuConfig: z.ZodObject<{
|
|
|
6890
6910
|
disablePager: z.ZodOptional<z.ZodBoolean>;
|
|
6891
6911
|
showLastModified: z.ZodOptional<z.ZodBoolean>;
|
|
6892
6912
|
fullWidth: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
6913
|
+
centered: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
6893
6914
|
suggestEdit: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
6894
6915
|
url: z.ZodString;
|
|
6895
6916
|
text: z.ZodOptional<z.ZodString>;
|
|
@@ -6923,6 +6944,7 @@ export declare const ZudokuConfig: z.ZodObject<{
|
|
|
6923
6944
|
}>>;
|
|
6924
6945
|
expandAllTags: z.ZodOptional<z.ZodBoolean>;
|
|
6925
6946
|
showInfoPage: z.ZodOptional<z.ZodBoolean>;
|
|
6947
|
+
disableSecurity: z.ZodOptional<z.ZodBoolean>;
|
|
6926
6948
|
schemaDownload: z.ZodOptional<z.ZodObject<{
|
|
6927
6949
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
6928
6950
|
fileName: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
@@ -6958,6 +6980,7 @@ export declare const ZudokuConfig: z.ZodObject<{
|
|
|
6958
6980
|
}>>;
|
|
6959
6981
|
expandAllTags: z.ZodOptional<z.ZodBoolean>;
|
|
6960
6982
|
showInfoPage: z.ZodOptional<z.ZodBoolean>;
|
|
6983
|
+
disableSecurity: z.ZodOptional<z.ZodBoolean>;
|
|
6961
6984
|
schemaDownload: z.ZodOptional<z.ZodObject<{
|
|
6962
6985
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
6963
6986
|
fileName: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
@@ -6993,6 +7016,7 @@ export declare const ZudokuConfig: z.ZodObject<{
|
|
|
6993
7016
|
}>>;
|
|
6994
7017
|
expandAllTags: z.ZodOptional<z.ZodBoolean>;
|
|
6995
7018
|
showInfoPage: z.ZodOptional<z.ZodBoolean>;
|
|
7019
|
+
disableSecurity: z.ZodOptional<z.ZodBoolean>;
|
|
6996
7020
|
schemaDownload: z.ZodOptional<z.ZodObject<{
|
|
6997
7021
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
6998
7022
|
fileName: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
@@ -7024,6 +7048,7 @@ export declare const ZudokuConfig: z.ZodObject<{
|
|
|
7024
7048
|
}>>;
|
|
7025
7049
|
expandAllTags: z.ZodOptional<z.ZodBoolean>;
|
|
7026
7050
|
showInfoPage: z.ZodOptional<z.ZodBoolean>;
|
|
7051
|
+
disableSecurity: z.ZodOptional<z.ZodBoolean>;
|
|
7027
7052
|
schemaDownload: z.ZodOptional<z.ZodObject<{
|
|
7028
7053
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
7029
7054
|
fileName: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
@@ -7059,6 +7084,7 @@ export declare const ZudokuConfig: z.ZodObject<{
|
|
|
7059
7084
|
}>>;
|
|
7060
7085
|
expandAllTags: z.ZodOptional<z.ZodBoolean>;
|
|
7061
7086
|
showInfoPage: z.ZodOptional<z.ZodBoolean>;
|
|
7087
|
+
disableSecurity: z.ZodOptional<z.ZodBoolean>;
|
|
7062
7088
|
schemaDownload: z.ZodOptional<z.ZodObject<{
|
|
7063
7089
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
7064
7090
|
fileName: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
@@ -7094,6 +7120,7 @@ export declare const ZudokuConfig: z.ZodObject<{
|
|
|
7094
7120
|
}>>;
|
|
7095
7121
|
expandAllTags: z.ZodOptional<z.ZodBoolean>;
|
|
7096
7122
|
showInfoPage: z.ZodOptional<z.ZodBoolean>;
|
|
7123
|
+
disableSecurity: z.ZodOptional<z.ZodBoolean>;
|
|
7097
7124
|
schemaDownload: z.ZodOptional<z.ZodObject<{
|
|
7098
7125
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
7099
7126
|
fileName: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
@@ -7194,6 +7221,7 @@ export declare const ZudokuConfig: z.ZodObject<{
|
|
|
7194
7221
|
}>>;
|
|
7195
7222
|
expandAllTags: z.ZodOptional<z.ZodBoolean>;
|
|
7196
7223
|
showInfoPage: z.ZodOptional<z.ZodBoolean>;
|
|
7224
|
+
disableSecurity: z.ZodOptional<z.ZodBoolean>;
|
|
7197
7225
|
schemaDownload: z.ZodOptional<z.ZodObject<{
|
|
7198
7226
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
7199
7227
|
fileName: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NavigationItem } from "../../../config/validators/NavigationSchema.js";
|
|
2
2
|
export declare const useZudoku: () => import("../../core/ZudokuContext.js").ZudokuContext;
|
|
3
|
-
export declare const useApiIdentities: () => import("@tanstack/react-query").UseQueryResult<import("../../core/ZudokuContext.js").ApiIdentity[]
|
|
3
|
+
export declare const useApiIdentities: () => import("@tanstack/react-query").UseQueryResult<NoInfer<import("../../core/ZudokuContext.js").ApiIdentity[]>, Error>;
|
|
4
4
|
export declare const useCurrentNavigation: () => {
|
|
5
5
|
navigation: NavigationItem[];
|
|
6
6
|
topNavItem: import("../../../config/validators/NavigationSchema.js").NavigationDoc | import("../../../config/validators/NavigationSchema.js").NavigationLink | import("../../../config/validators/NavigationSchema.js").NavigationCategory | import("../../../config/validators/NavigationSchema.js").NavigationCustomPage | import("../../../config/validators/NavigationSchema.js").NavigationSeparator | {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SidebarToggle: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -51,6 +51,11 @@ type Metadata = Partial<{
|
|
|
51
51
|
type Site = Partial<{
|
|
52
52
|
dir?: "ltr" | "rtl";
|
|
53
53
|
showPoweredBy?: boolean;
|
|
54
|
+
sidebar?: {
|
|
55
|
+
collapsible?: boolean;
|
|
56
|
+
toggleVisibility?: "always" | "hover";
|
|
57
|
+
togglePosition?: "top" | "center" | "bottom";
|
|
58
|
+
};
|
|
54
59
|
title?: string;
|
|
55
60
|
logo?: {
|
|
56
61
|
src: {
|
|
@@ -5,4 +5,5 @@ export { CACHE_KEYS, useCache } from "../components/cache.js";
|
|
|
5
5
|
export { useZudoku } from "../components/context/ZudokuContext.js";
|
|
6
6
|
export { useExposedProps } from "../util/useExposedProps.js";
|
|
7
7
|
export { useEvent } from "./useEvent.js";
|
|
8
|
+
export { useSidebar } from "../components/navigation/sidebarStore.js";
|
|
8
9
|
export { useCopyToClipboard } from "../util/useCopyToClipboard.js";
|
|
@@ -7,7 +7,7 @@ export interface MarkdownPluginOptions extends ZudokuDocsConfig {
|
|
|
7
7
|
basePath: string;
|
|
8
8
|
fileImports: Record<string, () => Promise<MDXImport>>;
|
|
9
9
|
}
|
|
10
|
-
export type MarkdownPluginDefaultOptions = Pick<Frontmatter, "toc" | "disablePager" | "showLastModified" | "suggestEdit" | "copyPage" | "fullWidth">;
|
|
10
|
+
export type MarkdownPluginDefaultOptions = Pick<Frontmatter, "toc" | "disablePager" | "showLastModified" | "suggestEdit" | "copyPage" | "fullWidth" | "centered">;
|
|
11
11
|
export type Frontmatter = {
|
|
12
12
|
title?: string;
|
|
13
13
|
description?: string;
|
|
@@ -24,6 +24,7 @@ export type Frontmatter = {
|
|
|
24
24
|
} | false;
|
|
25
25
|
copyPage?: boolean;
|
|
26
26
|
fullWidth?: boolean;
|
|
27
|
+
centered?: boolean;
|
|
27
28
|
};
|
|
28
29
|
export type MDXImport = {
|
|
29
30
|
tableOfContents: Toc;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import type { InkeepBaseSettings, InkeepJS } from "@inkeep/cxkit-types";
|
|
1
|
+
import type { InkeepAIChatSettings, InkeepBaseSettings, InkeepJS, InkeepModalSettings, InkeepSearchSettings } from "@inkeep/cxkit-types";
|
|
2
2
|
import type { ZudokuPlugin } from "../../core/plugins.js";
|
|
3
3
|
declare global {
|
|
4
4
|
interface Window {
|
|
5
5
|
Inkeep: InkeepJS | undefined;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
export
|
|
8
|
+
export type InkeepSearchPluginOptions = InkeepBaseSettings & Record<string, unknown> & {
|
|
9
|
+
type?: "inkeep";
|
|
10
|
+
searchSettings?: InkeepSearchSettings & Record<string, unknown>;
|
|
11
|
+
aiChatSettings?: InkeepAIChatSettings & Record<string, unknown>;
|
|
12
|
+
modalSettings?: InkeepModalSettings & Record<string, unknown>;
|
|
13
|
+
};
|
|
14
|
+
export declare const inkeepSearchPlugin: (settings: InkeepSearchPluginOptions) => ZudokuPlugin;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getCurrentConfig } from "../config/loader.js";
|
|
2
2
|
export type { ConfigEnv, Plugin, PluginOption, UserConfig } from "vite";
|
|
3
3
|
export { defineConfig, mergeConfig } from "vite";
|
|
4
|
+
export { joinUrl } from "../lib/util/joinUrl.js";
|
|
4
5
|
export { getCurrentConfig as getZudokuConfig };
|
|
5
6
|
export declare const getPluginConfigs: <V>(name: string) => V[];
|
package/dist/flat-config.d.ts
CHANGED
|
@@ -136,6 +136,11 @@ export interface FlatZudokuConfig {
|
|
|
136
136
|
dir?: ("ltr" | "rtl")
|
|
137
137
|
logo?: _Schema0
|
|
138
138
|
showPoweredBy?: boolean
|
|
139
|
+
sidebar?: {
|
|
140
|
+
collapsible?: boolean
|
|
141
|
+
toggleVisibility?: ("always" | "hover")
|
|
142
|
+
togglePosition?: ("top" | "center" | "bottom")
|
|
143
|
+
}
|
|
139
144
|
notFoundPage?: unknown
|
|
140
145
|
banner?: {
|
|
141
146
|
message: unknown
|
|
@@ -351,6 +356,9 @@ export interface FlatZudokuConfig {
|
|
|
351
356
|
organizationId: string
|
|
352
357
|
primaryBrandColor: string
|
|
353
358
|
organizationDisplayName: string
|
|
359
|
+
searchSettings?: unknown
|
|
360
|
+
aiChatSettings?: unknown
|
|
361
|
+
modalSettings?: unknown
|
|
354
362
|
[k: string]: unknown
|
|
355
363
|
} | {
|
|
356
364
|
type: "pagefind"
|
|
@@ -376,6 +384,7 @@ export interface FlatZudokuConfig {
|
|
|
376
384
|
disablePager?: boolean
|
|
377
385
|
showLastModified?: boolean
|
|
378
386
|
fullWidth?: boolean
|
|
387
|
+
centered?: boolean
|
|
379
388
|
suggestEdit?: {
|
|
380
389
|
url: string
|
|
381
390
|
text?: string
|
|
@@ -494,6 +503,7 @@ export interface _Schema22 {
|
|
|
494
503
|
showVersionSelect?: ("always" | "if-available" | "hide")
|
|
495
504
|
expandAllTags?: boolean
|
|
496
505
|
showInfoPage?: boolean
|
|
506
|
+
disableSecurity?: boolean
|
|
497
507
|
schemaDownload?: {
|
|
498
508
|
enabled?: boolean
|
|
499
509
|
fileName?: string
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// src/config/loader.ts
|
|
2
|
+
import colors from "picocolors";
|
|
3
|
+
import {
|
|
4
|
+
runnerImport,
|
|
5
|
+
loadEnv as viteLoadEnv
|
|
6
|
+
} from "vite";
|
|
7
|
+
|
|
8
|
+
// src/lib/util/invariant.ts
|
|
9
|
+
function invariant(condition, message, options) {
|
|
10
|
+
if (condition) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const provided = typeof message === "function" ? message() : message;
|
|
14
|
+
throw new ZudokuError(provided ?? "Invariant failed", options);
|
|
15
|
+
}
|
|
16
|
+
var ZudokuError = class extends Error {
|
|
17
|
+
developerHint;
|
|
18
|
+
title;
|
|
19
|
+
constructor(message, { developerHint, title, cause } = {}) {
|
|
20
|
+
super(message, { cause });
|
|
21
|
+
this.name = "ZudokuError";
|
|
22
|
+
this.title = title;
|
|
23
|
+
this.developerHint = developerHint;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// src/lib/util/joinUrl.ts
|
|
28
|
+
var defaultUrlRegExp = /^(\w+:\/\/[^/?]+)?([^?]*)(\?.*)?$/;
|
|
29
|
+
var normalizeParts = (parts) => parts.filter(
|
|
30
|
+
(part) => part !== null && part !== void 0 && part !== false && (typeof part === "string" || typeof part === "number")
|
|
31
|
+
).map((part) => `${part}`).filter((part) => part);
|
|
32
|
+
var parseParts = (parts) => {
|
|
33
|
+
const partsStr = parts.join("/");
|
|
34
|
+
const [, prefix = "", pathname = "", query = ""] = partsStr.match(defaultUrlRegExp) ?? [];
|
|
35
|
+
return {
|
|
36
|
+
prefix,
|
|
37
|
+
pathname: pathname.split("/").filter((part) => part !== ""),
|
|
38
|
+
query
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
var buildUrl = (parsedParts) => {
|
|
42
|
+
const { prefix, pathname, query } = parsedParts;
|
|
43
|
+
let url = prefix;
|
|
44
|
+
if (pathname.length > 0) {
|
|
45
|
+
if (url) {
|
|
46
|
+
url += "/";
|
|
47
|
+
} else {
|
|
48
|
+
url = "/";
|
|
49
|
+
}
|
|
50
|
+
url += pathname.join("/");
|
|
51
|
+
} else if (!url) {
|
|
52
|
+
url = "/";
|
|
53
|
+
}
|
|
54
|
+
return url + query;
|
|
55
|
+
};
|
|
56
|
+
var joinUrl = (...parts) => {
|
|
57
|
+
const normalizedParts = normalizeParts(parts);
|
|
58
|
+
const parsedParts = parseParts(normalizedParts);
|
|
59
|
+
return buildUrl(parsedParts);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// src/config/loader.ts
|
|
63
|
+
var configStore = globalThis;
|
|
64
|
+
var getConfig = () => configStore.__zudokuConfig;
|
|
65
|
+
var getCurrentConfig = () => {
|
|
66
|
+
const config = getConfig();
|
|
67
|
+
invariant(config, "Config not loaded");
|
|
68
|
+
return config;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// src/lib/core/plugin-config.ts
|
|
72
|
+
var PLUGIN_CONFIG = /* @__PURE__ */ Symbol.for("zudoku.pluginConfig");
|
|
73
|
+
var selectPluginConfigs = (plugins, name) => plugins.flatMap((plugin) => {
|
|
74
|
+
const tag = plugin && typeof plugin === "object" ? plugin[PLUGIN_CONFIG] : void 0;
|
|
75
|
+
return tag?.name === name ? [tag.config] : [];
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// src/vite/index.ts
|
|
79
|
+
import { defineConfig, mergeConfig } from "vite";
|
|
80
|
+
var getPluginConfigs = (name) => selectPluginConfigs(getCurrentConfig().plugins ?? [], name);
|
|
81
|
+
export {
|
|
82
|
+
defineConfig,
|
|
83
|
+
getPluginConfigs,
|
|
84
|
+
getCurrentConfig as getZudokuConfig,
|
|
85
|
+
joinUrl,
|
|
86
|
+
mergeConfig
|
|
87
|
+
};
|
|
@@ -193,24 +193,17 @@ Or pass any React node as the `icon` to override the default for the chosen `typ
|
|
|
193
193
|
## Customize colors
|
|
194
194
|
|
|
195
195
|
Each callout type is driven by a single CSS variable that determines the icon, border tint, and
|
|
196
|
-
background tint via `color-mix`. Override any of them in your
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
.dark {
|
|
208
|
-
--callout-tip: oklch(0.78 0.18 160);
|
|
209
|
-
--callout-sparkles: oklch(0.75 0.2 320);
|
|
210
|
-
}
|
|
211
|
-
`,
|
|
212
|
-
},
|
|
213
|
-
};
|
|
196
|
+
background tint via `color-mix`. Override any of them in your stylesheet to recolor a type globally:
|
|
197
|
+
|
|
198
|
+
```css title=styles.css
|
|
199
|
+
:root {
|
|
200
|
+
--callout-tip: oklch(0.65 0.18 160);
|
|
201
|
+
--callout-sparkles: oklch(0.6 0.22 320);
|
|
202
|
+
}
|
|
203
|
+
.dark {
|
|
204
|
+
--callout-tip: oklch(0.78 0.18 160);
|
|
205
|
+
--callout-sparkles: oklch(0.75 0.2 320);
|
|
206
|
+
}
|
|
214
207
|
```
|
|
215
208
|
|
|
216
209
|
All available variables:
|
|
@@ -168,3 +168,39 @@ your [Zudoku Configuration](./overview.md):
|
|
|
168
168
|
// ...
|
|
169
169
|
}
|
|
170
170
|
```
|
|
171
|
+
|
|
172
|
+
### Customizing Inkeep
|
|
173
|
+
|
|
174
|
+
Any other [base settings](https://docs.inkeep.com/cloud/ui-components/common-settings/base) can be
|
|
175
|
+
set alongside the required fields, for example `filters` to scope results or `transformSource` to
|
|
176
|
+
customize how sources are displayed.
|
|
177
|
+
|
|
178
|
+
You can also pass
|
|
179
|
+
[`searchSettings`](https://docs.inkeep.com/cloud/ui-components/common-settings/search),
|
|
180
|
+
[`aiChatSettings`](https://docs.inkeep.com/cloud/ui-components/common-settings/ai-chat), and
|
|
181
|
+
`modalSettings` to customize the respective parts of the search experience. They are merged with
|
|
182
|
+
Zudoku's defaults and passed through to Inkeep as-is, so any option Inkeep supports can be used —
|
|
183
|
+
including ones added after this Zudoku version was released.
|
|
184
|
+
|
|
185
|
+
For example, to categorize results into tabs based on their URL:
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
{
|
|
189
|
+
// ...
|
|
190
|
+
search: {
|
|
191
|
+
type: "inkeep",
|
|
192
|
+
// ...required fields from above
|
|
193
|
+
transformSource: (source) => {
|
|
194
|
+
if (!source.url.includes("/blog/")) return source;
|
|
195
|
+
return { ...source, tabs: [...(source.tabs ?? []), "Blog"] };
|
|
196
|
+
},
|
|
197
|
+
searchSettings: {
|
|
198
|
+
tabs: [["All", { isAlwaysVisible: true }], "Blog"],
|
|
199
|
+
},
|
|
200
|
+
aiChatSettings: {
|
|
201
|
+
aiAssistantName: "My Assistant",
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
// ...
|
|
205
|
+
}
|
|
206
|
+
```
|
|
@@ -127,6 +127,44 @@ export const NotFound = () => (
|
|
|
127
127
|
|
|
128
128
|
## Layout
|
|
129
129
|
|
|
130
|
+
### Collapsible Sidebar
|
|
131
|
+
|
|
132
|
+
The navigation sidebar is collapsible by default. A small toggle button on the sidebar's right
|
|
133
|
+
border lets users hide and reveal it. Configure the behavior under `site.sidebar`:
|
|
134
|
+
|
|
135
|
+
```tsx title=zudoku.config.tsx
|
|
136
|
+
{
|
|
137
|
+
site: {
|
|
138
|
+
sidebar: {
|
|
139
|
+
collapsible: true, // default: true. Set to false to disable the toggle entirely.
|
|
140
|
+
toggleVisibility: "always", // "always" (default) or "hover" — show button only when hovering the sidebar's right edge
|
|
141
|
+
togglePosition: "bottom", // "top", "center", or "bottom" (default)
|
|
142
|
+
},
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
For finer vertical placement, override the `--sidebar-toggle-y` CSS variable in your stylesheet:
|
|
148
|
+
|
|
149
|
+
```css
|
|
150
|
+
:root {
|
|
151
|
+
--sidebar-toggle-y: 30%;
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
The toggle button carries `aria-expanded="true"` when the sidebar is open and `"false"` when
|
|
156
|
+
collapsed. Combine it with the `[data-sidebar-toggle]` selector to position the button differently
|
|
157
|
+
per state:
|
|
158
|
+
|
|
159
|
+
```css
|
|
160
|
+
[data-sidebar-toggle][aria-expanded="true"] {
|
|
161
|
+
--sidebar-toggle-y: 20%;
|
|
162
|
+
}
|
|
163
|
+
[data-sidebar-toggle][aria-expanded="false"] {
|
|
164
|
+
--sidebar-toggle-y: 80%;
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
130
168
|
### Banner
|
|
131
169
|
|
|
132
170
|
Add a banner message to the top of the page:
|