@hanzo/docs-base-ui 16.5.0 → 16.7.5
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 +3 -3
- package/css/aspen.css +39 -0
- package/css/black.css +39 -1
- package/css/catppuccin.css +49 -1
- package/css/dusk.css +47 -1
- package/css/emerald.css +39 -0
- package/css/generated/docs.css +490 -0
- package/css/generated/flux.css +429 -0
- package/css/generated/home.css +285 -0
- package/css/generated/notebook.css +526 -0
- package/css/generated/shared.css +1173 -0
- package/css/lib/base.css +214 -0
- package/css/lib/default-colors.css +51 -0
- package/css/lib/shiki.css +98 -0
- package/css/neutral.css +7 -1
- package/css/ocean.css +44 -1
- package/css/preset.css +9 -7
- package/css/purple.css +39 -1
- package/css/ruby.css +39 -0
- package/css/shadcn.css +36 -1
- package/css/solar.css +75 -1
- package/css/vitepress.css +65 -1
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/components/accordion.d.ts +2 -3
- package/dist/components/accordion.js +9 -13
- package/dist/components/banner.d.ts +3 -4
- package/dist/components/banner.js +5 -9
- package/dist/components/callout.d.ts +6 -7
- package/dist/components/callout.js +1 -4
- package/dist/components/card.d.ts +4 -5
- package/dist/components/card.js +2 -5
- package/dist/components/codeblock.d.ts +8 -9
- package/dist/components/codeblock.js +9 -13
- package/dist/components/codeblock.rsc.d.ts +21 -0
- package/dist/components/codeblock.rsc.js +22 -0
- package/dist/components/dialog/search-algolia.d.ts +7 -9
- package/dist/components/dialog/search-algolia.js +8 -12
- package/dist/components/dialog/search-default.d.ts +7 -9
- package/dist/components/dialog/search-default.js +8 -12
- package/dist/components/dialog/search-orama.d.ts +7 -9
- package/dist/components/dialog/search-orama.js +8 -12
- package/dist/components/dialog/search.d.ts +21 -21
- package/dist/components/dialog/search.js +137 -60
- package/dist/components/dynamic-codeblock.core.d.ts +35 -0
- package/dist/components/dynamic-codeblock.core.js +51 -0
- package/dist/components/dynamic-codeblock.d.ts +7 -29
- package/dist/components/dynamic-codeblock.js +11 -60
- package/dist/components/files.d.ts +1 -2
- package/dist/components/files.js +6 -10
- package/dist/components/github-info.d.ts +23 -10
- package/dist/components/github-info.js +34 -29
- package/dist/components/heading.d.ts +1 -2
- package/dist/components/heading.js +3 -6
- package/dist/components/image-zoom.d.ts +4 -5
- package/dist/components/image-zoom.js +2 -5
- package/dist/components/inline-toc.d.ts +3 -4
- package/dist/components/inline-toc.js +2 -6
- package/dist/components/sidebar/base.d.ts +29 -23
- package/dist/components/sidebar/base.js +16 -22
- package/dist/components/sidebar/link-item.d.ts +3 -4
- package/dist/components/sidebar/link-item.js +6 -3
- package/dist/components/sidebar/page-tree.d.ts +3 -4
- package/dist/components/sidebar/page-tree.js +56 -45
- package/dist/components/sidebar/tabs/dropdown.d.ts +6 -9
- package/dist/components/sidebar/tabs/dropdown.js +22 -29
- package/dist/components/sidebar/tabs/index.d.ts +3 -17
- package/dist/components/sidebar/tabs/index.js +0 -3
- package/dist/components/steps.d.ts +4 -5
- package/dist/components/steps.js +0 -3
- package/dist/components/tabs.d.ts +15 -11
- package/dist/components/tabs.js +15 -20
- package/dist/components/toc/clerk.d.ts +19 -1
- package/dist/components/toc/clerk.js +165 -10
- package/dist/components/toc/default.d.ts +19 -1
- package/dist/components/toc/default.js +45 -10
- package/dist/components/toc/index.d.ts +29 -1
- package/dist/components/toc/index.js +105 -10
- package/dist/components/type-table.d.ts +11 -6
- package/dist/components/type-table.js +28 -23
- package/dist/components/ui/accordion.d.ts +7 -8
- package/dist/components/ui/accordion.js +2 -6
- package/dist/components/ui/button.d.ts +1 -2
- package/dist/components/ui/button.js +0 -3
- package/dist/components/ui/collapsible.d.ts +6 -7
- package/dist/components/ui/collapsible.js +3 -7
- package/dist/components/ui/navigation-menu.d.ts +27 -13
- package/dist/components/ui/navigation-menu.js +53 -31
- package/dist/components/ui/popover.d.ts +11 -6
- package/dist/components/ui/popover.js +15 -19
- package/dist/components/ui/scroll-area.d.ts +17 -7
- package/dist/components/ui/scroll-area.js +27 -31
- package/dist/components/ui/tabs.d.ts +8 -9
- package/dist/components/ui/tabs.js +5 -9
- package/dist/contexts/i18n.d.ts +62 -1
- package/dist/contexts/i18n.js +53 -10
- package/dist/contexts/search.d.ts +71 -5
- package/dist/contexts/search.js +64 -10
- package/dist/contexts/tree.d.ts +21 -1
- package/dist/contexts/tree.js +36 -10
- package/dist/i18n.d.ts +21 -1
- package/dist/i18n.js +20 -3
- package/dist/layouts/docs/client.d.ts +30 -29
- package/dist/layouts/docs/client.js +76 -52
- package/dist/layouts/docs/index.d.ts +21 -35
- package/dist/layouts/docs/index.js +16 -172
- package/dist/layouts/docs/page/index.d.ts +75 -52
- package/dist/layouts/docs/page/index.js +76 -56
- package/dist/layouts/docs/page/slots/breadcrumb.d.ts +14 -0
- package/dist/layouts/docs/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/docs/page/slots/container.d.ts +7 -0
- package/dist/layouts/docs/page/slots/container.js +17 -0
- package/dist/layouts/docs/page/slots/footer.d.ts +23 -0
- package/dist/layouts/docs/page/slots/footer.js +56 -0
- package/dist/layouts/docs/page/slots/toc.d.ts +55 -0
- package/dist/layouts/docs/page/slots/toc.js +166 -0
- package/dist/layouts/docs/slots/container.d.ts +7 -0
- package/dist/layouts/docs/slots/container.js +29 -0
- package/dist/layouts/docs/slots/header.d.ts +8 -0
- package/dist/layouts/docs/slots/header.js +38 -0
- package/dist/layouts/docs/slots/sidebar.d.ts +30 -0
- package/dist/layouts/docs/slots/sidebar.js +319 -0
- package/dist/layouts/flux/index.d.ts +74 -0
- package/dist/layouts/flux/index.js +146 -0
- package/dist/layouts/flux/page/index.d.ts +105 -0
- package/dist/layouts/flux/page/index.js +104 -0
- package/dist/layouts/flux/page/slots/breadcrumb.d.ts +14 -0
- package/dist/layouts/flux/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/flux/page/slots/container.d.ts +7 -0
- package/dist/layouts/flux/page/slots/container.js +17 -0
- package/dist/layouts/flux/page/slots/footer.d.ts +23 -0
- package/dist/layouts/flux/page/slots/footer.js +56 -0
- package/dist/layouts/flux/page/slots/toc.d.ts +34 -0
- package/dist/layouts/flux/page/slots/toc.js +172 -0
- package/dist/layouts/flux/slots/container.d.ts +7 -0
- package/dist/layouts/flux/slots/container.js +13 -0
- package/dist/layouts/flux/slots/sidebar.d.ts +23 -0
- package/dist/layouts/flux/slots/sidebar.js +237 -0
- package/dist/layouts/flux/slots/tab-dropdown.d.ts +17 -0
- package/dist/layouts/flux/slots/tab-dropdown.js +85 -0
- package/dist/layouts/home/index.d.ts +25 -8
- package/dist/layouts/home/index.js +39 -19
- package/dist/layouts/home/navbar.d.ts +7 -16
- package/dist/layouts/home/navbar.js +12 -14
- package/dist/layouts/home/not-found.d.ts +9 -0
- package/dist/layouts/home/not-found.js +38 -0
- package/dist/layouts/home/slots/container.d.ts +7 -0
- package/dist/layouts/home/slots/container.js +13 -0
- package/dist/layouts/home/slots/header.d.ts +11 -0
- package/dist/layouts/home/slots/header.js +242 -0
- package/dist/layouts/notebook/client.d.ts +32 -44
- package/dist/layouts/notebook/client.js +58 -148
- package/dist/layouts/notebook/index.d.ts +26 -25
- package/dist/layouts/notebook/index.js +16 -213
- package/dist/layouts/notebook/page/index.d.ts +75 -52
- package/dist/layouts/notebook/page/index.js +76 -56
- package/dist/layouts/notebook/page/slots/breadcrumb.d.ts +14 -0
- package/dist/layouts/notebook/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/notebook/page/slots/container.d.ts +7 -0
- package/dist/layouts/notebook/page/slots/container.js +17 -0
- package/dist/layouts/notebook/page/slots/footer.d.ts +23 -0
- package/dist/layouts/notebook/page/slots/footer.js +56 -0
- package/dist/layouts/notebook/page/slots/toc.d.ts +55 -0
- package/dist/layouts/notebook/page/slots/toc.js +165 -0
- package/dist/layouts/notebook/slots/container.d.ts +7 -0
- package/dist/layouts/notebook/slots/container.js +31 -0
- package/dist/layouts/notebook/slots/header.d.ts +8 -0
- package/dist/layouts/notebook/slots/header.js +194 -0
- package/dist/layouts/notebook/slots/sidebar.d.ts +40 -0
- package/dist/layouts/notebook/slots/sidebar.js +297 -0
- package/dist/layouts/shared/client.d.ts +45 -0
- package/dist/layouts/shared/client.js +84 -0
- package/dist/layouts/shared/index.d.ts +144 -35
- package/dist/layouts/shared/index.js +74 -15
- package/dist/layouts/shared/page-actions.d.ts +36 -0
- package/dist/layouts/shared/page-actions.js +190 -0
- package/dist/layouts/shared/slots/language-select.d.ts +10 -0
- package/dist/layouts/shared/{language-toggle.js → slots/language-select.js} +12 -16
- package/dist/layouts/shared/slots/search-trigger.d.ts +23 -0
- package/dist/layouts/shared/{search-toggle.js → slots/search-trigger.js} +12 -16
- package/dist/layouts/shared/slots/theme-switch.d.ts +14 -0
- package/dist/layouts/shared/{theme-toggle.js → slots/theme-switch.js} +11 -15
- package/dist/mdx.d.ts +23 -13
- package/dist/mdx.js +2 -6
- package/dist/mdx.server.d.ts +1 -3
- package/dist/mdx.server.js +0 -3
- package/dist/og/takumi.d.ts +21 -0
- package/dist/og/takumi.js +70 -0
- package/dist/og.d.ts +22 -1
- package/dist/og.js +70 -3
- package/dist/page.d.ts +6 -7
- package/dist/page.js +9 -14
- package/dist/provider/base.d.ts +5 -6
- package/dist/provider/base.js +5 -9
- package/dist/provider/next.d.ts +4 -5
- package/dist/provider/next.js +1 -5
- package/dist/provider/react-router.d.ts +4 -5
- package/dist/provider/react-router.js +1 -5
- package/dist/provider/tanstack.d.ts +4 -5
- package/dist/provider/tanstack.js +1 -5
- package/dist/provider/waku.d.ts +4 -5
- package/dist/provider/waku.js +1 -5
- package/dist/style.css +594 -192
- 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 -1
- package/dist/utils/use-copy-button.js +26 -3
- package/dist/utils/use-footer-items.d.ts +9 -1
- package/dist/utils/use-footer-items.js +24 -3
- package/dist/utils/use-is-scroll-top.d.ts +8 -1
- package/dist/utils/use-is-scroll-top.js +20 -3
- package/package.json +133 -81
- package/css/layouts/docs.css +0 -1
- package/css/layouts/home.css +0 -1
- package/css/layouts/notebook.css +0 -1
- package/dist/_virtual/rolldown_runtime.js +0 -36
- package/dist/components/accordion.d.ts.map +0 -1
- package/dist/components/accordion.js.map +0 -1
- package/dist/components/banner.d.ts.map +0 -1
- package/dist/components/banner.js.map +0 -1
- package/dist/components/callout.d.ts.map +0 -1
- package/dist/components/callout.js.map +0 -1
- package/dist/components/card.d.ts.map +0 -1
- package/dist/components/card.js.map +0 -1
- package/dist/components/codeblock.d.ts.map +0 -1
- package/dist/components/codeblock.js.map +0 -1
- package/dist/components/dialog/search-algolia.d.ts.map +0 -1
- package/dist/components/dialog/search-algolia.js.map +0 -1
- package/dist/components/dialog/search-default.d.ts.map +0 -1
- package/dist/components/dialog/search-default.js.map +0 -1
- package/dist/components/dialog/search-orama.d.ts.map +0 -1
- package/dist/components/dialog/search-orama.js.map +0 -1
- package/dist/components/dialog/search.d.ts.map +0 -1
- package/dist/components/dialog/search.js.map +0 -1
- package/dist/components/dynamic-codeblock.d.ts.map +0 -1
- package/dist/components/dynamic-codeblock.js.map +0 -1
- package/dist/components/files.d.ts.map +0 -1
- package/dist/components/files.js.map +0 -1
- package/dist/components/github-info.d.ts.map +0 -1
- package/dist/components/github-info.js.map +0 -1
- package/dist/components/heading.d.ts.map +0 -1
- package/dist/components/heading.js.map +0 -1
- package/dist/components/image-zoom-CtfZieBH.css +0 -80
- package/dist/components/image-zoom-CtfZieBH.css.map +0 -1
- package/dist/components/image-zoom.d.ts.map +0 -1
- package/dist/components/image-zoom.js.map +0 -1
- package/dist/components/image-zoom2.js +0 -1
- package/dist/components/inline-toc.d.ts.map +0 -1
- package/dist/components/inline-toc.js.map +0 -1
- package/dist/components/sidebar/base.d.ts.map +0 -1
- package/dist/components/sidebar/base.js.map +0 -1
- package/dist/components/sidebar/link-item.d.ts.map +0 -1
- package/dist/components/sidebar/link-item.js.map +0 -1
- package/dist/components/sidebar/page-tree.d.ts.map +0 -1
- package/dist/components/sidebar/page-tree.js.map +0 -1
- package/dist/components/sidebar/tabs/dropdown.d.ts.map +0 -1
- package/dist/components/sidebar/tabs/dropdown.js.map +0 -1
- package/dist/components/sidebar/tabs/index.d.ts.map +0 -1
- package/dist/components/sidebar/tabs/index.js.map +0 -1
- package/dist/components/steps.d.ts.map +0 -1
- package/dist/components/steps.js.map +0 -1
- package/dist/components/tabs.d.ts.map +0 -1
- package/dist/components/tabs.js.map +0 -1
- package/dist/components/toc/clerk.js.map +0 -1
- package/dist/components/toc/default.js.map +0 -1
- package/dist/components/toc/index.js.map +0 -1
- package/dist/components/type-table.d.ts.map +0 -1
- package/dist/components/type-table.js.map +0 -1
- package/dist/components/ui/accordion.d.ts.map +0 -1
- package/dist/components/ui/accordion.js.map +0 -1
- package/dist/components/ui/button.d.ts.map +0 -1
- package/dist/components/ui/button.js.map +0 -1
- package/dist/components/ui/collapsible.d.ts.map +0 -1
- package/dist/components/ui/collapsible.js.map +0 -1
- package/dist/components/ui/navigation-menu.d.ts.map +0 -1
- package/dist/components/ui/navigation-menu.js.map +0 -1
- package/dist/components/ui/popover.d.ts.map +0 -1
- package/dist/components/ui/popover.js.map +0 -1
- package/dist/components/ui/scroll-area.d.ts.map +0 -1
- package/dist/components/ui/scroll-area.js.map +0 -1
- package/dist/components/ui/tabs.d.ts.map +0 -1
- package/dist/components/ui/tabs.js.map +0 -1
- package/dist/contexts/i18n.js.map +0 -1
- package/dist/contexts/search.d.ts.map +0 -1
- package/dist/contexts/search.js.map +0 -1
- package/dist/contexts/tree.js.map +0 -1
- package/dist/layouts/docs/client.d.ts.map +0 -1
- package/dist/layouts/docs/client.js.map +0 -1
- package/dist/layouts/docs/index.d.ts.map +0 -1
- package/dist/layouts/docs/index.js.map +0 -1
- package/dist/layouts/docs/page/client.d.ts +0 -46
- package/dist/layouts/docs/page/client.d.ts.map +0 -1
- package/dist/layouts/docs/page/client.js +0 -227
- package/dist/layouts/docs/page/client.js.map +0 -1
- package/dist/layouts/docs/page/index.d.ts.map +0 -1
- package/dist/layouts/docs/page/index.js.map +0 -1
- package/dist/layouts/docs/sidebar.d.ts +0 -63
- package/dist/layouts/docs/sidebar.d.ts.map +0 -1
- package/dist/layouts/docs/sidebar.js +0 -162
- package/dist/layouts/docs/sidebar.js.map +0 -1
- package/dist/layouts/home/client.d.ts +0 -19
- package/dist/layouts/home/client.d.ts.map +0 -1
- package/dist/layouts/home/client.js +0 -285
- package/dist/layouts/home/client.js.map +0 -1
- package/dist/layouts/home/index.d.ts.map +0 -1
- package/dist/layouts/home/index.js.map +0 -1
- package/dist/layouts/home/navbar.d.ts.map +0 -1
- package/dist/layouts/home/navbar.js.map +0 -1
- package/dist/layouts/notebook/client.d.ts.map +0 -1
- package/dist/layouts/notebook/client.js.map +0 -1
- package/dist/layouts/notebook/index.d.ts.map +0 -1
- package/dist/layouts/notebook/index.js.map +0 -1
- package/dist/layouts/notebook/page/client.d.ts +0 -46
- package/dist/layouts/notebook/page/client.d.ts.map +0 -1
- package/dist/layouts/notebook/page/client.js +0 -227
- package/dist/layouts/notebook/page/client.js.map +0 -1
- package/dist/layouts/notebook/page/index.d.ts.map +0 -1
- package/dist/layouts/notebook/page/index.js.map +0 -1
- package/dist/layouts/notebook/sidebar.d.ts +0 -59
- package/dist/layouts/notebook/sidebar.d.ts.map +0 -1
- package/dist/layouts/notebook/sidebar.js +0 -133
- package/dist/layouts/notebook/sidebar.js.map +0 -1
- package/dist/layouts/shared/index.d.ts.map +0 -1
- package/dist/layouts/shared/index.js.map +0 -1
- package/dist/layouts/shared/language-toggle.d.ts +0 -10
- package/dist/layouts/shared/language-toggle.d.ts.map +0 -1
- package/dist/layouts/shared/language-toggle.js.map +0 -1
- package/dist/layouts/shared/search-toggle.d.ts +0 -23
- package/dist/layouts/shared/search-toggle.d.ts.map +0 -1
- package/dist/layouts/shared/search-toggle.js.map +0 -1
- package/dist/layouts/shared/theme-toggle.d.ts +0 -14
- package/dist/layouts/shared/theme-toggle.d.ts.map +0 -1
- package/dist/layouts/shared/theme-toggle.js.map +0 -1
- package/dist/mdx.d.ts.map +0 -1
- package/dist/mdx.js.map +0 -1
- package/dist/mdx.server.d.ts.map +0 -1
- package/dist/mdx.server.js.map +0 -1
- package/dist/page.d.ts.map +0 -1
- package/dist/page.js.map +0 -1
- package/dist/provider/base.d.ts.map +0 -1
- package/dist/provider/base.js.map +0 -1
- package/dist/provider/next.d.ts.map +0 -1
- package/dist/provider/next.js.map +0 -1
- package/dist/provider/react-router.d.ts.map +0 -1
- package/dist/provider/react-router.js.map +0 -1
- package/dist/provider/tanstack.d.ts.map +0 -1
- package/dist/provider/tanstack.js.map +0 -1
- package/dist/provider/waku.d.ts.map +0 -1
- package/dist/provider/waku.js.map +0 -1
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import * as React from "react";
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
3
|
import { Popover as Popover$1 } from "@base-ui/react/popover";
|
|
3
|
-
import * as
|
|
4
|
+
import * as _base_ui_react0 from "@base-ui/react";
|
|
4
5
|
|
|
5
6
|
//#region src/components/ui/popover.d.ts
|
|
6
7
|
declare const Popover: typeof Popover$1.Root;
|
|
7
8
|
declare const PopoverTrigger: Popover$1.Trigger;
|
|
8
|
-
declare
|
|
9
|
-
|
|
9
|
+
declare function PopoverContent({
|
|
10
|
+
className,
|
|
11
|
+
align,
|
|
12
|
+
sideOffset,
|
|
13
|
+
...props
|
|
14
|
+
}: React$1.ComponentPropsWithRef<typeof Popover$1.Popup> & Pick<Popover$1.Positioner.Props, 'sideOffset' | 'align'>): react_jsx_runtime0.JSX.Element;
|
|
15
|
+
declare const PopoverClose: React$1.ForwardRefExoticComponent<Omit<_base_ui_react0.PopoverCloseProps, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
10
16
|
//#endregion
|
|
11
|
-
export { Popover, PopoverClose, PopoverContent, PopoverTrigger };
|
|
12
|
-
//# sourceMappingURL=popover.d.ts.map
|
|
17
|
+
export { Popover, PopoverClose, PopoverContent, PopoverTrigger };
|
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
import * as React from "react";
|
|
6
5
|
import { Popover as Popover$1 } from "@base-ui/react/popover";
|
|
7
|
-
|
|
8
6
|
//#region src/components/ui/popover.tsx
|
|
9
7
|
const Popover = Popover$1.Root;
|
|
10
8
|
const PopoverTrigger = Popover$1.Trigger;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}) })
|
|
22
|
-
|
|
9
|
+
function PopoverContent({ className, align = "center", sideOffset = 4, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, {
|
|
11
|
+
align,
|
|
12
|
+
side: "bottom",
|
|
13
|
+
sideOffset,
|
|
14
|
+
className: "z-50",
|
|
15
|
+
children: /* @__PURE__ */ jsx(Popover$1.Popup, {
|
|
16
|
+
className: (s) => cn("z-50 origin-(--transform-origin) overflow-y-auto max-h-(--available-height) min-w-[240px] max-w-[98vw] rounded-xl border bg-fd-popover/60 backdrop-blur-lg p-2 text-sm text-fd-popover-foreground shadow-lg focus-visible:outline-none data-[closed]:animate-fd-popover-out data-[open]:animate-fd-popover-in", typeof className === "function" ? className(s) : className),
|
|
17
|
+
...props
|
|
18
|
+
})
|
|
19
|
+
}) });
|
|
20
|
+
}
|
|
23
21
|
const PopoverClose = Popover$1.Close;
|
|
24
|
-
|
|
25
22
|
//#endregion
|
|
26
23
|
export { Popover, PopoverClose, PopoverContent, PopoverTrigger };
|
|
27
|
-
//# sourceMappingURL=popover.js.map
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
import * as React from "react";
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
3
|
import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
|
|
3
|
-
import * as _base_ui_react13 from "@base-ui/react";
|
|
4
4
|
|
|
5
5
|
//#region src/components/ui/scroll-area.d.ts
|
|
6
|
-
declare
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
declare function ScrollArea({
|
|
7
|
+
children,
|
|
8
|
+
...props
|
|
9
|
+
}: React$1.ComponentPropsWithRef<typeof ScrollArea$1.Root>): react_jsx_runtime0.JSX.Element;
|
|
10
|
+
declare function ScrollViewport({
|
|
11
|
+
className,
|
|
12
|
+
children,
|
|
13
|
+
...props
|
|
14
|
+
}: React$1.ComponentPropsWithRef<typeof ScrollArea$1.Viewport>): react_jsx_runtime0.JSX.Element;
|
|
15
|
+
declare function ScrollBar({
|
|
16
|
+
className,
|
|
17
|
+
orientation,
|
|
18
|
+
...props
|
|
19
|
+
}: React$1.ComponentPropsWithRef<typeof ScrollArea$1.Scrollbar>): react_jsx_runtime0.JSX.Element;
|
|
9
20
|
type ScrollAreaProps = ScrollArea$1.Root.Props;
|
|
10
21
|
//#endregion
|
|
11
|
-
export { ScrollArea, ScrollAreaProps, ScrollBar, ScrollViewport };
|
|
12
|
-
//# sourceMappingURL=scroll-area.d.ts.map
|
|
22
|
+
export { ScrollArea, ScrollAreaProps, ScrollBar, ScrollViewport };
|
|
@@ -1,36 +1,32 @@
|
|
|
1
|
-
import { cn } from "
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
import "react";
|
|
2
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import * as React from "react";
|
|
4
4
|
import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
|
|
5
|
-
|
|
6
5
|
//#region src/components/ui/scroll-area.tsx
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
ScrollBar.displayName = ScrollArea$1.Scrollbar.displayName;
|
|
33
|
-
|
|
6
|
+
function ScrollArea({ children, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsxs(ScrollArea$1.Root, {
|
|
8
|
+
...props,
|
|
9
|
+
children: [
|
|
10
|
+
children,
|
|
11
|
+
/* @__PURE__ */ jsx(ScrollArea$1.Corner, {}),
|
|
12
|
+
/* @__PURE__ */ jsx(ScrollBar, { orientation: "vertical" })
|
|
13
|
+
]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function ScrollViewport({ className, children, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx(ScrollArea$1.Viewport, {
|
|
18
|
+
className: (s) => cn("size-full rounded-[inherit]", typeof className === "function" ? className(s) : className),
|
|
19
|
+
...props,
|
|
20
|
+
children
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function ScrollBar({ className, orientation = "vertical", ...props }) {
|
|
24
|
+
return /* @__PURE__ */ jsx(ScrollArea$1.Scrollbar, {
|
|
25
|
+
orientation,
|
|
26
|
+
className: (s) => cn("flex select-none transition-opacity", !s.hovering && "opacity-0", orientation === "vertical" && "h-full w-1.5", orientation === "horizontal" && "h-1.5 flex-col", typeof className === "function" ? className(s) : className),
|
|
27
|
+
...props,
|
|
28
|
+
children: /* @__PURE__ */ jsx(ScrollArea$1.Thumb, { className: "relative flex-1 rounded-full bg-fd-border" })
|
|
29
|
+
});
|
|
30
|
+
}
|
|
34
31
|
//#endregion
|
|
35
32
|
export { ScrollArea, ScrollBar, ScrollViewport };
|
|
36
|
-
//# sourceMappingURL=scroll-area.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as react3 from "react";
|
|
1
|
+
import * as react from "react";
|
|
3
2
|
import { ComponentProps } from "react";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
5
|
-
import * as
|
|
5
|
+
import * as _base_ui_react0 from "@base-ui/react";
|
|
6
6
|
|
|
7
7
|
//#region src/components/ui/tabs.d.ts
|
|
8
8
|
interface TabsProps extends ComponentProps<typeof Tabs$1.Root> {
|
|
@@ -20,8 +20,8 @@ interface TabsProps extends ComponentProps<typeof Tabs$1.Root> {
|
|
|
20
20
|
updateAnchor?: boolean;
|
|
21
21
|
onValueChange?: (value: string) => void;
|
|
22
22
|
}
|
|
23
|
-
declare const TabsList:
|
|
24
|
-
declare const TabsTrigger:
|
|
23
|
+
declare const TabsList: react.ForwardRefExoticComponent<Omit<_base_ui_react0.TabsListProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
declare const TabsTrigger: react.ForwardRefExoticComponent<Omit<_base_ui_react0.TabsTabProps, "ref"> & react.RefAttributes<HTMLElement>>;
|
|
25
25
|
declare function Tabs({
|
|
26
26
|
ref,
|
|
27
27
|
groupId,
|
|
@@ -31,11 +31,10 @@ declare function Tabs({
|
|
|
31
31
|
value: _value,
|
|
32
32
|
onValueChange: _onValueChange,
|
|
33
33
|
...props
|
|
34
|
-
}: TabsProps):
|
|
34
|
+
}: TabsProps): react_jsx_runtime0.JSX.Element;
|
|
35
35
|
declare function TabsContent({
|
|
36
36
|
value,
|
|
37
37
|
...props
|
|
38
|
-
}: ComponentProps<typeof Tabs$1.Panel>):
|
|
38
|
+
}: ComponentProps<typeof Tabs$1.Panel>): react_jsx_runtime0.JSX.Element;
|
|
39
39
|
//#endregion
|
|
40
|
-
export { Tabs, TabsContent, TabsList, TabsProps, TabsTrigger };
|
|
41
|
-
//# sourceMappingURL=tabs.d.ts.map
|
|
40
|
+
export { Tabs, TabsContent, TabsList, TabsProps, TabsTrigger };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
"use client";
|
|
2
|
+
import { mergeRefs } from "../../utils/merge-refs.js";
|
|
4
3
|
import { createContext, use, useEffectEvent, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
6
|
-
import { mergeRefs } from "@hanzo/docs-ui/merge-refs";
|
|
7
|
-
|
|
8
6
|
//#region src/components/ui/tabs.tsx
|
|
9
7
|
const listeners = /* @__PURE__ */ new Map();
|
|
10
8
|
const TabsContext = createContext(null);
|
|
@@ -38,8 +36,8 @@ function Tabs({ ref, groupId, persist = false, updateAnchor = false, defaultValu
|
|
|
38
36
|
useLayoutEffect(() => {
|
|
39
37
|
const hash = window.location.hash.slice(1);
|
|
40
38
|
if (!hash) return;
|
|
41
|
-
for (const [value
|
|
42
|
-
setValue(value
|
|
39
|
+
for (const [value, id] of valueToIdMap.entries()) if (id === hash) {
|
|
40
|
+
setValue(value);
|
|
43
41
|
tabsRef.current?.scrollIntoView();
|
|
44
42
|
break;
|
|
45
43
|
}
|
|
@@ -75,7 +73,5 @@ function TabsContent({ value, ...props }) {
|
|
|
75
73
|
children: props.children
|
|
76
74
|
});
|
|
77
75
|
}
|
|
78
|
-
|
|
79
76
|
//#endregion
|
|
80
77
|
export { Tabs, TabsContent, TabsList, TabsTrigger };
|
|
81
|
-
//# sourceMappingURL=tabs.js.map
|
package/dist/contexts/i18n.d.ts
CHANGED
|
@@ -1 +1,62 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/contexts/i18n.d.ts
|
|
5
|
+
interface Translations {
|
|
6
|
+
search: string;
|
|
7
|
+
searchNoResult: string;
|
|
8
|
+
toc: string;
|
|
9
|
+
tocNoHeadings: string;
|
|
10
|
+
lastUpdate: string;
|
|
11
|
+
chooseLanguage: string;
|
|
12
|
+
nextPage: string;
|
|
13
|
+
previousPage: string;
|
|
14
|
+
chooseTheme: string;
|
|
15
|
+
editOnGithub: string;
|
|
16
|
+
}
|
|
17
|
+
type TranslationsOption = {
|
|
18
|
+
[key: string]: string | TranslationsOption;
|
|
19
|
+
};
|
|
20
|
+
interface LocaleItem {
|
|
21
|
+
name: string;
|
|
22
|
+
locale: string;
|
|
23
|
+
}
|
|
24
|
+
interface I18nContextType {
|
|
25
|
+
text: Translations & TranslationsOption;
|
|
26
|
+
locale?: string;
|
|
27
|
+
onChange?: (v: string) => void;
|
|
28
|
+
locales?: LocaleItem[];
|
|
29
|
+
}
|
|
30
|
+
declare const defaultTranslations: Translations;
|
|
31
|
+
declare function I18nLabel(props: {
|
|
32
|
+
label: keyof Translations;
|
|
33
|
+
}): string;
|
|
34
|
+
declare function useI18n(): I18nContextType;
|
|
35
|
+
interface I18nProviderProps {
|
|
36
|
+
/**
|
|
37
|
+
* Current locale
|
|
38
|
+
*/
|
|
39
|
+
locale?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Handle changes to the locale, redirect user when not specified.
|
|
42
|
+
*/
|
|
43
|
+
onLocaleChange?: (v: string) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Translations of current locale
|
|
46
|
+
*/
|
|
47
|
+
translations?: TranslationsOption;
|
|
48
|
+
/**
|
|
49
|
+
* Available languages
|
|
50
|
+
*/
|
|
51
|
+
locales?: LocaleItem[];
|
|
52
|
+
children?: ReactNode;
|
|
53
|
+
}
|
|
54
|
+
declare function I18nProvider({
|
|
55
|
+
locales,
|
|
56
|
+
locale,
|
|
57
|
+
onLocaleChange,
|
|
58
|
+
children,
|
|
59
|
+
translations
|
|
60
|
+
}: I18nProviderProps): react_jsx_runtime0.JSX.Element;
|
|
61
|
+
//#endregion
|
|
62
|
+
export { I18nLabel, I18nProvider, I18nProviderProps, Translations, TranslationsOption, defaultTranslations, useI18n };
|
package/dist/contexts/i18n.js
CHANGED
|
@@ -1,12 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, useContext, useMemo, useRef } from "react";
|
|
3
|
+
import { usePathname, useRouter } from "@hanzo/docs-core/framework";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
//#region src/contexts/i18n.tsx
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const defaultTranslations = {
|
|
7
|
+
search: "Search",
|
|
8
|
+
searchNoResult: "No results found",
|
|
9
|
+
toc: "On this page",
|
|
10
|
+
tocNoHeadings: "No Headings",
|
|
11
|
+
lastUpdate: "Last updated on",
|
|
12
|
+
chooseLanguage: "Choose a language",
|
|
13
|
+
nextPage: "Next Page",
|
|
14
|
+
previousPage: "Previous Page",
|
|
15
|
+
chooseTheme: "Theme",
|
|
16
|
+
editOnGithub: "Edit on GitHub"
|
|
17
|
+
};
|
|
18
|
+
const I18nContext = createContext({ text: { ...defaultTranslations } });
|
|
19
|
+
function I18nLabel(props) {
|
|
20
|
+
return useI18n().text[props.label];
|
|
21
|
+
}
|
|
22
|
+
function useI18n() {
|
|
23
|
+
return useContext(I18nContext);
|
|
24
|
+
}
|
|
25
|
+
function I18nProvider({ locales = [], locale, onLocaleChange, children, translations }) {
|
|
26
|
+
const router = useRouter();
|
|
27
|
+
const pathname = usePathname();
|
|
28
|
+
const onChange = (value) => {
|
|
29
|
+
if (onLocaleChange) return onLocaleChange(value);
|
|
30
|
+
const segments = pathname.split("/").filter((v) => v.length > 0);
|
|
31
|
+
if (segments[0] !== locale) segments.unshift(value);
|
|
32
|
+
else segments[0] = value;
|
|
33
|
+
router.push(`/${segments.join("/")}`);
|
|
34
|
+
};
|
|
35
|
+
const onChangeRef = useRef(onChange);
|
|
36
|
+
onChangeRef.current = onChange;
|
|
37
|
+
return /* @__PURE__ */ jsx(I18nContext, {
|
|
38
|
+
value: useMemo(() => ({
|
|
39
|
+
locale,
|
|
40
|
+
locales,
|
|
41
|
+
text: {
|
|
42
|
+
...defaultTranslations,
|
|
43
|
+
...translations
|
|
44
|
+
},
|
|
45
|
+
onChange: (v) => onChangeRef.current(v)
|
|
46
|
+
}), [
|
|
47
|
+
locale,
|
|
48
|
+
locales,
|
|
49
|
+
translations
|
|
50
|
+
]),
|
|
51
|
+
children
|
|
52
|
+
});
|
|
53
|
+
}
|
|
10
54
|
//#endregion
|
|
11
|
-
export {
|
|
12
|
-
//# sourceMappingURL=i18n.js.map
|
|
55
|
+
export { I18nLabel, I18nProvider, defaultTranslations, useI18n };
|
|
@@ -1,8 +1,74 @@
|
|
|
1
|
-
|
|
1
|
+
import { ComponentType, ReactNode } from "react";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
3
|
|
|
3
4
|
//#region src/contexts/search.d.ts
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
interface HotKey {
|
|
6
|
+
display: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Key code or a function determining whether the key is pressed.
|
|
9
|
+
*/
|
|
10
|
+
key: string | ((e: KeyboardEvent) => boolean);
|
|
11
|
+
}
|
|
12
|
+
interface SharedProps {
|
|
13
|
+
open: boolean;
|
|
14
|
+
onOpenChange: (open: boolean) => void;
|
|
15
|
+
}
|
|
16
|
+
type SearchLink = [name: string, href: string];
|
|
17
|
+
interface TagItem {
|
|
18
|
+
name: string;
|
|
19
|
+
value: string;
|
|
20
|
+
}
|
|
21
|
+
interface SearchProviderProps {
|
|
22
|
+
/**
|
|
23
|
+
* Preload search dialog before opening it
|
|
24
|
+
*
|
|
25
|
+
* @defaultValue `true`
|
|
26
|
+
*/
|
|
27
|
+
preload?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Custom links to be displayed if search is empty
|
|
30
|
+
*/
|
|
31
|
+
links?: SearchLink[];
|
|
32
|
+
/**
|
|
33
|
+
* Hotkeys for triggering search dialog
|
|
34
|
+
*
|
|
35
|
+
* @defaultValue Meta/Ctrl + K
|
|
36
|
+
*/
|
|
37
|
+
hotKey?: HotKey[];
|
|
38
|
+
/**
|
|
39
|
+
* Replace default search dialog, allowing you to use other solutions such as Algolia Search
|
|
40
|
+
*
|
|
41
|
+
* It receives the `open` and `onOpenChange` prop, can be lazy loaded with `next/dynamic`
|
|
42
|
+
*/
|
|
43
|
+
SearchDialog: ComponentType<SharedProps>;
|
|
44
|
+
/**
|
|
45
|
+
* Additional props to the dialog
|
|
46
|
+
*/
|
|
47
|
+
options?: Partial<SharedProps & Record<string, unknown>>;
|
|
48
|
+
children?: ReactNode;
|
|
49
|
+
}
|
|
50
|
+
interface SearchContextType {
|
|
51
|
+
enabled: boolean;
|
|
52
|
+
open: boolean;
|
|
53
|
+
hotKey: HotKey[];
|
|
54
|
+
setOpenSearch: (value: boolean) => void;
|
|
55
|
+
}
|
|
56
|
+
declare function useSearchContext(): SearchContextType;
|
|
57
|
+
declare function SearchProvider({
|
|
58
|
+
SearchDialog,
|
|
59
|
+
children,
|
|
60
|
+
preload,
|
|
61
|
+
options,
|
|
62
|
+
hotKey,
|
|
63
|
+
links
|
|
64
|
+
}: SearchProviderProps): react_jsx_runtime0.JSX.Element;
|
|
65
|
+
/**
|
|
66
|
+
* Show children only when search is enabled via React Context
|
|
67
|
+
*/
|
|
68
|
+
declare function SearchOnly({
|
|
69
|
+
children
|
|
70
|
+
}: {
|
|
71
|
+
children: ReactNode;
|
|
72
|
+
}): ReactNode;
|
|
6
73
|
//#endregion
|
|
7
|
-
export {
|
|
8
|
-
//# sourceMappingURL=search.d.ts.map
|
|
74
|
+
export { SearchLink, SearchOnly, SearchProvider, SearchProviderProps, SharedProps, TagItem, useSearchContext };
|
package/dist/contexts/search.js
CHANGED
|
@@ -1,12 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { Suspense, createContext, use, useEffect, useEffectEvent, useMemo, useState } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
4
|
//#region src/contexts/search.tsx
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 (window.navigator.userAgent.includes("Windows")) setKey("Ctrl");
|
|
18
|
+
}, []);
|
|
19
|
+
return key;
|
|
20
|
+
}
|
|
21
|
+
function SearchProvider({ SearchDialog, children, preload = true, options, hotKey = [{
|
|
22
|
+
key: (e) => e.metaKey || e.ctrlKey,
|
|
23
|
+
display: /* @__PURE__ */ jsx(MetaOrControl, {})
|
|
24
|
+
}, {
|
|
25
|
+
key: "k",
|
|
26
|
+
display: "K"
|
|
27
|
+
}], links }) {
|
|
28
|
+
const [isOpen, setIsOpen] = useState(preload ? false : void 0);
|
|
29
|
+
const onKeyDown = useEffectEvent((e) => {
|
|
30
|
+
if (hotKey.every((v) => typeof v.key === "string" ? e.key === v.key : v.key(e))) {
|
|
31
|
+
setIsOpen((open) => !open);
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
window.addEventListener("keydown", onKeyDown);
|
|
37
|
+
return () => {
|
|
38
|
+
window.removeEventListener("keydown", onKeyDown);
|
|
39
|
+
};
|
|
40
|
+
}, [hotKey]);
|
|
41
|
+
return /* @__PURE__ */ jsxs(SearchContext, {
|
|
42
|
+
value: useMemo(() => ({
|
|
43
|
+
enabled: true,
|
|
44
|
+
open: isOpen ?? false,
|
|
45
|
+
hotKey,
|
|
46
|
+
setOpenSearch: setIsOpen
|
|
47
|
+
}), [isOpen, hotKey]),
|
|
48
|
+
children: [isOpen !== void 0 && /* @__PURE__ */ jsx(Suspense, {
|
|
49
|
+
fallback: null,
|
|
50
|
+
children: /* @__PURE__ */ jsx(SearchDialog, {
|
|
51
|
+
open: isOpen,
|
|
52
|
+
onOpenChange: setIsOpen,
|
|
53
|
+
links,
|
|
54
|
+
...options
|
|
55
|
+
})
|
|
56
|
+
}), children]
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Show children only when search is enabled via React Context
|
|
61
|
+
*/
|
|
62
|
+
function SearchOnly({ children }) {
|
|
63
|
+
if (useSearchContext().enabled) return children;
|
|
64
|
+
}
|
|
10
65
|
//#endregion
|
|
11
|
-
export {
|
|
12
|
-
//# sourceMappingURL=search.js.map
|
|
66
|
+
export { SearchOnly, SearchProvider, useSearchContext };
|
package/dist/contexts/tree.d.ts
CHANGED
|
@@ -1 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
import * as PageTree from "@hanzo/docs-core/page-tree";
|
|
4
|
+
|
|
5
|
+
//#region src/contexts/tree.d.ts
|
|
6
|
+
type MakeRequired<O, K extends keyof O> = Omit<O, K> & Pick<Required<O>, K>;
|
|
7
|
+
interface TreeContextType {
|
|
8
|
+
root: MakeRequired<PageTree.Root | PageTree.Folder, '$id'>;
|
|
9
|
+
full: PageTree.Root;
|
|
10
|
+
}
|
|
11
|
+
declare function TreeContextProvider({
|
|
12
|
+
tree: rawTree,
|
|
13
|
+
children
|
|
14
|
+
}: {
|
|
15
|
+
tree: PageTree.Root;
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
18
|
+
declare function useTreePath(): PageTree.Node[];
|
|
19
|
+
declare function useTreeContext(): TreeContextType;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { TreeContextProvider, useTreeContext, useTreePath };
|
package/dist/contexts/tree.js
CHANGED
|
@@ -1,12 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, use, useMemo, useRef } from "react";
|
|
3
|
+
import { usePathname } from "@hanzo/docs-core/framework";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { searchPath } from "@hanzo/docs-core/breadcrumb";
|
|
5
6
|
//#region src/contexts/tree.tsx
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const TreeContext = createContext(null);
|
|
8
|
+
const PathContext = createContext([]);
|
|
9
|
+
function TreeContextProvider({ tree: rawTree, children }) {
|
|
10
|
+
const nextIdRef = useRef(0);
|
|
11
|
+
const pathname = usePathname();
|
|
12
|
+
const tree = useMemo(() => rawTree, [rawTree.$id ?? rawTree]);
|
|
13
|
+
const path = useMemo(() => {
|
|
14
|
+
return searchPath(tree.children, pathname) ?? (tree.fallback ? searchPath(tree.fallback.children, pathname) : null) ?? [];
|
|
15
|
+
}, [tree, pathname]);
|
|
16
|
+
const root = path.findLast((item) => item.type === "folder" && item.root) ?? tree;
|
|
17
|
+
root.$id ??= String(nextIdRef.current++);
|
|
18
|
+
return /* @__PURE__ */ jsx(TreeContext, {
|
|
19
|
+
value: useMemo(() => ({
|
|
20
|
+
root,
|
|
21
|
+
full: tree
|
|
22
|
+
}), [root, tree]),
|
|
23
|
+
children: /* @__PURE__ */ jsx(PathContext, {
|
|
24
|
+
value: path,
|
|
25
|
+
children
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function useTreePath() {
|
|
30
|
+
return use(PathContext);
|
|
31
|
+
}
|
|
32
|
+
function useTreeContext() {
|
|
33
|
+
const ctx = use(TreeContext);
|
|
34
|
+
if (!ctx) throw new Error("You must wrap this component under <DocsLayout />");
|
|
35
|
+
return ctx;
|
|
36
|
+
}
|
|
10
37
|
//#endregion
|
|
11
|
-
export {
|
|
12
|
-
//# sourceMappingURL=tree.js.map
|
|
38
|
+
export { TreeContextProvider, useTreeContext, useTreePath };
|
package/dist/i18n.d.ts
CHANGED
|
@@ -1 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
import { I18nProviderProps, Translations, defaultTranslations } from "./contexts/i18n.js";
|
|
2
|
+
import { I18nConfig } from "@hanzo/docs-core/i18n";
|
|
3
|
+
|
|
4
|
+
//#region src/i18n.d.ts
|
|
5
|
+
interface I18nUIConfig<Languages extends string> extends I18nConfig<Languages> {
|
|
6
|
+
/**
|
|
7
|
+
* get i18n config for Fumadocs UI `<RootProvider i18n={config} />`.
|
|
8
|
+
*/
|
|
9
|
+
provider: (locale?: Languages | (string & {})) => I18nProviderProps;
|
|
10
|
+
}
|
|
11
|
+
type TranslationsConfig<Languages extends string> = { [K in Languages]?: Partial<Translations> & {
|
|
12
|
+
displayName?: string;
|
|
13
|
+
} };
|
|
14
|
+
declare function defineI18nUI<Languages extends string>(config: I18nConfig<Languages>, options?: {
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated you can directly define the translations in outer scope (the parent object of `translations`)
|
|
17
|
+
*/
|
|
18
|
+
translations: TranslationsConfig<Languages>;
|
|
19
|
+
} | TranslationsConfig<Languages>): I18nUIConfig<Languages>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { type I18nProviderProps, I18nUIConfig, type Translations, defaultTranslations, defineI18nUI };
|
package/dist/i18n.js
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { defaultTranslations } from "./contexts/i18n.js";
|
|
2
|
+
//#region src/i18n.tsx
|
|
3
|
+
function defineI18nUI(config, options = {}) {
|
|
4
|
+
const translations = "translations" in options ? options.translations : options;
|
|
5
|
+
return {
|
|
6
|
+
...config,
|
|
7
|
+
provider(locale = config.defaultLanguage) {
|
|
8
|
+
return {
|
|
9
|
+
locale,
|
|
10
|
+
translations: translations[locale],
|
|
11
|
+
locales: config.languages.map((locale) => ({
|
|
12
|
+
locale,
|
|
13
|
+
name: translations[locale]?.displayName ?? locale
|
|
14
|
+
}))
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { defaultTranslations, defineI18nUI };
|