@farming-labs/theme 0.2.55 → 0.2.56
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-api.mjs +27 -56
- package/dist/docs-layout.mjs +2 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/mdx.d.mts +23 -4
- package/dist/mdx.mjs +16 -3
- package/package.json +2 -2
package/dist/docs-api.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { getNextAppDir } from "./get-app-dir.mjs";
|
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import matter from "gray-matter";
|
|
6
|
-
import { DEFAULT_SITEMAP_MD_DOCS_ROUTE, acceptsDocsMarkdown, buildDocsAskAIContext, buildDocsConfigMap, buildDocsDiagnostics, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsMarkdownResponse, createDocsRobotsResponse, createDocsSitemapResponse, detectDocsMarkdownAgentRequest, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsTelemetryAgentSurfaceEvent, emitDocsTelemetryProjectEvent, formatDocsAskAIPackageHints, getDocsLlmsTxtMaxCharsIssue, hasDocsMarkdownSignatureAgent, inferDocsTelemetryAgentSurface, isDocsConfigRequest, isDocsDiagnosticsRequest, normalizeDocsRelated, normalizePageAgentFrontmatter, performDocsSearch, renderDocsLlmsTxt, renderDocsMarkdownDocument, resolveAskAISearchRequestConfig, resolveChangelogConfig, resolveDocsAgentContractMcpTools, resolveDocsI18n, resolveDocsLlmsTxtRequest, resolveDocsLlmsTxtSections, resolveDocsLocale, resolveDocsMetadataBaseUrl, resolveDocsSitemapConfig, resolvePageSidebarFolderIndexBehavior, resolveSearchRequestConfig, selectDocsLlmsTxtContent } from "@farming-labs/docs";
|
|
6
|
+
import { DEFAULT_SITEMAP_MD_DOCS_ROUTE, acceptsDocsMarkdown, buildDocsAskAIContext, buildDocsConfigMap, buildDocsDiagnostics, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsMarkdownResponse, createDocsRobotsResponse, createDocsSitemapResponse, detectDocsMarkdownAgentRequest, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsTelemetryAgentSurfaceEvent, emitDocsTelemetryProjectEvent, formatDocsAskAIPackageHints, getDocsLlmsTxtMaxCharsIssue, hasDocsMarkdownSignatureAgent, inferDocsTelemetryAgentSurface, isDocsConfigRequest, isDocsDiagnosticsRequest, normalizeDocsRelated, normalizePageAgentFrontmatter, performDocsSearch, renderDocsLlmsTxt, renderDocsMarkdownDocument, resolveAskAISearchRequestConfig, resolveChangelogConfig, resolveDocsAgentContractMcpTools, resolveDocsAudienceMdxContent, resolveDocsI18n, resolveDocsLlmsTxtRequest, resolveDocsLlmsTxtSections, resolveDocsLocale, resolveDocsMetadataBaseUrl, resolveDocsSitemapConfig, resolvePageSidebarFolderIndexBehavior, resolveSearchRequestConfig, selectDocsLlmsTxtContent, stripGeneratedAgentProvenance } from "@farming-labs/docs";
|
|
7
7
|
import { buildApiReferenceOpenApiDocumentAsync, createDocsMcpHttpHandler, createFilesystemDocsMcpSource, readDocsSitemapManifest, resolveApiReferenceConfig, resolveDocsMcpConfig } from "@farming-labs/docs/server";
|
|
8
8
|
|
|
9
9
|
//#region src/docs-api.ts
|
|
@@ -275,8 +275,8 @@ function buildAgentSpec({ origin, entry, i18n, search, mcp, feedback, llms, site
|
|
|
275
275
|
apiPattern: `${DEFAULT_DOCS_API_ROUTE}?format=markdown&path={slug}`,
|
|
276
276
|
resolutionOrder: [
|
|
277
277
|
"agent.md",
|
|
278
|
-
"
|
|
279
|
-
"page markdown"
|
|
278
|
+
"agent audience projection",
|
|
279
|
+
"shared page markdown"
|
|
280
280
|
]
|
|
281
281
|
},
|
|
282
282
|
agentContract: {
|
|
@@ -824,53 +824,6 @@ function stripCommentsAndStrings(content) {
|
|
|
824
824
|
}
|
|
825
825
|
return result;
|
|
826
826
|
}
|
|
827
|
-
function resolveAgentMdxContent(content, audience) {
|
|
828
|
-
const lines = content.split("\n");
|
|
829
|
-
const output = [];
|
|
830
|
-
let fenceMarker = null;
|
|
831
|
-
let agentDepth = 0;
|
|
832
|
-
for (const line of lines) {
|
|
833
|
-
const trimmed = line.trim();
|
|
834
|
-
const fenceMatch = trimmed.match(/^(`{3,}|~{3,})/);
|
|
835
|
-
if (fenceMatch) {
|
|
836
|
-
if (!fenceMarker) fenceMarker = fenceMatch[1];
|
|
837
|
-
else if (trimmed.startsWith(fenceMarker)) fenceMarker = null;
|
|
838
|
-
if (audience === "agent" || agentDepth === 0) output.push(line);
|
|
839
|
-
continue;
|
|
840
|
-
}
|
|
841
|
-
if (!fenceMarker) {
|
|
842
|
-
if (/^<Agent(?:\s[^>]*)?\/>$/.test(trimmed)) continue;
|
|
843
|
-
const singleLineMatch = line.match(/^(\s*)<Agent(?:\s[^>]*)?>([\s\S]*?)<\/Agent>\s*$/);
|
|
844
|
-
if (singleLineMatch) {
|
|
845
|
-
if (audience === "agent" && singleLineMatch[2]) output.push(`${singleLineMatch[1]}${singleLineMatch[2]}`);
|
|
846
|
-
continue;
|
|
847
|
-
}
|
|
848
|
-
if (line.match(/^(\s*)<Agent(?:\s[^>]*)?>\s*$/)) {
|
|
849
|
-
agentDepth += 1;
|
|
850
|
-
continue;
|
|
851
|
-
}
|
|
852
|
-
const openWithContentMatch = line.match(/^(\s*)<Agent(?:\s[^>]*)?>(.*)$/);
|
|
853
|
-
if (openWithContentMatch) {
|
|
854
|
-
agentDepth += 1;
|
|
855
|
-
if (audience === "agent" && openWithContentMatch[2]) output.push(`${openWithContentMatch[1]}${openWithContentMatch[2]}`);
|
|
856
|
-
continue;
|
|
857
|
-
}
|
|
858
|
-
const closeWithContentMatch = line.match(/^(.*)<\/Agent>\s*$/);
|
|
859
|
-
if (closeWithContentMatch && agentDepth > 0) {
|
|
860
|
-
if (audience === "agent" && closeWithContentMatch[1]) output.push(closeWithContentMatch[1]);
|
|
861
|
-
agentDepth = Math.max(0, agentDepth - 1);
|
|
862
|
-
continue;
|
|
863
|
-
}
|
|
864
|
-
if (/^<\/Agent>\s*$/.test(trimmed) && agentDepth > 0) {
|
|
865
|
-
agentDepth = Math.max(0, agentDepth - 1);
|
|
866
|
-
continue;
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
if (agentDepth > 0 && audience === "human") continue;
|
|
870
|
-
output.push(line);
|
|
871
|
-
}
|
|
872
|
-
return output.join("\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
873
|
-
}
|
|
874
827
|
function stripMdx(content) {
|
|
875
828
|
return content.replace(/^(import|export)\s.*$/gm, "").replace(/<[^>]+\/>/g, "").replace(/<\/?[A-Z][^>]*>/g, "").replace(/<\/?[a-z][^>]*>/g, "").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/!\[([^\]]*)\]\([^)]+\)/g, "$1").replace(/^#{1,6}\s+/gm, "").replace(/(\*{1,3}|_{1,3})(.*?)\1/g, "$2").replace(/```[\s\S]*?```/g, "").replace(/`([^`]+)`/g, "$1").replace(/^>\s+/gm, "").replace(/^[-*_]{3,}\s*$/gm, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
876
829
|
}
|
|
@@ -913,6 +866,20 @@ function isHiddenFolderIndexPageDir(dir) {
|
|
|
913
866
|
return false;
|
|
914
867
|
}
|
|
915
868
|
}
|
|
869
|
+
function readAudienceAgentDoc(dir) {
|
|
870
|
+
const agentPath = path.join(dir, "agent.md");
|
|
871
|
+
if (!fs.existsSync(agentPath)) return void 0;
|
|
872
|
+
try {
|
|
873
|
+
const { content } = matter(stripGeneratedAgentProvenance(fs.readFileSync(agentPath, "utf-8")));
|
|
874
|
+
const agentRawContent = resolveDocsAudienceMdxContent(content, "agent");
|
|
875
|
+
return {
|
|
876
|
+
agentContent: stripMdx(agentRawContent),
|
|
877
|
+
agentRawContent
|
|
878
|
+
};
|
|
879
|
+
} catch {
|
|
880
|
+
return;
|
|
881
|
+
}
|
|
882
|
+
}
|
|
916
883
|
function scanDocsDir(docsDir, entry, locale, excludedDirs = [], publicPath = `/${normalizePathSegment(entry) || "docs"}`) {
|
|
917
884
|
const indexes = [];
|
|
918
885
|
function isExcluded(dir) {
|
|
@@ -933,8 +900,9 @@ function scanDocsDir(docsDir, entry, locale, excludedDirs = [], publicPath = `/$
|
|
|
933
900
|
const title = data.title || slugParts[slugParts.length - 1]?.replace(/-/g, " ") || "Documentation";
|
|
934
901
|
const description = data.description;
|
|
935
902
|
const { content: fileContent } = matter(raw);
|
|
936
|
-
const rawContent =
|
|
937
|
-
const agentRawContent =
|
|
903
|
+
const rawContent = resolveDocsAudienceMdxContent(fileContent, "human");
|
|
904
|
+
const agentRawContent = resolveDocsAudienceMdxContent(fileContent, "agent");
|
|
905
|
+
const agentDoc = readAudienceAgentDoc(dir);
|
|
938
906
|
const content = stripMdx(rawContent);
|
|
939
907
|
const url = withLangInUrl(publicDocsRoute(publicPath, slugParts), locale);
|
|
940
908
|
indexes.push({
|
|
@@ -948,7 +916,8 @@ function scanDocsDir(docsDir, entry, locale, excludedDirs = [], publicPath = `/$
|
|
|
948
916
|
url,
|
|
949
917
|
sourcePath: pageSource.replace(/\\/g, "/"),
|
|
950
918
|
lastModified: fs.statSync(pageSource).mtime.toISOString(),
|
|
951
|
-
locale
|
|
919
|
+
locale,
|
|
920
|
+
...agentDoc
|
|
952
921
|
});
|
|
953
922
|
}
|
|
954
923
|
} catch {}
|
|
@@ -994,8 +963,9 @@ function scanChangelogDir(changelogDir, entryPath, changelogPath, locale, public
|
|
|
994
963
|
if (data.draft === true) continue;
|
|
995
964
|
const title = data.title || name.replace(/-/g, " ");
|
|
996
965
|
const description = data.description;
|
|
997
|
-
const rawContent =
|
|
998
|
-
const agentRawContent =
|
|
966
|
+
const rawContent = resolveDocsAudienceMdxContent(fileContent, "human");
|
|
967
|
+
const agentRawContent = resolveDocsAudienceMdxContent(fileContent, "agent");
|
|
968
|
+
const agentDoc = readAudienceAgentDoc(entryDir);
|
|
999
969
|
const content = stripMdx(rawContent);
|
|
1000
970
|
const url = withLangInUrl(publicDocsRoute(publicPath, [changelogPath, name]), locale);
|
|
1001
971
|
const tags = Array.isArray(data.tags) ? data.tags.filter((value) => typeof value === "string") : void 0;
|
|
@@ -1011,7 +981,8 @@ function scanChangelogDir(changelogDir, entryPath, changelogPath, locale, public
|
|
|
1011
981
|
locale,
|
|
1012
982
|
type: "changelog",
|
|
1013
983
|
version: typeof data.version === "string" ? data.version : void 0,
|
|
1014
|
-
tags
|
|
984
|
+
tags,
|
|
985
|
+
...agentDoc
|
|
1015
986
|
});
|
|
1016
987
|
} catch {}
|
|
1017
988
|
}
|
package/dist/docs-layout.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import path from "node:path";
|
|
|
13
13
|
import matter from "gray-matter";
|
|
14
14
|
import { DocsLayout } from "fumadocs-ui/layouts/docs";
|
|
15
15
|
import { Suspense } from "react";
|
|
16
|
-
import { applySidebarFolderIndexBehavior, buildPageOpenGraph, buildPageTwitter, normalizePageAgentFrontmatter, renderDocsPageStructuredDataJson, resolveChangelogConfig,
|
|
16
|
+
import { applySidebarFolderIndexBehavior, buildPageOpenGraph, buildPageTwitter, normalizePageAgentFrontmatter, renderDocsPageStructuredDataJson, resolveChangelogConfig, resolveDocsAnalyticsConfig, resolveDocsAudienceMdxContent, resolveDocsMetadataBaseUrl, resolvePageSidebarFolderIndexBehavior, toDocsMarkdownUrl } from "@farming-labs/docs";
|
|
17
17
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
18
|
|
|
19
19
|
//#region src/docs-layout.tsx
|
|
@@ -390,7 +390,7 @@ function buildReadingTimeMap(config, ctx, options) {
|
|
|
390
390
|
const pagePath = path.join(dir, "page.mdx");
|
|
391
391
|
if (fs.existsSync(pagePath)) {
|
|
392
392
|
const { data, content } = matter(fs.readFileSync(pagePath, "utf-8"));
|
|
393
|
-
const minutes = resolvePageReadingTime(data,
|
|
393
|
+
const minutes = resolvePageReadingTime(data, resolveDocsAudienceMdxContent(content, "human"), options);
|
|
394
394
|
if (typeof minutes === "number") {
|
|
395
395
|
const url = publicDocsRoute(ctx, slugParts);
|
|
396
396
|
map[url] = minutes;
|
package/dist/index.d.mts
CHANGED
|
@@ -14,10 +14,10 @@ import { PageActions } from "./page-actions.mjs";
|
|
|
14
14
|
import { withLangInUrl } from "./i18n.mjs";
|
|
15
15
|
import { HoverLink, HoverLinkProps } from "./hover-link.mjs";
|
|
16
16
|
import { Prompt, PromptProps } from "./prompt.mjs";
|
|
17
|
-
import { Agent, CodeGroup } from "./mdx.mjs";
|
|
17
|
+
import { Agent, AgentProps, Audience, AudienceProps, CodeGroup, CodeGroupProps, Human, HumanProps } from "./mdx.mjs";
|
|
18
18
|
import { DocsLayout } from "fumadocs-ui/layouts/docs";
|
|
19
|
-
import { AIConfig, BreadcrumbConfig, ChangelogConfig, ChangelogFrontmatter, CopyMarkdownConfig, CopyMarkdownFormat, DocsConfig, DocsFeedbackData, DocsFeedbackValue, DocsMetadata, DocsNav, DocsTheme, FeedbackConfig, FontStyle, OGConfig, OpenDocsConfig, OpenDocsProvider, PageActionsConfig, PageAgentAppliesTo, PageAgentCommand, PageAgentFailureMode, PageAgentFrontmatter, PageAgentVerification, PageFrontmatter, SidebarConfig, ThemeToggleConfig, TypographyConfig, UIConfig, createTheme, deepMerge, defineDocs, extendTheme } from "@farming-labs/docs";
|
|
19
|
+
import { AIConfig, BreadcrumbConfig, ChangelogConfig, ChangelogFrontmatter, CopyMarkdownConfig, CopyMarkdownFormat, DocsConfig, DocsContentAudience, DocsFeedbackData, DocsFeedbackValue, DocsMetadata, DocsNav, DocsTheme, FeedbackConfig, FontStyle, OGConfig, OpenDocsConfig, OpenDocsProvider, PageActionsConfig, PageAgentAppliesTo, PageAgentCommand, PageAgentFailureMode, PageAgentFrontmatter, PageAgentVerification, 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, 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 PageAgentAppliesTo, type PageAgentCommand, type PageAgentFailureMode, type PageAgentFrontmatter, type PageAgentVerification, 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 AgentProps, Audience, type AudienceProps, type BreadcrumbConfig, type ChangelogConfig, type ChangelogFrontmatter, CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, CodeGroup, type CodeGroupProps, CommandGridUIDefaults, ConcreteUIDefaults, type CopyMarkdownConfig, type CopyMarkdownFormat, DocsBody, DocsClientHooks, DocsCommandSearch, type DocsConfig, type DocsContentAudience, 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, Human, type HumanProps, LedgerUIDefaults, type OGConfig, type OpenDocsConfig, type OpenDocsProvider, PageActions, type PageActionsConfig, type PageAgentAppliesTo, type PageAgentCommand, type PageAgentFailureMode, type PageAgentFrontmatter, type PageAgentVerification, 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/index.mjs
CHANGED
|
@@ -14,11 +14,11 @@ import { ThreadlineUIDefaults, threadline, threadlinePageActions } from "./threa
|
|
|
14
14
|
import { DocsClientHooks } from "./docs-client-hooks.mjs";
|
|
15
15
|
import { HoverLink } from "./hover-link.mjs";
|
|
16
16
|
import { Prompt } from "./prompt.mjs";
|
|
17
|
-
import { Agent, CodeGroup } from "./mdx.mjs";
|
|
17
|
+
import { Agent, Audience, CodeGroup, Human } from "./mdx.mjs";
|
|
18
18
|
import { DocsLayout } from "fumadocs-ui/layouts/docs";
|
|
19
19
|
import { 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
23
|
|
|
24
|
-
export { Agent, CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, CodeGroup, CommandGridUIDefaults, ConcreteUIDefaults, DocsBody, DocsClientHooks, DocsCommandSearch, DocsFeedback, DocsLayout, DocsPage, DocsPageClient, DefaultUIDefaults as FumadocsUIDefaults, HardlineUIDefaults, HoverLink, LedgerUIDefaults, PageActions, Pre, Prompt, RootProvider, Tab, Tabs, ThreadlineUIDefaults, commandGrid, concrete, createDocsLayout, createDocsMetadata, createPageMetadata, createTheme, deepMerge, defineDocs, extendTheme, fumadocs, hardline, ledger, threadline, threadlinePageActions, withLangInUrl };
|
|
24
|
+
export { Agent, Audience, CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, CodeGroup, CommandGridUIDefaults, ConcreteUIDefaults, DocsBody, DocsClientHooks, DocsCommandSearch, DocsFeedback, DocsLayout, DocsPage, DocsPageClient, DefaultUIDefaults as FumadocsUIDefaults, HardlineUIDefaults, HoverLink, Human, LedgerUIDefaults, PageActions, Pre, Prompt, RootProvider, Tab, Tabs, ThreadlineUIDefaults, commandGrid, concrete, createDocsLayout, createDocsMetadata, createPageMetadata, createTheme, deepMerge, defineDocs, extendTheme, fumadocs, hardline, ledger, threadline, threadlinePageActions, withLangInUrl };
|
package/dist/mdx.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { MDXImg } from "./mdx-img.mjs";
|
|
|
2
2
|
import { HoverLink } from "./hover-link.mjs";
|
|
3
3
|
import { Prompt, PromptIconValue, PromptOpenDocsProvider } from "./prompt.mjs";
|
|
4
4
|
import React from "react";
|
|
5
|
-
import { CodeBlockCopyData, DocsTheme } from "@farming-labs/docs";
|
|
5
|
+
import { CodeBlockCopyData, DocsContentAudience, DocsTheme } from "@farming-labs/docs";
|
|
6
6
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
7
7
|
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
|
|
8
8
|
import { CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger } from "fumadocs-ui/components/codeblock";
|
|
@@ -15,9 +15,26 @@ import * as fumadocs_ui_components_callout0 from "fumadocs-ui/components/callout
|
|
|
15
15
|
declare function Table(props: React.ComponentPropsWithoutRef<"table">): React.DetailedReactHTMLElement<{
|
|
16
16
|
className: string;
|
|
17
17
|
}, HTMLElement>;
|
|
18
|
-
|
|
18
|
+
interface AgentProps {
|
|
19
19
|
children?: React.ReactNode;
|
|
20
|
-
}
|
|
20
|
+
}
|
|
21
|
+
interface HumanProps {
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
}
|
|
24
|
+
interface AudienceProps {
|
|
25
|
+
only: DocsContentAudience;
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
declare function Agent({
|
|
29
|
+
children
|
|
30
|
+
}: AgentProps): React.FunctionComponentElement<React.FragmentProps> | null;
|
|
31
|
+
declare function Human({
|
|
32
|
+
children
|
|
33
|
+
}: HumanProps): React.FunctionComponentElement<React.FragmentProps> | null;
|
|
34
|
+
declare function Audience({
|
|
35
|
+
only,
|
|
36
|
+
children
|
|
37
|
+
}: AudienceProps): React.FunctionComponentElement<React.FragmentProps> | null;
|
|
21
38
|
interface CodeGroupProps extends Omit<React.ComponentPropsWithoutRef<typeof CodeBlockTabs>, "children"> {
|
|
22
39
|
children?: React.ReactNode;
|
|
23
40
|
/**
|
|
@@ -40,8 +57,10 @@ declare const extendedMdxComponents: {
|
|
|
40
57
|
img: typeof MDXImg;
|
|
41
58
|
table: typeof Table;
|
|
42
59
|
Agent: typeof Agent;
|
|
60
|
+
Audience: typeof Audience;
|
|
43
61
|
CodeGroup: typeof CodeGroup;
|
|
44
62
|
HoverLink: typeof HoverLink;
|
|
63
|
+
Human: typeof Human;
|
|
45
64
|
Prompt: typeof Prompt;
|
|
46
65
|
Tab: typeof Tab;
|
|
47
66
|
Tabs: typeof Tabs;
|
|
@@ -76,4 +95,4 @@ interface GetMDXComponentsOptions {
|
|
|
76
95
|
}
|
|
77
96
|
declare function getMDXComponents<T extends Record<string, unknown> = Record<string, unknown>>(overrides?: T, options?: GetMDXComponentsOptions): typeof extendedMdxComponents & T;
|
|
78
97
|
//#endregion
|
|
79
|
-
export { Agent, CodeGroup, CodeGroupProps, GetMDXComponentsOptions, HoverLink, Prompt, Tab, Tabs, defaultMdxComponents, extendedMdxComponents, getMDXComponents };
|
|
98
|
+
export { Agent, AgentProps, Audience, AudienceProps, CodeGroup, CodeGroupProps, GetMDXComponentsOptions, HoverLink, Human, HumanProps, Prompt, Tab, Tabs, defaultMdxComponents, extendedMdxComponents, getMDXComponents };
|
package/dist/mdx.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import { HoverLink } from "./hover-link.mjs";
|
|
|
5
5
|
import { extractPromptText } from "./prompt-text.mjs";
|
|
6
6
|
import { Prompt } from "./prompt.mjs";
|
|
7
7
|
import React from "react";
|
|
8
|
+
import { resolveDocsAudienceExposure } from "@farming-labs/docs";
|
|
8
9
|
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
|
|
9
10
|
import { CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger } from "fumadocs-ui/components/codeblock";
|
|
10
11
|
import defaultMdxComponents from "fumadocs-ui/mdx";
|
|
@@ -31,8 +32,18 @@ import defaultMdxComponents from "fumadocs-ui/mdx";
|
|
|
31
32
|
function Table(props) {
|
|
32
33
|
return React.createElement("div", { className: "fd-table-wrapper relative overflow-auto prose-no-margin my-6" }, React.createElement("table", props));
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
-
return null;
|
|
35
|
+
function renderAudience(only, audience, children) {
|
|
36
|
+
if (!resolveDocsAudienceExposure(only, audience)) return null;
|
|
37
|
+
return React.createElement(React.Fragment, null, children);
|
|
38
|
+
}
|
|
39
|
+
function Agent({ children }) {
|
|
40
|
+
return renderAudience("agent", "human", children);
|
|
41
|
+
}
|
|
42
|
+
function Human({ children }) {
|
|
43
|
+
return renderAudience("human", "human", children);
|
|
44
|
+
}
|
|
45
|
+
function Audience({ only, children }) {
|
|
46
|
+
return renderAudience(only, "human", children);
|
|
36
47
|
}
|
|
37
48
|
const codeGroupLabelProps = [
|
|
38
49
|
"title",
|
|
@@ -159,8 +170,10 @@ const extendedMdxComponents = {
|
|
|
159
170
|
img: MDXImg,
|
|
160
171
|
table: Table,
|
|
161
172
|
Agent,
|
|
173
|
+
Audience,
|
|
162
174
|
CodeGroup,
|
|
163
175
|
HoverLink,
|
|
176
|
+
Human,
|
|
164
177
|
Prompt,
|
|
165
178
|
Tab,
|
|
166
179
|
Tabs
|
|
@@ -240,4 +253,4 @@ function getMDXComponents(overrides, options) {
|
|
|
240
253
|
}
|
|
241
254
|
|
|
242
255
|
//#endregion
|
|
243
|
-
export { Agent, CodeGroup, HoverLink, Prompt, Tab, Tabs, defaultMdxComponents, extendedMdxComponents, getMDXComponents };
|
|
256
|
+
export { Agent, Audience, CodeGroup, HoverLink, Human, Prompt, Tab, Tabs, defaultMdxComponents, extendedMdxComponents, getMDXComponents };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/theme",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.56",
|
|
4
4
|
"description": "Theme package for @farming-labs/docs — layout, provider, MDX components, and styles",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
"tsdown": "^0.20.3",
|
|
147
147
|
"typescript": "^5.9.3",
|
|
148
148
|
"vitest": "^4.1.8",
|
|
149
|
-
"@farming-labs/docs": "0.2.
|
|
149
|
+
"@farming-labs/docs": "0.2.56"
|
|
150
150
|
},
|
|
151
151
|
"peerDependencies": {
|
|
152
152
|
"@farming-labs/docs": ">=0.0.1",
|