@farming-labs/next 0.2.103 → 0.2.104
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/package.json +3 -3
- package/dist/api-reference.d.mts +0 -41
- package/dist/api-reference.mjs +0 -755
- package/dist/api.d.mts +0 -30
- package/dist/api.mjs +0 -154
- package/dist/changelog-rail-search.d.mts +0 -46
- package/dist/changelog-rail-search.mjs +0 -443
- package/dist/changelog.d.mts +0 -36
- package/dist/changelog.mjs +0 -417
- package/dist/client-callbacks.d.mts +0 -9
- package/dist/client-callbacks.mjs +0 -62
- package/dist/code-block-themes-CCE5ViGj.mjs +0 -25
- package/dist/config.d.mts +0 -7
- package/dist/config.mjs +0 -2139
- package/dist/index.d.mts +0 -5
- package/dist/index.mjs +0 -6
- package/dist/layout.d.mts +0 -12
- package/dist/layout.mjs +0 -94
- package/dist/mdx-plugins/rehype-code.d.mts +0 -2
- package/dist/mdx-plugins/rehype-code.mjs +0 -3
- package/dist/mdx-plugins/rehype-toc.d.mts +0 -2
- package/dist/mdx-plugins/rehype-toc.mjs +0 -3
- package/dist/mdx-plugins/remark-code-group.d.mts +0 -2
- package/dist/mdx-plugins/remark-code-group.mjs +0 -3
- package/dist/mdx-plugins/remark-heading.d.mts +0 -6
- package/dist/mdx-plugins/remark-heading.mjs +0 -28
- package/dist/mdx-plugins/remark-markdown-alternate.d.mts +0 -21
- package/dist/mdx-plugins/remark-markdown-alternate.mjs +0 -78
- package/dist/mdx-plugins/remark-og.d.mts +0 -22
- package/dist/mdx-plugins/remark-og.mjs +0 -30
package/dist/changelog.d.mts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { ChangelogFrontmatter } from "@farming-labs/docs";
|
|
2
|
-
import { ComponentType } from "react";
|
|
3
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
-
import { DocsConfig as DocsConfig$1 } from "@farming-labs/theme";
|
|
5
|
-
import { Metadata } from "next";
|
|
6
|
-
|
|
7
|
-
//#region src/changelog.d.ts
|
|
8
|
-
interface GeneratedChangelogEntry {
|
|
9
|
-
slug: string;
|
|
10
|
-
date: string;
|
|
11
|
-
url: string;
|
|
12
|
-
sourcePath: string;
|
|
13
|
-
Component: ComponentType;
|
|
14
|
-
metadata?: ChangelogFrontmatter;
|
|
15
|
-
}
|
|
16
|
-
declare function createNextChangelogIndexPage(config: DocsConfig$1, entries: GeneratedChangelogEntry[]): () => react_jsx_runtime0.JSX.Element;
|
|
17
|
-
declare function createNextChangelogEntryPage(config: DocsConfig$1, entries: GeneratedChangelogEntry[]): (props: {
|
|
18
|
-
params?: Promise<{
|
|
19
|
-
slug?: string;
|
|
20
|
-
}> | {
|
|
21
|
-
slug?: string;
|
|
22
|
-
};
|
|
23
|
-
}) => Promise<react_jsx_runtime0.JSX.Element>;
|
|
24
|
-
declare function createNextChangelogStaticParams(entries: GeneratedChangelogEntry[]): () => {
|
|
25
|
-
slug: string;
|
|
26
|
-
}[];
|
|
27
|
-
declare function createNextChangelogIndexMetadata(config: DocsConfig$1): Metadata;
|
|
28
|
-
declare function createNextChangelogEntryMetadata(config: DocsConfig$1, entries: GeneratedChangelogEntry[]): (props: {
|
|
29
|
-
params?: Promise<{
|
|
30
|
-
slug?: string;
|
|
31
|
-
}> | {
|
|
32
|
-
slug?: string;
|
|
33
|
-
};
|
|
34
|
-
}) => Promise<Metadata>;
|
|
35
|
-
//#endregion
|
|
36
|
-
export { GeneratedChangelogEntry, createNextChangelogEntryMetadata, createNextChangelogEntryPage, createNextChangelogIndexMetadata, createNextChangelogIndexPage, createNextChangelogStaticParams };
|
package/dist/changelog.mjs
DELETED
|
@@ -1,417 +0,0 @@
|
|
|
1
|
-
import { ChangelogDirectory, ChangelogTOC } from "./changelog-rail-search.mjs";
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import { collectDocsMarkdownSections, resolveChangelogConfig } from "@farming-labs/docs";
|
|
5
|
-
import Link from "next/link";
|
|
6
|
-
import { notFound } from "next/navigation";
|
|
7
|
-
import { createElement, isValidElement } from "react";
|
|
8
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
import { createPageMetadata } from "@farming-labs/theme";
|
|
10
|
-
|
|
11
|
-
//#region src/changelog.tsx
|
|
12
|
-
function formatDisplayDate(value) {
|
|
13
|
-
const parsed = /* @__PURE__ */ new Date(`${value}T00:00:00Z`);
|
|
14
|
-
if (Number.isNaN(parsed.valueOf())) return value;
|
|
15
|
-
return new Intl.DateTimeFormat("en-US", {
|
|
16
|
-
month: "long",
|
|
17
|
-
day: "numeric",
|
|
18
|
-
year: "numeric",
|
|
19
|
-
timeZone: "UTC"
|
|
20
|
-
}).format(parsed).toUpperCase();
|
|
21
|
-
}
|
|
22
|
-
function normalizeAuthors(value) {
|
|
23
|
-
if (!value) return [];
|
|
24
|
-
if (Array.isArray(value)) return value.filter((item) => typeof item === "string" && item.trim().length > 0);
|
|
25
|
-
return value.trim() ? [value] : [];
|
|
26
|
-
}
|
|
27
|
-
function normalizeWhitespace(value) {
|
|
28
|
-
return value.replace(/\s+/g, " ").trim();
|
|
29
|
-
}
|
|
30
|
-
function truncatePaginationText(value, maxLength) {
|
|
31
|
-
const normalized = normalizeWhitespace(value);
|
|
32
|
-
if (normalized.length <= maxLength) return normalized;
|
|
33
|
-
const sliced = normalized.slice(0, maxLength + 1).trimEnd();
|
|
34
|
-
const boundary = sliced.lastIndexOf(" ");
|
|
35
|
-
return `${(boundary >= Math.floor(maxLength * .6) ? sliced.slice(0, boundary) : sliced.slice(0, maxLength)).replace(/[.,;:!?-]+$/g, "").trimEnd()}…`;
|
|
36
|
-
}
|
|
37
|
-
function truncatePaginationTitle(value, maxLength = 72) {
|
|
38
|
-
return truncatePaginationText(value, maxLength);
|
|
39
|
-
}
|
|
40
|
-
function truncatePaginationDescription(value, maxLength = 110) {
|
|
41
|
-
return truncatePaginationText(value, maxLength);
|
|
42
|
-
}
|
|
43
|
-
function extractChangelogToc(sourcePath) {
|
|
44
|
-
try {
|
|
45
|
-
return collectDocsMarkdownSections(readFileSync(join(process.cwd(), sourcePath), "utf-8")).filter((heading) => heading.level >= 2 && heading.level <= 4 && heading.heading).map((heading) => ({
|
|
46
|
-
title: heading.heading,
|
|
47
|
-
url: `#${encodeURIComponent(heading.id)}`,
|
|
48
|
-
depth: heading.level
|
|
49
|
-
}));
|
|
50
|
-
} catch {
|
|
51
|
-
return [];
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
function resolveEntries(entries) {
|
|
55
|
-
return entries.filter((entry) => entry.metadata?.draft !== true).map((entry) => ({
|
|
56
|
-
slug: entry.slug,
|
|
57
|
-
date: entry.date,
|
|
58
|
-
url: entry.url,
|
|
59
|
-
sourcePath: entry.sourcePath,
|
|
60
|
-
title: entry.metadata?.title?.trim() || entry.slug.replace(/-/g, " "),
|
|
61
|
-
description: entry.metadata?.description?.trim() || void 0,
|
|
62
|
-
authors: normalizeAuthors(entry.metadata?.authors),
|
|
63
|
-
version: typeof entry.metadata?.version === "string" ? entry.metadata.version : void 0,
|
|
64
|
-
tags: Array.isArray(entry.metadata?.tags) ? entry.metadata.tags.filter((item) => typeof item === "string" && item.trim().length > 0) : [],
|
|
65
|
-
pinned: entry.metadata?.pinned === true,
|
|
66
|
-
image: typeof entry.metadata?.image === "string" && entry.metadata.image.trim().length > 0 ? entry.metadata.image : void 0,
|
|
67
|
-
Component: entry.Component
|
|
68
|
-
})).sort((left, right) => {
|
|
69
|
-
if (left.pinned !== right.pinned) return left.pinned ? -1 : 1;
|
|
70
|
-
return right.date.localeCompare(left.date);
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
function findEntry(entries, slug) {
|
|
74
|
-
return entries.find((entry) => entry.slug === slug);
|
|
75
|
-
}
|
|
76
|
-
function toDirectoryEntries(entries) {
|
|
77
|
-
return entries.map((entry) => ({
|
|
78
|
-
slug: entry.slug,
|
|
79
|
-
title: entry.title,
|
|
80
|
-
description: entry.description,
|
|
81
|
-
date: entry.date,
|
|
82
|
-
url: entry.url,
|
|
83
|
-
version: entry.version,
|
|
84
|
-
tags: entry.tags,
|
|
85
|
-
authors: entry.authors,
|
|
86
|
-
image: entry.image,
|
|
87
|
-
content: createElement(entry.Component)
|
|
88
|
-
}));
|
|
89
|
-
}
|
|
90
|
-
function renderActionsComponent(value) {
|
|
91
|
-
if (!value) return null;
|
|
92
|
-
if (isValidElement(value)) return value;
|
|
93
|
-
if (typeof value === "function") return createElement(value);
|
|
94
|
-
return value;
|
|
95
|
-
}
|
|
96
|
-
function getListingUrl(config) {
|
|
97
|
-
const changelog = resolveChangelogConfig(config.changelog);
|
|
98
|
-
return `/${(config.entry ?? "docs").replace(/^\/+|\/+$/g, "")}/${changelog.path}`;
|
|
99
|
-
}
|
|
100
|
-
function formatChangelogTagLabel(tag) {
|
|
101
|
-
return tag.split(/[-_\s]+/).filter(Boolean).map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()).join(" ");
|
|
102
|
-
}
|
|
103
|
-
function ChangelogActions({ children }) {
|
|
104
|
-
if (!children) return null;
|
|
105
|
-
return /* @__PURE__ */ jsx("div", {
|
|
106
|
-
className: "fd-changelog-actions",
|
|
107
|
-
children
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
function MetaRow({ entry, includeVersion = true }) {
|
|
111
|
-
return /* @__PURE__ */ jsx("div", {
|
|
112
|
-
className: "flex flex-wrap gap-2",
|
|
113
|
-
children: [includeVersion && entry.version ? {
|
|
114
|
-
label: entry.version,
|
|
115
|
-
kind: "version"
|
|
116
|
-
} : null, ...entry.tags.map((tag) => ({
|
|
117
|
-
label: tag,
|
|
118
|
-
kind: "tag"
|
|
119
|
-
}))].filter(Boolean).map((item) => /* @__PURE__ */ jsx("span", {
|
|
120
|
-
className: "fd-changelog-tag",
|
|
121
|
-
"data-testid": item.kind === "tag" ? "changelog-tag" : void 0,
|
|
122
|
-
children: item.kind === "tag" ? formatChangelogTagLabel(item.label) : item.label
|
|
123
|
-
}, `${item.kind}-${item.label}`))
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
function EmptyState() {
|
|
127
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
128
|
-
className: "not-prose rounded-[1.75rem] bg-black/[0.02] px-8 py-12 shadow-[inset_0_0_0_1px_rgba(15,23,42,0.06)] dark:bg-white/[0.03] dark:shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]",
|
|
129
|
-
children: [/* @__PURE__ */ jsx("h2", {
|
|
130
|
-
className: "text-2xl font-semibold tracking-tight text-neutral-950 dark:text-neutral-50",
|
|
131
|
-
children: "No changelog entries yet"
|
|
132
|
-
}), /* @__PURE__ */ jsxs("p", {
|
|
133
|
-
className: "mt-3 max-w-2xl text-base leading-7 text-neutral-600 dark:text-neutral-400",
|
|
134
|
-
children: [
|
|
135
|
-
"Add a dated folder like",
|
|
136
|
-
" ",
|
|
137
|
-
/* @__PURE__ */ jsx("code", {
|
|
138
|
-
className: "rounded bg-black/[0.05] px-1.5 py-0.5 dark:bg-white/[0.08]",
|
|
139
|
-
children: "changelog/2026-03-04/page.mdx"
|
|
140
|
-
}),
|
|
141
|
-
" ",
|
|
142
|
-
"and it will appear here automatically."
|
|
143
|
-
]
|
|
144
|
-
})]
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
function ChangelogEntryPagination(props) {
|
|
148
|
-
if (!props.previous && !props.next) return null;
|
|
149
|
-
const both = Boolean(props.previous && props.next);
|
|
150
|
-
return /* @__PURE__ */ jsxs("nav", {
|
|
151
|
-
className: "not-prose fd-page-nav mt-16",
|
|
152
|
-
"aria-label": "Changelog pagination",
|
|
153
|
-
style: both ? void 0 : { gridTemplateColumns: "1fr" },
|
|
154
|
-
children: [props.previous ? /* @__PURE__ */ jsxs(Link, {
|
|
155
|
-
href: props.previous.url,
|
|
156
|
-
prefetch: true,
|
|
157
|
-
className: "fd-page-nav-card fd-page-nav-prev",
|
|
158
|
-
children: [
|
|
159
|
-
/* @__PURE__ */ jsxs("span", {
|
|
160
|
-
className: "fd-page-nav-label",
|
|
161
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
162
|
-
"aria-hidden": true,
|
|
163
|
-
children: "←"
|
|
164
|
-
}), "Previous"]
|
|
165
|
-
}),
|
|
166
|
-
/* @__PURE__ */ jsx("span", {
|
|
167
|
-
className: "fd-page-nav-title",
|
|
168
|
-
children: truncatePaginationTitle(props.previous.title)
|
|
169
|
-
}),
|
|
170
|
-
/* @__PURE__ */ jsx("span", {
|
|
171
|
-
className: `fd-page-nav-description${props.previous.description ? "" : " fd-page-nav-description-empty"}`,
|
|
172
|
-
"aria-hidden": props.previous.description ? void 0 : true,
|
|
173
|
-
children: props.previous.description ? truncatePaginationDescription(props.previous.description) : "\xA0"
|
|
174
|
-
})
|
|
175
|
-
]
|
|
176
|
-
}) : both ? /* @__PURE__ */ jsx("div", { "aria-hidden": "true" }) : null, props.next ? /* @__PURE__ */ jsxs(Link, {
|
|
177
|
-
href: props.next.url,
|
|
178
|
-
prefetch: true,
|
|
179
|
-
className: "fd-page-nav-card fd-page-nav-next",
|
|
180
|
-
children: [
|
|
181
|
-
/* @__PURE__ */ jsxs("span", {
|
|
182
|
-
className: "fd-page-nav-label",
|
|
183
|
-
children: ["Next", /* @__PURE__ */ jsx("span", {
|
|
184
|
-
"aria-hidden": true,
|
|
185
|
-
children: "→"
|
|
186
|
-
})]
|
|
187
|
-
}),
|
|
188
|
-
/* @__PURE__ */ jsx("span", {
|
|
189
|
-
className: "fd-page-nav-title",
|
|
190
|
-
children: truncatePaginationTitle(props.next.title)
|
|
191
|
-
}),
|
|
192
|
-
/* @__PURE__ */ jsx("span", {
|
|
193
|
-
className: `fd-page-nav-description${props.next.description ? "" : " fd-page-nav-description-empty"}`,
|
|
194
|
-
"aria-hidden": props.next.description ? void 0 : true,
|
|
195
|
-
children: props.next.description ? truncatePaginationDescription(props.next.description) : "\xA0"
|
|
196
|
-
})
|
|
197
|
-
]
|
|
198
|
-
}) : both ? /* @__PURE__ */ jsx("div", { "aria-hidden": "true" }) : null]
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
function ChangelogEntryView(props) {
|
|
202
|
-
const Content = props.entry.Component;
|
|
203
|
-
const contentClassName = "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";
|
|
204
|
-
const tocItems = props.toc.map((item) => ({
|
|
205
|
-
href: item.url,
|
|
206
|
-
title: item.title
|
|
207
|
-
}));
|
|
208
|
-
return /* @__PURE__ */ jsx("div", {
|
|
209
|
-
className: "fd-changelog-frame not-prose relative w-full pb-16",
|
|
210
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
211
|
-
className: "fd-changelog-shell",
|
|
212
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
213
|
-
className: "fd-changelog-main",
|
|
214
|
-
children: [
|
|
215
|
-
/* @__PURE__ */ jsx("div", {
|
|
216
|
-
className: "border-b border-fd-border/50 pb-5",
|
|
217
|
-
children: /* @__PURE__ */ jsxs(Link, {
|
|
218
|
-
href: props.listingUrl,
|
|
219
|
-
prefetch: true,
|
|
220
|
-
style: { marginBottom: "30px" },
|
|
221
|
-
className: "inline-flex items-center gap-2 text-sm font-medium text-fd-muted-foreground no-underline transition-colors hover:text-fd-foreground",
|
|
222
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
223
|
-
"aria-hidden": true,
|
|
224
|
-
children: "←"
|
|
225
|
-
}), "Back to changelog"]
|
|
226
|
-
})
|
|
227
|
-
}),
|
|
228
|
-
/* @__PURE__ */ jsxs("div", {
|
|
229
|
-
style: { paddingTop: "4.5rem" },
|
|
230
|
-
children: [
|
|
231
|
-
/* @__PURE__ */ jsxs("div", {
|
|
232
|
-
className: "fd-changelog-mobile-summary",
|
|
233
|
-
children: [props.entry.version ? /* @__PURE__ */ jsx("div", {
|
|
234
|
-
className: "fd-changelog-version-box",
|
|
235
|
-
children: props.entry.version
|
|
236
|
-
}) : /* @__PURE__ */ jsx("div", {}), /* @__PURE__ */ jsx("time", {
|
|
237
|
-
className: "fd-changelog-date",
|
|
238
|
-
dateTime: props.entry.date,
|
|
239
|
-
children: formatDisplayDate(props.entry.date)
|
|
240
|
-
})]
|
|
241
|
-
}),
|
|
242
|
-
/* @__PURE__ */ jsxs("div", {
|
|
243
|
-
className: "fd-changelog-mobile-content",
|
|
244
|
-
children: [/* @__PURE__ */ jsxs("header", {
|
|
245
|
-
className: "flex flex-col gap-2",
|
|
246
|
-
children: [
|
|
247
|
-
/* @__PURE__ */ jsx("h1", {
|
|
248
|
-
className: "m-0 text-balance text-2xl font-semibold leading-snug tracking-tight text-fd-foreground md:text-3xl",
|
|
249
|
-
children: props.entry.title
|
|
250
|
-
}),
|
|
251
|
-
/* @__PURE__ */ jsx(MetaRow, {
|
|
252
|
-
entry: props.entry,
|
|
253
|
-
includeVersion: false
|
|
254
|
-
}),
|
|
255
|
-
props.entry.description ? /* @__PURE__ */ jsx("p", {
|
|
256
|
-
className: "m-0 max-w-2xl text-sm leading-relaxed text-fd-muted-foreground",
|
|
257
|
-
children: props.entry.description
|
|
258
|
-
}) : null
|
|
259
|
-
]
|
|
260
|
-
}), /* @__PURE__ */ jsxs("article", {
|
|
261
|
-
className: `${contentClassName} mt-6`,
|
|
262
|
-
children: [props.entry.image ? /* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx("img", {
|
|
263
|
-
src: props.entry.image,
|
|
264
|
-
alt: `${props.entry.title} preview`,
|
|
265
|
-
loading: "lazy",
|
|
266
|
-
decoding: "async"
|
|
267
|
-
}) }) : null, /* @__PURE__ */ jsx(Content, {})]
|
|
268
|
-
})]
|
|
269
|
-
}),
|
|
270
|
-
/* @__PURE__ */ jsxs("div", {
|
|
271
|
-
className: "fd-changelog-desktop-grid",
|
|
272
|
-
children: [
|
|
273
|
-
/* @__PURE__ */ jsx("div", {
|
|
274
|
-
className: "flex items-start justify-end pt-0.5",
|
|
275
|
-
children: props.entry.version ? /* @__PURE__ */ jsx("div", {
|
|
276
|
-
className: "fd-changelog-version-box",
|
|
277
|
-
children: props.entry.version
|
|
278
|
-
}) : /* @__PURE__ */ jsx("div", {
|
|
279
|
-
className: "h-9",
|
|
280
|
-
"aria-hidden": "true"
|
|
281
|
-
})
|
|
282
|
-
}),
|
|
283
|
-
/* @__PURE__ */ jsxs("div", {
|
|
284
|
-
className: "fd-changelog-rail",
|
|
285
|
-
"data-testid": "changelog-rail",
|
|
286
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
287
|
-
className: "fd-changelog-timeline-line",
|
|
288
|
-
"data-testid": "changelog-timeline-line",
|
|
289
|
-
"aria-hidden": true,
|
|
290
|
-
style: {
|
|
291
|
-
top: "1rem",
|
|
292
|
-
bottom: "0"
|
|
293
|
-
}
|
|
294
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
295
|
-
className: "fd-changelog-timeline-dot mt-1",
|
|
296
|
-
"data-testid": "changelog-timeline-dot",
|
|
297
|
-
"aria-hidden": true
|
|
298
|
-
})]
|
|
299
|
-
}),
|
|
300
|
-
/* @__PURE__ */ jsxs("div", {
|
|
301
|
-
className: "min-w-0 space-y-6",
|
|
302
|
-
children: [
|
|
303
|
-
/* @__PURE__ */ jsx("time", {
|
|
304
|
-
className: "fd-changelog-date block pt-0.5",
|
|
305
|
-
dateTime: props.entry.date,
|
|
306
|
-
children: formatDisplayDate(props.entry.date)
|
|
307
|
-
}),
|
|
308
|
-
/* @__PURE__ */ jsxs("header", {
|
|
309
|
-
className: "flex flex-col gap-2",
|
|
310
|
-
children: [
|
|
311
|
-
/* @__PURE__ */ jsx("h1", {
|
|
312
|
-
className: "m-0 text-balance text-2xl font-semibold leading-snug tracking-tight text-fd-foreground md:text-3xl",
|
|
313
|
-
children: props.entry.title
|
|
314
|
-
}),
|
|
315
|
-
/* @__PURE__ */ jsx(MetaRow, {
|
|
316
|
-
entry: props.entry,
|
|
317
|
-
includeVersion: false
|
|
318
|
-
}),
|
|
319
|
-
props.entry.description ? /* @__PURE__ */ jsx("p", {
|
|
320
|
-
className: "m-0 max-w-2xl text-sm leading-relaxed text-fd-muted-foreground",
|
|
321
|
-
children: props.entry.description
|
|
322
|
-
}) : null
|
|
323
|
-
]
|
|
324
|
-
}),
|
|
325
|
-
/* @__PURE__ */ jsxs("article", {
|
|
326
|
-
className: contentClassName,
|
|
327
|
-
children: [props.entry.image ? /* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx("img", {
|
|
328
|
-
src: props.entry.image,
|
|
329
|
-
alt: `${props.entry.title} preview`,
|
|
330
|
-
loading: "lazy",
|
|
331
|
-
decoding: "async"
|
|
332
|
-
}) }) : null, /* @__PURE__ */ jsx(Content, {})]
|
|
333
|
-
})
|
|
334
|
-
]
|
|
335
|
-
})
|
|
336
|
-
]
|
|
337
|
-
})
|
|
338
|
-
]
|
|
339
|
-
}),
|
|
340
|
-
/* @__PURE__ */ jsx(ChangelogEntryPagination, {
|
|
341
|
-
previous: props.previous,
|
|
342
|
-
next: props.next
|
|
343
|
-
})
|
|
344
|
-
]
|
|
345
|
-
}), /* @__PURE__ */ jsx(ChangelogTOC, {
|
|
346
|
-
title: "On this page",
|
|
347
|
-
items: tocItems,
|
|
348
|
-
variant: "content"
|
|
349
|
-
})]
|
|
350
|
-
})
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
function createNextChangelogIndexPage(config, entries) {
|
|
354
|
-
return function NextChangelogIndexPage() {
|
|
355
|
-
const changelog = resolveChangelogConfig(config.changelog);
|
|
356
|
-
const resolvedEntries = resolveEntries(entries);
|
|
357
|
-
const actions = renderActionsComponent(changelog.actionsComponent);
|
|
358
|
-
return resolvedEntries.length > 0 ? /* @__PURE__ */ jsx(ChangelogDirectory, {
|
|
359
|
-
title: changelog.title,
|
|
360
|
-
description: changelog.description,
|
|
361
|
-
entries: toDirectoryEntries(resolvedEntries),
|
|
362
|
-
searchEnabled: changelog.search,
|
|
363
|
-
actions: actions ? /* @__PURE__ */ jsx(ChangelogActions, { children: actions }) : null
|
|
364
|
-
}) : /* @__PURE__ */ jsx(EmptyState, {});
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
function createNextChangelogEntryPage(config, entries) {
|
|
368
|
-
return async function NextChangelogEntryPage(props) {
|
|
369
|
-
const resolvedEntries = resolveEntries(entries);
|
|
370
|
-
const slug = (props.params ? await props.params : void 0)?.slug;
|
|
371
|
-
if (!slug) notFound();
|
|
372
|
-
const entry = findEntry(resolvedEntries, slug);
|
|
373
|
-
if (!entry) notFound();
|
|
374
|
-
const currentIndex = resolvedEntries.findIndex((candidate) => candidate.slug === slug);
|
|
375
|
-
const previous = currentIndex < resolvedEntries.length - 1 ? resolvedEntries[currentIndex + 1] : void 0;
|
|
376
|
-
const next = currentIndex > 0 ? resolvedEntries[currentIndex - 1] : void 0;
|
|
377
|
-
return /* @__PURE__ */ jsx(ChangelogEntryView, {
|
|
378
|
-
entry,
|
|
379
|
-
toc: extractChangelogToc(entry.sourcePath),
|
|
380
|
-
previous,
|
|
381
|
-
next,
|
|
382
|
-
listingUrl: getListingUrl(config)
|
|
383
|
-
});
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
function createNextChangelogStaticParams(entries) {
|
|
387
|
-
return function generateStaticParams() {
|
|
388
|
-
return resolveEntries(entries).map((entry) => ({ slug: entry.slug }));
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
function createNextChangelogIndexMetadata(config) {
|
|
392
|
-
const changelog = resolveChangelogConfig(config.changelog);
|
|
393
|
-
return createPageMetadata(config, {
|
|
394
|
-
title: changelog.title,
|
|
395
|
-
description: changelog.description
|
|
396
|
-
}, void 0, getListingUrl(config));
|
|
397
|
-
}
|
|
398
|
-
function createNextChangelogEntryMetadata(config, entries) {
|
|
399
|
-
return async function generateMetadata(props) {
|
|
400
|
-
const slug = (props.params ? await props.params : void 0)?.slug;
|
|
401
|
-
const entry = slug ? findEntry(resolveEntries(entries), slug) : void 0;
|
|
402
|
-
if (!entry) {
|
|
403
|
-
const changelog = resolveChangelogConfig(config.changelog);
|
|
404
|
-
return createPageMetadata(config, {
|
|
405
|
-
title: changelog.title,
|
|
406
|
-
description: changelog.description
|
|
407
|
-
}, void 0, getListingUrl(config));
|
|
408
|
-
}
|
|
409
|
-
return createPageMetadata(config, {
|
|
410
|
-
title: entry.title,
|
|
411
|
-
description: entry.description
|
|
412
|
-
}, void 0, `${getListingUrl(config)}/${entry.slug}`);
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
//#endregion
|
|
417
|
-
export { createNextChangelogEntryMetadata, createNextChangelogEntryPage, createNextChangelogIndexMetadata, createNextChangelogIndexPage, createNextChangelogStaticParams };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
//#region src/client-callbacks.d.ts
|
|
4
|
-
declare function DocsClientCallbacks(props?: {
|
|
5
|
-
apiReferencePrimaryServerUrl?: string;
|
|
6
|
-
docsCloudEnabled?: boolean;
|
|
7
|
-
}): react_jsx_runtime0.JSX.Element;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { DocsClientCallbacks as default };
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useEffect } from "react";
|
|
4
|
-
import docsConfig from "@farming-labs/next-internal-docs-config";
|
|
5
|
-
import { DocsClientHooks } from "@farming-labs/theme/client-hooks";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
|
|
8
|
-
//#region src/client-callbacks.tsx
|
|
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]);
|
|
34
|
-
const analytics = resolveDocsClientAnalytics(docsConfig.analytics, props?.docsCloudEnabled);
|
|
35
|
-
return /* @__PURE__ */ jsx(DocsClientHooks, {
|
|
36
|
-
onCopyClick: docsConfig.onCopyClick,
|
|
37
|
-
analytics,
|
|
38
|
-
onFeedback: docsConfig.feedback && typeof docsConfig.feedback === "object" ? docsConfig.feedback.onFeedback : void 0,
|
|
39
|
-
onAIFeedback: docsConfig.ai?.feedback && typeof docsConfig.ai.feedback === "object" ? docsConfig.ai.feedback.onFeedback : void 0,
|
|
40
|
-
onAIActions: docsConfig.ai?.onActions
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
function resolveDocsClientAnalytics(analytics, docsCloudEnabled) {
|
|
44
|
-
if (!docsCloudEnabled) return analytics;
|
|
45
|
-
if (analytics === true) return {
|
|
46
|
-
enabled: true,
|
|
47
|
-
console: true,
|
|
48
|
-
cloud: false
|
|
49
|
-
};
|
|
50
|
-
if (analytics && typeof analytics === "object") return {
|
|
51
|
-
...analytics,
|
|
52
|
-
cloud: false
|
|
53
|
-
};
|
|
54
|
-
return {
|
|
55
|
-
enabled: true,
|
|
56
|
-
console: false,
|
|
57
|
-
cloud: false
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
//#endregion
|
|
62
|
-
export { DocsClientCallbacks as default };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
|
|
4
|
-
//#region src/code-block-themes.ts
|
|
5
|
-
const DEFAULT_CODE_BLOCK_THEMES = {
|
|
6
|
-
light: "github-light",
|
|
7
|
-
dark: "github-dark"
|
|
8
|
-
};
|
|
9
|
-
const SHADCN_CODE_BLOCK_THEMES = {
|
|
10
|
-
light: "github-light-default",
|
|
11
|
-
dark: "vesper"
|
|
12
|
-
};
|
|
13
|
-
const SHADCN_THEME_IMPORT = /(?:from\s*|import\s*)["']@farming-labs\/theme\/shadcn["']/;
|
|
14
|
-
function resolveCodeBlockThemes({ root, configPath, theme }) {
|
|
15
|
-
const configFile = join(root, configPath);
|
|
16
|
-
const fallback = existsSync(configFile) && SHADCN_THEME_IMPORT.test(readFileSync(configFile, "utf8")) ? SHADCN_CODE_BLOCK_THEMES : DEFAULT_CODE_BLOCK_THEMES;
|
|
17
|
-
const codeBlock = theme?.ui?.codeBlock;
|
|
18
|
-
return {
|
|
19
|
-
light: codeBlock?.theme ?? fallback.light,
|
|
20
|
-
dark: codeBlock?.darkTheme ?? fallback.dark
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
export { resolveCodeBlockThemes as t };
|
package/dist/config.d.mts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { DocsConfig } from "@farming-labs/docs";
|
|
2
|
-
import { NextConfig } from "next";
|
|
3
|
-
|
|
4
|
-
//#region src/config.d.ts
|
|
5
|
-
declare function withDocs(nextConfig?: NextConfig, docsConfig?: Pick<DocsConfig, "agent" | "mcp" | "theme">): NextConfig;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { withDocs };
|