@farming-labs/theme 0.2.99 → 0.2.102

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.
@@ -1,9 +1,12 @@
1
- import { TanstackDocsLayout, TanstackDocsLayoutProps } from "./tanstack-layout.mjs";
1
+ import { TanstackDocsLayoutProps } from "./tanstack-layout.mjs";
2
2
  import { ComponentPropsWithoutRef } from "react";
3
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
  import { RootProvider } from "fumadocs-ui/provider/base";
5
5
 
6
6
  //#region src/browser.d.ts
7
+ type BrowserDocsLayoutProps = Omit<TanstackDocsLayoutProps, "browserRuntime">;
8
+ /** Docs layout for framework-neutral browser adapters such as Farm.js. */
9
+ declare function BrowserDocsLayout(props: BrowserDocsLayoutProps): react_jsx_runtime0.JSX.Element;
7
10
  type FumadocsProviderProps = ComponentPropsWithoutRef<typeof RootProvider>;
8
11
  declare global {
9
12
  interface Window {
@@ -22,4 +25,4 @@ declare function BrowserRootProvider({
22
25
  ...props
23
26
  }: BrowserRootProviderProps): react_jsx_runtime0.JSX.Element;
24
27
  //#endregion
25
- export { TanstackDocsLayout as BrowserDocsLayout, type TanstackDocsLayoutProps as BrowserDocsLayoutProps, BrowserRootProvider, BrowserRootProviderProps };
28
+ export { BrowserDocsLayout, BrowserDocsLayoutProps, BrowserRootProvider, BrowserRootProviderProps };
package/dist/browser.mjs CHANGED
@@ -7,6 +7,13 @@ import { jsx } from "react/jsx-runtime";
7
7
  import { RootProvider } from "fumadocs-ui/provider/base";
8
8
 
9
9
  //#region src/browser.tsx
10
+ /** Docs layout for framework-neutral browser adapters such as Farm.js. */
11
+ function BrowserDocsLayout(props) {
12
+ return /* @__PURE__ */ jsx(TanstackDocsLayout, {
13
+ ...props,
14
+ browserRuntime: true
15
+ });
16
+ }
10
17
  function patchHistoryEvents() {
11
18
  if (typeof window === "undefined" || window.__fdBrowserHistoryPatched) return;
12
19
  for (const method of ["pushState", "replaceState"]) {
@@ -71,4 +78,4 @@ function BrowserRootProvider({ children, search, initialPathname = "/", ...props
71
78
  }
72
79
 
73
80
  //#endregion
74
- export { TanstackDocsLayout as BrowserDocsLayout, BrowserRootProvider };
81
+ export { BrowserDocsLayout, BrowserRootProvider };
@@ -8,7 +8,6 @@ import { DocsCommandSearch } from "./docs-command-search.mjs";
8
8
  import { resolveReadingTimeOptions } from "./reading-time-options.mjs";
9
9
  import { resolvePageReadingTime } from "./reading-time.mjs";
10
10
  import { SidebarSearchWithAI } from "./sidebar-search-ai.mjs";
11
- import { TabletSidebarBridge } from "./tablet-sidebar-bridge.mjs";
12
11
  import { LocaleThemeControl } from "./locale-theme-control.mjs";
13
12
  import fs from "node:fs";
14
13
  import path from "node:path";
@@ -809,7 +808,6 @@ function createDocsLayout(config, options) {
809
808
  /* @__PURE__ */ jsx(TypographyStyle, { typography }),
810
809
  /* @__PURE__ */ jsx(LayoutStyle, { layout: layoutDimensions }),
811
810
  forcedTheme && /* @__PURE__ */ jsx(ForcedThemeScript, { theme: forcedTheme }),
812
- config.theme?.name === "fumadocs-pixel-border" && /* @__PURE__ */ jsx(TabletSidebarBridge, {}),
813
811
  !staticExport && /* @__PURE__ */ jsx(Suspense, {
814
812
  fallback: null,
815
813
  children: /* @__PURE__ */ jsx(DocsCommandSearch, {
@@ -844,7 +842,6 @@ function createDocsLayout(config, options) {
844
842
  fallback: children,
845
843
  children: /* @__PURE__ */ jsx(DocsPageClient, {
846
844
  tocEnabled,
847
- themeName: config.theme?.name,
848
845
  tocStyle,
849
846
  breadcrumbEnabled,
850
847
  changelogBasePath,
@@ -17,8 +17,8 @@ interface SerializedProvider {
17
17
  }
18
18
  interface DocsPageClientProps {
19
19
  tocEnabled: boolean;
20
- /** Active theme preset name, used for theme-specific structural affordances. */
21
- themeName?: string;
20
+ /** Expose the llms.txt action in a runtime-owned header slot. */
21
+ showLlmsInHeader?: boolean;
22
22
  tocStyle?: "default" | "directional";
23
23
  breadcrumbEnabled?: boolean;
24
24
  changelogBasePath?: string;
@@ -104,7 +104,7 @@ interface DocsPageClientProps {
104
104
  }
105
105
  declare function DocsPageClient({
106
106
  tocEnabled,
107
- themeName,
107
+ showLlmsInHeader,
108
108
  tocStyle,
109
109
  breadcrumbEnabled,
110
110
  changelogBasePath,
@@ -255,7 +255,7 @@ function findThreadlineTocActionsContainer() {
255
255
  }
256
256
  return toc.parentElement ?? toc;
257
257
  }
258
- function DocsPageClient({ tocEnabled, themeName, tocStyle = "default", breadcrumbEnabled = true, changelogBasePath, entry = "docs", publicPath, locale, copyMarkdown = false, copyMarkdownFormat, copyMarkdownIncludeTitle, copyMarkdownLabel, copyMarkdownCopiedLabel, openDocs = false, openDocsProviders, openDocsTarget, openDocsPrompt, pageActionsPosition = "below-title", pageActionsAlignment = "left", githubUrl, contentDir, githubBranch = "main", githubDirectory, editOnGithubUrl, lastModifiedMap, lastModified: lastModifiedProp, readingTimeMap, readingTime: readingTimeProp, readingTimeFormat = "long", previousPage, nextPage, structuredDataMap, structuredData: structuredDataProp, readingTimeEnabled = false, lastUpdatedEnabled = true, lastUpdatedLabel = "Last updated", lastUpdatedPosition = "footer", llmsTxtEnabled = false, generatedTitleMap, descriptionMap, description, descriptionInBody = false, feedbackEnabled = false, feedbackQuestion, feedbackPlaceholder, feedbackRequireComment, feedbackPositiveLabel, feedbackNegativeLabel, feedbackSubmitLabel, feedbackSuccessMessage, feedbackErrorMessage, feedbackOnFeedback, analytics = false, children }) {
258
+ function DocsPageClient({ tocEnabled, showLlmsInHeader = false, tocStyle = "default", breadcrumbEnabled = true, changelogBasePath, entry = "docs", publicPath, locale, copyMarkdown = false, copyMarkdownFormat, copyMarkdownIncludeTitle, copyMarkdownLabel, copyMarkdownCopiedLabel, openDocs = false, openDocsProviders, openDocsTarget, openDocsPrompt, pageActionsPosition = "below-title", pageActionsAlignment = "left", githubUrl, contentDir, githubBranch = "main", githubDirectory, editOnGithubUrl, lastModifiedMap, lastModified: lastModifiedProp, readingTimeMap, readingTime: readingTimeProp, readingTimeFormat = "long", previousPage, nextPage, structuredDataMap, structuredData: structuredDataProp, readingTimeEnabled = false, lastUpdatedEnabled = true, lastUpdatedLabel = "Last updated", lastUpdatedPosition = "footer", llmsTxtEnabled = false, generatedTitleMap, descriptionMap, description, descriptionInBody = false, feedbackEnabled = false, feedbackQuestion, feedbackPlaceholder, feedbackRequireComment, feedbackPositiveLabel, feedbackNegativeLabel, feedbackSubmitLabel, feedbackSuccessMessage, feedbackErrorMessage, feedbackOnFeedback, analytics = false, children }) {
259
259
  const fdTocStyle = tocStyle === "directional" ? "clerk" : void 0;
260
260
  const [toc, setToc] = useState([]);
261
261
  const [titlePortalHost, setTitlePortalHost] = useState(null);
@@ -268,7 +268,7 @@ function DocsPageClient({ tocEnabled, themeName, tocStyle = "default", breadcrum
268
268
  const activeLocale = resolveClientLocale(searchParams, locale);
269
269
  const resolvedPublicPath = normalizePublicDocsPath(publicPath, entry);
270
270
  const llmsLangQuery = activeLocale ? `?lang=${encodeURIComponent(activeLocale)}` : "";
271
- const showLlmsInHeader = llmsTxtEnabled && themeName === "fumadocs-pixel-border";
271
+ const shouldShowLlmsInHeader = llmsTxtEnabled && showLlmsInHeader;
272
272
  const normalizedPath = (browserPathname || pathname).replace(/\/$/, "") || "/";
273
273
  const pageTitle = generatedTitleMap?.[normalizedPath];
274
274
  const pageDescription = description ?? descriptionMap?.[normalizedPath];
@@ -586,11 +586,11 @@ function DocsPageClient({ tocEnabled, themeName, tocStyle = "default", breadcrum
586
586
  llmsTxtEnabled && /* @__PURE__ */ jsx("a", {
587
587
  href: `/llms.txt${llmsLangQuery}`,
588
588
  className: "fd-agent-llms-directive",
589
- "data-visible-in-header": showLlmsInHeader ? "true" : void 0,
590
- style: showLlmsInHeader ? void 0 : agentLlmsDirectiveStyle,
591
- tabIndex: showLlmsInHeader ? void 0 : -1,
592
- "aria-hidden": showLlmsInHeader ? void 0 : true,
593
- children: showLlmsInHeader ? "LLMS.TXT" : "llms.txt"
589
+ "data-visible-in-header": shouldShowLlmsInHeader ? "true" : void 0,
590
+ style: shouldShowLlmsInHeader ? void 0 : agentLlmsDirectiveStyle,
591
+ tabIndex: shouldShowLlmsInHeader ? void 0 : -1,
592
+ "aria-hidden": shouldShowLlmsInHeader ? void 0 : true,
593
+ children: shouldShowLlmsInHeader ? "LLMS.TXT" : "llms.txt"
594
594
  }, "llms-txt"),
595
595
  titleControlsPortal,
596
596
  tocActionsPortal,
@@ -606,7 +606,7 @@ function DocsPageClient({ tocEnabled, themeName, tocStyle = "default", breadcrum
606
606
  style: fdTocStyle
607
607
  },
608
608
  breadcrumb: { enabled: false },
609
- footer: { enabled: false },
609
+ footer: { enabled: !isChangelogRoute },
610
610
  children: [
611
611
  effectiveBreadcrumbEnabled && /* @__PURE__ */ jsx(PathBreadcrumb, {
612
612
  pathname,
@@ -59,10 +59,10 @@ declare const PixelBorderUIDefaults: {
59
59
  layout: {
60
60
  contentWidth: number;
61
61
  sidebarWidth: number;
62
- tocWidth: number;
63
62
  toc: {
64
63
  enabled: boolean;
65
64
  depth: number;
65
+ style: "directional";
66
66
  };
67
67
  header: {
68
68
  height: number;
@@ -29,30 +29,30 @@ const PixelBorderUIDefaults = {
29
29
  },
30
30
  h1: {
31
31
  size: "2.25rem",
32
- weight: 400,
33
- lineHeight: "1.14",
32
+ weight: 700,
33
+ lineHeight: "1.2",
34
34
  letterSpacing: "-0.02em"
35
35
  },
36
36
  h2: {
37
37
  size: "1.5rem",
38
- weight: 400,
39
- lineHeight: "1.24",
38
+ weight: 600,
39
+ lineHeight: "1.3",
40
40
  letterSpacing: "-0.01em"
41
41
  },
42
42
  h3: {
43
43
  size: "1.25rem",
44
- weight: 400,
45
- lineHeight: "1.3"
44
+ weight: 600,
45
+ lineHeight: "1.4"
46
46
  },
47
47
  h4: {
48
48
  size: "1.125rem",
49
- weight: 400,
49
+ weight: 600,
50
50
  lineHeight: "1.4"
51
51
  },
52
52
  body: {
53
- size: "0.975rem",
53
+ size: "1rem",
54
54
  weight: 400,
55
- lineHeight: "1.8"
55
+ lineHeight: "1.75"
56
56
  },
57
57
  small: {
58
58
  size: "0.875rem",
@@ -63,13 +63,13 @@ const PixelBorderUIDefaults = {
63
63
  layout: {
64
64
  contentWidth: 860,
65
65
  sidebarWidth: 286,
66
- tocWidth: 240,
67
66
  toc: {
68
67
  enabled: true,
69
- depth: 3
68
+ depth: 3,
69
+ style: "directional"
70
70
  },
71
71
  header: {
72
- height: 44,
72
+ height: 56,
73
73
  sticky: true
74
74
  }
75
75
  },
@@ -27,6 +27,8 @@ interface TreeRoot {
27
27
  interface TanstackDocsLayoutProps {
28
28
  config: DocsConfig;
29
29
  tree: TreeRoot;
30
+ /** Enables browser-adapter shell affordances that are not part of a theme preset. */
31
+ browserRuntime?: boolean;
30
32
  locale?: string;
31
33
  description?: string;
32
34
  descriptionInBody?: boolean;
@@ -47,6 +49,7 @@ interface TanstackDocsLayoutProps {
47
49
  declare function TanstackDocsLayout({
48
50
  config,
49
51
  tree,
52
+ browserRuntime,
50
53
  locale,
51
54
  description,
52
55
  descriptionInBody,
@@ -7,8 +7,8 @@ import { resolveDocsCloudAIClientRequest } from "./docs-cloud-ai-client.mjs";
7
7
  import { DocsCommandSearch } from "./docs-command-search.mjs";
8
8
  import { resolveReadingTimeOptions } from "./reading-time-options.mjs";
9
9
  import { SidebarSearchWithAI } from "./sidebar-search-ai.mjs";
10
- import { TabletSidebarBridge } from "./tablet-sidebar-bridge.mjs";
11
10
  import { LocaleThemeControl } from "./locale-theme-control.mjs";
11
+ import { TabletSidebarBridge } from "./tablet-sidebar-bridge.mjs";
12
12
  import { DocsLayout } from "fumadocs-ui/layouts/docs";
13
13
  import { Suspense } from "react";
14
14
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -224,7 +224,7 @@ function resolveFeedbackConfig(feedback) {
224
224
  function ForcedThemeScript({ theme }) {
225
225
  return /* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: `document.documentElement.classList.remove('light','dark');document.documentElement.classList.add('${theme === "light" || theme === "dark" ? theme : "light"}');` } });
226
226
  }
227
- function TanstackDocsLayout({ config, tree, locale, description, descriptionInBody, readingTime, lastModified, previousPage, nextPage, structuredData, editOnGithubUrl, children }) {
227
+ function TanstackDocsLayout({ config, tree, browserRuntime = false, locale, description, descriptionInBody, readingTime, lastModified, previousPage, nextPage, structuredData, editOnGithubUrl, children }) {
228
228
  const tocConfig = config.theme?.ui?.layout?.toc;
229
229
  const tocEnabled = tocConfig?.enabled !== false;
230
230
  const tocStyle = tocConfig?.style;
@@ -260,6 +260,7 @@ function TanstackDocsLayout({ config, tree, locale, description, descriptionInBo
260
260
  const llmsTxtEnabled = resolveEnabledByDefault(config.llmsTxt);
261
261
  const feedbackConfig = resolveFeedbackConfig(config.feedback);
262
262
  const staticExport = !!config.staticExport;
263
+ const frameworkContainerProps = browserRuntime ? { "data-fd-framework": "" } : void 0;
263
264
  const openDocsConfig = pageActions?.openDocs && typeof pageActions.openDocs === "object" ? pageActions.openDocs : void 0;
264
265
  const openDocsProviders = resolveOpenDocsProviders(openDocsConfig?.providers, {
265
266
  target: openDocsConfig?.target,
@@ -323,13 +324,14 @@ function TanstackDocsLayout({ config, tree, locale, description, descriptionInBo
323
324
  enabled: false
324
325
  } : themeSwitch,
325
326
  sidebar: finalSidebarProps,
327
+ containerProps: frameworkContainerProps,
326
328
  ...aiMode === "sidebar-icon" && aiEnabled ? { searchToggle: { components: { lg: /* @__PURE__ */ jsx(SidebarSearchWithAI, {}) } } } : {},
327
329
  children: [
328
330
  /* @__PURE__ */ jsx(ColorStyle, { colors }),
329
331
  /* @__PURE__ */ jsx(TypographyStyle, { typography }),
330
332
  /* @__PURE__ */ jsx(LayoutStyle, { layout: layoutDimensions }),
331
333
  forcedTheme && /* @__PURE__ */ jsx(ForcedThemeScript, { theme: forcedTheme }),
332
- config.theme?.name === "fumadocs-pixel-border" && /* @__PURE__ */ jsx(TabletSidebarBridge, {}),
334
+ browserRuntime && config.theme?.name === "fumadocs-pixel-border" && /* @__PURE__ */ jsx(TabletSidebarBridge, {}),
333
335
  !staticExport && /* @__PURE__ */ jsx(Suspense, {
334
336
  fallback: null,
335
337
  children: /* @__PURE__ */ jsx(DocsCommandSearch, {
@@ -361,7 +363,7 @@ function TanstackDocsLayout({ config, tree, locale, description, descriptionInBo
361
363
  fallback: children,
362
364
  children: /* @__PURE__ */ jsx(DocsPageClient, {
363
365
  tocEnabled,
364
- themeName: config.theme?.name,
366
+ showLlmsInHeader: browserRuntime && config.theme?.name === "fumadocs-pixel-border",
365
367
  tocStyle,
366
368
  breadcrumbEnabled,
367
369
  entry: config.entry ?? "docs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/theme",
3
- "version": "0.2.99",
3
+ "version": "0.2.102",
4
4
  "description": "Theme package for @farming-labs/docs — layout, provider, MDX components, and styles",
5
5
  "keywords": [
6
6
  "docs",
@@ -161,7 +161,7 @@
161
161
  "tsdown": "^0.20.3",
162
162
  "typescript": "^5.9.3",
163
163
  "vitest": "^4.1.8",
164
- "@farming-labs/docs": "0.2.99"
164
+ "@farming-labs/docs": "0.2.102"
165
165
  },
166
166
  "peerDependencies": {
167
167
  "@farming-labs/docs": ">=0.0.1",