slidev-theme-practicum 0.1.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/README.md +270 -0
- package/components/DebugGrid.vue +50 -0
- package/components/DecorLibrary.vue +1117 -0
- package/components/Header.vue +124 -0
- package/components/Image.vue +82 -0
- package/components/ImageRenderer.vue +126 -0
- package/components/Logo.vue +142 -0
- package/components/Person.vue +89 -0
- package/components/Slide.vue +324 -0
- package/components/Slot.vue +419 -0
- package/components/Text.vue +216 -0
- package/components/Timeline.vue +202 -0
- package/composables/decor-catalog.mjs +339 -0
- package/composables/decor-config.mjs +488 -0
- package/composables/decor-file-store.ts +192 -0
- package/composables/decor-http-store.ts +25 -0
- package/composables/decor-store.ts +39 -0
- package/composables/decor-tuning-overrides.mjs +2 -0
- package/composables/decor-workbench.ts +799 -0
- package/composables/grid-placement.ts +396 -0
- package/composables/image-config.mjs +484 -0
- package/composables/layout-authoring.ts +372 -0
- package/composables/layout-markdown.mjs +56 -0
- package/composables/layout-recipes.ts +347 -0
- package/composables/layout-registry.ts +47 -0
- package/composables/layout-shorthands.ts +891 -0
- package/composables/layout-vnode.ts +43 -0
- package/composables/logo-mark.mjs +5 -0
- package/composables/slide-layout.ts +43 -0
- package/composables/slot-placement.ts +195 -0
- package/composables/slot-rules.ts +147 -0
- package/composables/text-fit-runtime.ts +577 -0
- package/composables/text-priority-fit.mjs +166 -0
- package/composables/text-typography.mjs +138 -0
- package/composables/theme-foundation.ts +192 -0
- package/composables/theme-media.mjs +202 -0
- package/composables/use-theme-config.ts +71 -0
- package/decor-library.md +10 -0
- package/env.d.ts +6 -0
- package/example.md +786 -0
- package/layouts/collection.vue +5 -0
- package/layouts/cover.vue +5 -0
- package/layouts/default.vue +5 -0
- package/layouts/explainer.vue +5 -0
- package/layouts/message.vue +5 -0
- package/layouts/none.vue +5 -0
- package/layouts/section.vue +5 -0
- package/layouts/two-cols.vue +11 -0
- package/package.json +84 -0
- package/public/decor/decor-1.svg +83 -0
- package/public/decor/decor-10.svg +40 -0
- package/public/decor/decor-11.svg +162 -0
- package/public/decor/decor-12.svg +83 -0
- package/public/decor/decor-13.svg +5 -0
- package/public/decor/decor-14.svg +7 -0
- package/public/decor/decor-15.svg +10 -0
- package/public/decor/decor-16.svg +9 -0
- package/public/decor/decor-17.png +0 -0
- package/public/decor/decor-18.png +0 -0
- package/public/decor/decor-19.svg +5 -0
- package/public/decor/decor-2.png +0 -0
- package/public/decor/decor-3.svg +9 -0
- package/public/decor/decor-4.svg +31 -0
- package/public/decor/decor-5.png +0 -0
- package/public/decor/decor-6.png +0 -0
- package/public/decor/decor-7.png +0 -0
- package/public/decor/decor-8.svg +21 -0
- package/public/decor/decor-9.svg +38 -0
- package/public/favicon.svg +11 -0
- package/public/photos/photo-1.png +0 -0
- package/public/photos/photo-10.png +0 -0
- package/public/photos/photo-2.png +0 -0
- package/public/photos/photo-3.png +0 -0
- package/public/photos/photo-4.png +0 -0
- package/public/photos/photo-5.png +0 -0
- package/public/photos/photo-6.png +0 -0
- package/public/photos/photo-7.png +0 -0
- package/public/photos/photo-8.png +0 -0
- package/public/photos/photo-9.png +0 -0
- package/setup/main.ts +3 -0
- package/setup/shiki.ts +10 -0
- package/setup/vite-plugins.ts +106 -0
- package/slidev-theme-practicum.png +0 -0
- package/slidev-theme-practicum.svg +102 -0
- package/styles/example.css +0 -0
- package/styles/index.css +192 -0
- package/styles/vars.css +119 -0
- package/types/slidev-client.d.ts +15 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { computed } from 'vue'
|
|
2
|
+
import { useSlideContext } from '@slidev/client'
|
|
3
|
+
import { resolveTone, type ThemeTone } from './theme-foundation'
|
|
4
|
+
|
|
5
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
6
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function readBoolean(value: unknown, fallback: boolean) {
|
|
10
|
+
if (typeof value === 'boolean')
|
|
11
|
+
return value
|
|
12
|
+
|
|
13
|
+
if (typeof value === 'number')
|
|
14
|
+
return value !== 0
|
|
15
|
+
|
|
16
|
+
if (typeof value === 'string') {
|
|
17
|
+
const normalized = value.trim().toLowerCase()
|
|
18
|
+
if (normalized === 'true' || normalized === '1')
|
|
19
|
+
return true
|
|
20
|
+
if (normalized === 'false' || normalized === '0')
|
|
21
|
+
return false
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return fallback
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function readDefaultTone(value: unknown, fallback: ThemeTone): ThemeTone {
|
|
28
|
+
if (value == null || value === '')
|
|
29
|
+
return fallback
|
|
30
|
+
|
|
31
|
+
return resolveTone(value, 'themeConfig.defaultTone', fallback)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function useThemeConfig() {
|
|
35
|
+
const { $slidev } = useSlideContext()
|
|
36
|
+
const configs = computed<Record<string, unknown>>(() => $slidev?.configs ?? {})
|
|
37
|
+
|
|
38
|
+
const themeConfigs = computed<Record<string, unknown>>(() => {
|
|
39
|
+
const value = $slidev?.themeConfigs?.value ?? configs.value.themeConfig
|
|
40
|
+
return isRecord(value) ? value : {}
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const deckTitle = computed(() => {
|
|
44
|
+
const explicit = themeConfigs.value.deckTitle
|
|
45
|
+
if (typeof explicit === 'string' && explicit.trim())
|
|
46
|
+
return explicit.trim()
|
|
47
|
+
|
|
48
|
+
const fallback = configs.value.title
|
|
49
|
+
if (typeof fallback === 'string' && fallback.trim())
|
|
50
|
+
return fallback.trim()
|
|
51
|
+
|
|
52
|
+
return ''
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const showPageNumber = computed(() => readBoolean(themeConfigs.value.showPageNumber, true))
|
|
56
|
+
const debugGrid = computed(() => readBoolean(themeConfigs.value.debugGrid, false))
|
|
57
|
+
const defaultTone = computed(() => readDefaultTone(themeConfigs.value.defaultTone, 'blue'))
|
|
58
|
+
const decors = computed(() => {
|
|
59
|
+
const explicit = themeConfigs.value.decors
|
|
60
|
+
return Array.isArray(explicit) ? explicit : []
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
themeConfigs,
|
|
65
|
+
deckTitle,
|
|
66
|
+
showPageNumber,
|
|
67
|
+
debugGrid,
|
|
68
|
+
defaultTone,
|
|
69
|
+
decors,
|
|
70
|
+
}
|
|
71
|
+
}
|
package/decor-library.md
ADDED