@venix-sistemas/jade 1.1.0 → 1.3.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 +555 -228
- package/dist/module.json +1 -1
- package/dist/module.mjs +89 -13
- package/dist/runtime/components/VenixThemeSwitcher.d.vue.ts +3 -1
- package/dist/runtime/components/VenixThemeSwitcher.vue +592 -106
- package/dist/runtime/components/VenixThemeSwitcher.vue.d.ts +3 -1
- package/dist/runtime/composables/useThemeColors.d.ts +8 -2
- package/dist/runtime/composables/useThemeColors.js +24 -9
- package/dist/runtime/composables/useThemeCookies.d.ts +17 -2
- package/dist/runtime/composables/useThemeCookies.js +44 -7
- package/dist/runtime/composables/useThemeLocale.d.ts +7 -2
- package/dist/runtime/composables/useThemeLocale.js +2 -2
- package/dist/runtime/composables/useThemeSeasonal.d.ts +3 -3
- package/dist/runtime/composables/useThemeSeasonal.js +1 -1
- package/dist/runtime/composables/useVenixTheme.d.ts +40 -0
- package/dist/runtime/composables/useVenixTheme.js +249 -112
- package/dist/runtime/nitro/theme-init.js +8 -5
- package/dist/runtime/plugins/overlay-scrollbars.client.js +89 -0
- package/dist/runtime/plugins/theme-init.server.js +7 -12
- package/dist/runtime/plugins/vuetify-theme.js +8 -11
- package/dist/runtime/scripts/theme-init.d.ts +33 -11
- package/dist/runtime/scripts/theme-init.js +59 -88
- package/dist/shared/constants.d.ts +72 -3
- package/dist/shared/constants.js +26 -1
- package/dist/shared/css/cursor-svg.d.ts +10 -0
- package/dist/shared/css/cursor-svg.js +28 -0
- package/dist/shared/css/cursor.js +86 -34
- package/dist/shared/css/index.d.ts +1 -7
- package/dist/shared/css/index.js +5 -5
- package/dist/shared/css/scrollbar.js +61 -7
- package/dist/shared/css/transition.d.ts +1 -1
- package/dist/shared/css/typography.js +13 -0
- package/dist/shared/theme.json +308 -192
- package/dist/shared/types/color-options.d.ts +26 -2
- package/dist/shared/types/colors.d.ts +64 -12
- package/dist/shared/types/cursor.d.ts +34 -4
- package/dist/shared/types/index.d.ts +3 -3
- package/dist/shared/types/runtime-config.d.ts +5 -2
- package/dist/shared/types/scrollbar.d.ts +11 -0
- package/dist/shared/types/theme.d.ts +7 -0
- package/dist/shared/types/typography.d.ts +2 -1
- package/dist/shared/utils/icon-refs.d.ts +7 -3
- package/dist/shared/utils/icon.d.ts +4 -2
- package/dist/shared/utils/icon.js +6 -2
- package/dist/shared/utils/index.d.ts +5 -4
- package/dist/shared/utils/index.js +12 -6
- package/dist/shared/utils/inline-script.d.ts +6 -0
- package/dist/shared/utils/inline-script.js +3 -0
- package/dist/shared/utils/load.d.ts +2 -3
- package/dist/shared/utils/load.js +6 -12
- package/dist/shared/utils/merge-themes.d.ts +39 -9
- package/dist/shared/utils/merge-themes.js +101 -5
- package/dist/shared/utils/normalize.d.ts +0 -11
- package/dist/shared/utils/normalize.js +0 -12
- package/dist/shared/utils/theme-config.d.ts +15 -6
- package/dist/shared/utils/theme-config.js +28 -16
- package/dist/shared/utils/theme-resolve.d.ts +23 -22
- package/dist/shared/utils/theme-resolve.js +35 -66
- package/dist/shared/utils/theme-resolver.d.ts +47 -0
- package/dist/shared/utils/theme-resolver.js +140 -0
- package/package.json +22 -10
- package/README-default.md +0 -84
- package/dist/runtime/plugin.js +0 -3
- /package/dist/runtime/{plugin.d.ts → plugins/overlay-scrollbars.client.d.ts} +0 -0
|
@@ -1,118 +1,569 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
ref="rootRef"
|
|
4
|
-
class="venix-theme-switcher"
|
|
5
|
-
@focusout="handleFocusOut"
|
|
6
|
-
>
|
|
7
|
-
<span
|
|
8
|
-
class="venix-theme-switcher__sr-only"
|
|
9
|
-
role="status"
|
|
10
|
-
aria-live="polite"
|
|
11
|
-
>{{ announcement }}</span>
|
|
12
|
-
|
|
13
|
-
<button
|
|
14
|
-
ref="triggerRef"
|
|
15
|
-
type="button"
|
|
16
|
-
class="venix-theme-switcher__trigger"
|
|
17
|
-
:class="{ 'venix-theme-switcher__trigger--visible': visible }"
|
|
18
|
-
:aria-label="resolvedLabel"
|
|
19
|
-
:aria-expanded="open"
|
|
20
|
-
aria-haspopup="menu"
|
|
21
|
-
@click="toggleOpen"
|
|
22
|
-
>
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
2
|
+
<div
|
|
3
|
+
ref="rootRef"
|
|
4
|
+
class="venix-theme-switcher"
|
|
5
|
+
@focusout="handleFocusOut"
|
|
6
|
+
>
|
|
7
|
+
<span
|
|
8
|
+
class="venix-theme-switcher__sr-only"
|
|
9
|
+
role="status"
|
|
10
|
+
aria-live="polite"
|
|
11
|
+
>{{ announcement }}</span>
|
|
12
|
+
|
|
13
|
+
<button
|
|
14
|
+
ref="triggerRef"
|
|
15
|
+
type="button"
|
|
16
|
+
class="venix-theme-switcher__trigger"
|
|
17
|
+
:class="{ 'venix-theme-switcher__trigger--visible': visible }"
|
|
18
|
+
:aria-label="resolvedLabel"
|
|
19
|
+
:aria-expanded="open"
|
|
20
|
+
aria-haspopup="menu"
|
|
21
|
+
@click="toggleOpen"
|
|
22
|
+
>
|
|
23
|
+
<template v-if="activeIcon">
|
|
24
|
+
<span
|
|
25
|
+
v-if="activeIcon.format === 'emote'"
|
|
26
|
+
:key="activeIconKey"
|
|
27
|
+
class="venix-icon venix-icon--emoji"
|
|
28
|
+
aria-hidden="true"
|
|
29
|
+
>{{ activeIcon.value }}</span>
|
|
30
|
+
<VenixIcon
|
|
31
|
+
v-else
|
|
32
|
+
:key="activeIconKey"
|
|
33
|
+
:icon="activeIcon.value"
|
|
34
|
+
:mode="activeIcon.format"
|
|
35
|
+
aria-hidden="true"
|
|
36
|
+
/>
|
|
37
|
+
</template>
|
|
38
|
+
<span
|
|
39
|
+
v-if="showLabel"
|
|
40
|
+
class="venix-theme-switcher__trigger-label"
|
|
41
|
+
>{{ triggerLabel }}</span>
|
|
42
|
+
</button>
|
|
43
|
+
|
|
44
|
+
<Transition name="venix-theme-switcher-menu">
|
|
45
|
+
<div
|
|
46
|
+
v-show="open"
|
|
47
|
+
ref="menuRef"
|
|
48
|
+
class="venix-theme-switcher__menu"
|
|
49
|
+
:class="{ 'venix-theme-switcher__menu--above': placeAbove }"
|
|
50
|
+
:style="menuStyle"
|
|
51
|
+
role="menu"
|
|
52
|
+
tabindex="-1"
|
|
53
|
+
:aria-label="resolvedLabel"
|
|
54
|
+
@keydown="handleMenuKeydown"
|
|
55
|
+
>
|
|
56
|
+
<div
|
|
57
|
+
v-if="view === 'settings'"
|
|
58
|
+
key="settings"
|
|
59
|
+
class="venix-theme-switcher__view venix-theme-switcher__view--settings"
|
|
60
|
+
>
|
|
61
|
+
<div class="venix-theme-switcher__header">
|
|
62
|
+
<button
|
|
63
|
+
type="button"
|
|
64
|
+
role="menuitem"
|
|
65
|
+
class="venix-theme-switcher__icon-button"
|
|
66
|
+
:aria-label="backLabel"
|
|
67
|
+
:title="backLabel"
|
|
68
|
+
@click="showView('main')"
|
|
69
|
+
>
|
|
70
|
+
<span
|
|
71
|
+
v-if="icons.back?.format === 'emote'"
|
|
72
|
+
class="venix-icon venix-icon--emoji"
|
|
73
|
+
aria-hidden="true"
|
|
74
|
+
>{{ icons.back.value }}</span>
|
|
75
|
+
<VenixIcon
|
|
76
|
+
v-else-if="icons.back"
|
|
77
|
+
:icon="icons.back.value"
|
|
78
|
+
:mode="icons.back.format"
|
|
79
|
+
aria-hidden="true"
|
|
80
|
+
/>
|
|
81
|
+
</button>
|
|
82
|
+
<div
|
|
83
|
+
class="venix-theme-switcher__heading"
|
|
84
|
+
aria-hidden="true"
|
|
85
|
+
>
|
|
86
|
+
{{ settingsHeading }}
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<div
|
|
91
|
+
class="venix-theme-switcher__separator"
|
|
92
|
+
role="separator"
|
|
93
|
+
/>
|
|
94
|
+
|
|
95
|
+
<div
|
|
96
|
+
class="venix-theme-switcher__group"
|
|
97
|
+
role="group"
|
|
98
|
+
:aria-label="settingsHeading"
|
|
99
|
+
>
|
|
100
|
+
<button
|
|
101
|
+
v-for="option in settingsOptions"
|
|
102
|
+
:key="option.key"
|
|
103
|
+
type="button"
|
|
104
|
+
role="menuitemcheckbox"
|
|
105
|
+
class="venix-theme-switcher__item venix-theme-switcher__item--toggle"
|
|
106
|
+
:class="{ 'venix-theme-switcher__item--on': option.enabled }"
|
|
107
|
+
:aria-checked="option.enabled"
|
|
108
|
+
@click="option.toggle()"
|
|
109
|
+
>
|
|
110
|
+
<span
|
|
111
|
+
v-if="option.icon?.format === 'emote'"
|
|
112
|
+
class="venix-icon venix-icon--emoji venix-theme-switcher__item-icon"
|
|
113
|
+
aria-hidden="true"
|
|
114
|
+
>{{ option.icon.value }}</span>
|
|
115
|
+
<VenixIcon
|
|
116
|
+
v-else-if="option.icon"
|
|
117
|
+
class="venix-theme-switcher__item-icon"
|
|
118
|
+
:icon="option.icon.value"
|
|
119
|
+
:mode="option.icon.format"
|
|
120
|
+
aria-hidden="true"
|
|
121
|
+
/>
|
|
122
|
+
<span class="venix-theme-switcher__item-text">
|
|
123
|
+
<span class="venix-theme-switcher__item-title">{{ option.title }}</span>
|
|
124
|
+
<span
|
|
125
|
+
v-if="option.description"
|
|
126
|
+
class="venix-theme-switcher__item-description"
|
|
127
|
+
>{{ option.description }}</span>
|
|
128
|
+
</span>
|
|
129
|
+
<span
|
|
130
|
+
class="venix-theme-switcher__switch"
|
|
131
|
+
aria-hidden="true"
|
|
132
|
+
/>
|
|
133
|
+
</button>
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
|
+
<a
|
|
137
|
+
class="venix-theme-switcher__credit"
|
|
138
|
+
role="menuitem"
|
|
139
|
+
tabindex="-1"
|
|
140
|
+
:href="SWITCHER_CREDIT.url"
|
|
141
|
+
target="_blank"
|
|
142
|
+
rel="noopener"
|
|
143
|
+
>{{ SWITCHER_CREDIT.name }}</a>
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
<div
|
|
147
|
+
v-else
|
|
148
|
+
key="main"
|
|
149
|
+
class="venix-theme-switcher__view"
|
|
150
|
+
>
|
|
151
|
+
<div class="venix-theme-switcher__header">
|
|
152
|
+
<div
|
|
153
|
+
class="venix-theme-switcher__heading"
|
|
154
|
+
aria-hidden="true"
|
|
155
|
+
>
|
|
156
|
+
{{ resolvedLabel }}
|
|
157
|
+
</div>
|
|
158
|
+
<button
|
|
159
|
+
v-if="settingsOptions.length > 0"
|
|
160
|
+
type="button"
|
|
161
|
+
role="menuitem"
|
|
162
|
+
class="venix-theme-switcher__icon-button"
|
|
163
|
+
:aria-label="settingsHeading"
|
|
164
|
+
:title="settingsHeading"
|
|
165
|
+
@click="showView('settings')"
|
|
166
|
+
>
|
|
167
|
+
<span
|
|
168
|
+
v-if="icons.settings?.format === 'emote'"
|
|
169
|
+
class="venix-icon venix-icon--emoji"
|
|
170
|
+
aria-hidden="true"
|
|
171
|
+
>{{ icons.settings.value }}</span>
|
|
172
|
+
<VenixIcon
|
|
173
|
+
v-else-if="icons.settings"
|
|
174
|
+
:icon="icons.settings.value"
|
|
175
|
+
:mode="icons.settings.format"
|
|
176
|
+
aria-hidden="true"
|
|
177
|
+
/>
|
|
178
|
+
</button>
|
|
179
|
+
</div>
|
|
180
|
+
|
|
181
|
+
<div
|
|
182
|
+
class="venix-theme-switcher__separator"
|
|
183
|
+
role="separator"
|
|
184
|
+
/>
|
|
185
|
+
|
|
186
|
+
<div
|
|
187
|
+
class="venix-theme-switcher__group"
|
|
188
|
+
role="group"
|
|
189
|
+
:aria-label="modeHeading"
|
|
190
|
+
>
|
|
191
|
+
<div
|
|
192
|
+
class="venix-theme-switcher__subheading"
|
|
193
|
+
aria-hidden="true"
|
|
194
|
+
>
|
|
195
|
+
{{ modeHeading }}
|
|
196
|
+
</div>
|
|
197
|
+
<div class="venix-theme-switcher__modes">
|
|
198
|
+
<button
|
|
199
|
+
v-for="item in modes"
|
|
200
|
+
:key="item.value"
|
|
201
|
+
type="button"
|
|
202
|
+
role="menuitemradio"
|
|
203
|
+
class="venix-theme-switcher__item venix-theme-switcher__item--mode"
|
|
204
|
+
:class="{ 'venix-theme-switcher__item--active': item.value === mode.preference.value }"
|
|
205
|
+
:aria-checked="item.value === mode.preference.value"
|
|
206
|
+
@click="selectMode(item.value)"
|
|
207
|
+
>
|
|
208
|
+
<span
|
|
209
|
+
v-if="item.icon?.format === 'emote'"
|
|
210
|
+
class="venix-icon venix-icon--emoji venix-theme-switcher__item-icon"
|
|
211
|
+
aria-hidden="true"
|
|
212
|
+
>{{ item.icon.value }}</span>
|
|
213
|
+
<VenixIcon
|
|
214
|
+
v-else-if="item.icon"
|
|
215
|
+
class="venix-theme-switcher__item-icon"
|
|
216
|
+
:icon="item.icon.value"
|
|
217
|
+
:mode="item.icon.format"
|
|
218
|
+
aria-hidden="true"
|
|
219
|
+
/>
|
|
220
|
+
<span>{{ item.name }}</span>
|
|
221
|
+
</button>
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
|
+
|
|
225
|
+
<template
|
|
226
|
+
v-for="section in themeSections"
|
|
227
|
+
:key="section.key"
|
|
228
|
+
>
|
|
229
|
+
<div
|
|
230
|
+
class="venix-theme-switcher__separator"
|
|
231
|
+
role="separator"
|
|
232
|
+
/>
|
|
233
|
+
|
|
234
|
+
<div
|
|
235
|
+
class="venix-theme-switcher__group"
|
|
236
|
+
role="group"
|
|
237
|
+
:aria-label="section.heading"
|
|
238
|
+
>
|
|
239
|
+
<div
|
|
240
|
+
class="venix-theme-switcher__subheading"
|
|
241
|
+
aria-hidden="true"
|
|
242
|
+
>
|
|
243
|
+
{{ section.heading }}
|
|
244
|
+
</div>
|
|
245
|
+
<button
|
|
246
|
+
v-for="item in section.items"
|
|
247
|
+
:key="item.value"
|
|
248
|
+
type="button"
|
|
249
|
+
role="menuitemradio"
|
|
250
|
+
class="venix-theme-switcher__item"
|
|
251
|
+
:class="{ 'venix-theme-switcher__item--active': item.value === theme.preference.value }"
|
|
252
|
+
:aria-checked="item.value === theme.preference.value"
|
|
253
|
+
@click="selectTheme(item.value)"
|
|
254
|
+
>
|
|
255
|
+
<span
|
|
256
|
+
v-if="item.icon?.format === 'emote'"
|
|
257
|
+
class="venix-icon venix-icon--emoji venix-theme-switcher__item-icon"
|
|
258
|
+
aria-hidden="true"
|
|
259
|
+
>{{ item.icon.value }}</span>
|
|
260
|
+
<VenixIcon
|
|
261
|
+
v-else-if="item.icon"
|
|
262
|
+
class="venix-theme-switcher__item-icon"
|
|
263
|
+
:icon="item.icon.value"
|
|
264
|
+
:mode="item.icon.format"
|
|
265
|
+
aria-hidden="true"
|
|
266
|
+
/>
|
|
267
|
+
<span>{{ item.name }}</span>
|
|
268
|
+
<span
|
|
269
|
+
v-if="seasonLabels[item.value]"
|
|
270
|
+
class="venix-theme-switcher__item-season"
|
|
271
|
+
>{{ seasonLabels[item.value] }}</span>
|
|
272
|
+
</button>
|
|
273
|
+
</div>
|
|
274
|
+
</template>
|
|
275
|
+
</div>
|
|
276
|
+
</div>
|
|
277
|
+
</Transition>
|
|
278
|
+
</div>
|
|
74
279
|
</template>
|
|
75
280
|
|
|
76
281
|
<script setup>
|
|
77
282
|
import { ref, computed, onMounted, onUnmounted, nextTick } from "vue";
|
|
283
|
+
import { useRuntimeConfig } from "#app";
|
|
78
284
|
import { useVenixTheme } from "../composables/useVenixTheme";
|
|
285
|
+
import { getDefaultSelection, getSeasonDates } from "../../shared/utils/theme-resolve";
|
|
286
|
+
import { resolveThemeIcon } from "../../shared/utils/icon";
|
|
287
|
+
import { SWITCHER_CREDIT, SWITCHER_ICONS } from "../../shared/constants";
|
|
288
|
+
import VenixIcon from "./VenixIcon.vue";
|
|
79
289
|
const LABEL_TRANSLATIONS = {
|
|
80
|
-
"pt-BR": "
|
|
81
|
-
"en-US": "
|
|
82
|
-
"es-ES": "
|
|
83
|
-
"fr-FR": "
|
|
84
|
-
"de-DE": "
|
|
85
|
-
"it-IT": "
|
|
86
|
-
"ja-JP": "\
|
|
87
|
-
"ko-KR": "\
|
|
88
|
-
"zh-CN": "\u989C\u8272
|
|
290
|
+
"pt-BR": "Cores do site",
|
|
291
|
+
"en-US": "Website color",
|
|
292
|
+
"es-ES": "Color del sitio",
|
|
293
|
+
"fr-FR": "Couleur du site",
|
|
294
|
+
"de-DE": "Website-Farbe",
|
|
295
|
+
"it-IT": "Colore del sito",
|
|
296
|
+
"ja-JP": "\u30B5\u30A4\u30C8\u306E\u8272",
|
|
297
|
+
"ko-KR": "\uC0AC\uC774\uD2B8 \uC0C9\uC0C1",
|
|
298
|
+
"zh-CN": "\u7F51\u7AD9\u989C\u8272"
|
|
89
299
|
};
|
|
90
300
|
const CHANGED_ANNOUNCEMENT_TRANSLATIONS = {
|
|
91
|
-
"pt-BR": "
|
|
92
|
-
"en-US": "
|
|
93
|
-
"es-ES": "
|
|
94
|
-
"fr-FR": "
|
|
95
|
-
"de-DE": "
|
|
96
|
-
"it-IT": "
|
|
97
|
-
"ja-JP": "\
|
|
98
|
-
"ko-KR": "\
|
|
99
|
-
"zh-CN": "\u989C\u8272\
|
|
301
|
+
"pt-BR": "Cores do site alteradas para {theme}",
|
|
302
|
+
"en-US": "Website color changed to {theme}",
|
|
303
|
+
"es-ES": "Color del sitio cambiado a {theme}",
|
|
304
|
+
"fr-FR": "Couleur du site chang\xE9e pour {theme}",
|
|
305
|
+
"de-DE": "Website-Farbe ge\xE4ndert zu {theme}",
|
|
306
|
+
"it-IT": "Colore del sito cambiato in {theme}",
|
|
307
|
+
"ja-JP": "\u30B5\u30A4\u30C8\u306E\u8272\u304C{theme}\u306B\u5909\u66F4\u3055\u308C\u307E\u3057\u305F",
|
|
308
|
+
"ko-KR": "\uC0AC\uC774\uD2B8 \uC0C9\uC0C1\uC774 {theme}(\uC73C)\uB85C \uBCC0\uACBD\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
|
|
309
|
+
"zh-CN": "\u7F51\u7AD9\u989C\u8272\u5DF2\u66F4\u6539\u4E3A{theme}"
|
|
310
|
+
};
|
|
311
|
+
const MODE_HEADING_TRANSLATIONS = {
|
|
312
|
+
"pt-BR": "Modo",
|
|
313
|
+
"en-US": "Mode",
|
|
314
|
+
"es-ES": "Modo",
|
|
315
|
+
"fr-FR": "Mode",
|
|
316
|
+
"de-DE": "Modus",
|
|
317
|
+
"it-IT": "Modalit\xE0",
|
|
318
|
+
"ja-JP": "\u30E2\u30FC\u30C9",
|
|
319
|
+
"ko-KR": "\uBAA8\uB4DC",
|
|
320
|
+
"zh-CN": "\u6A21\u5F0F"
|
|
321
|
+
};
|
|
322
|
+
const THEME_HEADING_TRANSLATIONS = {
|
|
323
|
+
"pt-BR": "Tema",
|
|
324
|
+
"en-US": "Theme",
|
|
325
|
+
"es-ES": "Tema",
|
|
326
|
+
"fr-FR": "Th\xE8me",
|
|
327
|
+
"de-DE": "Thema",
|
|
328
|
+
"it-IT": "Tema",
|
|
329
|
+
"ja-JP": "\u30C6\u30FC\u30DE",
|
|
330
|
+
"ko-KR": "\uD14C\uB9C8",
|
|
331
|
+
"zh-CN": "\u4E3B\u9898"
|
|
332
|
+
};
|
|
333
|
+
const CUSTOM_HEADING_TRANSLATIONS = {
|
|
334
|
+
"pt-BR": "Tema personalizado",
|
|
335
|
+
"en-US": "Custom theme",
|
|
336
|
+
"es-ES": "Tema personalizado",
|
|
337
|
+
"fr-FR": "Th\xE8me personnalis\xE9",
|
|
338
|
+
"de-DE": "Eigenes Thema",
|
|
339
|
+
"it-IT": "Tema personalizzato",
|
|
340
|
+
"ja-JP": "\u30AB\u30B9\u30BF\u30E0\u30C6\u30FC\u30DE",
|
|
341
|
+
"ko-KR": "\uC0AC\uC6A9\uC790 \uC9C0\uC815 \uD14C\uB9C8",
|
|
342
|
+
"zh-CN": "\u81EA\u5B9A\u4E49\u4E3B\u9898"
|
|
343
|
+
};
|
|
344
|
+
const MODE_CHANGED_ANNOUNCEMENT_TRANSLATIONS = {
|
|
345
|
+
"pt-BR": "Modo alterado para {mode}",
|
|
346
|
+
"en-US": "Mode changed to {mode}",
|
|
347
|
+
"es-ES": "Modo cambiado a {mode}",
|
|
348
|
+
"fr-FR": "Mode chang\xE9 pour {mode}",
|
|
349
|
+
"de-DE": "Modus ge\xE4ndert zu {mode}",
|
|
350
|
+
"it-IT": "Modalit\xE0 cambiata in {mode}",
|
|
351
|
+
"ja-JP": "\u30E2\u30FC\u30C9\u304C{mode}\u306B\u5909\u66F4\u3055\u308C\u307E\u3057\u305F",
|
|
352
|
+
"ko-KR": "\uBAA8\uB4DC\uAC00 {mode}(\uC73C)\uB85C \uBCC0\uACBD\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
|
|
353
|
+
"zh-CN": "\u6A21\u5F0F\u5DF2\u66F4\u6539\u4E3A{mode}"
|
|
354
|
+
};
|
|
355
|
+
const SETTINGS_HEADING_TRANSLATIONS = {
|
|
356
|
+
"pt-BR": "Configura\xE7\xF5es",
|
|
357
|
+
"en-US": "Settings",
|
|
358
|
+
"es-ES": "Configuraci\xF3n",
|
|
359
|
+
"fr-FR": "Param\xE8tres",
|
|
360
|
+
"de-DE": "Einstellungen",
|
|
361
|
+
"it-IT": "Impostazioni",
|
|
362
|
+
"ja-JP": "\u8A2D\u5B9A",
|
|
363
|
+
"ko-KR": "\uC124\uC815",
|
|
364
|
+
"zh-CN": "\u8BBE\u7F6E"
|
|
365
|
+
};
|
|
366
|
+
const BACK_TRANSLATIONS = {
|
|
367
|
+
"pt-BR": "Voltar",
|
|
368
|
+
"en-US": "Back",
|
|
369
|
+
"es-ES": "Volver",
|
|
370
|
+
"fr-FR": "Retour",
|
|
371
|
+
"de-DE": "Zur\xFCck",
|
|
372
|
+
"it-IT": "Indietro",
|
|
373
|
+
"ja-JP": "\u623B\u308B",
|
|
374
|
+
"ko-KR": "\uB4A4\uB85C",
|
|
375
|
+
"zh-CN": "\u8FD4\u56DE"
|
|
376
|
+
};
|
|
377
|
+
const SAVE_TITLE_TRANSLATIONS = {
|
|
378
|
+
"pt-BR": "Salvar altera\xE7\xF5es",
|
|
379
|
+
"en-US": "Save changes",
|
|
380
|
+
"es-ES": "Guardar cambios",
|
|
381
|
+
"fr-FR": "Enregistrer",
|
|
382
|
+
"de-DE": "Speichern",
|
|
383
|
+
"it-IT": "Salva modifiche",
|
|
384
|
+
"ja-JP": "\u5909\u66F4\u3092\u4FDD\u5B58",
|
|
385
|
+
"ko-KR": "\uBCC0\uACBD \uC0AC\uD56D \uC800\uC7A5",
|
|
386
|
+
"zh-CN": "\u4FDD\u5B58\u66F4\u6539"
|
|
387
|
+
};
|
|
388
|
+
const SAVE_DESCRIPTION_TRANSLATIONS = {
|
|
389
|
+
"pt-BR": "Lembrar suas escolhas ao voltar ao site (usa cookies)",
|
|
390
|
+
"en-US": "Remember your choices next time you visit (uses cookies)",
|
|
391
|
+
"es-ES": "Recordar tus elecciones la pr\xF3xima vez (usa cookies)",
|
|
392
|
+
"fr-FR": "Retrouver vos choix \xE0 la prochaine visite (cookies)",
|
|
393
|
+
"de-DE": "Deine Auswahl beim n\xE4chsten Besuch behalten (Cookies)",
|
|
394
|
+
"it-IT": "Ricordare le tue scelte alla prossima visita (usa cookie)",
|
|
395
|
+
"ja-JP": "\u6B21\u56DE\u306E\u30A2\u30AF\u30BB\u30B9\u6642\u3082\u9078\u629E\u3092\u4FDD\u6301\u3057\u307E\u3059\uFF08Cookie\u3092\u4F7F\u7528\uFF09",
|
|
396
|
+
"ko-KR": "\uB2E4\uC74C \uBC29\uBB38 \uB54C\uB3C4 \uC120\uD0DD\uC744 \uC720\uC9C0\uD569\uB2C8\uB2E4 (\uCFE0\uD0A4 \uC0AC\uC6A9)",
|
|
397
|
+
"zh-CN": "\u4E0B\u6B21\u8BBF\u95EE\u65F6\u4FDD\u7559\u4F60\u7684\u9009\u62E9\uFF08\u4F7F\u7528 Cookie\uFF09"
|
|
398
|
+
};
|
|
399
|
+
const SCROLLBAR_TITLE_TRANSLATIONS = {
|
|
400
|
+
"pt-BR": "Rolagem personalizada",
|
|
401
|
+
"en-US": "Custom scrollbar",
|
|
402
|
+
"es-ES": "Scroll personalizado",
|
|
403
|
+
"fr-FR": "D\xE9filement stylis\xE9",
|
|
404
|
+
"de-DE": "Eigene Scrollleiste",
|
|
405
|
+
"it-IT": "Scroll personalizzato",
|
|
406
|
+
"ja-JP": "\u30AB\u30B9\u30BF\u30E0\u30B9\u30AF\u30ED\u30FC\u30EB\u30D0\u30FC",
|
|
407
|
+
"ko-KR": "\uC0AC\uC6A9\uC790 \uC9C0\uC815 \uC2A4\uD06C\uB864\uBC14",
|
|
408
|
+
"zh-CN": "\u81EA\u5B9A\u4E49\u6EDA\u52A8\u6761"
|
|
409
|
+
};
|
|
410
|
+
const CURSOR_TITLE_TRANSLATIONS = {
|
|
411
|
+
"pt-BR": "Cursor personalizado",
|
|
412
|
+
"en-US": "Custom cursor",
|
|
413
|
+
"es-ES": "Cursor personalizado",
|
|
414
|
+
"fr-FR": "Curseur stylis\xE9",
|
|
415
|
+
"de-DE": "Eigener Mauszeiger",
|
|
416
|
+
"it-IT": "Cursore personalizzato",
|
|
417
|
+
"ja-JP": "\u30AB\u30B9\u30BF\u30E0\u30AB\u30FC\u30BD\u30EB",
|
|
418
|
+
"ko-KR": "\uC0AC\uC6A9\uC790 \uC9C0\uC815 \uCEE4\uC11C",
|
|
419
|
+
"zh-CN": "\u81EA\u5B9A\u4E49\u5149\u6807"
|
|
420
|
+
};
|
|
421
|
+
const SEASON_RANGE_TRANSLATIONS = {
|
|
422
|
+
"pt-BR": "{start} a {end}",
|
|
423
|
+
"en-US": "{start} \u2013 {end}",
|
|
424
|
+
"es-ES": "{start} a {end}",
|
|
425
|
+
"fr-FR": "{start} \u2013 {end}",
|
|
426
|
+
"de-DE": "{start} \u2013 {end}",
|
|
427
|
+
"it-IT": "{start} \u2013 {end}",
|
|
428
|
+
"ja-JP": "{start}\uFF5E{end}",
|
|
429
|
+
"ko-KR": "{start}~{end}",
|
|
430
|
+
"zh-CN": "{start}\u81F3{end}"
|
|
431
|
+
};
|
|
432
|
+
const FONT_TITLE_TRANSLATIONS = {
|
|
433
|
+
"pt-BR": "Fonte personalizada",
|
|
434
|
+
"en-US": "Custom font",
|
|
435
|
+
"es-ES": "Fuente personalizada",
|
|
436
|
+
"fr-FR": "Police stylis\xE9e",
|
|
437
|
+
"de-DE": "Eigene Schriftart",
|
|
438
|
+
"it-IT": "Font personalizzato",
|
|
439
|
+
"ja-JP": "\u30AB\u30B9\u30BF\u30E0\u30D5\u30A9\u30F3\u30C8",
|
|
440
|
+
"ko-KR": "\uC0AC\uC6A9\uC790 \uC9C0\uC815 \uAE00\uAF34",
|
|
441
|
+
"zh-CN": "\u81EA\u5B9A\u4E49\u5B57\u4F53"
|
|
100
442
|
};
|
|
101
443
|
const props = defineProps({
|
|
102
444
|
label: { type: String, required: false },
|
|
103
|
-
showLabel: { type: Boolean, required: false }
|
|
445
|
+
showLabel: { type: Boolean, required: false },
|
|
446
|
+
hideConsent: { type: Boolean, required: false }
|
|
104
447
|
});
|
|
105
|
-
const { theme, themes, locale } = useVenixTheme();
|
|
106
|
-
const resolvedLabel = computed(() => props.label ?? locale.translate(LABEL_TRANSLATIONS, "
|
|
448
|
+
const { theme, themes, mode, modes, locale, persistence, scrollbar, cursor, font } = useVenixTheme();
|
|
449
|
+
const resolvedLabel = computed(() => props.label ?? locale.translate(LABEL_TRANSLATIONS, "Website color"));
|
|
450
|
+
const modeHeading = computed(() => locale.translate(MODE_HEADING_TRANSLATIONS, "Mode"));
|
|
451
|
+
const themeHeading = computed(() => locale.translate(THEME_HEADING_TRANSLATIONS, "Theme"));
|
|
452
|
+
const themeSections = computed(() => [
|
|
453
|
+
{ key: "built-in", heading: themeHeading.value, items: themes.value.filter((item) => !item.custom) },
|
|
454
|
+
{ key: "custom", heading: locale.translate(CUSTOM_HEADING_TRANSLATIONS, "Custom theme"), items: themes.value.filter((item) => item.custom) }
|
|
455
|
+
].filter((section) => section.items.length > 0));
|
|
456
|
+
const triggerLabel = computed(() => [theme.data.value?.name, mode.data.value?.name].filter(Boolean).join(" \xB7 "));
|
|
457
|
+
const today = ref(null);
|
|
458
|
+
const seasonLabels = computed(() => {
|
|
459
|
+
if (!today.value) return {};
|
|
460
|
+
const now = today.value;
|
|
461
|
+
let format;
|
|
462
|
+
try {
|
|
463
|
+
format = new Intl.DateTimeFormat(locale.current.value, { day: "2-digit", month: "2-digit" });
|
|
464
|
+
} catch {
|
|
465
|
+
format = new Intl.DateTimeFormat(void 0, { day: "2-digit", month: "2-digit" });
|
|
466
|
+
}
|
|
467
|
+
const template = locale.translate(SEASON_RANGE_TRANSLATIONS, "{start} \u2013 {end}");
|
|
468
|
+
const labels = {};
|
|
469
|
+
for (const item of themes.value) {
|
|
470
|
+
const group = theme.colors.groups[item.value];
|
|
471
|
+
const dates = group && getSeasonDates(group, now);
|
|
472
|
+
if (dates) labels[item.value] = template.replace("{start}", format.format(dates.start)).replace("{end}", format.format(dates.end));
|
|
473
|
+
}
|
|
474
|
+
return labels;
|
|
475
|
+
});
|
|
476
|
+
const settingsHeading = computed(() => locale.translate(SETTINGS_HEADING_TRANSLATIONS, "Settings"));
|
|
477
|
+
const backLabel = computed(() => locale.translate(BACK_TRANSLATIONS, "Back"));
|
|
478
|
+
const iconFormat = useRuntimeConfig().public.venixTheme?.iconFormat ?? "svg";
|
|
479
|
+
const icons = {
|
|
480
|
+
settings: resolveThemeIcon(SWITCHER_ICONS.settings, iconFormat),
|
|
481
|
+
back: resolveThemeIcon(SWITCHER_ICONS.back, iconFormat)
|
|
482
|
+
};
|
|
483
|
+
const settingsOptions = computed(() => {
|
|
484
|
+
const options = [];
|
|
485
|
+
if (persistence.required && !props.hideConsent) {
|
|
486
|
+
options.push({
|
|
487
|
+
key: "save",
|
|
488
|
+
icon: resolveThemeIcon(SWITCHER_ICONS.save, iconFormat),
|
|
489
|
+
title: locale.translate(SAVE_TITLE_TRANSLATIONS, "Save changes"),
|
|
490
|
+
description: locale.translate(SAVE_DESCRIPTION_TRANSLATIONS, "Remember your choices next time you visit (uses cookies)"),
|
|
491
|
+
enabled: persistence.hasConsent.value,
|
|
492
|
+
toggle: () => persistence.hasConsent.value ? persistence.revoke() : persistence.grant()
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
if (scrollbar.available) {
|
|
496
|
+
options.push({
|
|
497
|
+
key: "scrollbar",
|
|
498
|
+
icon: resolveThemeIcon(SWITCHER_ICONS.scrollbar, iconFormat),
|
|
499
|
+
title: locale.translate(SCROLLBAR_TITLE_TRANSLATIONS, "Custom scrollbar"),
|
|
500
|
+
enabled: scrollbar.enabled.value,
|
|
501
|
+
toggle: () => scrollbar.set(!scrollbar.enabled.value)
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
if (cursor.available && hasFinePointer.value) {
|
|
505
|
+
options.push({
|
|
506
|
+
key: "cursor",
|
|
507
|
+
icon: resolveThemeIcon(SWITCHER_ICONS.cursor, iconFormat),
|
|
508
|
+
title: locale.translate(CURSOR_TITLE_TRANSLATIONS, "Custom cursor"),
|
|
509
|
+
enabled: cursor.enabled.value,
|
|
510
|
+
toggle: () => cursor.set(!cursor.enabled.value)
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
if (font.available) {
|
|
514
|
+
options.push({
|
|
515
|
+
key: "font",
|
|
516
|
+
icon: resolveThemeIcon(SWITCHER_ICONS.font, iconFormat),
|
|
517
|
+
title: locale.translate(FONT_TITLE_TRANSLATIONS, "Custom font"),
|
|
518
|
+
enabled: font.enabled.value,
|
|
519
|
+
toggle: () => font.set(!font.enabled.value)
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
return options;
|
|
523
|
+
});
|
|
524
|
+
const baseTheme = getDefaultSelection(theme.colors).fallbackTheme;
|
|
107
525
|
const open = ref(false);
|
|
526
|
+
const view = ref("main");
|
|
108
527
|
const visible = ref(false);
|
|
109
528
|
const announcement = ref("");
|
|
110
529
|
const rootRef = ref(null);
|
|
111
530
|
const triggerRef = ref(null);
|
|
112
|
-
const
|
|
531
|
+
const menuRef = ref(null);
|
|
532
|
+
const placeAbove = ref(false);
|
|
533
|
+
const menuStyle = ref({});
|
|
534
|
+
const SCREEN_MARGIN = 8;
|
|
535
|
+
const MENU_GAP = 8;
|
|
536
|
+
const updatePlacement = () => {
|
|
537
|
+
const trigger = triggerRef.value;
|
|
538
|
+
const menu = menuRef.value;
|
|
539
|
+
if (!trigger || !menu) return;
|
|
540
|
+
const button = trigger.getBoundingClientRect();
|
|
541
|
+
const screenWidth = document.documentElement.clientWidth;
|
|
542
|
+
const below = window.innerHeight - button.bottom - MENU_GAP - SCREEN_MARGIN;
|
|
543
|
+
const above = button.top - MENU_GAP - SCREEN_MARGIN;
|
|
544
|
+
placeAbove.value = below < menu.scrollHeight && above > below;
|
|
545
|
+
const width = Math.min(menu.offsetWidth, screenWidth - 2 * SCREEN_MARGIN);
|
|
546
|
+
const left = button.right - width;
|
|
547
|
+
const shift = Math.min(Math.max(left, SCREEN_MARGIN), screenWidth - SCREEN_MARGIN - width) - left;
|
|
548
|
+
menuStyle.value = {
|
|
549
|
+
maxHeight: `${Math.max(placeAbove.value ? above : below, 0)}px`,
|
|
550
|
+
right: `${-shift}px`,
|
|
551
|
+
// The opening animation grows from the button, wherever it ends up
|
|
552
|
+
transformOrigin: `${Math.round(width - shift - button.width / 2)}px ${placeAbove.value ? "100%" : "0"}`
|
|
553
|
+
};
|
|
554
|
+
};
|
|
555
|
+
const handleResize = () => {
|
|
556
|
+
if (open.value) updatePlacement();
|
|
557
|
+
};
|
|
558
|
+
const hasFinePointer = ref(true);
|
|
559
|
+
const activeIcon = computed(() => {
|
|
560
|
+
const effectiveTheme = theme.preference.value === "system" ? theme.activeSeasonalTheme.value : theme.preference.value;
|
|
561
|
+
if (!effectiveTheme || effectiveTheme === baseTheme) return mode.data.value?.icon ?? null;
|
|
562
|
+
return themes.value.find((item) => item.value === effectiveTheme)?.icon ?? null;
|
|
563
|
+
});
|
|
113
564
|
const activeIconKey = computed(() => `${theme.value.value}:${activeIcon.value?.format ?? ""}:${activeIcon.value?.value ?? ""}`);
|
|
114
565
|
const getMenuItems = () => {
|
|
115
|
-
return Array.from(rootRef.value?.querySelectorAll(".venix-theme-switcher__item") ?? []);
|
|
566
|
+
return Array.from(rootRef.value?.querySelectorAll(".venix-theme-switcher__icon-button, .venix-theme-switcher__item") ?? []);
|
|
116
567
|
};
|
|
117
568
|
const focusItemAt = (index) => {
|
|
118
569
|
const items = getMenuItems();
|
|
@@ -122,32 +573,47 @@ const focusItemAt = (index) => {
|
|
|
122
573
|
const toggleOpen = async () => {
|
|
123
574
|
open.value = !open.value;
|
|
124
575
|
if (!open.value) return;
|
|
576
|
+
view.value = "main";
|
|
125
577
|
await nextTick();
|
|
578
|
+
updatePlacement();
|
|
126
579
|
const items = getMenuItems();
|
|
127
|
-
|
|
128
|
-
|
|
580
|
+
(items.find((el) => el.getAttribute("aria-checked") === "true") ?? items[0])?.focus();
|
|
581
|
+
};
|
|
582
|
+
const showView = async (next) => {
|
|
583
|
+
menuRef.value?.focus();
|
|
584
|
+
view.value = next;
|
|
585
|
+
await nextTick();
|
|
586
|
+
const items = getMenuItems();
|
|
587
|
+
(next === "settings" ? items[1] : items[0])?.focus();
|
|
129
588
|
};
|
|
130
589
|
const close = (options = {}) => {
|
|
131
590
|
if (!open.value) return;
|
|
132
591
|
open.value = false;
|
|
133
592
|
if (options.restoreFocus) triggerRef.value?.focus();
|
|
134
593
|
};
|
|
135
|
-
const
|
|
594
|
+
const selectTheme = (value) => {
|
|
136
595
|
const selected = themes.value.find((item) => item.value === value);
|
|
137
|
-
theme.
|
|
138
|
-
const template = locale.translate(CHANGED_ANNOUNCEMENT_TRANSLATIONS, "
|
|
596
|
+
theme.set(value);
|
|
597
|
+
const template = locale.translate(CHANGED_ANNOUNCEMENT_TRANSLATIONS, "Website color changed to {theme}");
|
|
139
598
|
announcement.value = template.replace("{theme}", selected?.name ?? value);
|
|
140
|
-
|
|
599
|
+
};
|
|
600
|
+
const selectMode = (value) => {
|
|
601
|
+
const selected = modes.value.find((item) => item.value === value);
|
|
602
|
+
mode.set(value);
|
|
603
|
+
const template = locale.translate(MODE_CHANGED_ANNOUNCEMENT_TRANSLATIONS, "Mode changed to {mode}");
|
|
604
|
+
announcement.value = template.replace("{mode}", selected?.name ?? value);
|
|
141
605
|
};
|
|
142
606
|
const handleMenuKeydown = (event) => {
|
|
143
607
|
const items = getMenuItems();
|
|
144
608
|
const currentIndex = items.findIndex((el) => el === document.activeElement);
|
|
145
609
|
switch (event.key) {
|
|
146
610
|
case "ArrowDown":
|
|
611
|
+
case "ArrowRight":
|
|
147
612
|
event.preventDefault();
|
|
148
613
|
focusItemAt(currentIndex + 1);
|
|
149
614
|
break;
|
|
150
615
|
case "ArrowUp":
|
|
616
|
+
case "ArrowLeft":
|
|
151
617
|
event.preventDefault();
|
|
152
618
|
focusItemAt(currentIndex - 1);
|
|
153
619
|
break;
|
|
@@ -165,8 +631,20 @@ const handleFocusOut = (event) => {
|
|
|
165
631
|
const nextTarget = event.relatedTarget;
|
|
166
632
|
if (!nextTarget || !rootRef.value?.contains(nextTarget)) close();
|
|
167
633
|
};
|
|
168
|
-
const
|
|
169
|
-
|
|
634
|
+
const isInside = (rect, event) => event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
635
|
+
const isTransitionHitOnMenu = (event) => open.value && event.target === document.documentElement && !!menuRef.value && isInside(menuRef.value.getBoundingClientRect(), event);
|
|
636
|
+
const handleMouseDown = (event) => {
|
|
637
|
+
if (isTransitionHitOnMenu(event)) event.preventDefault();
|
|
638
|
+
};
|
|
639
|
+
const handlePointerDown = (event) => {
|
|
640
|
+
if (isTransitionHitOnMenu(event)) return;
|
|
641
|
+
if (!rootRef.value || !event.composedPath().includes(rootRef.value)) close();
|
|
642
|
+
};
|
|
643
|
+
const handleClick = (event) => {
|
|
644
|
+
if (!isTransitionHitOnMenu(event)) return;
|
|
645
|
+
const control = getMenuItems().find((el) => isInside(el.getBoundingClientRect(), event));
|
|
646
|
+
control?.focus();
|
|
647
|
+
control?.click();
|
|
170
648
|
};
|
|
171
649
|
const handleKeydown = (event) => {
|
|
172
650
|
if (event.key === "Escape") close({ restoreFocus: true });
|
|
@@ -177,15 +655,23 @@ onMounted(() => {
|
|
|
177
655
|
visible.value = true;
|
|
178
656
|
});
|
|
179
657
|
});
|
|
180
|
-
|
|
658
|
+
hasFinePointer.value = window.matchMedia("(any-pointer: fine)").matches;
|
|
659
|
+
today.value = /* @__PURE__ */ new Date();
|
|
660
|
+
document.addEventListener("pointerdown", handlePointerDown);
|
|
661
|
+
document.addEventListener("mousedown", handleMouseDown, true);
|
|
662
|
+
document.addEventListener("click", handleClick);
|
|
181
663
|
document.addEventListener("keydown", handleKeydown);
|
|
664
|
+
window.addEventListener("resize", handleResize);
|
|
182
665
|
});
|
|
183
666
|
onUnmounted(() => {
|
|
184
|
-
document.removeEventListener("
|
|
667
|
+
document.removeEventListener("pointerdown", handlePointerDown);
|
|
668
|
+
document.removeEventListener("mousedown", handleMouseDown, true);
|
|
669
|
+
document.removeEventListener("click", handleClick);
|
|
185
670
|
document.removeEventListener("keydown", handleKeydown);
|
|
671
|
+
window.removeEventListener("resize", handleResize);
|
|
186
672
|
});
|
|
187
673
|
</script>
|
|
188
674
|
|
|
189
675
|
<style>
|
|
190
|
-
.venix-theme-switcher{display:inline-block;position:relative}.venix-theme-switcher__sr-only{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border:0;white-space:nowrap}.venix-theme-switcher__trigger{align-items:center;background:transparent;border:none;border-radius:999px;color:inherit;cursor:pointer;display:inline-flex;font-size:1.25rem;gap:.5rem;line-height:1;opacity:0;padding:.5rem;transition:opacity .3s ease,background-color .2s ease}.venix-theme-switcher__trigger--visible{opacity:1}.venix-theme-switcher__trigger:focus-visible
|
|
676
|
+
.venix-theme-switcher{display:inline-block;position:relative}.venix-theme-switcher,.venix-theme-switcher *,.venix-theme-switcher :after,.venix-theme-switcher :before{box-sizing:border-box}.venix-theme-switcher__sr-only{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border:0;white-space:nowrap}.venix-theme-switcher__trigger{align-items:center;background:transparent;border:none;border-radius:999px;color:inherit;cursor:pointer;display:inline-flex;font-size:1.25rem;gap:.5rem;line-height:1;opacity:0;padding:.5rem;transition:opacity .3s ease,background-color .2s ease}.venix-theme-switcher__trigger--visible{opacity:1}.venix-theme-switcher__trigger:focus-visible{background:var(--color-background3,hsla(0,0%,50%,.15))}@media (hover:hover){.venix-theme-switcher__trigger:hover{background:var(--color-background3,hsla(0,0%,50%,.15))}}.venix-theme-switcher__trigger-label{font-size:.875rem}.venix-theme-switcher__menu{border-radius:.75rem;margin:0;max-width:calc(100vw - 1rem);min-width:min(16rem,calc(100vw - 1rem));overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;padding:.375rem;position:absolute;right:0;scrollbar-color:var(--venix-switcher-border) transparent;scrollbar-width:thin;text-align:left;top:calc(100% + .5rem);z-index:50;--venix-switcher-bg:#1f2128;--venix-switcher-border:#3a3d46;--venix-switcher-text:rgba(245,245,247,.7);--venix-switcher-text-strong:#fff;--venix-switcher-heading:#fff;--venix-switcher-subheading:#f5f5f7;--venix-switcher-hover:hsla(0,0%,100%,.1);--venix-switcher-active:hsla(0,0%,100%,.16);--venix-switcher-description:rgba(245,245,247,.45);--venix-switcher-switch-off:#3a3d46;--venix-switcher-knob-off:#9a9ca5;--venix-switcher-switch-on:#f5f5f7;--venix-switcher-shadow:rgba(0,0,0,.25);--venix-switcher-icon-button:1.75rem;background:var(--venix-switcher-bg);border:1px solid var(--venix-switcher-border);box-shadow:0 8px 24px var(--venix-switcher-shadow);transform-origin:top right}.venix-theme-switcher__menu--above{bottom:calc(100% + .5rem);top:auto}.venix-theme-switcher__icon-button,.venix-theme-switcher__item,.venix-theme-switcher__trigger{-webkit-tap-highlight-color:transparent;touch-action:manipulation}.venix-theme-switcher__menu:focus{outline:none}@supports (color:light-dark(#fff,#000)){.venix-theme-switcher__menu{--venix-switcher-bg:light-dark(#fff,#1f2128);--venix-switcher-border:light-dark(#e2e4ea,#3a3d46);--venix-switcher-text:light-dark(rgba(31,33,40,.7),rgba(245,245,247,.7));--venix-switcher-text-strong:light-dark(#000,#fff);--venix-switcher-heading:light-dark(#000,#fff);--venix-switcher-subheading:light-dark(#1f2128,#f5f5f7);--venix-switcher-hover:light-dark(rgba(0,0,0,.06),hsla(0,0%,100%,.1));--venix-switcher-active:light-dark(rgba(0,0,0,.1),hsla(0,0%,100%,.16));--venix-switcher-description:light-dark(rgba(31,33,40,.5),rgba(245,245,247,.45));--venix-switcher-switch-off:light-dark(#d5d7de,#3a3d46);--venix-switcher-knob-off:light-dark(#fff,#9a9ca5);--venix-switcher-switch-on:light-dark(#1f2128,#f5f5f7);--venix-switcher-shadow:light-dark(rgba(0,0,0,.12),rgba(0,0,0,.25))}}.venix-theme-switcher-menu-enter-active{transition:transform .22s cubic-bezier(0,0,.2,1),opacity .12s ease-out}.venix-theme-switcher-menu-leave-active{transition:opacity .2s ease-in}.venix-theme-switcher-menu-enter-from{opacity:0;transform:scale(.3)}.venix-theme-switcher-menu-leave-to{opacity:0}.venix-theme-switcher__view{animation:venix-theme-switcher-view-in .18s cubic-bezier(0,0,.2,1);--venix-switcher-view-from:-0.5rem}.venix-theme-switcher__view--settings{--venix-switcher-view-from:0.5rem}@keyframes venix-theme-switcher-view-in{0%{opacity:0;transform:translateX(var(--venix-switcher-view-from))}}@media (prefers-reduced-motion:reduce){.venix-theme-switcher-menu-enter-active,.venix-theme-switcher-menu-leave-active{transition:none}.venix-theme-switcher__view{animation:none}}.venix-theme-switcher__header{align-items:center;display:grid;gap:.25rem;grid-template-columns:var(--venix-switcher-icon-button) 1fr var(--venix-switcher-icon-button)}.venix-theme-switcher__header .venix-theme-switcher__heading{grid-column:2;grid-row:1}.venix-theme-switcher__heading+.venix-theme-switcher__icon-button{grid-column:3}.venix-theme-switcher__icon-button{align-items:center;background:transparent;border:none;border-radius:.5rem;color:var(--venix-switcher-text);cursor:pointer;display:flex;font-size:1rem;height:var(--venix-switcher-icon-button);justify-content:center;padding:0;transition:background-color .15s ease,color .15s ease;width:var(--venix-switcher-icon-button)}.venix-theme-switcher__icon-button:focus-visible{background:var(--venix-switcher-hover);color:var(--venix-switcher-text-strong)}@media (hover:hover){.venix-theme-switcher__icon-button:hover{background:var(--venix-switcher-hover);color:var(--venix-switcher-text-strong)}}.venix-theme-switcher__heading{color:var(--venix-switcher-heading);font-size:.75rem;padding:.375rem .625rem}.venix-theme-switcher__heading,.venix-theme-switcher__subheading{font-weight:600;letter-spacing:.04em;text-align:center;text-transform:uppercase}.venix-theme-switcher__subheading{color:var(--venix-switcher-subheading);font-size:.6875rem;padding:.25rem .625rem}.venix-theme-switcher__modes{display:grid;gap:.25rem;grid-template-columns:repeat(3,1fr)}.venix-theme-switcher__separator{background:var(--venix-switcher-border);height:1px;margin:.375rem .25rem}.venix-theme-switcher__item{align-items:center;background:transparent;border:none;border-radius:.5rem;color:var(--venix-switcher-text);cursor:pointer;display:flex;font:inherit;gap:.625rem;padding:.5rem .625rem;text-align:left;transition:background-color .15s ease,color .15s ease;width:100%}.venix-theme-switcher__item--mode{flex-direction:column;font-size:.75rem;gap:.25rem;justify-content:center;padding:.5rem .25rem;text-align:center}.venix-theme-switcher__item--mode .venix-theme-switcher__item-icon{font-size:1.125rem}.venix-theme-switcher__item:focus-visible{background:var(--venix-switcher-hover);color:var(--venix-switcher-text-strong)}@media (hover:hover){.venix-theme-switcher__item:hover{background:var(--venix-switcher-hover);color:var(--venix-switcher-text-strong)}}@media (pointer:coarse){.venix-theme-switcher__menu{--venix-switcher-icon-button:2.5rem}.venix-theme-switcher__item{padding-block:.625rem}}.venix-theme-switcher__item--active{background:var(--venix-switcher-active);color:var(--venix-switcher-text-strong);font-weight:600}.venix-theme-switcher__item-icon{flex-shrink:0}.venix-theme-switcher__item-season{color:var(--venix-switcher-description);font-size:.6875rem;font-variant-numeric:tabular-nums;font-weight:400;margin-left:auto;opacity:.6;padding-left:.5rem;white-space:nowrap}.venix-theme-switcher__item--on{color:var(--venix-switcher-text-strong)}.venix-theme-switcher__item-text{display:flex;flex:1;flex-direction:column;gap:.125rem;min-width:0}.venix-theme-switcher__item-title{white-space:nowrap}.venix-theme-switcher__item-description{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;color:var(--venix-switcher-description);font-size:.6875rem;-webkit-line-clamp:2;line-clamp:2;line-height:1.3}.venix-theme-switcher__switch{background:var(--venix-switcher-switch-off);border-radius:999px;flex-shrink:0;height:1rem;position:relative;transition:background-color .15s ease;width:1.75rem}.venix-theme-switcher__switch:after{background:var(--venix-switcher-knob-off);border-radius:50%;content:"";height:.75rem;left:.125rem;position:absolute;top:.125rem;transition:transform .15s ease,background-color .15s ease;width:.75rem}.venix-theme-switcher__item--on .venix-theme-switcher__switch{background:var(--venix-switcher-switch-on)}.venix-theme-switcher__item--on .venix-theme-switcher__switch:after{background:var(--venix-switcher-bg);transform:translateX(.75rem)}.venix-theme-switcher__credit{color:var(--venix-switcher-description);display:block;font-size:.625rem;line-height:1.2;margin-top:.25rem;opacity:.6;padding:.125rem .25rem;text-align:center;text-decoration:none;transition:opacity .15s ease}.venix-theme-switcher__credit:focus-visible,.venix-theme-switcher__credit:hover{opacity:1;text-decoration:underline}@media (prefers-reduced-motion:reduce){.venix-theme-switcher__switch,.venix-theme-switcher__switch:after{transition:none}}
|
|
191
677
|
</style>
|