slidev-theme-kotlin 0.0.7 → 0.0.9
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/CHANGELOG.md +15 -0
- package/README.md +6 -4
- package/components/Kodee.vue +31 -27
- package/package.json +16 -5
- package/styles/layout.css +6 -0
- package/.github/workflows/pages.yml +0 -54
- package/example.md +0 -220
- /package/{public → assets}/kodee-drinking.svg +0 -0
- /package/{public → assets}/kodee-greeting.svg +0 -0
- /package/{public → assets}/kodee-heart.svg +0 -0
- /package/{public → assets}/kodee-in-love.svg +0 -0
- /package/{public → assets}/kodee-jumping.svg +0 -0
- /package/{public → assets}/kodee-sitting.svg +0 -0
- /package/{public → assets}/kodee-tiny.svg +0 -0
- /package/{public → assets}/kodee-wave.svg +0 -0
- /package/{public → assets}/kodee-welcome.svg +0 -0
- /package/{public → assets}/kodee-wink.svg +0 -0
- /package/{public → assets}/kodee-winter.svg +0 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.0.9
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Bundle Kodee SVG variants with the theme instead of serving them from the theme package's `public/` directory.
|
|
8
|
+
|
|
9
|
+
Previously, `Kodee.vue` generated runtime URLs such as `/theme/kodee-welcome.svg` and relied on Slidev to copy a consuming theme's `public/` directory into the presentation output. That copying behavior did not work with newer Slidev/Vite versions (including Slidev 52.19 and Vite 8), so consumer builds omitted `dist/theme/kodee-*.svg`; Kodee images then returned 404s in the browser.
|
|
10
|
+
|
|
11
|
+
Kodee assets now live in `assets/` and are imported by Vite at build time. Consumer presentations receive emitted, fingerprinted asset URLs, independent of Slidev's theme-public-directory copying behavior.
|
|
12
|
+
|
|
13
|
+
### Packaging
|
|
14
|
+
|
|
15
|
+
- Added an npm `files` allowlist so the bundled mascot assets are always included in the published theme package.
|
package/README.md
CHANGED
|
@@ -35,6 +35,7 @@ Add the theme to your slides' frontmatter:
|
|
|
35
35
|
```yaml
|
|
36
36
|
---
|
|
37
37
|
theme: kotlin
|
|
38
|
+
transition: view-transition
|
|
38
39
|
---
|
|
39
40
|
|
|
40
41
|
# Your Presentation Title
|
|
@@ -113,9 +114,9 @@ npm run export
|
|
|
113
114
|
npm run screenshot
|
|
114
115
|
```
|
|
115
116
|
|
|
116
|
-
### Running the
|
|
117
|
+
### Running the Slides
|
|
117
118
|
|
|
118
|
-
The repository includes `
|
|
119
|
+
The repository includes `slides.md`, a compact presentation demonstrating the theme's layouts, Kotlin highlighting, Kodee animations, magic moves, and click animations:
|
|
119
120
|
|
|
120
121
|
```bash
|
|
121
122
|
npm run dev
|
|
@@ -134,8 +135,9 @@ This will open the example presentation in your browser with hot-reload enabled.
|
|
|
134
135
|
│ ├── cover.vue # Cover slide layout
|
|
135
136
|
│ ├── default.vue # Default slide layout
|
|
136
137
|
│ └── intro.vue # Introduction slide layout
|
|
138
|
+
├── assets/ # Bundled theme assets
|
|
139
|
+
│ └── kodee-*.svg # Kodee mascot variants (11 variants)
|
|
137
140
|
├── public/ # Static assets
|
|
138
|
-
│ ├── kodee-*.svg # Kodee mascot variants (11 variants)
|
|
139
141
|
│ └── kotlin-logo*.svg # Kotlin logos (light/dark modes)
|
|
140
142
|
├── setup/ # Slidev setup files
|
|
141
143
|
│ └── shiki.ts # Syntax highlighting configuration for Kotlin
|
|
@@ -143,7 +145,7 @@ This will open the example presentation in your browser with hot-reload enabled.
|
|
|
143
145
|
│ ├── index.ts # Style entry point
|
|
144
146
|
│ └── layout.css # Layout styles
|
|
145
147
|
├── debug.js # Utility script for enumerating Shiki Kotlin tokens
|
|
146
|
-
├──
|
|
148
|
+
├── slides.md # Example presentation used for local development and GitHub Pages
|
|
147
149
|
├── package.json # Package configuration and dependencies
|
|
148
150
|
└── LICENSE # Apache License 2.0
|
|
149
151
|
```
|
package/components/Kodee.vue
CHANGED
|
@@ -19,26 +19,27 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
19
19
|
scale: undefined,
|
|
20
20
|
})
|
|
21
21
|
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
// Bundle mascot assets with the theme instead of relying on Slidev to copy a
|
|
23
|
+
// dependency's public directory into the consuming presentation.
|
|
24
|
+
const kodeeAssets = import.meta.glob('../assets/kodee-*.svg', {
|
|
25
|
+
eager: true,
|
|
26
|
+
import: 'default',
|
|
27
|
+
query: '?url',
|
|
28
|
+
}) as Record<string, string>
|
|
27
29
|
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const variantName = computed(() =>
|
|
31
|
+
props.variant.startsWith('kodee-') ? props.variant : `kodee-${props.variant}`,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
const kodeeImage = computed(() => kodeeAssets[`../assets/${variantName.value}.svg`])
|
|
32
35
|
|
|
33
36
|
// Compute size classes and dimensions
|
|
34
37
|
const sizeConfig = computed(() => {
|
|
35
38
|
switch (props.size) {
|
|
36
39
|
case 'large':
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return {width: '600px', height: '600px'}
|
|
41
|
-
}
|
|
40
|
+
return variantName.value === 'kodee-wave'
|
|
41
|
+
? {width: '500px', height: '500px'}
|
|
42
|
+
: {width: '600px', height: '600px'}
|
|
42
43
|
case 'small':
|
|
43
44
|
default:
|
|
44
45
|
return {width: '200px', height: '200px'}
|
|
@@ -53,16 +54,15 @@ const positionStyles = computed(() => {
|
|
|
53
54
|
height: sizeConfig.value.height,
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
const
|
|
57
|
-
console.log(`[DEBUG] Kodee image: encountered ${src}`)
|
|
57
|
+
const variant = variantName.value
|
|
58
58
|
|
|
59
59
|
styles.right = '0px'
|
|
60
60
|
if (props.position === 'corner') {
|
|
61
|
-
if (
|
|
61
|
+
if (variant === 'kodee-greeting') {
|
|
62
62
|
styles.bottom = '-42px'
|
|
63
|
-
} else if (
|
|
63
|
+
} else if (variant === 'kodee-wink') {
|
|
64
64
|
styles.bottom = '-35px'
|
|
65
|
-
} else if (
|
|
65
|
+
} else if (variant === 'kodee-wave') {
|
|
66
66
|
styles.bottom = '-15px'
|
|
67
67
|
} else {
|
|
68
68
|
styles.bottom = '-42px'
|
|
@@ -72,11 +72,11 @@ const positionStyles = computed(() => {
|
|
|
72
72
|
styles.right = '-5%'
|
|
73
73
|
styles.transform = 'translateY(-40%)'
|
|
74
74
|
|
|
75
|
-
if (
|
|
75
|
+
if (variant === 'kodee-greeting') {
|
|
76
76
|
styles.top = '13%'
|
|
77
|
-
} else if (
|
|
77
|
+
} else if (variant === 'kodee-wink') {
|
|
78
78
|
styles.top = '10%'
|
|
79
|
-
} else if (
|
|
79
|
+
} else if (variant === 'kodee-wave') {
|
|
80
80
|
styles.top = '16%'
|
|
81
81
|
styles.right = '3%'
|
|
82
82
|
} else {
|
|
@@ -95,10 +95,13 @@ const positionStyles = computed(() => {
|
|
|
95
95
|
const motionConfig = computed(() => {
|
|
96
96
|
const baseScale = props.scale || 1
|
|
97
97
|
|
|
98
|
+
// Check if we're in a view transition (Kodee staying the same between slides)
|
|
99
|
+
const isViewTransitioning = typeof document !== 'undefined' && document.startViewTransition
|
|
100
|
+
|
|
98
101
|
return {
|
|
99
102
|
initial: {
|
|
100
|
-
opacity: 0,
|
|
101
|
-
scale: baseScale
|
|
103
|
+
opacity: isViewTransitioning ? 1 : 0,
|
|
104
|
+
scale: baseScale,
|
|
102
105
|
},
|
|
103
106
|
enter: {
|
|
104
107
|
opacity: 1,
|
|
@@ -108,13 +111,14 @@ const motionConfig = computed(() => {
|
|
|
108
111
|
stiffness: 100,
|
|
109
112
|
damping: 15,
|
|
110
113
|
mass: 1,
|
|
114
|
+
duration: isViewTransitioning ? 0 : undefined,
|
|
111
115
|
},
|
|
112
116
|
},
|
|
113
117
|
leave: {
|
|
114
|
-
opacity: 0,
|
|
115
|
-
scale: baseScale
|
|
118
|
+
opacity: isViewTransitioning ? 1 : 0,
|
|
119
|
+
scale: baseScale,
|
|
116
120
|
transition: {
|
|
117
|
-
duration: 300,
|
|
121
|
+
duration: isViewTransitioning ? 0 : 300,
|
|
118
122
|
},
|
|
119
123
|
},
|
|
120
124
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "slidev-theme-kotlin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"slidev-theme",
|
|
@@ -9,11 +9,22 @@
|
|
|
9
9
|
"engines": {
|
|
10
10
|
"node": ">=18.0.0"
|
|
11
11
|
},
|
|
12
|
+
"files": [
|
|
13
|
+
"assets",
|
|
14
|
+
"components",
|
|
15
|
+
"layouts",
|
|
16
|
+
"public",
|
|
17
|
+
"setup",
|
|
18
|
+
"styles",
|
|
19
|
+
"CHANGELOG.md",
|
|
20
|
+
"README.md",
|
|
21
|
+
"LICENSE"
|
|
22
|
+
],
|
|
12
23
|
"scripts": {
|
|
13
|
-
"build": "slidev build
|
|
14
|
-
"dev": "slidev
|
|
15
|
-
"export": "slidev export
|
|
16
|
-
"screenshot": "slidev export
|
|
24
|
+
"build": "slidev build slides.md",
|
|
25
|
+
"dev": "slidev slides.md --open",
|
|
26
|
+
"export": "slidev export slides.md",
|
|
27
|
+
"screenshot": "slidev export slides.md --format png"
|
|
17
28
|
},
|
|
18
29
|
"dependencies": {
|
|
19
30
|
"@slidev/types": "^52.2.5"
|
package/styles/layout.css
CHANGED
|
@@ -13,6 +13,12 @@
|
|
|
13
13
|
::view-transition-new(kodee-mascot) {
|
|
14
14
|
animation-duration: 0.5s;
|
|
15
15
|
animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
16
|
+
mix-blend-mode: normal;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
::view-transition-group(kodee-mascot) {
|
|
20
|
+
animation-duration: 0.5s;
|
|
21
|
+
animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
.slidev-slide-content {
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
name: Deploy pages
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch:
|
|
5
|
-
push:
|
|
6
|
-
branches: [main]
|
|
7
|
-
|
|
8
|
-
permissions:
|
|
9
|
-
contents: read
|
|
10
|
-
pages: write
|
|
11
|
-
id-token: write
|
|
12
|
-
|
|
13
|
-
concurrency:
|
|
14
|
-
group: pages
|
|
15
|
-
cancel-in-progress: false
|
|
16
|
-
|
|
17
|
-
jobs:
|
|
18
|
-
build:
|
|
19
|
-
runs-on: ubuntu-latest
|
|
20
|
-
|
|
21
|
-
steps:
|
|
22
|
-
- uses: actions/checkout@v4
|
|
23
|
-
|
|
24
|
-
- uses: actions/setup-node@v4
|
|
25
|
-
with:
|
|
26
|
-
node-version: 'lts/*'
|
|
27
|
-
|
|
28
|
-
- name: Setup @antfu/ni
|
|
29
|
-
run: npm i -g @antfu/ni
|
|
30
|
-
|
|
31
|
-
- name: Install dependencies
|
|
32
|
-
run: nci
|
|
33
|
-
|
|
34
|
-
- name: Build
|
|
35
|
-
run: nr build --base /${{github.event.repository.name}}/
|
|
36
|
-
|
|
37
|
-
- name: Setup Pages
|
|
38
|
-
uses: actions/configure-pages@v4
|
|
39
|
-
|
|
40
|
-
- uses: actions/upload-pages-artifact@v3
|
|
41
|
-
with:
|
|
42
|
-
path: dist
|
|
43
|
-
|
|
44
|
-
deploy:
|
|
45
|
-
environment:
|
|
46
|
-
name: github-pages
|
|
47
|
-
url: ${{ steps.deployment.outputs.page_url }}
|
|
48
|
-
needs: build
|
|
49
|
-
runs-on: ubuntu-latest
|
|
50
|
-
name: Deploy
|
|
51
|
-
steps:
|
|
52
|
-
- name: Deploy to GitHub Pages
|
|
53
|
-
id: deployment
|
|
54
|
-
uses: actions/deploy-pages@v4
|
package/example.md
DELETED
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
theme: ./
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Kodee Magic Move Demo
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
kodee:
|
|
9
|
-
variant: greeting
|
|
10
|
-
size: large
|
|
11
|
-
position: featured
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
# Kodee Magic Move Demo
|
|
15
|
-
|
|
16
|
-
## Welcome to Kotlin!
|
|
17
|
-
|
|
18
|
-
Meet Kodee, the Kotlin mascot!
|
|
19
|
-
|
|
20
|
-
- Kodee appears large on this slide
|
|
21
|
-
- Watch the magic move to the next slide
|
|
22
|
-
- Smooth scale and position animation
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
kodee:
|
|
26
|
-
variant: greeting
|
|
27
|
-
size: small
|
|
28
|
-
position: corner
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
# Details Slide
|
|
32
|
-
|
|
33
|
-
## Code Example
|
|
34
|
-
|
|
35
|
-
Here's some Kotlin code with Kodee in the corner:
|
|
36
|
-
|
|
37
|
-
```kotlin
|
|
38
|
-
fun greet(name: String) {
|
|
39
|
-
println("Hello, $name!")
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
fun main() {
|
|
43
|
-
greet("Kotlin Developer")
|
|
44
|
-
}
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Notice how Kodee smoothly transitioned from large to small!
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
kodee:
|
|
51
|
-
variant: wink
|
|
52
|
-
size: large
|
|
53
|
-
position: featured
|
|
54
|
-
---
|
|
55
|
-
|
|
56
|
-
# Different Kodee Variants
|
|
57
|
-
|
|
58
|
-
You can use different Kodee images:
|
|
59
|
-
|
|
60
|
-
- `greeting` - Kodee waving hello
|
|
61
|
-
- `wink` - Kodee winking
|
|
62
|
-
- `jumping` - Kodee jumping with joy
|
|
63
|
-
- `sitting` - Kodee sitting down
|
|
64
|
-
- `drinking` - Kodee with a drink
|
|
65
|
-
- And more!
|
|
66
|
-
|
|
67
|
-
---
|
|
68
|
-
kodee:
|
|
69
|
-
variant: wink
|
|
70
|
-
size: small
|
|
71
|
-
position: corner
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
# Minimal Boilerplate
|
|
75
|
-
|
|
76
|
-
Just add to your slide's frontmatter:
|
|
77
|
-
|
|
78
|
-
```yaml
|
|
79
|
-
---
|
|
80
|
-
kodee:
|
|
81
|
-
variant: greeting
|
|
82
|
-
size: large
|
|
83
|
-
position: featured
|
|
84
|
-
---
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
That's it! Kodee will automatically appear and animate between slides.
|
|
88
|
-
|
|
89
|
-
---
|
|
90
|
-
kodee:
|
|
91
|
-
variant: wave
|
|
92
|
-
size: large
|
|
93
|
-
position: featured
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
# Different Kodee Variants
|
|
97
|
-
|
|
98
|
-
You can use different Kodee images:
|
|
99
|
-
|
|
100
|
-
- `greeting` - Kodee waving hello
|
|
101
|
-
- `wink` - Kodee winking
|
|
102
|
-
- `jumping` - Kodee jumping with joy
|
|
103
|
-
- `sitting` - Kodee sitting down
|
|
104
|
-
- `drinking` - Kodee with a drink
|
|
105
|
-
- And more!
|
|
106
|
-
|
|
107
|
-
---
|
|
108
|
-
kodee:
|
|
109
|
-
variant: wave
|
|
110
|
-
size: small
|
|
111
|
-
position: corner
|
|
112
|
-
---
|
|
113
|
-
|
|
114
|
-
# Minimal Boilerplate
|
|
115
|
-
|
|
116
|
-
Just add to your slide's frontmatter:
|
|
117
|
-
|
|
118
|
-
```yaml
|
|
119
|
-
---
|
|
120
|
-
kodee:
|
|
121
|
-
variant: greeting
|
|
122
|
-
size: large
|
|
123
|
-
position: featured
|
|
124
|
-
---
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
That's it! Kodee will automatically appear and animate between slides.
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
kodee:
|
|
131
|
-
variant: wave
|
|
132
|
-
size: small
|
|
133
|
-
position: corner
|
|
134
|
-
---
|
|
135
|
-
|
|
136
|
-
# IntelliJ like Syntax Highlighting
|
|
137
|
-
|
|
138
|
-
```kotlin
|
|
139
|
-
interface User {
|
|
140
|
-
val id: Int
|
|
141
|
-
val firstName: String
|
|
142
|
-
val lastName: String
|
|
143
|
-
val role: String
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
fun getUser(id: Long): User? = null
|
|
147
|
-
|
|
148
|
-
fun updateUser(id: Long, update: User?) {
|
|
149
|
-
if (update == null) return
|
|
150
|
-
getUser(id)
|
|
151
|
-
}
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
---
|
|
155
|
-
kodee:
|
|
156
|
-
variant: wave
|
|
157
|
-
size: small
|
|
158
|
-
position: corner
|
|
159
|
-
---
|
|
160
|
-
|
|
161
|
-
# Magic Kotlin Code Move
|
|
162
|
-
|
|
163
|
-
````md magic-move
|
|
164
|
-
```kotlin
|
|
165
|
-
fun updateUser(id: Long, update: User?) {
|
|
166
|
-
}
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
```kotlin
|
|
170
|
-
fun updateUser(id: Long, update: User?) {
|
|
171
|
-
if (update == null) return
|
|
172
|
-
getUser(id)
|
|
173
|
-
}
|
|
174
|
-
```
|
|
175
|
-
````
|
|
176
|
-
|
|
177
|
-
---
|
|
178
|
-
kodee:
|
|
179
|
-
variant: wave
|
|
180
|
-
size: small
|
|
181
|
-
position: corner
|
|
182
|
-
---
|
|
183
|
-
|
|
184
|
-
# Magic move & line highlighting
|
|
185
|
-
|
|
186
|
-
````md magic-move
|
|
187
|
-
```kotlin
|
|
188
|
-
val plusOne: (Int) -> Int = { it + 1 }
|
|
189
|
-
```
|
|
190
|
-
```kotlin{3}
|
|
191
|
-
val plusOne: (Int) -> Int = { it + 1 }
|
|
192
|
-
|
|
193
|
-
val sum: (Int, Int) -> Int = { a, b -> a + b }
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
```kotlin{5}
|
|
197
|
-
val plusOne: (Int) -> Int = { it + 1 }
|
|
198
|
-
|
|
199
|
-
val sum: (Int, Int) -> Int = { a, b -> a + b }
|
|
200
|
-
|
|
201
|
-
val plus: (Int, Int) -> Int = Int::plus
|
|
202
|
-
```
|
|
203
|
-
````
|
|
204
|
-
|
|
205
|
-
---
|
|
206
|
-
kodee:
|
|
207
|
-
variant: wave
|
|
208
|
-
size: small
|
|
209
|
-
position: corner
|
|
210
|
-
---
|
|
211
|
-
|
|
212
|
-
# Kotlin code & Rough Notation
|
|
213
|
-
|
|
214
|
-
```kotlin
|
|
215
|
-
operator fun <span v-mark.underline>Content</span>.unaryPlus(): Unit {
|
|
216
|
-
<span v-mark.circle>println</span>("Hello, World!")
|
|
217
|
-
}
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
---
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|