@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,7 +1,48 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { isActive, normalize } from "../../utils/urls.js";
|
|
2
|
+
import { LinkItem, baseSlots } from "./client.js";
|
|
3
|
+
import { useMemo } from "react";
|
|
2
4
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
|
|
5
|
+
import * as PageTree from "@hanzo/docs-core/page-tree";
|
|
4
6
|
//#region src/layouts/shared/index.tsx
|
|
7
|
+
const defaultTransform = (option, node) => {
|
|
8
|
+
if (!node.icon) return option;
|
|
9
|
+
return {
|
|
10
|
+
...option,
|
|
11
|
+
icon: /* @__PURE__ */ jsx("div", {
|
|
12
|
+
className: "size-full [&_svg]:size-full max-md:p-1.5 max-md:rounded-md max-md:border max-md:bg-fd-secondary",
|
|
13
|
+
children: node.icon
|
|
14
|
+
})
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
function getLayoutTabs(tree, { transform = defaultTransform } = {}) {
|
|
18
|
+
const results = [];
|
|
19
|
+
function next(node, unlisted) {
|
|
20
|
+
if ("root" in node && node.root) {
|
|
21
|
+
const url = node.index?.url ?? node.children.find((node) => node.type === "page")?.url;
|
|
22
|
+
if (url) {
|
|
23
|
+
const option = {
|
|
24
|
+
title: node.name,
|
|
25
|
+
icon: node.icon,
|
|
26
|
+
description: node.description,
|
|
27
|
+
url,
|
|
28
|
+
unlisted,
|
|
29
|
+
$folder: node
|
|
30
|
+
};
|
|
31
|
+
const mapped = transform ? transform(option, node) : option;
|
|
32
|
+
if (mapped) results.push(mapped);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
for (const child of node.children) if (child.type === "folder") next(child, unlisted);
|
|
36
|
+
}
|
|
37
|
+
next(tree);
|
|
38
|
+
if (tree.fallback) next(tree.fallback, true);
|
|
39
|
+
return results;
|
|
40
|
+
}
|
|
41
|
+
function isLayoutTabActive(tab, pathname) {
|
|
42
|
+
if (tab.$folder) return PageTree.findPath(tab.$folder.children, (node) => node.type === "page" && isActive(node.url, pathname)) !== null;
|
|
43
|
+
if (tab.urls) return tab.urls.has(normalize(pathname));
|
|
44
|
+
return isActive(tab.url, pathname, true);
|
|
45
|
+
}
|
|
5
46
|
/**
|
|
6
47
|
* Get link items with shortcuts
|
|
7
48
|
*/
|
|
@@ -22,18 +63,36 @@ function resolveLinkItems({ links = [], githubUrl }) {
|
|
|
22
63
|
});
|
|
23
64
|
return result;
|
|
24
65
|
}
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
66
|
+
function useLinkItems({ githubUrl, links }) {
|
|
67
|
+
return useMemo(() => {
|
|
68
|
+
const all = resolveLinkItems({
|
|
69
|
+
links,
|
|
70
|
+
githubUrl
|
|
71
|
+
});
|
|
72
|
+
const navItems = [];
|
|
73
|
+
const menuItems = [];
|
|
74
|
+
for (const item of all) switch (item.on) {
|
|
75
|
+
case "menu":
|
|
76
|
+
menuItems.push(item);
|
|
77
|
+
break;
|
|
78
|
+
case "nav":
|
|
79
|
+
navItems.push(item);
|
|
80
|
+
break;
|
|
81
|
+
default:
|
|
82
|
+
navItems.push(item);
|
|
83
|
+
menuItems.push(item);
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
navItems,
|
|
87
|
+
menuItems,
|
|
88
|
+
all
|
|
89
|
+
};
|
|
90
|
+
}, [links, githubUrl]);
|
|
91
|
+
}
|
|
92
|
+
function isLinkItemActive(link, pathname) {
|
|
93
|
+
if (link.type === "custom" || !link.url) return false;
|
|
94
|
+
if (link.active === "none") return false;
|
|
95
|
+
return isActive(link.url, pathname, link.active === "nested-url");
|
|
35
96
|
}
|
|
36
|
-
|
|
37
97
|
//#endregion
|
|
38
|
-
export {
|
|
39
|
-
//# sourceMappingURL=index.js.map
|
|
98
|
+
export { LinkItem, baseSlots, getLayoutTabs, isLayoutTabActive, isLinkItemActive, resolveLinkItems, useLinkItems };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { PopoverTrigger } from "../../components/ui/popover.js";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/layouts/shared/page-actions.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* see https://fumadocs.dev/docs/integrations/llms#page-actions to customise.
|
|
8
|
+
*/
|
|
9
|
+
declare function MarkdownCopyButton({
|
|
10
|
+
markdownUrl,
|
|
11
|
+
...props
|
|
12
|
+
}: ComponentProps<'button'> & {
|
|
13
|
+
/**
|
|
14
|
+
* A URL to fetch the raw Markdown/MDX content of page
|
|
15
|
+
*/
|
|
16
|
+
markdownUrl: string;
|
|
17
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* see https://fumadocs.dev/docs/integrations/llms#page-actions to customise.
|
|
20
|
+
*/
|
|
21
|
+
declare function ViewOptionsPopover({
|
|
22
|
+
markdownUrl,
|
|
23
|
+
githubUrl,
|
|
24
|
+
...props
|
|
25
|
+
}: ComponentProps<typeof PopoverTrigger> & {
|
|
26
|
+
/**
|
|
27
|
+
* A URL to the raw Markdown/MDX content of page
|
|
28
|
+
*/
|
|
29
|
+
markdownUrl?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Source file URL on GitHub
|
|
32
|
+
*/
|
|
33
|
+
githubUrl?: string;
|
|
34
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { MarkdownCopyButton, ViewOptionsPopover };
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { useCopyButton } from "../../utils/use-copy-button.js";
|
|
4
|
+
import { buttonVariants } from "../../components/ui/button.js";
|
|
5
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../../components/ui/popover.js";
|
|
6
|
+
import { useMemo, useState } from "react";
|
|
7
|
+
import { usePathname } from "@hanzo/docs-core/framework";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { Check, ChevronDown, Copy, ExternalLinkIcon, TextIcon } from "lucide-react";
|
|
10
|
+
//#region src/layouts/shared/page-actions.tsx
|
|
11
|
+
const cache = /* @__PURE__ */ new Map();
|
|
12
|
+
/**
|
|
13
|
+
* see https://fumadocs.dev/docs/integrations/llms#page-actions to customise.
|
|
14
|
+
*/
|
|
15
|
+
function MarkdownCopyButton({ markdownUrl, ...props }) {
|
|
16
|
+
const [isLoading, setLoading] = useState(false);
|
|
17
|
+
const [checked, onClick] = useCopyButton(async () => {
|
|
18
|
+
const cached = cache.get(markdownUrl);
|
|
19
|
+
if (cached) return navigator.clipboard.writeText(await cached);
|
|
20
|
+
setLoading(true);
|
|
21
|
+
try {
|
|
22
|
+
const promise = fetch(markdownUrl).then((res) => res.text());
|
|
23
|
+
cache.set(markdownUrl, promise);
|
|
24
|
+
await navigator.clipboard.write([new ClipboardItem({ "text/plain": promise })]);
|
|
25
|
+
} finally {
|
|
26
|
+
setLoading(false);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
30
|
+
disabled: isLoading,
|
|
31
|
+
onClick,
|
|
32
|
+
...props,
|
|
33
|
+
className: cn(buttonVariants({
|
|
34
|
+
color: "secondary",
|
|
35
|
+
size: "sm",
|
|
36
|
+
className: "gap-2 [&_svg]:size-3.5 [&_svg]:text-fd-muted-foreground"
|
|
37
|
+
}), props.className),
|
|
38
|
+
children: [checked ? /* @__PURE__ */ jsx(Check, {}) : /* @__PURE__ */ jsx(Copy, {}), props.children ?? "Copy Markdown"]
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* see https://fumadocs.dev/docs/integrations/llms#page-actions to customise.
|
|
43
|
+
*/
|
|
44
|
+
function ViewOptionsPopover({ markdownUrl, githubUrl, ...props }) {
|
|
45
|
+
const pathname = usePathname();
|
|
46
|
+
const items = useMemo(() => {
|
|
47
|
+
const q = `Read ${typeof window === "undefined" ? pathname : new URL(pathname, window.location.origin)}, I want to ask questions about it.`;
|
|
48
|
+
return [
|
|
49
|
+
githubUrl && {
|
|
50
|
+
title: "Open in GitHub",
|
|
51
|
+
href: githubUrl,
|
|
52
|
+
icon: /* @__PURE__ */ jsxs("svg", {
|
|
53
|
+
fill: "currentColor",
|
|
54
|
+
role: "img",
|
|
55
|
+
viewBox: "0 0 24 24",
|
|
56
|
+
children: [/* @__PURE__ */ jsx("title", { children: "GitHub" }), /* @__PURE__ */ jsx("path", { d: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" })]
|
|
57
|
+
})
|
|
58
|
+
},
|
|
59
|
+
markdownUrl && {
|
|
60
|
+
title: "View as Markdown",
|
|
61
|
+
href: markdownUrl,
|
|
62
|
+
icon: /* @__PURE__ */ jsx(TextIcon, {})
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
title: "Open in Scira AI",
|
|
66
|
+
href: `https://scira.ai/?${new URLSearchParams({ q })}`,
|
|
67
|
+
icon: /* @__PURE__ */ jsxs("svg", {
|
|
68
|
+
width: "910",
|
|
69
|
+
height: "934",
|
|
70
|
+
viewBox: "0 0 910 934",
|
|
71
|
+
fill: "none",
|
|
72
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsx("title", { children: "Scira AI" }),
|
|
75
|
+
/* @__PURE__ */ jsx("path", {
|
|
76
|
+
d: "M647.664 197.775C569.13 189.049 525.5 145.419 516.774 66.8849C508.048 145.419 464.418 189.049 385.884 197.775C464.418 206.501 508.048 250.131 516.774 328.665C525.5 250.131 569.13 206.501 647.664 197.775Z",
|
|
77
|
+
fill: "currentColor",
|
|
78
|
+
stroke: "currentColor",
|
|
79
|
+
strokeWidth: "8",
|
|
80
|
+
strokeLinejoin: "round"
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ jsx("path", {
|
|
83
|
+
d: "M516.774 304.217C510.299 275.491 498.208 252.087 480.335 234.214C462.462 216.341 439.058 204.251 410.333 197.775C439.059 191.3 462.462 179.209 480.335 161.336C498.208 143.463 510.299 120.06 516.774 91.334C523.25 120.059 535.34 143.463 553.213 161.336C571.086 179.209 594.49 191.3 623.216 197.775C594.49 204.251 571.086 216.341 553.213 234.214C535.34 252.087 523.25 275.491 516.774 304.217Z",
|
|
84
|
+
fill: "currentColor",
|
|
85
|
+
stroke: "currentColor",
|
|
86
|
+
strokeWidth: "8",
|
|
87
|
+
strokeLinejoin: "round"
|
|
88
|
+
}),
|
|
89
|
+
/* @__PURE__ */ jsx("path", {
|
|
90
|
+
d: "M857.5 508.116C763.259 497.644 710.903 445.288 700.432 351.047C689.961 445.288 637.605 497.644 543.364 508.116C637.605 518.587 689.961 570.943 700.432 665.184C710.903 570.943 763.259 518.587 857.5 508.116Z",
|
|
91
|
+
stroke: "currentColor",
|
|
92
|
+
strokeWidth: "20",
|
|
93
|
+
strokeLinejoin: "round"
|
|
94
|
+
}),
|
|
95
|
+
/* @__PURE__ */ jsx("path", {
|
|
96
|
+
d: "M700.432 615.957C691.848 589.05 678.575 566.357 660.383 548.165C642.191 529.973 619.499 516.7 592.593 508.116C619.499 499.533 642.191 486.258 660.383 468.066C678.575 449.874 691.848 427.181 700.432 400.274C709.015 427.181 722.289 449.874 740.481 468.066C758.673 486.258 781.365 499.533 808.271 508.116C781.365 516.7 758.673 529.973 740.481 548.165C722.289 566.357 709.015 589.05 700.432 615.957Z",
|
|
97
|
+
stroke: "currentColor",
|
|
98
|
+
strokeWidth: "20",
|
|
99
|
+
strokeLinejoin: "round"
|
|
100
|
+
}),
|
|
101
|
+
/* @__PURE__ */ jsx("path", {
|
|
102
|
+
d: "M889.949 121.237C831.049 114.692 798.326 81.9698 791.782 23.0692C785.237 81.9698 752.515 114.692 693.614 121.237C752.515 127.781 785.237 160.504 791.782 219.404C798.326 160.504 831.049 127.781 889.949 121.237Z",
|
|
103
|
+
fill: "currentColor",
|
|
104
|
+
stroke: "currentColor",
|
|
105
|
+
strokeWidth: "8",
|
|
106
|
+
strokeLinejoin: "round"
|
|
107
|
+
}),
|
|
108
|
+
/* @__PURE__ */ jsx("path", {
|
|
109
|
+
d: "M791.782 196.795C786.697 176.937 777.869 160.567 765.16 147.858C752.452 135.15 736.082 126.322 716.226 121.237C736.082 116.152 752.452 107.324 765.16 94.6152C777.869 81.9065 786.697 65.5368 791.782 45.6797C796.867 65.5367 805.695 81.9066 818.403 94.6152C831.112 107.324 847.481 116.152 867.338 121.237C847.481 126.322 831.112 135.15 818.403 147.858C805.694 160.567 796.867 176.937 791.782 196.795Z",
|
|
110
|
+
fill: "currentColor",
|
|
111
|
+
stroke: "currentColor",
|
|
112
|
+
strokeWidth: "8",
|
|
113
|
+
strokeLinejoin: "round"
|
|
114
|
+
}),
|
|
115
|
+
/* @__PURE__ */ jsx("path", {
|
|
116
|
+
d: "M760.632 764.337C720.719 814.616 669.835 855.1 611.872 882.692C553.91 910.285 490.404 924.255 426.213 923.533C362.022 922.812 298.846 907.419 241.518 878.531C184.19 849.643 134.228 808.026 95.4548 756.863C56.6815 705.7 30.1238 646.346 17.8129 583.343C5.50207 520.339 7.76433 455.354 24.4266 393.359C41.089 331.364 71.7099 274.001 113.947 225.658C156.184 177.315 208.919 139.273 268.117 114.442",
|
|
117
|
+
stroke: "currentColor",
|
|
118
|
+
strokeWidth: "30",
|
|
119
|
+
strokeLinecap: "round",
|
|
120
|
+
strokeLinejoin: "round"
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
})
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
title: "Open in ChatGPT",
|
|
127
|
+
href: `https://chatgpt.com/?${new URLSearchParams({
|
|
128
|
+
hints: "search",
|
|
129
|
+
q
|
|
130
|
+
})}`,
|
|
131
|
+
icon: /* @__PURE__ */ jsxs("svg", {
|
|
132
|
+
role: "img",
|
|
133
|
+
viewBox: "0 0 24 24",
|
|
134
|
+
fill: "currentColor",
|
|
135
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
136
|
+
children: [/* @__PURE__ */ jsx("title", { children: "OpenAI" }), /* @__PURE__ */ jsx("path", { d: "M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z" })]
|
|
137
|
+
})
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
title: "Open in Claude",
|
|
141
|
+
href: `https://claude.ai/new?${new URLSearchParams({ q })}`,
|
|
142
|
+
icon: /* @__PURE__ */ jsxs("svg", {
|
|
143
|
+
fill: "currentColor",
|
|
144
|
+
role: "img",
|
|
145
|
+
viewBox: "0 0 24 24",
|
|
146
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
147
|
+
children: [/* @__PURE__ */ jsx("title", { children: "Anthropic" }), /* @__PURE__ */ jsx("path", { d: "M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z" })]
|
|
148
|
+
})
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
title: "Open in Cursor",
|
|
152
|
+
icon: /* @__PURE__ */ jsxs("svg", {
|
|
153
|
+
fill: "currentColor",
|
|
154
|
+
role: "img",
|
|
155
|
+
viewBox: "0 0 24 24",
|
|
156
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
157
|
+
children: [/* @__PURE__ */ jsx("title", { children: "Cursor" }), /* @__PURE__ */ jsx("path", { d: "M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23" })]
|
|
158
|
+
}),
|
|
159
|
+
href: `https://cursor.com/link/prompt?${new URLSearchParams({ text: q })}`
|
|
160
|
+
}
|
|
161
|
+
].filter((v) => !!v);
|
|
162
|
+
}, [
|
|
163
|
+
githubUrl,
|
|
164
|
+
markdownUrl,
|
|
165
|
+
pathname
|
|
166
|
+
]);
|
|
167
|
+
return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsxs(PopoverTrigger, {
|
|
168
|
+
...props,
|
|
169
|
+
className: (state) => cn(buttonVariants({
|
|
170
|
+
color: "secondary",
|
|
171
|
+
size: "sm"
|
|
172
|
+
}), "gap-2 data-[state=open]:bg-fd-accent data-[state=open]:text-fd-accent-foreground", typeof props.className === "function" ? props.className(state) : props.className),
|
|
173
|
+
children: [props.children ?? "Open", /* @__PURE__ */ jsx(ChevronDown, { className: "size-3.5 text-fd-muted-foreground" })]
|
|
174
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
175
|
+
className: "flex flex-col",
|
|
176
|
+
children: items.map((item) => /* @__PURE__ */ jsxs("a", {
|
|
177
|
+
href: item.href,
|
|
178
|
+
rel: "noreferrer noopener",
|
|
179
|
+
target: "_blank",
|
|
180
|
+
className: "text-sm p-2 rounded-lg inline-flex items-center gap-2 hover:text-fd-accent-foreground hover:bg-fd-accent [&_svg]:size-4",
|
|
181
|
+
children: [
|
|
182
|
+
item.icon,
|
|
183
|
+
item.title,
|
|
184
|
+
/* @__PURE__ */ jsx(ExternalLinkIcon, { className: "text-fd-muted-foreground size-3.5 ms-auto" })
|
|
185
|
+
]
|
|
186
|
+
}, item.href))
|
|
187
|
+
})] });
|
|
188
|
+
}
|
|
189
|
+
//#endregion
|
|
190
|
+
export { MarkdownCopyButton, ViewOptionsPopover };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/layouts/shared/slots/language-select.d.ts
|
|
5
|
+
type LanguageSelectProps = ComponentProps<'button'>;
|
|
6
|
+
declare function LanguageSelect(props: LanguageSelectProps): React.ReactElement;
|
|
7
|
+
type LanguageSelectTextProps = ComponentProps<'span'>;
|
|
8
|
+
declare function LanguageSelectText(props: LanguageSelectTextProps): react_jsx_runtime0.JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { LanguageSelect, LanguageSelectProps, LanguageSelectText, LanguageSelectTextProps };
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { Popover, PopoverContent, PopoverTrigger } from "
|
|
6
|
-
import { cn } from "@hanzo/docs-ui/cn";
|
|
1
|
+
"use client";
|
|
2
|
+
import { useI18n } from "../../../contexts/i18n.js";
|
|
3
|
+
import { cn } from "../../../utils/cn.js";
|
|
4
|
+
import { buttonVariants } from "../../../components/ui/button.js";
|
|
5
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../../../components/ui/popover.js";
|
|
7
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const context = (0, i18n_exports.useI18n)();
|
|
7
|
+
//#region src/layouts/shared/slots/language-select.tsx
|
|
8
|
+
function LanguageSelect(props) {
|
|
9
|
+
const context = useI18n();
|
|
12
10
|
if (!context.locales) throw new Error("Missing `<I18nProvider />`");
|
|
13
11
|
return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
14
12
|
"aria-label": context.text.chooseLanguage,
|
|
@@ -33,15 +31,13 @@ function LanguageToggle(props) {
|
|
|
33
31
|
}, item.locale))]
|
|
34
32
|
})] });
|
|
35
33
|
}
|
|
36
|
-
function
|
|
37
|
-
const
|
|
38
|
-
const text =
|
|
34
|
+
function LanguageSelectText(props) {
|
|
35
|
+
const { locales, locale } = useI18n();
|
|
36
|
+
const text = locales?.find((item) => item.locale === locale)?.name;
|
|
39
37
|
return /* @__PURE__ */ jsx("span", {
|
|
40
38
|
...props,
|
|
41
39
|
children: text
|
|
42
40
|
});
|
|
43
41
|
}
|
|
44
|
-
|
|
45
42
|
//#endregion
|
|
46
|
-
export {
|
|
47
|
-
//# sourceMappingURL=language-toggle.js.map
|
|
43
|
+
export { LanguageSelect, LanguageSelectText };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ButtonProps } from "../../../components/ui/button.js";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/layouts/shared/slots/search-trigger.d.ts
|
|
6
|
+
interface SearchTriggerProps extends Omit<ComponentProps<'button'>, 'color'>, ButtonProps {
|
|
7
|
+
hideIfDisabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare function SearchTrigger({
|
|
10
|
+
hideIfDisabled,
|
|
11
|
+
size,
|
|
12
|
+
color,
|
|
13
|
+
...props
|
|
14
|
+
}: SearchTriggerProps): react_jsx_runtime0.JSX.Element | null;
|
|
15
|
+
interface FullSearchTriggerProps extends ComponentProps<'button'> {
|
|
16
|
+
hideIfDisabled?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare function FullSearchTrigger({
|
|
19
|
+
hideIfDisabled,
|
|
20
|
+
...props
|
|
21
|
+
}: FullSearchTriggerProps): react_jsx_runtime0.JSX.Element | null;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { FullSearchTrigger, FullSearchTriggerProps, SearchTrigger, SearchTriggerProps };
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { cn } from "@hanzo/docs-ui/cn";
|
|
1
|
+
"use client";
|
|
2
|
+
import { useI18n } from "../../../contexts/i18n.js";
|
|
3
|
+
import { cn } from "../../../utils/cn.js";
|
|
4
|
+
import { buttonVariants } from "../../../components/ui/button.js";
|
|
5
|
+
import { useSearchContext } from "../../../contexts/search.js";
|
|
7
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
7
|
import { Search } from "lucide-react";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const { setOpenSearch, enabled } = (0, search_exports.useSearchContext)();
|
|
8
|
+
//#region src/layouts/shared/slots/search-trigger.tsx
|
|
9
|
+
function SearchTrigger({ hideIfDisabled, size = "icon-sm", color = "ghost", ...props }) {
|
|
10
|
+
const { setOpenSearch, enabled } = useSearchContext();
|
|
13
11
|
if (hideIfDisabled && !enabled) return null;
|
|
14
12
|
return /* @__PURE__ */ jsx("button", {
|
|
15
13
|
type: "button",
|
|
@@ -25,9 +23,9 @@ function SearchToggle({ hideIfDisabled, size = "icon-sm", color = "ghost", ...pr
|
|
|
25
23
|
children: /* @__PURE__ */ jsx(Search, {})
|
|
26
24
|
});
|
|
27
25
|
}
|
|
28
|
-
function
|
|
29
|
-
const { enabled, hotKey, setOpenSearch } =
|
|
30
|
-
const { text } =
|
|
26
|
+
function FullSearchTrigger({ hideIfDisabled, ...props }) {
|
|
27
|
+
const { enabled, hotKey, setOpenSearch } = useSearchContext();
|
|
28
|
+
const { text } = useI18n();
|
|
31
29
|
if (hideIfDisabled && !enabled) return null;
|
|
32
30
|
return /* @__PURE__ */ jsxs("button", {
|
|
33
31
|
type: "button",
|
|
@@ -50,7 +48,5 @@ function LargeSearchToggle({ hideIfDisabled, ...props }) {
|
|
|
50
48
|
]
|
|
51
49
|
});
|
|
52
50
|
}
|
|
53
|
-
|
|
54
51
|
//#endregion
|
|
55
|
-
export {
|
|
56
|
-
//# sourceMappingURL=search-toggle.js.map
|
|
52
|
+
export { FullSearchTrigger, SearchTrigger };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/layouts/shared/slots/theme-switch.d.ts
|
|
5
|
+
interface ThemeSwitchProps extends ComponentProps<'div'> {
|
|
6
|
+
mode?: 'light-dark' | 'light-dark-system';
|
|
7
|
+
}
|
|
8
|
+
declare function ThemeSwitch({
|
|
9
|
+
className,
|
|
10
|
+
mode,
|
|
11
|
+
...props
|
|
12
|
+
}: ThemeSwitchProps): react_jsx_runtime0.JSX.Element;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { ThemeSwitch, ThemeSwitchProps };
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { Airplay, Moon, Sun } from "lucide-react";
|
|
6
|
-
import { useEffect, useState } from "react";
|
|
7
6
|
import { cva } from "class-variance-authority";
|
|
8
7
|
import { useTheme } from "next-themes";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const itemVariants = cva("size-6.5 rounded-full p-1.5 text-fd-muted-foreground", { variants: { active: {
|
|
8
|
+
//#region src/layouts/shared/slots/theme-switch.tsx
|
|
9
|
+
const itemVariants = cva("size-6.5 p-1.5 text-fd-muted-foreground", { variants: { active: {
|
|
12
10
|
true: "bg-fd-accent text-fd-accent-foreground",
|
|
13
11
|
false: "text-fd-muted-foreground"
|
|
14
12
|
} } });
|
|
@@ -17,25 +15,25 @@ const full = [
|
|
|
17
15
|
["dark", Moon],
|
|
18
16
|
["system", Airplay]
|
|
19
17
|
];
|
|
20
|
-
function
|
|
18
|
+
function ThemeSwitch({ className, mode = "light-dark", ...props }) {
|
|
21
19
|
const { setTheme, theme, resolvedTheme } = useTheme();
|
|
22
20
|
const [mounted, setMounted] = useState(false);
|
|
23
21
|
useEffect(() => {
|
|
24
22
|
setMounted(true);
|
|
25
23
|
}, []);
|
|
26
|
-
const container = cn("inline-flex items-center rounded-full border p-1", className);
|
|
24
|
+
const container = cn("inline-flex items-center rounded-full border p-1 *:rounded-full", className);
|
|
27
25
|
if (mode === "light-dark") {
|
|
28
|
-
const value
|
|
26
|
+
const value = mounted ? resolvedTheme : null;
|
|
29
27
|
return /* @__PURE__ */ jsx("button", {
|
|
30
28
|
className: container,
|
|
31
29
|
"aria-label": `Toggle Theme`,
|
|
32
|
-
onClick: () => setTheme(value
|
|
30
|
+
onClick: () => setTheme(value === "light" ? "dark" : "light"),
|
|
33
31
|
"data-theme-toggle": "",
|
|
34
32
|
children: full.map(([key, Icon]) => {
|
|
35
33
|
if (key === "system") return;
|
|
36
34
|
return /* @__PURE__ */ jsx(Icon, {
|
|
37
35
|
fill: "currentColor",
|
|
38
|
-
className: cn(itemVariants({ active: value
|
|
36
|
+
className: cn(itemVariants({ active: value === key }))
|
|
39
37
|
}, key);
|
|
40
38
|
})
|
|
41
39
|
});
|
|
@@ -56,7 +54,5 @@ function ThemeToggle({ className, mode = "light-dark", ...props }) {
|
|
|
56
54
|
}, key))
|
|
57
55
|
});
|
|
58
56
|
}
|
|
59
|
-
|
|
60
57
|
//#endregion
|
|
61
|
-
export {
|
|
62
|
-
//# sourceMappingURL=theme-toggle.js.map
|
|
58
|
+
export { ThemeSwitch };
|
package/dist/mdx.d.ts
CHANGED
|
@@ -2,30 +2,41 @@ import { Callout, CalloutContainer, CalloutDescription, CalloutTitle } from "./c
|
|
|
2
2
|
import { Card, Cards } from "./components/card.js";
|
|
3
3
|
import { CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger } from "./components/codeblock.js";
|
|
4
4
|
import { createRelativeLink as createRelativeLink$1 } from "./mdx.server.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import React, { AnchorHTMLAttributes, FC, HTMLAttributes, ImgHTMLAttributes, TableHTMLAttributes } from "react";
|
|
6
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
7
7
|
|
|
8
8
|
//#region src/mdx.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* global types for MDX.js
|
|
11
|
+
*/
|
|
12
|
+
declare module 'mdx/types.js' {
|
|
13
|
+
namespace JSX {
|
|
14
|
+
type Element = React.JSX.Element;
|
|
15
|
+
type ElementClass = React.JSX.ElementClass;
|
|
16
|
+
type ElementType = React.JSX.ElementType;
|
|
17
|
+
type IntrinsicElements = React.JSX.IntrinsicElements;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
9
20
|
declare function Image(props: ImgHTMLAttributes<HTMLImageElement> & {
|
|
10
21
|
sizes?: string;
|
|
11
|
-
}):
|
|
12
|
-
declare function Table(props: TableHTMLAttributes<HTMLTableElement>):
|
|
22
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
23
|
+
declare function Table(props: TableHTMLAttributes<HTMLTableElement>): react_jsx_runtime0.JSX.Element;
|
|
13
24
|
declare const defaultMdxComponents: {
|
|
14
25
|
CodeBlockTab: typeof CodeBlockTab;
|
|
15
26
|
CodeBlockTabs: typeof CodeBlockTabs;
|
|
16
27
|
CodeBlockTabsList: typeof CodeBlockTabsList;
|
|
17
28
|
CodeBlockTabsTrigger: typeof CodeBlockTabsTrigger;
|
|
18
|
-
pre: (props: HTMLAttributes<HTMLPreElement>) =>
|
|
29
|
+
pre: (props: HTMLAttributes<HTMLPreElement>) => react_jsx_runtime0.JSX.Element;
|
|
19
30
|
Card: typeof Card;
|
|
20
31
|
Cards: typeof Cards;
|
|
21
32
|
a: FC<AnchorHTMLAttributes<HTMLAnchorElement>>;
|
|
22
33
|
img: typeof Image;
|
|
23
|
-
h1: (props: HTMLAttributes<HTMLHeadingElement>) =>
|
|
24
|
-
h2: (props: HTMLAttributes<HTMLHeadingElement>) =>
|
|
25
|
-
h3: (props: HTMLAttributes<HTMLHeadingElement>) =>
|
|
26
|
-
h4: (props: HTMLAttributes<HTMLHeadingElement>) =>
|
|
27
|
-
h5: (props: HTMLAttributes<HTMLHeadingElement>) =>
|
|
28
|
-
h6: (props: HTMLAttributes<HTMLHeadingElement>) =>
|
|
34
|
+
h1: (props: HTMLAttributes<HTMLHeadingElement>) => react_jsx_runtime0.JSX.Element;
|
|
35
|
+
h2: (props: HTMLAttributes<HTMLHeadingElement>) => react_jsx_runtime0.JSX.Element;
|
|
36
|
+
h3: (props: HTMLAttributes<HTMLHeadingElement>) => react_jsx_runtime0.JSX.Element;
|
|
37
|
+
h4: (props: HTMLAttributes<HTMLHeadingElement>) => react_jsx_runtime0.JSX.Element;
|
|
38
|
+
h5: (props: HTMLAttributes<HTMLHeadingElement>) => react_jsx_runtime0.JSX.Element;
|
|
39
|
+
h6: (props: HTMLAttributes<HTMLHeadingElement>) => react_jsx_runtime0.JSX.Element;
|
|
29
40
|
table: typeof Table;
|
|
30
41
|
Callout: typeof Callout;
|
|
31
42
|
CalloutContainer: typeof CalloutContainer;
|
|
@@ -34,5 +45,4 @@ declare const defaultMdxComponents: {
|
|
|
34
45
|
};
|
|
35
46
|
declare const createRelativeLink: typeof createRelativeLink$1;
|
|
36
47
|
//#endregion
|
|
37
|
-
export { createRelativeLink, defaultMdxComponents as default };
|
|
38
|
-
//# sourceMappingURL=mdx.d.ts.map
|
|
48
|
+
export { createRelativeLink, defaultMdxComponents as default };
|
package/dist/mdx.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
+
import { cn } from "./utils/cn.js";
|
|
1
2
|
import { Card, Cards } from "./components/card.js";
|
|
2
3
|
import { Callout, CalloutContainer, CalloutDescription, CalloutTitle } from "./components/callout.js";
|
|
3
4
|
import { Heading } from "./components/heading.js";
|
|
4
5
|
import { CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, Pre } from "./components/codeblock.js";
|
|
5
|
-
import Link from "@hanzo/docs-core/link";
|
|
6
6
|
import { Image } from "@hanzo/docs-core/framework";
|
|
7
|
-
import { cn } from "@hanzo/docs-ui/cn";
|
|
8
7
|
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
|
|
8
|
+
import Link from "@hanzo/docs-core/link";
|
|
10
9
|
//#region src/mdx.tsx
|
|
11
10
|
function Image$1(props) {
|
|
12
11
|
return /* @__PURE__ */ jsx(Image, {
|
|
13
12
|
sizes: "(max-width: 768px) 100vw, (max-width: 1200px) 70vw, 900px",
|
|
14
13
|
...props,
|
|
15
|
-
src: props.src,
|
|
16
14
|
className: cn("rounded-lg", props.className)
|
|
17
15
|
});
|
|
18
16
|
}
|
|
@@ -68,7 +66,5 @@ const defaultMdxComponents = {
|
|
|
68
66
|
const createRelativeLink = () => {
|
|
69
67
|
throw new Error("`createRelativeLink` is only supported in Node.js environment");
|
|
70
68
|
};
|
|
71
|
-
|
|
72
69
|
//#endregion
|
|
73
70
|
export { createRelativeLink, defaultMdxComponents as default };
|
|
74
|
-
//# sourceMappingURL=mdx.js.map
|
package/dist/mdx.server.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { ComponentProps, FC } from "react";
|
|
|
3
3
|
import { LoaderConfig, LoaderOutput, Page } from "@hanzo/docs-core/source";
|
|
4
4
|
|
|
5
5
|
//#region src/mdx.server.d.ts
|
|
6
|
-
|
|
7
6
|
/**
|
|
8
7
|
* Extend the default Link component to resolve relative file paths in `href`.
|
|
9
8
|
*
|
|
@@ -13,5 +12,4 @@ import { LoaderConfig, LoaderOutput, Page } from "@hanzo/docs-core/source";
|
|
|
13
12
|
*/
|
|
14
13
|
declare function createRelativeLink<C extends LoaderConfig>(source: LoaderOutput<C>, page: Page, OverrideLink?: FC<ComponentProps<'a'>>): FC<ComponentProps<'a'>>;
|
|
15
14
|
//#endregion
|
|
16
|
-
export { createRelativeLink, defaultMdxComponents as default };
|
|
17
|
-
//# sourceMappingURL=mdx.server.d.ts.map
|
|
15
|
+
export { createRelativeLink, defaultMdxComponents as default };
|
package/dist/mdx.server.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import defaultMdxComponents from "./mdx.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
|
|
4
3
|
//#region src/mdx.server.tsx
|
|
5
4
|
/**
|
|
6
5
|
* Extend the default Link component to resolve relative file paths in `href`.
|
|
@@ -17,7 +16,5 @@ function createRelativeLink(source, page, OverrideLink = defaultMdxComponents.a)
|
|
|
17
16
|
});
|
|
18
17
|
};
|
|
19
18
|
}
|
|
20
|
-
|
|
21
19
|
//#endregion
|
|
22
20
|
export { createRelativeLink, defaultMdxComponents as default };
|
|
23
|
-
//# sourceMappingURL=mdx.server.js.map
|