@farming-labs/theme 0.0.47 → 0.0.48
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/hover-link.d.mts +24 -0
- package/dist/hover-link.mjs +167 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +2 -1
- package/dist/mdx.d.mts +3 -1
- package/dist/mdx.mjs +3 -1
- package/package.json +2 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/hover-link.d.ts
|
|
5
|
+
interface HoverLinkProps {
|
|
6
|
+
href: string;
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
linkLabel?: string;
|
|
11
|
+
external?: boolean;
|
|
12
|
+
prefetch?: boolean;
|
|
13
|
+
}
|
|
14
|
+
declare function HoverLink({
|
|
15
|
+
href,
|
|
16
|
+
title,
|
|
17
|
+
description,
|
|
18
|
+
children,
|
|
19
|
+
linkLabel,
|
|
20
|
+
external,
|
|
21
|
+
prefetch
|
|
22
|
+
}: HoverLinkProps): react_jsx_runtime0.JSX.Element;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { HoverLink };
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import Link from "fumadocs-core/link";
|
|
6
|
+
import { Popover, PopoverContent, PopoverTrigger } from "fumadocs-ui/components/ui/popover";
|
|
7
|
+
|
|
8
|
+
//#region src/hover-link.tsx
|
|
9
|
+
function HoverLink({ href, title, description, children, linkLabel = "Open page", external, prefetch }) {
|
|
10
|
+
const [open, setOpen] = useState(false);
|
|
11
|
+
const closeTimerRef = useRef(null);
|
|
12
|
+
function clearCloseTimer() {
|
|
13
|
+
if (closeTimerRef.current !== null) {
|
|
14
|
+
window.clearTimeout(closeTimerRef.current);
|
|
15
|
+
closeTimerRef.current = null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function openPopover() {
|
|
19
|
+
clearCloseTimer();
|
|
20
|
+
setOpen(true);
|
|
21
|
+
}
|
|
22
|
+
function closePopover() {
|
|
23
|
+
clearCloseTimer();
|
|
24
|
+
closeTimerRef.current = window.setTimeout(() => setOpen(false), 120);
|
|
25
|
+
}
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
return () => {
|
|
28
|
+
if (closeTimerRef.current !== null) window.clearTimeout(closeTimerRef.current);
|
|
29
|
+
};
|
|
30
|
+
}, []);
|
|
31
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
32
|
+
open,
|
|
33
|
+
onOpenChange: setOpen,
|
|
34
|
+
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
35
|
+
asChild: true,
|
|
36
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
37
|
+
type: "button",
|
|
38
|
+
onMouseEnter: openPopover,
|
|
39
|
+
onMouseLeave: closePopover,
|
|
40
|
+
onFocus: openPopover,
|
|
41
|
+
onBlur: closePopover,
|
|
42
|
+
onClick: () => setOpen((value) => !value),
|
|
43
|
+
style: {
|
|
44
|
+
display: "inline-flex",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
gap: "0.35rem",
|
|
47
|
+
border: "none",
|
|
48
|
+
background: "transparent",
|
|
49
|
+
padding: 0,
|
|
50
|
+
color: "var(--color-fd-foreground, currentColor)",
|
|
51
|
+
cursor: "pointer",
|
|
52
|
+
textDecoration: "underline",
|
|
53
|
+
textDecorationStyle: "dashed",
|
|
54
|
+
textUnderlineOffset: "0.22em",
|
|
55
|
+
textDecorationColor: "color-mix(in srgb, var(--color-fd-border, currentColor) 85%, transparent)",
|
|
56
|
+
font: "inherit"
|
|
57
|
+
},
|
|
58
|
+
children: [/* @__PURE__ */ jsx("span", { children }), /* @__PURE__ */ jsx("span", {
|
|
59
|
+
"aria-hidden": "true",
|
|
60
|
+
style: {
|
|
61
|
+
fontSize: "0.75em",
|
|
62
|
+
opacity: .8
|
|
63
|
+
},
|
|
64
|
+
children: "+"
|
|
65
|
+
})]
|
|
66
|
+
})
|
|
67
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
68
|
+
align: "center",
|
|
69
|
+
sideOffset: 12,
|
|
70
|
+
onMouseEnter: openPopover,
|
|
71
|
+
onMouseLeave: closePopover,
|
|
72
|
+
onFocusCapture: openPopover,
|
|
73
|
+
onBlurCapture: closePopover,
|
|
74
|
+
style: {
|
|
75
|
+
width: "min(22rem, calc(100vw - 2rem))",
|
|
76
|
+
borderRadius: "calc(var(--radius, 0.75rem) + 2px)",
|
|
77
|
+
border: "1px solid color-mix(in srgb, var(--color-fd-border, #2a2a2a) 88%, transparent)",
|
|
78
|
+
background: "var(--color-fd-popover, var(--color-fd-background, #0b0b0b))",
|
|
79
|
+
color: "var(--color-fd-popover-foreground, var(--color-fd-foreground, currentColor))",
|
|
80
|
+
padding: "0.95rem 1rem",
|
|
81
|
+
boxShadow: "0 20px 45px color-mix(in srgb, var(--color-fd-background, #000) 78%, transparent)",
|
|
82
|
+
backdropFilter: "blur(14px)"
|
|
83
|
+
},
|
|
84
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
85
|
+
style: {
|
|
86
|
+
display: "flex",
|
|
87
|
+
flexDirection: "column",
|
|
88
|
+
gap: "0.75rem"
|
|
89
|
+
},
|
|
90
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
91
|
+
style: {
|
|
92
|
+
display: "flex",
|
|
93
|
+
flexDirection: "column",
|
|
94
|
+
gap: "0.35rem"
|
|
95
|
+
},
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ jsx("span", {
|
|
98
|
+
style: {
|
|
99
|
+
fontSize: "0.68rem",
|
|
100
|
+
textTransform: "uppercase",
|
|
101
|
+
letterSpacing: "0.1em",
|
|
102
|
+
fontFamily: "var(--fd-font-mono, var(--font-geist-mono, ui-monospace, monospace))",
|
|
103
|
+
color: "color-mix(in srgb, var(--color-fd-popover-foreground, currentColor) 55%, transparent)"
|
|
104
|
+
},
|
|
105
|
+
children: "Link Preview"
|
|
106
|
+
}),
|
|
107
|
+
/* @__PURE__ */ jsx(Link, {
|
|
108
|
+
href,
|
|
109
|
+
external,
|
|
110
|
+
prefetch,
|
|
111
|
+
style: {
|
|
112
|
+
fontSize: "1rem",
|
|
113
|
+
fontWeight: 600,
|
|
114
|
+
lineHeight: 1.3,
|
|
115
|
+
color: "var(--color-fd-popover-foreground, currentColor)",
|
|
116
|
+
textDecoration: "none"
|
|
117
|
+
},
|
|
118
|
+
children: title
|
|
119
|
+
}),
|
|
120
|
+
/* @__PURE__ */ jsx("p", {
|
|
121
|
+
style: {
|
|
122
|
+
margin: 0,
|
|
123
|
+
fontSize: "0.92rem",
|
|
124
|
+
lineHeight: 1.6,
|
|
125
|
+
color: "color-mix(in srgb, var(--color-fd-popover-foreground, currentColor) 74%, transparent)"
|
|
126
|
+
},
|
|
127
|
+
children: description
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
131
|
+
style: {
|
|
132
|
+
display: "flex",
|
|
133
|
+
alignItems: "center",
|
|
134
|
+
justifyContent: "space-between",
|
|
135
|
+
gap: "0.75rem",
|
|
136
|
+
paddingTop: "0.25rem",
|
|
137
|
+
borderTop: "1px solid color-mix(in srgb, var(--color-fd-border, #2a2a2a) 72%, transparent)"
|
|
138
|
+
},
|
|
139
|
+
children: /* @__PURE__ */ jsxs(Link, {
|
|
140
|
+
href,
|
|
141
|
+
external,
|
|
142
|
+
prefetch,
|
|
143
|
+
style: {
|
|
144
|
+
display: "inline-flex",
|
|
145
|
+
alignItems: "center",
|
|
146
|
+
gap: "0.4rem",
|
|
147
|
+
fontSize: "0.8rem",
|
|
148
|
+
fontWeight: 600,
|
|
149
|
+
textTransform: "uppercase",
|
|
150
|
+
letterSpacing: "0.08em",
|
|
151
|
+
fontFamily: "var(--fd-font-mono, var(--font-geist-mono, ui-monospace, monospace))",
|
|
152
|
+
color: "var(--color-fd-primary, var(--color-fd-popover-foreground, currentColor))",
|
|
153
|
+
textDecoration: "none"
|
|
154
|
+
},
|
|
155
|
+
children: [linkLabel, /* @__PURE__ */ jsx("span", {
|
|
156
|
+
"aria-hidden": "true",
|
|
157
|
+
children: "→"
|
|
158
|
+
})]
|
|
159
|
+
})
|
|
160
|
+
})]
|
|
161
|
+
})
|
|
162
|
+
})]
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
//#endregion
|
|
167
|
+
export { HoverLink };
|
package/dist/index.d.mts
CHANGED
|
@@ -5,9 +5,10 @@ import { DocsPageClient } from "./docs-page-client.mjs";
|
|
|
5
5
|
import { RootProvider } from "./provider.mjs";
|
|
6
6
|
import { PageActions } from "./page-actions.mjs";
|
|
7
7
|
import { withLangInUrl } from "./i18n.mjs";
|
|
8
|
+
import { HoverLink } from "./hover-link.mjs";
|
|
8
9
|
import { DocsLayout } from "fumadocs-ui/layouts/docs";
|
|
9
10
|
import { AIConfig, BreadcrumbConfig, CopyMarkdownConfig, DocsConfig, DocsMetadata, DocsNav, DocsTheme, FontStyle, OGConfig, OpenDocsConfig, OpenDocsProvider, PageActionsConfig, PageFrontmatter, SidebarConfig, ThemeToggleConfig, TypographyConfig, UIConfig, createTheme, deepMerge, defineDocs, extendTheme } from "@farming-labs/docs";
|
|
10
11
|
import { DocsBody, DocsPage } from "fumadocs-ui/layouts/docs/page";
|
|
11
12
|
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
|
|
12
13
|
import { CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, Pre } from "fumadocs-ui/components/codeblock";
|
|
13
|
-
export { type AIConfig, type BreadcrumbConfig, CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, type CopyMarkdownConfig, DocsBody, DocsCommandSearch, type DocsConfig, DocsLayout, type DocsMetadata, type DocsNav, DocsPage, DocsPageClient, type DocsTheme, type FontStyle, DefaultUIDefaults as FumadocsUIDefaults, type OGConfig, type OpenDocsConfig, type OpenDocsProvider, PageActions, type PageActionsConfig, type PageFrontmatter, Pre, RootProvider, type SidebarConfig, Tab, Tabs, type ThemeToggleConfig, type TypographyConfig, type UIConfig, createDocsLayout, createDocsMetadata, createPageMetadata, createTheme, deepMerge, defineDocs, extendTheme, fumadocs, withLangInUrl };
|
|
14
|
+
export { type AIConfig, type BreadcrumbConfig, CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, type CopyMarkdownConfig, DocsBody, DocsCommandSearch, type DocsConfig, DocsLayout, type DocsMetadata, type DocsNav, DocsPage, DocsPageClient, type DocsTheme, type FontStyle, DefaultUIDefaults as FumadocsUIDefaults, HoverLink, type OGConfig, type OpenDocsConfig, type OpenDocsProvider, PageActions, type PageActionsConfig, type PageFrontmatter, Pre, RootProvider, type SidebarConfig, Tab, Tabs, type ThemeToggleConfig, type TypographyConfig, type UIConfig, createDocsLayout, createDocsMetadata, createPageMetadata, createTheme, deepMerge, defineDocs, extendTheme, fumadocs, withLangInUrl };
|
package/dist/index.mjs
CHANGED
|
@@ -5,10 +5,11 @@ import { DocsCommandSearch } from "./docs-command-search.mjs";
|
|
|
5
5
|
import { createDocsLayout, createDocsMetadata, createPageMetadata } from "./docs-layout.mjs";
|
|
6
6
|
import { RootProvider } from "./provider.mjs";
|
|
7
7
|
import { DefaultUIDefaults, fumadocs } from "./default/index.mjs";
|
|
8
|
+
import { HoverLink } from "./hover-link.mjs";
|
|
8
9
|
import { DocsLayout } from "fumadocs-ui/layouts/docs";
|
|
9
10
|
import { createTheme, deepMerge, defineDocs, extendTheme } from "@farming-labs/docs";
|
|
10
11
|
import { DocsBody, DocsPage } from "fumadocs-ui/layouts/docs/page";
|
|
11
12
|
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
|
|
12
13
|
import { CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, Pre } from "fumadocs-ui/components/codeblock";
|
|
13
14
|
|
|
14
|
-
export { CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, DocsBody, DocsCommandSearch, DocsLayout, DocsPage, DocsPageClient, DefaultUIDefaults as FumadocsUIDefaults, PageActions, Pre, RootProvider, Tab, Tabs, createDocsLayout, createDocsMetadata, createPageMetadata, createTheme, deepMerge, defineDocs, extendTheme, fumadocs, withLangInUrl };
|
|
15
|
+
export { CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, DocsBody, DocsCommandSearch, DocsLayout, DocsPage, DocsPageClient, DefaultUIDefaults as FumadocsUIDefaults, HoverLink, PageActions, Pre, RootProvider, Tab, Tabs, createDocsLayout, createDocsMetadata, createPageMetadata, createTheme, deepMerge, defineDocs, extendTheme, fumadocs, withLangInUrl };
|
package/dist/mdx.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HoverLink } from "./hover-link.mjs";
|
|
1
2
|
import { MDXImg } from "./mdx-img.mjs";
|
|
2
3
|
import React from "react";
|
|
3
4
|
import { CodeBlockCopyData } from "@farming-labs/docs";
|
|
@@ -11,6 +12,7 @@ import * as fumadocs_ui_components_callout0 from "fumadocs-ui/components/callout
|
|
|
11
12
|
//#region src/mdx.d.ts
|
|
12
13
|
declare const extendedMdxComponents: {
|
|
13
14
|
img: typeof MDXImg;
|
|
15
|
+
HoverLink: typeof HoverLink;
|
|
14
16
|
Tab: typeof Tab;
|
|
15
17
|
Tabs: typeof Tabs;
|
|
16
18
|
CodeBlockTab: typeof fumadocs_ui_components_codeblock0.CodeBlockTab;
|
|
@@ -39,4 +41,4 @@ interface GetMDXComponentsOptions {
|
|
|
39
41
|
}
|
|
40
42
|
declare function getMDXComponents<T extends Record<string, unknown> = Record<string, unknown>>(overrides?: T, options?: GetMDXComponentsOptions): typeof extendedMdxComponents & T;
|
|
41
43
|
//#endregion
|
|
42
|
-
export { GetMDXComponentsOptions, Tab, Tabs, defaultMdxComponents, extendedMdxComponents, getMDXComponents };
|
|
44
|
+
export { GetMDXComponentsOptions, HoverLink, Tab, Tabs, defaultMdxComponents, extendedMdxComponents, getMDXComponents };
|
package/dist/mdx.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HoverLink } from "./hover-link.mjs";
|
|
1
2
|
import { MDXImg } from "./mdx-img.mjs";
|
|
2
3
|
import { createPreWithCopyCallback } from "./code-block-copy-wrapper.mjs";
|
|
3
4
|
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
|
|
@@ -7,6 +8,7 @@ import defaultMdxComponents from "fumadocs-ui/mdx";
|
|
|
7
8
|
const extendedMdxComponents = {
|
|
8
9
|
...defaultMdxComponents,
|
|
9
10
|
img: MDXImg,
|
|
11
|
+
HoverLink,
|
|
10
12
|
Tab,
|
|
11
13
|
Tabs
|
|
12
14
|
};
|
|
@@ -23,4 +25,4 @@ function getMDXComponents(overrides, options) {
|
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
//#endregion
|
|
26
|
-
export { Tab, Tabs, defaultMdxComponents, extendedMdxComponents, getMDXComponents };
|
|
28
|
+
export { HoverLink, Tab, Tabs, defaultMdxComponents, extendedMdxComponents, getMDXComponents };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/theme",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.48",
|
|
4
4
|
"description": "Theme package for @farming-labs/docs — layout, provider, MDX components, and styles",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"tsdown": "^0.20.3",
|
|
111
111
|
"typescript": "^5.9.3",
|
|
112
112
|
"vitest": "^3.2.4",
|
|
113
|
-
"@farming-labs/docs": "0.0.
|
|
113
|
+
"@farming-labs/docs": "0.0.48"
|
|
114
114
|
},
|
|
115
115
|
"peerDependencies": {
|
|
116
116
|
"@farming-labs/docs": ">=0.0.1",
|