fumapress 0.3.1 → 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 +65 -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.js +6 -0
- package/dist/components/openapi.payload.js +21 -0
- package/dist/components/orama-search-static.js +1 -1
- package/dist/config.d.ts +35 -36
- package/dist/config.js +20 -23
- 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 +3 -2
- 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 +17 -17
- package/dist/lib/shared.js +47 -13
- package/dist/lib/types.d.ts +51 -7
- package/dist/lib/vitefu.js +1 -1
- package/dist/plugins/blog.d.ts +27 -23
- package/dist/plugins/blog.js +47 -124
- package/dist/plugins/flexsearch.js +7 -5
- package/dist/plugins/internal/disable-search.js +15 -0
- package/dist/plugins/llms.txt.d.ts +7 -0
- package/dist/plugins/llms.txt.js +60 -25
- package/dist/plugins/openapi.d.ts +12 -5
- package/dist/plugins/openapi.js +63 -8
- package/dist/plugins/orama-search.js +7 -5
- package/dist/plugins/takumi.d.ts +10 -0
- package/dist/plugins/takumi.js +26 -24
- package/dist/router/fs.d.ts +36 -0
- package/dist/router/fs.js +106 -0
- package/dist/router.d.ts +10 -7
- package/dist/router.js +100 -63
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +26 -3
- package/package.json +19 -12
- package/dist/adapters/openapi.d.ts +0 -15
- package/dist/adapters/openapi.js +0 -22
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");
|
|
@@ -39,6 +47,8 @@
|
|
|
39
47
|
@source inline("createBlogLayoutPage");
|
|
40
48
|
@source inline("createBlogTagPage");
|
|
41
49
|
@source inline("createBlogTagsPage");
|
|
50
|
+
@source inline("createClientAPIPage");
|
|
51
|
+
@source inline("createContext");
|
|
42
52
|
@source inline("createDocsLayoutPage");
|
|
43
53
|
@source inline("createHomeLayout");
|
|
44
54
|
@source inline("createHomeLayoutPage");
|
|
@@ -47,16 +57,22 @@
|
|
|
47
57
|
@source inline("createNotebookLayoutPage");
|
|
48
58
|
@source inline("createRootLayout");
|
|
49
59
|
@source inline("creationDate");
|
|
60
|
+
@source inline("cssUrl");
|
|
50
61
|
@source inline("ctx");
|
|
62
|
+
@source inline("current");
|
|
51
63
|
@source inline("currentDate");
|
|
52
64
|
@source inline("cva");
|
|
53
65
|
@source inline("data");
|
|
66
|
+
@source inline("data-fd-home-layout-container");
|
|
54
67
|
@source inline("data-version");
|
|
55
68
|
@source inline("date");
|
|
69
|
+
@source inline("decoded");
|
|
56
70
|
@source inline("decoration-fd-primary");
|
|
57
71
|
@source inline("default");
|
|
72
|
+
@source inline("defined");
|
|
58
73
|
@source inline("detect");
|
|
59
74
|
@source inline("detector");
|
|
75
|
+
@source inline("do");
|
|
60
76
|
@source inline("duration-150");
|
|
61
77
|
@source inline("else");
|
|
62
78
|
@source inline("empty");
|
|
@@ -66,6 +82,7 @@
|
|
|
66
82
|
@source inline("export");
|
|
67
83
|
@source inline("extends");
|
|
68
84
|
@source inline("false");
|
|
85
|
+
@source inline("find");
|
|
69
86
|
@source inline("fixed");
|
|
70
87
|
@source inline("flex");
|
|
71
88
|
@source inline("flex-1");
|
|
@@ -78,13 +95,18 @@
|
|
|
78
95
|
@source inline("font-semibold");
|
|
79
96
|
@source inline("for");
|
|
80
97
|
@source inline("from");
|
|
98
|
+
@source inline("fumadocs-core/i18n");
|
|
81
99
|
@source inline("fumadocs-core/source");
|
|
82
100
|
@source inline("fumadocs-core/toc");
|
|
101
|
+
@source inline("fumadocs-ui/i18n");
|
|
102
|
+
@source inline("fumapress");
|
|
83
103
|
@source inline("function");
|
|
84
104
|
@source inline("gap-1");
|
|
85
105
|
@source inline("gap-2");
|
|
86
106
|
@source inline("gap-4");
|
|
87
|
-
@source inline("
|
|
107
|
+
@source inline("getBlogContext");
|
|
108
|
+
@source inline("getLayoutProps");
|
|
109
|
+
@source inline("getPressContext");
|
|
88
110
|
@source inline("getTags");
|
|
89
111
|
@source inline("ghost");
|
|
90
112
|
@source inline("githubUrl");
|
|
@@ -93,29 +115,37 @@
|
|
|
93
115
|
@source inline("grid-cols-2");
|
|
94
116
|
@source inline("groupTags");
|
|
95
117
|
@source inline("grouped");
|
|
118
|
+
@source inline("h-12");
|
|
96
119
|
@source inline("hook");
|
|
97
120
|
@source inline("hooks");
|
|
98
121
|
@source inline("hover:bg-fd-accent");
|
|
99
122
|
@source inline("hover:text-fd-accent-foreground");
|
|
100
123
|
@source inline("href");
|
|
101
124
|
@source inline("i18n");
|
|
102
|
-
@source inline("
|
|
125
|
+
@source inline("i18nProvider");
|
|
103
126
|
@source inline("if");
|
|
104
127
|
@source inline("import");
|
|
105
128
|
@source inline("in");
|
|
129
|
+
@source inline("indexPath");
|
|
106
130
|
@source inline("inherit");
|
|
131
|
+
@source inline("inheritLayoutProps");
|
|
132
|
+
@source inline("inherited");
|
|
107
133
|
@source inline("inline-flex");
|
|
108
134
|
@source inline("interface");
|
|
135
|
+
@source inline("is");
|
|
136
|
+
@source inline("isBlog");
|
|
109
137
|
@source inline("isLoading");
|
|
138
|
+
@source inline("it");
|
|
110
139
|
@source inline("item");
|
|
111
140
|
@source inline("items");
|
|
112
141
|
@source inline("items-center");
|
|
113
142
|
@source inline("items-start");
|
|
114
143
|
@source inline("joinPathname");
|
|
115
144
|
@source inline("key");
|
|
145
|
+
@source inline("keyof");
|
|
146
|
+
@source inline("label");
|
|
116
147
|
@source inline("lang");
|
|
117
148
|
@source inline("language");
|
|
118
|
-
@source inline("languages");
|
|
119
149
|
@source inline("lastModified");
|
|
120
150
|
@source inline("layout");
|
|
121
151
|
@source inline("layoutData");
|
|
@@ -126,10 +156,9 @@
|
|
|
126
156
|
@source inline("let");
|
|
127
157
|
@source inline("loaderConfig");
|
|
128
158
|
@source inline("locale");
|
|
129
|
-
@source inline("locales");
|
|
130
159
|
@source inline("lucide-react");
|
|
131
160
|
@source inline("markdownUrl");
|
|
132
|
-
@source inline("
|
|
161
|
+
@source inline("matchingBlogPosts");
|
|
133
162
|
@source inline("max-h-[min(600px,calc(100vh---spacing(30)))]");
|
|
134
163
|
@source inline("max-sm:-mx-4");
|
|
135
164
|
@source inline("max-w-[1400px]");
|
|
@@ -146,25 +175,26 @@
|
|
|
146
175
|
@source inline("mt-6");
|
|
147
176
|
@source inline("mt-auto");
|
|
148
177
|
@source inline("mx-auto");
|
|
149
|
-
@source inline("name");
|
|
150
|
-
@source inline("never");
|
|
151
178
|
@source inline("new");
|
|
152
179
|
@source inline("of");
|
|
180
|
+
@source inline("on");
|
|
153
181
|
@source inline("onClick");
|
|
154
182
|
@source inline("onCopy");
|
|
155
183
|
@source inline("onOpenChange");
|
|
156
184
|
@source inline("onSearchChange");
|
|
185
|
+
@source inline("only");
|
|
157
186
|
@source inline("open");
|
|
158
187
|
@source inline("option");
|
|
159
188
|
@source inline("options");
|
|
160
189
|
@source inline("orderedPosts");
|
|
190
|
+
@source inline("outer");
|
|
161
191
|
@source inline("overline");
|
|
162
192
|
@source inline("p-1");
|
|
163
193
|
@source inline("p-4");
|
|
164
194
|
@source inline("page");
|
|
165
195
|
@source inline("pageProps");
|
|
166
196
|
@source inline("panelButtonVariants");
|
|
167
|
-
@source inline("
|
|
197
|
+
@source inline("payload");
|
|
168
198
|
@source inline("pb-6");
|
|
169
199
|
@source inline("posts");
|
|
170
200
|
@source inline("primary");
|
|
@@ -174,7 +204,6 @@
|
|
|
174
204
|
@source inline("pt-2");
|
|
175
205
|
@source inline("pt-3.5");
|
|
176
206
|
@source inline("pt-4");
|
|
177
|
-
@source inline("pt-6");
|
|
178
207
|
@source inline("px-1.5");
|
|
179
208
|
@source inline("px-2");
|
|
180
209
|
@source inline("px-3");
|
|
@@ -182,12 +211,16 @@
|
|
|
182
211
|
@source inline("py-0.5");
|
|
183
212
|
@source inline("py-1");
|
|
184
213
|
@source inline("py-2");
|
|
214
|
+
@source inline("py-6");
|
|
185
215
|
@source inline("query");
|
|
186
216
|
@source inline("r");
|
|
187
217
|
@source inline("react");
|
|
218
|
+
@source inline("rel");
|
|
188
219
|
@source inline("render");
|
|
189
220
|
@source inline("renderCtx");
|
|
190
221
|
@source inline("renderRootMeta");
|
|
222
|
+
@source inline("replacements");
|
|
223
|
+
@source inline("resolved");
|
|
191
224
|
@source inline("result");
|
|
192
225
|
@source inline("return");
|
|
193
226
|
@source inline("root");
|
|
@@ -196,7 +229,9 @@
|
|
|
196
229
|
@source inline("rounded-lg");
|
|
197
230
|
@source inline("rounded-xl");
|
|
198
231
|
@source inline("schema");
|
|
232
|
+
@source inline("schemaId");
|
|
199
233
|
@source inline("search");
|
|
234
|
+
@source inline("server");
|
|
200
235
|
@source inline("setOpen");
|
|
201
236
|
@source inline("shadow-inner");
|
|
202
237
|
@source inline("shadow-md");
|
|
@@ -210,13 +245,23 @@
|
|
|
210
245
|
@source inline("sm:grid-cols-3");
|
|
211
246
|
@source inline("sm:max-w-[400px]");
|
|
212
247
|
@source inline("sm:rounded-xl");
|
|
248
|
+
@source inline("so");
|
|
213
249
|
@source inline("source");
|
|
214
250
|
@source inline("specify");
|
|
215
251
|
@source inline("static");
|
|
216
252
|
@source inline("string");
|
|
253
|
+
@source inline("styleTag");
|
|
217
254
|
@source inline("styles");
|
|
255
|
+
@source inline("stylesheet");
|
|
256
|
+
@source inline("sure");
|
|
257
|
+
@source inline("swap");
|
|
258
|
+
@source inline("t");
|
|
259
|
+
@source inline("tag");
|
|
260
|
+
@source inline("tagTitle");
|
|
218
261
|
@source inline("tags");
|
|
262
|
+
@source inline("tagsInTotal");
|
|
219
263
|
@source inline("tagsPath");
|
|
264
|
+
@source inline("text");
|
|
220
265
|
@source inline("text-2xl");
|
|
221
266
|
@source inline("text-3xl");
|
|
222
267
|
@source inline("text-fd-card-foreground");
|
|
@@ -227,29 +272,38 @@
|
|
|
227
272
|
@source inline("text-xs");
|
|
228
273
|
@source inline("the");
|
|
229
274
|
@source inline("this");
|
|
275
|
+
@source inline("throw");
|
|
230
276
|
@source inline("title");
|
|
231
277
|
@source inline("to");
|
|
232
278
|
@source inline("toc");
|
|
233
279
|
@source inline("transition-all");
|
|
234
280
|
@source inline("transition-colors");
|
|
235
281
|
@source inline("transition-transform");
|
|
236
|
-
@source inline("
|
|
282
|
+
@source inline("translated");
|
|
283
|
+
@source inline("translationsConfig");
|
|
237
284
|
@source inline("tree");
|
|
285
|
+
@source inline("true");
|
|
238
286
|
@source inline("truncate");
|
|
239
287
|
@source inline("type");
|
|
240
|
-
@source inline("
|
|
288
|
+
@source inline("typeof");
|
|
241
289
|
@source inline("unstable_notFound");
|
|
242
290
|
@source inline("url");
|
|
243
291
|
@source inline("use");
|
|
244
292
|
@source inline("useCopyButton");
|
|
245
293
|
@source inline("useDocsSearch");
|
|
246
294
|
@source inline("useI18n");
|
|
295
|
+
@source inline("useMemo");
|
|
247
296
|
@source inline("useState");
|
|
248
297
|
@source inline("useTOCItems");
|
|
298
|
+
@source inline("useTranslations");
|
|
299
|
+
@source inline("useTranslationsBase");
|
|
300
|
+
@source inline("value");
|
|
249
301
|
@source inline("variant");
|
|
250
302
|
@source inline("w-full");
|
|
251
303
|
@source inline("waku");
|
|
304
|
+
@source inline("wrapper");
|
|
252
305
|
@source inline("xl:grid-cols-4");
|
|
253
306
|
@source inline("xl:grid-cols-6");
|
|
307
|
+
@source inline("you");
|
|
254
308
|
@source inline("z-2");
|
|
255
309
|
@source inline("z-20");
|
|
@@ -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 };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, use, useMemo } from "react";
|
|
4
|
+
//#region src/components/openapi.payload.tsx
|
|
5
|
+
const Context = createContext(null);
|
|
6
|
+
function PayloadProvider({ payload, children }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(Context, {
|
|
8
|
+
value: useMemo(() => JSON.parse(payload), [payload]),
|
|
9
|
+
children
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function WithPayload({ schemaId, Comp, props }) {
|
|
13
|
+
const payload = use(Context)?.[schemaId];
|
|
14
|
+
if (!payload) throw new Error(`[Fumapress] Failed to find OpenAPI payload for schema "${schemaId}", do you sure it is defined in createOpenAPI()?`);
|
|
15
|
+
return /* @__PURE__ */ jsx(Comp, {
|
|
16
|
+
payload,
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { PayloadProvider, WithPayload };
|
|
@@ -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
|
-
import { Adapter, Awaitable,
|
|
3
|
-
import { ComponentType, ReactNode } from "react";
|
|
4
|
-
import { TranslationsOption } from "fumadocs-ui/contexts/i18n";
|
|
2
|
+
import { Adapter, Awaitable, ServerPluginOption } from "./lib/types.js";
|
|
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,45 +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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
}>;
|
|
32
|
+
meta?: MetaConfig<NoInfer<C>>;
|
|
31
33
|
}
|
|
32
34
|
interface Layouts<C extends ConfigContext = ConfigContext> {
|
|
33
|
-
root:
|
|
35
|
+
root: FC<{
|
|
34
36
|
lang?: string;
|
|
35
|
-
ctx: AppContext<C>;
|
|
36
37
|
children: ReactNode;
|
|
37
|
-
}
|
|
38
|
-
|
|
38
|
+
}> & {
|
|
39
|
+
$ctx?: C;
|
|
40
|
+
};
|
|
41
|
+
page: FC<{
|
|
39
42
|
lang?: string;
|
|
40
43
|
slugs: string[];
|
|
41
|
-
ctx: AppContext<C>;
|
|
42
44
|
page: C["loaderConfig"]["page"];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
+
}> & {
|
|
46
|
+
$ctx?: C;
|
|
47
|
+
};
|
|
48
|
+
notFound: FC<{
|
|
45
49
|
lang?: string;
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
}> & {
|
|
51
|
+
$ctx?: C;
|
|
52
|
+
};
|
|
48
53
|
/**
|
|
49
|
-
* Define default props for
|
|
54
|
+
* Define default props for all Fumadocs layouts, will be deep-merged with current props.
|
|
50
55
|
*/
|
|
51
56
|
defaultProps?: (this: AppContext<C>, env: {
|
|
52
57
|
lang: string | undefined;
|
|
53
58
|
}) => Awaitable<Omit<BaseLayoutProps, "children">>;
|
|
54
59
|
}
|
|
55
|
-
interface I18nConfig$1<Lang extends string = string> extends Pick<I18nConfig<NoInfer<Lang>>, "defaultLanguage" | "fallbackLanguage" | "parser"> {
|
|
56
|
-
/** locale code -> language info */
|
|
57
|
-
languages: { [K in Lang]: {
|
|
58
|
-
displayName: string;
|
|
59
|
-
translations?: TranslationsOption;
|
|
60
|
-
} };
|
|
61
|
-
}
|
|
62
60
|
interface MetaConfig<C extends ConfigContext = ConfigContext> {
|
|
63
61
|
/** render meta tags for any pages */
|
|
64
62
|
root?: (this: AppContext<C>) => ReactNode;
|
|
@@ -76,14 +74,16 @@ interface SiteConfig {
|
|
|
76
74
|
rootDir?: string;
|
|
77
75
|
};
|
|
78
76
|
}
|
|
79
|
-
interface I18nConfigBuilder<Lang extends string> extends I18nConfig$1<Lang> {
|
|
80
|
-
/** convert Fumapress i18n config to core i18n config */
|
|
81
|
-
toCore: () => I18nConfig<Lang>;
|
|
82
|
-
}
|
|
83
77
|
interface ConfigBuilder<C extends ConfigContext> extends Config<C> {
|
|
84
|
-
|
|
78
|
+
/** for type inference only, always `undefined` */
|
|
79
|
+
$context: C;
|
|
80
|
+
getPlugins: () => ServerPluginOption<C>[];
|
|
81
|
+
getLayouts: () => Partial<Layouts<C>>;
|
|
82
|
+
getAdapters: () => Adapter<C>[];
|
|
83
|
+
usePlugins: (...plugins: ServerPluginOption<C>[]) => ConfigBuilder<C>;
|
|
85
84
|
useLayouts: (layouts: Partial<Layouts<C>>) => ConfigBuilder<C>;
|
|
86
|
-
|
|
85
|
+
/** Add adapter for content sources */
|
|
86
|
+
useAdapters: (...adapters: Adapter<C>[]) => ConfigBuilder<C>;
|
|
87
87
|
}
|
|
88
88
|
declare function defineConfig<C extends LoaderConfig, L extends string = string>(config: Config<{
|
|
89
89
|
loaderConfig: C;
|
|
@@ -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 };
|