slidev-theme-kotlin 0.10.0 → 0.12.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 +52 -0
- package/README.md +240 -14
- package/annotation-editor.d.ts +2 -0
- package/annotation-editor.mjs +5 -0
- package/assets/edit-3-svgrepo-com.svg +5 -0
- package/components/DrawnAnnotation.vue +1362 -433
- package/components/DrawnAnnotationEditorLauncher.vue +50 -0
- package/components/DrawnAnnotationEditorToolbar.vue +264 -0
- package/components/InlineCompilerError.vue +608 -0
- package/components/Kodee.vue +79 -84
- package/components/KodeeWrapper.vue +11 -27
- package/components/MagicMoveBetween.vue +276 -0
- package/components/README.md +181 -40
- package/components/annotation-label-markdown.test.ts +22 -0
- package/components/annotation-label-markdown.ts +34 -0
- package/components/code-text-match.ts +78 -0
- package/components/drawn-annotation/editor-store.test.ts +141 -0
- package/components/drawn-annotation/editor-store.ts +137 -0
- package/components/drawn-annotation/geometry.test.ts +88 -0
- package/components/drawn-annotation/geometry.ts +239 -0
- package/components/drawn-annotation/writer-client.ts +81 -0
- package/components/kodee-props.ts +16 -0
- package/global-top.vue +26 -0
- package/package.json +35 -10
- package/plugins/drawn-annotation-editor.d.ts +30 -0
- package/plugins/drawn-annotation-editor.mjs +391 -0
- package/plugins/drawn-annotation-editor.test.ts +386 -0
- 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 +22 -0
- package/setup/magic-move-between.ts +191 -0
- package/setup/preparser.ts +24 -0
- package/setup/shiki.ts +277 -327
- package/setup/transformers.ts +239 -0
- package/styles/fonts.css +59 -0
- package/styles/index.ts +2 -0
- package/styles/layout.css +262 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 0.12.0
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Support Magic Move between slides: a `magic-move` separator (or `magicMove: true` frontmatter) links consecutive slides, and their top-level code fences morph across the slide boundary in both navigation directions. Code windows pair up by position, so parallel snippets (for example Kotlin next to SQL) animate independently, and decks using `transition: view-transition` pair the code windows through the View Transitions API instead of cross-fading them.
|
|
10
|
+
- Support per-click line highlighting (`{1|2-3}`) and fence options (`{lines:true, at:2}`) on chained fences: the ranges register as clicks on their slide and step through before navigation moves on, matching classic Magic Move behaviour.
|
|
11
|
+
- Add a development-only visual annotation editor: `drawnAnnotationEditor()` (exported as `slidev-theme-kotlin/annotation-editor`) injects transient source locators while serving, and persists dragged label, width, and connector geometry as a normalized `:geometry` binding on exactly the edited `DrawnAnnotation` tag — with keyboard nudging, undo, revision-conflict detection, and reset controls. Builds and exports carry no editor code.
|
|
12
|
+
- Add the `geometry` prop to `DrawnAnnotation`: normalized source-local label and connector geometry, including quadratic Bézier connectors, that overrides automatic placement.
|
|
13
|
+
- Add `DrawnAnnotation`'s passive mode for observing a click already owned by nearby `v-click` / `v-clicks` content without registering an extra click step.
|
|
14
|
+
- Add JDBC and R2DBC identity badges and border colours for Kotlin code fences with the `jdbc` and `r2dbc` modifiers.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Make automatic `DrawnAnnotation` label placement deterministic: candidates prefer the requested side and stay clear of the slide's laid-out content (including still-hidden v-click content, so a label never sits where the slide is about to grow), of the annotation's own mark, of labels placed by earlier annotations, and of `avoid-selector` matches (kept at `clearance` distance), wrapping into free space when needed.
|
|
19
|
+
- **Breaking**: replace `DrawnAnnotation`'s `label-x` / `label-y` / `label-width` props with the normalized `geometry.label` binding.
|
|
20
|
+
- **Breaking**: a `DrawnAnnotation` without `at`/`on` is now part of the initial slide state instead of taking the next automatic click; give `at` or `on` for a reveal.
|
|
21
|
+
- Render `DrawnAnnotation` labels as safe Markdown; inline code and block quotes use the theme's local-first JetBrains Mono stack.
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- Persist curved-connector edits: the source writer no longer rejects the `type: 'quadratic'` connector shape its own serializer emits.
|
|
26
|
+
- Ship `slidev-theme-kotlin/annotation-editor` as plain JavaScript with type declarations, so a consuming deck's `vite.config.ts` can load it under Node instead of failing on raw TypeScript inside node_modules.
|
|
27
|
+
- Keep a save conflict recoverable: after a 409 the write client no longer adopts the other author's revision, so a continuing drag cannot silently overwrite their edit.
|
|
28
|
+
- Persist a width-only first edit by materializing the label's current position, instead of silently dropping the width while reporting "Annotation saved".
|
|
29
|
+
- Translate a quadratic connector's control point with arrow-key body nudges, matching pointer body drags instead of distorting the saved curve.
|
|
30
|
+
- Match the Alt+Shift+A editor shortcut by physical key so it works on macOS, where Option+Shift+A composes "Å".
|
|
31
|
+
- Escape quotes in cross-slide Magic Move fence titles and options, so titles like `[Bob's file.kt]` and options like `{at:"+2"}` no longer break the slide markup.
|
|
32
|
+
- Morph cross-slide Magic Move from the correct step when a chain slide contributes no fence at a position, and give duplicate identical fences on one slide their own animation identity.
|
|
33
|
+
- Decode annotation source locators as UTF-8 in the browser, so decks with non-ASCII filenames can save geometry.
|
|
34
|
+
- Do not apply the code-chip background to inline Markdown code in `DrawnAnnotation` labels.
|
|
35
|
+
|
|
36
|
+
## 0.11.0
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- Bundle `InlineCompilerError`, a click-aware inline diagnostic component that marks source lines or exact code text in static Shiki and Magic Move blocks.
|
|
41
|
+
- Add IntelliJ-style identity icons to code windows for Kotlin, Gradle, Amper, Java, terminal, Maven, and PostgreSQL fences, including Kotlin and Gradle fence aliases.
|
|
42
|
+
- Add `export:slide` for exporting an individual slide at an exact click state.
|
|
43
|
+
- Add visual regression review and check scripts for comparing the theme and consumer decks across revisions.
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- Make code-window icon border colours and column-based code sizing customizable through CSS variables.
|
|
48
|
+
- Improve `DrawnAnnotation` tracking, label placement, obstacle detection, and animation timing across Magic Move and view transitions.
|
|
49
|
+
- Update Slidev dependencies to 52.19.1 and require Node.js 20.12 or newer.
|
|
50
|
+
|
|
51
|
+
### Documentation
|
|
52
|
+
|
|
53
|
+
- Document inline compiler diagnostics, code-window icons and sizing, single-slide export, and visual regression review workflows.
|
|
54
|
+
|
|
3
55
|
## 0.10.0
|
|
4
56
|
|
|
5
57
|
### Added
|
package/README.md
CHANGED
|
@@ -8,15 +8,17 @@ This theme provides a professional presentation template tailored for Kotlin dev
|
|
|
8
8
|
|
|
9
9
|
- **Kodee Mascot Integration**: Animated Kodee character with multiple variants (greeting, wink, wave, jumping, sitting, drinking, heart, in-love, welcome, winter, tiny)
|
|
10
10
|
- **Magic Move Animations**: Smooth transitions for Kodee between slides with configurable size and position
|
|
11
|
+
- **Magic Move between slides**: Link slides with a `magic-move` separator and their code windows morph across the slide boundary, including several parallel snippets per slide
|
|
11
12
|
- **Kotlin Syntax Highlighting**: Custom Shiki configuration optimized for Kotlin code
|
|
12
13
|
- **Multiple Layouts**: Pre-built layouts including default, cover, and intro
|
|
13
14
|
- **Kotlin Branding**: Official Kotlin logos for both light and dark modes
|
|
14
|
-
- **JetBrains Fonts**:
|
|
15
|
+
- **JetBrains Fonts**: Prefers locally installed JetBrains Sans and JetBrains Mono, with Inter and Google-hosted JetBrains Mono fallbacks
|
|
15
16
|
- **Drawn annotations**: Click-aware, hand-drawn marks, labels, and connectors for elements and code
|
|
17
|
+
- **Inline compiler diagnostics**: IntelliJ-style squiggles and messages for static and Magic Move code blocks
|
|
16
18
|
|
|
17
19
|
## Requirements
|
|
18
20
|
|
|
19
|
-
- **Node.js**: >=
|
|
21
|
+
- **Node.js**: >= 20.12.0
|
|
20
22
|
- **Package Manager**: npm (or pnpm with shamefully-hoist=true)
|
|
21
23
|
|
|
22
24
|
## Installation
|
|
@@ -29,6 +31,29 @@ npm install slidev-theme-kotlin
|
|
|
29
31
|
|
|
30
32
|
## Usage
|
|
31
33
|
|
|
34
|
+
### Visual annotation editor (development)
|
|
35
|
+
|
|
36
|
+
Enable the optional, development-only source writer in the consuming deck's
|
|
37
|
+
`vite.config.ts`:
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { defineConfig } from 'vite'
|
|
41
|
+
import { drawnAnnotationEditor } from 'slidev-theme-kotlin/annotation-editor'
|
|
42
|
+
|
|
43
|
+
export default defineConfig({
|
|
44
|
+
plugins: [drawnAnnotationEditor()],
|
|
45
|
+
})
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Open Slidev's annotation editor (or press **Alt+Shift+A**) and drag a visible
|
|
49
|
+
label, its width handle, or a connector control. The editor persists normalized
|
|
50
|
+
`:geometry` on exactly that `DrawnAnnotation` tag. **Cmd/Ctrl+Z** undoes a
|
|
51
|
+
saved edit; reset controls restore label, connector, or all geometry. Source
|
|
52
|
+
revisions are checked, so a conflict preserves the local draft until **Reload
|
|
53
|
+
saved geometry** is chosen. The locator, toolbar, and write endpoint exist only
|
|
54
|
+
while Vite serves the deck; builds and exports render saved geometry without
|
|
55
|
+
editor code.
|
|
56
|
+
|
|
32
57
|
### Basic Setup
|
|
33
58
|
|
|
34
59
|
Add the theme to your slides' frontmatter:
|
|
@@ -42,6 +67,129 @@ transition: view-transition
|
|
|
42
67
|
# Your Presentation Title
|
|
43
68
|
```
|
|
44
69
|
|
|
70
|
+
### Code icons
|
|
71
|
+
|
|
72
|
+
Code fences are rendered as one IntelliJ Light/Darcula editor surface without a
|
|
73
|
+
title bar. A compact identity icon is placed in its top-right corner and follows
|
|
74
|
+
the presentation color scheme:
|
|
75
|
+
|
|
76
|
+
````md
|
|
77
|
+
```kotlin
|
|
78
|
+
fun main() = println("Hello")
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```kts gradle
|
|
82
|
+
plugins { kotlin("jvm") }
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
```yaml toolchain
|
|
86
|
+
product: jvm/app
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```xml maven
|
|
90
|
+
<artifactId>demo</artifactId>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
```sql
|
|
94
|
+
SELECT * FROM presentations;
|
|
95
|
+
```
|
|
96
|
+
````
|
|
97
|
+
|
|
98
|
+
`kotlin`, `kt`, and `kts` use the Kotlin icon; each with a `gradle`, `jdbc`,
|
|
99
|
+
or `r2dbc` modifier uses the Gradle, JDBC, or R2DBC identity respectively.
|
|
100
|
+
`yaml toolchain`, `java`, `bash`, `xml maven`, and `sql` use the Amper, Java,
|
|
101
|
+
Terminal, Maven, and PostgreSQL icons respectively. All other fences remain plain
|
|
102
|
+
code surfaces.
|
|
103
|
+
|
|
104
|
+
The identity border colours are exposed as theme variables and can be
|
|
105
|
+
customized from a deck stylesheet. Each variable has a light and dark-mode
|
|
106
|
+
value:
|
|
107
|
+
|
|
108
|
+
```css
|
|
109
|
+
:root {
|
|
110
|
+
--code-window-kotlin-color: #834df0;
|
|
111
|
+
--code-window-gradle-color: #6c707e;
|
|
112
|
+
--code-window-amper-color: #087cfa;
|
|
113
|
+
--code-window-java-color: #e66d17;
|
|
114
|
+
--code-window-terminal-color: #6c707e;
|
|
115
|
+
--code-window-maven-color: #3574f0;
|
|
116
|
+
--code-window-postgresql-color: #336791;
|
|
117
|
+
--code-window-jdbc-color: #f59e0b;
|
|
118
|
+
--code-window-r2dbc-color: #06b6d4;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
html.dark {
|
|
122
|
+
--code-window-kotlin-color: #a571e6;
|
|
123
|
+
/* Override any of the other dark-mode values as needed. */
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Code sizing
|
|
128
|
+
|
|
129
|
+
Every code window uses one font size calculated from the slide canvas width. By
|
|
130
|
+
default, a full-width window fits 68 monospace characters. Override the column
|
|
131
|
+
count once in the deck's stylesheet:
|
|
132
|
+
|
|
133
|
+
```css
|
|
134
|
+
:root {
|
|
135
|
+
--code-window-columns: 72;
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The calculation accounts for the standard layout and code padding. A custom
|
|
140
|
+
layout with different horizontal spacing can override
|
|
141
|
+
`--code-window-inline-space`. To bypass column-based sizing entirely, set an
|
|
142
|
+
explicit `--code-window-font-size`, for example `1.25rem`.
|
|
143
|
+
|
|
144
|
+
### Magic Move between slides
|
|
145
|
+
|
|
146
|
+
Slidev's classic Magic Move animates code inside one slide, on clicks. This
|
|
147
|
+
theme additionally supports morphing code **across slides**: put `magic-move`
|
|
148
|
+
in the separator between two slides and their code windows animate from one to
|
|
149
|
+
the next when you navigate.
|
|
150
|
+
|
|
151
|
+
````md
|
|
152
|
+
# My Slide
|
|
153
|
+
|
|
154
|
+
```kotlin
|
|
155
|
+
class Person
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
magic-move
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
# My Slide
|
|
163
|
+
|
|
164
|
+
```kotlin
|
|
165
|
+
class Person(val name: String)
|
|
166
|
+
```
|
|
167
|
+
````
|
|
168
|
+
|
|
169
|
+
Details:
|
|
170
|
+
|
|
171
|
+
- The separator links the slide it precedes to the one before it, so the last
|
|
172
|
+
slide of a chain needs no marker. Any number of slides can be chained by
|
|
173
|
+
repeating the `magic-move` separator.
|
|
174
|
+
- Code windows pair up **by position**: the first fence of a slide morphs into
|
|
175
|
+
the first fence of the next, the second into the second, and so on. Several
|
|
176
|
+
parallel snippets (say Kotlin next to SQL) each animate independently.
|
|
177
|
+
- Everything outside the code fences is a normal slide — headings, prose, and
|
|
178
|
+
layout can change freely and follow the deck's regular slide transition.
|
|
179
|
+
- With `transition: view-transition`, the code windows of both slides are
|
|
180
|
+
paired through the View Transitions API, so the window glides to its new
|
|
181
|
+
position while the tokens morph, instead of cross-fading with the page.
|
|
182
|
+
- Navigating backward plays the animation in reverse. Deep links, the
|
|
183
|
+
overview, and PDF/PNG exports render each slide's own step statically.
|
|
184
|
+
- Fence metadata still works: the code-window identity icons, `[Title]`
|
|
185
|
+
labels, and `{lines:true}` line numbers apply per chain. Per-click line
|
|
186
|
+
highlighting works too — `` ```kotlin {1|2-3} `` registers clicks on that
|
|
187
|
+
slide and steps through the ranges before navigation moves on, exactly like
|
|
188
|
+
one step of a classic Magic Move block. Snippet imports (`<<< @/...`) do
|
|
189
|
+
not participate in chains.
|
|
190
|
+
- `magicMove: true` in the slide's YAML frontmatter is equivalent to the bare
|
|
191
|
+
`magic-move` separator and can be combined with other frontmatter keys.
|
|
192
|
+
|
|
45
193
|
### Using Kodee Mascot
|
|
46
194
|
|
|
47
195
|
Enable Kodee once for the whole deck with `themeConfig`:
|
|
@@ -115,7 +263,7 @@ kodee:
|
|
|
115
263
|
|
|
116
264
|
### Using DrawnAnnotation
|
|
117
265
|
|
|
118
|
-
`<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.
|
|
266
|
+
`<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. Labels accept safe Markdown: backticked inline code and `>` quotes use the local-first JetBrains Mono stack.
|
|
119
267
|
|
|
120
268
|
````md
|
|
121
269
|
<DrawnAnnotation type="circle" text="fun main" label="program entry point" :on="1">
|
|
@@ -129,6 +277,22 @@ fun main() = println("Hello, Kotlin!")
|
|
|
129
277
|
|
|
130
278
|
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
279
|
|
|
280
|
+
### Using InlineCompilerError
|
|
281
|
+
|
|
282
|
+
`<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.
|
|
283
|
+
|
|
284
|
+
````md
|
|
285
|
+
<InlineCompilerError text="userName" message="Unresolved reference: userName" :on="1">
|
|
286
|
+
|
|
287
|
+
```kotlin
|
|
288
|
+
println(userName)
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
</InlineCompilerError>
|
|
292
|
+
````
|
|
293
|
+
|
|
294
|
+
See [`components/README.md`](components/README.md#inlinecompilererror) for the target and click-timing props.
|
|
295
|
+
|
|
132
296
|
#### IntelliJ formatting
|
|
133
297
|
|
|
134
298
|
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 +327,33 @@ npm run build
|
|
|
163
327
|
# Export presentation to PDF
|
|
164
328
|
npm run export
|
|
165
329
|
|
|
166
|
-
# Export
|
|
330
|
+
# Export every slide and click state as PNG screenshots
|
|
167
331
|
npm run screenshot
|
|
332
|
+
|
|
333
|
+
# Export one slide; --click is zero-based (0 is the initial state)
|
|
334
|
+
npm run export:slide -- --slide 12 --click 3
|
|
335
|
+
|
|
336
|
+
# Render this working tree against HEAD and open the generated visual review
|
|
337
|
+
npm run visual:review
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Exporting One Slide
|
|
341
|
+
|
|
342
|
+
`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:
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
# Initial state of slide 12
|
|
346
|
+
npm run export:slide -- --slide 12
|
|
347
|
+
|
|
348
|
+
# State after the third click of slide 12
|
|
349
|
+
npm run export:slide -- --slide 12 --click 3 --output artifacts/slide-12-click-3.png
|
|
350
|
+
|
|
351
|
+
# Use another deck entry
|
|
352
|
+
npm run export:slide -- --entry path/to/talk.md --slide 4 --click 0
|
|
168
353
|
```
|
|
169
354
|
|
|
355
|
+
`--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.
|
|
356
|
+
|
|
170
357
|
### Running the Slides
|
|
171
358
|
|
|
172
359
|
The repository includes `slides.md`, a compact presentation demonstrating the theme's layouts, Kotlin highlighting, Kodee animations, magic moves, and click animations:
|
|
@@ -181,9 +368,11 @@ This will open the example presentation in your browser with hot-reload enabled.
|
|
|
181
368
|
|
|
182
369
|
```
|
|
183
370
|
.
|
|
184
|
-
├── components/
|
|
185
|
-
│ ├──
|
|
186
|
-
│
|
|
371
|
+
├── components/ # Vue components
|
|
372
|
+
│ ├── DrawnAnnotation.vue # Hand-drawn marks, labels, and connectors
|
|
373
|
+
│ ├── InlineCompilerError.vue # Inline code diagnostics
|
|
374
|
+
│ ├── Kodee.vue # Main Kodee mascot component with animations
|
|
375
|
+
│ └── KodeeWrapper.vue # Wrapper component for Kodee integration
|
|
187
376
|
├── slide-bottom.vue # Per-slide Kodee layer shared by every layout
|
|
188
377
|
├── layouts/ # Slidev layout templates
|
|
189
378
|
│ ├── cover.vue # Cover slide layout
|
|
@@ -198,7 +387,7 @@ This will open the example presentation in your browser with hot-reload enabled.
|
|
|
198
387
|
├── styles/ # Theme styles
|
|
199
388
|
│ ├── index.ts # Style entry point
|
|
200
389
|
│ └── layout.css # Layout styles
|
|
201
|
-
├──
|
|
390
|
+
├── .pi/extensions/inspect-shiki-token-scopes.ts # Local Pi tool for inspecting Shiki token scopes
|
|
202
391
|
├── slides.md # Example presentation used for local development and GitHub Pages
|
|
203
392
|
├── package.json # Package configuration and dependencies
|
|
204
393
|
└── LICENSE # Apache License 2.0
|
|
@@ -210,11 +399,47 @@ This will open the example presentation in your browser with hot-reload enabled.
|
|
|
210
399
|
|
|
211
400
|
No environment variables are currently required for this theme.
|
|
212
401
|
|
|
213
|
-
##
|
|
402
|
+
## Visual regression review
|
|
403
|
+
|
|
404
|
+
Visual review starts a temporary Slidev server and uses Playwright Chromium to
|
|
405
|
+
capture every settled click state from Slidev's normal presenter/player route
|
|
406
|
+
(`/<slide>?clicks=<click>`), rather than the print-export `?print=clicks` route.
|
|
407
|
+
It renders the current working tree and a Git revision with the same browser,
|
|
408
|
+
compares every PNG with `pixelmatch`, and writes a three-column
|
|
409
|
+
base/current/diff page. When the local
|
|
410
|
+
`~/Developer/kotlin-fundamentals` consumer deck is available, its baseline is
|
|
411
|
+
rendered from its clean `HEAD` and its current capture includes its working-tree
|
|
412
|
+
changes, with each capture linked to the corresponding theme revision.
|
|
413
|
+
Screenshots are not committed: the chosen Git revision is the baseline, so
|
|
414
|
+
accepting an intentional visual change is simply reviewing it and committing
|
|
415
|
+
that change.
|
|
214
416
|
|
|
215
|
-
|
|
417
|
+
```bash
|
|
418
|
+
# Compare the working tree with the last commit.
|
|
419
|
+
npm run visual:review
|
|
420
|
+
|
|
421
|
+
# Compare a branch with its integration base.
|
|
422
|
+
npm run visual:review -- --base origin/main
|
|
423
|
+
|
|
424
|
+
# Use in automation when any visual difference should fail the command.
|
|
425
|
+
npm run visual:check -- --base origin/main
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
Open the `file://.../.visual/review/index.html` path printed by the command.
|
|
429
|
+
The `.visual/` directory contains disposable base/current captures and diffs
|
|
430
|
+
and is ignored by Git. `npm run screenshot` is the non-comparison escape hatch
|
|
431
|
+
when raw PNGs are all that is needed.
|
|
432
|
+
|
|
433
|
+
The visual exporter requires the Chromium binary supplied by
|
|
434
|
+
`playwright-chromium`. If dependency installation is configured not to run
|
|
435
|
+
package install scripts, download it once with:
|
|
436
|
+
|
|
437
|
+
```bash
|
|
438
|
+
npx playwright install chromium
|
|
439
|
+
```
|
|
216
440
|
|
|
217
|
-
|
|
441
|
+
`npm run lint` validates the deck's frontmatter and Kodee configuration; `npm
|
|
442
|
+
run build` runs that lint before building the Slidev deck.
|
|
218
443
|
|
|
219
444
|
## Configuration
|
|
220
445
|
|
|
@@ -257,11 +482,12 @@ layout: cover
|
|
|
257
482
|
## Dependencies
|
|
258
483
|
|
|
259
484
|
### Runtime Dependencies
|
|
260
|
-
- `@
|
|
261
|
-
- `
|
|
485
|
+
- `@shikijs/magic-move` (4.4.3) - Code-token morphing for Magic Move
|
|
486
|
+
- `@slidev/types` (52.19.1) - Slidev type definitions
|
|
487
|
+
- `roughjs` (4.6.6) - Hand-drawn SVG paths for `DrawnAnnotation`
|
|
262
488
|
|
|
263
489
|
### Development Dependencies
|
|
264
|
-
- `@slidev/cli` (
|
|
490
|
+
- `@slidev/cli` (52.19.1) - Slidev command-line interface
|
|
265
491
|
|
|
266
492
|
## Contributing
|
|
267
493
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Loaded by Node itself when a consuming deck's `vite.config.ts` imports
|
|
2
|
+
// `slidev-theme-kotlin/annotation-editor`, so this entry must be plain
|
|
3
|
+
// JavaScript: Vite's config bundler externalizes resolved node_modules
|
|
4
|
+
// imports, and Node refuses raw TypeScript under node_modules.
|
|
5
|
+
export { drawnAnnotationEditor } from './plugins/drawn-annotation-editor.mjs'
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path d="M19.767 3.33517L22.5484 6.2099L12.4869 15.9447L8.94013 16.5933L9.70549 13.0699L19.767 3.33517Z" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
<path d="M20 14V17C20 18.6569 18.6569 20 17 20H7C5.34315 20 4 18.6569 4 17V7C4 5.34315 5.34315 4 7 4H12" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
+
</svg>
|