fumapress 0.4.0 → 0.5.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/css/generated.css +50 -11
- package/dist/adapters/mdx/schema.d.ts +2 -0
- package/dist/client.d.ts +56 -0
- package/dist/client.js +16 -0
- package/dist/components/blog-panel.js +5 -3
- package/dist/components/blog.js +12 -8
- package/dist/components/flexsearch-static.js +1 -1
- package/dist/components/i18n.js +16 -0
- package/dist/components/openapi.payload.js +1 -1
- package/dist/components/orama-search-static.js +1 -1
- package/dist/config.d.ts +28 -29
- package/dist/config.js +2 -14
- package/dist/i18n.d.ts +18 -0
- package/dist/i18n.js +20 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -2
- package/dist/layouts/blog.d.ts +2 -1
- package/dist/layouts/blog.index.js +13 -11
- package/dist/layouts/blog.js +15 -23
- package/dist/layouts/blog.tags.js +29 -47
- package/dist/layouts/docs.d.ts +8 -2
- package/dist/layouts/docs.js +8 -8
- package/dist/layouts/home.d.ts +26 -19
- package/dist/layouts/home.js +20 -32
- package/dist/layouts/notebook.d.ts +8 -2
- package/dist/layouts/notebook.js +8 -8
- package/dist/layouts/root.js +18 -15
- package/dist/layouts/switch.d.ts +2 -2
- package/dist/layouts/switch.js +5 -8
- package/dist/lib/join-pathname.js +4 -4
- package/dist/lib/shared.d.ts +15 -4
- package/dist/lib/shared.js +27 -12
- package/dist/lib/types.d.ts +26 -3
- package/dist/lib/vitefu.js +1 -1
- package/dist/plugins/blog.d.ts +27 -23
- package/dist/plugins/blog.js +68 -145
- package/dist/plugins/flexsearch.js +3 -2
- package/dist/plugins/llms.txt.d.ts +7 -0
- package/dist/plugins/llms.txt.js +59 -25
- package/dist/plugins/openapi.d.ts +2 -2
- package/dist/plugins/openapi.js +17 -43
- package/dist/plugins/orama-search.js +3 -2
- package/dist/plugins/takumi.d.ts +10 -0
- package/dist/plugins/takumi.js +25 -24
- package/dist/router/fs.d.ts +36 -0
- package/dist/router/fs.js +106 -0
- package/dist/router.d.ts +9 -6
- package/dist/router.js +84 -41
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +26 -3
- package/package.json +16 -8
package/css/generated.css
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
@source inline("---spacing");
|
|
2
2
|
@source inline("-translate-x-1/2");
|
|
3
3
|
@source inline("@orama/orama");
|
|
4
|
+
@source inline("a");
|
|
4
5
|
@source inline("absolutePath");
|
|
5
6
|
@source inline("active:scale-95");
|
|
7
|
+
@source inline("allTags");
|
|
6
8
|
@source inline("as");
|
|
7
9
|
@source inline("async");
|
|
8
10
|
@source inline("await");
|
|
11
|
+
@source inline("backToHome");
|
|
9
12
|
@source inline("backdrop-blur-sm");
|
|
10
13
|
@source inline("bg-fd-card");
|
|
11
14
|
@source inline("bg-fd-primary");
|
|
@@ -22,12 +25,17 @@
|
|
|
22
25
|
@source inline("border-y");
|
|
23
26
|
@source inline("bottom-2");
|
|
24
27
|
@source inline("buttonVariants");
|
|
28
|
+
@source inline("can");
|
|
25
29
|
@source inline("children");
|
|
26
30
|
@source inline("class-variance-authority");
|
|
27
31
|
@source inline("className");
|
|
28
32
|
@source inline("client");
|
|
29
33
|
@source inline("cn");
|
|
34
|
+
@source inline("components");
|
|
35
|
+
@source inline("config");
|
|
30
36
|
@source inline("const");
|
|
37
|
+
@source inline("content");
|
|
38
|
+
@source inline("copied");
|
|
31
39
|
@source inline("core:docs-layout");
|
|
32
40
|
@source inline("core:home-layout");
|
|
33
41
|
@source inline("core:notebook-layout");
|
|
@@ -49,10 +57,13 @@
|
|
|
49
57
|
@source inline("createNotebookLayoutPage");
|
|
50
58
|
@source inline("createRootLayout");
|
|
51
59
|
@source inline("creationDate");
|
|
60
|
+
@source inline("cssUrl");
|
|
52
61
|
@source inline("ctx");
|
|
62
|
+
@source inline("current");
|
|
53
63
|
@source inline("currentDate");
|
|
54
64
|
@source inline("cva");
|
|
55
65
|
@source inline("data");
|
|
66
|
+
@source inline("data-fd-home-layout-container");
|
|
56
67
|
@source inline("data-version");
|
|
57
68
|
@source inline("date");
|
|
58
69
|
@source inline("decoded");
|
|
@@ -84,13 +95,18 @@
|
|
|
84
95
|
@source inline("font-semibold");
|
|
85
96
|
@source inline("for");
|
|
86
97
|
@source inline("from");
|
|
98
|
+
@source inline("fumadocs-core/i18n");
|
|
87
99
|
@source inline("fumadocs-core/source");
|
|
88
100
|
@source inline("fumadocs-core/toc");
|
|
101
|
+
@source inline("fumadocs-ui/i18n");
|
|
102
|
+
@source inline("fumapress");
|
|
89
103
|
@source inline("function");
|
|
90
104
|
@source inline("gap-1");
|
|
91
105
|
@source inline("gap-2");
|
|
92
106
|
@source inline("gap-4");
|
|
93
|
-
@source inline("
|
|
107
|
+
@source inline("getBlogContext");
|
|
108
|
+
@source inline("getLayoutProps");
|
|
109
|
+
@source inline("getPressContext");
|
|
94
110
|
@source inline("getTags");
|
|
95
111
|
@source inline("ghost");
|
|
96
112
|
@source inline("githubUrl");
|
|
@@ -99,20 +115,25 @@
|
|
|
99
115
|
@source inline("grid-cols-2");
|
|
100
116
|
@source inline("groupTags");
|
|
101
117
|
@source inline("grouped");
|
|
118
|
+
@source inline("h-12");
|
|
102
119
|
@source inline("hook");
|
|
103
120
|
@source inline("hooks");
|
|
104
121
|
@source inline("hover:bg-fd-accent");
|
|
105
122
|
@source inline("hover:text-fd-accent-foreground");
|
|
106
123
|
@source inline("href");
|
|
107
124
|
@source inline("i18n");
|
|
108
|
-
@source inline("
|
|
125
|
+
@source inline("i18nProvider");
|
|
109
126
|
@source inline("if");
|
|
110
127
|
@source inline("import");
|
|
111
128
|
@source inline("in");
|
|
129
|
+
@source inline("indexPath");
|
|
112
130
|
@source inline("inherit");
|
|
131
|
+
@source inline("inheritLayoutProps");
|
|
132
|
+
@source inline("inherited");
|
|
113
133
|
@source inline("inline-flex");
|
|
114
134
|
@source inline("interface");
|
|
115
135
|
@source inline("is");
|
|
136
|
+
@source inline("isBlog");
|
|
116
137
|
@source inline("isLoading");
|
|
117
138
|
@source inline("it");
|
|
118
139
|
@source inline("item");
|
|
@@ -121,9 +142,10 @@
|
|
|
121
142
|
@source inline("items-start");
|
|
122
143
|
@source inline("joinPathname");
|
|
123
144
|
@source inline("key");
|
|
145
|
+
@source inline("keyof");
|
|
146
|
+
@source inline("label");
|
|
124
147
|
@source inline("lang");
|
|
125
148
|
@source inline("language");
|
|
126
|
-
@source inline("languages");
|
|
127
149
|
@source inline("lastModified");
|
|
128
150
|
@source inline("layout");
|
|
129
151
|
@source inline("layoutData");
|
|
@@ -134,10 +156,9 @@
|
|
|
134
156
|
@source inline("let");
|
|
135
157
|
@source inline("loaderConfig");
|
|
136
158
|
@source inline("locale");
|
|
137
|
-
@source inline("locales");
|
|
138
159
|
@source inline("lucide-react");
|
|
139
160
|
@source inline("markdownUrl");
|
|
140
|
-
@source inline("
|
|
161
|
+
@source inline("matchingBlogPosts");
|
|
141
162
|
@source inline("max-h-[min(600px,calc(100vh---spacing(30)))]");
|
|
142
163
|
@source inline("max-sm:-mx-4");
|
|
143
164
|
@source inline("max-w-[1400px]");
|
|
@@ -154,18 +175,19 @@
|
|
|
154
175
|
@source inline("mt-6");
|
|
155
176
|
@source inline("mt-auto");
|
|
156
177
|
@source inline("mx-auto");
|
|
157
|
-
@source inline("name");
|
|
158
|
-
@source inline("never");
|
|
159
178
|
@source inline("new");
|
|
160
179
|
@source inline("of");
|
|
180
|
+
@source inline("on");
|
|
161
181
|
@source inline("onClick");
|
|
162
182
|
@source inline("onCopy");
|
|
163
183
|
@source inline("onOpenChange");
|
|
164
184
|
@source inline("onSearchChange");
|
|
185
|
+
@source inline("only");
|
|
165
186
|
@source inline("open");
|
|
166
187
|
@source inline("option");
|
|
167
188
|
@source inline("options");
|
|
168
189
|
@source inline("orderedPosts");
|
|
190
|
+
@source inline("outer");
|
|
169
191
|
@source inline("overline");
|
|
170
192
|
@source inline("p-1");
|
|
171
193
|
@source inline("p-4");
|
|
@@ -173,7 +195,6 @@
|
|
|
173
195
|
@source inline("pageProps");
|
|
174
196
|
@source inline("panelButtonVariants");
|
|
175
197
|
@source inline("payload");
|
|
176
|
-
@source inline("pb-20");
|
|
177
198
|
@source inline("pb-6");
|
|
178
199
|
@source inline("posts");
|
|
179
200
|
@source inline("primary");
|
|
@@ -183,7 +204,6 @@
|
|
|
183
204
|
@source inline("pt-2");
|
|
184
205
|
@source inline("pt-3.5");
|
|
185
206
|
@source inline("pt-4");
|
|
186
|
-
@source inline("pt-6");
|
|
187
207
|
@source inline("px-1.5");
|
|
188
208
|
@source inline("px-2");
|
|
189
209
|
@source inline("px-3");
|
|
@@ -191,12 +211,16 @@
|
|
|
191
211
|
@source inline("py-0.5");
|
|
192
212
|
@source inline("py-1");
|
|
193
213
|
@source inline("py-2");
|
|
214
|
+
@source inline("py-6");
|
|
194
215
|
@source inline("query");
|
|
195
216
|
@source inline("r");
|
|
196
217
|
@source inline("react");
|
|
218
|
+
@source inline("rel");
|
|
197
219
|
@source inline("render");
|
|
198
220
|
@source inline("renderCtx");
|
|
199
221
|
@source inline("renderRootMeta");
|
|
222
|
+
@source inline("replacements");
|
|
223
|
+
@source inline("resolved");
|
|
200
224
|
@source inline("result");
|
|
201
225
|
@source inline("return");
|
|
202
226
|
@source inline("root");
|
|
@@ -207,6 +231,7 @@
|
|
|
207
231
|
@source inline("schema");
|
|
208
232
|
@source inline("schemaId");
|
|
209
233
|
@source inline("search");
|
|
234
|
+
@source inline("server");
|
|
210
235
|
@source inline("setOpen");
|
|
211
236
|
@source inline("shadow-inner");
|
|
212
237
|
@source inline("shadow-md");
|
|
@@ -220,14 +245,23 @@
|
|
|
220
245
|
@source inline("sm:grid-cols-3");
|
|
221
246
|
@source inline("sm:max-w-[400px]");
|
|
222
247
|
@source inline("sm:rounded-xl");
|
|
248
|
+
@source inline("so");
|
|
223
249
|
@source inline("source");
|
|
224
250
|
@source inline("specify");
|
|
225
251
|
@source inline("static");
|
|
226
252
|
@source inline("string");
|
|
253
|
+
@source inline("styleTag");
|
|
227
254
|
@source inline("styles");
|
|
255
|
+
@source inline("stylesheet");
|
|
228
256
|
@source inline("sure");
|
|
257
|
+
@source inline("swap");
|
|
258
|
+
@source inline("t");
|
|
259
|
+
@source inline("tag");
|
|
260
|
+
@source inline("tagTitle");
|
|
229
261
|
@source inline("tags");
|
|
262
|
+
@source inline("tagsInTotal");
|
|
230
263
|
@source inline("tagsPath");
|
|
264
|
+
@source inline("text");
|
|
231
265
|
@source inline("text-2xl");
|
|
232
266
|
@source inline("text-3xl");
|
|
233
267
|
@source inline("text-fd-card-foreground");
|
|
@@ -245,11 +279,13 @@
|
|
|
245
279
|
@source inline("transition-all");
|
|
246
280
|
@source inline("transition-colors");
|
|
247
281
|
@source inline("transition-transform");
|
|
248
|
-
@source inline("
|
|
282
|
+
@source inline("translated");
|
|
283
|
+
@source inline("translationsConfig");
|
|
249
284
|
@source inline("tree");
|
|
285
|
+
@source inline("true");
|
|
250
286
|
@source inline("truncate");
|
|
251
287
|
@source inline("type");
|
|
252
|
-
@source inline("
|
|
288
|
+
@source inline("typeof");
|
|
253
289
|
@source inline("unstable_notFound");
|
|
254
290
|
@source inline("url");
|
|
255
291
|
@source inline("use");
|
|
@@ -259,10 +295,13 @@
|
|
|
259
295
|
@source inline("useMemo");
|
|
260
296
|
@source inline("useState");
|
|
261
297
|
@source inline("useTOCItems");
|
|
298
|
+
@source inline("useTranslations");
|
|
299
|
+
@source inline("useTranslationsBase");
|
|
262
300
|
@source inline("value");
|
|
263
301
|
@source inline("variant");
|
|
264
302
|
@source inline("w-full");
|
|
265
303
|
@source inline("waku");
|
|
304
|
+
@source inline("wrapper");
|
|
266
305
|
@source inline("xl:grid-cols-4");
|
|
267
306
|
@source inline("xl:grid-cols-6");
|
|
268
307
|
@source inline("you");
|
|
@@ -12,6 +12,7 @@ declare const pageSchema: z.ZodObject<{
|
|
|
12
12
|
declare const metaSchema: z.ZodObject<{
|
|
13
13
|
title: z.ZodOptional<z.ZodString>;
|
|
14
14
|
pages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
15
|
+
pagesIndex: z.ZodOptional<z.ZodString>;
|
|
15
16
|
description: z.ZodOptional<z.ZodString>;
|
|
16
17
|
root: z.ZodOptional<z.ZodBoolean>;
|
|
17
18
|
defaultOpen: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -29,6 +30,7 @@ declare const blogPageSchema: z.ZodObject<{
|
|
|
29
30
|
declare const blogMetaSchema: z.ZodObject<{
|
|
30
31
|
title: z.ZodOptional<z.ZodString>;
|
|
31
32
|
pages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
33
|
+
pagesIndex: z.ZodOptional<z.ZodString>;
|
|
32
34
|
description: z.ZodOptional<z.ZodString>;
|
|
33
35
|
root: z.ZodOptional<z.ZodBoolean>;
|
|
34
36
|
defaultOpen: z.ZodOptional<z.ZodBoolean>;
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Unstable_ChangeRouteCallback, Unstable_ChangeRouteEvent } from "waku/router/client";
|
|
2
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
import { ComponentProps, ReactNode, TransitionFunction } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/client.d.ts
|
|
6
|
+
interface LinkProps extends ComponentProps<"a"> {
|
|
7
|
+
/**
|
|
8
|
+
* indicates if the link should scroll or not on navigation
|
|
9
|
+
* - `true`: always scroll
|
|
10
|
+
* - `false`: never scroll
|
|
11
|
+
* - `undefined`: scroll on path/hash change (not on query-only change)
|
|
12
|
+
*/
|
|
13
|
+
scroll?: boolean;
|
|
14
|
+
unstable_pending?: ReactNode;
|
|
15
|
+
unstable_notPending?: ReactNode;
|
|
16
|
+
unstable_prefetchOnEnter?: boolean;
|
|
17
|
+
unstable_prefetchOnView?: boolean;
|
|
18
|
+
unstable_startTransition?: ((fn: TransitionFunction) => void) | undefined;
|
|
19
|
+
href: string;
|
|
20
|
+
}
|
|
21
|
+
interface Router {
|
|
22
|
+
push: (to: string, options?: {
|
|
23
|
+
/**
|
|
24
|
+
* indicates if the link should scroll or not on navigation
|
|
25
|
+
* - `true`: always scroll
|
|
26
|
+
* - `false`: never scroll
|
|
27
|
+
* - `undefined`: scroll on path/hash change (not on query-only change)
|
|
28
|
+
*/
|
|
29
|
+
scroll?: boolean;
|
|
30
|
+
}) => Promise<void>;
|
|
31
|
+
replace: (to: string, options?: {
|
|
32
|
+
/**
|
|
33
|
+
* indicates if the link should scroll or not on navigation
|
|
34
|
+
* - `true`: always scroll
|
|
35
|
+
* - `false`: never scroll
|
|
36
|
+
* - `undefined`: scroll on path/hash change (not on query-only change)
|
|
37
|
+
*/
|
|
38
|
+
scroll?: boolean;
|
|
39
|
+
}) => Promise<void>;
|
|
40
|
+
reload: () => Promise<void>;
|
|
41
|
+
back: () => void;
|
|
42
|
+
forward: () => void;
|
|
43
|
+
prefetch: (to: string) => void;
|
|
44
|
+
unstable_events: Record<"on" | "off", (event: Unstable_ChangeRouteEvent, handler: Unstable_ChangeRouteCallback) => void>;
|
|
45
|
+
path: string;
|
|
46
|
+
query: string;
|
|
47
|
+
hash: string;
|
|
48
|
+
}
|
|
49
|
+
declare function Link({
|
|
50
|
+
href,
|
|
51
|
+
children,
|
|
52
|
+
...props
|
|
53
|
+
}: LinkProps): _$react_jsx_runtime0.JSX.Element;
|
|
54
|
+
declare function useRouter(): Router;
|
|
55
|
+
//#endregion
|
|
56
|
+
export { Link, LinkProps, Router, useRouter };
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Link as Link$1, useRouter as useRouter$1 } from "waku/router/client";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/client.tsx
|
|
5
|
+
function Link({ href, children, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(Link$1, {
|
|
7
|
+
to: href,
|
|
8
|
+
...props,
|
|
9
|
+
children
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function useRouter() {
|
|
13
|
+
return useRouter$1();
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Link, useRouter };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/cn.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useTranslations } from "./i18n.js";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { useState } from "react";
|
|
5
6
|
import { ChevronDown, ShareIcon } from "lucide-react";
|
|
6
7
|
import { TOCProvider, TOCScrollArea, useTOCItems } from "fumadocs-ui/components/toc";
|
|
7
8
|
import { TOCItem, TOCItems } from "fumadocs-ui/components/toc/clerk";
|
|
@@ -11,6 +12,7 @@ import { useCopyButton } from "fumadocs-ui/utils/use-copy-button";
|
|
|
11
12
|
//#region src/components/blog-panel.tsx
|
|
12
13
|
const panelButtonVariants = cva("inline-flex items-center font-medium gap-2 px-3 py-2 transition-all duration-150 rounded-lg hover:text-fd-accent-foreground hover:bg-fd-accent active:scale-95");
|
|
13
14
|
function BlogPanel() {
|
|
15
|
+
const t = useTranslations();
|
|
14
16
|
const items = useTOCItems();
|
|
15
17
|
const [open, setOpen] = useState(false);
|
|
16
18
|
const [isSuccessful, onCopy] = useCopyButton(() => {
|
|
@@ -36,12 +38,12 @@ function BlogPanel() {
|
|
|
36
38
|
className: cn(panelButtonVariants(), "min-w-0"),
|
|
37
39
|
children: [/* @__PURE__ */ jsx("span", {
|
|
38
40
|
className: "truncate",
|
|
39
|
-
children:
|
|
41
|
+
children: t.tableOfContents
|
|
40
42
|
}), /* @__PURE__ */ jsx(ChevronDown, { className: cn("size-3.5 shrink-0 text-fd-muted-foreground transition-transform", open && "rotate-180") })]
|
|
41
43
|
}), /* @__PURE__ */ jsxs("button", {
|
|
42
44
|
className: cn(panelButtonVariants(), "ms-auto text-fd-muted-foreground"),
|
|
43
45
|
onClick: onCopy,
|
|
44
|
-
children: [/* @__PURE__ */ jsx(ShareIcon, { className: "size-3.5 shrink-0" }), isSuccessful ?
|
|
46
|
+
children: [/* @__PURE__ */ jsx(ShareIcon, { className: "size-3.5 shrink-0" }), isSuccessful ? t.copied : t.share]
|
|
45
47
|
})]
|
|
46
48
|
})]
|
|
47
49
|
});
|
package/dist/components/blog.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { getCreationDate } from "../lib/shared.js";
|
|
1
|
+
import { getCreationDate, getPressContext } from "../lib/shared.js";
|
|
2
2
|
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { I18nLabel } from "./i18n.js";
|
|
3
4
|
import { joinPathname } from "../lib/join-pathname.js";
|
|
4
|
-
import {
|
|
5
|
+
import { getBlogContext } from "../plugins/blog.js";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import {
|
|
7
|
+
import { Link } from "waku";
|
|
7
8
|
import { CornerLeftUpIcon } from "lucide-react";
|
|
9
|
+
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
8
10
|
//#region src/components/blog.tsx
|
|
9
11
|
function BlogItem({ page, date }) {
|
|
10
12
|
return /* @__PURE__ */ jsxs(Link, {
|
|
@@ -26,7 +28,8 @@ function BlogItem({ page, date }) {
|
|
|
26
28
|
]
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
|
-
async function OrderedBlogGrid({ posts
|
|
31
|
+
async function OrderedBlogGrid({ posts }) {
|
|
32
|
+
const ctx = getPressContext();
|
|
30
33
|
const currentDate = new Date(Date.now());
|
|
31
34
|
const orderedPosts = [];
|
|
32
35
|
for (const page of posts) {
|
|
@@ -45,15 +48,16 @@ async function OrderedBlogGrid({ posts, ctx }) {
|
|
|
45
48
|
}, page.url))
|
|
46
49
|
});
|
|
47
50
|
}
|
|
48
|
-
function LinkToHome({ lang
|
|
49
|
-
|
|
51
|
+
function LinkToHome({ lang }) {
|
|
52
|
+
const { indexPath } = getBlogContext();
|
|
53
|
+
if (!indexPath) return;
|
|
50
54
|
return /* @__PURE__ */ jsxs(Link, {
|
|
51
|
-
to: lang ? joinPathname(lang,
|
|
55
|
+
to: lang ? joinPathname(lang, indexPath) : indexPath,
|
|
52
56
|
className: cn(buttonVariants({
|
|
53
57
|
variant: "ghost",
|
|
54
58
|
className: "text-fd-muted-foreground gap-2"
|
|
55
59
|
})),
|
|
56
|
-
children: [/* @__PURE__ */ jsx(CornerLeftUpIcon, { className: "size-3.5" }),
|
|
60
|
+
children: [/* @__PURE__ */ jsx(CornerLeftUpIcon, { className: "size-3.5" }), /* @__PURE__ */ jsx(I18nLabel, { label: "backToHome" })]
|
|
57
61
|
});
|
|
58
62
|
}
|
|
59
63
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useI18n } from "fumadocs-ui/contexts/i18n";
|
|
3
4
|
import { SearchDialog, SearchDialogClose, SearchDialogContent, SearchDialogHeader, SearchDialogIcon, SearchDialogInput, SearchDialogList, SearchDialogOverlay } from "fumadocs-ui/components/dialog/search";
|
|
4
5
|
import { useDocsSearch } from "fumadocs-core/search/client";
|
|
5
6
|
import { flexsearchStaticClient } from "fumadocs-core/search/client/flexsearch-static";
|
|
6
|
-
import { useI18n } from "fumadocs-ui/contexts/i18n";
|
|
7
7
|
//#region src/components/flexsearch-static.tsx
|
|
8
8
|
function DefaultSearchDialog(props) {
|
|
9
9
|
const { locale } = useI18n();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { defaultTranslations } from "../i18n.js";
|
|
3
|
+
import { renderTranslation } from "fumadocs-core/i18n";
|
|
4
|
+
import { useTranslations } from "fumadocs-ui/contexts/i18n";
|
|
5
|
+
//#region src/components/i18n.tsx
|
|
6
|
+
function useTranslations$1() {
|
|
7
|
+
return useTranslations("fumapress") ?? defaultTranslations;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Renders a translated string. Use in server components so the label is resolved on the client from the current locale.
|
|
11
|
+
*/
|
|
12
|
+
function I18nLabel({ label, replacements }) {
|
|
13
|
+
return renderTranslation(useTranslations$1()[label], replacements);
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { I18nLabel, useTranslations$1 as useTranslations };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { createContext, use, useMemo } from "react";
|
|
3
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, use, useMemo } from "react";
|
|
4
4
|
//#region src/components/openapi.payload.tsx
|
|
5
5
|
const Context = createContext(null);
|
|
6
6
|
function PayloadProvider({ payload, children }) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useI18n } from "fumadocs-ui/contexts/i18n";
|
|
3
4
|
import { SearchDialog, SearchDialogClose, SearchDialogContent, SearchDialogHeader, SearchDialogIcon, SearchDialogInput, SearchDialogList, SearchDialogOverlay } from "fumadocs-ui/components/dialog/search";
|
|
4
5
|
import { useDocsSearch } from "fumadocs-core/search/client";
|
|
5
|
-
import { useI18n } from "fumadocs-ui/contexts/i18n";
|
|
6
6
|
import { create } from "@orama/orama";
|
|
7
7
|
//#region src/components/orama-search-static.tsx
|
|
8
8
|
function initOrama() {
|
package/dist/config.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AppContext } from "./lib/shared.js";
|
|
2
2
|
import { Adapter, Awaitable, ServerPluginOption } from "./lib/types.js";
|
|
3
|
-
import { ComponentType, ReactNode } from "react";
|
|
4
|
-
import { TranslationsOption } from "fumadocs-ui/contexts/i18n";
|
|
5
3
|
import { LoaderConfig, LoaderOutput } from "fumadocs-core/source";
|
|
6
|
-
import {
|
|
4
|
+
import { FC, ReactNode } from "react";
|
|
5
|
+
import { I18nConfig, SingularTranslationsAPI, TranslationsAPI } from "fumadocs-core/i18n";
|
|
6
|
+
import { Translations } from "fumadocs-ui/i18n";
|
|
7
7
|
import { BaseLayoutProps } from "fumadocs-ui/layouts/shared";
|
|
8
8
|
|
|
9
9
|
//#region src/config.d.ts
|
|
@@ -20,41 +20,43 @@ interface Config<C extends ConfigContext = ConfigContext> {
|
|
|
20
20
|
*/
|
|
21
21
|
mode?: BuildMode;
|
|
22
22
|
/** the default content loader */
|
|
23
|
-
loader
|
|
23
|
+
loader?: LoaderOutput<C["loaderConfig"]> | (() => Awaitable<LoaderOutput<C["loaderConfig"]>>);
|
|
24
24
|
site?: SiteConfig;
|
|
25
|
-
|
|
25
|
+
/** this is optional if you have defined `translations` */
|
|
26
|
+
i18n?: I18nConfig<C["lang"]>;
|
|
27
|
+
translations?: TranslationsAPI<C["lang"], {
|
|
28
|
+
ui: Translations;
|
|
29
|
+
}> | SingularTranslationsAPI<{
|
|
30
|
+
ui: Translations;
|
|
31
|
+
}>;
|
|
26
32
|
meta?: MetaConfig<NoInfer<C>>;
|
|
27
33
|
}
|
|
28
34
|
interface Layouts<C extends ConfigContext = ConfigContext> {
|
|
29
|
-
root:
|
|
35
|
+
root: FC<{
|
|
30
36
|
lang?: string;
|
|
31
|
-
ctx: AppContext<C>;
|
|
32
37
|
children: ReactNode;
|
|
33
|
-
}
|
|
34
|
-
|
|
38
|
+
}> & {
|
|
39
|
+
$ctx?: C;
|
|
40
|
+
};
|
|
41
|
+
page: FC<{
|
|
35
42
|
lang?: string;
|
|
36
43
|
slugs: string[];
|
|
37
|
-
ctx: AppContext<C>;
|
|
38
44
|
page: C["loaderConfig"]["page"];
|
|
39
|
-
}
|
|
40
|
-
|
|
45
|
+
}> & {
|
|
46
|
+
$ctx?: C;
|
|
47
|
+
};
|
|
48
|
+
notFound: FC<{
|
|
41
49
|
lang?: string;
|
|
42
|
-
|
|
43
|
-
|
|
50
|
+
}> & {
|
|
51
|
+
$ctx?: C;
|
|
52
|
+
};
|
|
44
53
|
/**
|
|
45
|
-
* Define default props for
|
|
54
|
+
* Define default props for all Fumadocs layouts, will be deep-merged with current props.
|
|
46
55
|
*/
|
|
47
56
|
defaultProps?: (this: AppContext<C>, env: {
|
|
48
57
|
lang: string | undefined;
|
|
49
58
|
}) => Awaitable<Omit<BaseLayoutProps, "children">>;
|
|
50
59
|
}
|
|
51
|
-
interface I18nConfig$1<Lang extends string = string> extends Pick<I18nConfig<NoInfer<Lang>>, "defaultLanguage" | "fallbackLanguage" | "parser"> {
|
|
52
|
-
/** locale code -> language info */
|
|
53
|
-
languages: { [K in Lang]: {
|
|
54
|
-
displayName: string;
|
|
55
|
-
translations?: TranslationsOption;
|
|
56
|
-
} };
|
|
57
|
-
}
|
|
58
60
|
interface MetaConfig<C extends ConfigContext = ConfigContext> {
|
|
59
61
|
/** render meta tags for any pages */
|
|
60
62
|
root?: (this: AppContext<C>) => ReactNode;
|
|
@@ -72,17 +74,15 @@ interface SiteConfig {
|
|
|
72
74
|
rootDir?: string;
|
|
73
75
|
};
|
|
74
76
|
}
|
|
75
|
-
interface I18nConfigBuilder<Lang extends string> extends I18nConfig$1<Lang> {
|
|
76
|
-
/** convert Fumapress i18n config to core i18n config */
|
|
77
|
-
toCore: () => I18nConfig<Lang>;
|
|
78
|
-
}
|
|
79
77
|
interface ConfigBuilder<C extends ConfigContext> extends Config<C> {
|
|
78
|
+
/** for type inference only, always `undefined` */
|
|
79
|
+
$context: C;
|
|
80
80
|
getPlugins: () => ServerPluginOption<C>[];
|
|
81
81
|
getLayouts: () => Partial<Layouts<C>>;
|
|
82
82
|
getAdapters: () => Adapter<C>[];
|
|
83
83
|
usePlugins: (...plugins: ServerPluginOption<C>[]) => ConfigBuilder<C>;
|
|
84
84
|
useLayouts: (layouts: Partial<Layouts<C>>) => ConfigBuilder<C>;
|
|
85
|
-
/** Add adapter for content sources
|
|
85
|
+
/** Add adapter for content sources */
|
|
86
86
|
useAdapters: (...adapters: Adapter<C>[]) => ConfigBuilder<C>;
|
|
87
87
|
}
|
|
88
88
|
declare function defineConfig<C extends LoaderConfig, L extends string = string>(config: Config<{
|
|
@@ -92,6 +92,5 @@ declare function defineConfig<C extends LoaderConfig, L extends string = string>
|
|
|
92
92
|
loaderConfig: C;
|
|
93
93
|
lang: L;
|
|
94
94
|
}>;
|
|
95
|
-
declare function defineI18nConfig<Lang extends string>(config: I18nConfig$1<Lang>): I18nConfigBuilder<Lang>;
|
|
96
95
|
//#endregion
|
|
97
|
-
export { BuildMode, Config, ConfigBuilder, ConfigContext,
|
|
96
|
+
export { BuildMode, Config, ConfigBuilder, ConfigContext, Layouts, MetaConfig, SiteConfig, defineConfig };
|
package/dist/config.js
CHANGED
|
@@ -5,6 +5,7 @@ function defineConfig(config) {
|
|
|
5
5
|
const adapters = [];
|
|
6
6
|
return {
|
|
7
7
|
...config,
|
|
8
|
+
$context: void 0,
|
|
8
9
|
getPlugins() {
|
|
9
10
|
return plugins;
|
|
10
11
|
},
|
|
@@ -28,18 +29,5 @@ function defineConfig(config) {
|
|
|
28
29
|
}
|
|
29
30
|
};
|
|
30
31
|
}
|
|
31
|
-
function defineI18nConfig(config) {
|
|
32
|
-
return {
|
|
33
|
-
...config,
|
|
34
|
-
toCore() {
|
|
35
|
-
return {
|
|
36
|
-
defaultLanguage: this.defaultLanguage,
|
|
37
|
-
fallbackLanguage: this.fallbackLanguage,
|
|
38
|
-
parser: this.parser,
|
|
39
|
-
languages: Object.keys(this.languages)
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
32
|
//#endregion
|
|
45
|
-
export { defineConfig
|
|
33
|
+
export { defineConfig };
|
package/dist/i18n.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TranslationValue, TranslationsAPIExtension } from "fumadocs-core/i18n";
|
|
2
|
+
|
|
3
|
+
//#region src/i18n.d.ts
|
|
4
|
+
declare const defaultTranslations: {
|
|
5
|
+
blog: string;
|
|
6
|
+
allTags: string;
|
|
7
|
+
tagsInTotal: TranslationValue<"count">;
|
|
8
|
+
tagTitle: TranslationValue<"tag">;
|
|
9
|
+
matchingBlogPosts: TranslationValue<"count">;
|
|
10
|
+
backToHome: string;
|
|
11
|
+
tableOfContents: string;
|
|
12
|
+
share: string;
|
|
13
|
+
copied: string;
|
|
14
|
+
};
|
|
15
|
+
type Translations = typeof defaultTranslations;
|
|
16
|
+
declare function fumapressTranslations(): TranslationsAPIExtension<"fumapress", Translations>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Translations, defaultTranslations, fumapressTranslations };
|
package/dist/i18n.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/i18n.ts
|
|
2
|
+
const defaultTranslations = {
|
|
3
|
+
blog: "Blog",
|
|
4
|
+
allTags: "All Tags",
|
|
5
|
+
tagsInTotal: "{count} tags in total.",
|
|
6
|
+
tagTitle: "Tag \"{tag}\"",
|
|
7
|
+
matchingBlogPosts: "{count} matching blog posts.",
|
|
8
|
+
backToHome: "Back to Home",
|
|
9
|
+
tableOfContents: "Table of Contents",
|
|
10
|
+
share: "Share",
|
|
11
|
+
copied: "Copied"
|
|
12
|
+
};
|
|
13
|
+
function fumapressTranslations() {
|
|
14
|
+
return {
|
|
15
|
+
namespace: "fumapress",
|
|
16
|
+
defaultValue: defaultTranslations
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { defaultTranslations, fumapressTranslations };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppContext } from "./lib/shared.js";
|
|
2
|
-
import { BuildMode, Config, ConfigBuilder, ConfigContext,
|
|
3
|
-
import { Adapter, AppContextData, RouteFns, ServerPlugin, ServerPluginOption } from "./lib/types.js";
|
|
4
|
-
export { type Adapter, type AppContext, type AppContextData, BuildMode, Config, ConfigBuilder, ConfigContext,
|
|
1
|
+
import { AppContext, getPressContext } from "./lib/shared.js";
|
|
2
|
+
import { BuildMode, Config, ConfigBuilder, ConfigContext, Layouts, MetaConfig, SiteConfig, defineConfig } from "./config.js";
|
|
3
|
+
import { Adapter, AppContextData, RouteConfig, RouteFns, ServerPlugin, ServerPluginOption } from "./lib/types.js";
|
|
4
|
+
export { type Adapter, type AppContext, type AppContextData, BuildMode, Config, ConfigBuilder, ConfigContext, Layouts, MetaConfig, type RouteConfig, type RouteFns, type ServerPlugin, type ServerPluginOption, SiteConfig, defineConfig, getPressContext };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { defineConfig
|
|
2
|
-
|
|
1
|
+
import { defineConfig } from "./config.js";
|
|
2
|
+
import { getPressContext } from "./lib/shared.js";
|
|
3
|
+
export { defineConfig, getPressContext };
|
package/dist/layouts/blog.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ import { ReactNode } from "react";
|
|
|
7
7
|
import { TOCItemType } from "fumadocs-core/toc";
|
|
8
8
|
|
|
9
9
|
//#region src/layouts/blog.d.ts
|
|
10
|
-
|
|
10
|
+
/** You can use `createHomeLayout()` directly, this is only a wrapper */
|
|
11
|
+
declare function createBlogLayout<C extends ConfigContext>(options?: HomeLayoutOptions<C>): BlogLayout<C>;
|
|
11
12
|
interface BlogLayoutPageRenderData {
|
|
12
13
|
creationDate?: Date;
|
|
13
14
|
toc: TOCItemType[];
|