slidev-theme-kotlin 0.12.0 → 0.13.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 +84 -0
- package/README.md +350 -27
- package/{public → assets/code-window}/Postgresql_elephant.svg +21 -21
- package/assets/code-window/run.svg +3 -0
- package/bin/kotlin-snippets.mjs +63 -0
- package/components/DrawnAnnotation.vue +787 -251
- package/components/DrawnAnnotationEditorLauncher.vue +11 -2
- package/components/DrawnAnnotationEditorToolbar.vue +284 -87
- package/components/DrawnAnnotationProblems.vue +87 -0
- package/components/InlineCompilerError.vue +323 -260
- package/components/InlineValue.vue +55 -0
- package/components/Kodee.vue +8 -17
- package/components/KodeeWrapper.vue +22 -35
- package/components/MagicMoveBetween.vue +98 -24
- package/components/README.md +376 -40
- package/components/SmartCast.vue +50 -0
- package/components/TypeHint.vue +75 -0
- package/components/Warning.vue +50 -0
- package/components/annotation-label-markdown.ts +139 -22
- package/components/annotation-line-breaks.ts +7 -0
- package/components/code-highlight.ts +434 -0
- package/components/code-text-match.ts +205 -24
- package/components/drawn-annotation/editor-store.ts +92 -13
- package/components/drawn-annotation/geometry.ts +40 -2
- package/components/drawn-annotation/writer-client.ts +8 -10
- package/components/kodee-props.ts +44 -0
- package/components/kodee-view-transition.ts +13 -0
- package/components/magic-move/batched-renderer.ts +158 -0
- package/components/transition-ink.ts +81 -0
- package/global-bottom.vue +48 -0
- package/global-top.vue +8 -3
- package/index.html +9 -0
- package/package.json +12 -6
- package/plugins/drawn-annotation-editor.d.ts +2 -1
- package/plugins/drawn-annotation-editor.mjs +117 -30
- package/setup/analytics.ts +133 -0
- package/setup/code-imports.ts +297 -0
- package/setup/code-window-icon.ts +2 -0
- package/setup/hash-route-redirect.ts +46 -0
- package/setup/kotlin-snippets.ts +510 -0
- package/setup/magic-move-between.ts +33 -11
- package/setup/main.ts +28 -0
- package/setup/shiki.ts +29 -1
- package/setup/static-content.ts +867 -0
- package/setup/transformers.ts +67 -17
- package/setup/vite-plugins.ts +20 -0
- package/styles/layout.css +83 -16
- package/components/annotation-label-markdown.test.ts +0 -22
- package/components/drawn-annotation/editor-store.test.ts +0 -141
- package/components/drawn-annotation/geometry.test.ts +0 -88
- package/plugins/drawn-annotation-editor.test.ts +0 -386
- package/public/kotlin-logo-name-dark-mode.svg +0 -45
- package/public/kotlin-logo-name-light-mode.svg +0 -44
- package/public/kotlin-logo.svg +0 -19
- /package/{public → assets/code-window}/amper-icon.svg +0 -0
- /package/{public → assets/code-window}/gradle.svg +0 -0
- /package/{public → assets/code-window}/gradle_dark.svg +0 -0
- /package/{public → assets/code-window}/java.svg +0 -0
- /package/{public → assets/code-window}/java_dark.svg +0 -0
- /package/{public → assets/code-window}/kotlin.svg +0 -0
- /package/{public → assets/code-window}/kotlin_dark.svg +0 -0
- /package/{public → assets/code-window}/maven.svg +0 -0
- /package/{public → assets/code-window}/maven_dark.svg +0 -0
- /package/{public → assets/code-window}/terminal.svg +0 -0
- /package/{public → assets/code-window}/terminal_dark.svg +0 -0
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
<?xml version="1.0"?>
|
|
2
|
-
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
|
3
|
-
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
4
|
-
|
|
5
|
-
<svg width="432.071pt" height="445.383pt" viewBox="0 0 432.071 445.383" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
|
|
6
|
-
<g id="orginal" style="fill-rule:nonzero;clip-rule:nonzero;stroke:#000000;stroke-miterlimit:4;">
|
|
7
|
-
</g>
|
|
8
|
-
<g id="Layer_x0020_3" style="fill-rule:nonzero;clip-rule:nonzero;fill:none;stroke:#FFFFFF;stroke-width:12.4651;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;">
|
|
9
|
-
<path style="fill:#000000;stroke:#000000;stroke-width:37.3953;stroke-linecap:butt;stroke-linejoin:miter;" d="M323.205,324.227c2.833-23.601,1.984-27.062,19.563-23.239l4.463,0.392c13.517,0.615,31.199-2.174,41.587-7c22.362-10.376,35.622-27.7,13.572-23.148c-50.297,10.376-53.755-6.655-53.755-6.655c53.111-78.803,75.313-178.836,56.149-203.322 C352.514-5.534,262.036,26.049,260.522,26.869l-0.482,0.089c-9.938-2.062-21.06-3.294-33.554-3.496c-22.761-0.374-40.032,5.967-53.133,15.904c0,0-161.408-66.498-153.899,83.628c1.597,31.936,45.777,241.655,98.47,178.31 c19.259-23.163,37.871-42.748,37.871-42.748c9.242,6.14,20.307,9.272,31.912,8.147l0.897-0.765c-0.281,2.876-0.157,5.689,0.359,9.019c-13.572,15.167-9.584,17.83-36.723,23.416c-27.457,5.659-11.326,15.734-0.797,18.367c12.768,3.193,42.305,7.716,62.268-20.224 l-0.795,3.188c5.325,4.26,4.965,30.619,5.72,49.452c0.756,18.834,2.017,36.409,5.856,46.771c3.839,10.36,8.369,37.05,44.036,29.406c29.809-6.388,52.6-15.582,54.677-101.107"/>
|
|
10
|
-
<path style="fill:#336791;stroke:none;" d="M402.395,271.23c-50.302,10.376-53.76-6.655-53.76-6.655c53.111-78.808,75.313-178.843,56.153-203.326c-52.27-66.785-142.752-35.2-144.262-34.38l-0.486,0.087c-9.938-2.063-21.06-3.292-33.56-3.496c-22.761-0.373-40.026,5.967-53.127,15.902 c0,0-161.411-66.495-153.904,83.63c1.597,31.938,45.776,241.657,98.471,178.312c19.26-23.163,37.869-42.748,37.869-42.748c9.243,6.14,20.308,9.272,31.908,8.147l0.901-0.765c-0.28,2.876-0.152,5.689,0.361,9.019c-13.575,15.167-9.586,17.83-36.723,23.416 c-27.459,5.659-11.328,15.734-0.796,18.367c12.768,3.193,42.307,7.716,62.266-20.224l-0.796,3.188c5.319,4.26,9.054,27.711,8.428,48.969c-0.626,21.259-1.044,35.854,3.147,47.254c4.191,11.4,8.368,37.05,44.042,29.406c29.809-6.388,45.256-22.942,47.405-50.555 c1.525-19.631,4.976-16.729,5.194-34.28l2.768-8.309c3.192-26.611,0.507-35.196,18.872-31.203l4.463,0.392c13.517,0.615,31.208-2.174,41.591-7c22.358-10.376,35.618-27.7,13.573-23.148z"/>
|
|
11
|
-
<path d="M215.866,286.484c-1.385,49.516,0.348,99.377,5.193,111.495c4.848,12.118,15.223,35.688,50.9,28.045c29.806-6.39,40.651-18.756,45.357-46.051c3.466-20.082,10.148-75.854,11.005-87.281"/>
|
|
12
|
-
<path d="M173.104,38.256c0,0-161.521-66.016-154.012,84.109c1.597,31.938,45.779,241.664,98.473,178.316c19.256-23.166,36.671-41.335,36.671-41.335"/>
|
|
13
|
-
<path d="M260.349,26.207c-5.591,1.753,89.848-34.889,144.087,34.417c19.159,24.484-3.043,124.519-56.153,203.329"/>
|
|
14
|
-
<path style="stroke-linejoin:bevel;" d="M348.282,263.953c0,0,3.461,17.036,53.764,6.653c22.04-4.552,8.776,12.774-13.577,23.155c-18.345,8.514-59.474,10.696-60.146-1.069c-1.729-30.355,21.647-21.133,19.96-28.739c-1.525-6.85-11.979-13.573-18.894-30.338 c-6.037-14.633-82.796-126.849,21.287-110.183c3.813-0.789-27.146-99.002-124.553-100.599c-97.385-1.597-94.19,119.762-94.19,119.762"/>
|
|
15
|
-
<path d="M188.604,274.334c-13.577,15.166-9.584,17.829-36.723,23.417c-27.459,5.66-11.326,15.733-0.797,18.365c12.768,3.195,42.307,7.718,62.266-20.229c6.078-8.509-0.036-22.086-8.385-25.547c-4.034-1.671-9.428-3.765-16.361,3.994z"/>
|
|
16
|
-
<path d="M187.715,274.069c-1.368-8.917,2.93-19.528,7.536-31.942c6.922-18.626,22.893-37.255,10.117-96.339c-9.523-44.029-73.396-9.163-73.436-3.193c-0.039,5.968,2.889,30.26-1.067,58.548c-5.162,36.913,23.488,68.132,56.479,64.938"/>
|
|
17
|
-
<path style="fill:#FFFFFF;stroke-width:4.155;stroke-linecap:butt;stroke-linejoin:miter;" d="M172.517,141.7c-0.288,2.039,3.733,7.48,8.976,8.207c5.234,0.73,9.714-3.522,9.998-5.559c0.284-2.039-3.732-4.285-8.977-5.015c-5.237-0.731-9.719,0.333-9.996,2.367z"/>
|
|
18
|
-
<path style="fill:#FFFFFF;stroke-width:2.0775;stroke-linecap:butt;stroke-linejoin:miter;" d="M331.941,137.543c0.284,2.039-3.732,7.48-8.976,8.207c-5.238,0.73-9.718-3.522-10.005-5.559c-0.277-2.039,3.74-4.285,8.979-5.015c5.239-0.73,9.718,0.333,10.002,2.368z"/>
|
|
19
|
-
<path d="M350.676,123.432c0.863,15.994-3.445,26.888-3.988,43.914c-0.804,24.748,11.799,53.074-7.191,81.435"/>
|
|
20
|
-
<path style="stroke-width:3;" d="M0,60.232"/>
|
|
21
|
-
</g>
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
|
3
|
+
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
4
|
+
|
|
5
|
+
<svg width="432.071pt" height="445.383pt" viewBox="0 0 432.071 445.383" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
|
|
6
|
+
<g id="orginal" style="fill-rule:nonzero;clip-rule:nonzero;stroke:#000000;stroke-miterlimit:4;">
|
|
7
|
+
</g>
|
|
8
|
+
<g id="Layer_x0020_3" style="fill-rule:nonzero;clip-rule:nonzero;fill:none;stroke:#FFFFFF;stroke-width:12.4651;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;">
|
|
9
|
+
<path style="fill:#000000;stroke:#000000;stroke-width:37.3953;stroke-linecap:butt;stroke-linejoin:miter;" d="M323.205,324.227c2.833-23.601,1.984-27.062,19.563-23.239l4.463,0.392c13.517,0.615,31.199-2.174,41.587-7c22.362-10.376,35.622-27.7,13.572-23.148c-50.297,10.376-53.755-6.655-53.755-6.655c53.111-78.803,75.313-178.836,56.149-203.322 C352.514-5.534,262.036,26.049,260.522,26.869l-0.482,0.089c-9.938-2.062-21.06-3.294-33.554-3.496c-22.761-0.374-40.032,5.967-53.133,15.904c0,0-161.408-66.498-153.899,83.628c1.597,31.936,45.777,241.655,98.47,178.31 c19.259-23.163,37.871-42.748,37.871-42.748c9.242,6.14,20.307,9.272,31.912,8.147l0.897-0.765c-0.281,2.876-0.157,5.689,0.359,9.019c-13.572,15.167-9.584,17.83-36.723,23.416c-27.457,5.659-11.326,15.734-0.797,18.367c12.768,3.193,42.305,7.716,62.268-20.224 l-0.795,3.188c5.325,4.26,4.965,30.619,5.72,49.452c0.756,18.834,2.017,36.409,5.856,46.771c3.839,10.36,8.369,37.05,44.036,29.406c29.809-6.388,52.6-15.582,54.677-101.107"/>
|
|
10
|
+
<path style="fill:#336791;stroke:none;" d="M402.395,271.23c-50.302,10.376-53.76-6.655-53.76-6.655c53.111-78.808,75.313-178.843,56.153-203.326c-52.27-66.785-142.752-35.2-144.262-34.38l-0.486,0.087c-9.938-2.063-21.06-3.292-33.56-3.496c-22.761-0.373-40.026,5.967-53.127,15.902 c0,0-161.411-66.495-153.904,83.63c1.597,31.938,45.776,241.657,98.471,178.312c19.26-23.163,37.869-42.748,37.869-42.748c9.243,6.14,20.308,9.272,31.908,8.147l0.901-0.765c-0.28,2.876-0.152,5.689,0.361,9.019c-13.575,15.167-9.586,17.83-36.723,23.416 c-27.459,5.659-11.328,15.734-0.796,18.367c12.768,3.193,42.307,7.716,62.266-20.224l-0.796,3.188c5.319,4.26,9.054,27.711,8.428,48.969c-0.626,21.259-1.044,35.854,3.147,47.254c4.191,11.4,8.368,37.05,44.042,29.406c29.809-6.388,45.256-22.942,47.405-50.555 c1.525-19.631,4.976-16.729,5.194-34.28l2.768-8.309c3.192-26.611,0.507-35.196,18.872-31.203l4.463,0.392c13.517,0.615,31.208-2.174,41.591-7c22.358-10.376,35.618-27.7,13.573-23.148z"/>
|
|
11
|
+
<path d="M215.866,286.484c-1.385,49.516,0.348,99.377,5.193,111.495c4.848,12.118,15.223,35.688,50.9,28.045c29.806-6.39,40.651-18.756,45.357-46.051c3.466-20.082,10.148-75.854,11.005-87.281"/>
|
|
12
|
+
<path d="M173.104,38.256c0,0-161.521-66.016-154.012,84.109c1.597,31.938,45.779,241.664,98.473,178.316c19.256-23.166,36.671-41.335,36.671-41.335"/>
|
|
13
|
+
<path d="M260.349,26.207c-5.591,1.753,89.848-34.889,144.087,34.417c19.159,24.484-3.043,124.519-56.153,203.329"/>
|
|
14
|
+
<path style="stroke-linejoin:bevel;" d="M348.282,263.953c0,0,3.461,17.036,53.764,6.653c22.04-4.552,8.776,12.774-13.577,23.155c-18.345,8.514-59.474,10.696-60.146-1.069c-1.729-30.355,21.647-21.133,19.96-28.739c-1.525-6.85-11.979-13.573-18.894-30.338 c-6.037-14.633-82.796-126.849,21.287-110.183c3.813-0.789-27.146-99.002-124.553-100.599c-97.385-1.597-94.19,119.762-94.19,119.762"/>
|
|
15
|
+
<path d="M188.604,274.334c-13.577,15.166-9.584,17.829-36.723,23.417c-27.459,5.66-11.326,15.733-0.797,18.365c12.768,3.195,42.307,7.718,62.266-20.229c6.078-8.509-0.036-22.086-8.385-25.547c-4.034-1.671-9.428-3.765-16.361,3.994z"/>
|
|
16
|
+
<path d="M187.715,274.069c-1.368-8.917,2.93-19.528,7.536-31.942c6.922-18.626,22.893-37.255,10.117-96.339c-9.523-44.029-73.396-9.163-73.436-3.193c-0.039,5.968,2.889,30.26-1.067,58.548c-5.162,36.913,23.488,68.132,56.479,64.938"/>
|
|
17
|
+
<path style="fill:#FFFFFF;stroke-width:4.155;stroke-linecap:butt;stroke-linejoin:miter;" d="M172.517,141.7c-0.288,2.039,3.733,7.48,8.976,8.207c5.234,0.73,9.714-3.522,9.998-5.559c0.284-2.039-3.732-4.285-8.977-5.015c-5.237-0.731-9.719,0.333-9.996,2.367z"/>
|
|
18
|
+
<path style="fill:#FFFFFF;stroke-width:2.0775;stroke-linecap:butt;stroke-linejoin:miter;" d="M331.941,137.543c0.284,2.039-3.732,7.48-8.976,8.207c-5.238,0.73-9.718-3.522-10.005-5.559c-0.277-2.039,3.74-4.285,8.979-5.015c5.239-0.73,9.718,0.333,10.002,2.368z"/>
|
|
19
|
+
<path d="M350.676,123.432c0.863,15.994-3.445,26.888-3.988,43.914c-0.804,24.748,11.799,53.074-7.191,81.435"/>
|
|
20
|
+
<path style="stroke-width:3;" d="M0,60.232"/>
|
|
21
|
+
</g>
|
|
22
22
|
</svg>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `slidev-kotlin-snippets [entry.md] [--check]`
|
|
4
|
+
*
|
|
5
|
+
* Generate one compilable Kotlin file per Kotlin fence of a deck (see
|
|
6
|
+
* `setup/kotlin-snippets.ts`), under the directory and package named by
|
|
7
|
+
* `themeConfig.snippets` in the deck's headmatter. `--check` writes nothing
|
|
8
|
+
* and exits non-zero when the files on disk are missing, stale, or no longer
|
|
9
|
+
* produced, for CI. The entry defaults to `slides.md` in the working
|
|
10
|
+
* directory.
|
|
11
|
+
*/
|
|
12
|
+
import { existsSync } from 'node:fs'
|
|
13
|
+
import { dirname, relative, resolve } from 'node:path'
|
|
14
|
+
import { fileURLToPath } from 'node:url'
|
|
15
|
+
import { createJiti } from 'jiti'
|
|
16
|
+
import { injectPreparserExtensionLoader, load } from '@slidev/parser/fs'
|
|
17
|
+
|
|
18
|
+
const args = process.argv.slice(2)
|
|
19
|
+
const check = args.includes('--check')
|
|
20
|
+
const positional = args.filter(arg => !arg.startsWith('--'))
|
|
21
|
+
if (args.includes('--help') || args.includes('-h') || positional.length > 1) {
|
|
22
|
+
console.log('Usage: slidev-kotlin-snippets [entry.md] [--check]')
|
|
23
|
+
process.exit(positional.length > 1 ? 1 : 0)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const entry = resolve(positional[0] ?? 'slides.md')
|
|
27
|
+
if (!existsSync(entry)) {
|
|
28
|
+
console.error(`[slidev-theme-kotlin] no such entry: ${entry}`)
|
|
29
|
+
process.exit(1)
|
|
30
|
+
}
|
|
31
|
+
const userRoot = dirname(entry)
|
|
32
|
+
|
|
33
|
+
// The theme's setup modules are TypeScript, compiled by Vite when Slidev
|
|
34
|
+
// runs them. jiti (a dependency of @slidev/cli) does the same for this CLI.
|
|
35
|
+
const jiti = createJiti(import.meta.url)
|
|
36
|
+
const { collectSnippetFiles, resolveSnippetSettings, syncSnippetFiles } = await jiti.import('../setup/kotlin-snippets.ts')
|
|
37
|
+
const preparser = (await jiti.import('../setup/preparser.ts')).default
|
|
38
|
+
|
|
39
|
+
// Slidev registers the theme's preparser (the bare `magic-move` separator)
|
|
40
|
+
// when it loads a deck; do the same so slides split exactly as they present.
|
|
41
|
+
injectPreparserExtensionLoader((roots, headmatter, filepath, mode) => preparser({ filepath, headmatter, mode }))
|
|
42
|
+
const data = await load({ roots: [userRoot], userRoot }, entry)
|
|
43
|
+
|
|
44
|
+
const settings = resolveSnippetSettings(data.headmatter.themeConfig)
|
|
45
|
+
if (!settings) {
|
|
46
|
+
console.error('[slidev-theme-kotlin] set `themeConfig.snippets` in the headmatter (`true`, or `{ dir, package, imports }`) to generate Kotlin snippets')
|
|
47
|
+
process.exit(1)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const files = collectSnippetFiles(data.slides, userRoot, settings)
|
|
51
|
+
const result = syncSnippetFiles(userRoot, settings, files, { check })
|
|
52
|
+
const dir = relative(process.cwd(), resolve(userRoot, settings.dir)) || '.'
|
|
53
|
+
if (check) {
|
|
54
|
+
const stale = [...result.written.map(path => ` stale or missing: ${path}`), ...result.removed.map(path => ` no longer produced: ${path}`)]
|
|
55
|
+
if (stale.length) {
|
|
56
|
+
console.error(`[slidev-theme-kotlin] snippets in ${dir} are out of date; run \`slidev-kotlin-snippets\`:\n${stale.join('\n')}`)
|
|
57
|
+
process.exit(1)
|
|
58
|
+
}
|
|
59
|
+
console.log(`[slidev-theme-kotlin] snippets: ${files.length} files in ${dir} are up to date`)
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
console.log(`[slidev-theme-kotlin] snippets: ${files.length} files in ${dir} (${result.written.length} written, ${result.removed.length} removed, ${result.unchanged.length} unchanged)`)
|
|
63
|
+
}
|