@farming-labs/svelte-theme 0.2.13 → 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/svelte-theme",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "description": "Svelte UI components for @farming-labs/docs — layout, sidebar, TOC, search, and theme toggle",
5
5
  "keywords": [
6
6
  "docs",
@@ -122,8 +122,8 @@
122
122
  "dependencies": {
123
123
  "gray-matter": "^4.0.3",
124
124
  "sugar-high": "^0.9.5",
125
- "@farming-labs/docs": "0.2.13",
126
- "@farming-labs/svelte": "0.2.13"
125
+ "@farming-labs/docs": "0.2.15",
126
+ "@farming-labs/svelte": "0.2.15"
127
127
  },
128
128
  "peerDependencies": {
129
129
  "svelte": ">=5.0.0"
@@ -74,6 +74,17 @@
74
74
  .replace(/\{url\}/g, values.url);
75
75
  }
76
76
 
77
+ function resolveReadingTimeFormat(config, data) {
78
+ if (data?.readingTimeFormat === "short" || data?.readingTimeFormat === "long") {
79
+ return data.readingTimeFormat;
80
+ }
81
+
82
+ const readingTime = config?.readingTime;
83
+ return readingTime && typeof readingTime === "object" && readingTime.format === "short"
84
+ ? "short"
85
+ : "long";
86
+ }
87
+
77
88
  let breadcrumbEnabled = $derived.by(() => {
78
89
  const bc = config?.breadcrumb;
79
90
  if (bc === undefined || bc === true) return true;
@@ -194,7 +205,14 @@
194
205
  ? Math.max(1, Math.ceil(data.readingTime))
195
206
  : null
196
207
  );
197
- let readingTimeLabel = $derived(readingTimeValue ? `${readingTimeValue} min read` : null);
208
+ let readingTimeFormat = $derived(resolveReadingTimeFormat(config, data));
209
+ let readingTimeLabel = $derived(
210
+ readingTimeValue
211
+ ? readingTimeFormat === "short"
212
+ ? `${readingTimeValue} min`
213
+ : `${readingTimeValue} min read`
214
+ : null
215
+ );
198
216
  let showReadingTimeAbove = $derived(!!readingTimeLabel && showActionsAbove);
199
217
  let showReadingTimeBelow = $derived(
200
218
  !!readingTimeLabel &&