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.
Files changed (88) hide show
  1. package/README.md +270 -0
  2. package/components/DebugGrid.vue +50 -0
  3. package/components/DecorLibrary.vue +1117 -0
  4. package/components/Header.vue +124 -0
  5. package/components/Image.vue +82 -0
  6. package/components/ImageRenderer.vue +126 -0
  7. package/components/Logo.vue +142 -0
  8. package/components/Person.vue +89 -0
  9. package/components/Slide.vue +324 -0
  10. package/components/Slot.vue +419 -0
  11. package/components/Text.vue +216 -0
  12. package/components/Timeline.vue +202 -0
  13. package/composables/decor-catalog.mjs +339 -0
  14. package/composables/decor-config.mjs +488 -0
  15. package/composables/decor-file-store.ts +192 -0
  16. package/composables/decor-http-store.ts +25 -0
  17. package/composables/decor-store.ts +39 -0
  18. package/composables/decor-tuning-overrides.mjs +2 -0
  19. package/composables/decor-workbench.ts +799 -0
  20. package/composables/grid-placement.ts +396 -0
  21. package/composables/image-config.mjs +484 -0
  22. package/composables/layout-authoring.ts +372 -0
  23. package/composables/layout-markdown.mjs +56 -0
  24. package/composables/layout-recipes.ts +347 -0
  25. package/composables/layout-registry.ts +47 -0
  26. package/composables/layout-shorthands.ts +891 -0
  27. package/composables/layout-vnode.ts +43 -0
  28. package/composables/logo-mark.mjs +5 -0
  29. package/composables/slide-layout.ts +43 -0
  30. package/composables/slot-placement.ts +195 -0
  31. package/composables/slot-rules.ts +147 -0
  32. package/composables/text-fit-runtime.ts +577 -0
  33. package/composables/text-priority-fit.mjs +166 -0
  34. package/composables/text-typography.mjs +138 -0
  35. package/composables/theme-foundation.ts +192 -0
  36. package/composables/theme-media.mjs +202 -0
  37. package/composables/use-theme-config.ts +71 -0
  38. package/decor-library.md +10 -0
  39. package/env.d.ts +6 -0
  40. package/example.md +786 -0
  41. package/layouts/collection.vue +5 -0
  42. package/layouts/cover.vue +5 -0
  43. package/layouts/default.vue +5 -0
  44. package/layouts/explainer.vue +5 -0
  45. package/layouts/message.vue +5 -0
  46. package/layouts/none.vue +5 -0
  47. package/layouts/section.vue +5 -0
  48. package/layouts/two-cols.vue +11 -0
  49. package/package.json +84 -0
  50. package/public/decor/decor-1.svg +83 -0
  51. package/public/decor/decor-10.svg +40 -0
  52. package/public/decor/decor-11.svg +162 -0
  53. package/public/decor/decor-12.svg +83 -0
  54. package/public/decor/decor-13.svg +5 -0
  55. package/public/decor/decor-14.svg +7 -0
  56. package/public/decor/decor-15.svg +10 -0
  57. package/public/decor/decor-16.svg +9 -0
  58. package/public/decor/decor-17.png +0 -0
  59. package/public/decor/decor-18.png +0 -0
  60. package/public/decor/decor-19.svg +5 -0
  61. package/public/decor/decor-2.png +0 -0
  62. package/public/decor/decor-3.svg +9 -0
  63. package/public/decor/decor-4.svg +31 -0
  64. package/public/decor/decor-5.png +0 -0
  65. package/public/decor/decor-6.png +0 -0
  66. package/public/decor/decor-7.png +0 -0
  67. package/public/decor/decor-8.svg +21 -0
  68. package/public/decor/decor-9.svg +38 -0
  69. package/public/favicon.svg +11 -0
  70. package/public/photos/photo-1.png +0 -0
  71. package/public/photos/photo-10.png +0 -0
  72. package/public/photos/photo-2.png +0 -0
  73. package/public/photos/photo-3.png +0 -0
  74. package/public/photos/photo-4.png +0 -0
  75. package/public/photos/photo-5.png +0 -0
  76. package/public/photos/photo-6.png +0 -0
  77. package/public/photos/photo-7.png +0 -0
  78. package/public/photos/photo-8.png +0 -0
  79. package/public/photos/photo-9.png +0 -0
  80. package/setup/main.ts +3 -0
  81. package/setup/shiki.ts +10 -0
  82. package/setup/vite-plugins.ts +106 -0
  83. package/slidev-theme-practicum.png +0 -0
  84. package/slidev-theme-practicum.svg +102 -0
  85. package/styles/example.css +0 -0
  86. package/styles/index.css +192 -0
  87. package/styles/vars.css +119 -0
  88. 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
+ }
@@ -0,0 +1,10 @@
1
+ ---
2
+ theme: ./
3
+ title: Библиотека декора Практикума
4
+ layout: none
5
+ themeConfig:
6
+ deckTitle: 'Библиотека декора'
7
+ debugGrid: false
8
+ ---
9
+
10
+ <DecorLibrary />
package/env.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ declare module '*.vue' {
2
+ import type { DefineComponent } from 'vue'
3
+
4
+ const component: DefineComponent<Record<string, never>, Record<string, never>, unknown>
5
+ export default component
6
+ }