@farming-labs/astro-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 +3 -3
- package/src/components/DocsContent.astro +38 -0
- package/styles/docs.css +27 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/astro-theme",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.48",
|
|
4
4
|
"description": "Astro UI components for @farming-labs/docs — layout, sidebar, TOC, search, and theme toggle",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro",
|
|
@@ -109,8 +109,8 @@
|
|
|
109
109
|
},
|
|
110
110
|
"dependencies": {
|
|
111
111
|
"sugar-high": "^0.9.5",
|
|
112
|
-
"@farming-labs/astro": "0.1.
|
|
113
|
-
"@farming-labs/docs": "0.1.
|
|
112
|
+
"@farming-labs/astro": "0.1.48",
|
|
113
|
+
"@farming-labs/docs": "0.1.48"
|
|
114
114
|
},
|
|
115
115
|
"peerDependencies": {
|
|
116
116
|
"astro": ">=4.0.0"
|
|
@@ -84,6 +84,9 @@ const pageActionsAlignment = (() => {
|
|
|
84
84
|
if (typeof pa === "object" && pa !== null && pa.alignment) return pa.alignment;
|
|
85
85
|
return "left";
|
|
86
86
|
})();
|
|
87
|
+
const showPageActions = copyMarkdownEnabled || openDocsEnabled;
|
|
88
|
+
const showActionsAbove = pageActionsPosition === "above-title" && showPageActions;
|
|
89
|
+
const showActionsBelow = pageActionsPosition === "below-title" && showPageActions;
|
|
87
90
|
|
|
88
91
|
const lastUpdatedConfig = (() => {
|
|
89
92
|
const lu = config?.lastUpdated;
|
|
@@ -97,6 +100,17 @@ const lastUpdatedConfig = (() => {
|
|
|
97
100
|
|
|
98
101
|
const showLastUpdatedInFooter = !!data.lastModified && lastUpdatedConfig.enabled && lastUpdatedConfig.position === "footer";
|
|
99
102
|
const showLastUpdatedBelowTitle = !!data.lastModified && lastUpdatedConfig.enabled && lastUpdatedConfig.position === "below-title";
|
|
103
|
+
const readingTimeValue =
|
|
104
|
+
typeof data.readingTime === "number"
|
|
105
|
+
? Math.max(1, Math.ceil(data.readingTime))
|
|
106
|
+
: null;
|
|
107
|
+
const readingTimeLabel = readingTimeValue ? `${readingTimeValue} min read` : null;
|
|
108
|
+
const showReadingTimeAbove = !!readingTimeLabel && showActionsAbove;
|
|
109
|
+
const showReadingTimeBelow =
|
|
110
|
+
!!readingTimeLabel &&
|
|
111
|
+
!showReadingTimeAbove &&
|
|
112
|
+
(showActionsBelow || showLastUpdatedBelowTitle || (!showPageActions && pageActionsPosition === "below-title"));
|
|
113
|
+
const showReadingTimeStandalone = !!readingTimeLabel && !showReadingTimeAbove && !showReadingTimeBelow;
|
|
100
114
|
const feedbackConfig = (() => {
|
|
101
115
|
const defaults = {
|
|
102
116
|
enabled: false,
|
|
@@ -188,11 +202,29 @@ const htmlWithoutFirstH1 = (data.html || "").replace(/<h1[^>]*>[\s\S]*?<\/h1>\s*
|
|
|
188
202
|
)}
|
|
189
203
|
</div>
|
|
190
204
|
)}
|
|
205
|
+
{showReadingTimeAbove && (
|
|
206
|
+
<div class="fd-page-meta">
|
|
207
|
+
<span class="fd-page-meta-dot" aria-hidden="true">·</span>
|
|
208
|
+
<span class="fd-page-meta-item">{readingTimeLabel}</span>
|
|
209
|
+
</div>
|
|
210
|
+
)}
|
|
211
|
+
{showReadingTimeStandalone && (
|
|
212
|
+
<div class="fd-page-meta">
|
|
213
|
+
<span class="fd-page-meta-dot" aria-hidden="true">·</span>
|
|
214
|
+
<span class="fd-page-meta-item">{readingTimeLabel}</span>
|
|
215
|
+
</div>
|
|
216
|
+
)}
|
|
191
217
|
<h1 class="fd-page-title">{data.title}</h1>
|
|
192
218
|
{data.description && <p class="fd-page-description">{data.description}</p>}
|
|
193
219
|
{showLastUpdatedBelowTitle && data.lastModified && (
|
|
194
220
|
<p class="fd-last-modified fd-last-modified-below-title">Last updated: {data.lastModified}</p>
|
|
195
221
|
)}
|
|
222
|
+
{showReadingTimeBelow && !showActionsBelow && (
|
|
223
|
+
<div class="fd-page-meta">
|
|
224
|
+
<span class="fd-page-meta-dot" aria-hidden="true">·</span>
|
|
225
|
+
<span class="fd-page-meta-item">{readingTimeLabel}</span>
|
|
226
|
+
</div>
|
|
227
|
+
)}
|
|
196
228
|
{pageActionsPosition === "below-title" && (copyMarkdownEnabled || openDocsEnabled) && (
|
|
197
229
|
<>
|
|
198
230
|
<hr class="fd-page-actions-divider" aria-hidden="true" />
|
|
@@ -241,6 +273,12 @@ const htmlWithoutFirstH1 = (data.html || "").replace(/<h1[^>]*>[\s\S]*?<\/h1>\s*
|
|
|
241
273
|
</div>
|
|
242
274
|
)}
|
|
243
275
|
</div>
|
|
276
|
+
{showReadingTimeBelow && (
|
|
277
|
+
<div class="fd-page-meta">
|
|
278
|
+
<span class="fd-page-meta-dot" aria-hidden="true">·</span>
|
|
279
|
+
<span class="fd-page-meta-item">{readingTimeLabel}</span>
|
|
280
|
+
</div>
|
|
281
|
+
)}
|
|
244
282
|
</>
|
|
245
283
|
)}
|
|
246
284
|
<Fragment set:html={htmlWithoutFirstH1} />
|
package/styles/docs.css
CHANGED
|
@@ -1641,6 +1641,33 @@ html.dark pre.shiki {
|
|
|
1641
1641
|
margin-bottom: 1rem;
|
|
1642
1642
|
}
|
|
1643
1643
|
|
|
1644
|
+
.fd-page-meta {
|
|
1645
|
+
display: flex;
|
|
1646
|
+
flex-wrap: wrap;
|
|
1647
|
+
align-items: center;
|
|
1648
|
+
gap: 0.375rem;
|
|
1649
|
+
margin-bottom: 0.75rem;
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
.fd-page-meta-dot {
|
|
1653
|
+
display: inline-flex;
|
|
1654
|
+
align-items: center;
|
|
1655
|
+
justify-content: center;
|
|
1656
|
+
font-family: var(--fd-font-mono, ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace);
|
|
1657
|
+
font-size: 0.8rem;
|
|
1658
|
+
line-height: 1;
|
|
1659
|
+
color: color-mix(in srgb, var(--color-fd-muted-foreground) 78%, transparent);
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
.fd-page-meta-item {
|
|
1663
|
+
font-family: var(--fd-font-mono, ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace);
|
|
1664
|
+
font-size: 0.6875rem;
|
|
1665
|
+
font-weight: 500;
|
|
1666
|
+
letter-spacing: 0;
|
|
1667
|
+
text-transform: uppercase;
|
|
1668
|
+
color: var(--color-fd-muted-foreground);
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1644
1671
|
.fd-feedback {
|
|
1645
1672
|
margin-top: 2rem;
|
|
1646
1673
|
margin-bottom: 1.25rem;
|