@nikala-ui/folio 0.13.2 → 0.15.0
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 +16 -0
- package/dist/cli/commands/init.js +37 -2
- package/dist/client/app.jsx +6 -3
- package/dist/client/components/docs-layout-shell.d.ts +1 -0
- package/dist/client/components/docs-layout-shell.jsx +1 -1
- package/dist/client/components/docs-page-content.jsx +9 -5
- package/dist/client/navigation/page-navigation.js +10 -27
- package/dist/client/public/algolia-logo.svg +15 -0
- package/dist/client/public/favicon.ico +0 -0
- package/dist/client/public/logo.svg +11 -0
- package/dist/client/routing/use-docs-router.d.ts +1 -0
- package/dist/client/routing/use-docs-router.js +12 -3
- package/dist/client/style.css +139 -55
- package/dist/components/mdx-components.jsx +4 -1
- package/dist/components/ui/api-table.jsx +6 -4
- package/dist/components/ui/code-block.jsx +6 -4
- package/dist/components/ui/command.jsx +9 -5
- package/dist/components/ui/list.jsx +3 -1
- package/dist/components/ui/logo.d.ts +4 -1
- package/dist/components/ui/logo.jsx +8 -22
- package/dist/components/ui/package-manager-tabs.jsx +12 -2
- package/dist/components/ui/pager.jsx +4 -2
- package/dist/components/ui/section-heading.jsx +1 -1
- package/dist/components/ui/sidebar.jsx +6 -3
- package/dist/components/ui/spinner.jsx +3 -1
- package/dist/components/ui/theme-toggle.jsx +14 -12
- package/dist/config.d.ts +1 -0
- package/dist/config.js +84 -29
- package/dist/core/content-scanner.d.ts +2 -1
- package/dist/core/content-scanner.js +2 -9
- package/dist/core/plugin/index.d.ts +2 -0
- package/dist/core/plugin/index.js +1 -0
- package/dist/core/plugin/lifecycle-error.d.ts +19 -0
- package/dist/core/plugin/lifecycle-error.js +28 -0
- package/dist/core/plugin/lifecycle-snapshot.d.ts +1 -0
- package/dist/core/plugin/lifecycle-snapshot.js +156 -0
- package/dist/core/plugin/lifecycle.d.ts +34 -0
- package/dist/core/plugin/lifecycle.js +170 -0
- package/dist/core/route-tree.d.ts +3 -2
- package/dist/core/route-tree.js +40 -10
- package/dist/index.d.ts +7 -3
- package/dist/index.js +4 -3
- package/dist/plugin.d.ts +60 -0
- package/dist/plugin.js +51 -0
- package/dist/plugins/i18n/components/site-language-switcher.d.ts +10 -0
- package/dist/plugins/i18n/components/site-language-switcher.jsx +39 -0
- package/dist/plugins/i18n/constants.d.ts +1 -0
- package/dist/plugins/i18n/constants.js +1 -0
- package/dist/plugins/i18n/index.d.ts +11 -0
- package/dist/plugins/i18n/index.js +89 -0
- package/dist/plugins/i18n/navigation.d.ts +5 -0
- package/dist/plugins/i18n/navigation.js +33 -0
- package/dist/plugins/i18n/runtime.d.ts +19 -0
- package/dist/plugins/i18n/runtime.jsx +65 -0
- package/dist/plugins/i18n/site-locale.d.ts +12 -0
- package/dist/plugins/i18n/site-locale.js +119 -0
- package/dist/search/provider.d.ts +16 -4
- package/dist/search/provider.js +28 -3
- package/dist/server/index.d.ts +4 -1
- package/dist/server/index.js +73 -33
- package/dist/server/module-serialization.d.ts +6 -0
- package/dist/server/module-serialization.js +26 -0
- package/dist/server/plugin/components.d.ts +7 -0
- package/dist/server/plugin/components.js +82 -0
- package/dist/server/plugin/constants.d.ts +17 -0
- package/dist/server/plugin/constants.js +21 -0
- package/dist/server/{plugin.d.ts → plugin/index.d.ts} +3 -1
- package/dist/server/plugin/index.js +166 -0
- package/dist/server/plugin/lifecycle.d.ts +32 -0
- package/dist/server/plugin/lifecycle.js +110 -0
- package/dist/server/plugin/styles.d.ts +3 -0
- package/dist/server/plugin/styles.js +22 -0
- package/dist/server/plugin/virtual-modules.d.ts +11 -0
- package/dist/server/plugin/virtual-modules.js +88 -0
- package/dist/server/seo.d.ts +4 -0
- package/dist/server/seo.js +87 -0
- package/dist/themes/default/content/breadcrumbs.jsx +5 -2
- package/dist/themes/default/content/table-of-contents.jsx +3 -1
- package/dist/themes/default/layout.jsx +42 -14
- package/dist/themes/default/navbar.jsx +14 -7
- package/dist/themes/default/navigation/mobile-table-of-contents.jsx +3 -1
- package/dist/themes/default/navigation/sidebar-tree.d.ts +2 -0
- package/dist/themes/default/navigation/sidebar-tree.jsx +11 -2
- package/dist/themes/default/overlays/search-dialog.jsx +37 -11
- package/dist/themes/default/sidebar.jsx +7 -5
- package/dist/themes/types.d.ts +7 -2
- package/dist/types.d.ts +38 -1
- package/dist/utils/format-title.d.ts +1 -0
- package/dist/utils/format-title.js +11 -0
- package/dist/vendor/docs-src/components/mdx-components.tsx +4 -1
- package/dist/vendor/docs-src/components/ui/api-table.tsx +6 -4
- package/dist/vendor/docs-src/components/ui/code-block.tsx +6 -4
- package/dist/vendor/docs-src/components/ui/command.tsx +9 -5
- package/dist/vendor/docs-src/components/ui/list.tsx +4 -2
- package/dist/vendor/docs-src/components/ui/logo.tsx +19 -48
- package/dist/vendor/docs-src/components/ui/package-manager-tabs.tsx +12 -2
- package/dist/vendor/docs-src/components/ui/pager.tsx +4 -2
- package/dist/vendor/docs-src/components/ui/section-heading.tsx +5 -1
- package/dist/vendor/docs-src/components/ui/sidebar.tsx +7 -4
- package/dist/vendor/docs-src/components/ui/spinner.tsx +3 -1
- package/dist/vendor/docs-src/components/ui/theme-toggle.tsx +15 -13
- package/dist/vendor/docs-src/plugins/i18n/components/site-language-switcher.tsx +56 -0
- package/dist/vendor/docs-src/plugins/i18n/constants.ts +1 -0
- package/dist/vendor/docs-src/plugins/i18n/index.ts +110 -0
- package/dist/vendor/docs-src/plugins/i18n/navigation.ts +49 -0
- package/dist/vendor/docs-src/plugins/i18n/runtime.tsx +91 -0
- package/dist/vendor/docs-src/plugins/i18n/site-locale.ts +140 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +19 -4
- package/dist/server/plugin.js +0 -521
|
@@ -16,10 +16,19 @@ import { useSidebar } from "@/components/ui/sidebar";
|
|
|
16
16
|
import { Button } from "@/components/ui/button";
|
|
17
17
|
import { cn } from "@/lib/cn";
|
|
18
18
|
import { ChevronRight, Folder } from "lucide-solid";
|
|
19
|
+
import { localizeSidebarTree } from "../../../plugins/i18n/navigation.js";
|
|
20
|
+
import { useSiteLocale } from "../../../plugins/i18n/runtime.jsx";
|
|
19
21
|
import { resolveDefaultIcon } from "../icons.js";
|
|
20
22
|
import { containsActiveSidebarItem, containsNewSidebarItem, isSidebarItemActive, isSidebarItemNew, } from "../../../navigation/sidebar-state.js";
|
|
21
23
|
export const SidebarTree = (props) => {
|
|
22
24
|
const sidebar = useSidebar();
|
|
25
|
+
const siteLocale = useSiteLocale();
|
|
26
|
+
const activeLocale = () => {
|
|
27
|
+
const currentPage = props.pages?.find((page) => page.url === props.currentUrl);
|
|
28
|
+
const pageLocale = currentPage?.frontmatter.locale;
|
|
29
|
+
return typeof pageLocale === "string" ? pageLocale : siteLocale.locale();
|
|
30
|
+
};
|
|
31
|
+
const localizedTree = () => localizeSidebarTree(props.tree, props.pages || [], activeLocale());
|
|
23
32
|
const renderCategoryIcon = (name) => (<Show when={renderIcon(name, "size-4 shrink-0")} fallback={<Folder class="size-4 shrink-0"/>}>
|
|
24
33
|
{renderIcon(name, "size-4 shrink-0")}
|
|
25
34
|
</Show>);
|
|
@@ -117,7 +126,7 @@ export const SidebarTree = (props) => {
|
|
|
117
126
|
</SidebarGroupContent>
|
|
118
127
|
</SidebarGroup>);
|
|
119
128
|
return (<>
|
|
120
|
-
<For each={
|
|
121
|
-
<For each={
|
|
129
|
+
<For each={localizedTree().filter((item) => !item.items)}>{(item) => renderRootPage(item)}</For>
|
|
130
|
+
<For each={localizedTree().filter((item) => Boolean(item.items))}>{(group) => renderCategory(group)}</For>
|
|
122
131
|
</>);
|
|
123
132
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// packages/docs/src/themes/default/overlays/search-dialog.tsx
|
|
2
|
-
import { For, Show } from "solid-js";
|
|
2
|
+
import { createEffect, createSignal, For, Show } from "solid-js";
|
|
3
3
|
import { CommandDialog } from "@/components/ui/command";
|
|
4
4
|
import { CommandInput } from "@/components/ui/command";
|
|
5
5
|
import { CommandList } from "@/components/ui/command";
|
|
@@ -7,7 +7,11 @@ import { CommandEmpty } from "@/components/ui/command";
|
|
|
7
7
|
import { CommandGroup } from "@/components/ui/command";
|
|
8
8
|
import { CommandItem } from "@/components/ui/command";
|
|
9
9
|
import { FileText } from "lucide-solid";
|
|
10
|
+
import { resolveSearchProvider, searchPages } from "../../../search/provider.js";
|
|
11
|
+
import { useSiteLocale } from "../../../plugins/i18n/runtime.jsx";
|
|
10
12
|
export const DocsSearchDialog = (props) => {
|
|
13
|
+
const siteLocale = useSiteLocale();
|
|
14
|
+
const showAlgoliaAttribution = () => typeof props.provider !== "string" && props.provider?.name === "algolia";
|
|
11
15
|
const handleOpenChange = (open) => {
|
|
12
16
|
props.onOpenChange(open);
|
|
13
17
|
};
|
|
@@ -25,26 +29,48 @@ export const DocsSearchDialog = (props) => {
|
|
|
25
29
|
window.requestAnimationFrame(() => {
|
|
26
30
|
document.querySelector("#docs-search-input")?.focus();
|
|
27
31
|
});
|
|
28
|
-
}} enableHotkey={
|
|
32
|
+
}} enableHotkey={props.provider !== undefined}>
|
|
29
33
|
{({ search }) => {
|
|
30
|
-
const query = () => search().trim()
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
const query = () => search().trim();
|
|
35
|
+
const resolvedProvider = () => resolveSearchProvider({ provider: props.provider });
|
|
36
|
+
const [filteredPages, setFilteredPages] = createSignal(props.pages || []);
|
|
37
|
+
const [searching, setSearching] = createSignal(false);
|
|
38
|
+
let requestId = 0;
|
|
39
|
+
createEffect(() => {
|
|
40
|
+
const currentRequest = ++requestId;
|
|
41
|
+
setSearching(true);
|
|
42
|
+
Promise.resolve(searchPages(resolvedProvider(), query(), props.pages || []))
|
|
43
|
+
.then((results) => {
|
|
44
|
+
if (currentRequest === requestId)
|
|
45
|
+
setFilteredPages(results);
|
|
46
|
+
})
|
|
47
|
+
.finally(() => {
|
|
48
|
+
if (currentRequest === requestId)
|
|
49
|
+
setSearching(false);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
34
52
|
return (<>
|
|
35
|
-
<CommandInput id="docs-search-input" placeholder="
|
|
53
|
+
<CommandInput id="docs-search-input" placeholder={siteLocale.t("search.placeholder")}/>
|
|
36
54
|
<CommandList>
|
|
37
|
-
<Show when={query().length > 0 && filteredPages().length === 0}>
|
|
38
|
-
<CommandEmpty>
|
|
55
|
+
<Show when={!searching() && query().length > 0 && filteredPages().length === 0}>
|
|
56
|
+
<CommandEmpty>{siteLocale.t("search.empty")}</CommandEmpty>
|
|
39
57
|
</Show>
|
|
40
|
-
<Show when={filteredPages().length > 0}>
|
|
41
|
-
<CommandGroup heading="
|
|
58
|
+
<Show when={!searching() && filteredPages().length > 0}>
|
|
59
|
+
<CommandGroup heading={siteLocale.t("search.pages")}>
|
|
42
60
|
<For each={filteredPages()}>
|
|
43
61
|
{(page) => (<CommandItem title={page.title} subtitle={page.url} description={page.description} icon={FileText} shouldFilter={false} onSelect={() => handleSelect(page.url)}/>)}
|
|
44
62
|
</For>
|
|
45
63
|
</CommandGroup>
|
|
46
64
|
</Show>
|
|
47
65
|
</CommandList>
|
|
66
|
+
<Show when={showAlgoliaAttribution()}>
|
|
67
|
+
<div class="flex items-center justify-end border-t border-border px-3 py-2">
|
|
68
|
+
<a href="https://www.algolia.com" target="_blank" rel="noreferrer" class="inline-flex items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground" aria-label={`${siteLocale.t("search.by")} Algolia`}>
|
|
69
|
+
<span>{siteLocale.t("search.by")}</span>
|
|
70
|
+
<img src="/algolia-logo.svg" alt="Algolia" class="h-4 w-auto object-contain"/>
|
|
71
|
+
</a>
|
|
72
|
+
</div>
|
|
73
|
+
</Show>
|
|
48
74
|
</>);
|
|
49
75
|
}}
|
|
50
76
|
</CommandDialog>);
|
|
@@ -12,9 +12,11 @@ import { createFocusTrap } from "@/hooks/create-focus-trap";
|
|
|
12
12
|
import { createLockScroll } from "@/hooks/create-lock-scroll";
|
|
13
13
|
import { cn } from "@/lib/cn";
|
|
14
14
|
import { SidebarTree } from "./navigation/sidebar-tree.jsx";
|
|
15
|
+
import { useSiteLocale } from "../../plugins/i18n/runtime.jsx";
|
|
15
16
|
export const DocsSidebar = (props) => {
|
|
16
|
-
const [local, rest] = splitProps(props, ["tree", "nav", "currentUrl", "title", "logo", "headerSubtitle", "footerText", "showHeader", "showFooter", "class"]);
|
|
17
|
+
const [local, rest] = splitProps(props, ["tree", "pages", "nav", "currentUrl", "title", "logo", "headerSubtitle", "footerText", "showHeader", "showFooter", "class"]);
|
|
17
18
|
const brandText = () => local.logo?.text || local.title || "Folio";
|
|
19
|
+
const siteLocale = useSiteLocale();
|
|
18
20
|
const sidebar = useSidebar();
|
|
19
21
|
const [sidebarElement, setSidebarElement] = createSignal();
|
|
20
22
|
createFocusTrap(sidebarElement, {
|
|
@@ -37,7 +39,7 @@ export const DocsSidebar = (props) => {
|
|
|
37
39
|
});
|
|
38
40
|
return (<>
|
|
39
41
|
<Show when={sidebar.isMobile() && sidebar.openMobile()}>
|
|
40
|
-
<button type="button" aria-label="
|
|
42
|
+
<button type="button" aria-label={siteLocale.t("navigation.closeSidebar")} class="fixed inset-0 z-40 cursor-default bg-black/50 md:hidden" onClick={() => sidebar.setOpenMobile(false)}/>
|
|
41
43
|
</Show>
|
|
42
44
|
<Show when={!sidebar.isMobile() || sidebar.openMobile()}>
|
|
43
45
|
<div class={cn("w-0 md:shrink-0", sidebar.open() ? "md:w-[var(--sidebar-width)]" : "md:w-[var(--sidebar-width-icon)]")}>
|
|
@@ -46,7 +48,7 @@ export const DocsSidebar = (props) => {
|
|
|
46
48
|
<SidebarHeader class="h-14 box-border p-3 group-data-[collapsible=icon]:p-2">
|
|
47
49
|
<a href={local.logo?.href || "/"} data-sidebar="menu-button" class={cn(sidebarMenuButtonVariants({ variant: "default", size: "default" }), "h-8 w-full justify-between group-data-[collapsible=icon]:h-10")}>
|
|
48
50
|
<div class="flex items-center gap-2.5 overflow-hidden">
|
|
49
|
-
<Show when={local.logo?.image} fallback={<Logo class="
|
|
51
|
+
<Show when={local.logo?.image} fallback={<Logo class="h-7 w-auto"/>}>
|
|
50
52
|
{(image) => <img src={image()} alt={brandText()} class="size-7 shrink-0 rounded-md object-contain"/>}
|
|
51
53
|
</Show>
|
|
52
54
|
<div class="flex min-w-0 flex-col gap-0.5 leading-none group-data-[collapsible=icon]:hidden">
|
|
@@ -60,7 +62,7 @@ export const DocsSidebar = (props) => {
|
|
|
60
62
|
|
|
61
63
|
<SidebarContent class="h-full overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden">
|
|
62
64
|
<Show when={local.nav?.length}>
|
|
63
|
-
<nav aria-label="
|
|
65
|
+
<nav aria-label={siteLocale.t("navigation.primary")} class="border-b border-border/60 px-2 py-2 md:hidden">
|
|
64
66
|
<For each={local.nav}>
|
|
65
67
|
{(item) => (<a href={item.href} target={item.external ? "_blank" : undefined} rel={item.external ? "noreferrer" : undefined} onClick={() => sidebar.setOpenMobile(false)} class={cn(sidebarMenuButtonVariants({ variant: "default", size: "default" }), "w-full justify-start text-sm font-normal")}>
|
|
66
68
|
{item.title}
|
|
@@ -68,7 +70,7 @@ export const DocsSidebar = (props) => {
|
|
|
68
70
|
</For>
|
|
69
71
|
</nav>
|
|
70
72
|
</Show>
|
|
71
|
-
<SidebarTree tree={local.tree} currentUrl={local.currentUrl}/>
|
|
73
|
+
<SidebarTree tree={local.tree} pages={local.pages} currentUrl={local.currentUrl}/>
|
|
72
74
|
</SidebarContent>
|
|
73
75
|
|
|
74
76
|
<Show when={local.showFooter !== false}>
|
package/dist/themes/types.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import type { Component, JSX, ParentComponent } from "solid-js";
|
|
2
2
|
import type { DocsConfig, NavItem, PageData, TocItem, SidebarItem } from "../types.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { SearchAdapter } from "../search/provider.js";
|
|
4
4
|
export type BreadcrumbItemData = {
|
|
5
5
|
title: string;
|
|
6
6
|
href?: string;
|
|
7
7
|
};
|
|
8
8
|
export interface DocsNavbarProps {
|
|
9
9
|
config: DocsConfig;
|
|
10
|
+
currentPage?: PageData;
|
|
11
|
+
pages?: readonly PageData[];
|
|
12
|
+
onNavigate?: (url: string) => void;
|
|
10
13
|
onOpenSearch?: () => void;
|
|
11
14
|
showBrand?: boolean;
|
|
12
15
|
showSidebarTrigger?: boolean;
|
|
@@ -15,6 +18,7 @@ export interface DocsNavbarProps {
|
|
|
15
18
|
}
|
|
16
19
|
export interface DocsSidebarProps {
|
|
17
20
|
tree: SidebarItem[];
|
|
21
|
+
pages?: readonly PageData[];
|
|
18
22
|
nav?: NavItem[];
|
|
19
23
|
currentUrl?: string;
|
|
20
24
|
title?: string;
|
|
@@ -52,13 +56,14 @@ export interface DocsSearchDialogProps {
|
|
|
52
56
|
onOpenChange: (open: boolean) => void;
|
|
53
57
|
pages?: PageData[];
|
|
54
58
|
onSelectPage?: (url: string) => void;
|
|
55
|
-
provider?:
|
|
59
|
+
provider?: string | SearchAdapter;
|
|
56
60
|
}
|
|
57
61
|
export interface DocsLayoutProps {
|
|
58
62
|
config: DocsConfig;
|
|
59
63
|
tree: SidebarItem[];
|
|
60
64
|
pages?: PageData[];
|
|
61
65
|
currentPage?: PageData;
|
|
66
|
+
onNavigate?: (url: string) => void;
|
|
62
67
|
breadcrumbs?: BreadcrumbItemData[];
|
|
63
68
|
toc?: TocItem[];
|
|
64
69
|
prev?: {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Component } from "solid-js";
|
|
2
|
+
import type { FolioPluginConfig } from "./plugin.js";
|
|
3
|
+
import type { DocsUiLocaleConfig } from "./plugins/i18n/site-locale.js";
|
|
2
4
|
export type DocsIcon = Component<{
|
|
3
5
|
class?: string;
|
|
4
6
|
"aria-hidden"?: boolean | "true" | "false";
|
|
@@ -11,6 +13,8 @@ export interface Frontmatter {
|
|
|
11
13
|
icon?: string;
|
|
12
14
|
badge?: string;
|
|
13
15
|
addedAt?: string;
|
|
16
|
+
updatedAt?: string;
|
|
17
|
+
noindex?: boolean;
|
|
14
18
|
prev?: string | {
|
|
15
19
|
title: string;
|
|
16
20
|
href: string;
|
|
@@ -27,6 +31,14 @@ export interface TocItem {
|
|
|
27
31
|
text: string;
|
|
28
32
|
depth: number;
|
|
29
33
|
}
|
|
34
|
+
export interface DocsPageAction {
|
|
35
|
+
/** Accessible text rendered inside the page action link. */
|
|
36
|
+
label: string;
|
|
37
|
+
/** Destination opened when the visitor activates the action. */
|
|
38
|
+
href: string;
|
|
39
|
+
/** Open external destinations in a new tab with safe link attributes. */
|
|
40
|
+
external?: boolean;
|
|
41
|
+
}
|
|
30
42
|
export interface PageData {
|
|
31
43
|
slug: string;
|
|
32
44
|
url: string;
|
|
@@ -36,6 +48,7 @@ export interface PageData {
|
|
|
36
48
|
toc: TocItem[];
|
|
37
49
|
title: string;
|
|
38
50
|
description?: string;
|
|
51
|
+
pageActions?: DocsPageAction[];
|
|
39
52
|
}
|
|
40
53
|
export interface SidebarItem {
|
|
41
54
|
title: string;
|
|
@@ -67,6 +80,12 @@ export interface DocsNavigationConfig {
|
|
|
67
80
|
footer?: boolean;
|
|
68
81
|
headerSubtitle?: string;
|
|
69
82
|
footerText?: string;
|
|
83
|
+
promo?: {
|
|
84
|
+
title: string;
|
|
85
|
+
description: string;
|
|
86
|
+
href: string;
|
|
87
|
+
cta?: string;
|
|
88
|
+
};
|
|
70
89
|
};
|
|
71
90
|
}
|
|
72
91
|
export interface DocsHomeConfig {
|
|
@@ -96,6 +115,18 @@ export interface ShikiConfig {
|
|
|
96
115
|
};
|
|
97
116
|
langs?: string[];
|
|
98
117
|
}
|
|
118
|
+
export interface DocsSeoConfig {
|
|
119
|
+
/** Social preview image path or URL. */
|
|
120
|
+
image?: string;
|
|
121
|
+
/** Accessible alternative text for the social preview image. */
|
|
122
|
+
imageAlt?: string;
|
|
123
|
+
/** Site name used by social metadata. Defaults to the configured title. */
|
|
124
|
+
siteName?: string;
|
|
125
|
+
/** Open Graph locale. Defaults to `en_US`. */
|
|
126
|
+
locale?: string;
|
|
127
|
+
/** Twitter/X card type. */
|
|
128
|
+
twitterCard?: "summary" | "summary_large_image";
|
|
129
|
+
}
|
|
99
130
|
export interface DocsConfig {
|
|
100
131
|
title?: string;
|
|
101
132
|
description?: string;
|
|
@@ -123,9 +154,15 @@ export interface DocsConfig {
|
|
|
123
154
|
sidebar?: SidebarItem[] | "auto";
|
|
124
155
|
navigation?: DocsNavigationConfig;
|
|
125
156
|
theme?: DocsThemeConfig;
|
|
157
|
+
seo?: DocsSeoConfig;
|
|
126
158
|
shiki?: ShikiConfig;
|
|
127
159
|
search?: {
|
|
128
160
|
enabled?: boolean;
|
|
129
|
-
provider
|
|
161
|
+
/** A provider name or a configured adapter instance. */
|
|
162
|
+
provider?: string | import("./search/provider.js").SearchAdapter;
|
|
130
163
|
};
|
|
164
|
+
/** Resolved JSON-backed translations for the documentation interface. */
|
|
165
|
+
uiLocale?: DocsUiLocaleConfig;
|
|
166
|
+
/** Build-time extensions created by Folio plugin factories. */
|
|
167
|
+
plugins?: FolioPluginConfig;
|
|
131
168
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatTitleFromFilename(filename: string): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function formatTitleFromFilename(filename) {
|
|
2
|
+
const basename = filename.replace(/\\/g, "/").split("/").pop() || filename;
|
|
3
|
+
const extensionIndex = basename.lastIndexOf(".");
|
|
4
|
+
const base = extensionIndex > 0 ? basename.slice(0, extensionIndex) : basename;
|
|
5
|
+
if (base === "index")
|
|
6
|
+
return "Overview";
|
|
7
|
+
return base
|
|
8
|
+
.split(/[-_]/)
|
|
9
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
10
|
+
.join(" ");
|
|
11
|
+
}
|
|
@@ -97,7 +97,10 @@ export function MdxCode(props: HtmlProps<HTMLElement>) {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
function isPackageCommand(code: string, language: string) {
|
|
100
|
-
|
|
100
|
+
const packageCommand = /^(?:(?:bun|npm|pnpm|yarn)\s+(?:add|install|i|create|run)\s+|(?:bunx|npx|pnpm\s+dlx|yarn\s+dlx)\s+)/i;
|
|
101
|
+
return /^(bash|sh|shell|zsh)$/i.test(language)
|
|
102
|
+
&& !code.includes("\n")
|
|
103
|
+
&& packageCommand.test(code.trim());
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
/** Preserve Shiki's server-rendered children while using Nikala's code chrome. */
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
TableCell,
|
|
16
16
|
} from "@/components/ui/table";
|
|
17
17
|
import { cn } from "@/lib/cn";
|
|
18
|
+
import { useSiteLocale } from "../../plugins/i18n/runtime.jsx";
|
|
18
19
|
|
|
19
20
|
export interface ApiTableItem {
|
|
20
21
|
/** Property, attribute, or method name */
|
|
@@ -45,6 +46,7 @@ export interface ApiTableProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
|
45
46
|
* Clean, structured API reference table component composed from Table and Badge primitives.
|
|
46
47
|
*/
|
|
47
48
|
export const ApiTable: Component<ApiTableProps> = (props) => {
|
|
49
|
+
const siteLocale = useSiteLocale();
|
|
48
50
|
const [local, rest] = splitProps(props, [
|
|
49
51
|
"title",
|
|
50
52
|
"description",
|
|
@@ -70,10 +72,10 @@ export const ApiTable: Component<ApiTableProps> = (props) => {
|
|
|
70
72
|
<Table class="text-xs">
|
|
71
73
|
<TableHeader class="bg-muted/40 font-mono text-[11px] uppercase tracking-wider text-muted-foreground select-none">
|
|
72
74
|
<TableRow class="hover:bg-transparent">
|
|
73
|
-
<TableHead class="h-9 px-4 font-semibold">
|
|
74
|
-
<TableHead class="h-9 px-4 font-semibold">
|
|
75
|
-
<TableHead class="h-9 px-4 font-semibold">
|
|
76
|
-
<TableHead class="h-9 px-4 font-semibold">
|
|
75
|
+
<TableHead class="h-9 px-4 font-semibold">{siteLocale.t("apiTable.property")}</TableHead>
|
|
76
|
+
<TableHead class="h-9 px-4 font-semibold">{siteLocale.t("apiTable.type")}</TableHead>
|
|
77
|
+
<TableHead class="h-9 px-4 font-semibold">{siteLocale.t("apiTable.default")}</TableHead>
|
|
78
|
+
<TableHead class="h-9 px-4 font-semibold">{siteLocale.t("apiTable.description")}</TableHead>
|
|
77
79
|
</TableRow>
|
|
78
80
|
</TableHeader>
|
|
79
81
|
<TableBody class="font-mono text-xs">
|
|
@@ -14,6 +14,7 @@ import { Badge } from "@/components/ui/badge";
|
|
|
14
14
|
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
|
15
15
|
import { Tooltip, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip";
|
|
16
16
|
import { createClipboard } from "@/hooks/create-clipboard";
|
|
17
|
+
import { useSiteLocale } from "../../plugins/i18n/runtime.jsx";
|
|
17
18
|
import { cn } from "@/lib/cn";
|
|
18
19
|
|
|
19
20
|
export type CodeBlockPackageManager = "bunx" | "npx" | "pnpm" | "yarn";
|
|
@@ -151,6 +152,7 @@ function escapeHtml(str: string): string {
|
|
|
151
152
|
}
|
|
152
153
|
|
|
153
154
|
export const CodeBlock: ParentComponent<CodeBlockProps> = (props) => {
|
|
155
|
+
const siteLocale = useSiteLocale();
|
|
154
156
|
const [local, rest] = splitProps(props, [
|
|
155
157
|
"id",
|
|
156
158
|
"code",
|
|
@@ -288,7 +290,7 @@ export const CodeBlock: ParentComponent<CodeBlockProps> = (props) => {
|
|
|
288
290
|
variant="ghost"
|
|
289
291
|
size="icon"
|
|
290
292
|
onClick={handleCopy}
|
|
291
|
-
aria-label={clipboard.copied() ? "
|
|
293
|
+
aria-label={clipboard.copied() ? siteLocale.t("code.copied") : siteLocale.t("code.copy")}
|
|
292
294
|
class="size-6 p-0 rounded-xs text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer"
|
|
293
295
|
>
|
|
294
296
|
<Show when={clipboard.copied()} fallback={<Copy class="size-3.5" />}>
|
|
@@ -296,7 +298,7 @@ export const CodeBlock: ParentComponent<CodeBlockProps> = (props) => {
|
|
|
296
298
|
</Show>
|
|
297
299
|
</TooltipTrigger>
|
|
298
300
|
<TooltipContent class="text-[10px] py-1 px-2">
|
|
299
|
-
{clipboard.copied() ? "
|
|
301
|
+
{clipboard.copied() ? siteLocale.t("actions.copied") : siteLocale.t("code.copy")}
|
|
300
302
|
</TooltipContent>
|
|
301
303
|
</Tooltip>
|
|
302
304
|
</Show>
|
|
@@ -312,7 +314,7 @@ export const CodeBlock: ParentComponent<CodeBlockProps> = (props) => {
|
|
|
312
314
|
variant="outline"
|
|
313
315
|
size="icon"
|
|
314
316
|
onClick={handleCopy}
|
|
315
|
-
|
|
317
|
+
aria-label={clipboard.copied() ? siteLocale.t("code.copied") : siteLocale.t("code.copy")}
|
|
316
318
|
class="size-7 rounded-md border-border/80 bg-background/90 text-muted-foreground backdrop-blur-xs hover:bg-muted hover:text-foreground cursor-pointer shadow-2xs"
|
|
317
319
|
>
|
|
318
320
|
<Show when={clipboard.copied()} fallback={<Copy class="size-3.5" />}>
|
|
@@ -320,7 +322,7 @@ export const CodeBlock: ParentComponent<CodeBlockProps> = (props) => {
|
|
|
320
322
|
</Show>
|
|
321
323
|
</TooltipTrigger>
|
|
322
324
|
<TooltipContent class="text-[10px] py-1 px-2">
|
|
323
|
-
|
|
325
|
+
{clipboard.copied() ? siteLocale.t("actions.copied") : siteLocale.t("code.copy")}
|
|
324
326
|
</TooltipContent>
|
|
325
327
|
</Tooltip>
|
|
326
328
|
</div>
|
|
@@ -13,6 +13,7 @@ import { createKeybindings } from "@/hooks/create-keybindings";
|
|
|
13
13
|
import { Dialog } from "@kobalte/core/dialog";
|
|
14
14
|
import { Search, ArrowUp, ArrowDown, CornerDownLeft } from "lucide-solid";
|
|
15
15
|
import { cn } from "@/lib/cn";
|
|
16
|
+
import { useSiteLocale } from "../../plugins/i18n/runtime.jsx";
|
|
16
17
|
import { Kbd, KbdGroup } from "../ui/kbd";
|
|
17
18
|
import { InputGroup, InputGroupInput, InputGroupAddon } from "../ui/input-group";
|
|
18
19
|
import { List, ListGroup, ListHeader, ListItem, type ListItemProps } from "../ui/list";
|
|
@@ -193,6 +194,7 @@ export interface CommandInputProps
|
|
|
193
194
|
export const CommandInput: Component<CommandInputProps> = (props) => {
|
|
194
195
|
const [local, rest] = splitProps(props, ["class", "value", "onInput"]);
|
|
195
196
|
const { search, setSearch } = useCommand();
|
|
197
|
+
const siteLocale = useSiteLocale();
|
|
196
198
|
|
|
197
199
|
return (
|
|
198
200
|
<InputGroup class="border-0 border-b border-border rounded-none bg-transparent px-3 py-1 shadow-none focus-within:ring-0 focus-within:border-border">
|
|
@@ -208,7 +210,7 @@ export const CommandInput: Component<CommandInputProps> = (props) => {
|
|
|
208
210
|
local.onInput(e);
|
|
209
211
|
}
|
|
210
212
|
}}
|
|
211
|
-
placeholder="
|
|
213
|
+
placeholder={siteLocale.t("search.commandPlaceholder")}
|
|
212
214
|
class="h-11 text-base sm:text-sm font-medium"
|
|
213
215
|
{...rest}
|
|
214
216
|
/>
|
|
@@ -242,6 +244,7 @@ export interface CommandEmptyProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
|
242
244
|
export const CommandEmpty: Component<CommandEmptyProps> = (props) => {
|
|
243
245
|
const [local, rest] = splitProps(props, ["class", "children"]);
|
|
244
246
|
const { search } = useCommand();
|
|
247
|
+
const siteLocale = useSiteLocale();
|
|
245
248
|
|
|
246
249
|
return (
|
|
247
250
|
<Show when={search().trim().length > 0}>
|
|
@@ -252,7 +255,7 @@ export const CommandEmpty: Component<CommandEmptyProps> = (props) => {
|
|
|
252
255
|
)}
|
|
253
256
|
{...rest}
|
|
254
257
|
>
|
|
255
|
-
{local.children ||
|
|
258
|
+
{local.children || siteLocale.t("search.noResults", { query: search() })}
|
|
256
259
|
</div>
|
|
257
260
|
</Show>
|
|
258
261
|
);
|
|
@@ -347,6 +350,7 @@ export interface CommandFooterProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
|
347
350
|
|
|
348
351
|
export const CommandFooter: Component<CommandFooterProps> = (props) => {
|
|
349
352
|
const [local, rest] = splitProps(props, ["class", "children"]);
|
|
353
|
+
const siteLocale = useSiteLocale();
|
|
350
354
|
|
|
351
355
|
return (
|
|
352
356
|
<div
|
|
@@ -362,17 +366,17 @@ export const CommandFooter: Component<CommandFooterProps> = (props) => {
|
|
|
362
366
|
<Kbd size="sm"><ArrowUp class="w-2.5 h-2.5" /></Kbd>
|
|
363
367
|
<Kbd size="sm"><ArrowDown class="w-2.5 h-2.5" /></Kbd>
|
|
364
368
|
</KbdGroup>
|
|
365
|
-
<span>
|
|
369
|
+
<span>{siteLocale.t("command.navigate")}</span>
|
|
366
370
|
</span>
|
|
367
371
|
|
|
368
372
|
<span class="flex items-center gap-1">
|
|
369
373
|
<Kbd size="sm"><CornerDownLeft class="w-2.5 h-2.5" /></Kbd>
|
|
370
|
-
<span>
|
|
374
|
+
<span>{siteLocale.t("command.select")}</span>
|
|
371
375
|
</span>
|
|
372
376
|
|
|
373
377
|
<span class="flex items-center gap-1">
|
|
374
378
|
<Kbd size="sm">Esc</Kbd>
|
|
375
|
-
<span>
|
|
379
|
+
<span>{siteLocale.t("command.close")}</span>
|
|
376
380
|
</span>
|
|
377
381
|
</div>
|
|
378
382
|
|
|
@@ -9,6 +9,7 @@ import { Dynamic } from "solid-js/web";
|
|
|
9
9
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
10
10
|
import { ChevronRight } from "lucide-solid";
|
|
11
11
|
import { cn } from "@/lib/cn";
|
|
12
|
+
import { useSiteLocale } from "../../plugins/i18n/runtime.jsx";
|
|
12
13
|
|
|
13
14
|
/* --- List Container --- */
|
|
14
15
|
export interface ListProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
@@ -128,6 +129,7 @@ export const ListItem: Component<ListItemProps> = (props) => {
|
|
|
128
129
|
"class",
|
|
129
130
|
"children",
|
|
130
131
|
]);
|
|
132
|
+
const siteLocale = useSiteLocale();
|
|
131
133
|
|
|
132
134
|
const content = () => (
|
|
133
135
|
<>
|
|
@@ -136,7 +138,7 @@ export const ListItem: Component<ListItemProps> = (props) => {
|
|
|
136
138
|
<Show when={local.avatar}>
|
|
137
139
|
<img
|
|
138
140
|
src={local.avatar}
|
|
139
|
-
alt={local.title || "
|
|
141
|
+
alt={local.title || siteLocale.t("image.avatar")}
|
|
140
142
|
class="w-10 h-10 rounded-lg object-cover shrink-0 border border-border"
|
|
141
143
|
/>
|
|
142
144
|
</Show>
|
|
@@ -219,4 +221,4 @@ export const ListItem: Component<ListItemProps> = (props) => {
|
|
|
219
221
|
</a>
|
|
220
222
|
</Show>
|
|
221
223
|
);
|
|
222
|
-
};
|
|
224
|
+
};
|
|
@@ -6,63 +6,34 @@ export interface LogoProps extends JSX.SvgSVGAttributes<SVGSVGElement> {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Folio mark with a theme-aware accent fill.
|
|
10
|
+
*
|
|
11
|
+
* The paths intentionally use currentColor so the mark follows the
|
|
12
|
+
* consuming project's primary theme token instead of a fixed brand color.
|
|
10
13
|
*/
|
|
11
14
|
export const Logo: Component<LogoProps> = (props) => {
|
|
12
15
|
const [local, rest] = splitProps(props, ["class"]);
|
|
13
16
|
|
|
14
17
|
return (
|
|
15
18
|
<svg
|
|
16
|
-
viewBox="0 0
|
|
19
|
+
viewBox="0 0 111 134"
|
|
17
20
|
fill="none"
|
|
18
21
|
xmlns="http://www.w3.org/2000/svg"
|
|
19
|
-
class={cn("h-7 w-
|
|
22
|
+
class={cn("h-7 w-auto shrink-0 select-none text-primary", local.class)}
|
|
20
23
|
{...rest}
|
|
21
24
|
>
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/>
|
|
35
|
-
<path
|
|
36
|
-
d="M147.908 159.434C143.029 162.624 138.255 165.222 132.524 166.53C131.568 166.759 131.568 166.759 130.593 166.992C117.641 169.419 104.681 165.652 93.8424 158.557C84.6301 151.709 78.5873 142.443 75.2903 131.528C75.0234 130.675 75.0234 130.675 74.7511 129.804C72.9741 122.986 73.9008 115.665 74.4194 108.713C75.7267 91.1539 72.9686 78.0313 62.8484 63.365C61.808 61.5353 61.808 61.5353 62.2756 59.3756C74.2777 52.1095 87.8993 50.9005 101.359 53.9904C102.212 54.1829 103.066 54.3753 103.945 54.5736C110.197 56.0433 115.833 57.7788 121.484 60.8918C121.926 61.1331 122.368 61.3745 122.823 61.6232C141.727 72.123 158.382 89.1592 164.804 110.159C170.072 129.189 164.608 147.982 147.908 159.434Z"
|
|
37
|
-
fill="var(--primary-foreground, #ffffff)"
|
|
38
|
-
/>
|
|
39
|
-
<path
|
|
40
|
-
d="M224.945 222.724C223.467 224.948 221.157 226.154 218.937 227.554C218.142 228.066 218.142 228.067 217.331 228.589C215.58 229.716 213.822 230.833 212.065 231.95C210.849 232.73 209.634 233.51 208.418 234.291C205.22 236.344 202.016 238.389 198.811 240.432C195.542 242.519 192.277 244.613 189.012 246.706C182.605 250.813 176.192 254.911 169.776 259.003C163.425 254.055 159.038 246.461 154.501 239.887C151.859 236.063 149.162 232.301 146.129 228.777C140.59 220.962 138.709 211.47 139.907 202.042C141.806 192.774 145.937 185.415 153.125 179.281C153.821 178.654 154.516 178.028 155.232 177.382C161.199 173.349 167.362 171.636 174.492 171.096C175.187 171.029 175.187 171.029 175.896 170.961C185.36 171.183 194.837 174.7 201.562 181.385C202.406 182.334 203.235 183.298 204.044 184.277C204.596 184.933 204.596 184.933 205.159 185.602C207.879 189.006 209.907 192.696 211.94 196.538C212.966 198.458 213.996 200.376 215.027 202.293C215.301 202.803 215.574 203.312 215.856 203.837C218.216 208.207 220.709 212.489 223.254 216.754C225.579 220.827 225.579 220.827 224.945 222.724Z"
|
|
41
|
-
fill="var(--primary-foreground, #ffffff)"
|
|
42
|
-
/>
|
|
43
|
-
<path
|
|
44
|
-
d="M346.445 469.84C341.579 473.016 337.792 473.996 331.992 473.069C323.666 471.041 319.697 464.544 315.142 457.786C314.41 456.773 313.671 455.764 312.923 454.762C312.555 454.269 312.187 453.775 311.808 453.267C310.744 451.858 309.676 450.454 308.605 449.052C304.588 443.792 300.674 438.482 296.873 433.064C294.268 429.365 291.554 425.754 288.807 422.16C288.108 421.244 287.41 420.328 286.711 419.412C286.181 418.717 286.181 418.717 285.639 418.007C283.312 414.94 281.064 411.828 278.863 408.669C275.954 404.511 272.86 400.557 269.591 396.676C270.596 393.987 272.077 392.99 274.463 391.469C275.568 390.758 275.568 390.758 276.694 390.032C277.891 389.276 277.891 389.276 279.111 388.505C279.926 387.983 280.74 387.461 281.58 386.923C283.742 385.538 285.909 384.16 288.077 382.784C290.29 381.378 292.498 379.965 294.707 378.552C299.039 375.782 303.376 373.02 307.716 370.264C310.189 371.73 310.549 372.854 311.779 375.43C313.714 379.343 315.815 383.09 318.072 386.826C320.626 391.064 322.954 395.349 325.158 399.782C326.672 402.673 328.329 405.458 330.013 408.252C332.566 412.491 334.894 416.776 337.098 421.209C338.613 424.099 340.27 426.884 341.953 429.678C344.974 434.704 347.722 439.785 350.305 445.052C350.628 445.646 350.95 446.239 351.282 446.851C355.467 454.895 353.749 464.19 346.445 469.84Z"
|
|
45
|
-
fill="var(--primary-foreground, #ffffff)"
|
|
46
|
-
/>
|
|
47
|
-
<path
|
|
48
|
-
d="M175.175 164.461C174.611 164.495 174.047 164.529 173.466 164.565C161.822 165.517 151.451 170.117 143.632 178.98C141.188 182.058 138.963 185.278 136.798 188.557C134.916 187.16 133.636 185.817 132.364 183.853C132.04 183.352 131.717 182.852 131.383 182.336C131.053 181.817 130.724 181.297 130.384 180.762C130.043 180.241 129.703 179.719 129.351 179.182C129.031 178.682 128.711 178.182 128.381 177.668C128.089 177.211 127.796 176.755 127.495 176.285C126.898 175.109 126.898 175.109 127.21 173.669C127.885 173.594 127.885 173.594 128.573 173.517C144.325 171.353 156.368 162.585 166.151 150.449C168.977 152.315 170.506 155.002 172.283 157.806C172.597 158.285 172.911 158.765 173.234 159.26C175.527 162.839 175.527 162.839 175.175 164.461Z"
|
|
49
|
-
fill="var(--primary-foreground, #ffffff)"
|
|
50
|
-
/>
|
|
51
|
-
</g>
|
|
52
|
-
</g>
|
|
53
|
-
<defs>
|
|
54
|
-
<clipPath id="nikala-logo-clip0">
|
|
55
|
-
<rect width="223" height="223" rx="10" fill="white" />
|
|
56
|
-
</clipPath>
|
|
57
|
-
<clipPath id="nikala-logo-clip1">
|
|
58
|
-
<rect
|
|
59
|
-
width="377.121"
|
|
60
|
-
height="377.121"
|
|
61
|
-
fill="white"
|
|
62
|
-
transform="translate(431.932 116.81) rotate(102.218)"
|
|
63
|
-
/>
|
|
64
|
-
</clipPath>
|
|
65
|
-
</defs>
|
|
25
|
+
<path
|
|
26
|
+
d="M36.1777 0.00543119C36.9886 0.00499311 37.7994 0.00455503 38.6349 0.00410368C41.2808 0.00617229 43.9262 0.0294108 46.572 0.0530386C48.42 0.0586414 50.268 0.0629083 52.1161 0.0659018C56.9543 0.0772964 61.7923 0.106717 66.6305 0.140014C71.5778 0.170831 76.5251 0.184432 81.4724 0.199523C91.1607 0.231592 100.849 0.282723 110.537 0.346007C110.61 3.53599 110.654 6.72575 110.693 9.91632C110.725 11.2608 110.725 11.2608 110.757 12.6324C110.828 20.4476 109.466 26.0515 104.537 32.346C98.5344 38.2899 92.6817 40.5932 84.2432 40.6014C83.527 40.605 82.8108 40.6086 82.0729 40.6124C80.5233 40.6192 78.9737 40.6218 77.4242 40.6204C74.9635 40.6194 72.503 40.6324 70.0426 40.6494C63.0485 40.6955 56.0544 40.7202 49.06 40.7269C44.7747 40.7319 40.4898 40.7563 36.2046 40.7922C34.5801 40.8019 32.9555 40.8044 31.331 40.799C19.2921 40.7614 9.61779 41.743 0.536854 50.346C0.448685 46.7003 0.396074 43.0549 0.349354 39.4085C0.324217 38.3869 0.29908 37.3653 0.273182 36.3128C0.173253 25.8869 2.62732 17.3394 9.53685 9.34601C17.2641 2.66649 26.0794 -0.141013 36.1777 0.00543119Z"
|
|
27
|
+
fill="currentColor"
|
|
28
|
+
/>
|
|
29
|
+
<path
|
|
30
|
+
d="M22.0491 48.169C22.9608 48.1562 23.8728 48.1434 24.8118 48.1301C26.2884 48.119 26.2884 48.119 27.7947 48.1077C28.8123 48.0997 29.83 48.0916 30.8784 48.0833C33.0354 48.0694 35.1924 48.0587 37.3494 48.0509C40.6285 48.0337 43.9065 47.9898 47.1853 47.9456C49.2843 47.9355 51.3833 47.927 53.4822 47.9202C54.4544 47.9027 55.4266 47.8852 56.4283 47.8672C63.3556 47.889 69.7844 49.012 75.1263 53.7582C79.2822 58.4605 81.032 62.8674 80.8533 69.1585C80.0862 74.4616 77.9359 78.9471 74.1619 82.721C73.2957 83.2573 72.4295 83.7935 71.5369 84.346C70.7322 84.8676 69.9275 85.3892 69.0984 85.9266C64.0178 87.9514 59.3464 87.7288 53.9275 87.682C51.6228 87.6945 49.3182 87.7075 47.0135 87.721C43.4017 87.7249 39.7902 87.721 36.1785 87.7064C32.6778 87.6978 29.1782 87.7196 25.6775 87.7445C24.6105 87.7311 23.5435 87.7178 22.4442 87.704C13.6607 87.7897 7.75397 90.5347 0.536912 95.346C0.386963 91.1144 0.278963 86.8842 0.207322 82.6507C0.177416 81.2152 0.136674 79.7799 0.0842755 78.345C-0.242774 69.1492 0.0895104 61.5914 6.53691 54.346C11.3525 50.524 15.8247 48.2455 22.0491 48.169Z"
|
|
31
|
+
fill="currentColor"
|
|
32
|
+
/>
|
|
33
|
+
<path
|
|
34
|
+
d="M20.8612 95.2484C21.8892 95.2516 22.9173 95.2548 23.9764 95.2581C25.5842 95.2707 25.5842 95.2707 27.2245 95.2835C28.3079 95.288 29.3912 95.2926 30.5077 95.2972C33.1842 95.309 35.8606 95.3255 38.537 95.346C38.6543 99.0124 38.7246 102.678 38.787 106.346C38.8205 107.376 38.854 108.406 38.8885 109.467C38.9806 116.694 38.1397 122.373 33.1595 127.865C28.2702 132.292 23.1029 133.85 16.5526 133.662C10.763 132.754 6.1827 128.721 2.53699 124.346C0.114874 119.156 -0.478718 113.766 1.15417 108.268C3.56015 102.689 7.36624 99.4145 12.537 96.346C15.5962 95.3263 17.6612 95.2307 20.8612 95.2484Z"
|
|
35
|
+
fill="currentColor"
|
|
36
|
+
/>
|
|
66
37
|
</svg>
|
|
67
38
|
);
|
|
68
|
-
};
|
|
39
|
+
};
|
|
@@ -12,6 +12,7 @@ import { Button } from "@/components/ui/button";
|
|
|
12
12
|
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
|
13
13
|
import { Tooltip, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip";
|
|
14
14
|
import { createClipboard } from "@/hooks/create-clipboard";
|
|
15
|
+
import { useSiteLocale } from "../../plugins/i18n/runtime.jsx";
|
|
15
16
|
import { cn } from "@/lib/cn";
|
|
16
17
|
|
|
17
18
|
export type DefaultPackageManager = "bun" | "pnpm" | "npm" | "yarn" | "bunx" | "npx" | "deno";
|
|
@@ -42,6 +43,14 @@ function resolvePmCommand(manager: string, command: string): string {
|
|
|
42
43
|
const trimmed = command.trim();
|
|
43
44
|
const pm = manager.toLowerCase();
|
|
44
45
|
|
|
46
|
+
// 0. Package scripts (e.g. "bun run dev")
|
|
47
|
+
const runMatch = trimmed.match(/^(?:bun|npm|pnpm|yarn)\s+run\s+(.+)$/);
|
|
48
|
+
if (runMatch) {
|
|
49
|
+
const script = runMatch[1];
|
|
50
|
+
if (pm === "yarn") return `yarn ${script}`;
|
|
51
|
+
return `${pm} run ${script}`;
|
|
52
|
+
}
|
|
53
|
+
|
|
45
54
|
// 1. "create" command
|
|
46
55
|
const createMatch = trimmed.match(/^(?:bun|npm|npx|pnpm|yarn|deno)?\s*create\s+(.*)$/);
|
|
47
56
|
if (createMatch) {
|
|
@@ -152,6 +161,7 @@ export const PackageManagerTabs: ParentComponent<PackageManagerTabsProps> = (pro
|
|
|
152
161
|
});
|
|
153
162
|
|
|
154
163
|
const clipboard = createClipboard();
|
|
164
|
+
const siteLocale = useSiteLocale();
|
|
155
165
|
const copyable = () => local.copyable ?? true;
|
|
156
166
|
|
|
157
167
|
const handleCopy = async () => {
|
|
@@ -198,7 +208,7 @@ export const PackageManagerTabs: ParentComponent<PackageManagerTabsProps> = (pro
|
|
|
198
208
|
variant="ghost"
|
|
199
209
|
size="icon"
|
|
200
210
|
onClick={handleCopy}
|
|
201
|
-
aria-label={clipboard.copied() ? "
|
|
211
|
+
aria-label={clipboard.copied() ? siteLocale.t("code.copied") : siteLocale.t("code.copy")}
|
|
202
212
|
class="size-6 p-0 rounded-xs text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer"
|
|
203
213
|
>
|
|
204
214
|
<Show when={clipboard.copied()} fallback={<Copy class="size-3.5" />}>
|
|
@@ -206,7 +216,7 @@ export const PackageManagerTabs: ParentComponent<PackageManagerTabsProps> = (pro
|
|
|
206
216
|
</Show>
|
|
207
217
|
</TooltipTrigger>
|
|
208
218
|
<TooltipContent class="text-[10px] py-1 px-2">
|
|
209
|
-
{clipboard.copied() ? "
|
|
219
|
+
{clipboard.copied() ? siteLocale.t("actions.copied") : siteLocale.t("code.copy")}
|
|
210
220
|
</TooltipContent>
|
|
211
221
|
</Tooltip>
|
|
212
222
|
</Show>
|