@farming-labs/theme 0.1.56 → 0.1.58

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.
@@ -11,7 +11,7 @@ import path from "node:path";
11
11
  import matter from "gray-matter";
12
12
  import { DocsLayout } from "fumadocs-ui/layouts/docs";
13
13
  import { Suspense } from "react";
14
- import { applySidebarFolderIndexBehavior, buildPageOpenGraph, buildPageTwitter, resolveChangelogConfig, resolveDocsAgentMdxContent } from "@farming-labs/docs";
14
+ import { applySidebarFolderIndexBehavior, buildPageOpenGraph, buildPageTwitter, resolveChangelogConfig, resolveDocsAgentMdxContent, resolvePageSidebarFolderIndexBehavior } from "@farming-labs/docs";
15
15
  import { jsx, jsxs } from "react/jsx-runtime";
16
16
 
17
17
  //#region src/docs-layout.tsx
@@ -182,6 +182,7 @@ function buildTree(config, ctx, flat = false) {
182
182
  url,
183
183
  icon
184
184
  },
185
+ folderIndexBehavior: resolvePageSidebarFolderIndexBehavior(data.sidebar),
185
186
  children: folderChildren,
186
187
  ...flat ? {
187
188
  collapsible: false,
@@ -14,6 +14,7 @@ interface FolderNode {
14
14
  name: string;
15
15
  icon?: ReactNode;
16
16
  index?: PageNode;
17
+ folderIndexBehavior?: "link" | "toggle";
17
18
  children: (PageNode | FolderNode)[];
18
19
  collapsible?: boolean;
19
20
  defaultOpen?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/theme",
3
- "version": "0.1.56",
3
+ "version": "0.1.58",
4
4
  "description": "Theme package for @farming-labs/docs — layout, provider, MDX components, and styles",
5
5
  "keywords": [
6
6
  "docs",
@@ -133,7 +133,7 @@
133
133
  "tsdown": "^0.20.3",
134
134
  "typescript": "^5.9.3",
135
135
  "vitest": "^3.2.4",
136
- "@farming-labs/docs": "0.1.56"
136
+ "@farming-labs/docs": "0.1.58"
137
137
  },
138
138
  "peerDependencies": {
139
139
  "@farming-labs/docs": ">=0.0.1",
package/styles/base.css CHANGED
@@ -26,6 +26,24 @@ body {
26
26
  font-family: var(--fd-font-sans, var(--font-geist-sans, ui-sans-serif, system-ui, sans-serif));
27
27
  }
28
28
 
29
+ /*
30
+ * Sidebar folder rows can render as either links or toggle buttons depending on
31
+ * folderIndexBehavior. Reset the button chrome so both variants can share the
32
+ * same layout metrics once theme styles are applied.
33
+ */
34
+ :where(.fd-sidebar, aside#nd-sidebar, aside#nd-sidebar-mobile)
35
+ button[aria-controls][aria-expanded] {
36
+ appearance: none;
37
+ -webkit-appearance: none;
38
+ background: none;
39
+ border: 0;
40
+ color: inherit;
41
+ font: inherit;
42
+ letter-spacing: inherit;
43
+ line-height: inherit;
44
+ text-transform: inherit;
45
+ }
46
+
29
47
  code,
30
48
  kbd,
31
49
  pre,
@@ -50,7 +50,8 @@
50
50
  linear-gradient(180deg, color-mix(in srgb, var(--color-fd-primary) 10%, var(--color-fd-background)), var(--color-fd-background));
51
51
  }
52
52
 
53
- aside a[data-active] {
53
+ aside a[data-active],
54
+ aside button[aria-controls][aria-expanded] {
54
55
  text-transform: uppercase;
55
56
  letter-spacing: 0.045em;
56
57
  font-size: 0.79rem;
@@ -101,12 +101,16 @@ aside a > img:first-child {
101
101
  }
102
102
 
103
103
  /* ── Sidebar links — match DarkBold: 14px, 400 weight, minimal pad ─ */
104
- aside a[data-active] {
104
+ aside a[data-active],
105
+ aside button[aria-controls][aria-expanded] {
105
106
  font-size: 0.875rem;
106
107
  line-height: 1.5;
107
- font-weight: 400;
108
108
  padding: 6px 8px;
109
109
  border-radius: 6px;
110
+ }
111
+
112
+ aside a[data-active] {
113
+ font-weight: 400;
110
114
  color: var(--color-fd-muted-foreground);
111
115
  transition: color 150ms;
112
116
  }
@@ -253,7 +253,8 @@ article a[class*="text-fd-muted-foreground"] {
253
253
  border-color: hsl(0 0% 12%);
254
254
  }
255
255
 
256
- .dark aside a[data-active] {
256
+ .dark aside a[data-active],
257
+ .dark aside button[aria-controls][aria-expanded] {
257
258
  border-radius: 0.2rem !important;
258
259
  padding: 0.4rem 0.5rem;
259
260
  font-size: 0.8125rem;
@@ -86,7 +86,8 @@ aside#nd-sidebar,
86
86
  background: var(--color-fd-background);
87
87
  }
88
88
 
89
- aside a[data-active] {
89
+ aside a[data-active],
90
+ aside button[aria-controls][aria-expanded] {
90
91
  font-size: 0.875rem;
91
92
  line-height: 1.5;
92
93
  font-weight: 500;
@@ -78,12 +78,16 @@ aside#nd-sidebar,
78
78
  }
79
79
 
80
80
  /* Sidebar links and categories */
81
- aside a[data-active] {
82
- font-weight: 600;
81
+ aside a[data-active],
82
+ aside button[aria-controls][aria-expanded] {
83
83
  font-size: 0.92rem;
84
- letter-spacing: 0.01em;
85
84
  padding: 0.5rem 0.625rem;
86
85
  border: 1px solid transparent;
86
+ }
87
+
88
+ aside a[data-active] {
89
+ font-weight: 600;
90
+ letter-spacing: 0.01em;
87
91
  color: var(--color-fd-foreground);
88
92
  }
89
93
 
@@ -237,18 +237,22 @@ aside .overscroll-contain > div > div:last-child {
237
237
 
238
238
  /* ── Sidebar links (all levels) ──────────────────────────────────── */
239
239
 
240
- aside a[data-active] {
240
+ aside a[data-active],
241
+ aside button[aria-controls][aria-expanded] {
241
242
  font-size: 0.875rem;
242
243
  line-height: 1.6;
243
244
  border-radius: 0 !important;
244
245
  padding: 0.5rem 0.625rem !important;
245
246
  transition: color 0.15s ease;
246
- color: var(--color-fd-muted-foreground);
247
- font-weight: 400;
248
247
  overflow: hidden;
249
248
  background-color: transparent !important;
250
249
  }
251
250
 
251
+ aside a[data-active] {
252
+ color: var(--color-fd-muted-foreground);
253
+ font-weight: 400;
254
+ }
255
+
252
256
  aside a[data-active="true"],
253
257
  aside a[data-active="true"]:hover {
254
258
  background: transparent !important;