next-validate-link: add docs

This commit is contained in:
Fuma Nama
2024-11-02 17:28:54 +08:00
parent 750cdc474c
commit 2949da3cba
27 changed files with 525 additions and 963 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-ui': patch
---
Show 'ctrl' for windows in search toggle
+5 -5
View File
@@ -12,7 +12,7 @@
"start": "next start"
},
"dependencies": {
"@oramacloud/client": "^1.3.18",
"@oramacloud/client": "^1.3.19",
"@radix-ui/react-dialog": "^1.1.2",
"@radix-ui/react-popover": "^1.1.2",
"@radix-ui/react-slot": "^1.1.0",
@@ -29,7 +29,7 @@
"geist": "^1.3.1",
"hast-util-to-jsx-runtime": "^2.3.2",
"katex": "^0.16.11",
"lucide-react": "^0.453.0",
"lucide-react": "^0.454.0",
"next": "15.0.2",
"phenomenon": "^1.6.0",
"react": "^18.3.1",
@@ -47,20 +47,20 @@
"zod": "^3.23.8"
},
"devDependencies": {
"@next/env": "15.0.2",
"next-validate-link": "workspace:*",
"@fumadocs/cli": "workspace:*",
"@next/bundle-analyzer": "15.0.2",
"@next/env": "15.0.2",
"@next/eslint-plugin-next": "15.0.2",
"@types/hast": "^3.0.4",
"@types/mdx": "^2.0.13",
"@types/node": "22.8.1",
"@types/node": "22.8.6",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"autoprefixer": "^10.4.20",
"eslint-config-custom": "workspace:*",
"fast-glob": "^3.3.1",
"gray-matter": "^4.0.3",
"next-validate-link": "workspace:*",
"postcss": "^8.4.47",
"tailwindcss": "^3.4.14",
"tailwindcss-animate": "^1.0.7",
+1
View File
@@ -0,0 +1 @@
out
+2 -2
View File
@@ -15,7 +15,7 @@
"fumadocs-docgen": "workspace:*",
"fumadocs-mdx": "workspace:*",
"fumadocs-ui": "workspace:*",
"lucide-react": "^0.453.0",
"lucide-react": "^0.454.0",
"next": "^15.0.2",
"next-validate-link": "workspace:^",
"react": "^18.3.1",
@@ -24,7 +24,7 @@
},
"devDependencies": {
"@types/mdx": "^2.0.13",
"@types/node": "22.8.1",
"@types/node": "22.8.6",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"autoprefixer": "^10.4.20",
+1 -1
View File
@@ -11,7 +11,7 @@
"@fumadocs/content-collections": "workspace:*",
"fumadocs-core": "workspace:*",
"fumadocs-ui": "workspace:*",
"next": "^15.0.1",
"next": "^15.0.2",
"react": "18.3.1",
"react-dom": "18.3.1"
},
+1 -1
View File
@@ -13,7 +13,7 @@
"fumadocs-core": "workspace:*",
"fumadocs-mdx": "workspace:*",
"fumadocs-ui": "workspace:*",
"next": "15.0.1",
"next": "15.0.2",
"react": "18.3.1",
"react-dom": "18.3.1"
},
+1 -1
View File
@@ -11,7 +11,7 @@
"fumadocs-core": "workspace:*",
"fumadocs-mdx": "workspace:*",
"fumadocs-ui": "workspace:*",
"next": "15.0.1",
"next": "15.0.2",
"react": "18.3.1",
"react-dom": "18.3.1"
},
+1 -1
View File
@@ -14,7 +14,7 @@
"fumadocs-mdx": "workspace:*",
"fumadocs-openapi": "workspace:*",
"fumadocs-ui": "workspace:*",
"next": "15.0.1",
"next": "15.0.2",
"postcss": "^8.4.47",
"react": "18.3.1",
"react-dom": "18.3.1",
+1 -1
View File
@@ -11,7 +11,7 @@
"@fumadocs/mdx-remote": "workspace:*",
"fumadocs-core": "workspace:*",
"fumadocs-ui": "workspace:*",
"next": "15.0.1",
"next": "15.0.2",
"react": "18.3.1",
"react-dom": "18.3.1"
},
+3 -3
View File
@@ -18,10 +18,10 @@
},
"devDependencies": {
"@changesets/cli": "^2.27.9",
"@eslint/js": "^9.13.0",
"@eslint/js": "^9.14.0",
"@types/eslint__js": "^8.42.3",
"concurrently": "^9.0.1",
"eslint": "^9.13.0",
"eslint": "^9.14.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "5.1.0-rc-fb9a90fa48-20240614",
"eslint-plugin-tailwindcss": "^3.17.5",
@@ -30,7 +30,7 @@
"tsup": "8.3.5",
"turbo": "2.2.3",
"typescript": "^5.6.3",
"typescript-eslint": "^8.11.0",
"typescript-eslint": "^8.12.2",
"vitest": "^2.1.4"
},
"packageManager": "[email protected]",
+2 -2
View File
@@ -36,14 +36,14 @@
"dependencies": {
"@clack/prompts": "^0.7.0",
"commander": "^12.1.0",
"execa": "^9.5.0",
"execa": "^9.5.1",
"package-manager-detector": "^0.2.2",
"picocolors": "^1.1.1",
"ts-morph": "^24.0.0"
},
"devDependencies": {
"@types/cross-spawn": "^6.0.6",
"@types/node": "22.8.1",
"@types/node": "22.8.6",
"@types/react": "^18.3.12",
"eslint-config-custom": "workspace:*",
"fast-glob": "^3.3.1",
+1 -1
View File
@@ -37,7 +37,7 @@
"devDependencies": {
"@content-collections/core": "^0.7.2",
"@content-collections/mdx": "^0.2.0",
"@types/node": "22.8.1",
"@types/node": "22.8.6",
"eslint-config-custom": "workspace:*",
"fumadocs-core": "workspace:*",
"tsconfig": "workspace:*",
+4 -4
View File
@@ -98,19 +98,19 @@
"devDependencies": {
"@algolia/client-search": "4.24.0",
"@mdx-js/mdx": "^3.1.0",
"@oramacloud/client": "^1.3.18",
"@oramacloud/client": "^1.3.19",
"@types/estree-jsx": "^1.0.5",
"@types/hast": "^3.0.4",
"@types/mdast": "^4.0.3",
"@types/negotiator": "^0.6.3",
"@types/node": "22.8.1",
"@types/node": "22.8.6",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"algoliasearch": "4.24.0",
"eslint-config-custom": "workspace:*",
"mdast-util-mdx-jsx": "^3.1.3",
"mdast-util-mdxjs-esm": "^2.0.1",
"next": "^15.0.0",
"next": "^15.0.2",
"remark-mdx": "^3.1.0",
"remark-rehype": "^11.1.1",
"shiki-transformers": "^1.0.0",
@@ -118,8 +118,8 @@
"unified": "^11.0.5"
},
"peerDependencies": {
"algoliasearch": "4.24.0",
"@oramacloud/client": "1.x.x",
"algoliasearch": "4.24.0",
"next": "14.x.x || 15.x.x",
"react": ">= 18",
"react-dom": ">= 18"
+1 -1
View File
@@ -9,7 +9,7 @@
"@content-collections/mdx": "^0.2.0",
"@content-collections/next": "^0.2.3",
"@types/mdx": "^2.0.13",
"@types/node": "22.8.1",
"@types/node": "22.8.6",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"autoprefixer": "^10.4.20",
+1 -1
View File
@@ -33,7 +33,7 @@
},
"devDependencies": {
"@types/cross-spawn": "^6.0.6",
"@types/node": "22.8.1",
"@types/node": "22.8.6",
"eslint-config-custom": "workspace:*",
"fast-glob": "^3.3.1",
"tsconfig": "workspace:*"
+1 -1
View File
@@ -40,7 +40,7 @@
"@types/estree": "^1.0.6",
"@types/hast": "^3.0.4",
"@types/mdast": "^4.0.3",
"@types/node": "22.8.1",
"@types/node": "22.8.6",
"eslint-config-custom": "workspace:*",
"remark": "^15.0.0",
"tsconfig": "workspace:*",
+1 -1
View File
@@ -72,7 +72,7 @@
"devDependencies": {
"@types/mdx": "^2.0.13",
"@types/micromatch": "^4.0.9",
"@types/node": "22.8.1",
"@types/node": "22.8.6",
"@types/react": "^18.3.12",
"@types/ws": "^8.5.12",
"eslint-config-custom": "workspace:*",
+2 -3
View File
@@ -60,11 +60,10 @@
"@types/react": "^18.3.12",
"eslint-config-custom": "workspace:*",
"fumadocs-core": "workspace:*",
"next": "^15.0.1",
"next": "^15.0.2",
"tsconfig": "workspace:*",
"unified": "^11.0.5",
"vfile": "^6.0.3",
"webpack": "^5.95.0"
"vfile": "^6.0.3"
},
"peerDependencies": {
"fumadocs-core": "^14.0.0",
+1 -1
View File
@@ -3,7 +3,7 @@ import { defineConfig } from 'tsup';
export default defineConfig({
entry: ['./src/{index,loader-mdx}.ts', './src/{config,next}/index.ts'],
format: 'esm',
external: ['webpack', 'next', 'typescript'],
external: ['next', 'typescript'],
dts: true,
target: 'node18',
});
+1 -1
View File
@@ -33,7 +33,7 @@
"unist-util-visit": "^5.0.0"
},
"devDependencies": {
"@types/node": "22.8.1",
"@types/node": "22.8.6",
"eslint-config-custom": "workspace:*",
"tsconfig": "workspace:*"
},
+3 -3
View File
@@ -57,12 +57,12 @@
},
"devDependencies": {
"@types/js-yaml": "^4.0.9",
"@types/node": "22.8.1",
"@types/node": "22.8.6",
"@types/openapi-sampler": "^1.0.3",
"@types/react": "^18.3.12",
"bunchee": "^5.6.0",
"bunchee": "^5.6.1",
"eslint-config-custom": "workspace:*",
"lucide-react": "^0.453.0",
"lucide-react": "^0.454.0",
"next": "15.0.2",
"openapi-types": "^12.1.3",
"tsconfig": "workspace:*"
+1 -1
View File
@@ -46,7 +46,7 @@
"devDependencies": {
"@types/hast": "^3.0.4",
"@types/mdast": "^4.0.3",
"@types/node": "22.8.1",
"@types/node": "22.8.6",
"@types/react": "^18.3.12",
"eslint-config-custom": "workspace:*",
"fumadocs-ui": "workspace:*",
+1 -1
View File
@@ -35,7 +35,7 @@
"types:check": "tsc --noEmit"
},
"dependencies": {
"@types/node": "22.8.1",
"@types/node": "22.8.6",
"fast-glob": "^3.3.1",
"hast-util-to-jsx-runtime": "^2.3.2",
"mdast-util-from-markdown": "^2.0.2",
+2 -2
View File
@@ -81,11 +81,11 @@
},
"devDependencies": {
"@fumadocs/cli": "workspace:*",
"@next/eslint-plugin-next": "^15.0.1",
"@next/eslint-plugin-next": "^15.0.2",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"eslint-config-custom": "workspace:*",
"lucide-react": "^0.453.0",
"lucide-react": "^0.454.0",
"next": "15.0.2",
"postcss": "^8.4.47",
"postcss-cli": "^11.0.0",
@@ -5,9 +5,7 @@ import { useI18n } from '@/contexts/i18n';
import { cn } from '@/utils/cn';
import { buttonVariants } from '@/components/ui/button';
export function SearchToggle(
props: ButtonHTMLAttributes<HTMLButtonElement>,
): React.ReactElement {
export function SearchToggle(props: ButtonHTMLAttributes<HTMLButtonElement>) {
const { setOpenSearch } = useSearchContext();
return (
@@ -33,7 +31,7 @@ export function SearchToggle(
export function LargeSearchToggle(
props: ButtonHTMLAttributes<HTMLButtonElement>,
): React.ReactElement {
) {
const { hotKey, setOpenSearch } = useSearchContext();
const { text } = useI18n();
+24 -5
View File
@@ -1,8 +1,15 @@
import { createContext, useContext, useEffect, useMemo, useState } from 'react';
import {
createContext,
type ReactNode,
useContext,
useEffect,
useMemo,
useState,
} from 'react';
import type { SearchLink, SharedProps } from '@/components/dialog/search';
interface HotKey {
display: React.ReactNode;
display: ReactNode;
/**
* Key code or a function determining whether the key is pressed.
@@ -42,7 +49,7 @@ export interface SearchProviderProps {
*/
options?: Partial<SharedProps>;
children?: React.ReactNode;
children?: ReactNode;
}
interface SearchContextType {
@@ -61,6 +68,18 @@ export function useSearchContext(): SearchContextType {
return useContext(SearchContext);
}
function MetaOrControl() {
const [key, setKey] = useState('⌘');
useEffect(() => {
const isWindows = window.navigator.userAgent.includes('Windows');
if (isWindows) setKey('Ctrl');
}, []);
return key;
}
export function SearchProvider({
SearchDialog,
children,
@@ -69,7 +88,7 @@ export function SearchProvider({
hotKey = [
{
key: (e) => e.metaKey || e.ctrlKey,
display: '⌘',
display: <MetaOrControl />,
},
{
key: 'k',
@@ -81,7 +100,7 @@ export function SearchProvider({
const [isOpen, setIsOpen] = useState(preload ? false : undefined);
useEffect(() => {
const handler = (e: KeyboardEvent): void => {
const handler = (e: KeyboardEvent) => {
if (
hotKey.every((v) =>
typeof v.key === 'string' ? e.key === v.key : v.key(e),
+456 -916
View File
File diff suppressed because it is too large Load Diff