shapes-ui 0.4.2 → 0.6.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/.github/ISSUE_TEMPLATE/bug_report.yml +47 -0
- package/.github/ISSUE_TEMPLATE/config.yml +1 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +31 -0
- package/.github/pull_request_template.md +14 -0
- package/.github/workflows/pr-preview.yml +75 -0
- package/.github/workflows/release.yml +8 -0
- package/CHANGELOG.md +30 -0
- package/CODE_OF_CONDUCT.md +41 -0
- package/CONTRIBUTING.md +52 -0
- package/README.md +18 -0
- package/SECURITY.md +0 -0
- package/content/components/accordion.mdx +13 -0
- package/content/components/alert-dialog.mdx +34 -0
- package/content/components/autocomplete.mdx +62 -0
- package/content/components/avatar.mdx +11 -0
- package/content/components/button.mdx +8 -0
- package/content/components/checkbox.mdx +11 -0
- package/content/components/collapsible.mdx +11 -0
- package/content/components/combobox.mdx +33 -0
- package/content/components/context-menu.mdx +29 -0
- package/content/components/dialog.mdx +33 -0
- package/content/components/drawer.mdx +38 -0
- package/content/components/field.mdx +23 -2
- package/content/components/fieldset.mdx +11 -1
- package/content/components/form.mdx +8 -0
- package/content/components/input.mdx +4 -0
- package/content/components/menu.mdx +27 -0
- package/content/components/menubar.mdx +31 -0
- package/content/components/meter.mdx +14 -0
- package/content/components/navigation-menu.mdx +28 -0
- package/content/components/number-field.mdx +25 -0
- package/content/components/popover.mdx +22 -0
- package/content/components/preview-card.mdx +14 -2
- package/content/components/progress.mdx +15 -1
- package/content/components/radio.mdx +31 -0
- package/content/components/scroll-area.mdx +23 -0
- package/content/components/select.mdx +57 -0
- package/content/components/separator.mdx +29 -0
- package/content/components/slider.mdx +52 -0
- package/content/components/switch.mdx +30 -0
- package/content/components/tabs.mdx +47 -0
- package/content/components/toast.mdx +70 -0
- package/content/components/toggle-group.mdx +37 -0
- package/content/components/toggle.mdx +46 -2
- package/content/components/toolbar.mdx +48 -0
- package/content/components/tooltip.mdx +38 -0
- package/content/docs/installation.mdx +30 -0
- package/content-collections.ts +65 -1
- package/dist/cli.js +947 -101
- package/examples/__index.tsx +320 -66
- package/examples/autocomplete-align.tsx +39 -0
- package/examples/autocomplete-controlled.tsx +44 -0
- package/examples/autocomplete-groups.tsx +65 -0
- package/examples/autocomplete-no-clear.tsx +40 -0
- package/examples/avatar-demo.tsx +3 -3
- package/examples/checkbox-demo.tsx +1 -1
- package/examples/checkbox-form.tsx +3 -3
- package/examples/field-custom-control.tsx +33 -9
- package/examples/form-demo.tsx +5 -10
- package/examples/input-group-with-button.tsx +1 -1
- package/examples/menu-advanced.tsx +1 -3
- package/examples/menu-align.tsx +19 -16
- package/examples/menu-checkbox.tsx +2 -3
- package/examples/menu-demo.tsx +1 -3
- package/examples/menu-group.tsx +1 -3
- package/examples/menu-radio.tsx +1 -3
- package/examples/menu-submenu.tsx +2 -3
- package/examples/meter-demo.tsx +10 -2
- package/examples/meter-flip.tsx +8 -8
- package/examples/meter-no-label.tsx +9 -2
- package/examples/meter-no-value.tsx +7 -8
- package/examples/radio-card.tsx +28 -0
- package/examples/radio-demo.tsx +19 -1
- package/examples/radio-description.tsx +26 -0
- package/examples/radio-orientation.tsx +21 -0
- package/examples/select-alignment.tsx +51 -0
- package/examples/select-demo.tsx +36 -1
- package/examples/select-disabled.tsx +38 -0
- package/examples/select-groups.tsx +54 -0
- package/examples/select-invalid.tsx +41 -0
- package/examples/select-scrollable.tsx +112 -0
- package/examples/separator-demo.tsx +13 -0
- package/examples/separator-horizontal.tsx +18 -0
- package/examples/slider-controlled.tsx +28 -0
- package/examples/slider-demo.tsx +3 -1
- package/examples/slider-disabled.tsx +7 -0
- package/examples/slider-edge.tsx +13 -0
- package/examples/slider-multiple.tsx +7 -0
- package/examples/slider-range.tsx +5 -0
- package/examples/slider-vertical.tsx +10 -0
- package/examples/switch-demo.tsx +19 -1
- package/examples/switch-disabled.tsx +20 -0
- package/examples/switch-sizes.tsx +24 -0
- package/examples/switch-with-label.tsx +16 -0
- package/examples/tabs-demo.tsx +14 -1
- package/examples/tabs-disabled.tsx +21 -0
- package/examples/tabs-line.tsx +18 -0
- package/examples/tabs-vertical.tsx +13 -0
- package/examples/toast-action.tsx +39 -0
- package/examples/toast-anchored.tsx +36 -0
- package/examples/toast-demo.tsx +27 -1
- package/examples/toast-positions.tsx +54 -0
- package/examples/toast-promise.tsx +51 -0
- package/examples/toast-stacked.tsx +30 -0
- package/examples/toast-timeout.tsx +43 -0
- package/examples/toast-update.tsx +38 -0
- package/examples/toast-variants.tsx +54 -0
- package/examples/toggle-controlled.tsx +20 -0
- package/examples/toggle-demo.tsx +7 -51
- package/examples/toggle-group-demo.tsx +19 -0
- package/examples/toggle-group-multiple.tsx +19 -0
- package/examples/toggle-icon-fill.tsx +12 -0
- package/examples/toolbar-demo.tsx +45 -21
- package/examples/toolbar-input-link.tsx +35 -0
- package/examples/toolbar-menu.tsx +53 -0
- package/examples/tooltip-demo.tsx +48 -0
- package/examples/tooltip-positions.tsx +60 -0
- package/package.json +19 -18
- package/public/base-ui.svg +1 -0
- package/public/r/drawer.json +1 -1
- package/public/r/field.json +1 -1
- package/public/r/meter.json +1 -1
- package/public/r/number-field.json +1 -1
- package/public/r/progress.json +1 -1
- package/public/r/radio.json +1 -1
- package/public/r/select.json +1 -1
- package/public/r/slider.json +1 -1
- package/public/r/switch.json +1 -1
- package/public/r/tabs.json +1 -1
- package/public/r/toast.json +2 -1
- package/public/r/toggle.json +1 -1
- package/public/r/toolbar.json +1 -1
- package/public/r/tooltip.json +15 -0
- package/src/assets/base-ui.svg +1 -0
- package/src/commands/add.ts +79 -38
- package/src/commands/cli.ts +50 -3
- package/src/commands/create.ts +262 -0
- package/src/commands/init.ts +45 -12
- package/src/commands/palette.ts +55 -0
- package/src/components/docs/layout/footer.tsx +2 -2
- package/src/components/docs/layout/header.tsx +7 -19
- package/src/components/docs/layout/mobile-menu.tsx +26 -78
- package/src/components/docs/layout/nav-list.tsx +27 -21
- package/src/components/docs/layout/page-header.tsx +52 -7
- package/src/components/docs/layout/split-layout.tsx +11 -9
- package/src/components/docs/layout/table-of-content.tsx +145 -0
- package/src/components/docs/markdown/components.tsx +142 -29
- package/src/components/docs/markdown/copy-button.tsx +41 -0
- package/src/components/docs/markdown/installation-block.tsx +5 -24
- package/src/components/docs/markdown/render-preview.tsx +1 -1
- package/src/components/ui/badge.tsx +1 -1
- package/src/components/ui/button-group.tsx +1 -1
- package/src/components/ui/checkbox.tsx +1 -1
- package/src/components/ui/drawer.tsx +1 -1
- package/src/components/ui/field.tsx +9 -28
- package/src/components/ui/form.tsx +1 -1
- package/src/components/ui/meter.tsx +12 -26
- package/src/components/ui/number-field.tsx +1 -1
- package/src/components/ui/radio.tsx +32 -19
- package/src/components/ui/scroll-area.tsx +11 -2
- package/src/components/ui/select.tsx +6 -6
- package/src/components/ui/slider.tsx +8 -5
- package/src/components/ui/switch.tsx +13 -17
- package/src/components/ui/tabs.tsx +23 -10
- package/src/components/ui/toast.tsx +190 -29
- package/src/components/ui/toggle.tsx +1 -1
- package/src/components/ui/toolbar.tsx +17 -4
- package/src/components/ui/tooltip.tsx +54 -0
- package/src/lib/docs-headings.ts +72 -0
- package/src/routeTree.gen.ts +60 -3
- package/src/routes/__root.tsx +3 -5
- package/src/routes/components.$slug.tsx +20 -4
- package/src/routes/docs.$slug.tsx +78 -0
- package/src/routes/docs.tsx +15 -0
- package/src/styles/styles.css +1 -1
- package/src/utils/cli-utils.ts +8 -8
- package/src/utils/dependency-installer.ts +30 -0
- package/src/utils/package-manager.ts +4 -4
- package/src/utils/palette.ts +666 -0
- package/src/utils/schema.ts +6 -0
|
@@ -3,3 +3,73 @@ title: Toast
|
|
|
3
3
|
slug: toast
|
|
4
4
|
description: A brief message that appears temporarily to inform users of an action or event.
|
|
5
5
|
---
|
|
6
|
+
|
|
7
|
+
<RenderPreview name="toast-demo" />
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
<InstallationBlock name="toast" />
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
<UsageSection
|
|
16
|
+
from="@/components/ui/toast"
|
|
17
|
+
imports={["Toast", "ToastProvider", "globalToast", "useToast"]}
|
|
18
|
+
anatomy={`<ToastProvider>
|
|
19
|
+
<Toast />
|
|
20
|
+
</ToastProvider>;`}
|
|
21
|
+
/>
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
### Positions
|
|
26
|
+
|
|
27
|
+
Set `position` on `Toast` to choose where toasts appear in the viewport.
|
|
28
|
+
|
|
29
|
+
<RenderPreview name="toast-positions" />
|
|
30
|
+
|
|
31
|
+
### Stacking
|
|
32
|
+
|
|
33
|
+
Toasts now stack with collapsed and expanded behavior based on Base UI's stack attributes.
|
|
34
|
+
|
|
35
|
+
<RenderPreview name="toast-stacked" />
|
|
36
|
+
|
|
37
|
+
### Anchored
|
|
38
|
+
|
|
39
|
+
Pass `positionerProps` to `useToast().add` to anchor a toast to another element.
|
|
40
|
+
|
|
41
|
+
<RenderPreview name="toast-anchored" />
|
|
42
|
+
|
|
43
|
+
### Variants
|
|
44
|
+
|
|
45
|
+
Use toast `type` to style default, success, and error notifications.
|
|
46
|
+
|
|
47
|
+
<RenderPreview name="toast-variants" />
|
|
48
|
+
|
|
49
|
+
### Action
|
|
50
|
+
|
|
51
|
+
Use `actionProps` to render an inline action button like Undo.
|
|
52
|
+
|
|
53
|
+
<RenderPreview name="toast-action" />
|
|
54
|
+
|
|
55
|
+
### Promise
|
|
56
|
+
|
|
57
|
+
Show loading, success, and error states around async work with `useToast().promise`.
|
|
58
|
+
|
|
59
|
+
<RenderPreview name="toast-promise" />
|
|
60
|
+
|
|
61
|
+
### Update Existing Toast
|
|
62
|
+
|
|
63
|
+
Create a toast and then update it as the action progresses.
|
|
64
|
+
|
|
65
|
+
<RenderPreview name="toast-update" />
|
|
66
|
+
|
|
67
|
+
### Custom Timeout
|
|
68
|
+
|
|
69
|
+
Control auto-dismiss timing with the `timeout` option.
|
|
70
|
+
|
|
71
|
+
<RenderPreview name="toast-timeout" />
|
|
72
|
+
|
|
73
|
+
### Default
|
|
74
|
+
|
|
75
|
+
<RenderPreview name="toast-demo" />
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Toggle Group
|
|
3
|
+
slug: toggle-group
|
|
4
|
+
description: A grouped set of toggles for single or multiple selection.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<RenderPreview name="toggle-group-demo" />
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
<InstallationBlock name="toggle" />
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
<UsageSection
|
|
16
|
+
from="@/components/ui/toggle"
|
|
17
|
+
imports={["Toggle", "ToggleGroup", "toggleVariants"]}
|
|
18
|
+
anatomy={`<ToggleGroup>
|
|
19
|
+
<Toggle value="left" />
|
|
20
|
+
<Toggle value="center" />
|
|
21
|
+
<Toggle value="right" />
|
|
22
|
+
</ToggleGroup>;`}
|
|
23
|
+
/>
|
|
24
|
+
|
|
25
|
+
## Examples
|
|
26
|
+
|
|
27
|
+
### Single
|
|
28
|
+
|
|
29
|
+
Use `ToggleGroup` for an exclusive selection.
|
|
30
|
+
|
|
31
|
+
<RenderPreview name="toggle-group-demo" />
|
|
32
|
+
|
|
33
|
+
### Multiple
|
|
34
|
+
|
|
35
|
+
Set `multiple` on `ToggleGroup` to allow selecting more than one option.
|
|
36
|
+
|
|
37
|
+
<RenderPreview name="toggle-group-multiple" />
|
|
@@ -4,8 +4,52 @@ slug: toggle
|
|
|
4
4
|
description: A button that can be toggled between two states.
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
<RenderPreview
|
|
7
|
+
<RenderPreview name="toggle-demo" />
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
|
-
<InstallationBlock
|
|
11
|
+
<InstallationBlock name="toggle" />
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
<UsageSection
|
|
16
|
+
from="@/components/ui/toggle"
|
|
17
|
+
imports={["Toggle", "toggleVariants", "ToggleGroup"]}
|
|
18
|
+
anatomy={`<ToggleGroup>
|
|
19
|
+
<Toggle value="left" />
|
|
20
|
+
<Toggle value="center" />
|
|
21
|
+
<Toggle value="right" />
|
|
22
|
+
</ToggleGroup>;`}
|
|
23
|
+
/>
|
|
24
|
+
|
|
25
|
+
## Examples
|
|
26
|
+
|
|
27
|
+
### Toggle
|
|
28
|
+
|
|
29
|
+
Use `Toggle` for a single on/off state.
|
|
30
|
+
|
|
31
|
+
<RenderPreview name="toggle-demo" />
|
|
32
|
+
|
|
33
|
+
### Controlled Toggle
|
|
34
|
+
|
|
35
|
+
Control the pressed state externally with `pressed` and `onPressedChange`.
|
|
36
|
+
|
|
37
|
+
<RenderPreview name="toggle-controlled" />
|
|
38
|
+
|
|
39
|
+
### Icon Fill on Press
|
|
40
|
+
|
|
41
|
+
Add `data-slot="fill"` to a child icon to fill it when the toggle is pressed.
|
|
42
|
+
|
|
43
|
+
<RenderPreview name="toggle-icon-fill" />
|
|
44
|
+
|
|
45
|
+
### Toggle Group (Single)
|
|
46
|
+
|
|
47
|
+
Use `ToggleGroup` with `value` on each `Toggle` to create an exclusive selection.
|
|
48
|
+
|
|
49
|
+
<RenderPreview name="toggle-group-demo" />
|
|
50
|
+
|
|
51
|
+
### Toggle Group (Multiple)
|
|
52
|
+
|
|
53
|
+
Set `multiple` on `ToggleGroup` to allow more than one pressed toggle.
|
|
54
|
+
|
|
55
|
+
<RenderPreview name="toggle-group-multiple" />
|
|
@@ -3,3 +3,51 @@ title: Toolbar
|
|
|
3
3
|
slug: toolbar
|
|
4
4
|
description: A collection of buttons and controls organized in a horizontal bar.
|
|
5
5
|
---
|
|
6
|
+
|
|
7
|
+
<RenderPreview name="toolbar-demo" />
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
<InstallationBlock name="toolbar" />
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
<UsageSection
|
|
16
|
+
from="@/components/ui/toolbar"
|
|
17
|
+
imports={[
|
|
18
|
+
"Toolbar",
|
|
19
|
+
"ToolbarButton",
|
|
20
|
+
"ToolbarLink",
|
|
21
|
+
"ToolbarInput",
|
|
22
|
+
"ToolbarGroup",
|
|
23
|
+
"ToolbarSeparator",
|
|
24
|
+
]}
|
|
25
|
+
anatomy={`<Toolbar>
|
|
26
|
+
<ToolbarGroup>
|
|
27
|
+
<ToolbarButton />
|
|
28
|
+
<ToolbarSeparator />
|
|
29
|
+
<ToolbarLink />
|
|
30
|
+
</ToolbarGroup>
|
|
31
|
+
<ToolbarInput />
|
|
32
|
+
</Toolbar>;`}
|
|
33
|
+
/>
|
|
34
|
+
|
|
35
|
+
## Examples
|
|
36
|
+
|
|
37
|
+
### Demo
|
|
38
|
+
|
|
39
|
+
A simple formatting toolbar with grouped actions and separators.
|
|
40
|
+
|
|
41
|
+
<RenderPreview name="toolbar-demo" />
|
|
42
|
+
|
|
43
|
+
### With Menu
|
|
44
|
+
|
|
45
|
+
Use `render` on `ToolbarButton` with a menu trigger to compose popup controls in the toolbar.
|
|
46
|
+
|
|
47
|
+
<RenderPreview name="toolbar-menu" />
|
|
48
|
+
|
|
49
|
+
### Input and Link
|
|
50
|
+
|
|
51
|
+
A toolbar with a single trailing input and status link.
|
|
52
|
+
|
|
53
|
+
<RenderPreview name="toolbar-input-link" />
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Tooltip
|
|
3
|
+
slug: tooltip
|
|
4
|
+
description: A popup that appears when an element is hovered or focused, showing a hint for sighted users.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<RenderPreview name="tooltip-demo" />
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
<InstallationBlock name="tooltip" />
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
<UsageSection
|
|
16
|
+
from="@/components/ui/tooltip"
|
|
17
|
+
imports={["Tooltip", "TooltipTrigger", "TooltipPopup", "TooltipProvider"]}
|
|
18
|
+
anatomy={`<TooltipProvider>
|
|
19
|
+
<Tooltip>
|
|
20
|
+
<TooltipTrigger />
|
|
21
|
+
<TooltipPopup />
|
|
22
|
+
</Tooltip>
|
|
23
|
+
</TooltipProvider>;`}
|
|
24
|
+
/>
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
### Demo
|
|
29
|
+
|
|
30
|
+
A simple tooltip with multiple icon buttons and different messages.
|
|
31
|
+
|
|
32
|
+
<RenderPreview name="tooltip-demo" />
|
|
33
|
+
|
|
34
|
+
### Positions
|
|
35
|
+
|
|
36
|
+
Position tooltips on different sides relative to the trigger element.
|
|
37
|
+
|
|
38
|
+
<RenderPreview name="tooltip-positions" />
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Installation
|
|
3
|
+
slug: installation
|
|
4
|
+
description: Set up Shapes UI in your React project.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- React project
|
|
10
|
+
- Tailwind CSS v4
|
|
11
|
+
|
|
12
|
+
## Quick start
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx shapes-ui init
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
During setup, you can choose a brand palette and contrast mode. Shapes will generate semantic color tokens in your configured CSS file and keep them inside a managed block.
|
|
19
|
+
|
|
20
|
+
## Create with full setup
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx shapes-ui create my-app --full --palette emerald --contrast-mode deterministic
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Update palette later
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx shapes-ui palette set blue --contrast-mode dynamic
|
|
30
|
+
```
|
package/content-collections.ts
CHANGED
|
@@ -4,6 +4,8 @@ import rehypePrettyCode from "rehype-pretty-code";
|
|
|
4
4
|
import remarkGfm from "remark-gfm";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
|
|
7
|
+
import { extractHeadingsFromMarkdown } from "./src/lib/docs-headings";
|
|
8
|
+
|
|
7
9
|
const components = defineCollection({
|
|
8
10
|
name: "components",
|
|
9
11
|
directory: "content/components",
|
|
@@ -13,6 +15,67 @@ const components = defineCollection({
|
|
|
13
15
|
slug: z.string(),
|
|
14
16
|
description: z.string().optional(),
|
|
15
17
|
content: z.string(),
|
|
18
|
+
referenceLink: z.string().optional(),
|
|
19
|
+
}),
|
|
20
|
+
transform: async (document, context) => {
|
|
21
|
+
const mdx = await compileMDX(context, document, {
|
|
22
|
+
files: (appender) => {
|
|
23
|
+
appender.file(
|
|
24
|
+
"@/components/docs/markdown/render-preview",
|
|
25
|
+
"./src/components/docs/markdown/render-preview.tsx",
|
|
26
|
+
);
|
|
27
|
+
},
|
|
28
|
+
remarkPlugins: [remarkGfm],
|
|
29
|
+
rehypePlugins: [
|
|
30
|
+
[
|
|
31
|
+
rehypePrettyCode,
|
|
32
|
+
{
|
|
33
|
+
theme: {
|
|
34
|
+
light: "github-light",
|
|
35
|
+
dark: "github-dark",
|
|
36
|
+
},
|
|
37
|
+
keepBackground: false,
|
|
38
|
+
transformers: [
|
|
39
|
+
{
|
|
40
|
+
name: "line-numbers",
|
|
41
|
+
pre(node: any) {
|
|
42
|
+
node.properties["data-line-numbers"] = "";
|
|
43
|
+
},
|
|
44
|
+
line(node: any, line: number) {
|
|
45
|
+
node.properties.className = ["line"];
|
|
46
|
+
node.children.unshift({
|
|
47
|
+
type: "element",
|
|
48
|
+
tagName: "span",
|
|
49
|
+
properties: {
|
|
50
|
+
className: ["line-number"],
|
|
51
|
+
},
|
|
52
|
+
children: [{ type: "text", value: String(line) }],
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
],
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
...document,
|
|
63
|
+
mdx,
|
|
64
|
+
toc: extractHeadingsFromMarkdown(document.content),
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const docs = defineCollection({
|
|
70
|
+
name: "docs",
|
|
71
|
+
directory: "content/docs",
|
|
72
|
+
include: "*.mdx",
|
|
73
|
+
schema: z.object({
|
|
74
|
+
title: z.string(),
|
|
75
|
+
slug: z.string(),
|
|
76
|
+
description: z.string().optional(),
|
|
77
|
+
content: z.string(),
|
|
78
|
+
referenceLink: z.string().optional(),
|
|
16
79
|
}),
|
|
17
80
|
transform: async (document, context) => {
|
|
18
81
|
const mdx = await compileMDX(context, document, {
|
|
@@ -58,10 +121,11 @@ const components = defineCollection({
|
|
|
58
121
|
return {
|
|
59
122
|
...document,
|
|
60
123
|
mdx,
|
|
124
|
+
toc: extractHeadingsFromMarkdown(document.content),
|
|
61
125
|
};
|
|
62
126
|
},
|
|
63
127
|
});
|
|
64
128
|
|
|
65
129
|
export default defineConfig({
|
|
66
|
-
|
|
130
|
+
content: [components, docs],
|
|
67
131
|
});
|