@farming-labs/theme 0.2.16 → 0.2.17
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
CHANGED
|
@@ -791,6 +791,7 @@ function createDocsLayout(config, options) {
|
|
|
791
791
|
publicPath: localeContext.publicPath,
|
|
792
792
|
locale: activeLocale,
|
|
793
793
|
copyMarkdown: copyMarkdownEnabled,
|
|
794
|
+
copyMarkdownFormat: copyMarkdownConfig?.format,
|
|
794
795
|
copyMarkdownLabel: copyMarkdownConfig?.label,
|
|
795
796
|
copyMarkdownCopiedLabel: copyMarkdownConfig?.copiedLabel,
|
|
796
797
|
openDocs: openDocsEnabled,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
import { DocsFeedbackData, ReadingTimeFormat } from "@farming-labs/docs";
|
|
2
|
+
import { CopyMarkdownFormat, DocsFeedbackData, ReadingTimeFormat } from "@farming-labs/docs";
|
|
3
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/docs-page-client.d.ts
|
|
@@ -23,6 +23,7 @@ interface DocsPageClientProps {
|
|
|
23
23
|
/** Active locale (used for llms.txt links) */
|
|
24
24
|
locale?: string;
|
|
25
25
|
copyMarkdown?: boolean;
|
|
26
|
+
copyMarkdownFormat?: CopyMarkdownFormat;
|
|
26
27
|
copyMarkdownLabel?: string;
|
|
27
28
|
copyMarkdownCopiedLabel?: string;
|
|
28
29
|
openDocs?: boolean;
|
|
@@ -93,6 +94,7 @@ declare function DocsPageClient({
|
|
|
93
94
|
publicPath,
|
|
94
95
|
locale,
|
|
95
96
|
copyMarkdown,
|
|
97
|
+
copyMarkdownFormat,
|
|
96
98
|
copyMarkdownLabel,
|
|
97
99
|
copyMarkdownCopiedLabel,
|
|
98
100
|
openDocs,
|
|
@@ -255,7 +255,7 @@ function findThreadlineTocActionsContainer() {
|
|
|
255
255
|
}
|
|
256
256
|
return toc.parentElement ?? toc;
|
|
257
257
|
}
|
|
258
|
-
function DocsPageClient({ tocEnabled, tocStyle = "default", breadcrumbEnabled = true, changelogBasePath, entry = "docs", publicPath, locale, copyMarkdown = false, 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", structuredDataMap, structuredData: structuredDataProp, readingTimeEnabled = false, lastUpdatedEnabled = true, lastUpdatedPosition = "footer", llmsTxtEnabled = false, descriptionMap, description, feedbackEnabled = false, feedbackQuestion, feedbackPlaceholder, feedbackRequireComment, feedbackPositiveLabel, feedbackNegativeLabel, feedbackSubmitLabel, feedbackOnFeedback, analytics = false, children }) {
|
|
258
|
+
function DocsPageClient({ tocEnabled, tocStyle = "default", breadcrumbEnabled = true, changelogBasePath, entry = "docs", publicPath, locale, copyMarkdown = false, copyMarkdownFormat, 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", structuredDataMap, structuredData: structuredDataProp, readingTimeEnabled = false, lastUpdatedEnabled = true, lastUpdatedPosition = "footer", llmsTxtEnabled = false, descriptionMap, description, feedbackEnabled = false, feedbackQuestion, feedbackPlaceholder, feedbackRequireComment, feedbackPositiveLabel, feedbackNegativeLabel, feedbackSubmitLabel, 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);
|
|
@@ -465,6 +465,7 @@ function DocsPageClient({ tocEnabled, tocStyle = "default", breadcrumbEnabled =
|
|
|
465
465
|
"data-actions-alignment": pageActionsAlignment,
|
|
466
466
|
children: /* @__PURE__ */ jsx(PageActions, {
|
|
467
467
|
copyMarkdown,
|
|
468
|
+
copyMarkdownFormat,
|
|
468
469
|
copyMarkdownLabel,
|
|
469
470
|
copyMarkdownCopiedLabel,
|
|
470
471
|
openDocs,
|
|
@@ -510,6 +511,7 @@ function DocsPageClient({ tocEnabled, tocStyle = "default", breadcrumbEnabled =
|
|
|
510
511
|
className: "fd-actions-toc-portal not-prose",
|
|
511
512
|
children: /* @__PURE__ */ jsx(PageActions, {
|
|
512
513
|
copyMarkdown,
|
|
514
|
+
copyMarkdownFormat,
|
|
513
515
|
copyMarkdownLabel,
|
|
514
516
|
copyMarkdownCopiedLabel,
|
|
515
517
|
openDocs,
|
|
@@ -564,6 +566,7 @@ function DocsPageClient({ tocEnabled, tocStyle = "default", breadcrumbEnabled =
|
|
|
564
566
|
"data-actions-alignment": pageActionsAlignment,
|
|
565
567
|
children: /* @__PURE__ */ jsx(PageActions, {
|
|
566
568
|
copyMarkdown,
|
|
569
|
+
copyMarkdownFormat,
|
|
567
570
|
copyMarkdownLabel,
|
|
568
571
|
copyMarkdownCopiedLabel,
|
|
569
572
|
openDocs,
|
package/dist/index.d.mts
CHANGED
|
@@ -16,8 +16,8 @@ import { HoverLink, HoverLinkProps } from "./hover-link.mjs";
|
|
|
16
16
|
import { Prompt, PromptProps } from "./prompt.mjs";
|
|
17
17
|
import { Agent, CodeGroup } from "./mdx.mjs";
|
|
18
18
|
import { DocsLayout } from "fumadocs-ui/layouts/docs";
|
|
19
|
-
import { AIConfig, BreadcrumbConfig, ChangelogConfig, ChangelogFrontmatter, CopyMarkdownConfig, DocsConfig, DocsFeedbackData, DocsFeedbackValue, DocsMetadata, DocsNav, DocsTheme, FeedbackConfig, FontStyle, OGConfig, OpenDocsConfig, OpenDocsProvider, PageActionsConfig, PageFrontmatter, SidebarConfig, ThemeToggleConfig, TypographyConfig, UIConfig, createTheme, deepMerge, defineDocs, extendTheme } from "@farming-labs/docs";
|
|
19
|
+
import { AIConfig, BreadcrumbConfig, ChangelogConfig, ChangelogFrontmatter, CopyMarkdownConfig, CopyMarkdownFormat, DocsConfig, DocsFeedbackData, DocsFeedbackValue, DocsMetadata, DocsNav, DocsTheme, FeedbackConfig, FontStyle, OGConfig, OpenDocsConfig, OpenDocsProvider, PageActionsConfig, PageFrontmatter, SidebarConfig, ThemeToggleConfig, TypographyConfig, UIConfig, createTheme, deepMerge, defineDocs, extendTheme } from "@farming-labs/docs";
|
|
20
20
|
import { DocsBody, DocsPage } from "fumadocs-ui/layouts/docs/page";
|
|
21
21
|
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
|
|
22
22
|
import { CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, Pre } from "fumadocs-ui/components/codeblock";
|
|
23
|
-
export { type AIConfig, Agent, type BreadcrumbConfig, type ChangelogConfig, type ChangelogFrontmatter, CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, CodeGroup, CommandGridUIDefaults, ConcreteUIDefaults, type CopyMarkdownConfig, DocsBody, DocsClientHooks, DocsCommandSearch, type DocsConfig, DocsFeedback, type DocsFeedbackData, type DocsFeedbackProps, type DocsFeedbackValue, DocsLayout, type DocsMetadata, type DocsNav, DocsPage, DocsPageClient, type DocsTheme, type FeedbackConfig, type FontStyle, DefaultUIDefaults as FumadocsUIDefaults, HardlineUIDefaults, HoverLink, type HoverLinkProps, LedgerUIDefaults, type OGConfig, type OpenDocsConfig, type OpenDocsProvider, PageActions, type PageActionsConfig, type PageFrontmatter, Pre, Prompt, type PromptProps, RootProvider, type SidebarConfig, Tab, Tabs, type ThemeToggleConfig, ThreadlineUIDefaults, type TypographyConfig, type UIConfig, commandGrid, concrete, createDocsLayout, createDocsMetadata, createPageMetadata, createTheme, deepMerge, defineDocs, extendTheme, fumadocs, hardline, ledger, threadline, threadlinePageActions, withLangInUrl };
|
|
23
|
+
export { type AIConfig, Agent, type BreadcrumbConfig, type ChangelogConfig, type ChangelogFrontmatter, CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, CodeGroup, CommandGridUIDefaults, ConcreteUIDefaults, type CopyMarkdownConfig, type CopyMarkdownFormat, DocsBody, DocsClientHooks, DocsCommandSearch, type DocsConfig, DocsFeedback, type DocsFeedbackData, type DocsFeedbackProps, type DocsFeedbackValue, DocsLayout, type DocsMetadata, type DocsNav, DocsPage, DocsPageClient, type DocsTheme, type FeedbackConfig, type FontStyle, DefaultUIDefaults as FumadocsUIDefaults, HardlineUIDefaults, HoverLink, type HoverLinkProps, LedgerUIDefaults, type OGConfig, type OpenDocsConfig, type OpenDocsProvider, PageActions, type PageActionsConfig, type PageFrontmatter, Pre, Prompt, type PromptProps, RootProvider, type SidebarConfig, Tab, Tabs, type ThemeToggleConfig, ThreadlineUIDefaults, type TypographyConfig, type UIConfig, commandGrid, concrete, createDocsLayout, createDocsMetadata, createPageMetadata, createTheme, deepMerge, defineDocs, extendTheme, fumadocs, hardline, ledger, threadline, threadlinePageActions, withLangInUrl };
|
package/dist/page-actions.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CopyMarkdownFormat } from "@farming-labs/docs";
|
|
1
2
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
3
|
|
|
3
4
|
//#region src/page-actions.d.ts
|
|
@@ -11,6 +12,7 @@ interface SerializedProvider {
|
|
|
11
12
|
}
|
|
12
13
|
interface PageActionsProps {
|
|
13
14
|
copyMarkdown?: boolean;
|
|
15
|
+
copyMarkdownFormat?: CopyMarkdownFormat;
|
|
14
16
|
copyMarkdownLabel?: string;
|
|
15
17
|
copyMarkdownCopiedLabel?: string;
|
|
16
18
|
openDocs?: boolean;
|
|
@@ -25,6 +27,7 @@ interface PageActionsProps {
|
|
|
25
27
|
}
|
|
26
28
|
declare function PageActions({
|
|
27
29
|
copyMarkdown,
|
|
30
|
+
copyMarkdownFormat,
|
|
28
31
|
copyMarkdownLabel,
|
|
29
32
|
copyMarkdownCopiedLabel,
|
|
30
33
|
openDocs,
|
package/dist/page-actions.mjs
CHANGED
|
@@ -132,7 +132,7 @@ function pageUrlToMarkdownUrl(pageUrl) {
|
|
|
132
132
|
function fillPromptTemplate(template, values) {
|
|
133
133
|
return template.replace(/\{pageUrl\}/g, values.pageUrl).replace(/\{markdownUrl\}/g, values.markdownUrl).replace(/\{sourceUrl\}/g, values.sourceUrl).replace(/\{mdxUrl\}/g, values.sourceUrl).replace(/\{githubUrl\}/g, values.githubUrl).replace(/\{url\}/g, values.url);
|
|
134
134
|
}
|
|
135
|
-
function PageActions({ copyMarkdown, copyMarkdownLabel = "Copy page", copyMarkdownCopiedLabel = "Copied!", openDocs, providers, openDocsTarget = DEFAULT_OPEN_DOCS_TARGET, openDocsPrompt = DEFAULT_OPEN_DOCS_PROMPT, alignment = "left", variant = "default", githubFileUrl, analytics = false }) {
|
|
135
|
+
function PageActions({ copyMarkdown, copyMarkdownFormat = "markdown", copyMarkdownLabel = "Copy page", copyMarkdownCopiedLabel = "Copied!", openDocs, providers, openDocsTarget = DEFAULT_OPEN_DOCS_TARGET, openDocsPrompt = DEFAULT_OPEN_DOCS_PROMPT, alignment = "left", variant = "default", githubFileUrl, analytics = false }) {
|
|
136
136
|
const [copied, setCopied] = useState(false);
|
|
137
137
|
const [dropdownOpen, setDropdownOpen] = useState(false);
|
|
138
138
|
const dropdownRef = useRef(null);
|
|
@@ -143,7 +143,7 @@ function PageActions({ copyMarkdown, copyMarkdownLabel = "Copy page", copyMarkdo
|
|
|
143
143
|
const handleCopyMarkdown = useCallback(async () => {
|
|
144
144
|
try {
|
|
145
145
|
let content = "";
|
|
146
|
-
try {
|
|
146
|
+
if (copyMarkdownFormat === "markdown") try {
|
|
147
147
|
const response = await fetch(markdownHref, { headers: { Accept: "text/markdown" } });
|
|
148
148
|
if (response.ok) content = await response.text();
|
|
149
149
|
} catch {}
|
|
@@ -154,6 +154,7 @@ function PageActions({ copyMarkdown, copyMarkdownLabel = "Copy page", copyMarkdo
|
|
|
154
154
|
type: "page_action_copy_markdown",
|
|
155
155
|
properties: {
|
|
156
156
|
contentLength: content.length,
|
|
157
|
+
format: copyMarkdownFormat,
|
|
157
158
|
pathname
|
|
158
159
|
}
|
|
159
160
|
});
|
|
@@ -162,6 +163,7 @@ function PageActions({ copyMarkdown, copyMarkdownLabel = "Copy page", copyMarkdo
|
|
|
162
163
|
} catch {}
|
|
163
164
|
}, [
|
|
164
165
|
analytics,
|
|
166
|
+
copyMarkdownFormat,
|
|
165
167
|
markdownHref,
|
|
166
168
|
pathname
|
|
167
169
|
]);
|
|
@@ -238,6 +240,7 @@ function PageActions({ copyMarkdown, copyMarkdownLabel = "Copy page", copyMarkdo
|
|
|
238
240
|
onClick: handleCopyMarkdown,
|
|
239
241
|
className: "fd-page-action-btn",
|
|
240
242
|
"data-copied": copied,
|
|
243
|
+
"data-copy-markdown-format": copyMarkdownFormat,
|
|
241
244
|
children: [copied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopyIcon, {}), /* @__PURE__ */ jsx("span", { children: copied ? copyMarkdownCopiedLabel : copyMarkdownLabel })]
|
|
242
245
|
}),
|
|
243
246
|
openDocs && /* @__PURE__ */ jsxs("a", {
|
|
@@ -271,6 +274,7 @@ function PageActions({ copyMarkdown, copyMarkdownLabel = "Copy page", copyMarkdo
|
|
|
271
274
|
onClick: handleCopyMarkdown,
|
|
272
275
|
className: "fd-page-action-btn",
|
|
273
276
|
"data-copied": copied,
|
|
277
|
+
"data-copy-markdown-format": copyMarkdownFormat,
|
|
274
278
|
children: [copied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopyIcon, {}), /* @__PURE__ */ jsx("span", { children: copied ? copyMarkdownCopiedLabel : copyMarkdownLabel })]
|
|
275
279
|
}), openDocs && resolvedProviders.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
276
280
|
ref: dropdownRef,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/theme",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.17",
|
|
4
4
|
"description": "Theme package for @farming-labs/docs — layout, provider, MDX components, and styles",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
"tsdown": "^0.20.3",
|
|
146
146
|
"typescript": "^5.9.3",
|
|
147
147
|
"vitest": "^4.1.8",
|
|
148
|
-
"@farming-labs/docs": "0.2.
|
|
148
|
+
"@farming-labs/docs": "0.2.17"
|
|
149
149
|
},
|
|
150
150
|
"peerDependencies": {
|
|
151
151
|
"@farming-labs/docs": ">=0.0.1",
|