Skip to content

Commit 75f0744

Browse files
committed
Merge branch 'main' into feat/custom-pages
2 parents 408f0e3 + 8d0ebb2 commit 75f0744

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+7650
-5932
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
fetch-depth: 0
1818
- uses: actions/setup-node@v4
1919
with:
20-
node-version: '18'
20+
node-version: lts/*
2121
registry-url: https://registry.npmjs.org/
2222
- run: npm i -g @antfu/ni
2323
- run: nci

.github/workflows/smoke.yml

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,55 @@ on:
1414
workflow_dispatch:
1515

1616
jobs:
17+
pack:
18+
timeout-minutes: 10
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Set git to use LF
22+
run: |
23+
git config --global core.autocrlf false
24+
git config --global core.eol lf
25+
26+
- uses: actions/checkout@v4
27+
28+
- name: Use Node.js 20.x
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: 20.x
32+
33+
- name: Setup
34+
run: npm i -g @antfu/ni
35+
36+
- name: Setup PNPM
37+
uses: pnpm/action-setup@v2
38+
39+
- name: Install
40+
run: nci
41+
env:
42+
CYPRESS_INSTALL_BINARY: 0
43+
44+
- name: Build
45+
run: nr build
46+
47+
- name: Pack
48+
run: node ./scripts/pack.mjs /tmp/slidev-pkgs
49+
50+
- name: Upload artifacts
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: slidev-packages
54+
path: /tmp/slidev-pkgs
55+
1756
test:
57+
needs: pack
1858
timeout-minutes: 10
1959
runs-on: ${{ matrix.os }}
2060

2161
strategy:
2262
matrix:
2363
node-version: [18.x]
2464
os: [ubuntu-latest, windows-latest]
25-
pm: [yarn, npm, pnpm]
65+
pm: [npm, pnpm] # yarn not working in this CI
2666
hoist: [true, false]
2767

2868
steps:
@@ -33,10 +73,10 @@ jobs:
3373
3474
- uses: actions/checkout@v4
3575

36-
- name: Use Node.js ${{ matrix.node-version }}
76+
- name: Use Node.js 20.x
3777
uses: actions/setup-node@v4
3878
with:
39-
node-version: ${{ matrix.node-version }}
79+
node-version: 20.x
4080

4181
- name: Setup
4282
run: npm i -g @antfu/ni
@@ -47,15 +87,15 @@ jobs:
4787
- name: Install
4888
run: nci
4989

50-
- name: Build
51-
run: nr build
52-
53-
- name: Pack
54-
run: node ./scripts/pack.mjs ../temp/slidev-pkgs
90+
- name: Download artifacts
91+
uses: actions/download-artifact@v4
92+
with:
93+
name: slidev-packages
94+
path: /tmp/slidev-pkgs
5595

5696
- name: Create new project
5797
run: |
58-
npm i -g ../temp/slidev-pkgs/create-app.tgz
98+
npm i -g /tmp/slidev-pkgs/create-app.tgz
5999
echo "N" | create-slidev ../temp/slidev-project
60100
61101
- name: Remove npmrc
@@ -68,12 +108,12 @@ jobs:
68108
working-directory: ../temp/slidev-project
69109

70110
- name: Install project (npm, pnpm)
71-
run: ${{ matrix.pm }} i ../slidev-pkgs/cli.tgz playwright-chromium
111+
run: ${{ matrix.pm }} i /tmp/slidev-pkgs/cli.tgz playwright-chromium
72112
working-directory: ../temp/slidev-project
73113
if: ${{ matrix.pm != 'yarn' }}
74114

75115
- name: Install project (yarn)
76-
run: yarn add ../slidev-pkgs/cli.tgz playwright-chromium
116+
run: yarn add /tmp/slidev-pkgs/cli.tgz playwright-chromium
77117
working-directory: ../temp/slidev-project
78118
if: ${{ matrix.pm == 'yarn' }}
79119

@@ -92,7 +132,7 @@ jobs:
92132

93133
- name: Install globally
94134
run: |
95-
${{ matrix.pm }} i -g ${{ github.workspace }}/../temp/slidev-pkgs/cli.tgz playwright-chromium
135+
${{ matrix.pm }} i -g /tmp/slidev-pkgs/cli.tgz playwright-chromium
96136
${{ matrix.pm }} i -g @slidev/theme-seriph
97137
if: ${{ matrix.pm != 'yarn' }}
98138

.github/workflows/test.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
strategy:
2020
matrix:
21-
node-version: [16.x, 18.x]
21+
node-version: [lts/*]
2222
os: [ubuntu-latest, windows-latest, macos-latest]
2323
# os: [ubuntu-latest, macos-latest]
2424
fail-fast: false
@@ -57,10 +57,9 @@ jobs:
5757
steps:
5858
- uses: actions/checkout@v4
5959

60-
- name: Use Node.js 18.x
61-
uses: actions/setup-node@v4
60+
- uses: actions/setup-node@v4
6261
with:
63-
node-version: 18.x
62+
node-version: lts/*
6463

6564
- name: Setup
6665
run: npm i -g @antfu/ni

demo/starter/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
"@slidev/theme-default": "^0.25.0",
1414
"@slidev/theme-seriph": "^0.25.0",
1515
"nodemon": "^3.1.0",
16-
"vue": "^3.4.22"
16+
"vue": "^3.4.26"
1717
}
1818
}

demo/vue-runner/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"@slidev/cli": "workspace:*",
1111
"@slidev/theme-default": "^0.25.0",
1212
"@slidev/theme-seriph": "^0.25.0",
13-
"@vue/compiler-sfc": "^3.4.22",
13+
"@vue/compiler-sfc": "^3.4.26",
1414
"nodemon": "^3.1.0",
15-
"vue": "^3.4.22"
15+
"vue": "^3.4.26"
1616
}
1717
}

docs/builtin/components.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,16 @@ Parameters:
272272

273273
See https://sli.dev/guide/animations.html
274274

275+
### `VSwitch`
276+
277+
Switch between multiple slots based on clicks.
278+
279+
See https://sli.dev/guide/animations.html#enter-leave
280+
281+
- If the `unmount` prop is set to `true`, the previous slot will be unmounted when switching to the next slot. Default is `false`.
282+
- Use the `tag` and `childTag` props to change the default tag of the component and its children. Default is `div`.
283+
- Use the `transition` prop to change the transition effect. Default is `false` (disabled).
284+
275285
### `VDrag`
276286

277287
See https://sli.dev/guide/draggable.html

docs/guide/animations.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,24 @@ You can also specify the enter and leave index for the `v-click` directive by pa
194194
<div v-click.hide="[2, 4]">
195195
This will be hidden at click 2 and 3.
196196
</div>
197-
198197
<div v-click />
199198
<div v-click="'[+1, +1]'">
200199
This will be shown at click 3, and hidden since click 4.
201200
</div>
202201
```
203202

203+
You can also use `v-switch` to achieve the same effect:
204+
205+
```md
206+
<v-switch>
207+
<template #1> show at click 1, hide at click 2. </template>
208+
<template #2> show at click 2, hide at click 5. </template>
209+
<template #5-7> show at click 5, hide at click 7. </template>
210+
</v-switch>
211+
```
212+
213+
See [`VSwitch` Component](/builtin/components#vswitch) for more details.
214+
204215
### Custom Total Clicks Count
205216

206217
By default, Slidev counts how many steps are needed before going to the next slide. You can override this setting by passing the `clicks` frontmatter option:

docs/package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "docs",
33
"type": "module",
44
"private": true,
5-
"packageManager": "pnpm@8.15.7",
5+
"packageManager": "pnpm@9.0.6",
66
"scripts": {
77
"dev": "vitepress",
88
"build": "vitepress build",
@@ -11,26 +11,26 @@
1111
"dependencies": {
1212
"@antfu/utils": "^0.7.7",
1313
"@vueuse/core": "^10.9.0",
14-
"typeit": "^8.1.0"
14+
"typeit": "^8.8.3"
1515
},
1616
"devDependencies": {
17-
"@iconify/json": "^2.2.201",
18-
"@shikijs/vitepress-twoslash": "^1.3.0",
17+
"@iconify/json": "^2.2.206",
18+
"@shikijs/vitepress-twoslash": "^1.4.0",
1919
"@slidev/client": "0.34.3",
2020
"@slidev/parser": "0.34.3",
2121
"@slidev/theme-default": "0.21.2",
2222
"@slidev/types": "0.34.3",
2323
"@types/fs-extra": "^11.0.4",
24-
"@types/node": "^20.12.7",
25-
"@unocss/reset": "^0.59.3",
24+
"@types/node": "^20.12.8",
25+
"@unocss/reset": "^0.59.4",
2626
"fs-extra": "^11.2.0",
2727
"markdown-it": "^14.1.0",
28-
"shiki": "^1.3.0",
28+
"shiki": "^1.4.0",
2929
"typescript": "^5.4.5",
30-
"unocss": "^0.59.3",
31-
"unplugin-icons": "^0.18.5",
32-
"unplugin-vue-components": "^0.26.0",
33-
"vite-plugin-inspect": "^0.8.3",
34-
"vitepress": "^1.1.0"
30+
"unocss": "^0.59.4",
31+
"unplugin-icons": "^0.19.0",
32+
"unplugin-vue-components": "^0.27.0",
33+
"vite-plugin-inspect": "^0.8.4",
34+
"vitepress": "^1.1.4"
3535
}
3636
}

package.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"type": "module",
3-
"version": "0.49.0-beta.4",
3+
"version": "0.49.0-beta.6",
44
"private": true,
5-
"packageManager": "pnpm@8.15.7",
5+
"packageManager": "pnpm@9.0.6",
66
"engines": {
77
"node": ">=18.0.0"
88
},
@@ -26,10 +26,10 @@
2626
"test": "vitest test"
2727
},
2828
"devDependencies": {
29-
"@antfu/eslint-config": "^2.14.0",
29+
"@antfu/eslint-config": "^2.16.1",
3030
"@antfu/ni": "^0.21.12",
3131
"@antfu/utils": "^0.7.7",
32-
"@shikijs/markdown-it": "^1.3.0",
32+
"@shikijs/markdown-it": "^1.4.0",
3333
"@slidev/cli": "workspace:*",
3434
"@slidev/parser": "workspace:*",
3535
"@slidev/types": "workspace:*",
@@ -41,37 +41,37 @@
4141
"@types/fs-extra": "^11.0.4",
4242
"@types/js-yaml": "^4.0.9",
4343
"@types/katex": "^0.16.7",
44-
"@types/markdown-it": "^14.0.1",
45-
"@types/node": "^20.12.7",
44+
"@types/markdown-it": "^14.1.1",
45+
"@types/node": "^20.12.8",
4646
"@types/prismjs": "^1.26.3",
4747
"@types/prompts": "^2.4.9",
4848
"@types/recordrtc": "^5.6.14",
4949
"@types/resolve": "^1.20.6",
5050
"@types/semver": "^7.5.8",
5151
"@types/yargs": "^17.0.32",
5252
"@vueuse/core": "^10.9.0",
53-
"bumpp": "^9.4.0",
53+
"bumpp": "^9.4.1",
5454
"cross-env": "^7.0.3",
55-
"cypress": "^13.7.3",
56-
"eslint": "^9.0.0",
57-
"eslint-plugin-format": "^0.1.0",
55+
"cypress": "^13.8.1",
56+
"eslint": "^9.1.1",
57+
"eslint-plugin-format": "^0.1.1",
5858
"esno": "^4.7.0",
5959
"katex": "^0.16.10",
6060
"lint-staged": "^15.2.2",
6161
"mermaid": "^10.9.0",
6262
"playwright-chromium": "^1.43.1",
63-
"pnpm": "^8.15.7",
63+
"pnpm": "^9.0.6",
6464
"prettier-plugin-slidev": "^1.0.5",
6565
"rimraf": "^5.0.5",
66-
"shiki": "^1.3.0",
66+
"shiki": "^1.4.0",
6767
"simple-git-hooks": "^2.11.1",
68-
"taze": "^0.13.5",
68+
"taze": "^0.13.8",
6969
"tsup": "^8.0.2",
7070
"typescript": "^5.4.5",
71-
"vite": "^5.2.9",
72-
"vitest": "^1.5.0",
73-
"vue-tsc": "^2.0.13",
74-
"zx": "^8.0.1"
71+
"vite": "^5.2.11",
72+
"vitest": "^1.5.3",
73+
"vue-tsc": "^2.0.16",
74+
"zx": "^8.0.2"
7575
},
7676
"pnpm": {
7777
"patchedDependencies": {

packages/client/builtin/CodeBlockWrapper.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { computed, onMounted, onUnmounted, ref, watchEffect } from 'vue'
1717
import type { PropType } from 'vue'
1818
import { configs } from '../env'
1919
import { makeId, updateCodeHighlightRange } from '../logic/utils'
20-
import { CLASS_VCLICK_HIDDEN } from '../constants'
20+
import { CLASS_VCLICK_HIDDEN, CLICKS_MAX } from '../constants'
2121
import { useSlideContext } from '../context'
2222
2323
const props = defineProps({
@@ -66,7 +66,7 @@ onMounted(() => {
6666
const clicksInfo = clicks.calculateSince(props.at, props.ranges.length - 1)
6767
clicks.register(id, clicksInfo)
6868
69-
const index = computed(() => Math.max(0, clicks.current - clicksInfo.start + 1))
69+
const index = computed(() => clicksInfo ? Math.max(0, clicks.current - clicksInfo.start + 1) : CLICKS_MAX)
7070
7171
const finallyRange = computed(() => {
7272
return props.finally === 'last' ? props.ranges.at(-1) : props.finally.toString()

0 commit comments

Comments
 (0)