@farming-labs/nuxt-theme 0.1.45 → 0.1.48

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.1.45",
3
+ "version": "0.1.48",
4
4
  "description": "Nuxt/Vue UI components for @farming-labs/docs — layout, sidebar, TOC, search, and theme toggle",
5
5
  "keywords": [
6
6
  "docs",
@@ -81,7 +81,7 @@
81
81
  },
82
82
  "dependencies": {
83
83
  "sugar-high": "^0.9.5",
84
- "@farming-labs/docs": "0.1.45"
84
+ "@farming-labs/docs": "0.1.48"
85
85
  },
86
86
  "peerDependencies": {
87
87
  "nuxt": ">=3.0.0",
@@ -15,6 +15,7 @@ const props = defineProps<{
15
15
  description?: string;
16
16
  html: string;
17
17
  rawMarkdown?: string;
18
+ readingTime?: number | null;
18
19
  previousPage?: { name: string; url: string } | null;
19
20
  nextPage?: { name: string; url: string } | null;
20
21
  editOnGithub?: string;
@@ -168,6 +169,26 @@ const showPageActions = computed(
168
169
  );
169
170
  const showActionsAbove = computed(() => pageActionsPosition.value === "above-title" && showPageActions.value);
170
171
  const showActionsBelow = computed(() => pageActionsPosition.value === "below-title" && showPageActions.value);
172
+ const readingTimeValue = computed(() =>
173
+ typeof props.data.readingTime === "number"
174
+ ? Math.max(1, Math.ceil(props.data.readingTime))
175
+ : null,
176
+ );
177
+ const readingTimeLabel = computed(() =>
178
+ readingTimeValue.value ? `${readingTimeValue.value} min read` : null,
179
+ );
180
+ const showReadingTimeAbove = computed(() => !!readingTimeLabel.value && showActionsAbove.value);
181
+ const showReadingTimeBelow = computed(
182
+ () =>
183
+ !!readingTimeLabel.value &&
184
+ !showReadingTimeAbove.value &&
185
+ (showActionsBelow.value ||
186
+ showLastUpdatedBelowTitle.value ||
187
+ (!showPageActions.value && pageActionsPosition.value === "below-title")),
188
+ );
189
+ const showReadingTimeStandalone = computed(
190
+ () => !!readingTimeLabel.value && !showReadingTimeAbove.value && !showReadingTimeBelow.value,
191
+ );
171
192
  const feedbackConfig = computed(() => {
172
193
  const defaults = {
173
194
  enabled: false,
@@ -415,12 +436,24 @@ onUnmounted(() => {
415
436
  </div>
416
437
  </div>
417
438
  </div>
439
+ <div v-if="showReadingTimeAbove" class="fd-page-meta">
440
+ <span class="fd-page-meta-dot" aria-hidden="true">·</span>
441
+ <span class="fd-page-meta-item">{{ readingTimeLabel }}</span>
442
+ </div>
443
+ <div v-if="showReadingTimeStandalone" class="fd-page-meta">
444
+ <span class="fd-page-meta-dot" aria-hidden="true">·</span>
445
+ <span class="fd-page-meta-item">{{ readingTimeLabel }}</span>
446
+ </div>
418
447
 
419
448
  <h1 class="fd-page-title">{{ data.title }}</h1>
420
449
  <p v-if="data.description" class="fd-page-description">{{ data.description }}</p>
421
450
  <p v-if="showLastUpdatedBelowTitle && data.lastModified" class="fd-last-modified fd-last-modified-below-title">
422
451
  Last updated: {{ data.lastModified }}
423
452
  </p>
453
+ <div v-if="showReadingTimeBelow && !showActionsBelow" class="fd-page-meta">
454
+ <span class="fd-page-meta-dot" aria-hidden="true">·</span>
455
+ <span class="fd-page-meta-item">{{ readingTimeLabel }}</span>
456
+ </div>
424
457
 
425
458
  <!-- Below-title actions -->
426
459
  <template v-if="showActionsBelow">
@@ -480,6 +513,10 @@ onUnmounted(() => {
480
513
  </div>
481
514
  </div>
482
515
  </div>
516
+ <div v-if="showReadingTimeBelow" class="fd-page-meta">
517
+ <span class="fd-page-meta-dot" aria-hidden="true">·</span>
518
+ <span class="fd-page-meta-item">{{ readingTimeLabel }}</span>
519
+ </div>
483
520
  </template>
484
521
 
485
522
  <div v-html="htmlWithoutFirstH1" />
package/styles/docs.css CHANGED
@@ -750,6 +750,33 @@ samp {
750
750
  margin-bottom: 1rem;
751
751
  }
752
752
 
753
+ .fd-page-meta {
754
+ display: flex;
755
+ flex-wrap: wrap;
756
+ align-items: center;
757
+ gap: 0.375rem;
758
+ margin-bottom: 0.75rem;
759
+ }
760
+
761
+ .fd-page-meta-dot {
762
+ display: inline-flex;
763
+ align-items: center;
764
+ justify-content: center;
765
+ font-family: var(--fd-font-mono, ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace);
766
+ font-size: 0.8rem;
767
+ line-height: 1;
768
+ color: color-mix(in srgb, var(--color-fd-muted-foreground) 78%, transparent);
769
+ }
770
+
771
+ .fd-page-meta-item {
772
+ font-family: var(--fd-font-mono, ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace);
773
+ font-size: 0.6875rem;
774
+ font-weight: 500;
775
+ letter-spacing: 0;
776
+ text-transform: uppercase;
777
+ color: var(--color-fd-muted-foreground);
778
+ }
779
+
753
780
  .fd-feedback {
754
781
  margin-top: 2rem;
755
782
  margin-bottom: 1.25rem;