opin-ui 0.0.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/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/home.css +1 -0
- package/css/generated/notebook.css +1 -0
- package/css/generated/shared.css +1 -0
- package/css/lib/base.css +314 -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 +75 -0
- package/css/style.css +9 -0
- package/css/vitepress.css +65 -0
- package/dist/.translations/index.d.ts +49 -0
- package/dist/.translations/keys.js +49 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/components/accordion.d.ts +23 -0
- package/dist/components/accordion.js +68 -0
- package/dist/components/banner.d.ts +33 -0
- package/dist/components/banner.js +85 -0
- package/dist/components/callout.d.ts +41 -0
- package/dist/components/callout.js +53 -0
- package/dist/components/card.d.ts +19 -0
- package/dist/components/card.js +38 -0
- package/dist/components/codeblock.d.ts +61 -0
- package/dist/components/codeblock.js +173 -0
- package/dist/components/codeblock.rsc.d.ts +20 -0
- package/dist/components/codeblock.rsc.js +22 -0
- package/dist/components/dialog/search-algolia.d.ts +36 -0
- package/dist/components/dialog/search-algolia.js +64 -0
- package/dist/components/dialog/search-default.d.ts +36 -0
- package/dist/components/dialog/search-default.js +58 -0
- package/dist/components/dialog/search-orama.d.ts +43 -0
- package/dist/components/dialog/search-orama.js +69 -0
- package/dist/components/dialog/search.d.ts +112 -0
- package/dist/components/dialog/search.js +350 -0
- package/dist/components/dynamic-codeblock.core.d.ts +34 -0
- package/dist/components/dynamic-codeblock.core.js +51 -0
- package/dist/components/dynamic-codeblock.d.ts +9 -0
- package/dist/components/dynamic-codeblock.js +17 -0
- package/dist/components/files.d.ts +34 -0
- package/dist/components/files.js +40 -0
- package/dist/components/github-info.d.ts +35 -0
- package/dist/components/github-info.js +75 -0
- package/dist/components/heading.d.ts +13 -0
- package/dist/components/heading.js +38 -0
- package/dist/components/image-zoom.d.ts +23 -0
- package/dist/components/image-zoom.js +32 -0
- package/dist/components/image-zoom2.css +71 -0
- package/dist/components/inline-toc.d.ts +14 -0
- package/dist/components/inline-toc.js +28 -0
- package/dist/components/sidebar/base.d.ts +131 -0
- package/dist/components/sidebar/base.js +274 -0
- package/dist/components/sidebar/link-item.d.ts +22 -0
- package/dist/components/sidebar/link-item.js +38 -0
- package/dist/components/sidebar/page-tree.d.ts +28 -0
- package/dist/components/sidebar/page-tree.js +71 -0
- package/dist/components/sidebar/tabs/dropdown.d.ts +16 -0
- package/dist/components/sidebar/tabs/dropdown.js +71 -0
- package/dist/components/sidebar/tabs/index.d.ts +11 -0
- package/dist/components/sidebar/tabs/index.js +46 -0
- package/dist/components/steps.d.ts +15 -0
- package/dist/components/steps.js +16 -0
- package/dist/components/tabs.d.ts +49 -0
- package/dist/components/tabs.js +88 -0
- package/dist/components/toc/clerk.d.ts +20 -0
- package/dist/components/toc/clerk.js +226 -0
- package/dist/components/toc/default.d.ts +23 -0
- package/dist/components/toc/default.js +259 -0
- package/dist/components/toc/index.d.ts +19 -0
- package/dist/components/toc/index.js +45 -0
- package/dist/components/type-table.d.ts +43 -0
- package/dist/components/type-table.js +117 -0
- package/dist/components/ui/accordion.d.ts +30 -0
- package/dist/components/ui/accordion.js +42 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.js +20 -0
- package/dist/components/ui/collapsible.d.ts +15 -0
- package/dist/components/ui/collapsible.js +21 -0
- package/dist/components/ui/navigation-menu.d.ts +30 -0
- package/dist/components/ui/navigation-menu.js +41 -0
- package/dist/components/ui/popover.d.ts +15 -0
- package/dist/components/ui/popover.js +20 -0
- package/dist/components/ui/scroll-area.d.ts +22 -0
- package/dist/components/ui/scroll-area.js +34 -0
- package/dist/components/ui/tabs.d.ts +36 -0
- package/dist/components/ui/tabs.js +77 -0
- package/dist/contexts/i18n.d.ts +41 -0
- package/dist/contexts/i18n.js +37 -0
- package/dist/contexts/search.d.ts +73 -0
- package/dist/contexts/search.js +68 -0
- package/dist/contexts/tree.d.ts +20 -0
- package/dist/contexts/tree.js +38 -0
- package/dist/i18n.d.ts +16 -0
- package/dist/i18n.js +38 -0
- package/dist/layouts/docs/client.d.ts +34 -0
- package/dist/layouts/docs/client.js +92 -0
- package/dist/layouts/docs/index.d.ts +44 -0
- package/dist/layouts/docs/index.js +22 -0
- package/dist/layouts/docs/page/index.d.ts +115 -0
- package/dist/layouts/docs/page/index.js +124 -0
- package/dist/layouts/docs/page/slots/breadcrumb.d.ts +13 -0
- package/dist/layouts/docs/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/docs/page/slots/container.d.ts +6 -0
- package/dist/layouts/docs/page/slots/container.js +17 -0
- package/dist/layouts/docs/page/slots/footer.d.ts +22 -0
- package/dist/layouts/docs/page/slots/footer.js +56 -0
- package/dist/layouts/docs/page/slots/toc.d.ts +62 -0
- package/dist/layouts/docs/page/slots/toc.js +182 -0
- package/dist/layouts/docs/slots/container.d.ts +6 -0
- package/dist/layouts/docs/slots/container.js +36 -0
- package/dist/layouts/docs/slots/header.d.ts +6 -0
- package/dist/layouts/docs/slots/header.js +38 -0
- package/dist/layouts/docs/slots/sidebar.d.ts +29 -0
- package/dist/layouts/docs/slots/sidebar.js +326 -0
- package/dist/layouts/flux/index.d.ts +73 -0
- package/dist/layouts/flux/index.js +146 -0
- package/dist/layouts/flux/page/index.d.ts +102 -0
- package/dist/layouts/flux/page/index.js +104 -0
- package/dist/layouts/flux/page/slots/breadcrumb.d.ts +13 -0
- package/dist/layouts/flux/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/flux/page/slots/container.d.ts +6 -0
- package/dist/layouts/flux/page/slots/container.js +17 -0
- package/dist/layouts/flux/page/slots/footer.d.ts +22 -0
- package/dist/layouts/flux/page/slots/footer.js +56 -0
- package/dist/layouts/flux/page/slots/toc.d.ts +38 -0
- package/dist/layouts/flux/page/slots/toc.js +181 -0
- package/dist/layouts/flux/slots/container.d.ts +6 -0
- package/dist/layouts/flux/slots/container.js +13 -0
- package/dist/layouts/flux/slots/sidebar.d.ts +22 -0
- package/dist/layouts/flux/slots/sidebar.js +237 -0
- package/dist/layouts/flux/slots/tab-dropdown.d.ts +16 -0
- package/dist/layouts/flux/slots/tab-dropdown.js +85 -0
- package/dist/layouts/home/index.d.ts +28 -0
- package/dist/layouts/home/index.js +40 -0
- package/dist/layouts/home/navbar.d.ts +10 -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 +6 -0
- package/dist/layouts/home/slots/container.js +13 -0
- package/dist/layouts/home/slots/header.d.ts +9 -0
- package/dist/layouts/home/slots/header.js +239 -0
- package/dist/layouts/notebook/client.d.ts +36 -0
- package/dist/layouts/notebook/client.js +69 -0
- package/dist/layouts/notebook/index.d.ts +37 -0
- package/dist/layouts/notebook/index.js +22 -0
- package/dist/layouts/notebook/page/index.d.ts +115 -0
- package/dist/layouts/notebook/page/index.js +124 -0
- package/dist/layouts/notebook/page/slots/breadcrumb.d.ts +13 -0
- package/dist/layouts/notebook/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/notebook/page/slots/container.d.ts +6 -0
- package/dist/layouts/notebook/page/slots/container.js +17 -0
- package/dist/layouts/notebook/page/slots/footer.d.ts +22 -0
- package/dist/layouts/notebook/page/slots/footer.js +56 -0
- package/dist/layouts/notebook/page/slots/toc.d.ts +62 -0
- package/dist/layouts/notebook/page/slots/toc.js +181 -0
- package/dist/layouts/notebook/slots/container.d.ts +6 -0
- package/dist/layouts/notebook/slots/container.js +38 -0
- package/dist/layouts/notebook/slots/header.d.ts +6 -0
- package/dist/layouts/notebook/slots/header.js +194 -0
- package/dist/layouts/notebook/slots/sidebar.d.ts +30 -0
- package/dist/layouts/notebook/slots/sidebar.js +298 -0
- package/dist/layouts/shared/client.d.ts +44 -0
- package/dist/layouts/shared/client.js +84 -0
- package/dist/layouts/shared/index.d.ts +178 -0
- package/dist/layouts/shared/index.js +98 -0
- package/dist/layouts/shared/page-actions.d.ts +35 -0
- package/dist/layouts/shared/page-actions.js +195 -0
- package/dist/layouts/shared/slots/language-select.d.ts +18 -0
- package/dist/layouts/shared/slots/language-select.js +43 -0
- package/dist/layouts/shared/slots/search-trigger.d.ts +22 -0
- package/dist/layouts/shared/slots/search-trigger.js +53 -0
- package/dist/layouts/shared/slots/theme-switch.d.ts +13 -0
- package/dist/layouts/shared/slots/theme-switch.js +65 -0
- package/dist/legacy/layout.d.ts +36 -0
- package/dist/legacy/layout.js +44 -0
- package/dist/legacy/sidebar.d.ts +17 -0
- package/dist/legacy/sidebar.js +33 -0
- package/dist/mdx.d.ts +45 -0
- package/dist/mdx.js +70 -0
- package/dist/mdx.server.d.ts +15 -0
- package/dist/mdx.server.js +20 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/controlled.d.ts +31 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/controlled.js +461 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/index.d.ts +2 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/uncontrolled.d.ts +7 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/uncontrolled.js +17 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/adjust-svg-ids.js +53 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/compute-positioned-style.js +25 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/element-tests.js +12 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-div-img-style.js +45 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-alt.js +8 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-object-fit-style.js +55 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-regular-style.js +21 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-src.js +14 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-modal-img-transform.js +22 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-scale.js +27 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-style-ghost.js +31 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-style-modal-img.js +75 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-target-dimension.js +4 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/parse-position.js +7 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/test-has-scalable-src.js +5 -0
- package/dist/og/takumi.d.ts +21 -0
- package/dist/og/takumi.js +91 -0
- package/dist/og.d.ts +22 -0
- package/dist/og.js +91 -0
- package/dist/page.d.ts +35 -0
- package/dist/page.js +33 -0
- package/dist/provider/base.d.ts +49 -0
- package/dist/provider/base.js +32 -0
- package/dist/provider/next.d.ts +20 -0
- package/dist/provider/next.js +17 -0
- package/dist/provider/react-router.d.ts +20 -0
- package/dist/provider/react-router.js +17 -0
- package/dist/provider/tanstack.d.ts +20 -0
- package/dist/provider/tanstack.js +17 -0
- package/dist/provider/waku.d.ts +20 -0
- package/dist/provider/waku.js +17 -0
- package/dist/style.css +3534 -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 +6 -0
- package/dist/utils/use-copy-button.js +26 -0
- package/dist/utils/use-footer-items.d.ts +9 -0
- package/dist/utils/use-footer-items.js +24 -0
- package/dist/utils/use-is-scroll-top.d.ts +8 -0
- package/dist/utils/use-is-scroll-top.js +20 -0
- package/package.json +200 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { __exportAll } from "../../../_virtual/_rolldown/runtime.js";
|
|
3
|
+
import { cn } from "../../../utils/cn.js";
|
|
4
|
+
import { buttonVariants } from "../../../components/ui/button.js";
|
|
5
|
+
import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
|
|
6
|
+
import { TOC, TOCPopover, TOCProvider } from "./slots/toc.js";
|
|
7
|
+
import { Footer } from "./slots/footer.js";
|
|
8
|
+
import { Breadcrumb } from "./slots/breadcrumb.js";
|
|
9
|
+
import { Container } from "./slots/container.js";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Edit } from "lucide-react";
|
|
12
|
+
import { createContext, use, useEffect, useState } from "react";
|
|
13
|
+
import { useTranslations } from "@fuma-translate/react";
|
|
14
|
+
//#region src/layouts/notebook/page/index.tsx
|
|
15
|
+
var page_exports = /* @__PURE__ */ __exportAll({
|
|
16
|
+
DocsBody: () => DocsBody,
|
|
17
|
+
DocsDescription: () => DocsDescription,
|
|
18
|
+
DocsPage: () => DocsPage,
|
|
19
|
+
DocsTitle: () => DocsTitle,
|
|
20
|
+
EditOnGitHub: () => EditOnGitHub,
|
|
21
|
+
MarkdownCopyButton: () => MarkdownCopyButton,
|
|
22
|
+
PageBreadcrumb: () => Breadcrumb,
|
|
23
|
+
PageFooter: () => Footer,
|
|
24
|
+
PageLastUpdate: () => PageLastUpdate,
|
|
25
|
+
ViewOptionsPopover: () => ViewOptionsPopover,
|
|
26
|
+
useDocsPage: () => useDocsPage
|
|
27
|
+
});
|
|
28
|
+
const PageContext = createContext(null);
|
|
29
|
+
function useDocsPage() {
|
|
30
|
+
const context = use(PageContext);
|
|
31
|
+
if (!context) throw new Error("Please use page components under <DocsPage /> (`opin-ui/layouts/notebook/page`).");
|
|
32
|
+
return context;
|
|
33
|
+
}
|
|
34
|
+
function DocsPage({ full = false, tableOfContent: { enabled: tocEnabled = !full, single, ...tocProps } = {}, tableOfContentPopover: { enabled: tocPopoverEnabled, ...tocPopoverProps } = {}, breadcrumb: { enabled: breadcrumbEnabled = true, ...breadcrumb } = {}, footer: { enabled: footerEnabled = true, ...footer } = {}, toc = [], slots: defaultSlots = {}, children, ...containerProps }) {
|
|
35
|
+
tocPopoverEnabled ??= Boolean(toc.length > 0 || tocPopoverProps.header || tocPopoverProps.footer);
|
|
36
|
+
const slots = {
|
|
37
|
+
breadcrumb: defaultSlots.breadcrumb ?? Breadcrumb,
|
|
38
|
+
footer: defaultSlots.footer ?? Footer,
|
|
39
|
+
toc: defaultSlots.toc ?? {
|
|
40
|
+
provider: TOCProvider,
|
|
41
|
+
main: TOC,
|
|
42
|
+
popover: TOCPopover
|
|
43
|
+
},
|
|
44
|
+
container: defaultSlots.container ?? Container
|
|
45
|
+
};
|
|
46
|
+
return /* @__PURE__ */ jsx(PageContext, {
|
|
47
|
+
value: {
|
|
48
|
+
full,
|
|
49
|
+
slots
|
|
50
|
+
},
|
|
51
|
+
children: /* @__PURE__ */ jsxs(slots.toc.provider, {
|
|
52
|
+
single,
|
|
53
|
+
toc: tocEnabled || tocPopoverEnabled ? toc : [],
|
|
54
|
+
children: [
|
|
55
|
+
tocPopoverEnabled && (tocPopoverProps.component ?? /* @__PURE__ */ jsx(slots.toc.popover, { ...tocPopoverProps })),
|
|
56
|
+
/* @__PURE__ */ jsxs(slots.container, {
|
|
57
|
+
...containerProps,
|
|
58
|
+
children: [
|
|
59
|
+
breadcrumbEnabled && (breadcrumb.component ?? /* @__PURE__ */ jsx(slots.breadcrumb, { ...breadcrumb })),
|
|
60
|
+
children,
|
|
61
|
+
footerEnabled && (footer.component ?? /* @__PURE__ */ jsx(slots.footer, { ...footer }))
|
|
62
|
+
]
|
|
63
|
+
}),
|
|
64
|
+
tocEnabled && (tocProps.component ?? /* @__PURE__ */ jsx(slots.toc.main, { ...tocProps }))
|
|
65
|
+
]
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function EditOnGitHub(props) {
|
|
70
|
+
const t = useTranslations({ note: "edit page" });
|
|
71
|
+
return /* @__PURE__ */ jsx("a", {
|
|
72
|
+
target: "_blank",
|
|
73
|
+
rel: "noreferrer noopener",
|
|
74
|
+
...props,
|
|
75
|
+
className: cn(buttonVariants({
|
|
76
|
+
color: "secondary",
|
|
77
|
+
size: "sm"
|
|
78
|
+
}), "gap-1.5 not-prose", props.className),
|
|
79
|
+
children: props.children ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Edit, { className: "size-3.5" }), t("Edit on GitHub")] })
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Add typography styles
|
|
84
|
+
*/
|
|
85
|
+
function DocsBody({ children, className, ...props }) {
|
|
86
|
+
return /* @__PURE__ */ jsx("div", {
|
|
87
|
+
...props,
|
|
88
|
+
className: cn("prose flex-1", className),
|
|
89
|
+
children
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function DocsDescription({ children, className, ...props }) {
|
|
93
|
+
if (children === void 0) return null;
|
|
94
|
+
return /* @__PURE__ */ jsx("p", {
|
|
95
|
+
...props,
|
|
96
|
+
className: cn("mb-8 text-lg text-fd-muted-foreground", className),
|
|
97
|
+
children
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function DocsTitle({ children, className, ...props }) {
|
|
101
|
+
return /* @__PURE__ */ jsx("h1", {
|
|
102
|
+
...props,
|
|
103
|
+
className: cn("text-[1.75em] font-semibold", className),
|
|
104
|
+
children
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function PageLastUpdate({ date: value, ...props }) {
|
|
108
|
+
const t = useTranslations({ note: "page footer" });
|
|
109
|
+
const [date, setDate] = useState("");
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
setDate(value.toLocaleDateString());
|
|
112
|
+
}, [value]);
|
|
113
|
+
return /* @__PURE__ */ jsxs("p", {
|
|
114
|
+
...props,
|
|
115
|
+
className: cn("text-sm text-fd-muted-foreground", props.className),
|
|
116
|
+
children: [
|
|
117
|
+
t("Last updated on"),
|
|
118
|
+
" ",
|
|
119
|
+
date
|
|
120
|
+
]
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
124
|
+
export { DocsBody, DocsDescription, DocsPage, DocsTitle, EditOnGitHub, MarkdownCopyButton, Breadcrumb as PageBreadcrumb, Footer as PageFooter, PageLastUpdate, ViewOptionsPopover, page_exports, useDocsPage };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { BreadcrumbOptions } from "fumadocs-core/breadcrumb";
|
|
3
|
+
|
|
4
|
+
//#region src/layouts/notebook/page/slots/breadcrumb.d.ts
|
|
5
|
+
type BreadcrumbProps = BreadcrumbOptions & ComponentProps<'div'>;
|
|
6
|
+
declare function Breadcrumb({
|
|
7
|
+
includeRoot,
|
|
8
|
+
includeSeparator,
|
|
9
|
+
includePage,
|
|
10
|
+
...props
|
|
11
|
+
}: BreadcrumbProps): import("react").JSX.Element | null;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Breadcrumb, BreadcrumbProps };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../../utils/cn.js";
|
|
3
|
+
import { useTreeContext, useTreePath } from "../../../../contexts/tree.js";
|
|
4
|
+
import Link from "fumadocs-core/link";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { ChevronRight } from "lucide-react";
|
|
7
|
+
import { Fragment as Fragment$1, useMemo } from "react";
|
|
8
|
+
import { getBreadcrumbItemsFromPath } from "fumadocs-core/breadcrumb";
|
|
9
|
+
//#region src/layouts/notebook/page/slots/breadcrumb.tsx
|
|
10
|
+
function Breadcrumb({ includeRoot, includeSeparator, includePage, ...props }) {
|
|
11
|
+
const path = useTreePath();
|
|
12
|
+
const { root } = useTreeContext();
|
|
13
|
+
const items = useMemo(() => {
|
|
14
|
+
return getBreadcrumbItemsFromPath(root, path, {
|
|
15
|
+
includePage,
|
|
16
|
+
includeSeparator,
|
|
17
|
+
includeRoot
|
|
18
|
+
});
|
|
19
|
+
}, [
|
|
20
|
+
includePage,
|
|
21
|
+
includeRoot,
|
|
22
|
+
includeSeparator,
|
|
23
|
+
path,
|
|
24
|
+
root
|
|
25
|
+
]);
|
|
26
|
+
if (items.length === 0) return null;
|
|
27
|
+
return /* @__PURE__ */ jsx("div", {
|
|
28
|
+
...props,
|
|
29
|
+
className: cn("flex items-center gap-1.5 text-sm text-fd-muted-foreground", props.className),
|
|
30
|
+
children: items.map((item, i) => {
|
|
31
|
+
const className = cn("truncate", i === items.length - 1 && "text-fd-primary font-medium");
|
|
32
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [i !== 0 && /* @__PURE__ */ jsx(ChevronRight, { className: "size-3.5 shrink-0" }), item.url ? /* @__PURE__ */ jsx(Link, {
|
|
33
|
+
href: item.url,
|
|
34
|
+
className: cn(className, "transition-opacity hover:opacity-80"),
|
|
35
|
+
children: item.name
|
|
36
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
37
|
+
className,
|
|
38
|
+
children: item.name
|
|
39
|
+
})] }, i);
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { Breadcrumb };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../../utils/cn.js";
|
|
3
|
+
import { useDocsPage } from "../index.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/layouts/notebook/page/slots/container.tsx
|
|
6
|
+
function Container(props) {
|
|
7
|
+
const { full } = useDocsPage();
|
|
8
|
+
return /* @__PURE__ */ jsx("article", {
|
|
9
|
+
id: "nd-page",
|
|
10
|
+
"data-full": full,
|
|
11
|
+
...props,
|
|
12
|
+
className: cn("flex flex-col [grid-area:main] px-4 py-6 gap-4 md:px-6 md:pt-8 xl:px-8 xl:pt-14 *:max-w-[900px]", full && "*:max-w-[1285px]", props.className),
|
|
13
|
+
children: props.children
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { Container };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import * as PageTree from "fumadocs-core/page-tree";
|
|
3
|
+
|
|
4
|
+
//#region src/layouts/notebook/page/slots/footer.d.ts
|
|
5
|
+
type Item = Pick<PageTree.Item, 'name' | 'description' | 'url'>;
|
|
6
|
+
interface FooterProps extends ComponentProps<'div'> {
|
|
7
|
+
/**
|
|
8
|
+
* Items including information for the next and previous page
|
|
9
|
+
*/
|
|
10
|
+
items?: {
|
|
11
|
+
previous?: Item;
|
|
12
|
+
next?: Item;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
declare function Footer({
|
|
16
|
+
items,
|
|
17
|
+
children,
|
|
18
|
+
className,
|
|
19
|
+
...props
|
|
20
|
+
}: FooterProps): import("react").JSX.Element;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Footer, FooterProps };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../../utils/cn.js";
|
|
3
|
+
import { isActive } from "../../../../utils/urls.js";
|
|
4
|
+
import { useFooterItems } from "../../../../utils/use-footer-items.js";
|
|
5
|
+
import Link from "fumadocs-core/link";
|
|
6
|
+
import { usePathname } from "fumadocs-core/framework";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
9
|
+
import { useMemo } from "react";
|
|
10
|
+
import { useTranslations } from "@fuma-translate/react";
|
|
11
|
+
//#region src/layouts/notebook/page/slots/footer.tsx
|
|
12
|
+
function Footer({ items, children, className, ...props }) {
|
|
13
|
+
const footerList = useFooterItems();
|
|
14
|
+
const pathname = usePathname();
|
|
15
|
+
const { previous, next } = useMemo(() => {
|
|
16
|
+
if (items) return items;
|
|
17
|
+
const idx = footerList.findIndex((item) => isActive(item.url, pathname));
|
|
18
|
+
if (idx === -1) return {};
|
|
19
|
+
return {
|
|
20
|
+
previous: footerList[idx - 1],
|
|
21
|
+
next: footerList[idx + 1]
|
|
22
|
+
};
|
|
23
|
+
}, [
|
|
24
|
+
footerList,
|
|
25
|
+
items,
|
|
26
|
+
pathname
|
|
27
|
+
]);
|
|
28
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
29
|
+
className: cn("@container grid gap-4", previous && next ? "grid-cols-2" : "grid-cols-1", className),
|
|
30
|
+
...props,
|
|
31
|
+
children: [previous && /* @__PURE__ */ jsx(FooterItem, {
|
|
32
|
+
item: previous,
|
|
33
|
+
index: 0
|
|
34
|
+
}), next && /* @__PURE__ */ jsx(FooterItem, {
|
|
35
|
+
item: next,
|
|
36
|
+
index: 1
|
|
37
|
+
})]
|
|
38
|
+
}), children] });
|
|
39
|
+
}
|
|
40
|
+
function FooterItem({ item, index }) {
|
|
41
|
+
const t = useTranslations({ note: "pagination" });
|
|
42
|
+
const Icon = index === 0 ? ChevronLeft : ChevronRight;
|
|
43
|
+
return /* @__PURE__ */ jsxs(Link, {
|
|
44
|
+
href: item.url,
|
|
45
|
+
className: cn("flex flex-col gap-2 rounded-lg border p-4 text-sm transition-colors hover:bg-fd-accent/80 hover:text-fd-accent-foreground @max-lg:col-span-full", index === 1 && "text-end"),
|
|
46
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
47
|
+
className: cn("inline-flex items-center gap-1.5 font-medium", index === 1 && "flex-row-reverse"),
|
|
48
|
+
children: [/* @__PURE__ */ jsx(Icon, { className: "-mx-1 size-4 shrink-0 rtl:rotate-180" }), /* @__PURE__ */ jsx("p", { children: item.name })]
|
|
49
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
50
|
+
className: "text-fd-muted-foreground truncate",
|
|
51
|
+
children: item.description ?? (index === 0 ? t("Previous Page") : t("Next Page"))
|
|
52
|
+
})]
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { Footer };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { TOCItemsProps } from "../../../../components/toc/clerk.js";
|
|
2
|
+
import { TOCItemsProps as TOCItemsProps$1 } from "../../../../components/toc/default.js";
|
|
3
|
+
import { TOCProviderProps as TOCProviderProps$1 } from "../../../../components/toc/index.js";
|
|
4
|
+
import { ComponentProps, ReactNode } from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/layouts/notebook/page/slots/toc.d.ts
|
|
7
|
+
type TOCProviderProps = TOCProviderProps$1;
|
|
8
|
+
declare function TOCProvider(props: TOCProviderProps): import("react").JSX.Element;
|
|
9
|
+
type TOCProps = {
|
|
10
|
+
container?: ComponentProps<'div'>;
|
|
11
|
+
/**
|
|
12
|
+
* Custom content in TOC container, before the main TOC
|
|
13
|
+
*/
|
|
14
|
+
header?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Custom content in TOC container, after the main TOC
|
|
17
|
+
*/
|
|
18
|
+
footer?: ReactNode;
|
|
19
|
+
} & ({
|
|
20
|
+
style?: 'normal';
|
|
21
|
+
list?: TOCItemsProps$1;
|
|
22
|
+
} | {
|
|
23
|
+
style: 'clerk';
|
|
24
|
+
list?: TOCItemsProps;
|
|
25
|
+
});
|
|
26
|
+
declare function TOC({
|
|
27
|
+
container,
|
|
28
|
+
header,
|
|
29
|
+
footer,
|
|
30
|
+
style,
|
|
31
|
+
list
|
|
32
|
+
}: TOCProps): import("react").JSX.Element;
|
|
33
|
+
type TOCPopoverProps = {
|
|
34
|
+
container?: ComponentProps<'div'>;
|
|
35
|
+
trigger?: ComponentProps<'button'>;
|
|
36
|
+
content?: ComponentProps<'div'>;
|
|
37
|
+
/**
|
|
38
|
+
* Custom content in TOC container, before the main TOC
|
|
39
|
+
*/
|
|
40
|
+
header?: ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* Custom content in TOC container, after the main TOC
|
|
43
|
+
*/
|
|
44
|
+
footer?: ReactNode;
|
|
45
|
+
} & ({
|
|
46
|
+
style?: 'normal';
|
|
47
|
+
list?: TOCItemsProps$1;
|
|
48
|
+
} | {
|
|
49
|
+
style: 'clerk';
|
|
50
|
+
list?: TOCItemsProps;
|
|
51
|
+
});
|
|
52
|
+
declare function TOCPopover({
|
|
53
|
+
container,
|
|
54
|
+
trigger,
|
|
55
|
+
content,
|
|
56
|
+
header,
|
|
57
|
+
footer,
|
|
58
|
+
style,
|
|
59
|
+
list
|
|
60
|
+
}: TOCPopoverProps): import("react").JSX.Element;
|
|
61
|
+
//#endregion
|
|
62
|
+
export { TOC, TOCPopover, TOCPopoverProps, TOCProps, TOCProvider, TOCProviderProps };
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../../utils/cn.js";
|
|
3
|
+
import { TOCProvider as TOCProvider$1, TOCScrollArea, useItems, useTOCItems } from "../../../../components/toc/index.js";
|
|
4
|
+
import { default_exports } from "../../../../components/toc/default.js";
|
|
5
|
+
import { clerk_exports } from "../../../../components/toc/clerk.js";
|
|
6
|
+
import { useTreePath } from "../../../../contexts/tree.js";
|
|
7
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../../components/ui/collapsible.js";
|
|
8
|
+
import { useNotebookLayout } from "../../client.js";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { ChevronDown, Text } from "lucide-react";
|
|
11
|
+
import { createContext, use, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
|
|
12
|
+
import { useTranslations } from "@fuma-translate/react";
|
|
13
|
+
//#region src/layouts/notebook/page/slots/toc.tsx
|
|
14
|
+
function TOCProvider(props) {
|
|
15
|
+
return /* @__PURE__ */ jsx(TOCProvider$1, { ...props });
|
|
16
|
+
}
|
|
17
|
+
function TOC({ container, header, footer, style = "normal", list }) {
|
|
18
|
+
const items = useTOCItems();
|
|
19
|
+
const t = useTranslations({ note: "table of contents" });
|
|
20
|
+
const { TOCItems, TOCEmpty, TOCItem } = style === "clerk" ? clerk_exports : default_exports;
|
|
21
|
+
if (items.length === 0 && !footer && !header) return /* @__PURE__ */ jsx("div", {
|
|
22
|
+
id: "nd-toc-placeholder",
|
|
23
|
+
className: "hidden xl:layout:[--fd-toc-width:268px]"
|
|
24
|
+
});
|
|
25
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
26
|
+
id: "nd-toc",
|
|
27
|
+
...container,
|
|
28
|
+
className: cn("sticky top-(--fd-docs-row-3) [grid-area:toc] h-[calc(var(--fd-docs-height)-var(--fd-docs-row-3))] flex flex-col w-(--fd-toc-width) pt-12 pe-4 pb-2 xl:layout:[--fd-toc-width:268px] max-xl:hidden", container?.className),
|
|
29
|
+
children: [
|
|
30
|
+
header,
|
|
31
|
+
/* @__PURE__ */ jsxs("h3", {
|
|
32
|
+
id: "toc-title",
|
|
33
|
+
className: "inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground",
|
|
34
|
+
children: [/* @__PURE__ */ jsx(Text, { className: "size-4" }), t("On this page")]
|
|
35
|
+
}),
|
|
36
|
+
/* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, {
|
|
37
|
+
...list,
|
|
38
|
+
children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, { item }, item.url))]
|
|
39
|
+
}) }),
|
|
40
|
+
footer
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const TocPopoverContext = createContext(null);
|
|
45
|
+
function TOCPopover({ container, trigger, content, header, footer, style = "normal", list }) {
|
|
46
|
+
const items = useTOCItems();
|
|
47
|
+
const ref = useRef(null);
|
|
48
|
+
const [open, setOpen] = useState(false);
|
|
49
|
+
const { isNavTransparent } = useNotebookLayout();
|
|
50
|
+
const { TOCItems, TOCItem, TOCEmpty } = style === "clerk" ? clerk_exports : default_exports;
|
|
51
|
+
const onClickOutside = useEffectEvent((e) => {
|
|
52
|
+
if (!open || !(e.target instanceof HTMLElement)) return;
|
|
53
|
+
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
54
|
+
});
|
|
55
|
+
const onClickItem = () => {
|
|
56
|
+
setOpen(false);
|
|
57
|
+
};
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
window.addEventListener("click", onClickOutside);
|
|
60
|
+
return () => {
|
|
61
|
+
window.removeEventListener("click", onClickOutside);
|
|
62
|
+
};
|
|
63
|
+
}, []);
|
|
64
|
+
return /* @__PURE__ */ jsx(TocPopoverContext, {
|
|
65
|
+
value: useMemo(() => ({
|
|
66
|
+
open,
|
|
67
|
+
setOpen
|
|
68
|
+
}), [setOpen, open]),
|
|
69
|
+
children: /* @__PURE__ */ jsx(Collapsible, {
|
|
70
|
+
open,
|
|
71
|
+
onOpenChange: setOpen,
|
|
72
|
+
"data-toc-popover": "",
|
|
73
|
+
...container,
|
|
74
|
+
className: cn("sticky top-(--fd-docs-row-2) z-10 [grid-area:toc-popover] h-(--fd-toc-popover-height) xl:hidden max-xl:layout:[--fd-toc-popover-height:--spacing(10)]", container?.className),
|
|
75
|
+
children: /* @__PURE__ */ jsxs("header", {
|
|
76
|
+
ref,
|
|
77
|
+
className: cn("border-b backdrop-blur-sm transition-colors", (!isNavTransparent || open) && "bg-fd-background/80", open && "shadow-lg"),
|
|
78
|
+
children: [/* @__PURE__ */ jsx(PageTOCPopoverTrigger, { ...trigger }), /* @__PURE__ */ jsxs(PageTOCPopoverContent, {
|
|
79
|
+
...content,
|
|
80
|
+
children: [
|
|
81
|
+
header,
|
|
82
|
+
/* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, {
|
|
83
|
+
...list,
|
|
84
|
+
children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, {
|
|
85
|
+
item,
|
|
86
|
+
onClick: onClickItem
|
|
87
|
+
}, item.url))]
|
|
88
|
+
}) }),
|
|
89
|
+
footer
|
|
90
|
+
]
|
|
91
|
+
})]
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function PageTOCPopoverTrigger({ className, ...props }) {
|
|
97
|
+
const t = useTranslations({ note: "table of contents" });
|
|
98
|
+
const { open } = use(TocPopoverContext);
|
|
99
|
+
const items = useItems();
|
|
100
|
+
const selectedIdx = items.findIndex((item) => item.active);
|
|
101
|
+
const path = useTreePath().at(-1);
|
|
102
|
+
const showItem = selectedIdx !== -1 && !open;
|
|
103
|
+
return /* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
104
|
+
className: cn("flex w-full h-10 items-center text-sm text-fd-muted-foreground gap-2.5 px-4 py-2.5 text-start focus-visible:outline-none [&_svg]:size-4 md:px-6", className),
|
|
105
|
+
"data-toc-popover-trigger": "",
|
|
106
|
+
...props,
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ jsx(ProgressCircle, {
|
|
109
|
+
value: (items.findLastIndex((item) => item.active) + 1) / Math.max(1, items.length),
|
|
110
|
+
max: 1,
|
|
111
|
+
className: cn("shrink-0", open && "text-fd-primary")
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ jsxs("span", {
|
|
114
|
+
className: "grid flex-1 *:my-auto *:row-start-1 *:col-start-1",
|
|
115
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
116
|
+
className: cn("truncate transition-[opacity,translate,color]", open && "text-fd-foreground", showItem && "opacity-0 -translate-y-full pointer-events-none"),
|
|
117
|
+
children: path?.name ?? t("On this page")
|
|
118
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
119
|
+
className: cn("truncate transition-[opacity,translate]", !showItem && "opacity-0 translate-y-full pointer-events-none"),
|
|
120
|
+
children: items[selectedIdx]?.original.title
|
|
121
|
+
})]
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: cn("shrink-0 transition-transform mx-0.5", open && "rotate-180") })
|
|
124
|
+
]
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function clamp(input, min, max) {
|
|
128
|
+
if (input < min) return min;
|
|
129
|
+
if (input > max) return max;
|
|
130
|
+
return input;
|
|
131
|
+
}
|
|
132
|
+
function ProgressCircle({ value, strokeWidth = 1.5, size = 18, min = 0, max = 100, style, ...restSvgProps }) {
|
|
133
|
+
const normalizedValue = clamp(value, min, max);
|
|
134
|
+
const radius = size / 2 - strokeWidth;
|
|
135
|
+
const circumference = 2 * Math.PI * radius;
|
|
136
|
+
const progress = normalizedValue / max * circumference;
|
|
137
|
+
const circleProps = {
|
|
138
|
+
cx: size / 2,
|
|
139
|
+
cy: size / 2,
|
|
140
|
+
r: radius,
|
|
141
|
+
fill: "none",
|
|
142
|
+
strokeWidth
|
|
143
|
+
};
|
|
144
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
145
|
+
role: "progressbar",
|
|
146
|
+
viewBox: `0 0 ${size} ${size}`,
|
|
147
|
+
"aria-valuenow": normalizedValue,
|
|
148
|
+
"aria-valuemin": min,
|
|
149
|
+
"aria-valuemax": max,
|
|
150
|
+
style: {
|
|
151
|
+
width: size,
|
|
152
|
+
height: size,
|
|
153
|
+
...style
|
|
154
|
+
},
|
|
155
|
+
...restSvgProps,
|
|
156
|
+
children: [/* @__PURE__ */ jsx("circle", {
|
|
157
|
+
...circleProps,
|
|
158
|
+
className: "stroke-current/25"
|
|
159
|
+
}), /* @__PURE__ */ jsx("circle", {
|
|
160
|
+
...circleProps,
|
|
161
|
+
stroke: "currentColor",
|
|
162
|
+
strokeDasharray: circumference,
|
|
163
|
+
strokeDashoffset: circumference - progress,
|
|
164
|
+
strokeLinecap: "round",
|
|
165
|
+
transform: `rotate(-90 ${size / 2} ${size / 2})`,
|
|
166
|
+
className: "transition-all"
|
|
167
|
+
})]
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function PageTOCPopoverContent(props) {
|
|
171
|
+
return /* @__PURE__ */ jsx(CollapsibleContent, {
|
|
172
|
+
"data-toc-popover-content": "",
|
|
173
|
+
...props,
|
|
174
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
175
|
+
className: "flex flex-col px-4 max-h-[50vh] md:px-6",
|
|
176
|
+
children: props.children
|
|
177
|
+
})
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
//#endregion
|
|
181
|
+
export { TOC, TOCPopover, TOCProvider };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { useNotebookLayout } from "../client.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { useEffect, useState } from "react";
|
|
6
|
+
//#region src/layouts/notebook/slots/container.tsx
|
|
7
|
+
function Container(props) {
|
|
8
|
+
const { props: { nav }, slots } = useNotebookLayout();
|
|
9
|
+
const pageCol = "calc(var(--fd-layout-width,97rem) - var(--fd-sidebar-col) - var(--fd-toc-width))";
|
|
10
|
+
const { collapsed } = slots.sidebar?.useSidebar?.() ?? {};
|
|
11
|
+
const [previousCollapsed, setPreviousCollapsed] = useState(collapsed);
|
|
12
|
+
const isCollapseChanged = previousCollapsed !== collapsed;
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (isCollapseChanged) setPreviousCollapsed(collapsed);
|
|
15
|
+
}, [collapsed, isCollapseChanged]);
|
|
16
|
+
return /* @__PURE__ */ jsx("div", {
|
|
17
|
+
id: "nd-notebook-layout",
|
|
18
|
+
"data-sidebar-collapsed": collapsed,
|
|
19
|
+
"data-column-changed": isCollapseChanged,
|
|
20
|
+
...props,
|
|
21
|
+
style: {
|
|
22
|
+
gridTemplate: nav?.mode === "top" ? `". header header header ."
|
|
23
|
+
"sidebar sidebar toc-popover toc-popover ."
|
|
24
|
+
"sidebar sidebar main toc ." 1fr / minmax(min-content, 1fr) var(--fd-sidebar-col) minmax(0, ${pageCol}) var(--fd-toc-width) minmax(min-content, 1fr)` : `"sidebar sidebar header header ."
|
|
25
|
+
"sidebar sidebar toc-popover toc-popover ."
|
|
26
|
+
"sidebar sidebar main toc ." 1fr / minmax(min-content, 1fr) var(--fd-sidebar-col) minmax(0, ${pageCol}) var(--fd-toc-width) minmax(min-content, 1fr)`,
|
|
27
|
+
"--fd-docs-row-1": "var(--fd-banner-height, 0px)",
|
|
28
|
+
"--fd-docs-row-2": "calc(var(--fd-docs-row-1) + var(--fd-header-height))",
|
|
29
|
+
"--fd-docs-row-3": "calc(var(--fd-docs-row-2) + var(--fd-toc-popover-height))",
|
|
30
|
+
"--fd-sidebar-col": collapsed ? "0px" : "var(--fd-sidebar-width)",
|
|
31
|
+
...props.style
|
|
32
|
+
},
|
|
33
|
+
className: cn("grid overflow-x-clip min-h-(--fd-docs-height) auto-cols-auto auto-rows-auto [--fd-docs-height:100dvh] [--fd-header-height:0px] [--fd-toc-popover-height:0px] [--fd-sidebar-width:0px] [--fd-toc-width:0px] data-[column-changed=true]:transition-[grid-template-columns]", props.className),
|
|
34
|
+
children: props.children
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { Container };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/layouts/notebook/slots/header.d.ts
|
|
4
|
+
declare function Header(props: ComponentProps<'header'>): string | number | bigint | true | import("react").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { Header };
|