@vx-oss/docs-react 1.0.3
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/LICENSE +21 -0
- package/README.md +5 -0
- package/css/aspen.css +39 -0
- package/css/black.css +39 -0
- package/css/catppuccin.css +49 -0
- package/css/dusk.css +47 -0
- package/css/emerald.css +39 -0
- package/css/generated/docs.css +1 -0
- package/css/generated/flux.css +1 -0
- package/css/generated/glass.css +1 -0
- package/css/generated/home.css +1 -0
- package/css/generated/notebook.css +1 -0
- package/css/generated/shared.css +1 -0
- package/css/lib/base.css +296 -0
- package/css/lib/default-colors.css +51 -0
- package/css/lib/shiki.css +108 -0
- package/css/neutral.css +7 -0
- package/css/ocean.css +44 -0
- package/css/preset-legacy.css +43 -0
- package/css/preset.css +11 -0
- package/css/purple.css +39 -0
- package/css/ruby.css +39 -0
- package/css/shadcn.css +36 -0
- package/css/solar.css +65 -0
- package/css/style.css +9 -0
- package/css/vitepress.css +72 -0
- package/dist/.translations/index.d.ts +55 -0
- package/dist/.translations/keys.js +55 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/components/accordion.d.ts +10 -0
- package/dist/components/accordion.js +68 -0
- package/dist/components/banner.d.ts +25 -0
- package/dist/components/banner.js +85 -0
- package/dist/components/callout.d.ts +21 -0
- package/dist/components/callout.js +60 -0
- package/dist/components/card.d.ts +13 -0
- package/dist/components/card.js +39 -0
- package/dist/components/codeblock.d.ts +45 -0
- package/dist/components/codeblock.js +126 -0
- package/dist/components/codeblock.rsc.d.ts +15 -0
- package/dist/components/codeblock.rsc.js +22 -0
- package/dist/components/dialog/search-algolia.d.ts +27 -0
- package/dist/components/dialog/search-algolia.js +64 -0
- package/dist/components/dialog/search-default.d.ts +29 -0
- package/dist/components/dialog/search-default.js +66 -0
- package/dist/components/dialog/search-orama.d.ts +32 -0
- package/dist/components/dialog/search-orama.js +69 -0
- package/dist/components/dialog/search.d.ts +76 -0
- package/dist/components/dialog/search.js +351 -0
- package/dist/components/dynamic-codeblock.core.d.ts +26 -0
- package/dist/components/dynamic-codeblock.core.js +51 -0
- package/dist/components/dynamic-codeblock.d.ts +8 -0
- package/dist/components/dynamic-codeblock.js +17 -0
- package/dist/components/files.d.ts +21 -0
- package/dist/components/files.js +40 -0
- package/dist/components/github-info.d.ts +20 -0
- package/dist/components/github-info.js +75 -0
- package/dist/components/heading.d.ts +9 -0
- package/dist/components/heading.js +38 -0
- package/dist/components/image-zoom.d.ts +18 -0
- package/dist/components/image-zoom.js +32 -0
- package/dist/components/image-zoom2.css +71 -0
- package/dist/components/inline-toc.d.ts +10 -0
- package/dist/components/inline-toc.js +28 -0
- package/dist/components/sidebar/base.d.ts +85 -0
- package/dist/components/sidebar/base.js +277 -0
- package/dist/components/sidebar/link-item.d.ts +12 -0
- package/dist/components/sidebar/link-item.js +37 -0
- package/dist/components/sidebar/page-tree.d.ts +20 -0
- package/dist/components/sidebar/page-tree.js +69 -0
- package/dist/components/sidebar/tabs/dropdown.d.ts +15 -0
- package/dist/components/sidebar/tabs/dropdown.js +83 -0
- package/dist/components/sidebar/tabs/index.d.ts +8 -0
- package/dist/components/sidebar/tabs/index.js +46 -0
- package/dist/components/steps.d.ts +10 -0
- package/dist/components/steps.js +16 -0
- package/dist/components/tabs.d.ts +33 -0
- package/dist/components/tabs.js +95 -0
- package/dist/components/toc/clerk.d.ts +11 -0
- package/dist/components/toc/clerk.js +227 -0
- package/dist/components/toc/default.d.ts +13 -0
- package/dist/components/toc/default.js +260 -0
- package/dist/components/toc/index.d.ts +10 -0
- package/dist/components/toc/index.js +45 -0
- package/dist/components/type-table.d.ts +37 -0
- package/dist/components/type-table.js +117 -0
- package/dist/components/ui/accordion.d.ts +10 -0
- package/dist/components/ui/accordion.js +42 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/button.js +20 -0
- package/dist/components/ui/collapsible.d.ts +11 -0
- package/dist/components/ui/collapsible.js +21 -0
- package/dist/components/ui/navigation-menu.d.ts +14 -0
- package/dist/components/ui/navigation-menu.js +41 -0
- package/dist/components/ui/popover.d.ts +9 -0
- package/dist/components/ui/popover.js +20 -0
- package/dist/components/ui/scroll-area.d.ts +9 -0
- package/dist/components/ui/scroll-area.js +34 -0
- package/dist/components/ui/tabs.d.ts +23 -0
- package/dist/components/ui/tabs.js +102 -0
- package/dist/contexts/i18n.d.ts +34 -0
- package/dist/contexts/i18n.js +37 -0
- package/dist/contexts/search.d.ts +64 -0
- package/dist/contexts/search.js +68 -0
- package/dist/contexts/tree.d.ts +29 -0
- package/dist/contexts/tree.js +91 -0
- package/dist/i18n.d.ts +15 -0
- package/dist/i18n.js +38 -0
- package/dist/layouts/docs/client.d.ts +33 -0
- package/dist/layouts/docs/client.js +94 -0
- package/dist/layouts/docs/index.d.ts +32 -0
- package/dist/layouts/docs/index.js +23 -0
- package/dist/layouts/docs/page/index.d.ts +76 -0
- package/dist/layouts/docs/page/index.js +124 -0
- package/dist/layouts/docs/page/slots/breadcrumb.d.ts +7 -0
- package/dist/layouts/docs/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/docs/page/slots/container.d.ts +5 -0
- package/dist/layouts/docs/page/slots/container.js +22 -0
- package/dist/layouts/docs/page/slots/footer.d.ts +16 -0
- package/dist/layouts/docs/page/slots/footer.js +56 -0
- package/dist/layouts/docs/page/slots/toc.d.ts +47 -0
- package/dist/layouts/docs/page/slots/toc.js +182 -0
- package/dist/layouts/docs/slots/container.d.ts +5 -0
- package/dist/layouts/docs/slots/container.js +36 -0
- package/dist/layouts/docs/slots/header.d.ts +5 -0
- package/dist/layouts/docs/slots/header.js +38 -0
- package/dist/layouts/docs/slots/sidebar.d.ts +22 -0
- package/dist/layouts/docs/slots/sidebar.js +268 -0
- package/dist/layouts/flux/index.d.ts +61 -0
- package/dist/layouts/flux/index.js +146 -0
- package/dist/layouts/flux/page/index.d.ts +67 -0
- package/dist/layouts/flux/page/index.js +104 -0
- package/dist/layouts/flux/page/slots/breadcrumb.d.ts +7 -0
- package/dist/layouts/flux/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/flux/page/slots/container.d.ts +5 -0
- package/dist/layouts/flux/page/slots/container.js +22 -0
- package/dist/layouts/flux/page/slots/footer.d.ts +16 -0
- package/dist/layouts/flux/page/slots/footer.js +56 -0
- package/dist/layouts/flux/page/slots/toc.d.ts +29 -0
- package/dist/layouts/flux/page/slots/toc.js +181 -0
- package/dist/layouts/flux/slots/container.d.ts +5 -0
- package/dist/layouts/flux/slots/container.js +13 -0
- package/dist/layouts/flux/slots/sidebar.d.ts +16 -0
- package/dist/layouts/flux/slots/sidebar.js +243 -0
- package/dist/layouts/flux/slots/tab-dropdown.d.ts +10 -0
- package/dist/layouts/flux/slots/tab-dropdown.js +88 -0
- package/dist/layouts/glass/index.d.ts +39 -0
- package/dist/layouts/glass/index.js +70 -0
- package/dist/layouts/glass/layout-tabs.js +54 -0
- package/dist/layouts/glass/page/index.d.ts +31 -0
- package/dist/layouts/glass/page/index.js +92 -0
- package/dist/layouts/glass/page/slots/breadcrumb.d.ts +7 -0
- package/dist/layouts/glass/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/glass/page/slots/footer.d.ts +16 -0
- package/dist/layouts/glass/page/slots/footer.js +56 -0
- package/dist/layouts/glass/page/slots/toc.d.ts +19 -0
- package/dist/layouts/glass/page/slots/toc.js +108 -0
- package/dist/layouts/glass/slots/header.d.ts +6 -0
- package/dist/layouts/glass/slots/header.js +68 -0
- package/dist/layouts/glass/slots/sidebar.d.ts +21 -0
- package/dist/layouts/glass/slots/sidebar.js +267 -0
- package/dist/layouts/home/index.d.ts +27 -0
- package/dist/layouts/home/index.js +40 -0
- package/dist/layouts/home/navbar.d.ts +9 -0
- package/dist/layouts/home/navbar.js +34 -0
- package/dist/layouts/home/not-found.d.ts +7 -0
- package/dist/layouts/home/not-found.js +41 -0
- package/dist/layouts/home/slots/container.d.ts +5 -0
- package/dist/layouts/home/slots/container.js +13 -0
- package/dist/layouts/home/slots/header.d.ts +8 -0
- package/dist/layouts/home/slots/header.js +239 -0
- package/dist/layouts/notebook/client.d.ts +35 -0
- package/dist/layouts/notebook/client.js +69 -0
- package/dist/layouts/notebook/index.d.ts +26 -0
- package/dist/layouts/notebook/index.js +23 -0
- package/dist/layouts/notebook/page/index.d.ts +76 -0
- package/dist/layouts/notebook/page/index.js +124 -0
- package/dist/layouts/notebook/page/slots/breadcrumb.d.ts +7 -0
- package/dist/layouts/notebook/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/notebook/page/slots/container.d.ts +5 -0
- package/dist/layouts/notebook/page/slots/container.js +22 -0
- package/dist/layouts/notebook/page/slots/footer.d.ts +16 -0
- package/dist/layouts/notebook/page/slots/footer.js +56 -0
- package/dist/layouts/notebook/page/slots/toc.d.ts +47 -0
- package/dist/layouts/notebook/page/slots/toc.js +181 -0
- package/dist/layouts/notebook/slots/container.d.ts +5 -0
- package/dist/layouts/notebook/slots/container.js +38 -0
- package/dist/layouts/notebook/slots/header.d.ts +5 -0
- package/dist/layouts/notebook/slots/header.js +204 -0
- package/dist/layouts/notebook/slots/sidebar.d.ts +23 -0
- package/dist/layouts/notebook/slots/sidebar.js +240 -0
- package/dist/layouts/shared/client.d.ts +37 -0
- package/dist/layouts/shared/client.js +85 -0
- package/dist/layouts/shared/index.d.ts +169 -0
- package/dist/layouts/shared/index.js +98 -0
- package/dist/layouts/shared/page-actions.d.ts +27 -0
- package/dist/layouts/shared/page-actions.js +199 -0
- package/dist/layouts/shared/slots/language-select.d.ts +12 -0
- package/dist/layouts/shared/slots/language-select.js +43 -0
- package/dist/layouts/shared/slots/search-trigger.d.ts +13 -0
- package/dist/layouts/shared/slots/search-trigger.js +53 -0
- package/dist/layouts/shared/slots/theme-switch.d.ts +8 -0
- package/dist/layouts/shared/slots/theme-switch.js +70 -0
- package/dist/legacy/layout.d.ts +29 -0
- package/dist/legacy/layout.js +44 -0
- package/dist/legacy/sidebar.d.ts +14 -0
- package/dist/legacy/sidebar.js +34 -0
- package/dist/mdx.d.ts +44 -0
- package/dist/mdx.js +70 -0
- package/dist/mdx.server.d.ts +14 -0
- package/dist/mdx.server.js +20 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/controlled.d.ts +30 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/controlled.js +461 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/index.d.ts +3 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/uncontrolled.d.ts +6 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/uncontrolled.js +17 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/adjust-svg-ids.js +53 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/compute-positioned-style.js +25 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/element-tests.js +12 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-div-img-style.js +45 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-alt.js +10 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-object-fit-style.js +57 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-regular-style.js +21 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-src.js +14 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-modal-img-transform.js +22 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-scale.js +27 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-style-ghost.js +31 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-style-modal-img.js +75 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-target-dimension.js +4 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/parse-position.js +7 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/test-has-scalable-src.js +5 -0
- package/dist/og/takumi.d.ts +15 -0
- package/dist/og/takumi.js +91 -0
- package/dist/og.d.ts +16 -0
- package/dist/og.js +91 -0
- package/dist/page.d.ts +29 -0
- package/dist/page.js +33 -0
- package/dist/provider/astro.d.ts +29 -0
- package/dist/provider/astro.js +20 -0
- package/dist/provider/base.d.ts +48 -0
- package/dist/provider/base.js +73 -0
- package/dist/provider/next.d.ts +16 -0
- package/dist/provider/next.js +17 -0
- package/dist/provider/react-router.d.ts +16 -0
- package/dist/provider/react-router.js +17 -0
- package/dist/provider/tanstack.d.ts +16 -0
- package/dist/provider/tanstack.js +17 -0
- package/dist/provider/waku.d.ts +16 -0
- package/dist/provider/waku.js +17 -0
- package/dist/style.css +3640 -0
- package/dist/tailwind/typography.d.ts +2 -0
- package/dist/tailwind/typography.js +2 -0
- package/dist/utils/cn.js +2 -0
- package/dist/utils/merge-refs.js +11 -0
- package/dist/utils/urls.js +15 -0
- package/dist/utils/use-copy-button.d.ts +5 -0
- package/dist/utils/use-copy-button.js +26 -0
- package/dist/utils/use-footer-items.d.ts +8 -0
- package/dist/utils/use-footer-items.js +24 -0
- package/dist/utils/use-is-scroll-top.d.ts +6 -0
- package/dist/utils/use-is-scroll-top.js +20 -0
- package/package.json +212 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { DefaultSearchDialogProps } from "../components/dialog/search-default.js";
|
|
2
|
+
import { ComponentType, ReactNode } from "react";
|
|
3
|
+
//#region src/contexts/search.d.ts
|
|
4
|
+
interface HotKey {
|
|
5
|
+
display: ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* Key code or a function determining whether the key is pressed.
|
|
8
|
+
*/
|
|
9
|
+
key: string | ((e: KeyboardEvent) => boolean);
|
|
10
|
+
}
|
|
11
|
+
interface SharedProps {
|
|
12
|
+
open: boolean;
|
|
13
|
+
onOpenChange: (open: boolean) => void;
|
|
14
|
+
}
|
|
15
|
+
type SearchLink = [name: string, href: string];
|
|
16
|
+
interface TagItem {
|
|
17
|
+
name: string;
|
|
18
|
+
value: string;
|
|
19
|
+
}
|
|
20
|
+
interface SearchProviderProps<DialogProps extends SharedProps = DefaultSearchDialogProps> {
|
|
21
|
+
/**
|
|
22
|
+
* Preload search dialog before opening it
|
|
23
|
+
*
|
|
24
|
+
* @defaultValue `true`
|
|
25
|
+
*/
|
|
26
|
+
preload?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Custom links to be displayed if search is empty
|
|
29
|
+
*/
|
|
30
|
+
links?: SearchLink[];
|
|
31
|
+
/**
|
|
32
|
+
* Hotkeys for triggering search dialog
|
|
33
|
+
*
|
|
34
|
+
* @defaultValue Meta/Ctrl + K
|
|
35
|
+
*/
|
|
36
|
+
hotKey?: HotKey[];
|
|
37
|
+
/**
|
|
38
|
+
* Replace default search dialog, allowing you to use other solutions such as Algolia Search
|
|
39
|
+
*
|
|
40
|
+
* It receives the `open` and `onOpenChange` prop, can be lazy loaded with `React.lazy()`
|
|
41
|
+
*/
|
|
42
|
+
SearchDialog?: ComponentType<DialogProps>;
|
|
43
|
+
/**
|
|
44
|
+
* Additional props to the dialog
|
|
45
|
+
*/
|
|
46
|
+
options?: Partial<DialogProps>;
|
|
47
|
+
children?: ReactNode;
|
|
48
|
+
}
|
|
49
|
+
interface SearchContextType {
|
|
50
|
+
enabled: boolean;
|
|
51
|
+
open: boolean;
|
|
52
|
+
hotKey: HotKey[];
|
|
53
|
+
setOpenSearch: (value: boolean) => void;
|
|
54
|
+
}
|
|
55
|
+
declare function useSearchContext(): SearchContextType;
|
|
56
|
+
declare function SearchProvider<DialogProps extends SharedProps = DefaultSearchDialogProps>({ SearchDialog, children, preload, options, hotKey, links }: SearchProviderProps<DialogProps>): import("react").JSX.Element;
|
|
57
|
+
/**
|
|
58
|
+
* Show children only when search is enabled via React Context
|
|
59
|
+
*/
|
|
60
|
+
declare function SearchOnly({ children }: {
|
|
61
|
+
children: ReactNode;
|
|
62
|
+
}): ReactNode;
|
|
63
|
+
//#endregion
|
|
64
|
+
export { SearchLink, SearchOnly, SearchProvider, SearchProviderProps, SharedProps, TagItem, useSearchContext };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Suspense, createContext, lazy, use, useEffect, useEffectEvent, useMemo, useState } from "react";
|
|
4
|
+
//#region src/contexts/search.tsx
|
|
5
|
+
const SearchContext = createContext({
|
|
6
|
+
enabled: false,
|
|
7
|
+
open: false,
|
|
8
|
+
hotKey: [],
|
|
9
|
+
setOpenSearch: () => void 0
|
|
10
|
+
});
|
|
11
|
+
function useSearchContext() {
|
|
12
|
+
return use(SearchContext);
|
|
13
|
+
}
|
|
14
|
+
function MetaOrControl() {
|
|
15
|
+
const [key, setKey] = useState("⌘");
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (/Windows|Linux/i.test(window.navigator.userAgent)) setKey("Ctrl");
|
|
18
|
+
}, []);
|
|
19
|
+
return key;
|
|
20
|
+
}
|
|
21
|
+
const DEFAULT_HOT_KEYS = [{
|
|
22
|
+
key: (e) => e.metaKey || e.ctrlKey,
|
|
23
|
+
display: /* @__PURE__ */ jsx(MetaOrControl, {})
|
|
24
|
+
}, {
|
|
25
|
+
key: "k",
|
|
26
|
+
display: "K"
|
|
27
|
+
}];
|
|
28
|
+
const DefaultSearchDialog = lazy(() => import("../components/dialog/search-default.js"));
|
|
29
|
+
function SearchProvider({ SearchDialog = DefaultSearchDialog, children, preload = true, options, hotKey = DEFAULT_HOT_KEYS, links }) {
|
|
30
|
+
const [isOpen, setIsOpen] = useState(preload ? false : void 0);
|
|
31
|
+
const onKeyDown = useEffectEvent((e) => {
|
|
32
|
+
if (hotKey.every((v) => typeof v.key === "string" ? e.key === v.key : v.key(e))) {
|
|
33
|
+
setIsOpen((open) => !open);
|
|
34
|
+
e.preventDefault();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
window.addEventListener("keydown", onKeyDown);
|
|
39
|
+
return () => {
|
|
40
|
+
window.removeEventListener("keydown", onKeyDown);
|
|
41
|
+
};
|
|
42
|
+
}, []);
|
|
43
|
+
return /* @__PURE__ */ jsxs(SearchContext, {
|
|
44
|
+
value: useMemo(() => ({
|
|
45
|
+
enabled: true,
|
|
46
|
+
open: isOpen ?? false,
|
|
47
|
+
hotKey,
|
|
48
|
+
setOpenSearch: setIsOpen
|
|
49
|
+
}), [isOpen, hotKey]),
|
|
50
|
+
children: [/* @__PURE__ */ jsx(Suspense, {
|
|
51
|
+
fallback: null,
|
|
52
|
+
children: isOpen !== void 0 && /* @__PURE__ */ jsx(SearchDialog, {
|
|
53
|
+
open: isOpen,
|
|
54
|
+
onOpenChange: setIsOpen,
|
|
55
|
+
links,
|
|
56
|
+
...options
|
|
57
|
+
})
|
|
58
|
+
}), children]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Show children only when search is enabled via React Context
|
|
63
|
+
*/
|
|
64
|
+
function SearchOnly({ children }) {
|
|
65
|
+
if (useSearchContext().enabled) return children;
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { SearchOnly, SearchProvider, useSearchContext };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { LayoutTab } from "../layouts/shared/index.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import * as PageTree from "@vx-oss/docs-core/page-tree";
|
|
4
|
+
//#region src/contexts/tree.d.ts
|
|
5
|
+
type MakeRequired<O, K extends keyof O> = Omit<O, K> & Pick<Required<O>, K>;
|
|
6
|
+
interface TreeContextType {
|
|
7
|
+
root: MakeRequired<PageTree.Root | PageTree.Folder, '$id'>;
|
|
8
|
+
full: PageTree.Root;
|
|
9
|
+
}
|
|
10
|
+
declare function TreeContextProvider({ tree: rawTree, children }: {
|
|
11
|
+
tree: PageTree.Root;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
declare function useTreePath(): PageTree.Node[];
|
|
15
|
+
declare function useTreeContext(): TreeContextType;
|
|
16
|
+
interface TabsGroup {
|
|
17
|
+
/** the root folder on the current page's path, undefined for tabs not bound to the page tree */
|
|
18
|
+
active?: PageTree.Folder;
|
|
19
|
+
options: LayoutTab[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Group tabs by the root folders on the current page's path (outermost first): each tab is
|
|
23
|
+
* matched to its root folder, linking to the projection of current page when possible.
|
|
24
|
+
*
|
|
25
|
+
* Tabs not bound to the page tree are appended to the group of `root: true` folders.
|
|
26
|
+
*/
|
|
27
|
+
declare function useTabsGroups(tabs: LayoutTab[]): TabsGroup[];
|
|
28
|
+
//#endregion
|
|
29
|
+
export { TabsGroup, TreeContextProvider, useTabsGroups, useTreeContext, useTreePath };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { usePathname } from "@vx-oss/docs-core/framework";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { createContext, use, useMemo, useRef } from "react";
|
|
5
|
+
import * as PageTree from "@vx-oss/docs-core/page-tree";
|
|
6
|
+
import { searchPath } from "@vx-oss/docs-core/breadcrumb";
|
|
7
|
+
//#region src/contexts/tree.tsx
|
|
8
|
+
const TreeContext = createContext(null);
|
|
9
|
+
const PathContext = createContext([]);
|
|
10
|
+
function TreeContextProvider({ tree: rawTree, children }) {
|
|
11
|
+
const nextIdRef = useRef(0);
|
|
12
|
+
const pathname = usePathname();
|
|
13
|
+
const tree = useMemo(() => rawTree, [rawTree.$id]);
|
|
14
|
+
const path = useMemo(() => {
|
|
15
|
+
return searchPath(tree.children, pathname) ?? (tree.fallback ? searchPath(tree.fallback.children, pathname) : null) ?? [];
|
|
16
|
+
}, [tree, pathname]);
|
|
17
|
+
const root = path.findLast((item) => item.type === "folder" && item.root) ?? tree;
|
|
18
|
+
root.$id ??= String(nextIdRef.current++);
|
|
19
|
+
return /* @__PURE__ */ jsx(TreeContext, {
|
|
20
|
+
value: useMemo(() => ({
|
|
21
|
+
root,
|
|
22
|
+
full: tree
|
|
23
|
+
}), [root, tree]),
|
|
24
|
+
children: /* @__PURE__ */ jsx(PathContext, {
|
|
25
|
+
value: path,
|
|
26
|
+
children
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function useTreePath() {
|
|
31
|
+
return use(PathContext);
|
|
32
|
+
}
|
|
33
|
+
function useTreeContext() {
|
|
34
|
+
const ctx = use(TreeContext);
|
|
35
|
+
if (!ctx) throw new Error("You must wrap this component under <DocsLayout />");
|
|
36
|
+
return ctx;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Group tabs by the root folders on the current page's path (outermost first): each tab is
|
|
40
|
+
* matched to its root folder, linking to the projection of current page when possible.
|
|
41
|
+
*
|
|
42
|
+
* Tabs not bound to the page tree are appended to the group of `root: true` folders.
|
|
43
|
+
*/
|
|
44
|
+
function useTabsGroups(tabs) {
|
|
45
|
+
const { full: tree } = useTreeContext();
|
|
46
|
+
const path = use(PathContext);
|
|
47
|
+
return useMemo(() => {
|
|
48
|
+
const out = [];
|
|
49
|
+
const last = path[path.length - 1];
|
|
50
|
+
const page = last?.type === "page" ? last : void 0;
|
|
51
|
+
let scope = tree.fallback && !tree.children.includes(path[0]) ? tree.fallback : tree;
|
|
52
|
+
for (const node of path) {
|
|
53
|
+
if (node.type !== "folder" || !node.root) continue;
|
|
54
|
+
const group = {
|
|
55
|
+
active: node,
|
|
56
|
+
options: []
|
|
57
|
+
};
|
|
58
|
+
collectTabs(scope, node, page, tabs, group.options);
|
|
59
|
+
if (group.options.length > 0) out.push(group);
|
|
60
|
+
scope = node;
|
|
61
|
+
}
|
|
62
|
+
const custom = tabs.filter((tab) => !tab.$folder);
|
|
63
|
+
if (custom.length > 0) {
|
|
64
|
+
const group = out.findLast((group) => group.active?.root === true);
|
|
65
|
+
if (group) group.options.push(...custom);
|
|
66
|
+
else out.push({ options: custom });
|
|
67
|
+
}
|
|
68
|
+
return out;
|
|
69
|
+
}, [
|
|
70
|
+
tabs,
|
|
71
|
+
tree,
|
|
72
|
+
path
|
|
73
|
+
]);
|
|
74
|
+
}
|
|
75
|
+
/** collect the tabs of root folders with the same type as `active` within a scope */
|
|
76
|
+
function collectTabs(scope, active, page, tabs, out) {
|
|
77
|
+
for (const node of scope.children) {
|
|
78
|
+
if (node.type !== "folder") continue;
|
|
79
|
+
if (node.root === active.root) {
|
|
80
|
+
const tab = tabs.find((tab) => tab.$folder && (tab.$folder === node || tab.$folder.$id === node.$id));
|
|
81
|
+
if (!tab) continue;
|
|
82
|
+
const projection = page && PageTree.findProjection(active, node, page);
|
|
83
|
+
out.push(projection ? {
|
|
84
|
+
...tab,
|
|
85
|
+
url: projection.url
|
|
86
|
+
} : tab);
|
|
87
|
+
} else if (!node.root) collectTabs(node, active, page, tabs, out);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { TreeContextProvider, useTabsGroups, useTreeContext, useTreePath };
|
package/dist/i18n.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { I18nProviderProps } from "./contexts/i18n.js";
|
|
2
|
+
import { Translations } from "./.translations/index.js";
|
|
3
|
+
import { I18nConfig, SingularTranslationsAPI, TranslationExtension, TranslationsAPI } from "@vx-oss/docs-core/i18n";
|
|
4
|
+
//#region src/i18n.d.ts
|
|
5
|
+
declare function uiTranslations(): TranslationExtension<keyof Translations>;
|
|
6
|
+
declare function i18nProvider(translations: SingularTranslationsAPI): I18nProviderProps;
|
|
7
|
+
declare function i18nProvider<Languages extends string>(translations: TranslationsAPI<Languages>, lang?: NoInfer<Languages> | (string & {})): I18nProviderProps;
|
|
8
|
+
interface I18nUIConfig<Languages extends string> extends I18nConfig<Languages> {
|
|
9
|
+
provider: (locale?: Languages | (string & {})) => I18nProviderProps;
|
|
10
|
+
}
|
|
11
|
+
declare function defineI18nUI<Languages extends string>(config: I18nConfig<Languages>, localeTranslations?: Partial<Record<Languages, Record<string, string> & {
|
|
12
|
+
displayName?: string;
|
|
13
|
+
}>>): I18nUIConfig<Languages>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { I18nUIConfig, type Translations, defineI18nUI, i18nProvider, uiTranslations };
|
package/dist/i18n.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import keys_default from "./.translations/keys.js";
|
|
2
|
+
//#region src/i18n.tsx
|
|
3
|
+
function uiTranslations() {
|
|
4
|
+
return { keys: keys_default };
|
|
5
|
+
}
|
|
6
|
+
function i18nProvider(translations, lang) {
|
|
7
|
+
const t = translations.extend(uiTranslations());
|
|
8
|
+
if ("config" in t) {
|
|
9
|
+
const { defaultLanguage, languages } = t.config;
|
|
10
|
+
const locale = lang ?? defaultLanguage;
|
|
11
|
+
return {
|
|
12
|
+
locale: lang,
|
|
13
|
+
translations: t.get(locale) ?? t.get(defaultLanguage),
|
|
14
|
+
locales: languages.map((code) => ({
|
|
15
|
+
locale: code,
|
|
16
|
+
name: t.get(code).displayName ?? "English"
|
|
17
|
+
}))
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return { translations: t.get() };
|
|
21
|
+
}
|
|
22
|
+
function defineI18nUI(config, localeTranslations = {}) {
|
|
23
|
+
return {
|
|
24
|
+
...config,
|
|
25
|
+
provider(locale = config.defaultLanguage) {
|
|
26
|
+
return {
|
|
27
|
+
locale,
|
|
28
|
+
translations: localeTranslations[locale],
|
|
29
|
+
locales: config.languages.map((code) => ({
|
|
30
|
+
locale: code,
|
|
31
|
+
name: localeTranslations[code]?.displayName ?? code
|
|
32
|
+
}))
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { defineI18nUI, i18nProvider, uiTranslations };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BaseSlots, BaseSlotsProps } from "../shared/client.js";
|
|
2
|
+
import { LayoutTab, LinkItemType } from "../shared/index.js";
|
|
3
|
+
import { SidebarProps, SidebarProviderProps } from "./slots/sidebar.js";
|
|
4
|
+
import { DocsLayoutProps } from "./index.js";
|
|
5
|
+
import { ComponentProps, FC } from "react";
|
|
6
|
+
//#region src/layouts/docs/client.d.ts
|
|
7
|
+
interface DocsSlots extends BaseSlots {
|
|
8
|
+
container: FC<ComponentProps<'div'>>;
|
|
9
|
+
header: FC<ComponentProps<'header'>>;
|
|
10
|
+
sidebar: {
|
|
11
|
+
provider: FC<SidebarProviderProps>;
|
|
12
|
+
root: FC<SidebarProps>;
|
|
13
|
+
trigger: FC<ComponentProps<'button'>>;
|
|
14
|
+
useSidebar: () => {
|
|
15
|
+
collapsed: boolean;
|
|
16
|
+
open: boolean;
|
|
17
|
+
setOpen: (v: boolean) => void;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
interface SlotsProps extends BaseSlotsProps<DocsLayoutProps> {
|
|
22
|
+
tabs: LayoutTab[];
|
|
23
|
+
tabMode: NonNullable<DocsLayoutProps['tabMode']>;
|
|
24
|
+
}
|
|
25
|
+
declare function useDocsLayout(): {
|
|
26
|
+
props: SlotsProps;
|
|
27
|
+
isNavTransparent: boolean;
|
|
28
|
+
navItems: LinkItemType[];
|
|
29
|
+
menuItems: LinkItemType[];
|
|
30
|
+
slots: DocsSlots;
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { DocsSlots, useDocsLayout };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { TreeContextProvider, useTabsGroups } from "../../contexts/tree.js";
|
|
4
|
+
import { baseSlots } from "../shared/client.js";
|
|
5
|
+
import { isLayoutTabActive, useLinkItems } from "../shared/index.js";
|
|
6
|
+
import { useIsScrollTop } from "../../utils/use-is-scroll-top.js";
|
|
7
|
+
import { Sidebar, SidebarProvider, SidebarTrigger, useSidebar } from "./slots/sidebar.js";
|
|
8
|
+
import { Header } from "./slots/header.js";
|
|
9
|
+
import { Container } from "./slots/container.js";
|
|
10
|
+
import Link from "@vx-oss/docs-core/link";
|
|
11
|
+
import { usePathname } from "@vx-oss/docs-core/framework";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { createContext, use, useMemo } from "react";
|
|
14
|
+
//#region src/layouts/docs/client.tsx
|
|
15
|
+
const { useBaseSlots } = baseSlots({ useProps() {
|
|
16
|
+
return useDocsLayout().props;
|
|
17
|
+
} });
|
|
18
|
+
const LayoutContext = createContext(null);
|
|
19
|
+
function useIsDocsLayout() {
|
|
20
|
+
return use(LayoutContext) !== null;
|
|
21
|
+
}
|
|
22
|
+
function useDocsLayout() {
|
|
23
|
+
const context = use(LayoutContext);
|
|
24
|
+
if (!context) throw new Error("Please use <DocsPage /> (`@vx-oss/docs-react/layouts/docs/page`) under <DocsLayout /> (`@vx-oss/docs-react/layouts/docs`).");
|
|
25
|
+
return context;
|
|
26
|
+
}
|
|
27
|
+
function LayoutBody(props) {
|
|
28
|
+
const { nav: { enabled: navEnabled = true, transparentMode: navTransparentMode = "none" } = {}, sidebar: { enabled: sidebarEnabled = true, defaultOpenLevel, prefetch, ...sidebarProps } = {}, slots: defaultSlots, tabs, tabMode = "auto", tree, containerProps, children } = props;
|
|
29
|
+
const isTop = useIsScrollTop({ enabled: navTransparentMode === "top" }) ?? true;
|
|
30
|
+
const isNavTransparent = navTransparentMode === "top" ? isTop : navTransparentMode === "always";
|
|
31
|
+
const { baseSlots, baseProps } = useBaseSlots(props);
|
|
32
|
+
const linkItems = useLinkItems(props);
|
|
33
|
+
const slots = {
|
|
34
|
+
...baseSlots,
|
|
35
|
+
header: defaultSlots?.header ?? Header,
|
|
36
|
+
container: defaultSlots?.container ?? Container,
|
|
37
|
+
sidebar: defaultSlots?.sidebar ?? {
|
|
38
|
+
provider: SidebarProvider,
|
|
39
|
+
root: Sidebar,
|
|
40
|
+
trigger: SidebarTrigger,
|
|
41
|
+
useSidebar
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return /* @__PURE__ */ jsx(TreeContextProvider, {
|
|
45
|
+
tree,
|
|
46
|
+
children: /* @__PURE__ */ jsx(LayoutContext, {
|
|
47
|
+
value: {
|
|
48
|
+
props: {
|
|
49
|
+
tabMode,
|
|
50
|
+
tabs,
|
|
51
|
+
...baseProps
|
|
52
|
+
},
|
|
53
|
+
isNavTransparent,
|
|
54
|
+
slots,
|
|
55
|
+
...linkItems
|
|
56
|
+
},
|
|
57
|
+
children: /* @__PURE__ */ jsx(slots.sidebar.provider, {
|
|
58
|
+
defaultOpenLevel,
|
|
59
|
+
prefetch,
|
|
60
|
+
children: /* @__PURE__ */ jsxs(slots.container, {
|
|
61
|
+
...containerProps,
|
|
62
|
+
children: [
|
|
63
|
+
navEnabled && /* @__PURE__ */ jsx(slots.header, {}),
|
|
64
|
+
sidebarEnabled && /* @__PURE__ */ jsx(slots.sidebar.root, { ...sidebarProps }),
|
|
65
|
+
tabMode === "top" && tabs.length > 0 && /* @__PURE__ */ jsx(LayoutTabs, {
|
|
66
|
+
tabs,
|
|
67
|
+
className: "z-10 bg-fd-background border-b px-6 pt-3 xl:px-8 max-md:hidden"
|
|
68
|
+
}),
|
|
69
|
+
children
|
|
70
|
+
]
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function LayoutTabs({ tabs: allTabs, ...props }) {
|
|
77
|
+
const pathname = usePathname();
|
|
78
|
+
const group = useTabsGroups(allTabs).findLast((group) => typeof group.active?.root !== "string");
|
|
79
|
+
const selected = useMemo(() => {
|
|
80
|
+
return group?.options.findLast((option) => isLayoutTabActive(option, pathname));
|
|
81
|
+
}, [group, pathname]);
|
|
82
|
+
if (!group) return;
|
|
83
|
+
return /* @__PURE__ */ jsx("div", {
|
|
84
|
+
...props,
|
|
85
|
+
className: cn("flex flex-row items-end gap-6 overflow-auto [grid-area:main]", props.className),
|
|
86
|
+
children: group.options.map((tab, i) => /* @__PURE__ */ jsx(Link, {
|
|
87
|
+
href: tab.url,
|
|
88
|
+
className: cn("inline-flex border-b-2 border-transparent transition-colors items-center pb-1.5 font-medium gap-2 text-fd-muted-foreground text-sm text-nowrap hover:text-fd-accent-foreground", tab.unlisted && selected !== tab && "hidden", selected === tab && "border-fd-primary text-fd-primary"),
|
|
89
|
+
children: tab.title
|
|
90
|
+
}, i))
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
export { LayoutBody, useDocsLayout, useIsDocsLayout };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BaseLayoutProps, GetLayoutTabsOptions, LayoutTab } from "../shared/index.js";
|
|
2
|
+
import { SidebarProps, SidebarProviderProps } from "./slots/sidebar.js";
|
|
3
|
+
import { DocsSlots, useDocsLayout } from "./client.js";
|
|
4
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
5
|
+
import * as PageTree from "@vx-oss/docs-core/page-tree";
|
|
6
|
+
//#region src/layouts/docs/index.d.ts
|
|
7
|
+
interface DocsLayoutProps extends BaseLayoutProps {
|
|
8
|
+
tree: PageTree.Root;
|
|
9
|
+
sidebar?: SidebarOptions;
|
|
10
|
+
tabMode?: 'top' | 'auto';
|
|
11
|
+
tabs?: LayoutTab[] | GetLayoutTabsOptions | false;
|
|
12
|
+
containerProps?: HTMLAttributes<HTMLDivElement>;
|
|
13
|
+
slots?: Partial<DocsSlots>;
|
|
14
|
+
}
|
|
15
|
+
interface SidebarOptions extends SidebarProps, SidebarProviderProps {
|
|
16
|
+
enabled?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated use `slots.sidebar` instead.
|
|
19
|
+
*/
|
|
20
|
+
component?: ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated use layout-level `tabMode` option instead.
|
|
23
|
+
*/
|
|
24
|
+
tabMode?: 'auto' | 'top';
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated use layout-level `tabs` option instead.
|
|
27
|
+
*/
|
|
28
|
+
tabs?: LayoutTab[] | GetLayoutTabsOptions | false;
|
|
29
|
+
}
|
|
30
|
+
declare function DocsLayout({ tree, sidebar: { tabs: _tabs, tabMode: _tabMode, ...sidebarProps }, tabs: layoutTabs, tabMode, children, ...props }: DocsLayoutProps): import("react").JSX.Element;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { DocsLayout, DocsLayoutProps, type DocsSlots, useDocsLayout };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getLayoutTabs } from "../shared/index.js";
|
|
2
|
+
import { LayoutBody, useDocsLayout } from "./client.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
//#region src/layouts/docs/index.tsx
|
|
6
|
+
function DocsLayout({ tree, sidebar: { tabs: _tabs, tabMode: _tabMode, ...sidebarProps } = {}, tabs: layoutTabs = _tabs, tabMode = _tabMode, children, ...props }) {
|
|
7
|
+
const tabs = useMemo(() => {
|
|
8
|
+
if (Array.isArray(layoutTabs)) return layoutTabs;
|
|
9
|
+
if (typeof layoutTabs === "object") return getLayoutTabs(tree, layoutTabs);
|
|
10
|
+
if (layoutTabs !== false) return getLayoutTabs(tree);
|
|
11
|
+
return [];
|
|
12
|
+
}, [tree, layoutTabs]);
|
|
13
|
+
return /* @__PURE__ */ jsx(LayoutBody, {
|
|
14
|
+
tree,
|
|
15
|
+
tabs,
|
|
16
|
+
tabMode,
|
|
17
|
+
sidebar: sidebarProps,
|
|
18
|
+
...props,
|
|
19
|
+
children
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { DocsLayout, useDocsLayout };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { TOCPopoverProps, TOCProps, TOCProviderProps } from "./slots/toc.js";
|
|
2
|
+
import { Footer, FooterProps } from "./slots/footer.js";
|
|
3
|
+
import { Breadcrumb, BreadcrumbProps } from "./slots/breadcrumb.js";
|
|
4
|
+
import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
|
|
5
|
+
import { ComponentProps, FC, ReactNode } from "react";
|
|
6
|
+
import { TOCItemType } from "@vx-oss/docs-core/toc";
|
|
7
|
+
//#region src/layouts/docs/page/index.d.ts
|
|
8
|
+
interface DocsPageProps extends ComponentProps<'article'> {
|
|
9
|
+
toc?: TOCItemType[];
|
|
10
|
+
/**
|
|
11
|
+
* Extend the page to fill all available space
|
|
12
|
+
*
|
|
13
|
+
* @defaultValue false
|
|
14
|
+
*/
|
|
15
|
+
full?: boolean | undefined;
|
|
16
|
+
slots?: Partial<DocsPageSlots>;
|
|
17
|
+
footer?: FooterOptions;
|
|
18
|
+
breadcrumb?: BreadcrumbOptions;
|
|
19
|
+
tableOfContent?: TableOfContentOptions;
|
|
20
|
+
tableOfContentPopover?: TableOfContentPopoverOptions;
|
|
21
|
+
}
|
|
22
|
+
interface BreadcrumbOptions extends BreadcrumbProps {
|
|
23
|
+
enabled?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated use `slots.breadcrumb` instead.
|
|
26
|
+
*/
|
|
27
|
+
component?: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
interface FooterOptions extends FooterProps {
|
|
30
|
+
enabled?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated use `slots.footer` instead.
|
|
33
|
+
*/
|
|
34
|
+
component?: ReactNode;
|
|
35
|
+
}
|
|
36
|
+
type TableOfContentOptions = Pick<TOCProviderProps, 'single'> & TOCProps & {
|
|
37
|
+
enabled?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated use `slots.toc` instead.
|
|
40
|
+
*/
|
|
41
|
+
component?: ReactNode;
|
|
42
|
+
};
|
|
43
|
+
type TableOfContentPopoverOptions = TOCPopoverProps & {
|
|
44
|
+
enabled?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated use `slots.tocPopover` instead.
|
|
47
|
+
*/
|
|
48
|
+
component?: ReactNode;
|
|
49
|
+
};
|
|
50
|
+
interface DocsPageSlots {
|
|
51
|
+
toc: {
|
|
52
|
+
provider: FC<TOCProviderProps>;
|
|
53
|
+
main: FC<TOCProps>;
|
|
54
|
+
popover: FC<TOCPopoverProps>;
|
|
55
|
+
};
|
|
56
|
+
container: FC<ComponentProps<'article'>>;
|
|
57
|
+
footer: FC<FooterProps>;
|
|
58
|
+
breadcrumb: FC<BreadcrumbProps>;
|
|
59
|
+
}
|
|
60
|
+
declare function useDocsPage(): {
|
|
61
|
+
full: NonNullable<DocsPageProps["full"]>;
|
|
62
|
+
slots: DocsPageSlots;
|
|
63
|
+
};
|
|
64
|
+
declare function DocsPage({ full, tableOfContent: { enabled: tocEnabled, single, ...tocProps }, tableOfContentPopover: { enabled: tocPopoverEnabled, ...tocPopoverProps }, breadcrumb: { enabled: breadcrumbEnabled, ...breadcrumb }, footer: { enabled: footerEnabled, ...footer }, toc, slots: defaultSlots, children, ...containerProps }: DocsPageProps): import("react").JSX.Element;
|
|
65
|
+
declare function EditOnGitHub(props: ComponentProps<'a'>): import("react").JSX.Element;
|
|
66
|
+
/**
|
|
67
|
+
* Add typography styles
|
|
68
|
+
*/
|
|
69
|
+
declare function DocsBody({ children, className, ...props }: ComponentProps<'div'>): import("react").JSX.Element;
|
|
70
|
+
declare function DocsDescription({ children, className, ...props }: ComponentProps<'p'>): import("react").JSX.Element | null;
|
|
71
|
+
declare function DocsTitle({ children, className, ...props }: ComponentProps<'h1'>): import("react").JSX.Element;
|
|
72
|
+
declare function PageLastUpdate({ date: value, ...props }: Omit<ComponentProps<'p'>, 'children'> & {
|
|
73
|
+
date: Date;
|
|
74
|
+
}): import("react").JSX.Element;
|
|
75
|
+
//#endregion
|
|
76
|
+
export { type BreadcrumbProps, DocsBody, DocsDescription, DocsPage, DocsPageProps, DocsTitle, EditOnGitHub, type FooterProps, MarkdownCopyButton, Breadcrumb as PageBreadcrumb, Footer as PageFooter, PageLastUpdate, ViewOptionsPopover, useDocsPage };
|