slidev-theme-tud-db 0.0.3 → 0.0.5
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/Takeaway.vue +48 -0
- package/package.json +1 -1
- package/styles/db-theme.css +65 -6
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
|
|
4
|
+
// F1-style callout: a coloured left rule + a small uppercase eyebrow label, no
|
|
5
|
+
// fill, no symbol, upright (non-italic) body text. Knobs:
|
|
6
|
+
// label the eyebrow text ("Key Takeaway", "Question", "Problem"…); label=""
|
|
7
|
+
// hides it and leaves a bare ruled aside.
|
|
8
|
+
// color the rule + label colour: a brand keyword (below) or any CSS colour,
|
|
9
|
+
// so e.g. problems read red while takeaways stay blue.
|
|
10
|
+
// size optional overall scale — body text matches the slide's default text
|
|
11
|
+
// size by default; set e.g. size="1.1em" (or a bare number "1.1") to
|
|
12
|
+
// enlarge the whole callout. All spacing is em-based, so it stays
|
|
13
|
+
// vertically balanced at any size.
|
|
14
|
+
// Authoring (MDC block, needs `mdc: true`):
|
|
15
|
+
// ::takeaway{label="Problem" color="red"}
|
|
16
|
+
// A question can hide the fact that nothing was proven.
|
|
17
|
+
// ::
|
|
18
|
+
const props = defineProps({
|
|
19
|
+
label: { type: String, default: 'Key Takeaway' },
|
|
20
|
+
color: { type: String, default: 'blue' },
|
|
21
|
+
size: { type: String, default: '' },
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
// Brand-colour keywords -> theme tokens; anything else is used as a raw CSS colour.
|
|
25
|
+
const TOKENS: Record<string, string> = {
|
|
26
|
+
blue: 'var(--db-heading-blue)',
|
|
27
|
+
navy: 'var(--db-navy)',
|
|
28
|
+
teal: 'var(--db-accent3)',
|
|
29
|
+
green: 'var(--db-accent1)',
|
|
30
|
+
yellow: 'var(--db-accent4)',
|
|
31
|
+
red: 'var(--db-accent5)',
|
|
32
|
+
orange: 'var(--db-accent5)',
|
|
33
|
+
purple: 'var(--db-accent6)',
|
|
34
|
+
}
|
|
35
|
+
const accent = computed(() => TOKENS[props.color?.toLowerCase()] ?? props.color)
|
|
36
|
+
|
|
37
|
+
// A bare number ("1.1") is treated as an em multiplier; otherwise used verbatim.
|
|
38
|
+
const fontSize = computed(() =>
|
|
39
|
+
!props.size ? undefined : /^[\d.]+$/.test(props.size) ? `${props.size}em` : props.size,
|
|
40
|
+
)
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<template>
|
|
44
|
+
<div class="db-takeaway" :style="{ '--tk-accent': accent, fontSize }">
|
|
45
|
+
<div v-if="label" class="db-takeaway__label">{{ label }}</div>
|
|
46
|
+
<div class="db-takeaway__body"><slot /></div>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
package/package.json
CHANGED
package/styles/db-theme.css
CHANGED
|
@@ -160,6 +160,35 @@
|
|
|
160
160
|
font-style: normal; /* keep inline code upright inside the italic aside */
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
+
/* Rhetorical-question / one-sentence-takeaway callout (<Takeaway> via ::takeaway).
|
|
164
|
+
"F1" style: a coloured left rule fitted to the text height + a small uppercase
|
|
165
|
+
eyebrow label, no fill, no symbol. The accent colour is driven by --tk-accent
|
|
166
|
+
(set inline by the component from its `color` prop), defaulting to brand blue. */
|
|
167
|
+
.slidev-layout.db-default .db-takeaway {
|
|
168
|
+
margin: 0.6em 0;
|
|
169
|
+
/* em-based so the rule stays vertically balanced at any `size`. The tiny
|
|
170
|
+
top/bottom difference offsets the label cap-height vs body baseline insets. */
|
|
171
|
+
padding: 0.28em 0 0.11em 0.85em;
|
|
172
|
+
border-left: 3px solid var(--tk-accent, var(--db-heading-blue));
|
|
173
|
+
}
|
|
174
|
+
.slidev-layout.db-default .db-takeaway__label {
|
|
175
|
+
margin-bottom: 0.3em;
|
|
176
|
+
font-size: 0.72em;
|
|
177
|
+
font-weight: 700;
|
|
178
|
+
letter-spacing: 0.09em;
|
|
179
|
+
line-height: 1.1;
|
|
180
|
+
text-transform: uppercase;
|
|
181
|
+
color: var(--tk-accent, var(--db-heading-blue));
|
|
182
|
+
}
|
|
183
|
+
.slidev-layout.db-default .db-takeaway__body {
|
|
184
|
+
font-size: 1em;
|
|
185
|
+
line-height: 1.2;
|
|
186
|
+
color: var(--db-text-soft);
|
|
187
|
+
}
|
|
188
|
+
.slidev-layout.db-default .db-takeaway__body p { margin: 0; }
|
|
189
|
+
.slidev-layout.db-default .db-takeaway__body strong { font-weight: 700; }
|
|
190
|
+
.slidev-layout.db-default .db-takeaway__body code { font-weight: 500; }
|
|
191
|
+
|
|
163
192
|
/* Fenced code blocks: box only as wide as its content, not full slide width.
|
|
164
193
|
fit-content on the WRAPPER so an optional caption + the code share one width.
|
|
165
194
|
max-width keeps long lines from overflowing the slide. */
|
|
@@ -187,9 +216,12 @@
|
|
|
187
216
|
are a wide 24px gap between the number and the code, plus the block's 10px
|
|
188
217
|
left padding before the number. Both are scoped to line-numbered blocks so
|
|
189
218
|
plain code blocks keep their normal padding. */
|
|
190
|
-
.slidev-layout.db-default .slidev-code-line-numbers .slidev-code
|
|
219
|
+
.slidev-layout.db-default .slidev-code-line-numbers .slidev-code,
|
|
220
|
+
.slidev-layout.db-default .shiki-magic-move-container.slidev-code {
|
|
191
221
|
/* override the padding *variable* (Slidev applies padding via it, which beats
|
|
192
|
-
a plain padding-left here). top right bottom left — only the left shrinks.
|
|
222
|
+
a plain padding-left here). top right bottom left — only the left shrinks.
|
|
223
|
+
The Magic Move container isn't wrapped in .slidev-code-line-numbers, so it
|
|
224
|
+
needs the same override to keep its gutter rule aligned with plain blocks. */
|
|
193
225
|
--slidev-code-padding: 4px 10px 4px 6px; /* less space left of the numbers (was 10px) */
|
|
194
226
|
}
|
|
195
227
|
.slidev-layout.db-default .slidev-code-line-numbers .slidev-code code .line::before {
|
|
@@ -202,6 +234,32 @@
|
|
|
202
234
|
margin-right: 7px; /* separator → code (was a plain 8px gap) */
|
|
203
235
|
}
|
|
204
236
|
|
|
237
|
+
/* Magic Move (```md magic-move```) renders line numbers as real
|
|
238
|
+
.shiki-magic-move-line-number elements (each with opacity:0.3), not the
|
|
239
|
+
::before pseudo the plain blocks use — so the gutter rule above never reaches
|
|
240
|
+
them and the separator was missing. Re-create the same gutter: recolour the
|
|
241
|
+
numbers to match plain line-numbered blocks (gray-400, gray-600 in dark) so
|
|
242
|
+
the border can sit at full opacity instead of the dimmed 0.3. */
|
|
243
|
+
.slidev-layout.db-default .shiki-magic-move-line-number {
|
|
244
|
+
opacity: 1;
|
|
245
|
+
color: rgb(156 163 175);
|
|
246
|
+
/* Mirror the plain block's ::before geometry exactly: a fixed 1ch column,
|
|
247
|
+
right-aligned, so the digit is pinned against the padding instead of
|
|
248
|
+
shrink-wrapped and left-aligned. white-space:normal drops the literal
|
|
249
|
+
trailing spaces Magic Move pads numbers with (e.g. "1 "). */
|
|
250
|
+
box-sizing: border-box;
|
|
251
|
+
width: 1ch;
|
|
252
|
+
text-align: right;
|
|
253
|
+
overflow: visible;
|
|
254
|
+
white-space: normal;
|
|
255
|
+
padding-right: 10px; /* number → separator */
|
|
256
|
+
border-right: 1px solid var(--db-table-rule);
|
|
257
|
+
margin-right: 7px; /* separator → code */
|
|
258
|
+
}
|
|
259
|
+
.dark .slidev-layout.db-default .shiki-magic-move-line-number {
|
|
260
|
+
color: rgb(75 85 99);
|
|
261
|
+
}
|
|
262
|
+
|
|
205
263
|
/* Optional caption above a code block.
|
|
206
264
|
Authoring: ```python [What this snippet does] */
|
|
207
265
|
.slidev-layout.db-default .slidev-code-block-title {
|
|
@@ -306,10 +364,11 @@
|
|
|
306
364
|
vertical-align: middle; /* center cell text vertically */
|
|
307
365
|
text-align: center; /* center by default; :--/--: in markdown override */
|
|
308
366
|
}
|
|
309
|
-
/*
|
|
310
|
-
(
|
|
311
|
-
|
|
312
|
-
|
|
367
|
+
/* Breathing room above a table that follows something else — a heading, a
|
|
368
|
+
paragraph, a caption, or another (stacked) table. A table that is the very
|
|
369
|
+
first element in its container gets no top margin, so it sits flush at the
|
|
370
|
+
top of a slide or column. */
|
|
371
|
+
.slidev-layout.db-default table:not(:first-child) {
|
|
313
372
|
margin-top: 14px;
|
|
314
373
|
}
|
|
315
374
|
.slidev-layout.db-default thead th {
|