@miragon/slidev-toolkit 1.2.1 → 1.4.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.
@@ -42,5 +42,6 @@ const GAPS: Record<string, string> = {
42
42
  gap: var(--mg-gap);
43
43
  align-items: stretch;
44
44
  margin-top: 0.5rem;
45
+ margin-bottom: 1rem;
45
46
  }
46
47
  </style>
@@ -0,0 +1,110 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * CodeBlock — beschriftetes Code-„Fenster" in Miragon-CI.
4
+ *
5
+ * Rahmt einen Markdown-Code-Fence (im Default-Slot) mit einer weißen Brand-Card
6
+ * (wie <Card>: weiß, dünne Border, weicher blauer Schatten) und einer Kopfzeile
7
+ * aus optionalem Dateinamen (links, Geist Mono, gedämpft) und optionalem
8
+ * Sprach-Badge (rechts, blau — der einzige Brand-Akzent). Der eingebettete Fence
9
+ * behält Shikis Syntax-Highlighting in Reinform; sein Rahmen und jeglicher
10
+ * Zeilen-Hintergrund werden hier zurückgesetzt, damit die Komponente den Rahmen
11
+ * besitzt und der Code klar auf Weiß steht.
12
+ *
13
+ * Props:
14
+ * file Dateiname/Pfad in der Kopfzeile (optional).
15
+ * lang Sprach-Badge rechts in der Kopfzeile (optional, z. B. "md").
16
+ * size CSS-Schriftgröße des Codes (z. B. "0.9rem", "14px"); ohne
17
+ * Angabe die Standardgröße.
18
+ * hideHeader Kopfzeile ausblenden, auch wenn file/lang gesetzt sind
19
+ * (Standard: sichtbar).
20
+ *
21
+ * Nutzung (Fence auf eigenen Zeilen, Leerzeilen drumherum, damit er als
22
+ * Markdown geparst wird — wie die Bullet-Regel bei <SplitView>):
23
+ *
24
+ * <CodeBlock file="deck/slides.md" lang="md">
25
+ *
26
+ * ```md
27
+ * # Build decks like **code**
28
+ * ```
29
+ *
30
+ * </CodeBlock>
31
+ */
32
+ const props = defineProps<{
33
+ file?: string
34
+ lang?: string
35
+ size?: string
36
+ hideHeader?: boolean
37
+ }>()
38
+
39
+ const showHeader = () => Boolean((props.file || props.lang) && !props.hideHeader)
40
+ </script>
41
+
42
+ <template>
43
+ <div class="mg-code" :class="{ 'mg-code--sized': size }" :style="size ? { '--mg-code-size': size } : undefined">
44
+ <div v-if="showHeader()" class="mg-code__bar">
45
+ <span v-if="file" class="mg-code__file">{{ file }}</span>
46
+ <span v-if="lang" class="mg-code__lang">{{ lang }}</span>
47
+ </div>
48
+ <div class="mg-code__body"><slot /></div>
49
+ </div>
50
+ </template>
51
+
52
+ <style scoped>
53
+ .mg-code {
54
+ border-radius: 0.6rem;
55
+ border: 1px solid #e5e7eb;
56
+ background: var(--miragon-white);
57
+ box-shadow: 0 8px 20px rgba(51, 93, 229, 0.08);
58
+ overflow: hidden;
59
+ }
60
+ .mg-code__bar {
61
+ display: flex;
62
+ align-items: center;
63
+ justify-content: space-between;
64
+ gap: 0.75rem;
65
+ padding: 0.55rem 0.9rem;
66
+ background: var(--miragon-gray-light);
67
+ border-bottom: 1px solid #e5e7eb;
68
+ }
69
+ .mg-code__file {
70
+ font-family: var(--miragon-font-mono, ui-monospace, monospace);
71
+ font-size: 0.78rem;
72
+ color: var(--miragon-text-muted);
73
+ }
74
+ .mg-code__lang {
75
+ font-family: var(--miragon-font-mono, ui-monospace, monospace);
76
+ font-size: 0.68rem;
77
+ font-weight: 600;
78
+ text-transform: uppercase;
79
+ letter-spacing: 0.04em;
80
+ color: var(--miragon-blue-dark);
81
+ background: var(--miragon-blue-light);
82
+ border-radius: 0.35rem;
83
+ padding: 0.1rem 0.45rem;
84
+ }
85
+ .mg-code__body {
86
+ padding: 0.4rem 0.5rem;
87
+ }
88
+ /* The nested Shiki fence keeps its highlighting but drops the bare-fence frame
89
+ from code.css — the component owns the border, radius and shadow. The inner
90
+ <code> reset guards against any layout that tints inline code: fenced code
91
+ must stay a clean, unhighlighted-background block. */
92
+ .mg-code__body :deep(.slidev-code) {
93
+ border: none;
94
+ border-radius: 0;
95
+ box-shadow: none;
96
+ margin: 0;
97
+ padding: 0.5rem 0.6rem;
98
+ background: transparent;
99
+ }
100
+ .mg-code__body :deep(.slidev-code code) {
101
+ background: transparent;
102
+ padding: 0;
103
+ }
104
+ /* Optional per-instance font size. Slidev pins .slidev-code font-size with
105
+ !important, so the override needs it too. Only emitted when `size` is set,
106
+ leaving the default untouched otherwise. */
107
+ .mg-code--sized :deep(.slidev-code) {
108
+ font-size: var(--mg-code-size) !important;
109
+ }
110
+ </style>
@@ -62,6 +62,7 @@ const columns = computed(() => {
62
62
  .mg-split {
63
63
  display: grid;
64
64
  margin-top: 0.5rem;
65
+ margin-bottom: 1rem;
65
66
  }
66
67
  /* min-width:0 verhindert, dass breite Grafiken die Spalte über fr sprengen. */
67
68
  .mg-split__visual,
package/layouts/bpmn.vue CHANGED
@@ -151,7 +151,7 @@ const diagramSrc = computed(() => withBase(props.diagram))
151
151
  margin: 0;
152
152
  line-height: 1.5;
153
153
  }
154
- .bpmn-caption :deep(code) {
154
+ .bpmn-caption :deep(:not(pre) > code) {
155
155
  font-family: var(--miragon-font-mono);
156
156
  font-size: 0.9em;
157
157
  background: var(--miragon-blue-light);
@@ -175,7 +175,8 @@ const accentVar = computed(() =>
175
175
  text-decoration: none;
176
176
  border-bottom: 1px solid currentColor;
177
177
  }
178
- .content-body :deep(code) {
178
+
179
+ .content-body :deep(:not(pre) > code) {
179
180
  font-family: var(--miragon-font-mono);
180
181
  font-size: 0.9em;
181
182
  background: var(--miragon-blue-light);
package/layouts/dmn.vue CHANGED
@@ -165,7 +165,7 @@ const diagramSrc = computed(() => withBase(props.diagram))
165
165
  margin: 0;
166
166
  line-height: 1.5;
167
167
  }
168
- .dmn-caption :deep(code) {
168
+ .dmn-caption :deep(:not(pre) > code) {
169
169
  font-family: var(--miragon-font-mono);
170
170
  font-size: 0.9em;
171
171
  background: var(--miragon-blue-light);
@@ -265,7 +265,8 @@ const rightVerdictClass = computed(() => (props.leftIsGood ? 'verdict-bad' : 've
265
265
  border-radius: 0.18rem;
266
266
  background: var(--gb-grad);
267
267
  }
268
- .panel-body :deep(code) {
268
+
269
+ .panel-body :deep(:not(pre) > code) {
269
270
  font-family: var(--miragon-font-mono);
270
271
  font-size: 0.9em;
271
272
  background: var(--miragon-blue-light);
@@ -276,10 +277,6 @@ const rightVerdictClass = computed(() => (props.leftIsGood ? 'verdict-bad' : 've
276
277
  .panel-body :deep(pre) {
277
278
  font-family: var(--miragon-font-mono);
278
279
  font-size: 0.9rem;
279
- background: var(--miragon-blue-light);
280
- color: var(--miragon-text-primary);
281
- padding: 0.8rem 1rem;
282
- border-radius: 0.5rem;
283
280
  margin: 0.4rem 0 0;
284
281
  overflow-x: auto;
285
282
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miragon/slidev-toolkit",
3
- "version": "1.2.1",
3
+ "version": "1.4.0",
4
4
  "description": "Miragon Slidev toolkit: the brand theme, the layout archetypes, the reusable components (Card, CardGrid, StepList, Figure, SplitView) and the BrandMeshBackground animation. Single source of design truth, consumed by the reference deck in this repo.",
5
5
  "keywords": [
6
6
  "slidev-theme",
@@ -0,0 +1,33 @@
1
+ /* Code blocks — Miragon CI frame for every Shiki fence.
2
+ *
3
+ * Slidev renders a Markdown ```lang fence to <pre class="slidev-code shiki …">.
4
+ * By default that is a bare, unframed block. Here we give every fence the same
5
+ * white-card treatment the <Card> component uses (white background, thin grey
6
+ * border, soft blue brand shadow, rounded corners) so code reads as part of the
7
+ * design system. Font is already Geist Mono via --slidev-code-font-family
8
+ * (index.css). Colours come from theme.css — no hardcoded hex except the shared
9
+ * border/scrollbar neutrals already used across the toolkit.
10
+ *
11
+ * The <CodeBlock> component wraps a fence in a titled window; it strips this
12
+ * bare frame from the nested fence itself (see CodeBlock.vue) and supplies its
13
+ * own header + frame instead.
14
+ */
15
+
16
+ /* Every Shiki fence carries both `.shiki` and `.slidev-code`. Targeting both
17
+ (specificity 0,2,0) frames code in EVERY layout — including custom ones like
18
+ `goodbad` whose panels sit outside `.slidev-layout` — while staying low enough
19
+ that the <CodeBlock> component's :deep rules (0,3,0) can still reset it. */
20
+ .shiki.slidev-code {
21
+ background: var(--miragon-white);
22
+ border: 1px solid #e5e7eb;
23
+ border-radius: 0.6rem;
24
+ box-shadow: 0 8px 20px rgba(51, 93, 229, 0.06);
25
+ overflow-x: auto;
26
+ }
27
+
28
+ /* A caption line under a fence (a following *italic* line) reads as a muted
29
+ label, not body text. Kept subtle. */
30
+ .shiki.slidev-code + p em:only-child {
31
+ color: var(--miragon-text-muted);
32
+ font-size: 0.8rem;
33
+ }
package/styles/index.css CHANGED
@@ -6,6 +6,8 @@
6
6
  als in 0.49). */
7
7
  @import './theme.css';
8
8
  @import './fonts.css';
9
+ @import './code.css';
10
+ @import './table.css';
9
11
 
10
12
  /* Brand typography: Geist for everything, Geist Mono for code. Set on the app
11
13
  root so it cascades into every layout; redirect Slidev's code-font variable
@@ -0,0 +1,62 @@
1
+ /* Tables — Miragon CI frame for native Markdown tables.
2
+ *
3
+ * A Markdown table (`| a | b |`) is plain markdown, so it needs no component and
4
+ * keeps the slide source clean (it passes the no-raw-html check). This file gives
5
+ * every rendered `<table>` the same white-card treatment the <Card> component and
6
+ * code fences use: white surface, thin grey border, soft blue brand shadow,
7
+ * rounded corners. Header text stays BLACK (the heading rule); the single
8
+ * restrained accent is the blue rule under the header row. Body text is Geist
9
+ * Mono, matching the "Geist Mono for code and tables" CI invariant.
10
+ *
11
+ * Anchor: `#slideshow` is the single container that wraps EVERY slide page
12
+ * (`#slideshow > .slidev-page > <layout root>`), so this reaches tables in every
13
+ * layout — including the custom ones (`content`, `compare`, …) whose root is NOT
14
+ * `.slidev-layout`. Slidev's own defaults live on `.slidev-layout table`
15
+ * (specificity 0,1,1); anchoring on the `#slideshow` id (1,0,1) wins the cascade
16
+ * regardless of load order, without needing `!important`. Column alignment
17
+ * (`:---`, `---:`, `:--:`) is emitted by markdown-it as an inline `text-align`
18
+ * style, so it keeps working on top of these rules with no extra selectors.
19
+ *
20
+ * Colours come from theme.css; the only literal hex are the shared border/row
21
+ * neutrals already used across the toolkit (see code.css).
22
+ */
23
+
24
+ #slideshow table {
25
+ border-collapse: separate;
26
+ border-spacing: 0;
27
+ width: auto;
28
+ margin: 0.5rem 0 1.25rem;
29
+ font-family: var(--miragon-font-mono);
30
+ font-size: 0.95rem;
31
+ line-height: 1.5;
32
+ background: var(--miragon-white);
33
+ border: 1px solid #e5e7eb;
34
+ border-radius: 0.6rem;
35
+ overflow: hidden;
36
+ box-shadow: 0 8px 20px rgba(51, 93, 229, 0.06);
37
+ }
38
+
39
+ /* Header row: black label, restrained blue accent rule underneath. */
40
+ #slideshow thead th {
41
+ color: var(--miragon-text-primary);
42
+ font-weight: 700;
43
+ background: var(--miragon-blue-light);
44
+ border-bottom: 2px solid var(--miragon-blue);
45
+ }
46
+
47
+ #slideshow th,
48
+ #slideshow td {
49
+ padding: 0.55rem 1.1rem;
50
+ text-align: left;
51
+ color: var(--miragon-text-secondary);
52
+ border-bottom: 1px solid #eef1f5;
53
+ vertical-align: top;
54
+ }
55
+
56
+ /* Subtle zebra striping for scannability; last row carries no divider. */
57
+ #slideshow tbody tr:nth-child(even) td {
58
+ background: var(--miragon-gray-light);
59
+ }
60
+ #slideshow tbody tr:last-child td {
61
+ border-bottom: none;
62
+ }