slidev-theme-kotlin 0.0.9 → 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 CHANGED
@@ -1,5 +1,51 @@
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
+
22
+ ## 0.10.0
23
+
24
+ ### Added
25
+
26
+ - Bundle `DrawnAnnotation`, a click-aware, Rough.js-powered annotation component for marking elements or exact code text with circles, underlines, boxes, and strike-throughs.
27
+ - Support leader lines, target marks, automatic non-overlapping labels, sequential nested reveals, temporary click ranges, and Magic Move-aware tracking.
28
+ - Add complete component documentation and interactive examples to the theme showcase.
29
+
30
+ ### Packaging
31
+
32
+ - Add `roughjs` as a runtime dependency required by `DrawnAnnotation`.
33
+
34
+ ## 0.0.10
35
+
36
+ ### Added
37
+
38
+ - Allow decks to enable Kodee once with `themeConfig.kodee`. A shared per-slide layer supports every layout: regular slides use a small bottom-right mascot, while cover and intro layouts use a large featured mascot.
39
+ - Support concise per-slide overrides such as `kodee: wink` and `kodee: false`, while retaining the full object configuration.
40
+ - Implement the documented `medium` Kodee size.
41
+ - Bundle `DrawnAnnotation`, a click-aware, Rough.js-powered annotation component for marking elements or exact code text with circles, underlines, boxes, and strike-throughs.
42
+ - Support leader lines, target marks, automatic non-overlapping labels, sequential nested reveals, temporary click ranges, and Magic Move-aware tracking.
43
+ - Add complete component documentation and interactive examples to the theme showcase.
44
+
45
+ ### Packaging
46
+
47
+ - Add `roughjs` as a runtime dependency required by `DrawnAnnotation`.
48
+
3
49
  ## 0.0.9
4
50
 
5
51
  ### Fixed
package/README.md CHANGED
@@ -12,6 +12,8 @@ This theme provides a professional presentation template tailored for Kotlin dev
12
12
  - **Multiple Layouts**: Pre-built layouts including default, cover, and intro
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
+ - **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
15
17
 
16
18
  ## Requirements
17
19
 
@@ -41,9 +43,98 @@ transition: view-transition
41
43
  # Your Presentation Title
42
44
  ```
43
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
+
44
117
  ### Using Kodee Mascot
45
118
 
46
- Add Kodee to any slide by including the `kodee` configuration in the slide's frontmatter:
119
+ Enable Kodee once for the whole deck with `themeConfig`:
120
+
121
+ ```yaml
122
+ ---
123
+ theme: kotlin
124
+ themeConfig:
125
+ kodee: greeting
126
+ ---
127
+ ```
128
+
129
+ Kodee then uses layout-aware defaults: `small` in the bottom-right corner on regular slides, and `large`/`featured` on `cover` and `intro` slides. Override only the variant when a slide needs a different expression:
130
+
131
+ ```yaml
132
+ ---
133
+ kodee: wink
134
+ ---
135
+ ```
136
+
137
+ Use `kodee: false` to hide the mascot on one slide. The original object form remains available when you need complete control:
47
138
 
48
139
  ```yaml
49
140
  ---
@@ -52,8 +143,6 @@ kodee:
52
143
  size: large
53
144
  position: featured
54
145
  ---
55
-
56
- # Your Slide Content
57
146
  ```
58
147
 
59
148
  #### Kodee Configuration Options
@@ -72,13 +161,13 @@ kodee:
72
161
  - `tiny` - Tiny Kodee
73
162
 
74
163
  - **size**: Control Kodee's size
75
- - `small` - 200x200px (default)
76
- - `large` - 600x600px (500x500px for wave variant)
77
- - `medium` - TODO: Not yet implemented
164
+ - `small` - 200x200px (regular-layout default)
165
+ - `medium` - 320x320px
166
+ - `large` - 600x600px (500x500px for wave variant; cover/intro default)
78
167
 
79
168
  - **position**: Control Kodee's placement
80
- - `corner` - Bottom right corner (default)
81
- - `featured` - Prominently displayed on slide
169
+ - `corner` - Bottom right corner (regular-layout default)
170
+ - `featured` - Prominently displayed (cover/intro default)
82
171
  - `custom` - Use with `x` and `y` coordinates
83
172
 
84
173
  #### Custom Positioning
@@ -96,6 +185,58 @@ kodee:
96
185
  ---
97
186
  ```
98
187
 
188
+ ### Using DrawnAnnotation
189
+
190
+ `<DrawnAnnotation>` is auto-registered for every deck using the theme. It can mark an element with a selector or exact text inside a Shiki or Magic Move code block, then connect that mark to a label or another element.
191
+
192
+ ````md
193
+ <DrawnAnnotation type="circle" text="fun main" label="program entry point" :on="1">
194
+
195
+ ```kotlin
196
+ fun main() = println("Hello, Kotlin!")
197
+ ```
198
+
199
+ </DrawnAnnotation>
200
+ ````
201
+
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.
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
+
220
+ #### IntelliJ formatting
221
+
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:
223
+
224
+ ```ini
225
+ # .editorconfig
226
+ [*.md]
227
+ ij_formatter_tags_enabled = true
228
+ ```
229
+
230
+ ```md
231
+ ---
232
+ theme: kotlin
233
+ ---
234
+
235
+ <!-- @formatter:off -->
236
+ ```
237
+
238
+ The theme's example deck includes this guard.
239
+
99
240
  ## Development
100
241
 
101
242
  ### Available Scripts
@@ -110,10 +251,33 @@ npm run build
110
251
  # Export presentation to PDF
111
252
  npm run export
112
253
 
113
- # Export presentation as PNG screenshots
254
+ # Export every slide and click state as PNG screenshots
114
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
262
+ ```
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
115
277
  ```
116
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
+
117
281
  ### Running the Slides
118
282
 
119
283
  The repository includes `slides.md`, a compact presentation demonstrating the theme's layouts, Kotlin highlighting, Kodee animations, magic moves, and click animations:
@@ -128,9 +292,12 @@ This will open the example presentation in your browser with hot-reload enabled.
128
292
 
129
293
  ```
130
294
  .
131
- ├── components/ # Vue components
132
- │ ├── Kodee.vue # Main Kodee mascot component with animations
133
- │ └── KodeeWrapper.vue # Wrapper component for Kodee integration
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
300
+ ├── slide-bottom.vue # Per-slide Kodee layer shared by every layout
134
301
  ├── layouts/ # Slidev layout templates
135
302
  │ ├── cover.vue # Cover slide layout
136
303
  │ ├── default.vue # Default slide layout
@@ -144,7 +311,7 @@ This will open the example presentation in your browser with hot-reload enabled.
144
311
  ├── styles/ # Theme styles
145
312
  │ ├── index.ts # Style entry point
146
313
  │ └── layout.css # Layout styles
147
- ├── debug.js # Utility script for enumerating Shiki Kotlin tokens
314
+ ├── .pi/extensions/inspect-shiki-token-scopes.ts # Local Pi tool for inspecting Shiki token scopes
148
315
  ├── slides.md # Example presentation used for local development and GitHub Pages
149
316
  ├── package.json # Package configuration and dependencies
150
317
  └── LICENSE # Apache License 2.0
@@ -156,11 +323,47 @@ This will open the example presentation in your browser with hot-reload enabled.
156
323
 
157
324
  No environment variables are currently required for this theme.
158
325
 
159
- ## Testing
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
347
+
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:
160
360
 
161
- <!-- TODO: Add test setup and instructions -->
361
+ ```bash
362
+ npx playwright install chromium
363
+ ```
162
364
 
163
- No automated tests are currently configured for this theme.
365
+ `npm run lint` validates the deck's frontmatter and Kodee configuration; `npm
366
+ run build` runs that lint before building the Slidev deck.
164
367
 
165
368
  ## Configuration
166
369
 
@@ -204,6 +407,7 @@ layout: cover
204
407
 
205
408
  ### Runtime Dependencies
206
409
  - `@slidev/types` (^52.2.5) - Slidev type definitions
410
+ - `roughjs` (^4.6.6) - Hand-drawn SVG paths for `DrawnAnnotation`
207
411
 
208
412
  ### Development Dependencies
209
413
  - `@slidev/cli` (^52.2.5) - Slidev command-line interface