@farming-labs/nuxt-theme 0.2.14 → 0.2.15
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/nuxt-theme",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.15",
|
|
4
4
|
"description": "Nuxt/Vue UI components for @farming-labs/docs — layout, sidebar, TOC, search, and theme toggle",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"sugar-high": "^0.9.5",
|
|
91
|
-
"@farming-labs/docs": "0.2.
|
|
91
|
+
"@farming-labs/docs": "0.2.15"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
94
|
"nuxt": ">=3.0.0",
|
|
@@ -29,6 +29,7 @@ const props = defineProps<{
|
|
|
29
29
|
html: string;
|
|
30
30
|
rawMarkdown?: string;
|
|
31
31
|
readingTime?: number | null;
|
|
32
|
+
readingTimeFormat?: "long" | "short";
|
|
32
33
|
previousPage?: { name: string; url: string } | null;
|
|
33
34
|
nextPage?: { name: string; url: string } | null;
|
|
34
35
|
editOnGithub?: string;
|
|
@@ -56,6 +57,22 @@ type FeedbackPayload = {
|
|
|
56
57
|
locale?: string;
|
|
57
58
|
};
|
|
58
59
|
|
|
60
|
+
function resolveReadingTimeFormat(
|
|
61
|
+
config: Record<string, unknown> | null | undefined,
|
|
62
|
+
data: { readingTimeFormat?: "long" | "short" },
|
|
63
|
+
) {
|
|
64
|
+
if (data.readingTimeFormat === "short" || data.readingTimeFormat === "long") {
|
|
65
|
+
return data.readingTimeFormat;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const readingTime = config?.readingTime;
|
|
69
|
+
return readingTime &&
|
|
70
|
+
typeof readingTime === "object" &&
|
|
71
|
+
(readingTime as { format?: unknown }).format === "short"
|
|
72
|
+
? "short"
|
|
73
|
+
: "long";
|
|
74
|
+
}
|
|
75
|
+
|
|
59
76
|
interface DocsWindowHooks extends Window {
|
|
60
77
|
__fdOnFeedback__?: (payload: FeedbackPayload) => void | Promise<void>;
|
|
61
78
|
}
|
|
@@ -239,8 +256,13 @@ const readingTimeValue = computed(() =>
|
|
|
239
256
|
? Math.max(1, Math.ceil(props.data.readingTime))
|
|
240
257
|
: null,
|
|
241
258
|
);
|
|
259
|
+
const readingTimeFormat = computed(() => resolveReadingTimeFormat(props.config, props.data));
|
|
242
260
|
const readingTimeLabel = computed(() =>
|
|
243
|
-
readingTimeValue.value
|
|
261
|
+
readingTimeValue.value
|
|
262
|
+
? readingTimeFormat.value === "short"
|
|
263
|
+
? `${readingTimeValue.value} min`
|
|
264
|
+
: `${readingTimeValue.value} min read`
|
|
265
|
+
: null,
|
|
244
266
|
);
|
|
245
267
|
const showReadingTimeAbove = computed(() => !!readingTimeLabel.value && showActionsAbove.value);
|
|
246
268
|
const showReadingTimeBelow = computed(
|