@farming-labs/theme 0.2.18 → 0.2.21
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/docs-feedback.d.mts
CHANGED
|
@@ -12,6 +12,8 @@ interface DocsFeedbackProps {
|
|
|
12
12
|
positiveLabel?: string;
|
|
13
13
|
negativeLabel?: string;
|
|
14
14
|
submitLabel?: string;
|
|
15
|
+
successMessage?: string;
|
|
16
|
+
errorMessage?: string;
|
|
15
17
|
onFeedback?: (data: DocsFeedbackData) => void | Promise<void>;
|
|
16
18
|
analytics?: boolean;
|
|
17
19
|
}
|
|
@@ -25,6 +27,8 @@ declare function DocsFeedback({
|
|
|
25
27
|
positiveLabel,
|
|
26
28
|
negativeLabel,
|
|
27
29
|
submitLabel,
|
|
30
|
+
successMessage,
|
|
31
|
+
errorMessage,
|
|
28
32
|
onFeedback,
|
|
29
33
|
analytics
|
|
30
34
|
}: DocsFeedbackProps): react_jsx_runtime0.JSX.Element;
|
package/dist/docs-feedback.mjs
CHANGED
|
@@ -116,7 +116,7 @@ function CheckIcon() {
|
|
|
116
116
|
})
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
function DocsFeedback({ pathname, entry, locale, question = "How is this guide?", placeholder = "
|
|
119
|
+
function DocsFeedback({ pathname, entry, locale, question = "How is this guide?", placeholder = "Share what could be clearer...", requireComment = false, positiveLabel = "Good", negativeLabel = "Bad", submitLabel = "Submit", successMessage = "Thanks for the feedback.", errorMessage = "Could not send feedback. Please try again.", onFeedback, analytics = false }) {
|
|
120
120
|
const [selected, setSelected] = useState(null);
|
|
121
121
|
const [comment, setComment] = useState("");
|
|
122
122
|
const [status, setStatus] = useState("idle");
|
|
@@ -251,7 +251,7 @@ function DocsFeedback({ pathname, entry, locale, question = "How is this guide?"
|
|
|
251
251
|
"data-status": "success",
|
|
252
252
|
role: "status",
|
|
253
253
|
"aria-live": "polite",
|
|
254
|
-
children:
|
|
254
|
+
children: successMessage
|
|
255
255
|
})]
|
|
256
256
|
}),
|
|
257
257
|
status === "error" && /* @__PURE__ */ jsx("p", {
|
|
@@ -259,7 +259,7 @@ function DocsFeedback({ pathname, entry, locale, question = "How is this guide?"
|
|
|
259
259
|
"data-status": "error",
|
|
260
260
|
role: "status",
|
|
261
261
|
"aria-live": "polite",
|
|
262
|
-
children:
|
|
262
|
+
children: errorMessage
|
|
263
263
|
})
|
|
264
264
|
]
|
|
265
265
|
})]
|
package/dist/docs-layout.mjs
CHANGED
|
@@ -658,11 +658,13 @@ function createDocsLayout(config, options) {
|
|
|
658
658
|
const pageActionsAlignment = pageActions?.alignment ?? "left";
|
|
659
659
|
const lastUpdatedRaw = config.lastUpdated;
|
|
660
660
|
const lastUpdatedEnabled = lastUpdatedRaw !== false && (typeof lastUpdatedRaw !== "object" || lastUpdatedRaw.enabled !== false);
|
|
661
|
+
const lastUpdatedLabel = typeof lastUpdatedRaw === "object" ? lastUpdatedRaw.label ?? "Last updated" : "Last updated";
|
|
661
662
|
const lastUpdatedPosition = typeof lastUpdatedRaw === "object" ? lastUpdatedRaw.position ?? "footer" : "footer";
|
|
662
663
|
const readingTimeOptions = resolveReadingTimeOptions(config.readingTime);
|
|
663
664
|
const readingTimeEnabledByDefault = readingTimeOptions.enabled;
|
|
664
665
|
const readingTimeWordsPerMinute = readingTimeOptions.wordsPerMinute ?? 220;
|
|
665
666
|
const readingTimeFormat = readingTimeOptions.format;
|
|
667
|
+
const readingTimeIncludeCode = readingTimeOptions.includeCode;
|
|
666
668
|
const llmsTxtEnabled = resolveEnabledByDefault(config.llmsTxt);
|
|
667
669
|
const feedbackConfig = resolveFeedbackConfig(config.feedback);
|
|
668
670
|
const openDocsConfig = pageActions?.openDocs && typeof pageActions.openDocs === "object" ? pageActions.openDocs : void 0;
|
|
@@ -699,7 +701,8 @@ function createDocsLayout(config, options) {
|
|
|
699
701
|
const descriptionMap = buildDescriptionMap(config, localeContext);
|
|
700
702
|
const readingTimeMap = buildReadingTimeMap(config, localeContext, {
|
|
701
703
|
enabledByDefault: readingTimeEnabledByDefault,
|
|
702
|
-
wordsPerMinute: readingTimeWordsPerMinute
|
|
704
|
+
wordsPerMinute: readingTimeWordsPerMinute,
|
|
705
|
+
includeCode: readingTimeIncludeCode
|
|
703
706
|
});
|
|
704
707
|
const structuredDataMap = buildStructuredDataMap(config, localeContext);
|
|
705
708
|
const readingTimeEnabled = readingTimeEnabledByDefault || Object.keys(readingTimeMap).length > 0;
|
|
@@ -807,6 +810,7 @@ function createDocsLayout(config, options) {
|
|
|
807
810
|
githubDirectory,
|
|
808
811
|
lastModifiedMap,
|
|
809
812
|
lastUpdatedEnabled,
|
|
813
|
+
lastUpdatedLabel,
|
|
810
814
|
lastUpdatedPosition,
|
|
811
815
|
readingTimeEnabled,
|
|
812
816
|
readingTimeFormat,
|
|
@@ -821,6 +825,8 @@ function createDocsLayout(config, options) {
|
|
|
821
825
|
feedbackPositiveLabel: feedbackConfig.positiveLabel,
|
|
822
826
|
feedbackNegativeLabel: feedbackConfig.negativeLabel,
|
|
823
827
|
feedbackSubmitLabel: feedbackConfig.submitLabel,
|
|
828
|
+
feedbackSuccessMessage: feedbackConfig.successMessage,
|
|
829
|
+
feedbackErrorMessage: feedbackConfig.errorMessage,
|
|
824
830
|
analytics: analyticsEnabled,
|
|
825
831
|
children
|
|
826
832
|
})
|
|
@@ -844,18 +850,20 @@ function resolveFeedbackConfig(feedback) {
|
|
|
844
850
|
const defaults = {
|
|
845
851
|
enabled: false,
|
|
846
852
|
question: "How is this guide?",
|
|
847
|
-
placeholder: "
|
|
853
|
+
placeholder: "Share what could be clearer...",
|
|
848
854
|
requireComment: false,
|
|
849
855
|
positiveLabel: "Good",
|
|
850
856
|
negativeLabel: "Bad",
|
|
851
|
-
submitLabel: "Submit"
|
|
857
|
+
submitLabel: "Submit",
|
|
858
|
+
successMessage: "Thanks for the feedback.",
|
|
859
|
+
errorMessage: "Could not send feedback. Please try again."
|
|
852
860
|
};
|
|
853
861
|
if (feedback === void 0 || feedback === false) return defaults;
|
|
854
862
|
if (feedback === true) return {
|
|
855
863
|
...defaults,
|
|
856
864
|
enabled: true
|
|
857
865
|
};
|
|
858
|
-
const hasHumanFeedbackConfig = feedback.enabled !== void 0 || feedback.question !== void 0 || feedback.placeholder !== void 0 || feedback.requireComment !== void 0 || feedback.positiveLabel !== void 0 || feedback.negativeLabel !== void 0 || feedback.submitLabel !== void 0 || feedback.onFeedback !== void 0;
|
|
866
|
+
const hasHumanFeedbackConfig = feedback.enabled !== void 0 || feedback.question !== void 0 || feedback.placeholder !== void 0 || feedback.requireComment !== void 0 || feedback.positiveLabel !== void 0 || feedback.negativeLabel !== void 0 || feedback.submitLabel !== void 0 || feedback.successMessage !== void 0 || feedback.errorMessage !== void 0 || feedback.onFeedback !== void 0;
|
|
859
867
|
return {
|
|
860
868
|
enabled: feedback.enabled === true || feedback.enabled !== false && hasHumanFeedbackConfig,
|
|
861
869
|
question: feedback.question ?? defaults.question,
|
|
@@ -863,7 +871,9 @@ function resolveFeedbackConfig(feedback) {
|
|
|
863
871
|
requireComment: feedback.requireComment ?? defaults.requireComment,
|
|
864
872
|
positiveLabel: feedback.positiveLabel ?? defaults.positiveLabel,
|
|
865
873
|
negativeLabel: feedback.negativeLabel ?? defaults.negativeLabel,
|
|
866
|
-
submitLabel: feedback.submitLabel ?? defaults.submitLabel
|
|
874
|
+
submitLabel: feedback.submitLabel ?? defaults.submitLabel,
|
|
875
|
+
successMessage: feedback.successMessage ?? defaults.successMessage,
|
|
876
|
+
errorMessage: feedback.errorMessage ?? defaults.errorMessage
|
|
867
877
|
};
|
|
868
878
|
}
|
|
869
879
|
/**
|
|
@@ -66,6 +66,8 @@ interface DocsPageClientProps {
|
|
|
66
66
|
readingTimeEnabled?: boolean;
|
|
67
67
|
/** Whether to show "Last updated" at all */
|
|
68
68
|
lastUpdatedEnabled?: boolean;
|
|
69
|
+
/** Label shown before the formatted last-updated date */
|
|
70
|
+
lastUpdatedLabel?: string;
|
|
69
71
|
/** Where to show the "Last updated" date: "footer" (next to Edit on GitHub) or "below-title" */
|
|
70
72
|
lastUpdatedPosition?: "footer" | "below-title";
|
|
71
73
|
/** Whether llms.txt is enabled — shows links in footer */
|
|
@@ -82,6 +84,8 @@ interface DocsPageClientProps {
|
|
|
82
84
|
feedbackPositiveLabel?: string;
|
|
83
85
|
feedbackNegativeLabel?: string;
|
|
84
86
|
feedbackSubmitLabel?: string;
|
|
87
|
+
feedbackSuccessMessage?: string;
|
|
88
|
+
feedbackErrorMessage?: string;
|
|
85
89
|
feedbackOnFeedback?: (data: DocsFeedbackData) => void | Promise<void>;
|
|
86
90
|
analytics?: boolean;
|
|
87
91
|
children: ReactNode;
|
|
@@ -119,6 +123,7 @@ declare function DocsPageClient({
|
|
|
119
123
|
structuredData: structuredDataProp,
|
|
120
124
|
readingTimeEnabled,
|
|
121
125
|
lastUpdatedEnabled,
|
|
126
|
+
lastUpdatedLabel,
|
|
122
127
|
lastUpdatedPosition,
|
|
123
128
|
llmsTxtEnabled,
|
|
124
129
|
descriptionMap,
|
|
@@ -130,6 +135,8 @@ declare function DocsPageClient({
|
|
|
130
135
|
feedbackPositiveLabel,
|
|
131
136
|
feedbackNegativeLabel,
|
|
132
137
|
feedbackSubmitLabel,
|
|
138
|
+
feedbackSuccessMessage,
|
|
139
|
+
feedbackErrorMessage,
|
|
133
140
|
feedbackOnFeedback,
|
|
134
141
|
analytics,
|
|
135
142
|
children
|
|
@@ -255,7 +255,7 @@ function findThreadlineTocActionsContainer() {
|
|
|
255
255
|
}
|
|
256
256
|
return toc.parentElement ?? toc;
|
|
257
257
|
}
|
|
258
|
-
function DocsPageClient({ tocEnabled, tocStyle = "default", breadcrumbEnabled = true, changelogBasePath, entry = "docs", publicPath, locale, copyMarkdown = false, copyMarkdownFormat, copyMarkdownIncludeTitle, copyMarkdownLabel, copyMarkdownCopiedLabel, openDocs = false, openDocsProviders, openDocsTarget, openDocsPrompt, pageActionsPosition = "below-title", pageActionsAlignment = "left", githubUrl, contentDir, githubBranch = "main", githubDirectory, editOnGithubUrl, lastModifiedMap, lastModified: lastModifiedProp, readingTimeMap, readingTime: readingTimeProp, readingTimeFormat = "long", structuredDataMap, structuredData: structuredDataProp, readingTimeEnabled = false, lastUpdatedEnabled = true, lastUpdatedPosition = "footer", llmsTxtEnabled = false, descriptionMap, description, feedbackEnabled = false, feedbackQuestion, feedbackPlaceholder, feedbackRequireComment, feedbackPositiveLabel, feedbackNegativeLabel, feedbackSubmitLabel, feedbackOnFeedback, analytics = false, children }) {
|
|
258
|
+
function DocsPageClient({ tocEnabled, tocStyle = "default", breadcrumbEnabled = true, changelogBasePath, entry = "docs", publicPath, locale, copyMarkdown = false, copyMarkdownFormat, copyMarkdownIncludeTitle, copyMarkdownLabel, copyMarkdownCopiedLabel, openDocs = false, openDocsProviders, openDocsTarget, openDocsPrompt, pageActionsPosition = "below-title", pageActionsAlignment = "left", githubUrl, contentDir, githubBranch = "main", githubDirectory, editOnGithubUrl, lastModifiedMap, lastModified: lastModifiedProp, readingTimeMap, readingTime: readingTimeProp, readingTimeFormat = "long", structuredDataMap, structuredData: structuredDataProp, readingTimeEnabled = false, lastUpdatedEnabled = true, lastUpdatedLabel = "Last updated", lastUpdatedPosition = "footer", llmsTxtEnabled = false, descriptionMap, description, feedbackEnabled = false, feedbackQuestion, feedbackPlaceholder, feedbackRequireComment, feedbackPositiveLabel, feedbackNegativeLabel, feedbackSubmitLabel, feedbackSuccessMessage, feedbackErrorMessage, feedbackOnFeedback, analytics = false, children }) {
|
|
259
259
|
const fdTocStyle = tocStyle === "directional" ? "clerk" : void 0;
|
|
260
260
|
const [toc, setToc] = useState([]);
|
|
261
261
|
const [titlePortalHost, setTitlePortalHost] = useState(null);
|
|
@@ -434,6 +434,8 @@ function DocsPageClient({ tocEnabled, tocStyle = "default", breadcrumbEnabled =
|
|
|
434
434
|
const lastModified = !isChangelogRoute && lastUpdatedEnabled ? lastModifiedProp ?? lastModifiedMap?.[normalizedPath] : void 0;
|
|
435
435
|
const showLastUpdatedBelowTitle = !!lastModified && lastUpdatedPosition === "below-title";
|
|
436
436
|
const showLastUpdatedInFooter = !!lastModified && lastUpdatedPosition === "footer";
|
|
437
|
+
const lastUpdatedLabelText = lastUpdatedLabel.trim();
|
|
438
|
+
const lastUpdatedText = lastUpdatedLabelText && lastModified ? `${lastUpdatedLabelText} ${lastModified}` : lastModified;
|
|
437
439
|
const showFooter = !isChangelogRoute && (!!githubFileUrl || showLastUpdatedInFooter || llmsTxtEnabled);
|
|
438
440
|
const readingTimeBlock = typeof resolvedReadingTime === "number" ? /* @__PURE__ */ jsxs("div", {
|
|
439
441
|
className: "fd-page-meta not-prose",
|
|
@@ -455,9 +457,9 @@ function DocsPageClient({ tocEnabled, tocStyle = "default", breadcrumbEnabled =
|
|
|
455
457
|
const belowTitleBlock = showLastUpdatedBelowTitle || showActionsBelowTitle || showReadingTimeBelowTitle ? /* @__PURE__ */ jsxs("div", {
|
|
456
458
|
className: "fd-below-title-block not-prose",
|
|
457
459
|
children: [
|
|
458
|
-
showLastUpdatedBelowTitle && /* @__PURE__ */
|
|
460
|
+
showLastUpdatedBelowTitle && /* @__PURE__ */ jsx("p", {
|
|
459
461
|
className: "fd-last-updated-inline",
|
|
460
|
-
children:
|
|
462
|
+
children: lastUpdatedText
|
|
461
463
|
}, "last-updated"),
|
|
462
464
|
/* @__PURE__ */ jsx("hr", { className: "fd-title-separator" }, "separator"),
|
|
463
465
|
showActionsBelowTitle && /* @__PURE__ */ jsx("div", {
|
|
@@ -605,6 +607,8 @@ function DocsPageClient({ tocEnabled, tocStyle = "default", breadcrumbEnabled =
|
|
|
605
607
|
positiveLabel: feedbackPositiveLabel,
|
|
606
608
|
negativeLabel: feedbackNegativeLabel,
|
|
607
609
|
submitLabel: feedbackSubmitLabel,
|
|
610
|
+
successMessage: feedbackSuccessMessage,
|
|
611
|
+
errorMessage: feedbackErrorMessage,
|
|
608
612
|
onFeedback: feedbackOnFeedback,
|
|
609
613
|
analytics
|
|
610
614
|
}, "feedback"),
|
|
@@ -628,9 +632,9 @@ function DocsPageClient({ tocEnabled, tocStyle = "default", breadcrumbEnabled =
|
|
|
628
632
|
children: "llms-full.txt"
|
|
629
633
|
})]
|
|
630
634
|
}, "llms-links"),
|
|
631
|
-
showLastUpdatedInFooter && lastModified && /* @__PURE__ */
|
|
635
|
+
showLastUpdatedInFooter && lastModified && /* @__PURE__ */ jsx("span", {
|
|
632
636
|
className: "fd-last-updated-footer",
|
|
633
|
-
children:
|
|
637
|
+
children: lastUpdatedText
|
|
634
638
|
}, "last-updated")
|
|
635
639
|
]
|
|
636
640
|
}, "footer")
|
package/dist/reading-time.mjs
CHANGED
|
@@ -8,41 +8,46 @@ function normalizeWordsPerMinute(wordsPerMinute) {
|
|
|
8
8
|
if (typeof wordsPerMinute !== "number" || !Number.isFinite(wordsPerMinute)) return 220;
|
|
9
9
|
return Math.max(1, Math.floor(wordsPerMinute));
|
|
10
10
|
}
|
|
11
|
-
function stripNonReadingContent(content) {
|
|
12
|
-
|
|
11
|
+
function stripNonReadingContent(content, options) {
|
|
12
|
+
const includeCode = options?.includeCode === true;
|
|
13
|
+
return (includeCode ? content.replace(/^(`{3,}|~{3,})[^\n]*$/gm, " ").replace(/`([^`\n]+)`/g, " $1 ") : content.replace(/(`{3,})[^\n]*\n[\s\S]*?\1/g, " ").replace(/(~{3,})[^\n]*\n[\s\S]*?\1/g, " ").replace(/`[^`\n]+`/g, " ")).replace(/!\[[^\]]*\]\([^)]+\)/g, " ").replace(/\[([^\]]+)\]\([^)]+\)/g, " $1 ").replace(/<[^>]+>/g, " ").replace(includeCode ? /[{}]/g : /\{[^{}]*\}/g, " ").replace(/https?:\/\/\S+/g, " ").replace(/[#>*_~|]/g, " ");
|
|
13
14
|
}
|
|
14
|
-
function estimateReadingTimeMinutes(content, wordsPerMinute) {
|
|
15
|
-
const wordCount = stripNonReadingContent(content).match(/\b[\p{L}\p{N}][\p{L}\p{N}'’-]*\b/gu)?.length ?? 0;
|
|
15
|
+
function estimateReadingTimeMinutes(content, wordsPerMinute, options) {
|
|
16
|
+
const wordCount = stripNonReadingContent(content, options).match(/\b[\p{L}\p{N}][\p{L}\p{N}'’-]*\b/gu)?.length ?? 0;
|
|
16
17
|
return Math.max(1, Math.ceil(wordCount / normalizeWordsPerMinute(wordsPerMinute)));
|
|
17
18
|
}
|
|
18
19
|
function resolveReadingTimeOptions(readingTime) {
|
|
19
20
|
if (readingTime === true) return {
|
|
20
21
|
enabled: true,
|
|
21
|
-
format: "long"
|
|
22
|
+
format: "long",
|
|
23
|
+
includeCode: false
|
|
22
24
|
};
|
|
23
25
|
if (readingTime === false || readingTime === void 0 || readingTime === null) return {
|
|
24
26
|
enabled: false,
|
|
25
|
-
format: "long"
|
|
27
|
+
format: "long",
|
|
28
|
+
includeCode: false
|
|
26
29
|
};
|
|
27
30
|
if (typeof readingTime !== "object") return {
|
|
28
31
|
enabled: false,
|
|
29
|
-
format: "long"
|
|
32
|
+
format: "long",
|
|
33
|
+
includeCode: false
|
|
30
34
|
};
|
|
31
35
|
return {
|
|
32
36
|
enabled: readingTime.enabled !== false,
|
|
33
37
|
wordsPerMinute: typeof readingTime.wordsPerMinute === "number" && Number.isFinite(readingTime.wordsPerMinute) ? readingTime.wordsPerMinute : void 0,
|
|
34
|
-
format: readingTime.format === "short" ? "short" : "long"
|
|
38
|
+
format: readingTime.format === "short" ? "short" : "long",
|
|
39
|
+
includeCode: readingTime.includeCode === true
|
|
35
40
|
};
|
|
36
41
|
}
|
|
37
|
-
function resolveReadingTimeFromContent(frontmatter, content, wordsPerMinute) {
|
|
42
|
+
function resolveReadingTimeFromContent(frontmatter, content, wordsPerMinute, options) {
|
|
38
43
|
const pageData = frontmatter ?? {};
|
|
39
44
|
if (pageData.readingTime === false) return null;
|
|
40
45
|
if (typeof pageData.readingTime === "number" && Number.isFinite(pageData.readingTime)) return Math.max(1, Math.ceil(pageData.readingTime));
|
|
41
|
-
return estimateReadingTimeMinutes(content, wordsPerMinute);
|
|
46
|
+
return estimateReadingTimeMinutes(content, wordsPerMinute, options);
|
|
42
47
|
}
|
|
43
48
|
function resolvePageReadingTime(frontmatter, content, options) {
|
|
44
49
|
if (!(options?.enabledByDefault ?? false) && !hasExplicitReadingTime(frontmatter)) return;
|
|
45
|
-
return resolveReadingTimeFromContent(frontmatter, content, options?.wordsPerMinute);
|
|
50
|
+
return resolveReadingTimeFromContent(frontmatter, content, options?.wordsPerMinute, { includeCode: options?.includeCode });
|
|
46
51
|
}
|
|
47
52
|
|
|
48
53
|
//#endregion
|
package/dist/tanstack-layout.mjs
CHANGED
|
@@ -192,18 +192,20 @@ function resolveFeedbackConfig(feedback) {
|
|
|
192
192
|
const defaults = {
|
|
193
193
|
enabled: false,
|
|
194
194
|
question: "How is this guide?",
|
|
195
|
-
placeholder: "
|
|
195
|
+
placeholder: "Share what could be clearer...",
|
|
196
196
|
requireComment: false,
|
|
197
197
|
positiveLabel: "Good",
|
|
198
198
|
negativeLabel: "Bad",
|
|
199
|
-
submitLabel: "Submit"
|
|
199
|
+
submitLabel: "Submit",
|
|
200
|
+
successMessage: "Thanks for the feedback.",
|
|
201
|
+
errorMessage: "Could not send feedback. Please try again."
|
|
200
202
|
};
|
|
201
203
|
if (feedback === void 0 || feedback === false) return defaults;
|
|
202
204
|
if (feedback === true) return {
|
|
203
205
|
...defaults,
|
|
204
206
|
enabled: true
|
|
205
207
|
};
|
|
206
|
-
const hasHumanFeedbackConfig = feedback.enabled !== void 0 || feedback.question !== void 0 || feedback.placeholder !== void 0 || feedback.requireComment !== void 0 || feedback.positiveLabel !== void 0 || feedback.negativeLabel !== void 0 || feedback.submitLabel !== void 0 || feedback.onFeedback !== void 0;
|
|
208
|
+
const hasHumanFeedbackConfig = feedback.enabled !== void 0 || feedback.question !== void 0 || feedback.placeholder !== void 0 || feedback.requireComment !== void 0 || feedback.positiveLabel !== void 0 || feedback.negativeLabel !== void 0 || feedback.submitLabel !== void 0 || feedback.successMessage !== void 0 || feedback.errorMessage !== void 0 || feedback.onFeedback !== void 0;
|
|
207
209
|
return {
|
|
208
210
|
enabled: feedback.enabled === true || feedback.enabled !== false && hasHumanFeedbackConfig,
|
|
209
211
|
question: feedback.question ?? defaults.question,
|
|
@@ -211,7 +213,9 @@ function resolveFeedbackConfig(feedback) {
|
|
|
211
213
|
requireComment: feedback.requireComment ?? defaults.requireComment,
|
|
212
214
|
positiveLabel: feedback.positiveLabel ?? defaults.positiveLabel,
|
|
213
215
|
negativeLabel: feedback.negativeLabel ?? defaults.negativeLabel,
|
|
214
|
-
submitLabel: feedback.submitLabel ?? defaults.submitLabel
|
|
216
|
+
submitLabel: feedback.submitLabel ?? defaults.submitLabel,
|
|
217
|
+
successMessage: feedback.successMessage ?? defaults.successMessage,
|
|
218
|
+
errorMessage: feedback.errorMessage ?? defaults.errorMessage
|
|
215
219
|
};
|
|
216
220
|
}
|
|
217
221
|
function ForcedThemeScript({ theme }) {
|
|
@@ -246,6 +250,7 @@ function TanstackDocsLayout({ config, tree, locale, description, readingTime, la
|
|
|
246
250
|
const pageActionsAlignment = pageActions?.alignment ?? "left";
|
|
247
251
|
const lastUpdatedRaw = config.lastUpdated;
|
|
248
252
|
const lastUpdatedEnabled = lastUpdatedRaw !== false && (typeof lastUpdatedRaw !== "object" || lastUpdatedRaw.enabled !== false);
|
|
253
|
+
const lastUpdatedLabel = typeof lastUpdatedRaw === "object" ? lastUpdatedRaw.label ?? "Last updated" : "Last updated";
|
|
249
254
|
const lastUpdatedPosition = typeof lastUpdatedRaw === "object" ? lastUpdatedRaw.position ?? "footer" : "footer";
|
|
250
255
|
const readingTimeOptions = resolveReadingTimeOptions(config.readingTime);
|
|
251
256
|
const readingTimeEnabled = readingTimeOptions.enabled;
|
|
@@ -369,6 +374,7 @@ function TanstackDocsLayout({ config, tree, locale, description, readingTime, la
|
|
|
369
374
|
pageActionsAlignment,
|
|
370
375
|
editOnGithubUrl,
|
|
371
376
|
lastUpdatedEnabled,
|
|
377
|
+
lastUpdatedLabel,
|
|
372
378
|
lastUpdatedPosition,
|
|
373
379
|
lastModified,
|
|
374
380
|
readingTimeEnabled,
|
|
@@ -383,6 +389,8 @@ function TanstackDocsLayout({ config, tree, locale, description, readingTime, la
|
|
|
383
389
|
feedbackPositiveLabel: feedbackConfig.positiveLabel,
|
|
384
390
|
feedbackNegativeLabel: feedbackConfig.negativeLabel,
|
|
385
391
|
feedbackSubmitLabel: feedbackConfig.submitLabel,
|
|
392
|
+
feedbackSuccessMessage: feedbackConfig.successMessage,
|
|
393
|
+
feedbackErrorMessage: feedbackConfig.errorMessage,
|
|
386
394
|
analytics: analyticsEnabled,
|
|
387
395
|
children
|
|
388
396
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/theme",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.21",
|
|
4
4
|
"description": "Theme package for @farming-labs/docs — layout, provider, MDX components, and styles",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
"tsdown": "^0.20.3",
|
|
146
146
|
"typescript": "^5.9.3",
|
|
147
147
|
"vitest": "^4.1.8",
|
|
148
|
-
"@farming-labs/docs": "0.2.
|
|
148
|
+
"@farming-labs/docs": "0.2.21"
|
|
149
149
|
},
|
|
150
150
|
"peerDependencies": {
|
|
151
151
|
"@farming-labs/docs": ">=0.0.1",
|