@fumadocs/base-ui 16.7.1 → 16.7.2

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.
Files changed (54) hide show
  1. package/css/generated/docs.css +4 -1
  2. package/css/generated/flux.css +3 -3
  3. package/css/generated/home.css +2 -3
  4. package/css/generated/notebook.css +3 -1
  5. package/dist/components/toc/index.js +10 -1
  6. package/dist/components/ui/button.d.ts +1 -1
  7. package/dist/layouts/docs/client.d.ts +3 -3
  8. package/dist/layouts/docs/client.js +19 -22
  9. package/dist/layouts/docs/index.d.ts +1 -1
  10. package/dist/layouts/docs/page/index.d.ts +91 -3
  11. package/dist/layouts/docs/page/index.js +67 -7
  12. package/dist/layouts/docs/page/slots/breadcrumb.js +1 -0
  13. package/dist/layouts/docs/page/slots/container.js +2 -1
  14. package/dist/layouts/docs/page/slots/footer.js +1 -0
  15. package/dist/layouts/docs/slots/container.js +1 -0
  16. package/dist/layouts/docs/slots/header.js +1 -0
  17. package/dist/layouts/flux/index.d.ts +4 -4
  18. package/dist/layouts/flux/index.js +8 -11
  19. package/dist/layouts/flux/page/index.d.ts +79 -3
  20. package/dist/layouts/flux/page/index.js +61 -7
  21. package/dist/layouts/flux/page/slots/breadcrumb.js +1 -0
  22. package/dist/layouts/flux/page/slots/container.js +2 -1
  23. package/dist/layouts/flux/page/slots/footer.js +1 -0
  24. package/dist/layouts/flux/page/slots/toc.d.ts +4 -1
  25. package/dist/layouts/flux/page/slots/toc.js +3 -2
  26. package/dist/layouts/flux/slots/container.js +1 -0
  27. package/dist/layouts/home/index.d.ts +3 -3
  28. package/dist/layouts/home/index.js +6 -8
  29. package/dist/layouts/home/slots/container.js +1 -0
  30. package/dist/layouts/home/slots/header.d.ts +1 -1
  31. package/dist/layouts/home/slots/header.js +4 -4
  32. package/dist/layouts/notebook/client.d.ts +3 -3
  33. package/dist/layouts/notebook/client.js +14 -17
  34. package/dist/layouts/notebook/index.d.ts +1 -1
  35. package/dist/layouts/notebook/page/index.d.ts +91 -3
  36. package/dist/layouts/notebook/page/index.js +67 -7
  37. package/dist/layouts/notebook/page/slots/breadcrumb.js +1 -0
  38. package/dist/layouts/notebook/page/slots/container.js +2 -1
  39. package/dist/layouts/notebook/page/slots/footer.js +1 -0
  40. package/dist/layouts/notebook/slots/container.js +1 -0
  41. package/dist/layouts/shared/client.d.ts +6 -6
  42. package/dist/layouts/shared/client.js +4 -4
  43. package/dist/layouts/shared/index.d.ts +3 -3
  44. package/dist/layouts/shared/page-actions.d.ts +2 -2
  45. package/dist/layouts/shared/page-actions.js +3 -3
  46. package/dist/page.d.ts +1 -2
  47. package/dist/page.js +1 -2
  48. package/package.json +4 -4
  49. package/dist/layouts/docs/page/client.d.ts +0 -98
  50. package/dist/layouts/docs/page/client.js +0 -110
  51. package/dist/layouts/flux/page/client.d.ts +0 -82
  52. package/dist/layouts/flux/page/client.js +0 -94
  53. package/dist/layouts/notebook/page/client.d.ts +0 -98
  54. package/dist/layouts/notebook/page/client.js +0 -110
@@ -1,110 +0,0 @@
1
- "use client";
2
- import { useI18n } from "../../../contexts/i18n.js";
3
- import { cn } from "../../../utils/cn.js";
4
- import { TOC, TOCPopover, TOCProvider } from "./slots/toc.js";
5
- import { Footer } from "./slots/footer.js";
6
- import { Breadcrumb } from "./slots/breadcrumb.js";
7
- import { Container } from "./slots/container.js";
8
- import { createContext, use, useEffect, useState } from "react";
9
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
10
- //#region src/layouts/notebook/page/client.tsx
11
- const PageContext = createContext(null);
12
- function useDocsPage() {
13
- const context = use(PageContext);
14
- if (!context) throw new Error("Please use page components under <DocsPage /> (`fumadocs-ui/layouts/notebook/page`).");
15
- return context;
16
- }
17
- function DocsPage({ tableOfContent: { enabled: tocEnabled, single, ...tocProps } = {}, tableOfContentPopover: { enabled: tocPopoverEnabled, ...tocPopoverProps } = {}, footer = {}, breadcrumb = {}, full = false, toc = [], slots: defaultSlots = {}, children, ...containerProps }) {
18
- tocEnabled ??= Boolean(!full && (toc.length > 0 || tocProps.footer || tocProps.header));
19
- tocPopoverEnabled ??= Boolean(toc.length > 0 || tocPopoverProps.header || tocPopoverProps.footer);
20
- const slots = {
21
- breadcrumb: breadcrumb.enabled !== false ? defaultSlots.breadcrumb ?? InlineBreadcrumb : void 0,
22
- footer: footer.enabled !== false ? defaultSlots.footer ?? InlineFooter : void 0,
23
- toc: defaultSlots.toc ?? {
24
- provider: TOCProvider,
25
- main: tocEnabled ? InlineTOC : void 0,
26
- popover: tocPopoverEnabled ? InlineTOCPopover : void 0
27
- },
28
- container: defaultSlots.container ?? Container
29
- };
30
- let content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
31
- slots.toc?.popover && /* @__PURE__ */ jsx(slots.toc.popover, {}),
32
- slots.container && /* @__PURE__ */ jsxs(slots.container, {
33
- ...containerProps,
34
- children: [
35
- slots.breadcrumb && /* @__PURE__ */ jsx(slots.breadcrumb, {}),
36
- children,
37
- slots.footer && /* @__PURE__ */ jsx(slots.footer, {})
38
- ]
39
- }),
40
- slots.toc?.main && /* @__PURE__ */ jsx(slots.toc.main, {})
41
- ] });
42
- if (slots.toc) content = /* @__PURE__ */ jsx(slots.toc.provider, {
43
- single,
44
- toc: tocEnabled || tocPopoverEnabled ? toc : [],
45
- children: content
46
- });
47
- return /* @__PURE__ */ jsx(PageContext, {
48
- value: {
49
- props: {
50
- full,
51
- tableOfContent: tocProps,
52
- tableOfContentPopover: tocPopoverProps,
53
- footer,
54
- breadcrumb
55
- },
56
- slots
57
- },
58
- children: content
59
- });
60
- }
61
- function InlineBreadcrumb(props) {
62
- const { component, enabled: _, ...rest } = useDocsPage().props.breadcrumb ?? {};
63
- if (component) return component;
64
- return /* @__PURE__ */ jsx(Breadcrumb, {
65
- ...props,
66
- ...rest
67
- });
68
- }
69
- function InlineFooter(props) {
70
- const { component, enabled: _, ...rest } = useDocsPage().props.footer ?? {};
71
- if (component) return component;
72
- return /* @__PURE__ */ jsx(Footer, {
73
- ...props,
74
- ...rest
75
- });
76
- }
77
- function InlineTOCPopover(props) {
78
- const { tableOfContentPopover } = useDocsPage().props;
79
- if (tableOfContentPopover.component) return tableOfContentPopover.component;
80
- return /* @__PURE__ */ jsx(TOCPopover, {
81
- ...props,
82
- ...tableOfContentPopover
83
- });
84
- }
85
- function InlineTOC(props) {
86
- const { tableOfContent } = useDocsPage().props;
87
- if (tableOfContent.component) return tableOfContent.component;
88
- return /* @__PURE__ */ jsx(TOC, {
89
- ...props,
90
- ...tableOfContent
91
- });
92
- }
93
- function PageLastUpdate({ date: value, ...props }) {
94
- const { text } = useI18n();
95
- const [date, setDate] = useState("");
96
- useEffect(() => {
97
- setDate(value.toLocaleDateString());
98
- }, [value]);
99
- return /* @__PURE__ */ jsxs("p", {
100
- ...props,
101
- className: cn("text-sm text-fd-muted-foreground", props.className),
102
- children: [
103
- text.lastUpdate,
104
- " ",
105
- date
106
- ]
107
- });
108
- }
109
- //#endregion
110
- export { DocsPage, PageLastUpdate, useDocsPage };