@farming-labs/next 0.1.59 → 0.1.60
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/api-reference.d.mts +3 -1
- package/dist/api-reference.mjs +136 -36
- package/dist/changelog-rail-search.d.mts +1 -1
- package/dist/changelog-rail-search.mjs +1 -1
- package/dist/changelog.d.mts +1 -1
- package/dist/changelog.mjs +1 -1
- package/dist/client-callbacks.d.mts +3 -1
- package/dist/client-callbacks.mjs +26 -1
- package/package.json +3 -3
- package/styles/api-reference.css +239 -3
package/dist/api-reference.d.mts
CHANGED
|
@@ -10,6 +10,7 @@ interface NextApiReferenceSourceState {
|
|
|
10
10
|
title: string;
|
|
11
11
|
description?: string;
|
|
12
12
|
};
|
|
13
|
+
primaryServerUrl?: string;
|
|
13
14
|
pages: Array<{
|
|
14
15
|
url: string;
|
|
15
16
|
} & Record<string, any>>;
|
|
@@ -21,6 +22,7 @@ interface NextApiReferenceSourceState {
|
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
24
|
declare function buildNextOpenApiDocument(config: DocsConfig): Record<string, unknown>;
|
|
25
|
+
declare function flattenApiReferencePageTreeForSidebar(tree: any): any;
|
|
24
26
|
declare function withNextApiReferenceBanner(config: DocsConfig): DocsConfig;
|
|
25
27
|
declare function createNextApiReference(config: DocsConfig): (request?: Request) => Promise<Response>;
|
|
26
28
|
declare function createNextApiReferencePage(config: DocsConfig): (props?: {
|
|
@@ -36,4 +38,4 @@ declare function createNextApiReferenceLayout(config: DocsConfig): (props: {
|
|
|
36
38
|
declare function getNextApiReferenceSourceState(config: DocsConfig): Promise<NextApiReferenceSourceState>;
|
|
37
39
|
declare function getNextApiReferenceMode(config: DocsConfig): "fumadocs" | "scalar";
|
|
38
40
|
//#endregion
|
|
39
|
-
export { NextApiReferenceSourceState, buildNextOpenApiDocument, createNextApiReference, createNextApiReferenceLayout, createNextApiReferencePage, getNextApiReferenceMode, getNextApiReferenceSourceState, resolveApiReferenceConfig, withNextApiReferenceBanner };
|
|
41
|
+
export { NextApiReferenceSourceState, buildNextOpenApiDocument, createNextApiReference, createNextApiReferenceLayout, createNextApiReferencePage, flattenApiReferencePageTreeForSidebar, getNextApiReferenceMode, getNextApiReferenceSourceState, resolveApiReferenceConfig, withNextApiReferenceBanner };
|
package/dist/api-reference.mjs
CHANGED
|
@@ -115,11 +115,21 @@ function getForwardedHeaderValue(value) {
|
|
|
115
115
|
if (!value) return void 0;
|
|
116
116
|
return value.split(",").map((entry) => entry.trim()).find(Boolean) || void 0;
|
|
117
117
|
}
|
|
118
|
+
function getOriginFromHeaderUrl(value) {
|
|
119
|
+
if (!value) return void 0;
|
|
120
|
+
try {
|
|
121
|
+
return new URL(value).origin;
|
|
122
|
+
} catch {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
118
126
|
async function getOriginFromNextHeaders() {
|
|
119
127
|
const { headers } = await import("next/headers");
|
|
120
128
|
const headerList = await headers();
|
|
129
|
+
const hintedOrigin = getOriginFromHeaderUrl(headerList.get("origin")) ?? getOriginFromHeaderUrl(headerList.get("referer"));
|
|
130
|
+
if (hintedOrigin) return hintedOrigin;
|
|
121
131
|
const host = getForwardedHeaderValue(headerList.get("x-forwarded-host")) ?? getForwardedHeaderValue(headerList.get("host"));
|
|
122
|
-
if (!host) return
|
|
132
|
+
if (!host || host === "loading") return process.env.FARMING_LABS_DOCS_DEV_ORIGIN;
|
|
123
133
|
return `${getForwardedHeaderValue(headerList.get("x-forwarded-proto")) ?? "https"}://${host}`;
|
|
124
134
|
}
|
|
125
135
|
function buildPathParameters(fsSegments) {
|
|
@@ -255,6 +265,8 @@ function buildNextOpenApiDocument(config) {
|
|
|
255
265
|
function SwitcherGlyph({ kind, radius, active }) {
|
|
256
266
|
const isApi = kind === "api";
|
|
257
267
|
return /* @__PURE__ */ jsx("span", {
|
|
268
|
+
className: "fd-api-reference-switcher-glyph",
|
|
269
|
+
"data-active": active ? "true" : "false",
|
|
258
270
|
"aria-hidden": "true",
|
|
259
271
|
style: {
|
|
260
272
|
display: "inline-flex",
|
|
@@ -262,11 +274,8 @@ function SwitcherGlyph({ kind, radius, active }) {
|
|
|
262
274
|
height: 22,
|
|
263
275
|
alignItems: "center",
|
|
264
276
|
justifyContent: "center",
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
background: "color-mix(in srgb, var(--color-fd-card, #161616) 92%, transparent)",
|
|
268
|
-
color: active ? "var(--color-fd-primary, currentColor)" : "var(--color-fd-muted-foreground, rgba(255,255,255,0.72))",
|
|
269
|
-
boxShadow: "0 0 0 1px color-mix(in srgb, var(--color-fd-border, #2a2a2a) 32%, transparent)"
|
|
277
|
+
color: active ? "var(--color-fd-primary, currentColor)" : "var(--fd-api-switcher-muted, var(--color-fd-muted-foreground, rgba(255,255,255,0.72)))",
|
|
278
|
+
borderRadius: radius
|
|
270
279
|
},
|
|
271
280
|
children: isApi ? /* @__PURE__ */ jsx("svg", {
|
|
272
281
|
width: "13",
|
|
@@ -296,12 +305,12 @@ function SwitcherGlyph({ kind, radius, active }) {
|
|
|
296
305
|
}
|
|
297
306
|
function ChevronStack() {
|
|
298
307
|
return /* @__PURE__ */ jsxs("span", {
|
|
308
|
+
className: "fd-api-reference-switcher-chevron",
|
|
299
309
|
"aria-hidden": "true",
|
|
300
310
|
style: {
|
|
301
311
|
display: "inline-flex",
|
|
302
312
|
flexDirection: "column",
|
|
303
|
-
gap: 2
|
|
304
|
-
color: "var(--color-fd-muted-foreground, rgba(255,255,255,0.65))"
|
|
313
|
+
gap: 2
|
|
305
314
|
},
|
|
306
315
|
children: [/* @__PURE__ */ jsx("svg", {
|
|
307
316
|
width: "11",
|
|
@@ -475,9 +484,42 @@ function ApiReferenceThemeBridge({ config }) {
|
|
|
475
484
|
forcedTheme ? /* @__PURE__ */ jsx(ApiReferenceForcedThemeScript, { theme: forcedTheme }) : null
|
|
476
485
|
] });
|
|
477
486
|
}
|
|
487
|
+
function ApiReferenceServerUrlPatchScript({ serverUrl }) {
|
|
488
|
+
if (!serverUrl) return null;
|
|
489
|
+
return /* @__PURE__ */ jsx("script", {
|
|
490
|
+
id: "fd-api-reference-server-url-patch",
|
|
491
|
+
dangerouslySetInnerHTML: { __html: `(function () {
|
|
492
|
+
var raw = ${JSON.stringify(serverUrl)};
|
|
493
|
+
var resolve = function () {
|
|
494
|
+
try {
|
|
495
|
+
return new URL(raw, window.location.origin).toString();
|
|
496
|
+
} catch {
|
|
497
|
+
return window.location.origin;
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
var apply = function () {
|
|
501
|
+
var label = resolve();
|
|
502
|
+
document
|
|
503
|
+
.querySelectorAll('.fd-api-reference-route button[aria-haspopup="dialog"] code.truncate')
|
|
504
|
+
.forEach(function (node) {
|
|
505
|
+
if (node.textContent && node.textContent.trim() === 'loading...') {
|
|
506
|
+
node.textContent = label;
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
apply();
|
|
512
|
+
window.requestAnimationFrame(apply);
|
|
513
|
+
window.setTimeout(apply, 200);
|
|
514
|
+
window.setTimeout(apply, 1200);
|
|
515
|
+
})();` }
|
|
516
|
+
});
|
|
517
|
+
}
|
|
478
518
|
function SwitcherOption({ href, kind, title, description, current, config }) {
|
|
479
519
|
const theme = getApiReferenceSwitcherTheme(config);
|
|
480
520
|
return /* @__PURE__ */ jsxs(Link, {
|
|
521
|
+
className: "fd-api-reference-switcher-option",
|
|
522
|
+
"data-current": current ? "true" : "false",
|
|
481
523
|
href,
|
|
482
524
|
prefetch: true,
|
|
483
525
|
style: {
|
|
@@ -489,7 +531,6 @@ function SwitcherOption({ href, kind, title, description, current, config }) {
|
|
|
489
531
|
borderRadius: "0.625rem",
|
|
490
532
|
textDecoration: "none",
|
|
491
533
|
color: "inherit",
|
|
492
|
-
background: current ? "linear-gradient(90deg, color-mix(in srgb, var(--color-fd-primary, #facc15) 20%, transparent), color-mix(in srgb, var(--color-fd-primary, #facc15) 14%, transparent))" : "transparent",
|
|
493
534
|
backgroundImage: current ? theme.backgroundImage : void 0
|
|
494
535
|
},
|
|
495
536
|
children: [/* @__PURE__ */ jsx("span", {
|
|
@@ -530,27 +571,30 @@ function SwitcherOption({ href, kind, title, description, current, config }) {
|
|
|
530
571
|
function ApiReferenceSwitcher({ docsUrl, apiUrl, current, config }) {
|
|
531
572
|
const currentLabel = current === "api" ? "API Reference" : "Documentation";
|
|
532
573
|
const theme = getApiReferenceSwitcherTheme(config);
|
|
574
|
+
const themeStyle = resolveApiReferenceThemeStyle(config);
|
|
575
|
+
const switcherStyle = {
|
|
576
|
+
position: "relative",
|
|
577
|
+
marginBottom: 16,
|
|
578
|
+
overflow: "hidden",
|
|
579
|
+
backgroundImage: theme.backgroundImage,
|
|
580
|
+
boxShadow: theme.boxShadow,
|
|
581
|
+
["--fd-api-switcher-card-radius"]: theme.cardRadius,
|
|
582
|
+
["--fd-api-switcher-icon-radius"]: theme.iconRadius,
|
|
583
|
+
["--fd-api-switcher-shadow"]: theme.boxShadow
|
|
584
|
+
};
|
|
533
585
|
return /* @__PURE__ */ jsxs("details", {
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
borderRadius: theme.cardRadius,
|
|
538
|
-
border: "1px solid color-mix(in srgb, var(--color-fd-border, #2a2a2a) 100%, transparent)",
|
|
539
|
-
background: "color-mix(in srgb, var(--color-fd-card, #141414) 94%, transparent)",
|
|
540
|
-
boxShadow: theme.boxShadow,
|
|
541
|
-
overflow: "hidden",
|
|
542
|
-
backgroundImage: theme.backgroundImage
|
|
543
|
-
},
|
|
586
|
+
className: "fd-api-reference-switcher",
|
|
587
|
+
"data-theme-style": themeStyle,
|
|
588
|
+
style: switcherStyle,
|
|
544
589
|
children: [/* @__PURE__ */ jsxs("summary", {
|
|
590
|
+
className: "fd-api-reference-switcher-summary",
|
|
545
591
|
style: {
|
|
546
|
-
listStyle: "none",
|
|
547
592
|
display: "flex",
|
|
548
593
|
alignItems: "center",
|
|
549
594
|
justifyContent: "space-between",
|
|
550
595
|
gap: 10,
|
|
551
596
|
cursor: "pointer",
|
|
552
|
-
padding: "10px 13px"
|
|
553
|
-
background: "color-mix(in srgb, var(--color-fd-card, #202020) 96%, transparent)"
|
|
597
|
+
padding: "10px 13px"
|
|
554
598
|
},
|
|
555
599
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
556
600
|
style: {
|
|
@@ -573,12 +617,12 @@ function ApiReferenceSwitcher({ docsUrl, apiUrl, current, config }) {
|
|
|
573
617
|
})]
|
|
574
618
|
}), /* @__PURE__ */ jsx(ChevronStack, {})]
|
|
575
619
|
}), /* @__PURE__ */ jsxs("div", {
|
|
620
|
+
className: "fd-api-reference-switcher-options",
|
|
576
621
|
style: {
|
|
577
622
|
display: "flex",
|
|
578
623
|
flexDirection: "column",
|
|
579
624
|
gap: 2,
|
|
580
|
-
padding: "8px 8px 9px"
|
|
581
|
-
background: "color-mix(in srgb, var(--color-fd-card, #151515) 96%, transparent)"
|
|
625
|
+
padding: "8px 8px 9px"
|
|
582
626
|
},
|
|
583
627
|
children: [/* @__PURE__ */ jsx(SwitcherOption, {
|
|
584
628
|
href: docsUrl,
|
|
@@ -602,6 +646,9 @@ function getExistingSidebarBanner(config) {
|
|
|
602
646
|
if (!config.sidebar || config.sidebar === true) return void 0;
|
|
603
647
|
return config.sidebar.banner;
|
|
604
648
|
}
|
|
649
|
+
function resolveApiReferenceThemeStyle(config) {
|
|
650
|
+
if ((config.theme?.name?.toLowerCase() ?? "").includes("colorful")) return "colorful";
|
|
651
|
+
}
|
|
605
652
|
function mergeBanner(existing, next) {
|
|
606
653
|
if (!existing) return next;
|
|
607
654
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -613,6 +660,45 @@ function mergeBanner(existing, next) {
|
|
|
613
660
|
children: [existing, next]
|
|
614
661
|
});
|
|
615
662
|
}
|
|
663
|
+
function flattenApiReferencePageTreeForSidebar(tree) {
|
|
664
|
+
if (!tree || typeof tree !== "object") return tree;
|
|
665
|
+
const root = tree;
|
|
666
|
+
if (!Array.isArray(root.children) || root.children.length !== 1) return tree;
|
|
667
|
+
const [onlyChild] = root.children;
|
|
668
|
+
if (!onlyChild || typeof onlyChild !== "object") return tree;
|
|
669
|
+
const folder = onlyChild;
|
|
670
|
+
if (folder.type !== "folder" || !Array.isArray(folder.children)) return tree;
|
|
671
|
+
const nextChildren = [...folder.index ? [folder.index] : [], ...folder.children];
|
|
672
|
+
if (nextChildren.length === 0) return tree;
|
|
673
|
+
return {
|
|
674
|
+
...root,
|
|
675
|
+
children: nextChildren
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
function renderApiReferenceOperationLayout(slots) {
|
|
679
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
680
|
+
className: "fd-api-reference-operation",
|
|
681
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
682
|
+
className: "fd-api-reference-operation-main",
|
|
683
|
+
children: [
|
|
684
|
+
slots.header,
|
|
685
|
+
slots.apiPlayground,
|
|
686
|
+
slots.description ? /* @__PURE__ */ jsx("div", {
|
|
687
|
+
className: "fd-api-reference-operation-description",
|
|
688
|
+
children: slots.description
|
|
689
|
+
}) : null,
|
|
690
|
+
slots.authSchemes,
|
|
691
|
+
slots.parameters,
|
|
692
|
+
slots.body,
|
|
693
|
+
slots.responses,
|
|
694
|
+
slots.callbacks
|
|
695
|
+
]
|
|
696
|
+
}), slots.apiExample ? /* @__PURE__ */ jsx("div", {
|
|
697
|
+
className: "fd-api-reference-operation-example",
|
|
698
|
+
children: slots.apiExample
|
|
699
|
+
}) : null]
|
|
700
|
+
});
|
|
701
|
+
}
|
|
616
702
|
function withNextApiReferenceBanner(config) {
|
|
617
703
|
const apiReference = resolveApiReferenceConfig(config.apiReference);
|
|
618
704
|
if (!apiReference.enabled) return config;
|
|
@@ -678,7 +764,7 @@ function getOpenApiInfo(document) {
|
|
|
678
764
|
}
|
|
679
765
|
function createNextApiReferencePage(config) {
|
|
680
766
|
return async function NextApiReferencePage(props) {
|
|
681
|
-
const [{ createAPIPage }, {
|
|
767
|
+
const [{ createAPIPage }, { DocsDescription, DocsPage, DocsTitle }] = await Promise.all([import("fumadocs-openapi/ui"), import("fumadocs-ui/layouts/notebook/page")]);
|
|
682
768
|
const { info, pages, server, source } = await getNextApiReferenceSourceState(config);
|
|
683
769
|
const slug = (props?.params ? await props.params : void 0)?.slug ?? [];
|
|
684
770
|
if (pages.length === 0) return /* @__PURE__ */ jsxs(DocsPage, {
|
|
@@ -686,15 +772,18 @@ function createNextApiReferencePage(config) {
|
|
|
686
772
|
children: [
|
|
687
773
|
/* @__PURE__ */ jsx(DocsTitle, { children: info.title }),
|
|
688
774
|
/* @__PURE__ */ jsx(DocsDescription, { children: info.description }),
|
|
689
|
-
/* @__PURE__ */ jsx(
|
|
690
|
-
className: "
|
|
691
|
-
children:
|
|
692
|
-
|
|
775
|
+
/* @__PURE__ */ jsx("div", {
|
|
776
|
+
className: "fd-api-reference-body",
|
|
777
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
778
|
+
className: "rounded-xl border border-fd-border bg-fd-card p-6 text-sm text-fd-muted-foreground",
|
|
779
|
+
children: "No operations were found in the OpenAPI document."
|
|
780
|
+
})
|
|
781
|
+
})
|
|
693
782
|
]
|
|
694
783
|
});
|
|
695
784
|
const page = slug.length === 0 ? pages[0] : source.getPage(slug);
|
|
696
785
|
if (!page || typeof page.data?.getAPIPageProps !== "function") notFound();
|
|
697
|
-
const APIPage = createAPIPage(server);
|
|
786
|
+
const APIPage = createAPIPage(server, { content: { renderOperationLayout: renderApiReferenceOperationLayout } });
|
|
698
787
|
const currentPageIndex = slug.length === 0 ? 0 : pages.findIndex((entry) => entry.url === page.url);
|
|
699
788
|
const previousPage = currentPageIndex > 0 ? pages[currentPageIndex - 1] : void 0;
|
|
700
789
|
const nextPage = currentPageIndex >= 0 && currentPageIndex < pages.length - 1 ? pages[currentPageIndex + 1] : void 0;
|
|
@@ -706,7 +795,10 @@ function createNextApiReferencePage(config) {
|
|
|
706
795
|
children: [
|
|
707
796
|
/* @__PURE__ */ jsx(DocsTitle, { children: page.data.title ?? info.title }),
|
|
708
797
|
/* @__PURE__ */ jsx(DocsDescription, { children: typeof page.data.description === "string" && page.data.description.trim() ? page.data.description : info.description }),
|
|
709
|
-
/* @__PURE__ */ jsx(
|
|
798
|
+
/* @__PURE__ */ jsx("div", {
|
|
799
|
+
className: "fd-api-reference-body",
|
|
800
|
+
children: /* @__PURE__ */ jsx(APIPage, { ...page.data.getAPIPageProps() })
|
|
801
|
+
}),
|
|
710
802
|
previousPage || nextPage ? /* @__PURE__ */ jsxs("nav", {
|
|
711
803
|
className: "fd-api-reference-pagination",
|
|
712
804
|
"aria-label": "API reference pagination",
|
|
@@ -763,10 +855,12 @@ function createNextApiReferencePage(config) {
|
|
|
763
855
|
function createNextApiReferenceLayout(config) {
|
|
764
856
|
return async function NextApiReferenceLayout(props) {
|
|
765
857
|
const { DocsLayout } = await import("fumadocs-ui/layouts/notebook");
|
|
766
|
-
const { apiReference, source } = await getNextApiReferenceSourceState(config);
|
|
858
|
+
const { apiReference, primaryServerUrl, source } = await getNextApiReferenceSourceState(config);
|
|
859
|
+
const sidebarTree = flattenApiReferencePageTreeForSidebar(source.getPageTree());
|
|
767
860
|
const docsUrl = getDocsUrl(config);
|
|
768
861
|
const apiUrl = `/${apiReference.path}`;
|
|
769
862
|
const themeSwitch = resolveApiReferenceThemeSwitch(config.themeToggle);
|
|
863
|
+
const themeStyle = resolveApiReferenceThemeStyle(config);
|
|
770
864
|
const banner = mergeBanner(getExistingSidebarBanner(config), /* @__PURE__ */ jsx(ApiReferenceSwitcher, {
|
|
771
865
|
docsUrl,
|
|
772
866
|
apiUrl,
|
|
@@ -776,15 +870,20 @@ function createNextApiReferenceLayout(config) {
|
|
|
776
870
|
return /* @__PURE__ */ jsxs("div", {
|
|
777
871
|
className: "fd-api-reference-route",
|
|
778
872
|
"data-api-reference": "",
|
|
779
|
-
|
|
780
|
-
|
|
873
|
+
"data-theme-style": themeStyle,
|
|
874
|
+
children: [/* @__PURE__ */ jsx(DocsClientCallbacks, { apiReferencePrimaryServerUrl: primaryServerUrl }), /* @__PURE__ */ jsxs(DocsLayout, {
|
|
875
|
+
tree: sidebarTree,
|
|
781
876
|
sidebar: { banner },
|
|
782
877
|
themeSwitch,
|
|
783
878
|
nav: {
|
|
784
879
|
title: config.nav?.title ?? "Docs",
|
|
785
880
|
url: getDocsUrl(config)
|
|
786
881
|
},
|
|
787
|
-
children: [
|
|
882
|
+
children: [
|
|
883
|
+
/* @__PURE__ */ jsx(ApiReferenceThemeBridge, { config }),
|
|
884
|
+
/* @__PURE__ */ jsx(ApiReferenceServerUrlPatchScript, { serverUrl: primaryServerUrl }),
|
|
885
|
+
props.children
|
|
886
|
+
]
|
|
788
887
|
})]
|
|
789
888
|
});
|
|
790
889
|
};
|
|
@@ -816,6 +915,7 @@ async function getNextApiReferenceSourceState(config) {
|
|
|
816
915
|
apiReference,
|
|
817
916
|
document,
|
|
818
917
|
info,
|
|
918
|
+
primaryServerUrl: Array.isArray(document.servers) && typeof document.servers?.[0]?.url === "string" ? document.servers?.[0]?.url ?? void 0 : void 0,
|
|
819
919
|
pages: source.getPages(),
|
|
820
920
|
server,
|
|
821
921
|
source
|
|
@@ -826,4 +926,4 @@ function getNextApiReferenceMode(config) {
|
|
|
826
926
|
}
|
|
827
927
|
|
|
828
928
|
//#endregion
|
|
829
|
-
export { buildNextOpenApiDocument, createNextApiReference, createNextApiReferenceLayout, createNextApiReferencePage, getNextApiReferenceMode, getNextApiReferenceSourceState, resolveApiReferenceConfig, withNextApiReferenceBanner };
|
|
929
|
+
export { buildNextOpenApiDocument, createNextApiReference, createNextApiReferenceLayout, createNextApiReferencePage, flattenApiReferencePageTreeForSidebar, getNextApiReferenceMode, getNextApiReferenceSourceState, resolveApiReferenceConfig, withNextApiReferenceBanner };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import Link from "next/link";
|
|
4
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
4
|
import { useEffect, useMemo, useState } from "react";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
|
|
7
7
|
//#region src/changelog-rail-search.tsx
|
|
8
8
|
const MAGIC_PROSE = "fd-changelog-prose prose dark:prose-invert max-w-none min-w-0 prose-headings:scroll-mt-8 prose-headings:font-semibold prose-a:no-underline prose-headings:tracking-tight prose-headings:text-balance prose-p:tracking-tight prose-p:text-balance";
|
package/dist/changelog.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { ComponentType } from "react";
|
|
1
2
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
3
|
import { DocsConfig } from "@farming-labs/theme";
|
|
3
4
|
import { ChangelogFrontmatter } from "@farming-labs/docs";
|
|
4
|
-
import { ComponentType } from "react";
|
|
5
5
|
import { Metadata } from "next";
|
|
6
6
|
|
|
7
7
|
//#region src/changelog.d.ts
|
package/dist/changelog.mjs
CHANGED
|
@@ -3,10 +3,10 @@ import { readFileSync } from "node:fs";
|
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import Link from "next/link";
|
|
5
5
|
import { notFound } from "next/navigation";
|
|
6
|
+
import { createElement, isValidElement } from "react";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
import { createPageMetadata } from "@farming-labs/theme";
|
|
8
9
|
import { resolveChangelogConfig } from "@farming-labs/docs";
|
|
9
|
-
import { createElement, isValidElement } from "react";
|
|
10
10
|
|
|
11
11
|
//#region src/changelog.tsx
|
|
12
12
|
function formatDisplayDate(value) {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/client-callbacks.d.ts
|
|
4
|
-
declare function DocsClientCallbacks(
|
|
4
|
+
declare function DocsClientCallbacks(props?: {
|
|
5
|
+
apiReferencePrimaryServerUrl?: string;
|
|
6
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
5
7
|
//#endregion
|
|
6
8
|
export { DocsClientCallbacks as default };
|
|
@@ -1,11 +1,36 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
import { useEffect } from "react";
|
|
3
4
|
import docsConfig from "@farming-labs/next-internal-docs-config";
|
|
4
5
|
import { DocsClientHooks } from "@farming-labs/theme/client-hooks";
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
6
7
|
|
|
7
8
|
//#region src/client-callbacks.tsx
|
|
8
|
-
function
|
|
9
|
+
function resolveApiReferenceServerLabel(url) {
|
|
10
|
+
if (!url) return window.location.origin;
|
|
11
|
+
try {
|
|
12
|
+
return new URL(url, window.location.origin).toString();
|
|
13
|
+
} catch {
|
|
14
|
+
return window.location.origin;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function DocsClientCallbacks(props) {
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (!props?.apiReferencePrimaryServerUrl) return;
|
|
20
|
+
const nextLabel = resolveApiReferenceServerLabel(props.apiReferencePrimaryServerUrl);
|
|
21
|
+
const timers = [
|
|
22
|
+
0,
|
|
23
|
+
200,
|
|
24
|
+
1e3
|
|
25
|
+
].map((delay) => window.setTimeout(() => {
|
|
26
|
+
document.querySelectorAll(".fd-api-reference-route button[aria-haspopup=\"dialog\"] code.truncate").forEach((node) => {
|
|
27
|
+
if (node.textContent?.trim() === "loading...") node.textContent = nextLabel;
|
|
28
|
+
});
|
|
29
|
+
}, delay));
|
|
30
|
+
return () => {
|
|
31
|
+
timers.forEach((timer) => window.clearTimeout(timer));
|
|
32
|
+
};
|
|
33
|
+
}, [props?.apiReferencePrimaryServerUrl]);
|
|
9
34
|
return /* @__PURE__ */ jsx(DocsClientHooks, {
|
|
10
35
|
onCopyClick: docsConfig.onCopyClick,
|
|
11
36
|
onFeedback: docsConfig.feedback && typeof docsConfig.feedback === "object" ? docsConfig.feedback.onFeedback : void 0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/next",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.60",
|
|
4
4
|
"description": "Next.js adapter for @farming-labs/docs — MDX config wrapper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -95,8 +95,8 @@
|
|
|
95
95
|
"tsdown": "^0.20.3",
|
|
96
96
|
"typescript": "^5.9.3",
|
|
97
97
|
"vitest": "^3.2.4",
|
|
98
|
-
"@farming-labs/docs": "0.1.
|
|
99
|
-
"@farming-labs/theme": "0.1.
|
|
98
|
+
"@farming-labs/docs": "0.1.60",
|
|
99
|
+
"@farming-labs/theme": "0.1.60"
|
|
100
100
|
},
|
|
101
101
|
"peerDependencies": {
|
|
102
102
|
"@farming-labs/docs": ">=0.0.1",
|
package/styles/api-reference.css
CHANGED
|
@@ -39,17 +39,238 @@
|
|
|
39
39
|
--color-fd-overlay: hsla(0, 0%, 0%, 0.2);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
.fd-api-reference-switcher {
|
|
43
|
+
--fd-api-switcher-card-radius: var(--radius, 0.75rem);
|
|
44
|
+
--fd-api-switcher-icon-radius: var(--radius, 0.75rem);
|
|
45
|
+
--fd-api-switcher-shadow: none;
|
|
46
|
+
--fd-api-switcher-surface: var(--color-fd-card);
|
|
47
|
+
--fd-api-switcher-summary-surface: color-mix(
|
|
48
|
+
in srgb,
|
|
49
|
+
var(--color-fd-secondary) 72%,
|
|
50
|
+
var(--color-fd-card) 28%
|
|
51
|
+
);
|
|
52
|
+
--fd-api-switcher-border: color-mix(in srgb, var(--color-fd-border) 92%, transparent);
|
|
53
|
+
--fd-api-switcher-muted: rgb(71 85 105 / 0.84);
|
|
54
|
+
--fd-api-switcher-current-surface: color-mix(
|
|
55
|
+
in srgb,
|
|
56
|
+
var(--color-fd-primary, rgb(214 145 0)) 12%,
|
|
57
|
+
var(--color-fd-card) 88%
|
|
58
|
+
);
|
|
59
|
+
--fd-api-switcher-current-border: color-mix(
|
|
60
|
+
in srgb,
|
|
61
|
+
var(--color-fd-primary, rgb(214 145 0)) 22%,
|
|
62
|
+
transparent
|
|
63
|
+
);
|
|
64
|
+
--fd-api-switcher-glyph-surface: color-mix(
|
|
65
|
+
in srgb,
|
|
66
|
+
var(--color-fd-secondary) 64%,
|
|
67
|
+
var(--color-fd-card) 36%
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.dark .fd-api-reference-switcher {
|
|
72
|
+
--fd-api-switcher-shadow: 0 0 0 1px rgb(255 255 255 / 0.06);
|
|
73
|
+
--fd-api-switcher-surface: color-mix(in srgb, rgb(20 20 20) 94%, transparent);
|
|
74
|
+
--fd-api-switcher-summary-surface: color-mix(in srgb, rgb(28 28 28) 96%, transparent);
|
|
75
|
+
--fd-api-switcher-border: rgb(255 255 255 / 0.08);
|
|
76
|
+
--fd-api-switcher-muted: rgb(255 255 255 / 0.68);
|
|
77
|
+
--fd-api-switcher-current-surface: color-mix(
|
|
78
|
+
in srgb,
|
|
79
|
+
var(--color-fd-primary, rgb(250 204 21)) 18%,
|
|
80
|
+
transparent
|
|
81
|
+
);
|
|
82
|
+
--fd-api-switcher-current-border: color-mix(
|
|
83
|
+
in srgb,
|
|
84
|
+
var(--color-fd-primary, rgb(250 204 21)) 22%,
|
|
85
|
+
rgb(255 255 255 / 0.08)
|
|
86
|
+
);
|
|
87
|
+
--fd-api-switcher-glyph-surface: color-mix(in srgb, rgb(28 28 28) 94%, transparent);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.fd-api-reference-switcher {
|
|
91
|
+
border: 1px solid var(--fd-api-switcher-border);
|
|
92
|
+
border-radius: var(--fd-api-switcher-card-radius);
|
|
93
|
+
background: var(--fd-api-switcher-surface);
|
|
94
|
+
box-shadow: var(--fd-api-switcher-shadow);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.fd-api-reference-switcher-summary {
|
|
98
|
+
list-style: none;
|
|
99
|
+
background: var(--fd-api-switcher-summary-surface);
|
|
100
|
+
border-radius: calc(var(--fd-api-switcher-card-radius) - 1px);
|
|
101
|
+
color: inherit;
|
|
102
|
+
border-bottom: 1px solid color-mix(in srgb, var(--fd-api-switcher-border) 72%, transparent);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.fd-api-reference-switcher-summary::-webkit-details-marker {
|
|
106
|
+
display: none;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.fd-api-reference-switcher-options {
|
|
110
|
+
background: var(--fd-api-switcher-surface);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.fd-api-reference-switcher-option {
|
|
114
|
+
border: 1px solid transparent;
|
|
115
|
+
transition:
|
|
116
|
+
background-color 150ms ease,
|
|
117
|
+
border-color 150ms ease,
|
|
118
|
+
color 150ms ease;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.fd-api-reference-switcher-option:hover {
|
|
122
|
+
background: color-mix(in srgb, var(--color-fd-accent) 55%, transparent);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.fd-api-reference-switcher-option[data-current="true"] {
|
|
126
|
+
background: var(--fd-api-switcher-current-surface);
|
|
127
|
+
border-color: var(--fd-api-switcher-current-border);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.fd-api-reference-switcher-glyph {
|
|
131
|
+
border: 1px solid var(--fd-api-switcher-border);
|
|
132
|
+
border-radius: var(--fd-api-switcher-icon-radius);
|
|
133
|
+
background: var(--fd-api-switcher-glyph-surface);
|
|
134
|
+
box-shadow: var(--fd-api-switcher-shadow);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.fd-api-reference-switcher-glyph[data-active="false"] {
|
|
138
|
+
color: var(--fd-api-switcher-muted);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.fd-api-reference-switcher-chevron {
|
|
142
|
+
color: var(--fd-api-switcher-muted);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.light .fd-api-reference-switcher {
|
|
146
|
+
--fd-api-switcher-surface: var(--color-fd-card);
|
|
147
|
+
--fd-api-switcher-summary-surface: color-mix(
|
|
148
|
+
in srgb,
|
|
149
|
+
var(--color-fd-primary) 12%,
|
|
150
|
+
var(--color-fd-card) 88%
|
|
151
|
+
);
|
|
152
|
+
--fd-api-switcher-current-surface: color-mix(
|
|
153
|
+
in srgb,
|
|
154
|
+
var(--color-fd-primary) 14%,
|
|
155
|
+
var(--color-fd-card) 86%
|
|
156
|
+
);
|
|
157
|
+
--fd-api-switcher-glyph-surface: color-mix(
|
|
158
|
+
in srgb,
|
|
159
|
+
var(--color-fd-primary) 10%,
|
|
160
|
+
var(--color-fd-card) 90%
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.light .fd-api-reference-route article .border,
|
|
165
|
+
.light .fd-api-reference-route article [class*=" border"],
|
|
166
|
+
.light .fd-api-reference-route article [class^="border"] {
|
|
167
|
+
border-color: rgb(15 23 42 / 0.12);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.light .fd-api-reference-route article .bg-fd-card,
|
|
171
|
+
.light .fd-api-reference-route article .bg-fd-background {
|
|
172
|
+
background: color-mix(in srgb, rgb(255 255 255) 95%, rgb(245 241 232) 5%);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.light .fd-api-reference-route article .shadow-md,
|
|
176
|
+
.light .fd-api-reference-route article .shadow-sm {
|
|
177
|
+
box-shadow:
|
|
178
|
+
0 1px 2px rgb(15 23 42 / 0.05),
|
|
179
|
+
0 10px 30px rgb(15 23 42 / 0.04);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.light .fd-api-reference-route article .text-fd-muted-foreground {
|
|
183
|
+
color: rgb(71 85 105 / 0.9);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.light .fd-api-reference-switcher[data-theme-style="colorful"] .fd-api-reference-switcher-summary {
|
|
187
|
+
background: color-mix(in srgb, var(--color-fd-primary) 18%, white 82%);
|
|
188
|
+
color: var(--color-fd-primary);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.light .fd-api-reference-switcher[data-theme-style="colorful"] {
|
|
192
|
+
border-color: color-mix(in srgb, var(--color-fd-primary) 28%, var(--color-fd-border));
|
|
193
|
+
background: var(--color-fd-card);
|
|
194
|
+
box-shadow: none;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.light
|
|
198
|
+
.fd-api-reference-switcher[data-theme-style="colorful"]
|
|
199
|
+
.fd-api-reference-switcher-summary
|
|
200
|
+
.fd-api-reference-switcher-chevron {
|
|
201
|
+
color: color-mix(in srgb, var(--color-fd-primary) 78%, black 22%);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.light
|
|
205
|
+
.fd-api-reference-switcher[data-theme-style="colorful"]
|
|
206
|
+
.fd-api-reference-switcher-summary
|
|
207
|
+
.fd-api-reference-switcher-glyph {
|
|
208
|
+
background: color-mix(in srgb, var(--color-fd-primary) 24%, white 76%);
|
|
209
|
+
border-color: color-mix(in srgb, var(--color-fd-primary) 38%, var(--color-fd-border));
|
|
210
|
+
color: var(--color-fd-primary);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.light .fd-api-reference-switcher[data-theme-style="colorful"] .fd-api-reference-switcher-options {
|
|
214
|
+
background: var(--color-fd-card);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.light
|
|
218
|
+
.fd-api-reference-switcher[data-theme-style="colorful"]
|
|
219
|
+
.fd-api-reference-switcher-option[data-current="true"] {
|
|
220
|
+
background: color-mix(in srgb, var(--color-fd-primary) 18%, white 82%);
|
|
221
|
+
border-color: color-mix(in srgb, var(--color-fd-primary) 32%, var(--color-fd-border));
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.light
|
|
225
|
+
.fd-api-reference-route[data-theme-style="colorful"]
|
|
226
|
+
.fd-api-reference-pagination-item:hover {
|
|
227
|
+
border-color: color-mix(in srgb, var(--color-fd-primary) 36%, var(--color-fd-border));
|
|
228
|
+
background: color-mix(in srgb, var(--color-fd-card) 88%, var(--color-fd-primary) 12%);
|
|
229
|
+
}
|
|
230
|
+
|
|
42
231
|
.fd-api-reference-route #nd-subnav {
|
|
43
232
|
display: none;
|
|
44
233
|
}
|
|
45
234
|
|
|
46
235
|
.fd-api-reference-route #nd-page.fd-api-reference-page > * {
|
|
47
236
|
width: 100%;
|
|
48
|
-
max-width:
|
|
237
|
+
max-width: 1285px;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.fd-api-reference-route #nd-page.fd-api-reference-page > .fd-api-reference-body {
|
|
241
|
+
width: 100%;
|
|
242
|
+
max-width: none;
|
|
49
243
|
}
|
|
50
244
|
|
|
51
|
-
.fd-api-reference-route
|
|
52
|
-
|
|
245
|
+
.fd-api-reference-route
|
|
246
|
+
#nd-page.fd-api-reference-page
|
|
247
|
+
> .fd-api-reference-body
|
|
248
|
+
> .flex.flex-col.gap-24.text-sm {
|
|
249
|
+
width: 100%;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.fd-api-reference-operation {
|
|
253
|
+
display: flex;
|
|
254
|
+
flex-direction: column;
|
|
255
|
+
gap: 1rem 1.5rem;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.fd-api-reference-operation-main {
|
|
259
|
+
min-width: 0;
|
|
260
|
+
flex: 1 1 auto;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.fd-api-reference-operation-description {
|
|
264
|
+
margin-top: 0.9rem;
|
|
265
|
+
color: var(--color-fd-muted-foreground);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.fd-api-reference-operation-description > * {
|
|
269
|
+
margin: 0;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.fd-api-reference-operation-example {
|
|
273
|
+
min-width: 0;
|
|
53
274
|
}
|
|
54
275
|
|
|
55
276
|
.fd-api-reference-pagination {
|
|
@@ -121,6 +342,21 @@
|
|
|
121
342
|
}
|
|
122
343
|
}
|
|
123
344
|
|
|
345
|
+
@media (min-width: 960px) {
|
|
346
|
+
.fd-api-reference-operation {
|
|
347
|
+
display: grid;
|
|
348
|
+
grid-template-columns: minmax(0, 1fr) minmax(20rem, 25rem);
|
|
349
|
+
align-items: start;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.fd-api-reference-operation-example {
|
|
353
|
+
position: sticky;
|
|
354
|
+
top: calc(var(--fd-docs-row-1, 2rem) + 1rem);
|
|
355
|
+
width: min(100%, 25rem);
|
|
356
|
+
justify-self: end;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
124
360
|
@media (max-width: 1023px) {
|
|
125
361
|
.fd-api-reference-pagination {
|
|
126
362
|
grid-template-columns: 1fr;
|