slidev-theme-kotlin 0.0.8 → 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 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
@@ -114,9 +114,9 @@ npm run export
114
114
  npm run screenshot
115
115
  ```
116
116
 
117
- ### Running the Example
117
+ ### Running the Slides
118
118
 
119
- The repository includes `example.md` demonstrating all theme features:
119
+ The repository includes `slides.md`, a compact presentation demonstrating the theme's layouts, Kotlin highlighting, Kodee animations, magic moves, and click animations:
120
120
 
121
121
  ```bash
122
122
  npm run dev
@@ -135,8 +135,9 @@ This will open the example presentation in your browser with hot-reload enabled.
135
135
  │ ├── cover.vue # Cover slide layout
136
136
  │ ├── default.vue # Default slide layout
137
137
  │ └── intro.vue # Introduction slide layout
138
+ ├── assets/ # Bundled theme assets
139
+ │ └── kodee-*.svg # Kodee mascot variants (11 variants)
138
140
  ├── public/ # Static assets
139
- │ ├── kodee-*.svg # Kodee mascot variants (11 variants)
140
141
  │ └── kotlin-logo*.svg # Kotlin logos (light/dark modes)
141
142
  ├── setup/ # Slidev setup files
142
143
  │ └── shiki.ts # Syntax highlighting configuration for Kotlin
@@ -144,7 +145,7 @@ This will open the example presentation in your browser with hot-reload enabled.
144
145
  │ ├── index.ts # Style entry point
145
146
  │ └── layout.css # Layout styles
146
147
  ├── debug.js # Utility script for enumerating Shiki Kotlin tokens
147
- ├── example.md # Example presentation demonstrating theme features
148
+ ├── slides.md # Example presentation used for local development and GitHub Pages
148
149
  ├── package.json # Package configuration and dependencies
149
150
  └── LICENSE # Apache License 2.0
150
151
  ```
@@ -19,26 +19,27 @@ const props = withDefaults(defineProps<Props>(), {
19
19
  scale: undefined,
20
20
  })
21
21
 
22
- // Compute image source
23
- const imageSrc = computed(() => {
24
- const variant = props.variant.startsWith('kodee-') ? props.variant : `kodee-${props.variant}`
25
- return `theme/${variant}.svg`
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 kodeeImage = computed(() => {
29
- const base = import.meta.env.BASE_URL || '/'
30
- return `${base}${imageSrc.value}`
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
- if (imageSrc.value.endsWith("kodee-wave.svg")) {
38
- return {width: '500px', height: '500px'}
39
- } else {
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 src = imageSrc.value
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 (src.endsWith("kodee-greeting.svg")) {
61
+ if (variant === 'kodee-greeting') {
62
62
  styles.bottom = '-42px'
63
- } else if (src.endsWith("kodee-wink.svg")) {
63
+ } else if (variant === 'kodee-wink') {
64
64
  styles.bottom = '-35px'
65
- } else if (src.endsWith("kodee-wave.svg")) {
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 (src.endsWith("kodee-greeting.svg")) {
75
+ if (variant === 'kodee-greeting') {
76
76
  styles.top = '13%'
77
- } else if (src.endsWith("kodee-wink.svg")) {
77
+ } else if (variant === 'kodee-wink') {
78
78
  styles.top = '10%'
79
- } else if (src.endsWith("kodee-wave.svg")) {
79
+ } else if (variant === 'kodee-wave') {
80
80
  styles.top = '16%'
81
81
  styles.right = '3%'
82
82
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slidev-theme-kotlin",
3
- "version": "0.0.8",
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 example.md",
14
- "dev": "slidev example.md --open",
15
- "export": "slidev export example.md",
16
- "screenshot": "slidev export example.md --format png"
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"
@@ -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,221 +0,0 @@
1
- ---
2
- theme: ./
3
- transition: view-transition
4
- ---
5
-
6
- # Kodee Magic Move Demo
7
-
8
- ---
9
- kodee:
10
- variant: greeting
11
- size: large
12
- position: featured
13
- ---
14
-
15
- # Kodee Magic Move Demo
16
-
17
- ## Welcome to Kotlin!
18
-
19
- Meet Kodee, the Kotlin mascot!
20
-
21
- - Kodee appears large on this slide
22
- - Watch the magic move to the next slide
23
- - Smooth scale and position animation
24
-
25
- ---
26
- kodee:
27
- variant: greeting
28
- size: small
29
- position: corner
30
- ---
31
-
32
- # Details Slide
33
-
34
- ## Code Example
35
-
36
- Here's some Kotlin code with Kodee in the corner:
37
-
38
- ```kotlin
39
- fun greet(name: String) {
40
- println("Hello, $name!")
41
- }
42
-
43
- fun main() {
44
- greet("Kotlin Developer")
45
- }
46
- ```
47
-
48
- Notice how Kodee smoothly transitioned from large to small!
49
-
50
- ---
51
- kodee:
52
- variant: wink
53
- size: large
54
- position: featured
55
- ---
56
-
57
- # Different Kodee Variants
58
-
59
- You can use different Kodee images:
60
-
61
- - `greeting` - Kodee waving hello
62
- - `wink` - Kodee winking
63
- - `jumping` - Kodee jumping with joy
64
- - `sitting` - Kodee sitting down
65
- - `drinking` - Kodee with a drink
66
- - And more!
67
-
68
- ---
69
- kodee:
70
- variant: wink
71
- size: small
72
- position: corner
73
- ---
74
-
75
- # Minimal Boilerplate
76
-
77
- Just add to your slide's frontmatter:
78
-
79
- ```yaml
80
- ---
81
- kodee:
82
- variant: greeting
83
- size: large
84
- position: featured
85
- ---
86
- ```
87
-
88
- That's it! Kodee will automatically appear and animate between slides.
89
-
90
- ---
91
- kodee:
92
- variant: wave
93
- size: large
94
- position: featured
95
- ---
96
-
97
- # Different Kodee Variants
98
-
99
- You can use different Kodee images:
100
-
101
- - `greeting` - Kodee waving hello
102
- - `wink` - Kodee winking
103
- - `jumping` - Kodee jumping with joy
104
- - `sitting` - Kodee sitting down
105
- - `drinking` - Kodee with a drink
106
- - And more!
107
-
108
- ---
109
- kodee:
110
- variant: wave
111
- size: small
112
- position: corner
113
- ---
114
-
115
- # Minimal Boilerplate
116
-
117
- Just add to your slide's frontmatter:
118
-
119
- ```yaml
120
- ---
121
- kodee:
122
- variant: greeting
123
- size: large
124
- position: featured
125
- ---
126
- ```
127
-
128
- That's it! Kodee will automatically appear and animate between slides.
129
-
130
- ---
131
- kodee:
132
- variant: wave
133
- size: small
134
- position: corner
135
- ---
136
-
137
- # IntelliJ like Syntax Highlighting
138
-
139
- ```kotlin
140
- interface User {
141
- val id: Int
142
- val firstName: String
143
- val lastName: String
144
- val role: String
145
- }
146
-
147
- fun getUser(id: Long): User? = null
148
-
149
- fun updateUser(id: Long, update: User?) {
150
- if (update == null) return
151
- getUser(id)
152
- }
153
- ```
154
-
155
- ---
156
- kodee:
157
- variant: wave
158
- size: small
159
- position: corner
160
- ---
161
-
162
- # Magic Kotlin Code Move
163
-
164
- ````md magic-move
165
- ```kotlin
166
- fun updateUser(id: Long, update: User?) {
167
- }
168
- ```
169
-
170
- ```kotlin
171
- fun updateUser(id: Long, update: User?) {
172
- if (update == null) return
173
- getUser(id)
174
- }
175
- ```
176
- ````
177
-
178
- ---
179
- kodee:
180
- variant: wave
181
- size: small
182
- position: corner
183
- ---
184
-
185
- # Magic move & line highlighting
186
-
187
- ````md magic-move
188
- ```kotlin
189
- val plusOne: (Int) -> Int = { it + 1 }
190
- ```
191
- ```kotlin{3}
192
- val plusOne: (Int) -> Int = { it + 1 }
193
-
194
- val sum: (Int, Int) -> Int = { a, b -> a + b }
195
- ```
196
-
197
- ```kotlin{5}
198
- val plusOne: (Int) -> Int = { it + 1 }
199
-
200
- val sum: (Int, Int) -> Int = { a, b -> a + b }
201
-
202
- val plus: (Int, Int) -> Int = Int::plus
203
- ```
204
- ````
205
-
206
- ---
207
- kodee:
208
- variant: wave
209
- size: small
210
- position: corner
211
- ---
212
-
213
- # Kotlin code & Rough Notation
214
-
215
- ```kotlin
216
- operator fun <span v-mark.underline>Content</span>.unaryPlus(): Unit {
217
- <span v-mark.circle>println</span>("Hello, World!")
218
- }
219
- ```
220
-
221
- ---
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