@troshab/slidev-theme-troshab 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 (168) hide show
  1. package/CLAUDE.md +537 -0
  2. package/LICENSE +134 -0
  3. package/README.md +168 -0
  4. package/SKILL.md +414 -0
  5. package/components/AnimatedCounter.vue +35 -0
  6. package/components/Background.vue +204 -0
  7. package/components/Callout.vue +135 -0
  8. package/components/Card.vue +75 -0
  9. package/components/CardGrid.vue +67 -0
  10. package/components/CaseStudy.vue +66 -0
  11. package/components/CodeDiff.vue +229 -0
  12. package/components/CodeHighlight.vue +337 -0
  13. package/components/ColorSwatch.vue +114 -0
  14. package/components/Confetti.vue +292 -0
  15. package/components/Conversation.vue +405 -0
  16. package/components/Countdown.vue +476 -0
  17. package/components/Definition.vue +59 -0
  18. package/components/DeviceMockup.vue +392 -0
  19. package/components/Funnel.vue +87 -0
  20. package/components/Icon.vue +73 -0
  21. package/components/Iframe.vue +38 -0
  22. package/components/Image.vue +69 -0
  23. package/components/ImageCompare.vue +436 -0
  24. package/components/MatrixGrid.vue +85 -0
  25. package/components/MermaidChart.vue +299 -0
  26. package/components/Metric.vue +161 -0
  27. package/components/PersonCard.vue +165 -0
  28. package/components/PricingTable.vue +144 -0
  29. package/components/Progress.vue +100 -0
  30. package/components/Pyramid.vue +81 -0
  31. package/components/QRCode.vue +137 -0
  32. package/components/QuoteBlock.vue +101 -0
  33. package/components/SpeechBubble.vue +169 -0
  34. package/components/Stepper.vue +542 -0
  35. package/components/StyledList.vue +156 -0
  36. package/components/StyledText.vue +275 -0
  37. package/components/SwotGrid.vue +99 -0
  38. package/components/Tags.vue +20 -0
  39. package/components/Testimonial.vue +243 -0
  40. package/components/Typewriter.vue +181 -0
  41. package/components_base/AnimatedCounter.vue +208 -0
  42. package/components_base/CodeHighlight.vue +364 -0
  43. package/composables/useColors.ts +101 -0
  44. package/composables/useShiki.ts +81 -0
  45. package/example_content.md +371 -0
  46. package/example_dark.md +10 -0
  47. package/example_slides/001-cover.md +15 -0
  48. package/example_slides/002-agenda.md +25 -0
  49. package/example_slides/003-section-layouts.md +14 -0
  50. package/example_slides/004-fullscreen-centered.md +7 -0
  51. package/example_slides/005-fullscreen-align-bottom.md +14 -0
  52. package/example_slides/006-fullscreen-no-padding.md +14 -0
  53. package/example_slides/007-fullscreen-bg-image-dark.md +13 -0
  54. package/example_slides/008-fullscreen-bg-image-light.md +13 -0
  55. package/example_slides/009-fullscreen-bg-gradient.md +15 -0
  56. package/example_slides/010-fullscreen-bg-color.md +13 -0
  57. package/example_slides/011-split-basic.md +17 -0
  58. package/example_slides/012-split-image-text.md +18 -0
  59. package/example_slides/013-split-contrast.md +22 -0
  60. package/example_slides/014-columns-basic.md +13 -0
  61. package/example_slides/015-columns-two.md +26 -0
  62. package/example_slides/016-columns-ratios.md +22 -0
  63. package/example_slides/017-columns-three.md +31 -0
  64. package/example_slides/018-columns-four.md +22 -0
  65. package/example_slides/019-columns-alignment.md +23 -0
  66. package/example_slides/020-columns-styled.md +21 -0
  67. package/example_slides/021-footnote-prop.md +16 -0
  68. package/example_slides/022-iframe-fullscreen.md +8 -0
  69. package/example_slides/023-iframe-split.md +18 -0
  70. package/example_slides/024-section-components.md +14 -0
  71. package/example_slides/025-styled-text.md +9 -0
  72. package/example_slides/026-styled-text.md +15 -0
  73. package/example_slides/027-text-formatting.md +28 -0
  74. package/example_slides/028-text-spoiler.md +15 -0
  75. package/example_slides/029-icon-component.md +47 -0
  76. package/example_slides/030-metric-component.md +29 -0
  77. package/example_slides/031-person-card.md +33 -0
  78. package/example_slides/032-styled-list.md +50 -0
  79. package/example_slides/033-color-swatch.md +35 -0
  80. package/example_slides/034-code-highlight.md +9 -0
  81. package/example_slides/035-iframe-component.md +9 -0
  82. package/example_slides/036-callout.md +15 -0
  83. package/example_slides/037-card-grid.md +27 -0
  84. package/example_slides/038-stepper-variants.md +18 -0
  85. package/example_slides/039-stepper-clicks.md +49 -0
  86. package/example_slides/040-stepper-interactive.md +28 -0
  87. package/example_slides/041-tags-progress.md +21 -0
  88. package/example_slides/042-speech-bubble.md +30 -0
  89. package/example_slides/043-conversation.md +13 -0
  90. package/example_slides/044-device-iphone.md +26 -0
  91. package/example_slides/045-device-browser.md +7 -0
  92. package/example_slides/046-qrcode.md +26 -0
  93. package/example_slides/047-countdown.md +14 -0
  94. package/example_slides/048-typewriter.md +8 -0
  95. package/example_slides/049-confetti.md +16 -0
  96. package/example_slides/050-image-compare.md +13 -0
  97. package/example_slides/051-code-diff.md +24 -0
  98. package/example_slides/052-quote-block.md +8 -0
  99. package/example_slides/053-testimonial.md +26 -0
  100. package/example_slides/054-testimonial-featured.md +16 -0
  101. package/example_slides/055-funnel.md +12 -0
  102. package/example_slides/056-pyramid.md +13 -0
  103. package/example_slides/057-pricing-table.md +9 -0
  104. package/example_slides/058-swot-grid.md +12 -0
  105. package/example_slides/059-matrix-grid.md +12 -0
  106. package/example_slides/060-case-study.md +11 -0
  107. package/example_slides/061-definition.md +15 -0
  108. package/example_slides/062-mermaid-intro.md +34 -0
  109. package/example_slides/063-mermaid-flowchart.md +19 -0
  110. package/example_slides/064-mermaid-sequence.md +17 -0
  111. package/example_slides/065-mermaid-xy-chart.md +16 -0
  112. package/example_slides/066-mermaid-pie.md +17 -0
  113. package/example_slides/067-mermaid-class.md +19 -0
  114. package/example_slides/068-mermaid-state.md +19 -0
  115. package/example_slides/069-mermaid-er.md +22 -0
  116. package/example_slides/070-mermaid-gantt.md +24 -0
  117. package/example_slides/071-mermaid-timeline.md +17 -0
  118. package/example_slides/072-mermaid-mindmap.md +21 -0
  119. package/example_slides/073-mermaid-gitgraph.md +20 -0
  120. package/example_slides/074-mermaid-split.md +30 -0
  121. package/example_slides/075-mermaid-columns.md +32 -0
  122. package/example_slides/076-section-addons.md +14 -0
  123. package/example_slides/077-asciinema.md +27 -0
  124. package/example_slides/078-fancyarrow.md +31 -0
  125. package/example_slides/079-fancyarrow-demo.md +23 -0
  126. package/example_slides/080-section-theme.md +14 -0
  127. package/example_slides/081-color-architecture.md +22 -0
  128. package/example_slides/082-semantic-text-colors.md +25 -0
  129. package/example_slides/083-typography.md +16 -0
  130. package/example_slides/084-typography-rationale.md +22 -0
  131. package/example_slides/085-icons.md +24 -0
  132. package/example_slides/086-tables.md +14 -0
  133. package/example_slides/087-code-blocks.md +18 -0
  134. package/example_slides/088-motion-modes.md +35 -0
  135. package/example_slides/089-slide-transitions.md +31 -0
  136. package/example_slides/090-v-click-reveals.md +40 -0
  137. package/example_slides/091-accessibility.md +27 -0
  138. package/example_slides/092-safe-zone.md +17 -0
  139. package/example_slides/093-questions.md +8 -0
  140. package/example_white.md +10 -0
  141. package/fonts/IBMPlexMono-Medium.woff2 +1449 -0
  142. package/fonts/IBMPlexMono-Regular.woff2 +1449 -0
  143. package/fonts/IBMPlexSans-Bold.woff2 +1449 -0
  144. package/fonts/IBMPlexSans-Medium.woff2 +1449 -0
  145. package/fonts/IBMPlexSans-Regular.woff2 +1449 -0
  146. package/fonts/IBMPlexSans-SemiBold.woff2 +1449 -0
  147. package/fonts/LICENSE.txt +93 -0
  148. package/layouts/slide.vue +251 -0
  149. package/package.json +62 -0
  150. package/public/avatars/alice.png +0 -0
  151. package/public/avatars/bob.png +0 -0
  152. package/public/avatars/carol.png +0 -0
  153. package/scripts/chart-audit.mjs +216 -0
  154. package/scripts/contrast-audit.mjs +299 -0
  155. package/scripts/generate-palette.mjs +395 -0
  156. package/scripts/integrity-audit.mjs +357 -0
  157. package/scripts/shared/css-utils.mjs +216 -0
  158. package/scripts/shiki-audit.mjs +300 -0
  159. package/scripts/typography-audit.mjs +300 -0
  160. package/setup/main.ts +107 -0
  161. package/setup/mermaid.ts +237 -0
  162. package/setup/shiki.ts +40 -0
  163. package/snippets/demo.ts +26 -0
  164. package/styles/base.css +1053 -0
  165. package/styles/colors.css +422 -0
  166. package/styles/index.css +12 -0
  167. package/styles/motion.css +486 -0
  168. package/uno.config.ts +67 -0
@@ -0,0 +1,93 @@
1
+ Copyright © 2017 IBM Corp. with Reserved Font Name "Plex"
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+
5
+ This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,251 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * Universal slide layout — 3 modes cover 100% of slide structures.
4
+ *
5
+ * mode: fullscreen | split | columns (default: columns)
6
+ */
7
+
8
+ import { computed, useSlots } from 'vue'
9
+
10
+ const props = defineProps<{
11
+ mode?: 'fullscreen' | 'split' | 'columns'
12
+ // Fullscreen props
13
+ align?: 'left' | 'center' | 'right'
14
+ valign?: 'top' | 'center' | 'bottom'
15
+ padding?: boolean
16
+ // Split props
17
+ split?: [number, number]
18
+ // Columns props
19
+ cols?: number | string
20
+ gap?: '0' | '1' | '2' | '4' | '6' | '8'
21
+ justify?: 'start' | 'center' | 'end' | 'between' | 'stretch'
22
+ items?: 'top' | 'center' | 'bottom'
23
+ titleAlign?: 'left' | 'center' | 'right'
24
+ colAlign?: string | string[]
25
+ colBg?: string | string[]
26
+ colBorder?: boolean | boolean[]
27
+ // Structural props
28
+ footnote?: boolean
29
+ }>()
30
+
31
+ const slots = useSlots()
32
+ const layoutMode = props.mode || 'columns'
33
+
34
+ // ── Fullscreen helpers ──
35
+ const hasPadding = props.padding !== false
36
+ const hasBg = !!slots.bg
37
+
38
+ const alignStyle = computed(() => {
39
+ const h = { left: 'flex-start', center: 'center', right: 'flex-end' }[props.align || 'center']
40
+ const ta = props.align || 'center'
41
+ return { alignItems: h, textAlign: ta }
42
+ })
43
+
44
+ const valignStyle = computed(() => {
45
+ const v = { top: 'flex-start', center: 'center', bottom: 'flex-end' }[props.valign || 'center']
46
+ return { justifyContent: v }
47
+ })
48
+
49
+ // ── Split helpers ──
50
+ const splitSizes = computed(() => props.split || [6, 6])
51
+
52
+ const splitTemplate = computed(() => {
53
+ const [l, r] = splitSizes.value
54
+ return `${(l / 12) * 100}% ${(r / 12) * 100}%`
55
+ })
56
+
57
+ const leftHasBg = computed(() => !!slots['left-bg'])
58
+ const rightHasBg = computed(() => !!slots['right-bg'])
59
+ const leftHasContent = computed(() => !!slots.left)
60
+ const rightHasContent = computed(() => !!slots.right)
61
+
62
+ // ── Columns helpers ──
63
+ const colSizes = computed(() => {
64
+ const raw = props.cols ?? 1
65
+ if (typeof raw === 'number' || !String(raw).includes('-')) {
66
+ const n = Number(raw)
67
+ if (n === 1) return [12]
68
+ return Array(n).fill(Math.floor(12 / n))
69
+ }
70
+ return String(raw).split('-').map(Number)
71
+ })
72
+
73
+ const colCount = computed(() => colSizes.value.length)
74
+ const isSingleCol = computed(() => colCount.value === 1)
75
+
76
+ const gapMap: Record<string, string> = {
77
+ '0': '0rem', '1': '1rem', '2': '2rem', '4': '4rem', '6': '6rem', '8': '8rem',
78
+ }
79
+
80
+ const justifyMap: Record<string, string> = {
81
+ start: 'flex-start', center: 'center', end: 'flex-end',
82
+ between: 'space-between', stretch: 'stretch',
83
+ }
84
+
85
+ const alignMap: Record<string, string> = {
86
+ top: 'flex-start', center: 'center', bottom: 'flex-end',
87
+ }
88
+
89
+ const textAlignMap: Record<string, string> = {
90
+ left: 'left', center: 'center', right: 'right',
91
+ }
92
+
93
+ function getArr<T>(prop: T | T[] | undefined, i: number, fb: T): T {
94
+ if (prop === undefined) return fb
95
+ if (Array.isArray(prop)) return prop[i] ?? fb
96
+ return prop
97
+ }
98
+
99
+ function colStyle(i: number) {
100
+ const size = colSizes.value[i]
101
+ const justify = props.justify || 'stretch'
102
+ const s: Record<string, string> = {}
103
+
104
+ if (justify === 'stretch') {
105
+ s.flex = `${size} 0 0`
106
+ } else {
107
+ s.flex = `0 0 calc(${(size / 12) * 100}% - ${gapMap[props.gap || '4']})`
108
+ }
109
+
110
+ s.justifyContent = alignMap[props.items || 'top'] || 'flex-start'
111
+
112
+ const ta = getArr(props.colAlign, i, 'left') as string
113
+ s.textAlign = textAlignMap[ta] || 'left'
114
+
115
+ return s
116
+ }
117
+
118
+ function colClasses(i: number) {
119
+ const cls: string[] = ['slide-col']
120
+ const bg = getArr(props.colBg, i, 'none') as string
121
+ if (bg && bg !== 'none') cls.push(`slide-col-bg-${bg}`)
122
+ const border = getArr(props.colBorder, i, false) as boolean
123
+ if (border) cls.push('slide-col-border')
124
+ return cls
125
+ }
126
+
127
+ const gridStyle = computed(() => {
128
+ const s: Record<string, string> = {}
129
+ s.gap = gapMap[props.gap || '4']
130
+ const justify = props.justify || 'stretch'
131
+ if (justify !== 'stretch') s.justifyContent = justifyMap[justify]
132
+ return s
133
+ })
134
+ </script>
135
+
136
+ <template>
137
+ <!-- ════════ FULLSCREEN ════════ -->
138
+ <div
139
+ v-if="layoutMode === 'fullscreen'"
140
+ class="slidev-layout slide-fullscreen"
141
+ :class="{
142
+ 'slide-no-padding': !hasPadding,
143
+ 'slide-has-bg': hasBg,
144
+ }"
145
+ >
146
+ <!-- Background layer (edge-to-edge) -->
147
+ <div v-if="hasBg" class="slide-bg">
148
+ <slot name="bg" />
149
+ </div>
150
+
151
+ <!-- Content layer -->
152
+ <div
153
+ class="slide-content"
154
+ :style="{ ...alignStyle, ...valignStyle }"
155
+ >
156
+ <slot />
157
+ </div>
158
+
159
+ <!-- Footer -->
160
+ <div v-if="$slots.footer" class="slide-footer">
161
+ <slot name="footer" />
162
+ </div>
163
+ </div>
164
+
165
+ <!-- ════════ SPLIT ════════ -->
166
+ <div
167
+ v-else-if="layoutMode === 'split'"
168
+ class="slidev-layout slide-split"
169
+ :style="{ gridTemplateColumns: splitTemplate, gap: gapMap[gap || '0'] }"
170
+ >
171
+ <!-- Left panel -->
172
+ <div class="slide-panel slide-panel-left" :class="{ 'slide-panel-bg-only': leftHasBg && !leftHasContent }">
173
+ <div v-if="leftHasBg" class="slide-bg">
174
+ <slot name="left-bg" />
175
+ </div>
176
+ <div v-if="leftHasContent" class="slide-panel-content">
177
+ <slot name="left" />
178
+ </div>
179
+ </div>
180
+
181
+ <!-- Right panel -->
182
+ <div class="slide-panel slide-panel-right" :class="{ 'slide-panel-bg-only': rightHasBg && !rightHasContent }">
183
+ <div v-if="rightHasBg" class="slide-bg">
184
+ <slot name="right-bg" />
185
+ </div>
186
+ <div v-if="rightHasContent" class="slide-panel-content">
187
+ <slot name="right" />
188
+ </div>
189
+ </div>
190
+
191
+ <!-- Footer -->
192
+ <div v-if="$slots.footer" class="slide-footer" style="grid-column: 1 / -1;">
193
+ <slot name="footer" />
194
+ </div>
195
+ </div>
196
+
197
+ <!-- ════════ COLUMNS (default) ════════ -->
198
+ <div
199
+ v-else
200
+ class="slidev-layout slide-columns"
201
+ :class="{ 'slide-footnote': footnote }"
202
+ >
203
+ <!-- Title (multi-col only) -->
204
+ <div
205
+ v-if="!isSingleCol && $slots.default"
206
+ class="slide-title"
207
+ :style="{ textAlign: textAlignMap[titleAlign || 'left'] }"
208
+ >
209
+ <slot />
210
+ </div>
211
+
212
+ <!-- Subtitle -->
213
+ <div
214
+ v-if="!isSingleCol && $slots.subtitle"
215
+ class="slide-subtitle"
216
+ >
217
+ <slot name="subtitle" />
218
+ </div>
219
+
220
+ <!-- Single column: default slot is content -->
221
+ <div v-if="isSingleCol" class="slide-single">
222
+ <slot />
223
+ </div>
224
+
225
+ <!-- Multi-column grid -->
226
+ <div
227
+ v-else
228
+ class="slide-grid"
229
+ :style="gridStyle"
230
+ >
231
+ <div
232
+ v-for="i in colCount"
233
+ :key="i"
234
+ :class="colClasses(i - 1)"
235
+ :style="colStyle(i - 1)"
236
+ >
237
+ <div v-if="$slots[`col${i}-title`]" class="slide-col-title">
238
+ <slot :name="`col${i}-title`" />
239
+ </div>
240
+ <div v-if="$slots[`col${i}`]" class="slide-col-body">
241
+ <slot :name="`col${i}`" />
242
+ </div>
243
+ </div>
244
+ </div>
245
+
246
+ <!-- Footer -->
247
+ <div v-if="$slots.footer" class="slide-footer">
248
+ <slot name="footer" />
249
+ </div>
250
+ </div>
251
+ </template>
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@troshab/slidev-theme-troshab",
3
+ "version": "0.1.0",
4
+ "description": "A minimal, universal Slidev theme with flexible layouts and ready-to-use slide templates",
5
+ "author": "troshab",
6
+ "license": "PolyForm-Noncommercial-1.0.0",
7
+ "keywords": [
8
+ "slidev-theme",
9
+ "slidev",
10
+ "presentation",
11
+ "slides"
12
+ ],
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/troshab/slidev-theme-troshab"
16
+ },
17
+ "slidev": {
18
+ "colorSchema": "both",
19
+ "highlighter": "shiki",
20
+ "addons": [
21
+ "slidev-addon-asciinema",
22
+ "slidev-addon-fancy-arrow"
23
+ ],
24
+ "defaults": {
25
+ "layout": "slide",
26
+ "transition": "t-fade"
27
+ }
28
+ },
29
+ "engines": {
30
+ "node": ">=18.0.0",
31
+ "slidev": ">=0.50.0"
32
+ },
33
+ "dependencies": {
34
+ "qrcode": "^1.5.4",
35
+ "slidev-addon-asciinema": "^0.1.11",
36
+ "slidev-addon-fancy-arrow": "^0.16.0",
37
+ "slidev-addon-preload-images": "^0.2.0"
38
+ },
39
+ "scripts": {
40
+ "dev": "npx concurrently -n dark,light -c magenta,cyan \"slidev example_dark.md --port 30303\" \"slidev example_white.md --port 31313\"",
41
+ "dev:dark": "slidev example_dark.md --port 30303",
42
+ "dev:light": "slidev example_white.md --port 31313",
43
+ "audit:contrast": "node scripts/contrast-audit.mjs",
44
+ "audit:typography": "node scripts/typography-audit.mjs",
45
+ "audit:charts": "node scripts/chart-audit.mjs",
46
+ "audit:integrity": "node scripts/integrity-audit.mjs",
47
+ "audit:shiki": "node scripts/shiki-audit.mjs",
48
+ "audit:all": "node scripts/contrast-audit.mjs && node scripts/shiki-audit.mjs && node scripts/typography-audit.mjs && node scripts/chart-audit.mjs && node scripts/integrity-audit.mjs"
49
+ },
50
+ "devDependencies": {
51
+ "@fontsource/ibm-plex-mono": "^5.2.7",
52
+ "@fontsource/ibm-plex-sans": "^5.2.8",
53
+ "@iconify-json/ph": "^1.2.2",
54
+ "@slidev/cli": "^0.50.0",
55
+ "@types/qrcode": "^1.5.5",
56
+ "css-line-break": "^2.1.0",
57
+ "fontkit": "^2.0.4",
58
+ "playwright": "^1.58.1",
59
+ "playwright-chromium": "^1.58.1",
60
+ "unocss": "^0.65.0"
61
+ }
62
+ }
Binary file
Binary file
Binary file
@@ -0,0 +1,216 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Chart Palette Accessibility Audit for slidev-theme-troshab
5
+ *
6
+ * Checks chart colors against backgrounds (WCAG 1.4.11 non-text: 3:1)
7
+ * and grayscale distinguishability for colorblind/projector scenarios.
8
+ * Run: node scripts/chart-audit.mjs
9
+ *
10
+ * Standards:
11
+ * - WCAG 1.4.11: non-text contrast 3:1
12
+ * - APCA: non-text Lc 15+
13
+ * - Grayscale distinguishability for colorblind accessibility
14
+ *
15
+ * Scientific basis:
16
+ * - Ware (2012, Information Visualization) — grayscale = universal access
17
+ * - Brewer et al. (2003, ColorBrewer) — palette design for colorblind
18
+ * - Min luminance gap 0.01 for reliable discrimination (Ware)
19
+ */
20
+
21
+ import { resolve, dirname } from 'path'
22
+ import { fileURLToPath } from 'url'
23
+ import {
24
+ contrastRatio, apcaContrast, relativeLuminance,
25
+ parsePalette, parseSemanticTokens, parseChartTokens,
26
+ resolveHex, fmt, fmtLc,
27
+ } from './shared/css-utils.mjs'
28
+
29
+ const __dirname = dirname(fileURLToPath(import.meta.url))
30
+
31
+ // ---------------------------------------------------------------------------
32
+ // Paths & Parse
33
+ // ---------------------------------------------------------------------------
34
+
35
+ const colorsPath = resolve(__dirname, '..', 'styles', 'colors.css')
36
+
37
+ const palette = parsePalette(colorsPath)
38
+ const { light, dark } = parseSemanticTokens(colorsPath)
39
+ const chartTokens = parseChartTokens(colorsPath)
40
+
41
+ function sem(theme, varName) {
42
+ return resolveHex(palette, theme === 'light' ? light : dark, varName)
43
+ }
44
+
45
+ function chartHex(theme, n) {
46
+ const ref = (theme === 'light' ? chartTokens.light : chartTokens.dark)[n]
47
+ return ref ? palette[ref] : null
48
+ }
49
+
50
+ function chartRef(theme, n) {
51
+ return (theme === 'light' ? chartTokens.light : chartTokens.dark)[n] || '?'
52
+ }
53
+
54
+ // ---------------------------------------------------------------------------
55
+ // Helpers
56
+ // ---------------------------------------------------------------------------
57
+
58
+ let issues = []
59
+ let warns = []
60
+
61
+ function dualStatus(ratio, minRatio, lc, minLc) {
62
+ const wcagOk = ratio >= minRatio
63
+ const apcaOk = Math.abs(lc) >= minLc
64
+ if (wcagOk && apcaOk) return 'OK'
65
+ if (!wcagOk) return 'FAIL'
66
+ return 'WARN'
67
+ }
68
+
69
+ function statusIcon(s) {
70
+ if (s === 'FAIL') return '!'
71
+ if (s === 'WARN') return '~'
72
+ return ' '
73
+ }
74
+
75
+ // ===== MAIN =====
76
+
77
+ console.log('Chart Palette Accessibility Audit - slidev-theme-troshab')
78
+ console.log('='.repeat(76))
79
+
80
+ // Find how many chart colors we have
81
+ const chartCount = Math.max(
82
+ ...Object.keys(chartTokens.light).map(Number).filter(n => !isNaN(n)),
83
+ ...Object.keys(chartTokens.dark).map(Number).filter(n => !isNaN(n)),
84
+ )
85
+
86
+ // --- Section 1: Chart vs --color-bg (WCAG 1.4.11: 3:1) ---
87
+
88
+ console.log(`\n1. CHART vs BACKGROUND (WCAG 1.4.11 non-text: 3:1, APCA Lc 15+)`)
89
+ console.log('-'.repeat(76))
90
+
91
+ for (const theme of ['light', 'dark']) {
92
+ const bgHex = sem(theme, 'bg')
93
+ console.log(`\n ${theme.toUpperCase()} THEME (bg: ${bgHex}):`)
94
+ for (let i = 1; i <= chartCount; i++) {
95
+ const hex = chartHex(theme, i)
96
+ if (!hex || !bgHex) continue
97
+ const ratio = contrastRatio(hex, bgHex)
98
+ const lc = apcaContrast(hex, bgHex)
99
+ const status = dualStatus(ratio, 3.0, lc, 15)
100
+ const icon = statusIcon(status)
101
+ const ref = chartRef(theme, i)
102
+ console.log(` ${icon} chart-${String(i).padEnd(2)} (${ref.padEnd(14)}) ${fmt(ratio).padStart(8)} ${fmtLc(lc)} (${status})`)
103
+ if (status === 'FAIL') issues.push(`[${theme}] chart-${i} (${ref}) vs bg: ${fmt(ratio)} < 3:1`)
104
+ }
105
+ }
106
+
107
+ // --- Section 2: Chart vs --color-bg-soft ---
108
+
109
+ console.log(`\n\n2. CHART vs SURFACES (bg-soft, WCAG 3:1, APCA Lc 15+)`)
110
+ console.log('-'.repeat(76))
111
+
112
+ for (const theme of ['light', 'dark']) {
113
+ const bgHex = sem(theme, 'bg-soft')
114
+ console.log(`\n ${theme.toUpperCase()} THEME (bg-soft: ${bgHex}):`)
115
+ for (let i = 1; i <= chartCount; i++) {
116
+ const hex = chartHex(theme, i)
117
+ if (!hex || !bgHex) continue
118
+ const ratio = contrastRatio(hex, bgHex)
119
+ const lc = apcaContrast(hex, bgHex)
120
+ const status = dualStatus(ratio, 3.0, lc, 15)
121
+ const icon = statusIcon(status)
122
+ const ref = chartRef(theme, i)
123
+ console.log(` ${icon} chart-${String(i).padEnd(2)} (${ref.padEnd(14)}) ${fmt(ratio).padStart(8)} ${fmtLc(lc)} (${status})`)
124
+ if (status === 'FAIL') issues.push(`[${theme}] chart-${i} (${ref}) vs bg-soft: ${fmt(ratio)} < 3:1`)
125
+ }
126
+ }
127
+
128
+ // --- Section 3: Grayscale distinguishability ---
129
+
130
+ // Grayscale distinguishability: OKLCH-generated ramps produce similar luminance
131
+ // per shade level. With 8 colors spread across 4-5 shade tiers, the achievable
132
+ // minimum adjacent gap is ~0.013 (light) and ~0.047 (dark). Thresholds are
133
+ // calibrated to this physical limitation of chromatic palettes.
134
+ console.log(`\n\n3. GRAYSCALE DISTINGUISHABILITY (colorblind / projector)`)
135
+ console.log(' FAIL < 0.01, WARN < 0.018 (luminance difference between any pair)')
136
+ console.log('-'.repeat(76))
137
+
138
+ const failThreshold = 0.01
139
+ const warnThreshold = 0.018
140
+
141
+ for (const theme of ['light', 'dark']) {
142
+ console.log(`\n ${theme.toUpperCase()} THEME:`)
143
+
144
+ // Collect luminances
145
+ const lums = []
146
+ for (let i = 1; i <= chartCount; i++) {
147
+ const hex = chartHex(theme, i)
148
+ if (!hex) continue
149
+ lums.push({ n: i, ref: chartRef(theme, i), hex, lum: relativeLuminance(hex) })
150
+ }
151
+
152
+ // Sort by luminance for readability
153
+ lums.sort((a, b) => a.lum - b.lum)
154
+
155
+ console.log(' Luminance order (dark to light):')
156
+ for (const l of lums) {
157
+ console.log(` chart-${String(l.n).padEnd(2)} (${l.ref.padEnd(14)}) L = ${l.lum.toFixed(3)}`)
158
+ }
159
+
160
+ // Check all C(N,2) pairs
161
+ let pairFails = 0
162
+ let pairWarns = 0
163
+ const tooClose = []
164
+
165
+ for (let i = 0; i < lums.length; i++) {
166
+ for (let j = i + 1; j < lums.length; j++) {
167
+ const diff = Math.abs(lums[i].lum - lums[j].lum)
168
+
169
+ if (diff < failThreshold) {
170
+ tooClose.push({ a: lums[i], b: lums[j], diff, level: 'FAIL' })
171
+ pairFails++
172
+ } else if (diff < warnThreshold) {
173
+ tooClose.push({ a: lums[i], b: lums[j], diff, level: 'WARN' })
174
+ pairWarns++
175
+ }
176
+ }
177
+ }
178
+
179
+ if (tooClose.length === 0) {
180
+ console.log(` All ${lums.length * (lums.length - 1) / 2} pairs pass grayscale thresholds OK`)
181
+ } else {
182
+ console.log(`\n Close pairs:`)
183
+ for (const p of tooClose) {
184
+ const icon = p.level === 'FAIL' ? '!' : '~'
185
+ console.log(` ${icon} chart-${p.a.n} / chart-${p.b.n}`.padEnd(28) + ` diff = ${p.diff.toFixed(3)} ${p.level}`)
186
+ if (p.level === 'FAIL') {
187
+ issues.push(`[${theme}] chart-${p.a.n} (${p.a.ref}) / chart-${p.b.n} (${p.b.ref}): luminance diff ${p.diff.toFixed(3)} < ${failThreshold}`)
188
+ } else {
189
+ warns.push(`[${theme}] chart-${p.a.n} (${p.a.ref}) / chart-${p.b.n} (${p.b.ref}): luminance diff ${p.diff.toFixed(3)} < ${warnThreshold}`)
190
+ }
191
+ }
192
+ console.log(` ${pairFails} FAIL, ${pairWarns} WARN out of ${lums.length * (lums.length - 1) / 2} pairs`)
193
+ }
194
+ }
195
+
196
+ // --- Section 4: Summary ---
197
+
198
+ console.log('\n' + '='.repeat(76))
199
+ console.log('SUMMARY')
200
+ console.log('='.repeat(76))
201
+
202
+ if (issues.length === 0 && warns.length === 0) {
203
+ console.log('\nAll checks passed!')
204
+ } else {
205
+ if (issues.length > 0) {
206
+ console.log(`\n${issues.length} FAIL(s):`)
207
+ issues.forEach((issue, i) => console.log(` ${i + 1}. ${issue}`))
208
+ }
209
+ if (warns.length > 0) {
210
+ console.log(`\n${warns.length} WARN(s):`)
211
+ warns.forEach((w, i) => console.log(` ${i + 1}. ${w}`))
212
+ }
213
+ }
214
+
215
+ console.log()
216
+ process.exit(issues.length > 0 ? 1 : 0)