docs/.vitepress/theme/components/themerepo/ThemeScreen.vue
159 lines · 3153 bytes
1<script setup lang="ts">
2import { useId } from 'vue'
3import type { ManaTheme } from '../../../../ext/themeRepos/types'
4import type { Screen } from './screens'
5
6defineProps<{ screen: Screen; theme: ManaTheme }>()
7
8const id = useId()
9
10function colors(theme: ManaTheme) {
11 const vars = Object.entries(theme.colors).map((
12 [key, value]
13 ) => [`--t-${key}`, value])
14 return Object.fromEntries([
15 ...vars,
16 ['--scrim', `url(#${id}-scrim)`],
17 ['--fade', `url(#${id}-fade)`]
18 ])
19}
20</script>
21
22<template>
23 <svg
24 class="screen"
25 viewBox="0 0 497 1024"
26 role="img"
27 :aria-label="`${screen.title} screen in ${theme.name}`"
28 :style="colors(theme)"
29 >
30 <defs>
31 <linearGradient :id="`${id}-scrim`" x1="0" y1="0" x2="0" y2="1">
32 <stop offset="0.55" class="stop-overlay" stop-opacity="0" />
33 <stop offset="1" class="stop-overlay" />
34 </linearGradient>
35 <linearGradient :id="`${id}-fade`" x1="0" y1="0" x2="0" y2="1">
36 <stop offset="0" class="stop-background" stop-opacity="0" />
37 <stop offset="1" class="stop-background" />
38 </linearGradient>
39 </defs>
40 <component
41 :is="shape.tag"
42 v-for="(shape, i) in screen.shapes"
43 :key="i"
44 v-bind="shape.attrs"
45 />
46 </svg>
47</template>
48
49<style scoped>
50.screen {
51 display: block;
52 width: 100%;
53 height: auto;
54 border-radius: 8%/3.9%;
55 background: var(--t-background);
56 box-shadow: 0 0 0 1px var(--vp-c-divider);
57}
58.stop-overlay {
59 stop-color: var(--t-contentTileOverlay);
60}
61.stop-background {
62 stop-color: var(--t-background);
63}
64
65.label {
66 fill: var(--t-label);
67 fill-opacity: 0.8;
68}
69.muted {
70 fill: var(--t-secondaryLabel);
71 fill-opacity: 0.7;
72}
73.chevron {
74 fill: none;
75 stroke: var(--t-secondaryLabel);
76 stroke-width: 2.4;
77 stroke-linecap: round;
78 stroke-linejoin: round;
79}
80.progress-track {
81 fill: none;
82 stroke: var(--t-secondaryLabel);
83 stroke-opacity: 0.25;
84 stroke-width: 3;
85}
86.progress {
87 fill: none;
88 stroke: var(--t-accent);
89 stroke-width: 3;
90 stroke-linecap: round;
91}
92.accent {
93 fill: var(--t-accent);
94}
95.accent-soft {
96 fill: var(--t-accent);
97 fill-opacity: 0.25;
98}
99.on-accent {
100 fill: var(--t-foregroundOnAccent);
101}
102.secondary {
103 fill: var(--t-secondaryBackground);
104}
105.tertiary {
106 fill: var(--t-tertiaryBackground);
107}
108.separator {
109 fill: var(--t-separator);
110}
111.info {
112 fill: var(--t-statusInfo);
113}
114.support {
115 fill: #fd5d51;
116}
117.support-label {
118 fill: #ffffff;
119}
120.support-label-soft {
121 fill: #ffffff;
122 fill-opacity: 0.72;
123}
124.destructive {
125 fill: var(--t-statusDestructive);
126}
127.scrim {
128 fill: var(--scrim);
129}
130.fade {
131 fill: var(--fade);
132}
133.glass {
134 fill: var(--t-secondaryBackground);
135 fill-opacity: 0.92;
136 stroke: var(--t-separator);
137}
138.raised {
139 fill: var(--t-secondaryBackground);
140 stroke: var(--t-separator);
141}
142.raised-tertiary {
143 fill: var(--t-tertiaryBackground);
144 stroke: var(--t-separator);
145}
146.card {
147 fill: var(--t-secondaryBackground);
148 stroke: var(--t-separator);
149}
150.chip {
151 fill: var(--t-secondaryBackground);
152 stroke: var(--t-separator);
153}
154.info-chip {
155 fill: var(--t-statusInfo);
156 fill-opacity: 0.12;
157 stroke: var(--t-statusInfo);
158}
159</style>