Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 8.3.0 #256

Merged
merged 23 commits into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9bdb49d
UI: Improve Files component
fuma-nama Feb 12, 2024
21cac9e
Update all non-major dependencies to v1.1.2
renovate[bot] Feb 12, 2024
ad9c3b5
Update typescript-eslint monorepo to v7
renovate[bot] Feb 12, 2024
3ff289e
Merge pull request #252 from fuma-nama/renovate/all-minor-patch
fuma-nama Feb 13, 2024
b58fa3b
Merge pull request #253 from fuma-nama/renovate/major-typescript-esli…
fuma-nama Feb 13, 2024
99d66d2
UI: Rename `title` to `name`
fuma-nama Feb 13, 2024
11a19d6
Docs: Update shiki
fuma-nama Feb 13, 2024
0863fca
UI: Improve tailwind css presets
fuma-nama Feb 13, 2024
5e314ee
UI: Deprecate `input` color from Tailwind CSS preset
fuma-nama Feb 13, 2024
b0003d4
UI: Add `purple` theme
fuma-nama Feb 13, 2024
9b422ca
Docs: Fix layout file path
fuma-nama Feb 14, 2024
a9cb54c
Update dependency turbo to v1.12.4
renovate[bot] Feb 14, 2024
68f3483
Merge pull request #254 from fuma-nama/renovate/all-minor-patch
fuma-nama Feb 15, 2024
90cbbc1
Update all non-major dependencies to v1.1.3
renovate[bot] Feb 16, 2024
82c2739
Merge pull request #255 from fuma-nama/renovate/all-minor-patch
fuma-nama Feb 16, 2024
52d578d
UI: Set `darkMode` to `class` by default
fuma-nama Feb 18, 2024
84667d2
UI: Improve styles
fuma-nama Feb 18, 2024
77f4166
Merge branch 'dev' of https://github.com/SonMooSans/next-docs into dev
fuma-nama Feb 18, 2024
ca2ade1
UI: Improve accordions
fuma-nama Feb 18, 2024
441724f
Format
fuma-nama Feb 18, 2024
7ae2297
Add changesets
fuma-nama Feb 18, 2024
14432ec
Version Packages
github-actions[bot] Feb 18, 2024
93a0e8f
Merge pull request #251 from fuma-nama/changeset-release/dev
fuma-nama Feb 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/docs/app/(home)/page.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export function Rain(
export function Previews(): JSX.Element {
return (
<div className="rounded-xl border bg-background p-4 shadow-lg">
<p className="text-medium font-medium">I&apos;m satisfied with it</p>
<p className="text-sm font-medium">I&apos;m satisfied with it</p>

<a
href="https://joulev.dev"
Expand Down
12 changes: 6 additions & 6 deletions apps/docs/app/(home)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
StarsIcon,
TimerIcon,
} from 'lucide-react';
import { File, Files } from 'fumadocs-ui/components/files';
import { File, Files, Folder } from 'fumadocs-ui/components/files';
import Link from 'next/link';
import type { HTMLAttributes, ReactNode } from 'react';
import { cn } from '@/utils/cn';
Expand Down Expand Up @@ -381,11 +381,11 @@ function Introduction(): JSX.Element {
code={code}
/>
<Files className="z-[2] mt-20 shadow-xl">
<File title="content" defaultOpen>
<File title="index.mdx" />
<File title="hello.mdx" />
<File title="components.mdx" />
</File>
<Folder name="content" defaultOpen>
<File name="index.mdx" />
<File name="hello.mdx" />
<File name="components.mdx" />
</Folder>
</Files>
</div>
</div>
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion apps/docs/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './style.css';
import './global.css';
import 'fumadocs-ui/twoslash.css';
import { Star } from 'lucide-react';
import type { Viewport } from 'next';
Expand Down
42 changes: 17 additions & 25 deletions apps/docs/components/code-block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,35 @@ export function CodeBlock({
wrapper,
...props
}: CodeBlockProps): JSX.Element {
const tokens = useMemo(
const html = useMemo(
() =>
highlighter.codeToTokensWithThemes(code, {
highlighter.codeToHtml(code, {
lang,
defaultColor: false,
themes: {
light: 'github-light',
dark: 'github-dark',
},
transformers: [
{
name: 'remove-pre',
root: (root) => {
if (root.children[0].type !== 'element') return;

return {
type: 'root',
children: root.children[0].children,
};
},
},
],
}),
[code, lang],
);

return (
<Base.CodeBlock {...wrapper}>
<Base.Pre {...props}>
<code>
{tokens.map((token, i) => (
// eslint-disable-next-line react/no-array-index-key -- Should not re-render
<span className="line" key={i}>
{token.map((s, j) => (
<span
// eslint-disable-next-line react/no-array-index-key -- Should not re-render
key={j}
style={Object.fromEntries(
Object.entries(s.variants).map(([k, v]) => [
`--shiki-${k}`,
v.color,
]),
)}
>
{s.content}
</span>
))}
</span>
))}
</code>
</Base.Pre>
<Base.Pre {...props} dangerouslySetInnerHTML={{ __html: html }} />
</Base.CodeBlock>
);
}
40 changes: 22 additions & 18 deletions apps/docs/components/preview/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { HomeIcon } from 'lucide-react';
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
import { Callout } from 'fumadocs-ui/components/callout';
import { File, Files } from 'fumadocs-ui/components/files';
import { File, Folder, Files } from 'fumadocs-ui/components/files';
import { ImageZoom } from 'fumadocs-ui/components/image-zoom';
import { InlineTOC } from 'fumadocs-ui/components/inline-toc';
import { RollButton } from 'fumadocs-ui/components/roll-button';
Expand Down Expand Up @@ -90,11 +90,7 @@ export default {
),
accordion: (
<Wrapper>
<Accordions
type="single"
collapsible
className="rounded-xl bg-background px-4"
>
<Accordions type="single" collapsible>
<Accordion id="what-is-fumadocs" title="What is Fumadocs?">
A framework for building documentations
</Accordion>
Expand All @@ -112,17 +108,20 @@ export default {
files: (
<Wrapper>
<Files>
<File title="app" defaultOpen>
<File title="layout.tsx" />
<File title="page.tsx" />
<File title="global.css" />
</File>
<File title="components">
<File title="button.tsx" />
<File title="tabs.tsx" />
<File title="dialog.tsx" />
</File>
<File title="package.json" />
<Folder name="app" defaultOpen>
<Folder name="[id]" defaultOpen>
<File name="page.tsx" />
</Folder>
<File name="layout.tsx" />
<File name="page.tsx" />
<File name="global.css" />
</Folder>
<Folder name="components">
<File name="button.tsx" />
<File name="tabs.tsx" />
<File name="dialog.tsx" />
</Folder>
<File name="package.json" />
</Files>
</Wrapper>
),
Expand Down Expand Up @@ -194,5 +193,10 @@ export default {
</div>
</Wrapper>
),
'roll-button': <RollButton />,
'roll-button': (
<div className="rounded-lg border bg-card p-4 text-muted-foreground">
<p className="text-center text-sm">Scroll down to see the button</p>
<RollButton />
</div>
),
} as Record<string, ReactNode>;
3 changes: 1 addition & 2 deletions apps/docs/components/ui/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ const buttonVariants = cva(
variants: {
variant: {
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
outline:
'border border-input hover:bg-accent hover:text-accent-foreground',
outline: 'border hover:bg-accent hover:text-accent-foreground',
secondary:
'border bg-secondary text-secondary-foreground hover:bg-secondary/80',
ghost: 'hover:bg-accent hover:text-accent-foreground',
Expand Down
30 changes: 18 additions & 12 deletions apps/docs/content/docs/ui/components/files.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,27 @@ preview: 'files'
Wrap file components in `Files`.

```mdx
import { File, Files } from 'fumadocs-ui/components/files';
import { File, Folder, Files } from 'fumadocs-ui/components/files';

<Files>
<File title="app" defaultOpen>
<File title="layout.tsx" />
<File title="page.tsx" />
<File title="global.css" />
</File>
<File title="components">
<File title="button.tsx" />
<File title="tabs.tsx" />
<File title="dialog.tsx" />
</File>
<File title="package.json" />
<Folder name="app" defaultOpen>
<File name="layout.tsx" />
<File name="page.tsx" />
<File name="global.css" />
</Folder>
<Folder name="components">
<File name="button.tsx" />
<File name="tabs.tsx" />
<File name="dialog.tsx" />
</Folder>
<File name="package.json" />
</Files>
```

### File

<AutoTypeTable path="ui" name="FileProps" />

### Folder

<AutoTypeTable path="ui" name="FolderProps" />
2 changes: 1 addition & 1 deletion apps/docs/content/docs/ui/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default function RootLayout({ children }: { children: ReactNode }) {

Create a new catch-all route for our docs, and give it a proper layout.

```tsx title="app/docs/[[...slug]]/layout.tsx"
```tsx title="app/docs/layout.tsx"
import { DocsLayout } from 'fumadocs-ui/layout';
import type { ReactNode } from 'react';

Expand Down
12 changes: 10 additions & 2 deletions apps/docs/content/docs/ui/props.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
import type { Callout } from 'fumadocs-ui/components/callout';
import type { File } from 'fumadocs-ui/components/files';
import type { File, Folder } from 'fumadocs-ui/components/files';
import type { InlineTOC } from 'fumadocs-ui/components/inline-toc';
import type { RollButton } from 'fumadocs-ui/components/roll-button';
import type { TypeTable } from 'fumadocs-ui/components/type-table';
Expand All @@ -26,7 +26,15 @@ export type CalloutProps = Omit<
keyof ComponentPropsWithoutRef<'div'>
>;

export type FileProps = ComponentPropsWithoutRef<typeof File>;
export type FileProps = Omit<
ComponentPropsWithoutRef<typeof File>,
keyof ComponentPropsWithoutRef<'div'>
>;

export type FolderProps = Omit<
ComponentPropsWithoutRef<typeof Folder>,
keyof ComponentPropsWithoutRef<'div'>
>;

export type InlineTOCProps = Omit<
ComponentPropsWithoutRef<typeof InlineTOC>,
Expand Down
50 changes: 3 additions & 47 deletions apps/docs/content/docs/ui/theme.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -63,53 +63,9 @@ The design system was inspired by [Shadcn UI](https://ui.shadcn.com), you can ea
}
```

<Accordions>
<Accordion title="Default Styles">

```css
:root {
--background: 0 0% 100%;
--foreground: 0 0% 3.9%;
--muted: 0 0% 96.1%;
--muted-foreground: 0 0% 45.1%;
--popover: 0 0% 100%;
--popover-foreground: 0 0% 45.1%;
--card: 0 0% 99.7%;
--card-foreground: 0 0% 3.9%;
--border: 0 0% 89.8%;
--input: 0 0% 89.8%;
--primary: 0 0% 9%;
--primary-foreground: 0 0% 98%;
--secondary: 0 0% 96.1%;
--secondary-foreground: 0 0% 9%;
--accent: 0 0% 94.1%;
--accent-foreground: 0 0% 9%;
--ring: 0 0% 63.9%;
}

.dark {
--background: 0 0% 3.9%;
--foreground: 0 0% 98%;
--muted: 0 0% 14.9%;
--muted-foreground: 0 0% 60.9%;
--popover: 0 0% 7%;
--popover-foreground: 0 0% 98%;
--card: 0 0% 8%;
--card-foreground: 0 0% 98%;
--border: 0 0% 18%;
--input: 0 0% 14.9%;
--primary: 0 0% 98%;
--primary-foreground: 0 0% 9%;
--secondary: 0 0% 14.9%;
--secondary-foreground: 0 0% 98%;
--accent: 0 0% 14.9%;
--accent-foreground: 0 0% 98%;
--ring: 0 0% 14.9%;
}
```

</Accordion>
</Accordions>
> Only a subset of colors are provided by Fumadocs UI.
>
> It may not compatible with Shadcn UI.

## DocsUI Plugin

Expand Down
4 changes: 1 addition & 3 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@
},
"dependencies": {
"@next/env": "^14.0.0",
"@radix-ui/react-hover-card": "^1.0.7",
"algoliasearch": "^4.20.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"fast-glob": "^3.3.1",
"fumadocs-core": "workspace:*",
"fumadocs-mdx": "workspace:*",
"fumadocs-twoslash": "workspace:^",
Expand All @@ -31,7 +29,7 @@
"react-dom": "18.2.0",
"rehype-katex": "^7.0.0",
"remark-math": "^6.0.0",
"shiki": "^1.0.0-beta.2",
"shiki": "^1.1.2",
"tailwind-merge": "^2.0.0",
"zod": "^3.22.4"
},
Expand Down
1 change: 0 additions & 1 deletion apps/docs/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const { createPreset } = require('fumadocs-ui/tailwind-plugin');

/** @type {import('tailwindcss').Config} */
module.exports = {
darkMode: 'class',
content: [
'./components/**/*.{ts,tsx}',
'./app/**/*.{ts,tsx}',
Expand Down
6 changes: 3 additions & 3 deletions examples/contentlayer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
},
"dependencies": {
"contentlayer": "0.3.4",
"fumadocs-contentlayer": "1.0.4",
"fumadocs-core": "8.2.0",
"fumadocs-ui": "8.2.0",
"fumadocs-contentlayer": "1.0.5",
"fumadocs-core": "8.3.0",
"fumadocs-ui": "8.3.0",
"next": "14.0.4",
"next-contentlayer": "0.3.4",
"react": "18.2.0",
Expand Down
6 changes: 3 additions & 3 deletions examples/next-mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"start": "next start"
},
"dependencies": {
"fumadocs-core": "8.2.0",
"fumadocs-mdx": "8.0.3",
"fumadocs-ui": "8.2.0",
"fumadocs-core": "8.3.0",
"fumadocs-mdx": "8.0.4",
"fumadocs-ui": "8.3.0",
"next": "14.0.4",
"react": "18.2.0",
"react-dom": "18.2.0"
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
"prettier": "@vercel/style-guide/prettier",
"devDependencies": {
"@changesets/cli": "^2.26.2",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^7.0.0",
"@vercel/style-guide": "^5.1.0",
"concurrently": "^8.2.1",
"prettier": "^3.0.3",
"rimraf": "^5.0.5",
"tsup": "8.0.2",
"turbo": "1.12.3",
"turbo": "1.12.4",
"typescript": "5.3.3",
"vitest": "^1.0.4"
},
Expand Down
6 changes: 6 additions & 0 deletions packages/contentlayer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# fumadocs-contentlayer

## 1.0.5

### Patch Changes

- [email protected]

## 1.0.4

### Patch Changes
Expand Down
Loading
Loading