slidev-theme-kotlin 0.10.0 → 0.11.0
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 +19 -0
- package/README.md +157 -8
- package/components/DrawnAnnotation.vue +459 -180
- package/components/InlineCompilerError.vue +618 -0
- package/components/Kodee.vue +20 -8
- package/components/README.md +71 -10
- package/package.json +15 -7
- package/public/Postgresql_elephant.svg +22 -0
- package/public/amper-icon.svg +9 -0
- package/public/gradle.svg +7 -0
- package/public/gradle_dark.svg +7 -0
- package/public/java.svg +6 -0
- package/public/java_dark.svg +6 -0
- package/public/kotlin.svg +5 -0
- package/public/kotlin_dark.svg +5 -0
- package/public/maven.svg +4 -0
- package/public/maven_dark.svg +4 -0
- package/public/terminal.svg +6 -0
- package/public/terminal_dark.svg +6 -0
- package/setup/code-window-icon.ts +18 -0
- package/setup/shiki.ts +277 -327
- package/setup/transformers.ts +51 -0
- package/styles/layout.css +206 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.11.0
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Bundle `InlineCompilerError`, a click-aware inline diagnostic component that marks source lines or exact code text in static Shiki and Magic Move blocks.
|
|
8
|
+
- Add IntelliJ-style identity icons to code windows for Kotlin, Gradle, Amper, Java, terminal, Maven, and PostgreSQL fences, including Kotlin and Gradle fence aliases.
|
|
9
|
+
- Add `export:slide` for exporting an individual slide at an exact click state.
|
|
10
|
+
- Add visual regression review and check scripts for comparing the theme and consumer decks across revisions.
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Make code-window icon border colours and column-based code sizing customizable through CSS variables.
|
|
15
|
+
- Improve `DrawnAnnotation` tracking, label placement, obstacle detection, and animation timing across Magic Move and view transitions.
|
|
16
|
+
- Update Slidev dependencies to 52.19.1 and require Node.js 20.12 or newer.
|
|
17
|
+
|
|
18
|
+
### Documentation
|
|
19
|
+
|
|
20
|
+
- Document inline compiler diagnostics, code-window icons and sizing, single-slide export, and visual regression review workflows.
|
|
21
|
+
|
|
3
22
|
## 0.10.0
|
|
4
23
|
|
|
5
24
|
### Added
|
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ This theme provides a professional presentation template tailored for Kotlin dev
|
|
|
13
13
|
- **Kotlin Branding**: Official Kotlin logos for both light and dark modes
|
|
14
14
|
- **JetBrains Fonts**: Uses Inter for sans-serif and JetBrains Mono for code
|
|
15
15
|
- **Drawn annotations**: Click-aware, hand-drawn marks, labels, and connectors for elements and code
|
|
16
|
+
- **Inline compiler diagnostics**: IntelliJ-style squiggles and messages for static and Magic Move code blocks
|
|
16
17
|
|
|
17
18
|
## Requirements
|
|
18
19
|
|
|
@@ -42,6 +43,77 @@ transition: view-transition
|
|
|
42
43
|
# Your Presentation Title
|
|
43
44
|
```
|
|
44
45
|
|
|
46
|
+
### Code icons
|
|
47
|
+
|
|
48
|
+
Code fences are rendered as one IntelliJ Light/Darcula editor surface without a
|
|
49
|
+
title bar. A compact identity icon is placed in its top-right corner and follows
|
|
50
|
+
the presentation color scheme:
|
|
51
|
+
|
|
52
|
+
````md
|
|
53
|
+
```kotlin
|
|
54
|
+
fun main() = println("Hello")
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```kts gradle
|
|
58
|
+
plugins { kotlin("jvm") }
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```yaml toolchain
|
|
62
|
+
product: jvm/app
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```xml maven
|
|
66
|
+
<artifactId>demo</artifactId>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```sql
|
|
70
|
+
SELECT * FROM presentations;
|
|
71
|
+
```
|
|
72
|
+
````
|
|
73
|
+
|
|
74
|
+
`kotlin`, `kt`, and `kts` use the Kotlin icon; each with a `gradle` modifier
|
|
75
|
+
uses the Gradle icon. `yaml toolchain`, `java`, `bash`, `xml maven`, and `sql` use the
|
|
76
|
+
Amper, Java, Terminal, Maven, and PostgreSQL icons respectively. All other fences
|
|
77
|
+
remain plain code surfaces.
|
|
78
|
+
|
|
79
|
+
The identity border colours are exposed as theme variables and can be
|
|
80
|
+
customized from a deck stylesheet. Each variable has a light and dark-mode
|
|
81
|
+
value:
|
|
82
|
+
|
|
83
|
+
```css
|
|
84
|
+
:root {
|
|
85
|
+
--code-window-kotlin-color: #834df0;
|
|
86
|
+
--code-window-gradle-color: #6c707e;
|
|
87
|
+
--code-window-amper-color: #087cfa;
|
|
88
|
+
--code-window-java-color: #e66d17;
|
|
89
|
+
--code-window-terminal-color: #6c707e;
|
|
90
|
+
--code-window-maven-color: #3574f0;
|
|
91
|
+
--code-window-postgresql-color: #336791;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
html.dark {
|
|
95
|
+
--code-window-kotlin-color: #a571e6;
|
|
96
|
+
/* Override any of the other dark-mode values as needed. */
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Code sizing
|
|
101
|
+
|
|
102
|
+
Every code window uses one font size calculated from the slide canvas width. By
|
|
103
|
+
default, a full-width window fits 68 monospace characters. Override the column
|
|
104
|
+
count once in the deck's stylesheet:
|
|
105
|
+
|
|
106
|
+
```css
|
|
107
|
+
:root {
|
|
108
|
+
--code-window-columns: 72;
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The calculation accounts for the standard layout and code padding. A custom
|
|
113
|
+
layout with different horizontal spacing can override
|
|
114
|
+
`--code-window-inline-space`. To bypass column-based sizing entirely, set an
|
|
115
|
+
explicit `--code-window-font-size`, for example `1.25rem`.
|
|
116
|
+
|
|
45
117
|
### Using Kodee Mascot
|
|
46
118
|
|
|
47
119
|
Enable Kodee once for the whole deck with `themeConfig`:
|
|
@@ -129,6 +201,22 @@ fun main() = println("Hello, Kotlin!")
|
|
|
129
201
|
|
|
130
202
|
The full prop reference, timing behavior, and troubleshooting guide are in [`components/README.md`](components/README.md). The bundled [`slides.md`](slides.md) includes working examples of code annotations, connectors, labels, sequential reveals, and Magic Move integration.
|
|
131
203
|
|
|
204
|
+
### Using InlineCompilerError
|
|
205
|
+
|
|
206
|
+
`<InlineCompilerError>` is auto-registered for every deck using the theme. Wrap one code block to underline a source line or exact text with an IntelliJ-style diagnostic; it follows both static Shiki blocks and Magic Move steps.
|
|
207
|
+
|
|
208
|
+
````md
|
|
209
|
+
<InlineCompilerError text="userName" message="Unresolved reference: userName" :on="1">
|
|
210
|
+
|
|
211
|
+
```kotlin
|
|
212
|
+
println(userName)
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
</InlineCompilerError>
|
|
216
|
+
````
|
|
217
|
+
|
|
218
|
+
See [`components/README.md`](components/README.md#inlinecompilererror) for the target and click-timing props.
|
|
219
|
+
|
|
132
220
|
#### IntelliJ formatting
|
|
133
221
|
|
|
134
222
|
IntelliJ recognizes only the first YAML block in a Markdown file as frontmatter. To keep later Slidev frontmatter intact when using **Reformat Code**, enable formatter tags and stop formatting after the deck headmatter:
|
|
@@ -163,10 +251,33 @@ npm run build
|
|
|
163
251
|
# Export presentation to PDF
|
|
164
252
|
npm run export
|
|
165
253
|
|
|
166
|
-
# Export
|
|
254
|
+
# Export every slide and click state as PNG screenshots
|
|
167
255
|
npm run screenshot
|
|
256
|
+
|
|
257
|
+
# Export one slide; --click is zero-based (0 is the initial state)
|
|
258
|
+
npm run export:slide -- --slide 12 --click 3
|
|
259
|
+
|
|
260
|
+
# Render this working tree against HEAD and open the generated visual review
|
|
261
|
+
npm run visual:review
|
|
168
262
|
```
|
|
169
263
|
|
|
264
|
+
### Exporting One Slide
|
|
265
|
+
|
|
266
|
+
`npm run export:slide` is an AI-agent-friendly wrapper around `slidev export`. It writes one PNG rather than a directory of all exported pages:
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
# Initial state of slide 12
|
|
270
|
+
npm run export:slide -- --slide 12
|
|
271
|
+
|
|
272
|
+
# State after the third click of slide 12
|
|
273
|
+
npm run export:slide -- --slide 12 --click 3 --output artifacts/slide-12-click-3.png
|
|
274
|
+
|
|
275
|
+
# Use another deck entry
|
|
276
|
+
npm run export:slide -- --entry path/to/talk.md --slide 4 --click 0
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
`--slide` is one-based. `--click` is optional and zero-based, so `--click 0` is the initial slide state, `--click 1` is the state after one click, and so on. Without `--output`, screenshots are written under `.slidev/exports/`, which is ignored by Git. Run `npm run export:slide -- --help` for timeout, wait, and dark-mode options.
|
|
280
|
+
|
|
170
281
|
### Running the Slides
|
|
171
282
|
|
|
172
283
|
The repository includes `slides.md`, a compact presentation demonstrating the theme's layouts, Kotlin highlighting, Kodee animations, magic moves, and click animations:
|
|
@@ -181,9 +292,11 @@ This will open the example presentation in your browser with hot-reload enabled.
|
|
|
181
292
|
|
|
182
293
|
```
|
|
183
294
|
.
|
|
184
|
-
├── components/
|
|
185
|
-
│ ├──
|
|
186
|
-
│
|
|
295
|
+
├── components/ # Vue components
|
|
296
|
+
│ ├── DrawnAnnotation.vue # Hand-drawn marks, labels, and connectors
|
|
297
|
+
│ ├── InlineCompilerError.vue # Inline code diagnostics
|
|
298
|
+
│ ├── Kodee.vue # Main Kodee mascot component with animations
|
|
299
|
+
│ └── KodeeWrapper.vue # Wrapper component for Kodee integration
|
|
187
300
|
├── slide-bottom.vue # Per-slide Kodee layer shared by every layout
|
|
188
301
|
├── layouts/ # Slidev layout templates
|
|
189
302
|
│ ├── cover.vue # Cover slide layout
|
|
@@ -198,7 +311,7 @@ This will open the example presentation in your browser with hot-reload enabled.
|
|
|
198
311
|
├── styles/ # Theme styles
|
|
199
312
|
│ ├── index.ts # Style entry point
|
|
200
313
|
│ └── layout.css # Layout styles
|
|
201
|
-
├──
|
|
314
|
+
├── .pi/extensions/inspect-shiki-token-scopes.ts # Local Pi tool for inspecting Shiki token scopes
|
|
202
315
|
├── slides.md # Example presentation used for local development and GitHub Pages
|
|
203
316
|
├── package.json # Package configuration and dependencies
|
|
204
317
|
└── LICENSE # Apache License 2.0
|
|
@@ -210,11 +323,47 @@ This will open the example presentation in your browser with hot-reload enabled.
|
|
|
210
323
|
|
|
211
324
|
No environment variables are currently required for this theme.
|
|
212
325
|
|
|
213
|
-
##
|
|
326
|
+
## Visual regression review
|
|
327
|
+
|
|
328
|
+
Visual review starts a temporary Slidev server and uses Playwright Chromium to
|
|
329
|
+
capture every settled click state from Slidev's normal presenter/player route
|
|
330
|
+
(`/<slide>?clicks=<click>`), rather than the print-export `?print=clicks` route.
|
|
331
|
+
It renders the current working tree and a Git revision with the same browser,
|
|
332
|
+
compares every PNG with `pixelmatch`, and writes a three-column
|
|
333
|
+
base/current/diff page. When the local
|
|
334
|
+
`~/Developer/kotlin-fundamentals` consumer deck is available, its baseline is
|
|
335
|
+
rendered from its clean `HEAD` and its current capture includes its working-tree
|
|
336
|
+
changes, with each capture linked to the corresponding theme revision.
|
|
337
|
+
Screenshots are not committed: the chosen Git revision is the baseline, so
|
|
338
|
+
accepting an intentional visual change is simply reviewing it and committing
|
|
339
|
+
that change.
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
# Compare the working tree with the last commit.
|
|
343
|
+
npm run visual:review
|
|
344
|
+
|
|
345
|
+
# Compare a branch with its integration base.
|
|
346
|
+
npm run visual:review -- --base origin/main
|
|
214
347
|
|
|
215
|
-
|
|
348
|
+
# Use in automation when any visual difference should fail the command.
|
|
349
|
+
npm run visual:check -- --base origin/main
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
Open the `file://.../.visual/review/index.html` path printed by the command.
|
|
353
|
+
The `.visual/` directory contains disposable base/current captures and diffs
|
|
354
|
+
and is ignored by Git. `npm run screenshot` is the non-comparison escape hatch
|
|
355
|
+
when raw PNGs are all that is needed.
|
|
356
|
+
|
|
357
|
+
The visual exporter requires the Chromium binary supplied by
|
|
358
|
+
`playwright-chromium`. If dependency installation is configured not to run
|
|
359
|
+
package install scripts, download it once with:
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
npx playwright install chromium
|
|
363
|
+
```
|
|
216
364
|
|
|
217
|
-
|
|
365
|
+
`npm run lint` validates the deck's frontmatter and Kodee configuration; `npm
|
|
366
|
+
run build` runs that lint before building the Slidev deck.
|
|
218
367
|
|
|
219
368
|
## Configuration
|
|
220
369
|
|