@troshab/slidev-theme-troshab 0.1.8 → 0.1.14
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/CLAUDE.md +19 -0
- package/components/Stepper.vue +14 -9
- package/package.json +1 -1
- package/setup/mermaid.ts +12 -0
- package/setup/preparser.ts +71 -0
- package/setup/vite-plugins.ts +27 -0
- package/styles/base.css +27 -8
package/CLAUDE.md
CHANGED
|
@@ -181,6 +181,7 @@ Theme automatically applies matching colors via `setup/mermaid.ts` (reads CSS va
|
|
|
181
181
|
2. **Limit nodes** — max 6-8 for flowcharts
|
|
182
182
|
3. **No titles in xychart** — causes overflow
|
|
183
183
|
4. **Use abbreviations** — `LB` not `Load Balancer`
|
|
184
|
+
5. **Labels render as SVG `<text>`** — `setup/mermaid.ts` sets `htmlLabels: false`, fixing the foreignObject width=0 off-centre bug in Slidev's shadow-DOM render. Single- and multi-line node labels both centre correctly (`<br/>` for line breaks). No special handling needed.
|
|
184
185
|
|
|
185
186
|
### Limits by type
|
|
186
187
|
|
|
@@ -535,3 +536,21 @@ Phosphor Icons via Iconify (`@iconify-json/ph`). Use via `<Icon>` component:
|
|
|
535
536
|
```
|
|
536
537
|
|
|
537
538
|
Weight suffixes: (none) = regular, `-bold`, `-fill`, `-duotone`, `-thin`, `-light`.
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
## Related Projects (Cyber Academy)
|
|
542
|
+
|
|
543
|
+
This project is part of the Cyber Academy content factory. See `~/cyber-academy/README.md` for the full map.
|
|
544
|
+
|
|
545
|
+
| Path | Role |
|
|
546
|
+
|------|------|
|
|
547
|
+
| `~/colo_cyberrange` | LMS platform (delivery) |
|
|
548
|
+
| `~/soc-tier-2` | SOC Tier 1+2 program (course-gen DB pipeline) |
|
|
549
|
+
| `~/was26` | Web App Security 2026 (Slidev course) |
|
|
550
|
+
| `~/ll26` | Binary Exploitation 2026 (Slidev course, planned) |
|
|
551
|
+
| `~/avis26` | NaUKMA F5 bachelor program (curriculum admin) |
|
|
552
|
+
| `~/slidev-theme-troshab` | Slidev theme used by all course presentations |
|
|
553
|
+
|
|
554
|
+
Authoring tools: `~/.claude/plugins/marketplaces/troshab-own-claude-code` (skills `course-*`, `slidev-*`, `ukrainize-text`).
|
|
555
|
+
|
|
556
|
+
Cross-project navigation: `/troshab-own:cyber-academy` slash command.
|
package/components/Stepper.vue
CHANGED
|
@@ -240,7 +240,7 @@ function isUpcoming(index: number) {
|
|
|
240
240
|
display: flex;
|
|
241
241
|
flex-direction: column;
|
|
242
242
|
width: 100%;
|
|
243
|
-
padding: 0.25rem;
|
|
243
|
+
padding: 0.25rem 0.25rem 0;
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
/* ===== Track ===== */
|
|
@@ -267,12 +267,12 @@ function isUpcoming(index: number) {
|
|
|
267
267
|
.stepper-step {
|
|
268
268
|
display: flex;
|
|
269
269
|
align-items: center;
|
|
270
|
-
/* Reserve horizontal space for .stepper-marker's transform:
|
|
271
|
-
* active state. Scaled marker's visible box extends ~6px past
|
|
272
|
-
* box; without padding, step.scrollWidth exceeds
|
|
273
|
-
*
|
|
274
|
-
* scrollable overflow. */
|
|
275
|
-
padding:
|
|
270
|
+
/* Reserve horizontal AND vertical space for .stepper-marker's transform:
|
|
271
|
+
* scale(1.15) on active state. Scaled marker's visible box extends ~6px past
|
|
272
|
+
* its layout box; without padding, step.scrollWidth/scrollHeight exceeds
|
|
273
|
+
* clientWidth/clientHeight by 1-5px. Per CSS spec, transformed descendants
|
|
274
|
+
* count toward parent scrollable overflow. */
|
|
275
|
+
padding: var(--transform-scale-comp);
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
.stepper-horizontal .stepper-step {
|
|
@@ -459,7 +459,7 @@ function isUpcoming(index: number) {
|
|
|
459
459
|
.stepper-arrow-char {
|
|
460
460
|
color: var(--color-text-tertiary);
|
|
461
461
|
font-size: 2rem;
|
|
462
|
-
line-height: 1;
|
|
462
|
+
line-height: 1.25;
|
|
463
463
|
}
|
|
464
464
|
|
|
465
465
|
.stepper-connector.is-completed .stepper-arrow-char {
|
|
@@ -479,10 +479,15 @@ function isUpcoming(index: number) {
|
|
|
479
479
|
}
|
|
480
480
|
|
|
481
481
|
.stepper-vertical.stepper-arrows .stepper-connector {
|
|
482
|
+
width: auto;
|
|
483
|
+
min-width: 2rem;
|
|
484
|
+
min-height: 2.5rem;
|
|
482
485
|
background: none;
|
|
483
486
|
display: flex;
|
|
484
487
|
align-items: center;
|
|
485
|
-
|
|
488
|
+
justify-content: center;
|
|
489
|
+
margin-left: calc(var(--stepper-marker-size) / 2 - 1rem);
|
|
490
|
+
line-height: 1;
|
|
486
491
|
}
|
|
487
492
|
|
|
488
493
|
.stepper-vertical .stepper-connector.is-completed {
|
package/package.json
CHANGED
package/setup/mermaid.ts
CHANGED
|
@@ -60,6 +60,18 @@ export default defineMermaidSetup(() => {
|
|
|
60
60
|
return {
|
|
61
61
|
theme: 'base',
|
|
62
62
|
darkMode: isDark,
|
|
63
|
+
|
|
64
|
+
// Labels as native SVG <text> (centred via text-anchor) instead of
|
|
65
|
+
// htmlLabels (<p> in <foreignObject>). Slidev renders Mermaid into a SHADOW
|
|
66
|
+
// DOM where the foreignObject label is measured as width=0, and
|
|
67
|
+
// MermaidChart.vue's unlockSvg sets overflow:visible — so the text spilled
|
|
68
|
+
// out of the zero-width box ~15px right of centre. SVG <text> centres
|
|
69
|
+
// geometrically and is immune to that. Must be TOP-LEVEL (per-diagram
|
|
70
|
+
// `flowchart.htmlLabels` is deprecated/ignored). Single- AND multi-line
|
|
71
|
+
// labels both centre correctly (verified: offset 0px, symmetric gaps on
|
|
72
|
+
// each line) — the old mermaid#1177 tspan left-align no longer reproduces.
|
|
73
|
+
htmlLabels: false,
|
|
74
|
+
|
|
63
75
|
themeVariables: {
|
|
64
76
|
// Background
|
|
65
77
|
background: colors.bg,
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render markdown inside block-level theme components.
|
|
3
|
+
*
|
|
4
|
+
* markdown-it (and MDC) treat text flush against a custom block tag
|
|
5
|
+
* (<Callout>, <Card>, <StyledList>, ...) as a raw HTML block, so inline
|
|
6
|
+
* markdown inside it (**bold**, `code`, [links]) is NOT parsed. CommonMark
|
|
7
|
+
* needs a blank line after the opening tag and before the closing tag for the
|
|
8
|
+
* inner content to be parsed as markdown.
|
|
9
|
+
*
|
|
10
|
+
* This normalizes ANY PascalCase component used as a block (tag alone on its
|
|
11
|
+
* own line). Inline usage (<UPN>x</UPN> inside a sentence) is left untouched,
|
|
12
|
+
* and fenced code regions are skipped so component examples in code blocks are
|
|
13
|
+
* not rewritten.
|
|
14
|
+
*
|
|
15
|
+
* LOADING: Slidev loads preparser setups from the project and from ADDONS only,
|
|
16
|
+
* never from a theme root. So a deck must list this theme as an addon to pick
|
|
17
|
+
* this up:
|
|
18
|
+
*
|
|
19
|
+
* ---
|
|
20
|
+
* theme: "@troshab/slidev-theme-troshab"
|
|
21
|
+
* addons: ["@troshab/slidev-theme-troshab"]
|
|
22
|
+
* ---
|
|
23
|
+
*
|
|
24
|
+
* (The deck-scaffolding skill emits both lines.) Until a deck does that, an
|
|
25
|
+
* identical copy can live in the deck's own setup/preparser.ts.
|
|
26
|
+
*
|
|
27
|
+
* definePreparserSetup is an identity helper; we export the raw function to
|
|
28
|
+
* avoid importing @slidev/types (which jiti's CJS interop can choke on at the
|
|
29
|
+
* preparser stage).
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
const OPEN_ALONE = /^\s*<[A-Z][A-Za-z0-9]*\b[^>]*?>\s*$/
|
|
33
|
+
const CLOSE_ALONE = /^\s*<\/[A-Z][A-Za-z0-9]*>\s*$/
|
|
34
|
+
const SELF_CLOSE = /\/>\s*$/
|
|
35
|
+
const FENCE = /^\s*(```|~~~)/
|
|
36
|
+
|
|
37
|
+
export default () => [
|
|
38
|
+
{
|
|
39
|
+
name: 'troshab:md-in-components',
|
|
40
|
+
transformRawLines(lines: string[]) {
|
|
41
|
+
// Mark fenced code regions so we never rewrite inside them.
|
|
42
|
+
const inCode: boolean[] = new Array(lines.length).fill(false)
|
|
43
|
+
let fence = false
|
|
44
|
+
for (let i = 0; i < lines.length; i++) {
|
|
45
|
+
if (FENCE.test(lines[i])) {
|
|
46
|
+
inCode[i] = true // the fence line itself
|
|
47
|
+
fence = !fence
|
|
48
|
+
continue
|
|
49
|
+
}
|
|
50
|
+
inCode[i] = fence
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Insert blank lines bottom-up so splices don't shift unprocessed indices.
|
|
54
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
55
|
+
if (inCode[i]) continue
|
|
56
|
+
const line = lines[i]
|
|
57
|
+
|
|
58
|
+
if (CLOSE_ALONE.test(line)) {
|
|
59
|
+
if (i > 0 && lines[i - 1].trim() !== '') lines.splice(i, 0, '')
|
|
60
|
+
continue
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (OPEN_ALONE.test(line) && !SELF_CLOSE.test(line)) {
|
|
64
|
+
if (i + 1 < lines.length && lines[i + 1].trim() !== '') {
|
|
65
|
+
lines.splice(i + 1, 0, '')
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* slidev-theme-troshab — Vite Plugins Setup
|
|
3
|
+
*
|
|
4
|
+
* Fix: `lz-string` 1.5.0 is CJS-only (no `exports`/`module` fields).
|
|
5
|
+
* `@slidev/client/modules/mermaid.ts` does `import lz from 'lz-string'`
|
|
6
|
+
* which fails at runtime unless Vite pre-bundles the dep through esbuild
|
|
7
|
+
* (which fabricates a `default` export). Forcing `optimizeDeps.include`
|
|
8
|
+
* makes the pre-bundle deterministic across modules and CI environments.
|
|
9
|
+
*
|
|
10
|
+
* NOTE: this file runs through jiti BEFORE Vite starts, so it must avoid
|
|
11
|
+
* importing from ESM-only packages like `@slidev/types` (jiti's CJS interop
|
|
12
|
+
* crashes on them). `defineVitePluginsSetup` is just an identity helper
|
|
13
|
+
* for type inference; we drop it and export the raw setup function.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export default () => [
|
|
17
|
+
{
|
|
18
|
+
name: 'troshab:dep-optimization',
|
|
19
|
+
config() {
|
|
20
|
+
return {
|
|
21
|
+
optimizeDeps: {
|
|
22
|
+
include: ['lz-string'],
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
]
|
package/styles/base.css
CHANGED
|
@@ -11,12 +11,8 @@
|
|
|
11
11
|
/* Import color system */
|
|
12
12
|
@import './colors.css';
|
|
13
13
|
|
|
14
|
-
/*
|
|
15
|
-
|
|
16
|
-
Provides proper unicode-range subsetting
|
|
17
|
-
(latin, cyrillic, cyrillic-ext, etc.)
|
|
18
|
-
============================================ */
|
|
19
|
-
|
|
14
|
+
/* @font-face via @fontsource — must come BEFORE any other CSS rules per
|
|
15
|
+
* CSS spec (all @import / @charset / @layer at top of file). */
|
|
20
16
|
@import '@fontsource/ibm-plex-sans/400.css';
|
|
21
17
|
@import '@fontsource/ibm-plex-sans/500.css';
|
|
22
18
|
@import '@fontsource/ibm-plex-sans/600.css';
|
|
@@ -24,6 +20,15 @@
|
|
|
24
20
|
@import '@fontsource/ibm-plex-mono/400.css';
|
|
25
21
|
@import '@fontsource/ibm-plex-mono/500.css';
|
|
26
22
|
|
|
23
|
+
/* Slidev fix: #slidev-goto-dialog уse `-top-20` (-5rem) для closed state, але
|
|
24
|
+
* з 100+ слайдів список autocomplete стає вищим за 5rem і видно нижню
|
|
25
|
+
* частину з-під верху екрану. Перекриваємо: коли dialog має `-top-20` клас,
|
|
26
|
+
* примусово ховаємо через translateY(-100%). */
|
|
27
|
+
#slidev-goto-dialog.\-top-20 {
|
|
28
|
+
transform: translateY(-100%);
|
|
29
|
+
pointer-events: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
27
32
|
/* ============================================
|
|
28
33
|
2. CSS Custom Properties (Typography & Layout)
|
|
29
34
|
Note: Colors are defined in colors.css
|
|
@@ -56,7 +61,7 @@
|
|
|
56
61
|
Chung (2004, Vision Research): optimal 1.25-1.5 for body.
|
|
57
62
|
Bringhurst "Elements of Typographic Style": headings 1.1-1.25, body 1.3-1.5.
|
|
58
63
|
Kolers et al. (1981): reading speed U-curve — extremes reduce speed. */
|
|
59
|
-
--line-height-heading: 1.
|
|
64
|
+
--line-height-heading: 1.4; /* IBM Plex Sans + Cyrillic descender (у, р, ф, ц, щ) need extra room - 1.3 caused 1-8px h1 overflow */
|
|
60
65
|
--line-height-body: 1.4; /* Chung mid — comfortable for slides */
|
|
61
66
|
--line-height-reading: 1.5; /* Chung upper — BDA recommended for paragraphs */
|
|
62
67
|
--line-height-list: 1.4; /* matches body for consistency */
|
|
@@ -159,7 +164,7 @@
|
|
|
159
164
|
letter-spacing: var(--letter-spacing-body);
|
|
160
165
|
word-spacing: var(--word-spacing-body);
|
|
161
166
|
color: var(--color-text);
|
|
162
|
-
padding: var(--safe-inset-y) var(--safe-inset-x);
|
|
167
|
+
padding: var(--safe-inset-y) var(--safe-inset-x) calc(var(--safe-inset-y) - 16px);
|
|
163
168
|
height: 100%;
|
|
164
169
|
width: 100%;
|
|
165
170
|
}
|
|
@@ -182,6 +187,7 @@
|
|
|
182
187
|
line-height: 1.45;
|
|
183
188
|
}
|
|
184
189
|
|
|
190
|
+
|
|
185
191
|
/* --- Headings --- */
|
|
186
192
|
.slidev-layout h1,
|
|
187
193
|
.slidev-layout h2,
|
|
@@ -763,6 +769,19 @@
|
|
|
763
769
|
padding-bottom: 1%;
|
|
764
770
|
}
|
|
765
771
|
|
|
772
|
+
/* Split + footer: explicit grid rows so panels share remaining height with
|
|
773
|
+
* footer (auto). Without this, panel height defaults stretch and footer adds
|
|
774
|
+
* a 3rd auto-row, causing total > viewport (~80-200px overflow). */
|
|
775
|
+
.slide-split:has(.slide-footer) {
|
|
776
|
+
grid-template-rows: 1fr auto;
|
|
777
|
+
}
|
|
778
|
+
.slide-split:has(.slide-footer) .slide-panel {
|
|
779
|
+
min-height: 0;
|
|
780
|
+
}
|
|
781
|
+
.slide-split:has(.slide-footer) .slide-panel-content {
|
|
782
|
+
overflow: hidden;
|
|
783
|
+
}
|
|
784
|
+
|
|
766
785
|
/* ============================================
|
|
767
786
|
8. Component Styles
|
|
768
787
|
============================================ */
|