@nikala-ui/folio 0.14.0 → 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 +21 -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/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 +4 -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 +5 -3
- package/dist/index.js +3 -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/server/index.d.ts +4 -1
- package/dist/server/index.js +69 -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 +39 -12
- 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 +14 -3
- package/dist/themes/default/sidebar.jsx +7 -5
- package/dist/themes/types.d.ts +5 -0
- package/dist/types.d.ts +36 -0
- package/dist/utils/format-title.d.ts +1 -0
- package/dist/utils/format-title.js +11 -0
- 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 +4 -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 +11 -4
- package/dist/server/plugin.js +0 -521
package/README.md
CHANGED
|
@@ -22,6 +22,8 @@ and Tailwind CSS v4 design tokens.
|
|
|
22
22
|
- Local search and configurable page metadata.
|
|
23
23
|
- Shiki syntax highlighting with lazy language and theme loading.
|
|
24
24
|
- Custom themes, layouts, components, CSS, logos, and site metadata.
|
|
25
|
+
- Typed plugin lifecycle for production builds and development reloads, with
|
|
26
|
+
immutable page/config snapshots and actionable hook errors.
|
|
25
27
|
- CLI initialization for a complete documentation project.
|
|
26
28
|
|
|
27
29
|
The default theme uses the Nikala UI design system. Additional Nikala UI
|
|
@@ -186,6 +188,20 @@ export default config;
|
|
|
186
188
|
|
|
187
189
|
See the [Configuration](/configuration) guide for the supported options.
|
|
188
190
|
|
|
191
|
+
## Plugin status
|
|
192
|
+
|
|
193
|
+
The plugin API is public and integrated with production builds, development
|
|
194
|
+
reloads, generated projects, and the browser/SSR validation suite. See the
|
|
195
|
+
[plugin authoring guide](docs/configuration/plugins.mdx) for lifecycle order,
|
|
196
|
+
hook contracts, immutable inputs, error handling, and compatibility policy.
|
|
197
|
+
|
|
198
|
+
The API is pre-1.0 and therefore follows a compatible-minor policy: plugin
|
|
199
|
+
packages should pin a compatible Folio minor range such as `~0.15.0`. The
|
|
200
|
+
current contract supports page metadata transformation while preserving route
|
|
201
|
+
identity; adding routes or replacing source MDX requires a separately defined
|
|
202
|
+
future API. This release adds no breaking plugin contract change and requires
|
|
203
|
+
no migration.
|
|
204
|
+
|
|
189
205
|
## Customize the theme
|
|
190
206
|
|
|
191
207
|
The generated default theme is under `src/themes/default`. It can be
|
|
@@ -184,6 +184,24 @@ async function copyRegistrySource(root) {
|
|
|
184
184
|
await fs.outputFile(path.join(root, "src/lib/cn.ts"), await fs.readFile(cnSource, "utf-8"), "utf-8");
|
|
185
185
|
return { componentFiles, hookFiles, dependencies: [...dependencies].sort() };
|
|
186
186
|
}
|
|
187
|
+
async function copyPluginSources(root) {
|
|
188
|
+
const commandDir = path.dirname(fileURLToPath(import.meta.url));
|
|
189
|
+
const sourceCandidates = [
|
|
190
|
+
path.resolve(commandDir, "../../../src/plugins"),
|
|
191
|
+
path.resolve(commandDir, "../../plugins"),
|
|
192
|
+
];
|
|
193
|
+
const source = sourceCandidates.find((candidate) => fs.existsSync(candidate));
|
|
194
|
+
if (!source)
|
|
195
|
+
throw new Error("Folio plugin sources are missing from the package");
|
|
196
|
+
for (const sourceFile of await listSourceFiles(source)) {
|
|
197
|
+
const relative = path.relative(source, sourceFile);
|
|
198
|
+
const destination = path.join(root, "src/plugins", relative);
|
|
199
|
+
const content = (await fs.readFile(sourceFile, "utf-8"))
|
|
200
|
+
.replace(/from "(?:\.\.\/)+plugin\.js"/g, 'from "@nikala-ui/folio"')
|
|
201
|
+
.replace(/from "(?:\.\.\/)+types\.js"/g, 'from "@nikala-ui/folio"');
|
|
202
|
+
await fs.outputFile(destination, content, "utf-8");
|
|
203
|
+
}
|
|
204
|
+
}
|
|
187
205
|
async function copyCustomTheme(root) {
|
|
188
206
|
const commandDir = path.dirname(fileURLToPath(import.meta.url));
|
|
189
207
|
const sourceCandidates = [path.resolve(commandDir, "../../../src/themes/default"), path.resolve(commandDir, "../../themes/default")];
|
|
@@ -334,7 +352,7 @@ async function writeProjectFiles(root, registryDependencies) {
|
|
|
334
352
|
};
|
|
335
353
|
await fs.writeJson(packagePath, packageJson, { spaces: 2 });
|
|
336
354
|
await fs.outputFile(path.join(root, "tsconfig.json"), JSON.stringify({
|
|
337
|
-
compilerOptions: { target: "ES2022", module: "ESNext", moduleResolution: "Bundler", jsx: "preserve", jsxImportSource: "solid-js", strict: true, skipLibCheck: true, paths: { "@/*": ["./src/*"], "@/components/ui/*": ["./src/components/ui/*"], "@/hooks/*": ["./src/hooks/*"] } },
|
|
355
|
+
compilerOptions: { target: "ES2022", module: "ESNext", moduleResolution: "Bundler", jsx: "preserve", jsxImportSource: "solid-js", strict: true, skipLibCheck: true, paths: { "@/*": ["./src/*"], "@/components/*": ["./src/components/*"], "@/components/ui/*": ["./src/components/ui/*"], "@/hooks/*": ["./src/hooks/*"], "@/plugins/*": ["./src/plugins/*"] } },
|
|
338
356
|
include: ["src/**/*", "docs.config.ts"],
|
|
339
357
|
}, null, 2) + "\n", "utf-8");
|
|
340
358
|
}
|
|
@@ -364,13 +382,14 @@ Your Nikala UI components and reactive hooks are owned locally in **src/componen
|
|
|
364
382
|
</Callout>
|
|
365
383
|
`, "utf-8");
|
|
366
384
|
await copyCustomTheme(root);
|
|
385
|
+
await copyPluginSources(root);
|
|
367
386
|
await copyDefaultAssets(root);
|
|
368
387
|
const copied = await copyRegistrySource(root);
|
|
369
388
|
await writeProjectFiles(root, copied.dependencies);
|
|
370
389
|
installProjectDependencies(root);
|
|
371
390
|
console.log(` ${pc.green("✓")} Copied ${copied.componentFiles.length} UI sources and ${copied.hookFiles.length} hook sources`);
|
|
372
391
|
console.log(` ${pc.green("✓")} Registered ${copied.dependencies.length} component dependencies`);
|
|
373
|
-
console.log(` ${pc.green("✓")} Created ${pc.cyan("docs")}, ${pc.cyan("src/themes/default")}, and local Tailwind tokens`);
|
|
392
|
+
console.log(` ${pc.green("✓")} Created ${pc.cyan("docs")}, ${pc.cyan("src/plugins")}, ${pc.cyan("src/themes/default")}, and local Tailwind tokens`);
|
|
374
393
|
console.log();
|
|
375
394
|
console.log(` ${pc.bold(pc.green("Success!"))} Run ${pc.cyan("bunx @nikala-ui/folio dev")} to start your docs.`);
|
|
376
395
|
console.log();
|
package/dist/client/app.jsx
CHANGED
|
@@ -4,6 +4,7 @@ import { DocsLayoutShell } from "./components/docs-layout-shell.jsx";
|
|
|
4
4
|
import { DocsPageContent } from "./components/docs-page-content.jsx";
|
|
5
5
|
import { createPageNavigation } from "./navigation/page-navigation.js";
|
|
6
6
|
import { createDocsRouter } from "./routing/use-docs-router.js";
|
|
7
|
+
import { SiteLocaleProvider } from "../plugins/i18n/runtime.jsx";
|
|
7
8
|
// @ts-ignore
|
|
8
9
|
import rawConfig from "virtual:folio-config";
|
|
9
10
|
// @ts-ignore
|
|
@@ -44,7 +45,9 @@ export const App = (props) => {
|
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
47
|
const navigation = createPageNavigation(router.currentPage, allPages, sidebarTree);
|
|
47
|
-
return (<
|
|
48
|
-
<
|
|
49
|
-
|
|
48
|
+
return (<SiteLocaleProvider config={config.uiLocale} pages={allPages} currentPage={router.currentPage()} currentPath={router.currentPage()?.url} onNavigate={router.navigate}>
|
|
49
|
+
<DocsLayoutShell config={config} tree={sidebarTree} pages={allPages} currentPage={router.currentPage()} onNavigate={router.navigate} breadcrumbs={navigation.breadcrumbs()} toc={router.activePageModule() ? navigation.toc() : []} prev={navigation.prevPage()} next={navigation.nextPage()} sourceContent={sourceContent()}>
|
|
50
|
+
<DocsPageContent pageModule={router.activePageModule} mdxComponents={props.mdxComponents || defaultMdxComponents}/>
|
|
51
|
+
</DocsLayoutShell>
|
|
52
|
+
</SiteLocaleProvider>);
|
|
50
53
|
};
|
|
@@ -7,7 +7,7 @@ export const DocsLayoutShell = (props) => {
|
|
|
7
7
|
if (!ThemeProvider)
|
|
8
8
|
throw new Error("Folio theme must provide a ThemeProvider");
|
|
9
9
|
return (<ThemeProvider defaultTheme={resolveDefaultThemeMode(props.config)} storageKey="nikala-theme">
|
|
10
|
-
<configuredTheme.Layout config={props.config} tree={props.tree} pages={props.pages} currentPage={props.currentPage} breadcrumbs={props.breadcrumbs} toc={props.toc} prev={props.prev} next={props.next} sourceContent={props.sourceContent}>
|
|
10
|
+
<configuredTheme.Layout config={props.config} tree={props.tree} pages={props.pages} currentPage={props.currentPage} onNavigate={props.onNavigate} breadcrumbs={props.breadcrumbs} toc={props.toc} prev={props.prev} next={props.next} sourceContent={props.sourceContent}>
|
|
11
11
|
{props.children}
|
|
12
12
|
</configuredTheme.Layout>
|
|
13
13
|
</ThemeProvider>);
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { Show } from "solid-js";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { useSiteLocale } from "../../plugins/i18n/runtime.jsx";
|
|
3
|
+
export const DocsPageContent = (props) => {
|
|
4
|
+
const siteLocale = useSiteLocale();
|
|
5
|
+
return (<Show when={props.pageModule() !== null} fallback={<div class="p-8 text-sm text-muted-foreground">{siteLocale.t("status.loading")}</div>}>
|
|
6
|
+
<Show keyed when={props.pageModule()} fallback={<div class="space-y-4 py-8"><h1 class="text-2xl font-bold">{siteLocale.t("errors.pageNotFound")}</h1><p class="text-muted-foreground text-sm">{siteLocale.t("errors.pageNotFoundDescription")}</p></div>}>
|
|
4
7
|
{(module) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
const Page = module.default;
|
|
9
|
+
return <Page components={props.mdxComponents}/>;
|
|
10
|
+
}}
|
|
8
11
|
</Show>
|
|
9
12
|
</Show>);
|
|
13
|
+
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { createMemo } from "solid-js";
|
|
2
|
-
import {
|
|
2
|
+
import { buildPagination } from "../../core/route-tree.js";
|
|
3
3
|
export function createPageNavigation(currentPage, pages, sidebarTree) {
|
|
4
4
|
const breadcrumbs = createMemo(() => {
|
|
5
5
|
const page = currentPage();
|
|
6
6
|
if (!page)
|
|
7
7
|
return [];
|
|
8
|
-
const
|
|
8
|
+
const allSegments = page.url.split("/").filter(Boolean);
|
|
9
|
+
const locale = typeof page.frontmatter.locale === "string" ? page.frontmatter.locale : undefined;
|
|
10
|
+
const hasLocalePrefix = Boolean(locale && allSegments[0] === locale);
|
|
11
|
+
const segments = hasLocalePrefix ? allSegments.slice(1) : allSegments;
|
|
9
12
|
const items = [{ title: "Docs", href: "/" }];
|
|
10
|
-
let accumulated = "";
|
|
13
|
+
let accumulated = hasLocalePrefix ? `/${locale}` : "";
|
|
11
14
|
for (let index = 0; index < segments.length; index++) {
|
|
12
15
|
accumulated += `/${segments[index]}`;
|
|
13
16
|
const isLast = index === segments.length - 1;
|
|
@@ -20,31 +23,11 @@ export function createPageNavigation(currentPage, pages, sidebarTree) {
|
|
|
20
23
|
return items;
|
|
21
24
|
});
|
|
22
25
|
const toc = createMemo(() => currentPage()?.toc || []);
|
|
23
|
-
const
|
|
24
|
-
const visiblePages = new Map(pages.filter((page) => page.frontmatter?.hidden !== true).map((page) => [page.url, page]));
|
|
25
|
-
return flattenSidebarItems(sidebarTree).map((item) => visiblePages.get(item.href)).filter((page) => Boolean(page));
|
|
26
|
-
});
|
|
27
|
-
const prevPage = createMemo(() => {
|
|
26
|
+
const pagination = createMemo(() => {
|
|
28
27
|
const page = currentPage();
|
|
29
|
-
|
|
30
|
-
return undefined;
|
|
31
|
-
const ordered = flatPages();
|
|
32
|
-
const index = ordered.findIndex((item) => item.url === page.url);
|
|
33
|
-
if (index <= 0)
|
|
34
|
-
return undefined;
|
|
35
|
-
const previous = ordered[index - 1];
|
|
36
|
-
return { title: previous.title, href: previous.url };
|
|
37
|
-
});
|
|
38
|
-
const nextPage = createMemo(() => {
|
|
39
|
-
const page = currentPage();
|
|
40
|
-
if (!page)
|
|
41
|
-
return undefined;
|
|
42
|
-
const ordered = flatPages();
|
|
43
|
-
const index = ordered.findIndex((item) => item.url === page.url);
|
|
44
|
-
if (index < 0 || index >= ordered.length - 1)
|
|
45
|
-
return undefined;
|
|
46
|
-
const next = ordered[index + 1];
|
|
47
|
-
return { title: next.title, href: next.url };
|
|
28
|
+
return page ? buildPagination(pages, page.url, sidebarTree) : {};
|
|
48
29
|
});
|
|
30
|
+
const prevPage = createMemo(() => pagination().prev);
|
|
31
|
+
const nextPage = createMemo(() => pagination().next);
|
|
49
32
|
return { breadcrumbs, toc, prevPage, nextPage };
|
|
50
33
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<svg width="77" height="19" aria-label="Algolia" role="img" id="Layer_1"
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2196.2 500">
|
|
3
|
+
<defs>
|
|
4
|
+
<style>.cls-1,.cls-2{fill:#cacdd2;}.cls-2{fill-rule:evenodd;}</style>
|
|
5
|
+
</defs>
|
|
6
|
+
<path class="cls-2" d="M1070.38,275.3V5.91c0-3.63-3.24-6.39-6.82-5.83l-50.46,7.94c-2.87,.45-4.99,2.93-4.99,5.84l.17,273.22c0,12.92,0,92.7,95.97,95.49,3.33,.1,6.09-2.58,6.09-5.91v-40.78c0-2.96-2.19-5.51-5.12-5.84-34.85-4.01-34.85-47.57-34.85-54.72Z"></path>
|
|
7
|
+
<rect class="cls-1" x="1845.88" y="104.73" width="62.58" height="277.9" rx="5.9" ry="5.9"></rect>
|
|
8
|
+
<path class="cls-2" d="M1851.78,71.38h50.77c3.26,0,5.9-2.64,5.9-5.9V5.9c0-3.62-3.24-6.39-6.82-5.83l-50.77,7.95c-2.87,.45-4.99,2.92-4.99,5.83v51.62c0,3.26,2.64,5.9,5.9,5.9Z"></path>
|
|
9
|
+
<path class="cls-2" d="M1764.03,275.3V5.91c0-3.63-3.24-6.39-6.82-5.83l-50.46,7.94c-2.87,.45-4.99,2.93-4.99,5.84l.17,273.22c0,12.92,0,92.7,95.97,95.49,3.33,.1,6.09-2.58,6.09-5.91v-40.78c0-2.96-2.19-5.51-5.12-5.84-34.85-4.01-34.85-47.57-34.85-54.72Z"></path>
|
|
10
|
+
<path class="cls-2" d="M1631.95,142.72c-11.14-12.25-24.83-21.65-40.78-28.31-15.92-6.53-33.26-9.85-52.07-9.85-18.78,0-36.15,3.17-51.92,9.85-15.59,6.66-29.29,16.05-40.76,28.31-11.47,12.23-20.38,26.87-26.76,44.03-6.38,17.17-9.24,37.37-9.24,58.36,0,20.99,3.19,36.87,9.55,54.21,6.38,17.32,15.14,32.11,26.45,44.36,11.29,12.23,24.83,21.62,40.6,28.46,15.77,6.83,40.12,10.33,52.4,10.48,12.25,0,36.78-3.82,52.7-10.48,15.92-6.68,29.46-16.23,40.78-28.46,11.29-12.25,20.05-27.04,26.25-44.36,6.22-17.34,9.24-33.22,9.24-54.21,0-20.99-3.34-41.19-10.03-58.36-6.38-17.17-15.14-31.8-26.43-44.03Zm-44.43,163.75c-11.47,15.75-27.56,23.7-48.09,23.7-20.55,0-36.63-7.8-48.1-23.7-11.47-15.75-17.21-34.01-17.21-61.2,0-26.89,5.59-49.14,17.06-64.87,11.45-15.75,27.54-23.52,48.07-23.52,20.55,0,36.63,7.78,48.09,23.52,11.47,15.57,17.36,37.98,17.36,64.87,0,27.19-5.72,45.3-17.19,61.2Z"></path>
|
|
11
|
+
<path class="cls-2" d="M894.42,104.73h-49.33c-48.36,0-90.91,25.48-115.75,64.1-14.52,22.58-22.99,49.63-22.99,78.73,0,44.89,20.13,84.92,51.59,111.1,2.93,2.6,6.05,4.98,9.31,7.14,12.86,8.49,28.11,13.47,44.52,13.47,1.23,0,2.46-.03,3.68-.09,.36-.02,.71-.05,1.07-.07,.87-.05,1.75-.11,2.62-.2,.34-.03,.68-.08,1.02-.12,.91-.1,1.82-.21,2.73-.34,.21-.03,.42-.07,.63-.1,32.89-5.07,61.56-30.82,70.9-62.81v57.83c0,3.26,2.64,5.9,5.9,5.9h50.42c3.26,0,5.9-2.64,5.9-5.9V110.63c0-3.26-2.64-5.9-5.9-5.9h-56.32Zm0,206.92c-12.2,10.16-27.97,13.98-44.84,15.12-.16,.01-.33,.03-.49,.04-1.12,.07-2.24,.1-3.36,.1-42.24,0-77.12-35.89-77.12-79.37,0-10.25,1.96-20.01,5.42-28.98,11.22-29.12,38.77-49.74,71.06-49.74h49.33v142.83Z"></path>
|
|
12
|
+
<path class="cls-2" d="M2133.97,104.73h-49.33c-48.36,0-90.91,25.48-115.75,64.1-14.52,22.58-22.99,49.63-22.99,78.73,0,44.89,20.13,84.92,51.59,111.1,2.93,2.6,6.05,4.98,9.31,7.14,12.86,8.49,28.11,13.47,44.52,13.47,1.23,0,2.46-.03,3.68-.09,.36-.02,.71-.05,1.07-.07,.87-.05,1.75-.11,2.62-.2,.34-.03,.68-.08,1.02-.12,.91-.1,1.82-.21,2.73-.34,.21-.03,.42-.07,.63-.1,32.89-5.07,61.56-30.82,70.9-62.81v57.83c0,3.26,2.64,5.9,5.9,5.9h50.42c3.26,0,5.9-2.64,5.9-5.9V110.63c0-3.26-2.64-5.9-5.9-5.9h-56.32Zm0,206.92c-12.2,10.16-27.97,13.98-44.84,15.12-.16,.01-.33,.03-.49,.04-1.12,.07-2.24,.1-3.36,.1-42.24,0-77.12-35.89-77.12-79.37,0-10.25,1.96-20.01,5.42-28.98,11.22-29.12,38.77-49.74,71.06-49.74h49.33v142.83Z"></path>
|
|
13
|
+
<path class="cls-2" d="M1314.05,104.73h-49.33c-48.36,0-90.91,25.48-115.75,64.1-11.79,18.34-19.6,39.64-22.11,62.59-.58,5.3-.88,10.68-.88,16.14s.31,11.15,.93,16.59c4.28,38.09,23.14,71.61,50.66,94.52,2.93,2.6,6.05,4.98,9.31,7.14,12.86,8.49,28.11,13.47,44.52,13.47h0c17.99,0,34.61-5.93,48.16-15.97,16.29-11.58,28.88-28.54,34.48-47.75v50.26h-.11v11.08c0,21.84-5.71,38.27-17.34,49.36-11.61,11.08-31.04,16.63-58.25,16.63-11.12,0-28.79-.59-46.6-2.41-2.83-.29-5.46,1.5-6.27,4.22l-12.78,43.11c-1.02,3.46,1.27,7.02,4.83,7.53,21.52,3.08,42.52,4.68,54.65,4.68,48.91,0,85.16-10.75,108.89-32.21,21.48-19.41,33.15-48.89,35.2-88.52V110.63c0-3.26-2.64-5.9-5.9-5.9h-56.32Zm0,64.1s.65,139.13,0,143.36c-12.08,9.77-27.11,13.59-43.49,14.7-.16,.01-.33,.03-.49,.04-1.12,.07-2.24,.1-3.36,.1-1.32,0-2.63-.03-3.94-.1-40.41-2.11-74.52-37.26-74.52-79.38,0-10.25,1.96-20.01,5.42-28.98,11.22-29.12,38.77-49.74,71.06-49.74h49.33Z"></path>
|
|
14
|
+
<path class="cls-1" d="M249.83,0C113.3,0,2,110.09,.03,246.16c-2,138.19,110.12,252.7,248.33,253.5,42.68,.25,83.79-10.19,120.3-30.03,3.56-1.93,4.11-6.83,1.08-9.51l-23.38-20.72c-4.75-4.21-11.51-5.4-17.36-2.92-25.48,10.84-53.17,16.38-81.71,16.03-111.68-1.37-201.91-94.29-200.13-205.96,1.76-110.26,92-199.41,202.67-199.41h202.69V407.41l-115-102.18c-3.72-3.31-9.42-2.66-12.42,1.31-18.46,24.44-48.53,39.64-81.93,37.34-46.33-3.2-83.87-40.5-87.34-86.81-4.15-55.24,39.63-101.52,94-101.52,49.18,0,89.68,37.85,93.91,85.95,.38,4.28,2.31,8.27,5.52,11.12l29.95,26.55c3.4,3.01,8.79,1.17,9.63-3.3,2.16-11.55,2.92-23.58,2.07-35.92-4.82-70.34-61.8-126.93-132.17-131.26-80.68-4.97-148.13,58.14-150.27,137.25-2.09,77.1,61.08,143.56,138.19,145.26,32.19,.71,62.03-9.41,86.14-26.95l150.26,133.2c6.44,5.71,16.61,1.14,16.61-7.47V9.48C499.66,4.25,495.42,0,490.18,0H249.83Z"></path>
|
|
15
|
+
</svg>
|
|
Binary file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg width="111" height="134" viewBox="0 0 111 134" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path
|
|
3
|
+
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.5033 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"
|
|
4
|
+
fill="#00ade4" />
|
|
5
|
+
<path
|
|
6
|
+
d="M22.0491 48.169C22.9608 48.1562 23.8725 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.0863 74.4616 77.9359 78.9471 74.1619 82.721C73.2957 83.2573 72.4294 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.8248 48.2455 22.0491 48.169Z"
|
|
7
|
+
fill="#00ade4" />
|
|
8
|
+
<path
|
|
9
|
+
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.3914 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"
|
|
10
|
+
fill="#00ade4" />
|
|
11
|
+
</svg>
|
|
@@ -11,6 +11,7 @@ export interface DocsRouter {
|
|
|
11
11
|
pathname: Accessor<string>;
|
|
12
12
|
currentPage: Accessor<PageData | undefined>;
|
|
13
13
|
activePageModule: Accessor<PageModule | null | undefined>;
|
|
14
|
+
navigate: (url: string) => void;
|
|
14
15
|
}
|
|
15
16
|
export declare function createDocsRouter(options: DocsRouterOptions): DocsRouter;
|
|
16
17
|
export {};
|
|
@@ -2,6 +2,16 @@ import { createEffect, createMemo, createSignal, onCleanup, onMount } from "soli
|
|
|
2
2
|
const normalizePath = (path) => path.replace(/\/$/, "") || "/";
|
|
3
3
|
export function createDocsRouter(options) {
|
|
4
4
|
const [pathname, setPathname] = createSignal(options.initialPath || (typeof window !== "undefined" ? window.location.pathname : "/"));
|
|
5
|
+
const navigate = (url) => {
|
|
6
|
+
if (typeof window === "undefined")
|
|
7
|
+
return;
|
|
8
|
+
const target = new URL(url, window.location.origin);
|
|
9
|
+
if (target.origin !== window.location.origin)
|
|
10
|
+
return;
|
|
11
|
+
window.history.pushState(null, "", `${target.pathname}${target.search}${target.hash}`);
|
|
12
|
+
setPathname(target.pathname);
|
|
13
|
+
window.scrollTo({ top: 0, behavior: "instant" });
|
|
14
|
+
};
|
|
5
15
|
onMount(() => {
|
|
6
16
|
const handlePopState = () => setPathname(window.location.pathname);
|
|
7
17
|
const handleAnchorClick = (event) => {
|
|
@@ -24,8 +34,7 @@ export function createDocsRouter(options) {
|
|
|
24
34
|
if (url.origin !== window.location.origin)
|
|
25
35
|
return;
|
|
26
36
|
event.preventDefault();
|
|
27
|
-
|
|
28
|
-
window.history.pushState(null, "", href);
|
|
37
|
+
navigate(href);
|
|
29
38
|
if (url.hash) {
|
|
30
39
|
const element = document.getElementById(url.hash.slice(1));
|
|
31
40
|
if (element) {
|
|
@@ -82,5 +91,5 @@ export function createDocsRouter(options) {
|
|
|
82
91
|
setLoadedPageModule(undefined);
|
|
83
92
|
});
|
|
84
93
|
});
|
|
85
|
-
return { pathname, currentPage, activePageModule: loadedPageModule };
|
|
94
|
+
return { pathname, currentPage, activePageModule: loadedPageModule, navigate };
|
|
86
95
|
}
|
package/dist/client/style.css
CHANGED
|
@@ -7,65 +7,110 @@
|
|
|
7
7
|
|
|
8
8
|
:root {
|
|
9
9
|
--background: oklch(1 0 0);
|
|
10
|
-
--foreground: oklch(0.
|
|
10
|
+
--foreground: oklch(0.13 0.028 261.692);
|
|
11
11
|
--card: oklch(1 0 0);
|
|
12
|
-
--card-foreground: oklch(0.
|
|
12
|
+
--card-foreground: oklch(0.13 0.028 261.692);
|
|
13
13
|
--popover: oklch(1 0 0);
|
|
14
|
-
--popover-foreground: oklch(0.
|
|
15
|
-
--primary: oklch(0.
|
|
16
|
-
--primary-foreground: oklch(0.
|
|
17
|
-
--secondary: oklch(0.
|
|
18
|
-
--secondary-foreground: oklch(0.
|
|
19
|
-
--muted: oklch(0.
|
|
20
|
-
--muted-foreground: oklch(0.
|
|
21
|
-
--accent: oklch(0.
|
|
22
|
-
--accent-foreground: oklch(0.
|
|
14
|
+
--popover-foreground: oklch(0.13 0.028 261.692);
|
|
15
|
+
--primary: oklch(0.60 0.16 230);
|
|
16
|
+
--primary-foreground: oklch(0.9850 0 0);
|
|
17
|
+
--secondary: oklch(0.965 0.007 247.896);
|
|
18
|
+
--secondary-foreground: oklch(0.13 0.028 261.692);
|
|
19
|
+
--muted: oklch(0.965 0.007 247.896);
|
|
20
|
+
--muted-foreground: oklch(0.552 0.016 285.938);
|
|
21
|
+
--accent: oklch(0.965 0.007 247.896);
|
|
22
|
+
--accent-foreground: oklch(0.13 0.028 261.692);
|
|
23
23
|
--destructive: oklch(0.5770 0.2450 27.3250);
|
|
24
24
|
--destructive-foreground: oklch(1 0 0);
|
|
25
|
-
--border: oklch(0.
|
|
26
|
-
--input: oklch(0.
|
|
27
|
-
--ring: oklch(0.
|
|
28
|
-
--
|
|
29
|
-
--
|
|
30
|
-
--
|
|
31
|
-
--
|
|
32
|
-
--
|
|
33
|
-
--sidebar
|
|
34
|
-
--sidebar-
|
|
35
|
-
--sidebar-
|
|
36
|
-
--
|
|
37
|
-
--
|
|
38
|
-
--
|
|
25
|
+
--border: oklch(0.92 0.008 286.32);
|
|
26
|
+
--input: oklch(0.92 0.008 286.32);
|
|
27
|
+
--ring: oklch(0.7 0.015 286.067);
|
|
28
|
+
--chart-1: oklch(0.70 0.16 230);
|
|
29
|
+
--chart-2: oklch(0.60 0.14 210);
|
|
30
|
+
--chart-3: oklch(0.50 0.15 250);
|
|
31
|
+
--chart-4: oklch(0.80 0.10 220);
|
|
32
|
+
--chart-5: oklch(0.40 0.12 240);
|
|
33
|
+
--sidebar: oklch(0.985 0.002 247.839);
|
|
34
|
+
--sidebar-foreground: oklch(0.13 0.028 261.692);
|
|
35
|
+
--sidebar-primary: oklch(0.60 0.16 230);
|
|
36
|
+
--sidebar-primary-foreground: oklch(0.9850 0 0);
|
|
37
|
+
--sidebar-accent: oklch(0.965 0.007 247.896);
|
|
38
|
+
--sidebar-accent-foreground: oklch(0.13 0.028 261.692);
|
|
39
|
+
--sidebar-border: oklch(0.92 0.008 286.32);
|
|
40
|
+
--sidebar-ring: oklch(0.7 0.015 286.067);
|
|
41
|
+
--font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
|
|
42
|
+
--font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
|
|
43
|
+
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
44
|
+
--radius: 0.625rem;
|
|
45
|
+
--shadow-x: 0;
|
|
46
|
+
--shadow-y: 1px;
|
|
47
|
+
--shadow-blur: 3px;
|
|
48
|
+
--shadow-spread: 0px;
|
|
49
|
+
--shadow-opacity: 0.1;
|
|
50
|
+
--shadow-color: oklch(0 0 0);
|
|
51
|
+
--shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
|
52
|
+
--shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
|
53
|
+
--shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
|
|
54
|
+
--shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
|
|
55
|
+
--shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 2px 4px -1px hsl(0 0% 0% / 0.10);
|
|
56
|
+
--shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 4px 6px -1px hsl(0 0% 0% / 0.10);
|
|
57
|
+
--shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 8px 10px -1px hsl(0 0% 0% / 0.10);
|
|
58
|
+
--shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.25);
|
|
59
|
+
--tracking-normal: 0em;
|
|
60
|
+
--spacing: 0.25rem;
|
|
39
61
|
}
|
|
40
62
|
|
|
41
63
|
.dark {
|
|
42
|
-
--background: oklch(0.
|
|
43
|
-
--foreground: oklch(0.985 0
|
|
44
|
-
--card: oklch(0.
|
|
45
|
-
--card-foreground: oklch(0.985 0
|
|
46
|
-
--popover: oklch(0.
|
|
47
|
-
--popover-foreground: oklch(0.985 0
|
|
48
|
-
--primary: oklch(0.
|
|
49
|
-
--primary-foreground: oklch(0.
|
|
50
|
-
--secondary: oklch(0.
|
|
51
|
-
--secondary-foreground: oklch(0.985 0
|
|
52
|
-
--muted: oklch(0.
|
|
53
|
-
--muted-foreground: oklch(0.
|
|
54
|
-
--accent: oklch(0.
|
|
55
|
-
--accent-foreground: oklch(0.985 0
|
|
56
|
-
--destructive: oklch(0.
|
|
57
|
-
--destructive-foreground: oklch(0.985 0
|
|
58
|
-
--border: oklch(0.
|
|
59
|
-
--input: oklch(0.
|
|
60
|
-
--ring: oklch(0.
|
|
61
|
-
--
|
|
62
|
-
--
|
|
63
|
-
--
|
|
64
|
-
--
|
|
65
|
-
--
|
|
66
|
-
--sidebar
|
|
67
|
-
--sidebar-
|
|
68
|
-
--sidebar-
|
|
64
|
+
--background: oklch(0.13 0.028 261.692);
|
|
65
|
+
--foreground: oklch(0.985 0.002 247.839);
|
|
66
|
+
--card: oklch(0.18 0.025 261.692);
|
|
67
|
+
--card-foreground: oklch(0.985 0.002 247.839);
|
|
68
|
+
--popover: oklch(0.24 0.025 261.692);
|
|
69
|
+
--popover-foreground: oklch(0.985 0.002 247.839);
|
|
70
|
+
--primary: oklch(0.70 0.14 230);
|
|
71
|
+
--primary-foreground: oklch(0.1450 0 0);
|
|
72
|
+
--secondary: oklch(0.24 0.025 261.692);
|
|
73
|
+
--secondary-foreground: oklch(0.985 0.002 247.839);
|
|
74
|
+
--muted: oklch(0.24 0.025 261.692);
|
|
75
|
+
--muted-foreground: oklch(0.704 0.015 286.067);
|
|
76
|
+
--accent: oklch(0.34 0.025 261.692);
|
|
77
|
+
--accent-foreground: oklch(0.985 0.002 247.839);
|
|
78
|
+
--destructive: oklch(0.7040 0.1910 22.2160);
|
|
79
|
+
--destructive-foreground: oklch(0.985 0.002 247.839);
|
|
80
|
+
--border: oklch(0.27 0.02 261.692);
|
|
81
|
+
--input: oklch(0.32 0.02 261.692);
|
|
82
|
+
--ring: oklch(0.55 0.016 285.938);
|
|
83
|
+
--chart-1: oklch(0.70 0.16 230);
|
|
84
|
+
--chart-2: oklch(0.60 0.14 210);
|
|
85
|
+
--chart-3: oklch(0.50 0.15 250);
|
|
86
|
+
--chart-4: oklch(0.80 0.10 220);
|
|
87
|
+
--chart-5: oklch(0.40 0.12 240);
|
|
88
|
+
--sidebar: oklch(0.18 0.025 261.692);
|
|
89
|
+
--sidebar-foreground: oklch(0.985 0.002 247.839);
|
|
90
|
+
--sidebar-primary: oklch(0.70 0.14 230);
|
|
91
|
+
--sidebar-primary-foreground: oklch(0.1450 0 0);
|
|
92
|
+
--sidebar-accent: oklch(0.24 0.025 261.692);
|
|
93
|
+
--sidebar-accent-foreground: oklch(0.985 0.002 247.839);
|
|
94
|
+
--sidebar-border: oklch(0.27 0.02 261.692);
|
|
95
|
+
--sidebar-ring: oklch(0.55 0.016 285.938);
|
|
96
|
+
--font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
|
|
97
|
+
--font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
|
|
98
|
+
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
99
|
+
--radius: 0.625rem;
|
|
100
|
+
--shadow-x: 0;
|
|
101
|
+
--shadow-y: 1px;
|
|
102
|
+
--shadow-blur: 3px;
|
|
103
|
+
--shadow-spread: 0px;
|
|
104
|
+
--shadow-opacity: 0.1;
|
|
105
|
+
--shadow-color: oklch(0 0 0);
|
|
106
|
+
--shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
|
107
|
+
--shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
|
|
108
|
+
--shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
|
|
109
|
+
--shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
|
|
110
|
+
--shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 2px 4px -1px hsl(0 0% 0% / 0.10);
|
|
111
|
+
--shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 4px 6px -1px hsl(0 0% 0% / 0.10);
|
|
112
|
+
--shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 8px 10px -1px hsl(0 0% 0% / 0.10);
|
|
113
|
+
--shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.25);
|
|
69
114
|
}
|
|
70
115
|
|
|
71
116
|
@theme inline {
|
|
@@ -88,6 +133,11 @@
|
|
|
88
133
|
--color-border: var(--border);
|
|
89
134
|
--color-input: var(--input);
|
|
90
135
|
--color-ring: var(--ring);
|
|
136
|
+
--color-chart-1: var(--chart-1);
|
|
137
|
+
--color-chart-2: var(--chart-2);
|
|
138
|
+
--color-chart-3: var(--chart-3);
|
|
139
|
+
--color-chart-4: var(--chart-4);
|
|
140
|
+
--color-chart-5: var(--chart-5);
|
|
91
141
|
--color-sidebar: var(--sidebar);
|
|
92
142
|
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
93
143
|
--color-sidebar-primary: var(--sidebar-primary);
|
|
@@ -99,26 +149,60 @@
|
|
|
99
149
|
|
|
100
150
|
--font-sans: var(--font-sans);
|
|
101
151
|
--font-mono: var(--font-mono);
|
|
152
|
+
--font-serif: var(--font-serif);
|
|
102
153
|
|
|
103
154
|
--radius-sm: calc(var(--radius) - 4px);
|
|
104
155
|
--radius-md: calc(var(--radius) - 2px);
|
|
105
156
|
--radius-lg: var(--radius);
|
|
106
157
|
--radius-xl: calc(var(--radius) + 4px);
|
|
158
|
+
|
|
159
|
+
--shadow-2xs: var(--shadow-2xs);
|
|
160
|
+
--shadow-xs: var(--shadow-xs);
|
|
161
|
+
--shadow-sm: var(--shadow-sm);
|
|
162
|
+
--shadow: var(--shadow);
|
|
163
|
+
--shadow-md: var(--shadow-md);
|
|
164
|
+
--shadow-lg: var(--shadow-lg);
|
|
165
|
+
--shadow-xl: var(--shadow-xl);
|
|
166
|
+
--shadow-2xl: var(--shadow-2xl);
|
|
107
167
|
}
|
|
108
168
|
|
|
109
169
|
@layer base {
|
|
110
170
|
* {
|
|
111
171
|
border-color: var(--border);
|
|
112
172
|
}
|
|
173
|
+
|
|
174
|
+
* {
|
|
175
|
+
scrollbar-color: color-mix(in oklch, var(--primary) 42%, var(--border)) transparent;
|
|
176
|
+
scrollbar-width: thin;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
*::-webkit-scrollbar {
|
|
180
|
+
width: 6px;
|
|
181
|
+
height: 6px;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
*::-webkit-scrollbar-track {
|
|
185
|
+
background: transparent;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
*::-webkit-scrollbar-thumb {
|
|
189
|
+
background: color-mix(in oklch, var(--primary) 42%, var(--border));
|
|
190
|
+
border: 1px solid transparent;
|
|
191
|
+
border-radius: 999px;
|
|
192
|
+
background-clip: padding-box;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
*::-webkit-scrollbar-thumb:hover {
|
|
196
|
+
background: var(--primary);
|
|
197
|
+
}
|
|
198
|
+
|
|
113
199
|
body {
|
|
114
200
|
background-color: var(--background);
|
|
115
201
|
color: var(--foreground);
|
|
116
|
-
font-family: var(--font-sans);
|
|
117
|
-
min-height: 100vh;
|
|
118
|
-
margin: 0;
|
|
119
202
|
}
|
|
120
203
|
}
|
|
121
204
|
|
|
205
|
+
|
|
122
206
|
/* --- Shiki Syntax Highlighting Dual Theme --- */
|
|
123
207
|
pre.shiki,
|
|
124
208
|
pre.nikala-code-block {
|
|
@@ -2,10 +2,12 @@ import { splitProps, For, Show, } from "solid-js";
|
|
|
2
2
|
import { SectionHeading } from "@/components/ui/section-heading";
|
|
3
3
|
import { Table, TableHeader, TableBody, TableRow, TableHead, TableCell, } from "@/components/ui/table";
|
|
4
4
|
import { cn } from "@/lib/cn";
|
|
5
|
+
import { useSiteLocale } from "../../plugins/i18n/runtime.jsx";
|
|
5
6
|
/**
|
|
6
7
|
* Clean, structured API reference table component composed from Table and Badge primitives.
|
|
7
8
|
*/
|
|
8
9
|
export const ApiTable = (props) => {
|
|
10
|
+
const siteLocale = useSiteLocale();
|
|
9
11
|
const [local, rest] = splitProps(props, [
|
|
10
12
|
"title",
|
|
11
13
|
"description",
|
|
@@ -24,10 +26,10 @@ export const ApiTable = (props) => {
|
|
|
24
26
|
<Table class="text-xs">
|
|
25
27
|
<TableHeader class="bg-muted/40 font-mono text-[11px] uppercase tracking-wider text-muted-foreground select-none">
|
|
26
28
|
<TableRow class="hover:bg-transparent">
|
|
27
|
-
<TableHead class="h-9 px-4 font-semibold">
|
|
28
|
-
<TableHead class="h-9 px-4 font-semibold">
|
|
29
|
-
<TableHead class="h-9 px-4 font-semibold">
|
|
30
|
-
<TableHead class="h-9 px-4 font-semibold">
|
|
29
|
+
<TableHead class="h-9 px-4 font-semibold">{siteLocale.t("apiTable.property")}</TableHead>
|
|
30
|
+
<TableHead class="h-9 px-4 font-semibold">{siteLocale.t("apiTable.type")}</TableHead>
|
|
31
|
+
<TableHead class="h-9 px-4 font-semibold">{siteLocale.t("apiTable.default")}</TableHead>
|
|
32
|
+
<TableHead class="h-9 px-4 font-semibold">{siteLocale.t("apiTable.description")}</TableHead>
|
|
31
33
|
</TableRow>
|
|
32
34
|
</TableHeader>
|
|
33
35
|
<TableBody class="font-mono text-xs">
|
|
@@ -5,6 +5,7 @@ import { Badge } from "@/components/ui/badge";
|
|
|
5
5
|
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
|
6
6
|
import { Tooltip, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip";
|
|
7
7
|
import { createClipboard } from "@/hooks/create-clipboard";
|
|
8
|
+
import { useSiteLocale } from "../../plugins/i18n/runtime.jsx";
|
|
8
9
|
import { cn } from "@/lib/cn";
|
|
9
10
|
let shikiHighlighterPromise = null;
|
|
10
11
|
async function getShikiHighlighter() {
|
|
@@ -114,6 +115,7 @@ function escapeHtml(str) {
|
|
|
114
115
|
.replace(/'/g, "'");
|
|
115
116
|
}
|
|
116
117
|
export const CodeBlock = (props) => {
|
|
118
|
+
const siteLocale = useSiteLocale();
|
|
117
119
|
const [local, rest] = splitProps(props, [
|
|
118
120
|
"id",
|
|
119
121
|
"code",
|
|
@@ -221,13 +223,13 @@ export const CodeBlock = (props) => {
|
|
|
221
223
|
|
|
222
224
|
<Show when={copyable() && (local.code || cleanCode())}>
|
|
223
225
|
<Tooltip>
|
|
224
|
-
<TooltipTrigger as={Button} variant="ghost" size="icon" onClick={handleCopy} aria-label={clipboard.copied() ? "
|
|
226
|
+
<TooltipTrigger as={Button} variant="ghost" size="icon" onClick={handleCopy} aria-label={clipboard.copied() ? siteLocale.t("code.copied") : siteLocale.t("code.copy")} class="size-6 p-0 rounded-xs text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer">
|
|
225
227
|
<Show when={clipboard.copied()} fallback={<Copy class="size-3.5"/>}>
|
|
226
228
|
<Check class="size-3.5 text-emerald-500 dark:text-emerald-400"/>
|
|
227
229
|
</Show>
|
|
228
230
|
</TooltipTrigger>
|
|
229
231
|
<TooltipContent class="text-[10px] py-1 px-2">
|
|
230
|
-
{clipboard.copied() ? "
|
|
232
|
+
{clipboard.copied() ? siteLocale.t("actions.copied") : siteLocale.t("code.copy")}
|
|
231
233
|
</TooltipContent>
|
|
232
234
|
</Tooltip>
|
|
233
235
|
</Show>
|
|
@@ -238,13 +240,13 @@ export const CodeBlock = (props) => {
|
|
|
238
240
|
<Show when={!hasHeader() && copyable() && (local.code || cleanCode())}>
|
|
239
241
|
<div class="absolute right-2.5 top-2.5 z-10 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100">
|
|
240
242
|
<Tooltip>
|
|
241
|
-
<TooltipTrigger as={Button} variant="outline" size="icon" onClick={handleCopy} aria-label={clipboard.copied() ? "
|
|
243
|
+
<TooltipTrigger as={Button} variant="outline" size="icon" onClick={handleCopy} aria-label={clipboard.copied() ? siteLocale.t("code.copied") : siteLocale.t("code.copy")} 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">
|
|
242
244
|
<Show when={clipboard.copied()} fallback={<Copy class="size-3.5"/>}>
|
|
243
245
|
<Check class="size-3.5 text-emerald-500 dark:text-emerald-400"/>
|
|
244
246
|
</Show>
|
|
245
247
|
</TooltipTrigger>
|
|
246
248
|
<TooltipContent class="text-[10px] py-1 px-2">
|
|
247
|
-
|
|
249
|
+
{clipboard.copied() ? siteLocale.t("actions.copied") : siteLocale.t("code.copy")}
|
|
248
250
|
</TooltipContent>
|
|
249
251
|
</Tooltip>
|
|
250
252
|
</div>
|