fumadocs-ui 14.2.1 → 14.3.1
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/components/accordion.d.ts +4 -7
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +32 -104
- package/dist/components/api.d.ts +4 -13
- package/dist/components/api.d.ts.map +1 -0
- package/dist/components/api.js +3 -16
- package/dist/components/banner.d.ts +3 -5
- package/dist/components/banner.d.ts.map +1 -0
- package/dist/components/banner.js +53 -120
- package/dist/components/callout.d.ts +4 -7
- package/dist/components/callout.d.ts.map +1 -0
- package/dist/components/callout.js +13 -9
- package/dist/components/card.d.ts +5 -7
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +10 -10
- package/dist/components/codeblock.d.ts +6 -9
- package/dist/components/codeblock.d.ts.map +1 -0
- package/dist/components/codeblock.js +41 -15
- package/dist/components/dialog/search-algolia.d.ts +7 -11
- package/dist/components/dialog/search-algolia.d.ts.map +1 -0
- package/dist/components/dialog/search-algolia.js +19 -79
- package/dist/components/dialog/search-default.d.ts +6 -10
- package/dist/components/dialog/search-default.d.ts.map +1 -0
- package/dist/components/dialog/search-default.js +24 -73
- package/dist/components/dialog/search-orama.d.ts +7 -11
- package/dist/components/dialog/search-orama.d.ts.map +1 -0
- package/dist/components/dialog/search-orama.js +22 -79
- package/dist/components/dialog/search.d.ts +7 -9
- package/dist/components/dialog/search.d.ts.map +1 -0
- package/dist/components/dialog/search.js +98 -13
- package/dist/components/dialog/tag-list.d.ts +13 -0
- package/dist/components/dialog/tag-list.d.ts.map +1 -0
- package/dist/components/dialog/tag-list.js +20 -0
- package/dist/components/files.d.ts +7 -9
- package/dist/components/files.d.ts.map +1 -0
- package/dist/components/files.js +15 -63
- package/dist/components/heading.d.ts +4 -5
- package/dist/components/heading.d.ts.map +1 -0
- package/dist/components/heading.js +9 -9
- package/dist/components/image-zoom.d.ts +7 -8
- package/dist/components/image-zoom.d.ts.map +1 -0
- package/dist/components/image-zoom.js +16 -40
- package/dist/components/inline-toc.d.ts +4 -6
- package/dist/components/inline-toc.d.ts.map +1 -0
- package/dist/components/inline-toc.js +8 -46
- package/dist/components/layout/breadcrumb.d.ts +11 -0
- package/dist/components/layout/breadcrumb.d.ts.map +1 -0
- package/dist/components/layout/breadcrumb.js +20 -0
- package/dist/components/layout/language-toggle.d.ts +5 -7
- package/dist/components/layout/language-toggle.d.ts.map +1 -0
- package/dist/components/layout/language-toggle.js +24 -14
- package/dist/components/layout/nav.d.ts +28 -0
- package/dist/components/layout/nav.d.ts.map +1 -0
- package/dist/components/layout/nav.js +29 -0
- package/dist/components/layout/root-toggle.d.ts +5 -7
- package/dist/components/layout/root-toggle.d.ts.map +1 -0
- package/dist/components/layout/root-toggle.js +28 -13
- package/dist/components/layout/search-toggle.d.ts +4 -0
- package/dist/components/layout/search-toggle.d.ts.map +1 -0
- package/dist/components/layout/search-toggle.js +24 -0
- package/dist/components/layout/theme-toggle.d.ts +3 -0
- package/dist/components/layout/theme-toggle.d.ts.map +1 -0
- package/dist/components/layout/theme-toggle.js +21 -0
- package/dist/components/layout/toc-clerk.d.ts +6 -0
- package/dist/components/layout/toc-clerk.d.ts.map +1 -0
- package/dist/components/layout/toc-clerk.js +76 -0
- package/dist/components/layout/toc-popover.d.ts +8 -0
- package/dist/components/layout/toc-popover.d.ts.map +1 -0
- package/dist/components/layout/toc-popover.js +20 -0
- package/dist/components/layout/toc-thumb.d.ts +6 -0
- package/dist/components/layout/toc-thumb.d.ts.map +1 -0
- package/dist/components/layout/toc-thumb.js +53 -0
- package/dist/components/layout/toc.d.ts +19 -0
- package/dist/components/layout/toc.d.ts.map +1 -0
- package/dist/components/layout/toc.js +25 -0
- package/dist/components/registry.d.ts +3 -0
- package/dist/components/registry.d.ts.map +1 -0
- package/dist/components/registry.js +70 -0
- package/dist/components/steps.d.ts +4 -6
- package/dist/components/steps.d.ts.map +1 -0
- package/dist/components/steps.js +5 -16
- package/dist/components/tabs.d.ts +7 -21
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +61 -171
- package/dist/components/type-table.d.ts +5 -6
- package/dist/components/type-table.d.ts.map +1 -0
- package/dist/components/type-table.js +18 -59
- package/dist/components/ui/button.d.ts +5 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +14 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +12 -0
- package/dist/components/ui/navigation-menu.d.ts +11 -0
- package/dist/components/ui/navigation-menu.d.ts.map +1 -0
- package/dist/components/ui/navigation-menu.js +15 -0
- package/dist/components/ui/popover.d.ts +8 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +11 -0
- package/dist/components/ui/scroll-area.d.ts +7 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +11 -0
- package/dist/components/ui/tabs.d.ts +8 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +16 -0
- package/dist/{i18n-Db2HAPOu.d.ts → contexts/i18n.d.ts} +9 -5
- package/dist/contexts/i18n.d.ts.map +1 -0
- package/dist/contexts/i18n.js +23 -0
- package/dist/contexts/search.d.ts +50 -0
- package/dist/contexts/search.d.ts.map +1 -0
- package/dist/contexts/search.js +50 -0
- package/dist/contexts/sidebar.d.ts +18 -0
- package/dist/contexts/sidebar.d.ts.map +1 -0
- package/dist/contexts/sidebar.js +31 -0
- package/dist/contexts/tree.d.ts +13 -0
- package/dist/contexts/tree.d.ts.map +1 -0
- package/dist/contexts/tree.js +25 -0
- package/dist/i18n.d.ts +5 -6
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +31 -49
- package/dist/layouts/docs/navbar.d.ts +4 -0
- package/dist/layouts/docs/navbar.d.ts.map +1 -0
- package/dist/layouts/docs/navbar.js +22 -0
- package/dist/layouts/docs/sidebar.d.ts +40 -0
- package/dist/layouts/docs/sidebar.d.ts.map +1 -0
- package/dist/layouts/docs/sidebar.js +146 -0
- package/dist/layouts/docs.client.d.ts +14 -25
- package/dist/layouts/docs.client.d.ts.map +1 -0
- package/dist/layouts/docs.client.js +53 -195
- package/dist/layouts/docs.d.ts +34 -19
- package/dist/layouts/docs.d.ts.map +1 -0
- package/dist/layouts/docs.js +67 -202
- package/dist/layouts/home/menu.d.ts +6 -0
- package/dist/layouts/home/menu.d.ts.map +1 -0
- package/dist/layouts/home/menu.js +33 -0
- package/dist/layouts/home/navbar.d.ts +16 -0
- package/dist/layouts/home/navbar.d.ts.map +1 -0
- package/dist/layouts/home/navbar.js +48 -0
- package/dist/layouts/home.d.ts +5 -7
- package/dist/layouts/home.d.ts.map +1 -0
- package/dist/layouts/home.js +51 -59
- package/dist/layouts/links.d.ts +80 -0
- package/dist/layouts/links.d.ts.map +1 -0
- package/dist/layouts/links.js +14 -0
- package/dist/layouts/shared.d.ts +48 -2
- package/dist/layouts/shared.d.ts.map +1 -0
- package/dist/layouts/shared.js +27 -9
- package/dist/mdx.client.d.ts +3 -6
- package/dist/mdx.client.d.ts.map +1 -0
- package/dist/mdx.client.js +12 -19
- package/dist/mdx.d.ts +18 -20
- package/dist/mdx.d.ts.map +1 -0
- package/dist/mdx.js +47 -56
- package/dist/og.d.ts +6 -7
- package/dist/og.d.ts.map +1 -0
- package/dist/og.js +43 -102
- package/dist/page.client.d.ts +8 -41
- package/dist/page.client.d.ts.map +1 -0
- package/dist/page.client.js +71 -261
- package/dist/page.d.ts +28 -30
- package/dist/page.d.ts.map +1 -0
- package/dist/page.js +80 -168
- package/dist/provider.d.ts +12 -72
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +19 -55
- package/dist/style.css +1 -1
- package/dist/tailwind-plugin.d.ts +9 -20
- package/dist/tailwind-plugin.d.ts.map +1 -0
- package/dist/tailwind-plugin.js +191 -699
- package/dist/theme/animations.d.ts +170 -0
- package/dist/theme/animations.d.ts.map +1 -0
- package/dist/theme/animations.js +95 -0
- package/dist/theme/colors.d.ts +11 -0
- package/dist/theme/colors.d.ts.map +1 -0
- package/dist/theme/colors.js +327 -0
- package/dist/theme/typography.d.ts +70 -0
- package/dist/theme/typography.d.ts.map +1 -0
- package/dist/theme/typography.js +71 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/cn.js +1 -0
- package/dist/utils/get-sidebar-tabs.d.ts +7 -0
- package/dist/utils/get-sidebar-tabs.d.ts.map +1 -0
- package/dist/utils/get-sidebar-tabs.js +20 -0
- package/dist/utils/is-active.d.ts +2 -0
- package/dist/utils/is-active.d.ts.map +1 -0
- package/dist/utils/is-active.js +3 -0
- package/dist/utils/use-copy-button.d.ts +3 -0
- package/dist/utils/use-copy-button.d.ts.map +1 -0
- package/dist/utils/use-copy-button.js +25 -0
- package/package.json +9 -9
- package/dist/chunk-27HFSL7N.js +0 -53
- package/dist/chunk-2FLZOPQN.js +0 -54
- package/dist/chunk-2KMKNVSN.js +0 -29
- package/dist/chunk-AFMXKA2S.js +0 -125
- package/dist/chunk-CDPVENXR.js +0 -8
- package/dist/chunk-CLF6ZVYS.js +0 -259
- package/dist/chunk-DGKCMOIC.js +0 -56
- package/dist/chunk-DN6Z5VW6.js +0 -61
- package/dist/chunk-E3VO2QQT.js +0 -29
- package/dist/chunk-EFMHXXHW.js +0 -24
- package/dist/chunk-F534DZID.js +0 -43
- package/dist/chunk-GHOAONNQ.js +0 -48
- package/dist/chunk-IL64LMKR.js +0 -82
- package/dist/chunk-ILBYBJ5C.js +0 -38
- package/dist/chunk-IVBHRX3O.js +0 -31
- package/dist/chunk-J6XGK6ZG.js +0 -212
- package/dist/chunk-KZTWSBYY.js +0 -68
- package/dist/chunk-MCX7E6ZW.js +0 -57
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-QKOA6KEZ.js +0 -22
- package/dist/chunk-TK3TM3MR.js +0 -6
- package/dist/chunk-TQJ6YPJ3.js +0 -31
- package/dist/chunk-UUGCW3UP.js +0 -84
- package/dist/chunk-VPJMNIJX.js +0 -542
- package/dist/chunk-W36BQGMB.js +0 -69
- package/dist/chunk-YL3MZH7N.js +0 -66
- package/dist/chunk-ZBOI25UW.js +0 -139
- package/dist/components/api.client.d.ts +0 -5
- package/dist/components/api.client.js +0 -8
- package/dist/dynamic-sidebar-SYEETGZL.js +0 -129
- package/dist/edit-on-github-FIYOWWPQ.js +0 -49
- package/dist/layouts/home.client.d.ts +0 -11
- package/dist/layouts/home.client.js +0 -274
- package/dist/shared-SScCiV7b.d.ts +0 -152
- package/dist/sidebar-CQ4HmzQl.d.ts +0 -50
- package/dist/tag-list-BsEgfE3x.d.ts +0 -6
- package/dist/toc-clerk-SKE4LBT7.js +0 -158
- package/dist/tree-06ley65N.d.ts +0 -21
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { ReactNode, HTMLAttributes } from 'react';
|
|
3
|
-
|
|
4
|
-
interface BaseItem {
|
|
5
|
-
/**
|
|
6
|
-
* Restrict where the item is displayed
|
|
7
|
-
*
|
|
8
|
-
* @defaultValue 'all'
|
|
9
|
-
*/
|
|
10
|
-
on?: 'menu' | 'nav' | 'all';
|
|
11
|
-
}
|
|
12
|
-
interface MainItem extends BaseLinkItem {
|
|
13
|
-
type?: 'main';
|
|
14
|
-
icon?: ReactNode;
|
|
15
|
-
text: ReactNode;
|
|
16
|
-
description?: ReactNode;
|
|
17
|
-
}
|
|
18
|
-
interface MenuItem extends BaseItem {
|
|
19
|
-
type: 'menu';
|
|
20
|
-
icon?: ReactNode;
|
|
21
|
-
text: ReactNode;
|
|
22
|
-
url?: string;
|
|
23
|
-
items: ((MainItem & {
|
|
24
|
-
/**
|
|
25
|
-
* Options when displayed on navigation menu
|
|
26
|
-
*/
|
|
27
|
-
menu?: HTMLAttributes<HTMLElement> & {
|
|
28
|
-
banner?: ReactNode;
|
|
29
|
-
footer?: ReactNode;
|
|
30
|
-
};
|
|
31
|
-
}) | CustomItem)[];
|
|
32
|
-
/**
|
|
33
|
-
* @defaultValue false
|
|
34
|
-
*/
|
|
35
|
-
secondary?: boolean;
|
|
36
|
-
}
|
|
37
|
-
interface CustomItem extends BaseItem {
|
|
38
|
-
type: 'custom';
|
|
39
|
-
/**
|
|
40
|
-
* @defaultValue false
|
|
41
|
-
*/
|
|
42
|
-
secondary?: boolean;
|
|
43
|
-
children: ReactNode;
|
|
44
|
-
}
|
|
45
|
-
type LinkItemType = MainItem | IconItem | ButtonItem | MenuItem | CustomItem;
|
|
46
|
-
interface BaseLinkItem extends BaseItem {
|
|
47
|
-
url: string;
|
|
48
|
-
/**
|
|
49
|
-
* When the item is marked as active
|
|
50
|
-
*
|
|
51
|
-
* @defaultValue 'url'
|
|
52
|
-
*/
|
|
53
|
-
active?: 'url' | 'nested-url' | 'none';
|
|
54
|
-
external?: boolean;
|
|
55
|
-
}
|
|
56
|
-
declare const BaseLinkItem: react.ForwardRefExoticComponent<{
|
|
57
|
-
item: BaseLinkItem;
|
|
58
|
-
} & HTMLAttributes<HTMLAnchorElement> & react.RefAttributes<HTMLAnchorElement>>;
|
|
59
|
-
interface ButtonItem extends BaseLinkItem {
|
|
60
|
-
type: 'button';
|
|
61
|
-
icon?: ReactNode;
|
|
62
|
-
text: ReactNode;
|
|
63
|
-
/**
|
|
64
|
-
* @defaultValue false
|
|
65
|
-
*/
|
|
66
|
-
secondary?: boolean;
|
|
67
|
-
}
|
|
68
|
-
declare const ButtonItem: react.ForwardRefExoticComponent<{
|
|
69
|
-
item: ButtonItem;
|
|
70
|
-
} & HTMLAttributes<HTMLAnchorElement> & react.RefAttributes<HTMLAnchorElement>>;
|
|
71
|
-
interface IconItem extends BaseLinkItem {
|
|
72
|
-
type: 'icon';
|
|
73
|
-
/**
|
|
74
|
-
* `aria-label` of icon button
|
|
75
|
-
*/
|
|
76
|
-
label?: string;
|
|
77
|
-
icon: ReactNode;
|
|
78
|
-
text: ReactNode;
|
|
79
|
-
/**
|
|
80
|
-
* @defaultValue true
|
|
81
|
-
*/
|
|
82
|
-
secondary?: boolean;
|
|
83
|
-
}
|
|
84
|
-
declare const IconItem: react.ForwardRefExoticComponent<{
|
|
85
|
-
item: IconItem;
|
|
86
|
-
} & HTMLAttributes<HTMLAnchorElement> & react.RefAttributes<HTMLAnchorElement>>;
|
|
87
|
-
|
|
88
|
-
interface NavProviderProps {
|
|
89
|
-
/**
|
|
90
|
-
* Use transparent background
|
|
91
|
-
*
|
|
92
|
-
* @defaultValue none
|
|
93
|
-
*/
|
|
94
|
-
transparentMode?: 'always' | 'top' | 'none';
|
|
95
|
-
}
|
|
96
|
-
interface TitleProps {
|
|
97
|
-
title?: ReactNode;
|
|
98
|
-
/**
|
|
99
|
-
* Redirect url of title
|
|
100
|
-
* @defaultValue '/'
|
|
101
|
-
*/
|
|
102
|
-
url?: string;
|
|
103
|
-
}
|
|
104
|
-
declare function NavProvider({ transparentMode, children, }: NavProviderProps & {
|
|
105
|
-
children: ReactNode;
|
|
106
|
-
}): ReactNode;
|
|
107
|
-
|
|
108
|
-
interface NavOptions extends SharedNavProps {
|
|
109
|
-
enabled: boolean;
|
|
110
|
-
component: ReactNode;
|
|
111
|
-
}
|
|
112
|
-
interface SharedNavProps extends TitleProps, NavProviderProps {
|
|
113
|
-
/**
|
|
114
|
-
* Show/hide search toggle
|
|
115
|
-
*
|
|
116
|
-
* Note: Enable/disable search from root provider instead
|
|
117
|
-
*/
|
|
118
|
-
enableSearch?: boolean;
|
|
119
|
-
children?: ReactNode;
|
|
120
|
-
}
|
|
121
|
-
interface BaseLayoutProps {
|
|
122
|
-
/**
|
|
123
|
-
* Remove theme switcher component
|
|
124
|
-
*/
|
|
125
|
-
disableThemeSwitch?: boolean;
|
|
126
|
-
/**
|
|
127
|
-
* Enable Language Switch
|
|
128
|
-
*
|
|
129
|
-
* @defaultValue false
|
|
130
|
-
*/
|
|
131
|
-
i18n?: boolean;
|
|
132
|
-
/**
|
|
133
|
-
* GitHub url
|
|
134
|
-
*/
|
|
135
|
-
githubUrl?: string;
|
|
136
|
-
links?: LinkItemType[];
|
|
137
|
-
/**
|
|
138
|
-
* Replace or disable navbar
|
|
139
|
-
*/
|
|
140
|
-
nav?: Partial<NavOptions>;
|
|
141
|
-
children?: ReactNode;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Get Links Items with shortcuts
|
|
145
|
-
*/
|
|
146
|
-
declare function getLinks(links?: LinkItemType[], githubUrl?: string): LinkItemType[];
|
|
147
|
-
declare function replaceOrDefault(obj: {
|
|
148
|
-
enabled?: boolean;
|
|
149
|
-
component?: ReactNode;
|
|
150
|
-
} | undefined, def: ReactNode, customComponentProps?: object, disabled?: ReactNode): ReactNode;
|
|
151
|
-
|
|
152
|
-
export { type BaseLayoutProps as B, IconItem as I, type LinkItemType as L, NavProvider as N, type SharedNavProps as S, getLinks as g, replaceOrDefault as r };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import { PageTree } from 'fumadocs-core/server';
|
|
5
|
-
|
|
6
|
-
interface SidebarProps {
|
|
7
|
-
/**
|
|
8
|
-
* Open folders by default if their level is lower or equal to a specific level
|
|
9
|
-
* (Starting from 1)
|
|
10
|
-
*
|
|
11
|
-
* @defaultValue 0
|
|
12
|
-
*/
|
|
13
|
-
defaultOpenLevel?: number;
|
|
14
|
-
/**
|
|
15
|
-
* Prefetch links
|
|
16
|
-
*
|
|
17
|
-
* @defaultValue true
|
|
18
|
-
*/
|
|
19
|
-
prefetch?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Customise each of the component
|
|
22
|
-
*/
|
|
23
|
-
components?: Partial<Components>;
|
|
24
|
-
banner?: ReactNode;
|
|
25
|
-
children?: ReactNode;
|
|
26
|
-
footer?: ReactNode;
|
|
27
|
-
/**
|
|
28
|
-
* Hide search trigger
|
|
29
|
-
*
|
|
30
|
-
* @defaultValue false
|
|
31
|
-
*/
|
|
32
|
-
hideSearch?: boolean;
|
|
33
|
-
}
|
|
34
|
-
interface Components {
|
|
35
|
-
Item: React.FC<{
|
|
36
|
-
item: PageTree.Item;
|
|
37
|
-
}>;
|
|
38
|
-
Folder: React.FC<{
|
|
39
|
-
item: PageTree.Folder;
|
|
40
|
-
level: number;
|
|
41
|
-
}>;
|
|
42
|
-
Separator: React.FC<{
|
|
43
|
-
item: PageTree.Separator;
|
|
44
|
-
}>;
|
|
45
|
-
}
|
|
46
|
-
declare const Sidebar: react.MemoExoticComponent<({ components, defaultOpenLevel, prefetch, ...props }: SidebarProps & {
|
|
47
|
-
aside?: HTMLAttributes<HTMLElement> & Record<string, unknown>;
|
|
48
|
-
}) => react_jsx_runtime.JSX.Element>;
|
|
49
|
-
|
|
50
|
-
export { type SidebarProps as S, Sidebar as a };
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
TocThumb
|
|
4
|
-
} from "./chunk-DN6Z5VW6.js";
|
|
5
|
-
import {
|
|
6
|
-
ScrollArea,
|
|
7
|
-
ScrollViewport
|
|
8
|
-
} from "./chunk-2FLZOPQN.js";
|
|
9
|
-
import {
|
|
10
|
-
twMerge
|
|
11
|
-
} from "./chunk-TK3TM3MR.js";
|
|
12
|
-
import {
|
|
13
|
-
useI18n
|
|
14
|
-
} from "./chunk-EFMHXXHW.js";
|
|
15
|
-
import "./chunk-MLKGABMK.js";
|
|
16
|
-
|
|
17
|
-
// src/components/layout/toc-clerk.tsx
|
|
18
|
-
import * as Primitive from "fumadocs-core/toc";
|
|
19
|
-
import { useEffect, useRef, useState } from "react";
|
|
20
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
-
function ClerkTOCItems({
|
|
22
|
-
items,
|
|
23
|
-
isMenu = false
|
|
24
|
-
}) {
|
|
25
|
-
const { text } = useI18n();
|
|
26
|
-
const viewRef = useRef(null);
|
|
27
|
-
const containerRef = useRef(null);
|
|
28
|
-
const [svg, setSvg] = useState();
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
if (!containerRef.current) return;
|
|
31
|
-
const container = containerRef.current;
|
|
32
|
-
function onResize() {
|
|
33
|
-
if (container.clientHeight === 0) return;
|
|
34
|
-
let w = 0, h = 0;
|
|
35
|
-
const d = [];
|
|
36
|
-
for (let i = 0; i < items.length; i++) {
|
|
37
|
-
const element = container.querySelector(
|
|
38
|
-
`a[href="#${items[i].url.slice(1)}"]`
|
|
39
|
-
);
|
|
40
|
-
if (!element) continue;
|
|
41
|
-
const styles = getComputedStyle(element);
|
|
42
|
-
const offset = getLineOffset(items[i].depth) + 1, top = element.offsetTop + parseFloat(styles.paddingTop), bottom = element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom);
|
|
43
|
-
w = Math.max(offset, w);
|
|
44
|
-
h = Math.max(h, bottom);
|
|
45
|
-
d.push(`${i === 0 ? "M" : "L"}${offset} ${top}`);
|
|
46
|
-
d.push(`L${offset} ${bottom}`);
|
|
47
|
-
}
|
|
48
|
-
setSvg({
|
|
49
|
-
path: d.join(" "),
|
|
50
|
-
width: w + 1,
|
|
51
|
-
height: h
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
const observer = new ResizeObserver(onResize);
|
|
55
|
-
onResize();
|
|
56
|
-
observer.observe(container);
|
|
57
|
-
return () => {
|
|
58
|
-
observer.disconnect();
|
|
59
|
-
};
|
|
60
|
-
}, [items]);
|
|
61
|
-
if (items.length === 0)
|
|
62
|
-
return /* @__PURE__ */ jsx("div", { className: "rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground", children: text.tocNoHeadings });
|
|
63
|
-
return /* @__PURE__ */ jsx(ScrollArea, { className: twMerge("flex flex-col", isMenu && "-ms-3"), children: /* @__PURE__ */ jsxs(ScrollViewport, { className: "relative min-h-0", ref: viewRef, children: [
|
|
64
|
-
svg ? /* @__PURE__ */ jsx(
|
|
65
|
-
"div",
|
|
66
|
-
{
|
|
67
|
-
className: "absolute start-0 top-0 rtl:-scale-x-100",
|
|
68
|
-
style: {
|
|
69
|
-
width: svg.width,
|
|
70
|
-
height: svg.height,
|
|
71
|
-
maskImage: `url("data:image/svg+xml,${// Inline SVG
|
|
72
|
-
encodeURIComponent(
|
|
73
|
-
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${svg.width} ${svg.height}"><path d="${svg.path}" stroke="black" stroke-width="1" fill="none" /></svg>`
|
|
74
|
-
)}")`
|
|
75
|
-
},
|
|
76
|
-
children: /* @__PURE__ */ jsx(
|
|
77
|
-
TocThumb,
|
|
78
|
-
{
|
|
79
|
-
containerRef,
|
|
80
|
-
className: "mt-[var(--fd-top)] h-[var(--fd-height)] bg-fd-primary transition-all"
|
|
81
|
-
}
|
|
82
|
-
)
|
|
83
|
-
}
|
|
84
|
-
) : null,
|
|
85
|
-
/* @__PURE__ */ jsx(Primitive.ScrollProvider, { containerRef: viewRef, children: /* @__PURE__ */ jsx("div", { className: "flex flex-col", ref: containerRef, children: items.map((item, i) => /* @__PURE__ */ jsx(
|
|
86
|
-
TOCItem2,
|
|
87
|
-
{
|
|
88
|
-
item,
|
|
89
|
-
upper: items[i - 1]?.depth,
|
|
90
|
-
lower: items[i + 1]?.depth
|
|
91
|
-
},
|
|
92
|
-
item.url
|
|
93
|
-
)) }) })
|
|
94
|
-
] }) });
|
|
95
|
-
}
|
|
96
|
-
function getItemOffset(depth) {
|
|
97
|
-
if (depth <= 2) return 16;
|
|
98
|
-
if (depth === 3) return 32;
|
|
99
|
-
return 48;
|
|
100
|
-
}
|
|
101
|
-
function getLineOffset(depth) {
|
|
102
|
-
return depth >= 3 ? 12 : 0;
|
|
103
|
-
}
|
|
104
|
-
function TOCItem2({
|
|
105
|
-
item,
|
|
106
|
-
upper = item.depth,
|
|
107
|
-
lower = item.depth
|
|
108
|
-
}) {
|
|
109
|
-
const offset = getLineOffset(item.depth), upperOffset = getLineOffset(upper), lowerOffset = getLineOffset(lower);
|
|
110
|
-
return /* @__PURE__ */ jsxs(
|
|
111
|
-
Primitive.TOCItem,
|
|
112
|
-
{
|
|
113
|
-
href: item.url,
|
|
114
|
-
style: {
|
|
115
|
-
paddingInlineStart: getItemOffset(item.depth)
|
|
116
|
-
},
|
|
117
|
-
className: "prose relative py-2 text-sm text-fd-muted-foreground transition-colors [overflow-wrap:anywhere] first:pt-0 last:pb-0 data-[active=true]:text-fd-primary",
|
|
118
|
-
children: [
|
|
119
|
-
offset !== upperOffset ? /* @__PURE__ */ jsx(
|
|
120
|
-
"svg",
|
|
121
|
-
{
|
|
122
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
123
|
-
viewBox: "0 0 16 16",
|
|
124
|
-
className: "absolute -top-2 start-0 size-4 rtl:-scale-x-100",
|
|
125
|
-
children: /* @__PURE__ */ jsx(
|
|
126
|
-
"line",
|
|
127
|
-
{
|
|
128
|
-
x1: upperOffset,
|
|
129
|
-
y1: "0",
|
|
130
|
-
x2: offset,
|
|
131
|
-
y2: "16",
|
|
132
|
-
className: "stroke-fd-foreground/10",
|
|
133
|
-
strokeWidth: "1"
|
|
134
|
-
}
|
|
135
|
-
)
|
|
136
|
-
}
|
|
137
|
-
) : null,
|
|
138
|
-
/* @__PURE__ */ jsx(
|
|
139
|
-
"div",
|
|
140
|
-
{
|
|
141
|
-
className: twMerge(
|
|
142
|
-
"absolute inset-y-0 w-px bg-fd-foreground/10",
|
|
143
|
-
offset !== upperOffset && "top-2",
|
|
144
|
-
offset !== lowerOffset && "bottom-2"
|
|
145
|
-
),
|
|
146
|
-
style: {
|
|
147
|
-
insetInlineStart: offset
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
),
|
|
151
|
-
item.title
|
|
152
|
-
]
|
|
153
|
-
}
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
export {
|
|
157
|
-
ClerkTOCItems as default
|
|
158
|
-
};
|
package/dist/tree-06ley65N.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { PageTree } from 'fumadocs-core/server';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
interface TreeContextType {
|
|
5
|
-
/**
|
|
6
|
-
* The path to the current node
|
|
7
|
-
*/
|
|
8
|
-
path: PageTree.Node[];
|
|
9
|
-
/**
|
|
10
|
-
* Get neighbours of current `pathname`
|
|
11
|
-
*/
|
|
12
|
-
getNeighbours: () => [PageTree.Item | undefined, PageTree.Item | undefined];
|
|
13
|
-
root: PageTree.Root | PageTree.Folder;
|
|
14
|
-
}
|
|
15
|
-
declare function TreeContextProvider({ children, tree, }: {
|
|
16
|
-
tree: PageTree.Root;
|
|
17
|
-
children: ReactNode;
|
|
18
|
-
}): ReactNode;
|
|
19
|
-
declare function useTreeContext(): TreeContextType;
|
|
20
|
-
|
|
21
|
-
export { TreeContextProvider as T, useTreeContext as u };
|