@farming-labs/theme 0.2.139-beta.1 → 0.2.140
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/dist/docs-layout.mjs +2 -1
- package/dist/docs-page-client.d.mts +5 -1
- package/dist/docs-page-client.mjs +4 -1
- package/dist/open-docs-providers.mjs +20 -10
- package/dist/page-actions-config.d.mts +6 -1
- package/dist/page-actions-config.mjs +16 -1
- package/dist/page-actions-menu.mjs +28 -9
- package/dist/page-actions.d.mts +5 -0
- package/dist/page-actions.mjs +6 -1
- package/dist/tanstack-layout.mjs +2 -1
- package/package.json +3 -3
- package/styles/base.css +19 -0
- package/styles/bundles/browser-framework.css +19 -0
- package/styles/bundles/shared-framework.css +19 -0
package/dist/docs-layout.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { DocsPageClient } from "./docs-page-client.mjs";
|
|
|
7
7
|
import { DocsAIFeatures } from "./docs-ai-features-lazy.mjs";
|
|
8
8
|
import { resolveDocsCloudAIClientRequest } from "./docs-cloud-ai-client.mjs";
|
|
9
9
|
import { DocsCommandSearch } from "./docs-command-search.mjs";
|
|
10
|
-
import { resolveTocPageActions } from "./page-actions-config.mjs";
|
|
10
|
+
import { resolvePageActionDescriptions, resolveTocPageActions } from "./page-actions-config.mjs";
|
|
11
11
|
import { resolveReadingTimeOptions } from "./reading-time-options.mjs";
|
|
12
12
|
import { resolvePageReadingTime } from "./reading-time.mjs";
|
|
13
13
|
import { SidebarSearchWithAI } from "./sidebar-search-ai.mjs";
|
|
@@ -884,6 +884,7 @@ function createDocsLayout(config, options) {
|
|
|
884
884
|
pageActionsPosition,
|
|
885
885
|
pageActionsAlignment,
|
|
886
886
|
pageActionsVariant: pageActions?.variant ?? "buttons",
|
|
887
|
+
pageActionsDescriptions: resolvePageActionDescriptions(pageActions?.descriptions),
|
|
887
888
|
tocActions: resolveTocPageActions(pageActions?.toc),
|
|
888
889
|
tocAskAi: pageActions?.askAi !== false,
|
|
889
890
|
footer: config.footer,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ResolvedTocPageActions } from "./page-actions-config.mjs";
|
|
1
|
+
import { ResolvedPageActionDescriptions, ResolvedTocPageActions } from "./page-actions-config.mjs";
|
|
2
2
|
import { DocsStructuredDataPages } from "./page-structured-data.mjs";
|
|
3
3
|
import { DocsPageMetadata } from "./page-metadata.mjs";
|
|
4
4
|
import { ReactNode } from "react";
|
|
@@ -17,6 +17,7 @@ interface SerializedProvider {
|
|
|
17
17
|
urlTemplate: string;
|
|
18
18
|
target?: "markdown" | "page" | "source" | "github";
|
|
19
19
|
prompt?: string;
|
|
20
|
+
description?: string;
|
|
20
21
|
}
|
|
21
22
|
interface DocsPageClientProps {
|
|
22
23
|
/** Internal packed layout metadata. Direct values and legacy maps retain precedence. */
|
|
@@ -50,6 +51,8 @@ interface DocsPageClientProps {
|
|
|
50
51
|
pageActionsPosition?: "above-title" | "below-title" | "title" | "toc";
|
|
51
52
|
/** `menu` collects the title, below-title or above-title actions behind one "…" trigger. */
|
|
52
53
|
pageActionsVariant?: "buttons" | "menu";
|
|
54
|
+
/** Texts under each page actions menu item; the `menu` variant renders them. */
|
|
55
|
+
pageActionsDescriptions?: ResolvedPageActionDescriptions;
|
|
53
56
|
/** Actions in the table-of-contents rail alongside the actions at `pageActionsPosition`. */
|
|
54
57
|
tocActions?: ResolvedTocPageActions;
|
|
55
58
|
/** The table-of-contents rail's "Ask AI" button. */
|
|
@@ -153,6 +156,7 @@ declare function DocsPageClient({
|
|
|
153
156
|
installSkills,
|
|
154
157
|
pageActionsPosition,
|
|
155
158
|
pageActionsVariant,
|
|
159
|
+
pageActionsDescriptions,
|
|
156
160
|
tocActions,
|
|
157
161
|
tocAskAi,
|
|
158
162
|
pageActionsAlignment,
|
|
@@ -335,7 +335,7 @@ function findThreadlineTocActionsContainer() {
|
|
|
335
335
|
}
|
|
336
336
|
return toc.parentElement ?? toc;
|
|
337
337
|
}
|
|
338
|
-
function DocsPageClient({ pageMetadata, tocEnabled, showLlmsInHeader = false, tocStyle = "default", breadcrumbEnabled = true, changelogBasePath, entry = "docs", publicPath, locale, copyMarkdown = false, copyMarkdownFormat, copyMarkdownIncludeTitle, copyMarkdownLabel, copyMarkdownCopiedLabel, openDocs = false, viewMarkdown = false, openDocsProviders, openDocsTarget, openDocsPrompt, connectMcp, installSkills, pageActionsPosition = "below-title", pageActionsVariant = "buttons", tocActions, tocAskAi = true, pageActionsAlignment = "left", githubUrl, contentDir, githubBranch = "main", githubDirectory, githubEditUrl, editOnGithubUrl, lastModifiedMap, lastModified: lastModifiedProp, readingTimeMap, readingTime: readingTimeProp, readingTimeFormat = "long", previousPage, nextPage, titlePager = false, structuredDataMap, structuredDataPages, structuredData: structuredDataProp, readingTimeEnabled = false, lastUpdatedEnabled = true, lastUpdatedLabel = "Last updated", lastUpdatedPosition = "footer", llmsTxtEnabled = false, generatedTitleMap, generatedTitle, descriptionMap, description, descriptionInBody = false, feedbackEnabled = false, feedbackQuestion, feedbackPlaceholder, feedbackRequireComment, feedbackPositiveLabel, feedbackNegativeLabel, feedbackSubmitLabel, feedbackSuccessMessage, feedbackErrorMessage, feedbackOnFeedback, analytics = false, telemetry, telemetryFramework, footer, children }) {
|
|
338
|
+
function DocsPageClient({ pageMetadata, tocEnabled, showLlmsInHeader = false, tocStyle = "default", breadcrumbEnabled = true, changelogBasePath, entry = "docs", publicPath, locale, copyMarkdown = false, copyMarkdownFormat, copyMarkdownIncludeTitle, copyMarkdownLabel, copyMarkdownCopiedLabel, openDocs = false, viewMarkdown = false, openDocsProviders, openDocsTarget, openDocsPrompt, connectMcp, installSkills, pageActionsPosition = "below-title", pageActionsVariant = "buttons", pageActionsDescriptions, tocActions, tocAskAi = true, pageActionsAlignment = "left", githubUrl, contentDir, githubBranch = "main", githubDirectory, githubEditUrl, editOnGithubUrl, lastModifiedMap, lastModified: lastModifiedProp, readingTimeMap, readingTime: readingTimeProp, readingTimeFormat = "long", previousPage, nextPage, titlePager = false, structuredDataMap, structuredDataPages, structuredData: structuredDataProp, readingTimeEnabled = false, lastUpdatedEnabled = true, lastUpdatedLabel = "Last updated", lastUpdatedPosition = "footer", llmsTxtEnabled = false, generatedTitleMap, generatedTitle, descriptionMap, description, descriptionInBody = false, feedbackEnabled = false, feedbackQuestion, feedbackPlaceholder, feedbackRequireComment, feedbackPositiveLabel, feedbackNegativeLabel, feedbackSubmitLabel, feedbackSuccessMessage, feedbackErrorMessage, feedbackOnFeedback, analytics = false, telemetry, telemetryFramework, footer, children }) {
|
|
339
339
|
const router = useRouter();
|
|
340
340
|
const fdTocStyle = tocStyle === "directional" ? "clerk" : void 0;
|
|
341
341
|
const [toc, setToc] = useState([]);
|
|
@@ -594,6 +594,7 @@ function DocsPageClient({ pageMetadata, tocEnabled, showLlmsInHeader = false, to
|
|
|
594
594
|
installSkills,
|
|
595
595
|
alignment: pageActionsAlignment,
|
|
596
596
|
variant: actionsVariant,
|
|
597
|
+
descriptions: pageActionsDescriptions,
|
|
597
598
|
githubFileUrl,
|
|
598
599
|
analytics
|
|
599
600
|
})
|
|
@@ -623,6 +624,7 @@ function DocsPageClient({ pageMetadata, tocEnabled, showLlmsInHeader = false, to
|
|
|
623
624
|
installSkills,
|
|
624
625
|
alignment: "right",
|
|
625
626
|
variant: actionsVariant,
|
|
627
|
+
descriptions: pageActionsDescriptions,
|
|
626
628
|
githubFileUrl,
|
|
627
629
|
analytics
|
|
628
630
|
}, "actions")]
|
|
@@ -807,6 +809,7 @@ function DocsPageClient({ pageMetadata, tocEnabled, showLlmsInHeader = false, to
|
|
|
807
809
|
installSkills,
|
|
808
810
|
alignment: pageActionsAlignment,
|
|
809
811
|
variant: actionsVariant,
|
|
812
|
+
descriptions: pageActionsDescriptions,
|
|
810
813
|
githubFileUrl,
|
|
811
814
|
analytics
|
|
812
815
|
})
|
|
@@ -15,50 +15,58 @@ const OPEN_DOCS_PROVIDER_PRESETS = {
|
|
|
15
15
|
name: "ChatGPT",
|
|
16
16
|
iconHtml: OPEN_DOCS_PROVIDER_ICONS.chatgpt,
|
|
17
17
|
urlTemplate: "https://chatgpt.com/?q={prompt}",
|
|
18
|
-
promptUrlTemplate: PROMPT_PROVIDER_TEMPLATES.chatgpt
|
|
18
|
+
promptUrlTemplate: PROMPT_PROVIDER_TEMPLATES.chatgpt,
|
|
19
|
+
description: "Ask ChatGPT about this page"
|
|
19
20
|
},
|
|
20
21
|
claude: {
|
|
21
22
|
name: "Claude",
|
|
22
23
|
iconHtml: OPEN_DOCS_PROVIDER_ICONS.claude,
|
|
23
24
|
urlTemplate: "https://claude.ai/new?q={prompt}",
|
|
24
|
-
promptUrlTemplate: PROMPT_PROVIDER_TEMPLATES.claude
|
|
25
|
+
promptUrlTemplate: PROMPT_PROVIDER_TEMPLATES.claude,
|
|
26
|
+
description: "Ask Claude about this page"
|
|
25
27
|
},
|
|
26
28
|
cursor: {
|
|
27
29
|
name: "Cursor",
|
|
28
30
|
iconHtml: OPEN_DOCS_PROVIDER_ICONS.cursor,
|
|
29
31
|
urlTemplate: "https://cursor.com/link/prompt?text={prompt}",
|
|
30
|
-
promptUrlTemplate: PROMPT_PROVIDER_TEMPLATES.cursor
|
|
32
|
+
promptUrlTemplate: PROMPT_PROVIDER_TEMPLATES.cursor,
|
|
33
|
+
description: "Ask Cursor about this page"
|
|
31
34
|
},
|
|
32
35
|
gemini: {
|
|
33
36
|
name: "Gemini",
|
|
34
37
|
iconHtml: OPEN_DOCS_PROVIDER_ICONS.gemini,
|
|
35
38
|
urlTemplate: "https://gemini.google.com/app?q={prompt}",
|
|
36
|
-
promptUrlTemplate: PROMPT_PROVIDER_TEMPLATES.gemini
|
|
39
|
+
promptUrlTemplate: PROMPT_PROVIDER_TEMPLATES.gemini,
|
|
40
|
+
description: "Ask Gemini about this page"
|
|
37
41
|
},
|
|
38
42
|
copilot: {
|
|
39
43
|
name: "Copilot",
|
|
40
44
|
iconHtml: OPEN_DOCS_PROVIDER_ICONS.copilot,
|
|
41
45
|
urlTemplate: "https://github.com/copilot?prompt={prompt}",
|
|
42
|
-
promptUrlTemplate: PROMPT_PROVIDER_TEMPLATES.copilot
|
|
46
|
+
promptUrlTemplate: PROMPT_PROVIDER_TEMPLATES.copilot,
|
|
47
|
+
description: "Ask Copilot about this page"
|
|
43
48
|
},
|
|
44
49
|
perplexity: {
|
|
45
50
|
name: "Perplexity",
|
|
46
51
|
iconHtml: OPEN_DOCS_PROVIDER_ICONS.perplexity,
|
|
47
52
|
urlTemplate: "https://www.perplexity.ai/search/?q={prompt}",
|
|
48
|
-
promptUrlTemplate: PROMPT_PROVIDER_TEMPLATES.perplexity
|
|
53
|
+
promptUrlTemplate: PROMPT_PROVIDER_TEMPLATES.perplexity,
|
|
54
|
+
description: "Ask Perplexity about this page"
|
|
49
55
|
},
|
|
50
56
|
codex: {
|
|
51
57
|
name: "Codex",
|
|
52
58
|
iconHtml: OPEN_DOCS_PROVIDER_ICONS.chatgpt,
|
|
53
59
|
urlTemplate: "codex://new?prompt={prompt}",
|
|
54
|
-
promptUrlTemplate: PROMPT_PROVIDER_TEMPLATES.codex
|
|
60
|
+
promptUrlTemplate: PROMPT_PROVIDER_TEMPLATES.codex,
|
|
61
|
+
description: "Ask Codex about this page"
|
|
55
62
|
},
|
|
56
63
|
github: {
|
|
57
64
|
name: "GitHub",
|
|
58
65
|
iconHtml: OPEN_DOCS_PROVIDER_ICONS.github,
|
|
59
66
|
urlTemplate: "{githubUrl}",
|
|
60
67
|
promptUrlTemplate: "{githubUrl}",
|
|
61
|
-
target: "github"
|
|
68
|
+
target: "github",
|
|
69
|
+
description: "Edit this page on GitHub"
|
|
62
70
|
}
|
|
63
71
|
};
|
|
64
72
|
function normalizeProviderName(name) {
|
|
@@ -85,7 +93,8 @@ function resolveOpenDocsProvider(provider, options = {}) {
|
|
|
85
93
|
urlTemplate: preset.urlTemplate,
|
|
86
94
|
promptUrlTemplate: preset.promptUrlTemplate,
|
|
87
95
|
target: preset.target ?? options.target,
|
|
88
|
-
prompt: options.prompt
|
|
96
|
+
prompt: options.prompt,
|
|
97
|
+
description: preset.description
|
|
89
98
|
};
|
|
90
99
|
}
|
|
91
100
|
const cursorAppTemplate = normalizedId === "cursor" && provider.mode === "app" ? "cursor://anysphere.cursor-deeplink/prompt?text={prompt}" : void 0;
|
|
@@ -99,7 +108,8 @@ function resolveOpenDocsProvider(provider, options = {}) {
|
|
|
99
108
|
promptUrlTemplate: provider.promptUrlTemplate ?? cursorAppTemplate ?? preset?.promptUrlTemplate,
|
|
100
109
|
iconHtml: options.serializeIcon?.(provider.icon) ?? (typeof provider.icon === "string" ? provider.icon : void 0) ?? preset?.iconHtml,
|
|
101
110
|
target: provider.target ?? preset?.target ?? options.target ?? (hasCustomUrlTemplate ? "page" : void 0),
|
|
102
|
-
prompt: provider.prompt ?? options.prompt
|
|
111
|
+
prompt: provider.prompt ?? options.prompt,
|
|
112
|
+
description: provider.description ?? preset?.description
|
|
103
113
|
};
|
|
104
114
|
}
|
|
105
115
|
|
|
@@ -6,5 +6,10 @@ interface ResolvedTocPageActions {
|
|
|
6
6
|
viewMarkdown: boolean;
|
|
7
7
|
editOnGitHub: boolean;
|
|
8
8
|
}
|
|
9
|
+
interface ResolvedPageActionDescriptions {
|
|
10
|
+
copyMarkdown: string;
|
|
11
|
+
viewMarkdown: string;
|
|
12
|
+
connectMcp: string;
|
|
13
|
+
}
|
|
9
14
|
//#endregion
|
|
10
|
-
export { ResolvedTocPageActions };
|
|
15
|
+
export { ResolvedPageActionDescriptions, ResolvedTocPageActions };
|
|
@@ -9,6 +9,21 @@ function resolveTocPageActions(toc) {
|
|
|
9
9
|
editOnGitHub: picked.editOnGitHub !== false
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
+
const DEFAULT_PAGE_ACTION_DESCRIPTIONS = {
|
|
13
|
+
copyMarkdown: "Markdown, ready to paste into an LLM",
|
|
14
|
+
viewMarkdown: "This page as plain text",
|
|
15
|
+
connectMcp: "Use these docs from any MCP client"
|
|
16
|
+
};
|
|
17
|
+
/** Resolve `pageActions.descriptions` to the texts under each page actions menu item. */
|
|
18
|
+
function resolvePageActionDescriptions(descriptions) {
|
|
19
|
+
if (!descriptions) return void 0;
|
|
20
|
+
const picked = descriptions === true ? {} : descriptions;
|
|
21
|
+
return {
|
|
22
|
+
copyMarkdown: picked.copyMarkdown ?? DEFAULT_PAGE_ACTION_DESCRIPTIONS.copyMarkdown,
|
|
23
|
+
viewMarkdown: picked.viewMarkdown ?? DEFAULT_PAGE_ACTION_DESCRIPTIONS.viewMarkdown,
|
|
24
|
+
connectMcp: picked.connectMcp ?? DEFAULT_PAGE_ACTION_DESCRIPTIONS.connectMcp
|
|
25
|
+
};
|
|
26
|
+
}
|
|
12
27
|
|
|
13
28
|
//#endregion
|
|
14
|
-
export { resolveTocPageActions };
|
|
29
|
+
export { resolvePageActionDescriptions, resolveTocPageActions };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { useRef, useState } from "react";
|
|
3
|
+
import { Fragment, useId, useRef, useState } from "react";
|
|
4
4
|
import { Popover, PopoverContent, PopoverTrigger } from "fumadocs-ui/components/ui/popover";
|
|
5
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
|
|
@@ -41,6 +41,7 @@ function PageActionsMenu({ items, label = "More page actions" }) {
|
|
|
41
41
|
const [open, setOpen] = useState(false);
|
|
42
42
|
const contentRef = useRef(null);
|
|
43
43
|
const initialFocus = useRef("first");
|
|
44
|
+
const idPrefix = useId();
|
|
44
45
|
if (items.length === 0) return null;
|
|
45
46
|
const menuItems = () => Array.from(contentRef.current?.querySelectorAll("[role=\"menuitem\"]") ?? []);
|
|
46
47
|
const focusItem = (index) => {
|
|
@@ -89,17 +90,33 @@ function PageActionsMenu({ items, label = "More page actions" }) {
|
|
|
89
90
|
focusItem(initialFocus.current === "last" ? -1 : 0);
|
|
90
91
|
},
|
|
91
92
|
onKeyDown: onMenuKeyDown,
|
|
92
|
-
children: items.map((item) => {
|
|
93
|
+
children: items.map((item, index) => {
|
|
94
|
+
const labelId = item.description ? `${idPrefix}-${index}-label` : void 0;
|
|
95
|
+
const descriptionId = item.description ? `${idPrefix}-${index}-description` : void 0;
|
|
96
|
+
const label = /* @__PURE__ */ jsx("span", {
|
|
97
|
+
id: labelId,
|
|
98
|
+
className: "fd-page-action-menu-label",
|
|
99
|
+
children: item.label
|
|
100
|
+
});
|
|
93
101
|
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [item.icon && /* @__PURE__ */ jsx("span", {
|
|
94
102
|
className: "fd-page-action-menu-icon",
|
|
95
103
|
"aria-hidden": "true",
|
|
96
104
|
children: item.icon
|
|
97
|
-
}), /* @__PURE__ */
|
|
98
|
-
className: "fd-page-action-menu-
|
|
99
|
-
children:
|
|
100
|
-
|
|
101
|
-
|
|
105
|
+
}), item.description ? /* @__PURE__ */ jsxs("span", {
|
|
106
|
+
className: "fd-page-action-menu-text",
|
|
107
|
+
children: [label, /* @__PURE__ */ jsx("span", {
|
|
108
|
+
id: descriptionId,
|
|
109
|
+
className: "fd-page-action-menu-description",
|
|
110
|
+
children: item.description
|
|
111
|
+
})]
|
|
112
|
+
}) : label] });
|
|
113
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [item.separatorBefore && index > 0 && /* @__PURE__ */ jsx("div", {
|
|
114
|
+
role: "separator",
|
|
115
|
+
className: "fd-page-actions-menu-separator"
|
|
116
|
+
}), item.href ? /* @__PURE__ */ jsx("a", {
|
|
102
117
|
role: "menuitem",
|
|
118
|
+
"aria-labelledby": labelId,
|
|
119
|
+
"aria-describedby": descriptionId,
|
|
103
120
|
tabIndex: -1,
|
|
104
121
|
className: "fd-page-action-menu-item",
|
|
105
122
|
href: item.href,
|
|
@@ -110,9 +127,11 @@ function PageActionsMenu({ items, label = "More page actions" }) {
|
|
|
110
127
|
setOpen(false);
|
|
111
128
|
},
|
|
112
129
|
children: content
|
|
113
|
-
}
|
|
130
|
+
}) : /* @__PURE__ */ jsx("button", {
|
|
114
131
|
type: "button",
|
|
115
132
|
role: "menuitem",
|
|
133
|
+
"aria-labelledby": labelId,
|
|
134
|
+
"aria-describedby": descriptionId,
|
|
116
135
|
tabIndex: -1,
|
|
117
136
|
className: "fd-page-action-menu-item",
|
|
118
137
|
onClick: () => {
|
|
@@ -120,7 +139,7 @@ function PageActionsMenu({ items, label = "More page actions" }) {
|
|
|
120
139
|
setOpen(false);
|
|
121
140
|
},
|
|
122
141
|
children: content
|
|
123
|
-
}, item.key);
|
|
142
|
+
})] }, item.key);
|
|
124
143
|
})
|
|
125
144
|
})]
|
|
126
145
|
});
|
package/dist/page-actions.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ResolvedPageActionDescriptions } from "./page-actions-config.mjs";
|
|
1
2
|
import { CopyMarkdownFormat, PageActionMcpProvider } from "@farming-labs/docs";
|
|
2
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
4
|
|
|
@@ -9,6 +10,7 @@ interface SerializedProvider {
|
|
|
9
10
|
urlTemplate: string;
|
|
10
11
|
target?: "markdown" | "page" | "source" | "github";
|
|
11
12
|
prompt?: string;
|
|
13
|
+
description?: string;
|
|
12
14
|
}
|
|
13
15
|
interface PageActionsProps {
|
|
14
16
|
copyMarkdown?: boolean;
|
|
@@ -25,6 +27,8 @@ interface PageActionsProps {
|
|
|
25
27
|
alignment?: "left" | "right";
|
|
26
28
|
/** `menu` collects every enabled action behind one "…" trigger. */
|
|
27
29
|
variant?: "default" | "rail" | "menu";
|
|
30
|
+
/** Texts under each menu item, with provider descriptions. Only the `menu` variant renders them. */
|
|
31
|
+
descriptions?: ResolvedPageActionDescriptions;
|
|
28
32
|
/** GitHub file URL (edit view) for the current page. Used when urlTemplate contains {githubUrl}. */
|
|
29
33
|
githubFileUrl?: string | null;
|
|
30
34
|
analytics?: boolean;
|
|
@@ -61,6 +65,7 @@ declare function PageActions({
|
|
|
61
65
|
openDocsPrompt,
|
|
62
66
|
alignment,
|
|
63
67
|
variant,
|
|
68
|
+
descriptions,
|
|
64
69
|
githubFileUrl,
|
|
65
70
|
analytics,
|
|
66
71
|
askAi,
|
package/dist/page-actions.mjs
CHANGED
|
@@ -171,7 +171,7 @@ function currentPageTitle() {
|
|
|
171
171
|
const title = document.querySelector("#nd-page h1") ?? document.querySelector("article h1") ?? document.querySelector("h1");
|
|
172
172
|
return title?.innerText?.trim() || title?.textContent?.trim() || "";
|
|
173
173
|
}
|
|
174
|
-
function PageActions({ copyMarkdown, copyMarkdownFormat = "markdown", copyMarkdownIncludeTitle = false, copyMarkdownLabel = "Copy page", copyMarkdownCopiedLabel = "Copied!", openDocs, viewMarkdown = false, providers, openDocsTarget = DEFAULT_OPEN_DOCS_TARGET, openDocsPrompt = DEFAULT_OPEN_DOCS_PROMPT, alignment = "left", variant = "default", githubFileUrl, analytics = false, askAi = true, connectMcp, installSkills }) {
|
|
174
|
+
function PageActions({ copyMarkdown, copyMarkdownFormat = "markdown", copyMarkdownIncludeTitle = false, copyMarkdownLabel = "Copy page", copyMarkdownCopiedLabel = "Copied!", openDocs, viewMarkdown = false, providers, openDocsTarget = DEFAULT_OPEN_DOCS_TARGET, openDocsPrompt = DEFAULT_OPEN_DOCS_PROMPT, alignment = "left", variant = "default", descriptions, githubFileUrl, analytics = false, askAi = true, connectMcp, installSkills }) {
|
|
175
175
|
const [copied, setCopied] = useState(false);
|
|
176
176
|
const [dropdownOpen, setDropdownOpen] = useState(false);
|
|
177
177
|
const [mcpOpen, setMcpOpen] = useState(false);
|
|
@@ -317,12 +317,14 @@ function PageActions({ copyMarkdown, copyMarkdownFormat = "markdown", copyMarkdo
|
|
|
317
317
|
if (copyMarkdown) items.push({
|
|
318
318
|
key: "copy",
|
|
319
319
|
label: copyMarkdownLabel,
|
|
320
|
+
description: descriptions?.copyMarkdown,
|
|
320
321
|
icon: /* @__PURE__ */ jsx(CopyIcon, {}),
|
|
321
322
|
onSelect: () => void handleCopyMarkdown()
|
|
322
323
|
});
|
|
323
324
|
if (viewMarkdown) items.push({
|
|
324
325
|
key: "markdown",
|
|
325
326
|
label: "View as Markdown",
|
|
327
|
+
description: descriptions?.viewMarkdown,
|
|
326
328
|
icon: /* @__PURE__ */ jsx(FileTextIcon, {}),
|
|
327
329
|
href: markdownHref
|
|
328
330
|
});
|
|
@@ -331,6 +333,7 @@ function PageActions({ copyMarkdown, copyMarkdownFormat = "markdown", copyMarkdo
|
|
|
331
333
|
items.push({
|
|
332
334
|
key: `open:${provider.name}`,
|
|
333
335
|
label: `Open in ${provider.name}`,
|
|
336
|
+
description: descriptions ? provider.description : void 0,
|
|
334
337
|
icon: iconHtml ? /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: iconHtml } }) : void 0,
|
|
335
338
|
onSelect: () => handleOpen(provider)
|
|
336
339
|
});
|
|
@@ -338,7 +341,9 @@ function PageActions({ copyMarkdown, copyMarkdownFormat = "markdown", copyMarkdo
|
|
|
338
341
|
if (endpoint) items.push({
|
|
339
342
|
key: "mcp",
|
|
340
343
|
label: "Copy MCP server URL",
|
|
344
|
+
description: descriptions?.connectMcp,
|
|
341
345
|
icon: /* @__PURE__ */ jsx(CopyIcon, {}),
|
|
346
|
+
separatorBefore: true,
|
|
342
347
|
onSelect: () => void copySetup("mcp:menu", endpoint)
|
|
343
348
|
});
|
|
344
349
|
if (installSkills) items.push({
|
package/dist/tanstack-layout.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { escapeJsonLdForScript } from "./json-ld.mjs";
|
|
|
4
4
|
import { DocsPageClient } from "./docs-page-client.mjs";
|
|
5
5
|
import { resolveDocsCloudAIClientRequest } from "./docs-cloud-ai-client.mjs";
|
|
6
6
|
import { DocsCommandSearch } from "./docs-command-search.mjs";
|
|
7
|
-
import { resolveTocPageActions } from "./page-actions-config.mjs";
|
|
7
|
+
import { resolvePageActionDescriptions, resolveTocPageActions } from "./page-actions-config.mjs";
|
|
8
8
|
import { resolveReadingTimeOptions } from "./reading-time-options.mjs";
|
|
9
9
|
import { SidebarSearchWithAI } from "./sidebar-search-ai.mjs";
|
|
10
10
|
import { LocaleThemeControl } from "./locale-theme-control.mjs";
|
|
@@ -412,6 +412,7 @@ function TanstackDocsLayout({ config, tree, browserRuntime = false, telemetryFra
|
|
|
412
412
|
pageActionsPosition,
|
|
413
413
|
pageActionsAlignment,
|
|
414
414
|
pageActionsVariant: pageActions?.variant ?? "buttons",
|
|
415
|
+
pageActionsDescriptions: resolvePageActionDescriptions(pageActions?.descriptions),
|
|
415
416
|
tocActions: resolveTocPageActions(pageActions?.toc),
|
|
416
417
|
tocAskAi: pageActions?.askAi !== false,
|
|
417
418
|
footer: config.footer,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/theme",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.140",
|
|
4
4
|
"description": "Theme package for @farming-labs/docs — layout, provider, MDX components, and styles",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -162,13 +162,13 @@
|
|
|
162
162
|
"tsdown": "^0.20.3",
|
|
163
163
|
"typescript": "^5.9.3",
|
|
164
164
|
"vitest": "^4.1.8",
|
|
165
|
-
"@farming-labs/docs": "0.2.
|
|
165
|
+
"@farming-labs/docs": "0.2.140"
|
|
166
166
|
},
|
|
167
167
|
"peerDependencies": {
|
|
168
168
|
"next": ">=16.0.0",
|
|
169
169
|
"react": ">=19.2.0",
|
|
170
170
|
"react-dom": ">=19.2.0",
|
|
171
|
-
"@farming-labs/docs": "^0.2.
|
|
171
|
+
"@farming-labs/docs": "^0.2.140"
|
|
172
172
|
},
|
|
173
173
|
"peerDependenciesMeta": {
|
|
174
174
|
"next": {
|
package/styles/base.css
CHANGED
|
@@ -572,6 +572,24 @@ figure.shiki:has(figcaption) figcaption {
|
|
|
572
572
|
background: var(--color-fd-accent);
|
|
573
573
|
}
|
|
574
574
|
|
|
575
|
+
.fd-page-action-menu-text {
|
|
576
|
+
display: flex;
|
|
577
|
+
flex: 1;
|
|
578
|
+
flex-direction: column;
|
|
579
|
+
min-width: 0;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
.fd-page-action-menu-description {
|
|
583
|
+
font-size: 0.75rem;
|
|
584
|
+
line-height: 1rem;
|
|
585
|
+
color: var(--color-fd-muted-foreground);
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
.fd-page-actions-menu-separator {
|
|
589
|
+
margin: 0.25rem 0;
|
|
590
|
+
border-top: 1px solid var(--color-fd-border);
|
|
591
|
+
}
|
|
592
|
+
|
|
575
593
|
.fd-page-actions-menu-status {
|
|
576
594
|
position: absolute;
|
|
577
595
|
width: 1px;
|
|
@@ -1759,6 +1777,7 @@ figure.shiki:hover > div:first-child button {
|
|
|
1759
1777
|
.fd-sidebar-search-ai-row,
|
|
1760
1778
|
[data-theme-toggle],
|
|
1761
1779
|
a:has(> .fd-nav-title),
|
|
1780
|
+
.fd-nav-title,
|
|
1762
1781
|
a:has(.fd-nav-link)
|
|
1763
1782
|
),
|
|
1764
1783
|
#nd-docs-layout[data-fd-header="top"] #nd-sidebar div:has(> [data-theme-toggle]:only-child) {
|
|
@@ -6431,6 +6431,24 @@ figure.shiki:has(figcaption) figcaption {
|
|
|
6431
6431
|
background: var(--color-fd-accent);
|
|
6432
6432
|
}
|
|
6433
6433
|
|
|
6434
|
+
.fd-page-action-menu-text {
|
|
6435
|
+
display: flex;
|
|
6436
|
+
flex: 1;
|
|
6437
|
+
flex-direction: column;
|
|
6438
|
+
min-width: 0;
|
|
6439
|
+
}
|
|
6440
|
+
|
|
6441
|
+
.fd-page-action-menu-description {
|
|
6442
|
+
font-size: 0.75rem;
|
|
6443
|
+
line-height: 1rem;
|
|
6444
|
+
color: var(--color-fd-muted-foreground);
|
|
6445
|
+
}
|
|
6446
|
+
|
|
6447
|
+
.fd-page-actions-menu-separator {
|
|
6448
|
+
margin: 0.25rem 0;
|
|
6449
|
+
border-top: 1px solid var(--color-fd-border);
|
|
6450
|
+
}
|
|
6451
|
+
|
|
6434
6452
|
.fd-page-actions-menu-status {
|
|
6435
6453
|
position: absolute;
|
|
6436
6454
|
width: 1px;
|
|
@@ -7595,6 +7613,7 @@ figure.shiki:hover > div:first-child button {
|
|
|
7595
7613
|
.fd-sidebar-search-ai-row,
|
|
7596
7614
|
[data-theme-toggle],
|
|
7597
7615
|
a:has(> .fd-nav-title),
|
|
7616
|
+
.fd-nav-title,
|
|
7598
7617
|
a:has(.fd-nav-link)
|
|
7599
7618
|
),
|
|
7600
7619
|
#nd-docs-layout[data-fd-header="top"] #nd-sidebar div:has(> [data-theme-toggle]:only-child) {
|
|
@@ -6445,6 +6445,24 @@ figure.shiki:has(figcaption) figcaption {
|
|
|
6445
6445
|
background: var(--color-fd-accent);
|
|
6446
6446
|
}
|
|
6447
6447
|
|
|
6448
|
+
.fd-page-action-menu-text {
|
|
6449
|
+
display: flex;
|
|
6450
|
+
flex: 1;
|
|
6451
|
+
flex-direction: column;
|
|
6452
|
+
min-width: 0;
|
|
6453
|
+
}
|
|
6454
|
+
|
|
6455
|
+
.fd-page-action-menu-description {
|
|
6456
|
+
font-size: 0.75rem;
|
|
6457
|
+
line-height: 1rem;
|
|
6458
|
+
color: var(--color-fd-muted-foreground);
|
|
6459
|
+
}
|
|
6460
|
+
|
|
6461
|
+
.fd-page-actions-menu-separator {
|
|
6462
|
+
margin: 0.25rem 0;
|
|
6463
|
+
border-top: 1px solid var(--color-fd-border);
|
|
6464
|
+
}
|
|
6465
|
+
|
|
6448
6466
|
.fd-page-actions-menu-status {
|
|
6449
6467
|
position: absolute;
|
|
6450
6468
|
width: 1px;
|
|
@@ -7609,6 +7627,7 @@ figure.shiki:hover > div:first-child button {
|
|
|
7609
7627
|
.fd-sidebar-search-ai-row,
|
|
7610
7628
|
[data-theme-toggle],
|
|
7611
7629
|
a:has(> .fd-nav-title),
|
|
7630
|
+
.fd-nav-title,
|
|
7612
7631
|
a:has(.fd-nav-link)
|
|
7613
7632
|
),
|
|
7614
7633
|
#nd-docs-layout[data-fd-header="top"] #nd-sidebar div:has(> [data-theme-toggle]:only-child) {
|