diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 2c4f002..623b3d9 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -46,7 +46,7 @@ const AdvancedUsage: (DefaultTheme.NavItemWithLink | DefaultTheme.NavItemChildre { text: 'Using metadata from rules', link: '/advanced-usage/rule-metadata' }, { text: 'Rules operators', link: '/advanced-usage/rules-operators' }, { text: 'Validation helpers', link: '/advanced-usage/validations-helpers' }, - { text: 'Usage with Zod', link: '/advanced-usage/usage-with-zod' }, + { text: 'Async validation', link: '/advanced-usage/async-validation' }, ]; const Typescript: (DefaultTheme.NavItemWithLink | DefaultTheme.NavItemChildren)[] = [ @@ -60,6 +60,17 @@ const Typescript: (DefaultTheme.NavItemWithLink | DefaultTheme.NavItemChildren)[ }, ]; +const Integrations: (DefaultTheme.NavItemWithLink | DefaultTheme.NavItemChildren)[] = [ + { + text: 'Nuxt', + link: '/integrations/nuxt', + }, + { + text: 'Zod', + link: '/integrations/zod', + }, +]; + const Examples: DefaultTheme.NavItemWithLink[] = [{ text: 'Simple form example', link: '/examples/simple' }]; const Troubleshooting: DefaultTheme.NavItemWithLink[] = [ @@ -95,7 +106,6 @@ export default defineConfig({ text: 'Introduction', items: [ { text: 'Getting Started', link: '/introduction/' }, - { text: 'Integrations', link: '/introduction/integrations' }, { text: 'Comparisons', link: '/introduction/comparisons' }, ], collapsed: false, @@ -113,17 +123,22 @@ export default defineConfig({ { text: 'Advanced Usage', items: AdvancedUsage, - collapsed: false, + collapsed: true, + }, + { + text: 'Integrations', + items: Integrations, + collapsed: true, }, { text: 'Examples', items: Examples, - collapsed: false, + collapsed: true, }, { text: 'Troubleshooting', items: Troubleshooting, - collapsed: false, + collapsed: true, }, ], socialLinks: [{ icon: 'github', link: 'https://github.com/victorgarciaesgi/regle' }], diff --git a/docs/.vitepress/theme/custom.scss b/docs/.vitepress/theme/custom.scss index 63daaaa..140c457 100644 --- a/docs/.vitepress/theme/custom.scss +++ b/docs/.vitepress/theme/custom.scss @@ -112,6 +112,10 @@ iframe { flex-flow: row wrap; align-items: center; gap: 8px; + + .delete { + cursor: pointer; + } } } } @@ -182,7 +186,7 @@ iframe { .password-strength { margin: 8px 8px 0 8px; - width: 150px; + width: 170px; height: 4px; border-radius: 4px; border: 1px solid var(--vp-c-border); diff --git a/docs/src/advanced-usage/async-validation.md b/docs/src/advanced-usage/async-validation.md new file mode 100644 index 0000000..898c41d --- /dev/null +++ b/docs/src/advanced-usage/async-validation.md @@ -0,0 +1,8 @@ +--- +title: Async validations +--- + + +# Async validation + +TODO \ No newline at end of file diff --git a/docs/src/introduction/integrations.md b/docs/src/integrations/nuxt.md similarity index 66% rename from docs/src/introduction/integrations.md rename to docs/src/integrations/nuxt.md index a797ac4..5f1abca 100644 --- a/docs/src/introduction/integrations.md +++ b/docs/src/integrations/nuxt.md @@ -1,11 +1,9 @@ --- -title: Integrations +title: Nuxt --- -# Integrations - -## Nuxt +# Nuxt Adding the Nuxt module enables auto-imports for selected exports. @@ -58,28 +56,3 @@ The following exports will become globally available in your Nuxt application: - `@regle/zod` (if present) - useZodRegle - - -## Zod - -Regle offers an adapter for [Zod](https://zod.dev/). You can use any zod object schema to validate your state. It offers the same DX as using `@regle/rules`. - -Check [documentation for Zod](/advanced-usage/usage-with-zod) - -::: code-group -```sh [pnpm] -pnpm add @regle/zod -``` - -```sh [npm] -npm install @regle/zod -``` - -```sh [yarn] -yarn add @regle/zod -``` - -```sh [bun] -bun add @regle/zod -``` -::: diff --git a/docs/src/advanced-usage/usage-with-zod.md b/docs/src/integrations/zod.md similarity index 92% rename from docs/src/advanced-usage/usage-with-zod.md rename to docs/src/integrations/zod.md index f1fb7cd..4ff9fe8 100644 --- a/docs/src/advanced-usage/usage-with-zod.md +++ b/docs/src/integrations/zod.md @@ -5,20 +5,17 @@ title: Zod -# Usage with Zod - -## Prerequisites +# Zod -- `zod` version `3` or higher. +Regle offers an adapter for [Zod](https://zod.dev/). You can use any zod object schema to validate your state. It offers the same DX as using `@regle/rules`. +## Prerequisites -## Installation +- `zod` version `3.x` ::: code-group - ```sh [pnpm] pnpm add @regle/zod ``` @@ -37,6 +34,7 @@ bun add @regle/zod ::: + ## Usage @@ -125,3 +123,4 @@ async function submit() { } ``` + diff --git a/docs/src/parts/components/collections/AccessingCurrentItemState.vue b/docs/src/parts/components/collections/AccessingCurrentItemState.vue index fc548c0..789a39b 100644 --- a/docs/src/parts/components/collections/AccessingCurrentItemState.vue +++ b/docs/src/parts/components/collections/AccessingCurrentItemState.vue @@ -14,7 +14,7 @@ -
+
🗑️