@miragon/slidev-toolkit 1.2.1 → 1.3.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/components/CodeBlock.vue +110 -0
- package/layouts/bpmn.vue +1 -1
- package/layouts/content.vue +2 -1
- package/layouts/dmn.vue +1 -1
- package/layouts/goodbad.vue +2 -5
- package/package.json +1 -1
- package/styles/code.css +33 -0
- package/styles/index.css +1 -0
|
@@ -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>
|
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);
|
package/layouts/content.vue
CHANGED
|
@@ -175,7 +175,8 @@ const accentVar = computed(() =>
|
|
|
175
175
|
text-decoration: none;
|
|
176
176
|
border-bottom: 1px solid currentColor;
|
|
177
177
|
}
|
|
178
|
-
|
|
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);
|
package/layouts/goodbad.vue
CHANGED
|
@@ -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
|
-
|
|
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.
|
|
3
|
+
"version": "1.3.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",
|
package/styles/code.css
ADDED
|
@@ -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