Skip to content

Commit 6c5754b

Browse files
committed
docs: tweaks
1 parent 944e89c commit 6c5754b

File tree

10 files changed

+103
-60
lines changed

10 files changed

+103
-60
lines changed

docs/app.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,7 @@ const links: PageLink[] = [
4848
<TheFooter />
4949

5050
<ClientOnly>
51-
<LazyUContentSearch
52-
:files="files"
53-
:navigation="navigation"
54-
:links="links"
55-
/>
51+
<LazyUContentSearch :files="files" :navigation="navigation ?? undefined" :links="links" />
5652
</ClientOnly>
5753

5854
<UNotifications />

docs/components/content/PresetSection.vue

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const isReplaying = ref(false)
1818
const replayButton = ref<SVGElement>()
1919
const demoElement = ref<HTMLElement>()
2020
21-
const { apply } = useMotion(demoElement, props.preset)
21+
const { apply, set } = useMotion(demoElement, props.preset)
2222
2323
const replayInstance = useMotion(replayButton, {
2424
initial: {
@@ -27,16 +27,16 @@ const replayInstance = useMotion(replayButton, {
2727
})
2828
2929
async function replay() {
30-
if (isReplaying.value)
31-
return
32-
3330
isReplaying.value = true
3431
32+
replayInstance.set({
33+
rotate: 0,
34+
})
3535
replayInstance.apply({
36-
rotate: -360,
36+
rotate: -180,
3737
})
3838
39-
await apply(props.preset.initial)
39+
await set(props.preset.initial)
4040
4141
if (props.preset.visible)
4242
await apply(props.preset.visible)
@@ -47,18 +47,32 @@ async function replay() {
4747
if (props.preset.enter)
4848
await apply(props.preset.enter)
4949
50-
replayInstance.set({ rotate: 0 })
51-
5250
isReplaying.value = false
5351
}
5452
5553
const { data } = await useAsyncData(`preset-${props.name}`, () =>
5654
parseMarkdown(
5755
[
5856
`::code-group`,
59-
`\`\`\`vue [v-motion]\n<template>\n <div v-motion-${slugify(props.name)} />\n</template>\n\`\`\``,
60-
`\`\`\`vue [<Motion />]\n<template>\n <Motion preset="${props.name}" />\n</template>\n\`\`\``,
61-
`\`\`\`json [Preset]\n${JSON.stringify(props.preset, null, 2)}\n\`\`\``,
57+
...[
58+
'```vue [v-motion]',
59+
'<template>',
60+
` <div v-motion-${slugify(props.name)} />`,
61+
'</template>',
62+
'```',
63+
],
64+
...[
65+
'```vue [<Motion />]',
66+
'<template>',
67+
` <Motion preset="${props.name}" />`,
68+
'</template>',
69+
'```',
70+
],
71+
...[
72+
'```json [Preset]',
73+
`${JSON.stringify(props.preset, null, 2)}`,
74+
'```',
75+
],
6276
`::`,
6377
].join('\n'),
6478
))
@@ -76,12 +90,12 @@ const { data } = await useAsyncData(`preset-${props.name}`, () =>
7690
<div class="demoContainer relative">
7791
<client-only>
7892
<button class="absolute right-4 top-4" @click="replay">
79-
<div ref="replayButton">
93+
<div ref="replayButton" class="replayButton">
8094
<Icon name="heroicons-outline:refresh" class="h-6 w-6" />
8195
</div>
8296
</button>
8397
<div ref="demoElement" class="demoElement" @click="replay">
84-
<Face />
98+
<Face v-once />
8599
</div>
86100
</client-only>
87101
</div>
@@ -120,6 +134,12 @@ const { data } = await useAsyncData(`preset-${props.name}`, () =>
120134
border-radius: 16px;
121135
}
122136
137+
.replayButton {
138+
display: flex;
139+
align-items: center;
140+
justify-content: center;
141+
}
142+
123143
.demoElement {
124144
width: 6rem;
125145
}

docs/content/docs/1.getting-started/1.index.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,21 @@ description: Let's get started with `@vueuse/motion`.
1010

1111
Illustration from [Pebble People](https://blush.design/fr/collections/pebble-people) by [Deivid Saenz](https://blush.design/fr/artists/deivid-saenz).
1212

13-
```bash
13+
14+
::code-group
15+
```bash [npm]
16+
npm install @vueuse/motion
17+
```
18+
19+
```bash [yarn]
1420
yarn add @vueuse/motion
1521
```
1622

23+
```bash [pnpm]
24+
pnpm add @vueuse/motion
25+
```
26+
::
27+
1728
## Plugin Installation
1829

1930
If you are planning on using the directives (`v-motion`) from this package, you might want to add the plugin to your Vue instance.

docs/content/docs/1.getting-started/2.nuxt.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,16 @@ It should work with `nuxt3` and `@nuxt/bridge`.
1010

1111
Add `@vueuse/motion/nuxt` to the `modules` section of `nuxt.config.js`:
1212

13-
```javascript
13+
```typescript [nuxt.config.ts]
1414
{
15-
// nuxt.config.js
1615
modules: ['@vueuse/motion/nuxt']
1716
}
1817
```
1918

2019
Then, configure your animations 🤹:
2120

22-
```javascript
21+
```typescript [nuxt.config.ts]
2322
{
24-
// nuxt.config.js
2523
runtimeConfig: {
2624
public: {
2725
motion: {

docs/content/docs/2.features/2.composable-usage.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ import { useMotion } from '@vueuse/motion'
2525
const target = ref<HTMLElement>()
2626
2727
const motionInstance = useMotion(target, {
28-
initial: {
29-
opacity: 0,
30-
y: 100
31-
},
32-
enter: {
33-
opacity: 1,
34-
y: 0
35-
}
28+
initial: {
29+
opacity: 0,
30+
y: 100
31+
},
32+
enter: {
33+
opacity: 1,
34+
y: 0
35+
}
3636
})
3737
</script>
3838
```

docs/content/docs/2.features/3.motion-properties.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ The default unit of the vast majority of attributes will be resolved and appende
1212

1313
```javascript
1414
{
15-
opacity: 0,
16-
scale: 0.6,
17-
y: 100
15+
opacity: 0,
16+
scale: 0.6,
17+
y: 100
1818
}
1919
```
2020

@@ -32,8 +32,8 @@ Some keys are **forbidden** (`transition`, `rotate`, `scale`...) as they are now
3232

3333
```javascript
3434
{
35-
opacity: 0,
36-
marginTop: 10
35+
opacity: 0,
36+
marginTop: 10
3737
}
3838
```
3939

@@ -49,9 +49,9 @@ As an addition, you can use `x`, `y`, `z` properties, that will be converted int
4949

5050
```javascript
5151
{
52-
x: 10,
53-
y: 20,
54-
scale: 1.2
52+
x: 10,
53+
y: 20,
54+
scale: 1.2
5555
}
5656
```
5757

docs/content/docs/2.features/5.variants.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,21 @@ You can create your own variants and apply them using the motion instance.
226226

227227
```vue
228228
<template>
229-
<div v-motion="'customElement'" :initial="{ scale: 1, }" :variants="{ custom:
230-
{ scale: 2, transition: { type: "spring", stiffness: 100 } } }" />
229+
<div
230+
v-motion="'customElement'"
231+
:initial="{
232+
scale: 1,
233+
}"
234+
:variants="{
235+
custom: {
236+
scale: 2,
237+
transition: {
238+
type: "spring",
239+
stiffness: 100
240+
}
241+
}
242+
}"
243+
/>
231244
</template>
232245
233246
<script setup>

docs/content/docs/3.api/3.use-motions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Each values are [Motion Instances](/docs/features/motion-instance) for the named
1818

1919
```vue
2020
<template>
21-
<div v-motion="'myName'">
21+
<div v-motion="'myName'">
2222
</template>
2323
2424
<script setup>

docs/nuxt.config.ts

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,54 @@
1-
import { resolve } from 'node:path'
1+
import { resolve } from "node:path";
22

33
export default defineNuxtConfig({
4-
extends: ['@nuxt/ui-pro'],
4+
extends: ["@nuxt/ui-pro"],
55
features: {
66
devLogs: false,
77
},
88
typescript: {
99
includeWorkspace: true,
1010
},
11-
routeRules: { '/api/search.json': { prerender: true } },
11+
devtools: { enabled: false },
12+
routeRules: { "/api/search.json": { prerender: true } },
1213
vite: {
1314
$client: {
1415
build: {
1516
rollupOptions: {
1617
output: {
17-
chunkFileNames: '_nuxt/[name]-[hash].js',
18-
entryFileNames: '_nuxt/[name]-[hash].js',
18+
chunkFileNames: "_nuxt/[name]-[hash].js",
19+
entryFileNames: "_nuxt/[name]-[hash].js",
1920
},
2021
},
2122
},
2223
},
2324
},
2425

2526
alias: {
26-
'@vueuse/motion': resolve(__dirname, '../src/index.ts'),
27-
'@vueuse/motion/nuxt': resolve(__dirname, '../src/nuxt/module.ts'),
27+
"@vueuse/motion": resolve(__dirname, "../src/index.ts"),
28+
"@vueuse/motion/nuxt": resolve(__dirname, "../src/nuxt/module.ts"),
2829
},
2930
modules: [
30-
'@vueuse/motion/nuxt',
31-
'@nuxt/content',
32-
'@nuxt/ui',
33-
'@nuxtjs/google-fonts',
34-
'nuxt-og-image',
35-
'@nuxt/image',
31+
"@vueuse/motion/nuxt",
32+
"@nuxt/content",
33+
"@nuxt/ui",
34+
"@nuxtjs/google-fonts",
35+
"nuxt-og-image",
36+
"@nuxt/image",
3637
],
3738

38-
uiPro: { license: 'oss' }, // special license for nuxt & nuxt-modules orgs
39+
ui: {
40+
icons: ["simple-icons"],
41+
},
42+
43+
uiPro: { license: "oss" }, // special license for nuxt & nuxt-modules orgs
3944

4045
// Nuxt Content
4146
content: {},
4247

4348
// Fonts
4449
googleFonts: {
45-
display: 'swap',
50+
display: "swap",
4651
download: true,
47-
families: { 'DM+Sans': [400, 500, 600, 700] },
52+
families: { "DM+Sans": [400, 500, 600, 700] },
4853
},
49-
})
54+
});

docs/pages/docs/[...slug].vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const { data: surround } = await useAsyncData(`${route.path}-surround`, () =>
2020
// Page Metadata (SEO & OG)
2121
const { setPageMeta } = usePageMeta()
2222
setPageMeta({
23-
title: page.value.title,
23+
title: page.value.title ?? '',
2424
description: page.value.description,
2525
headline: headline.value,
2626
})

0 commit comments

Comments
 (0)