@data-fair/lib-vuetify 1.7.1 → 1.8.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/index.d.ts +0 -1
- package/index.js +2 -13
- package/package.json +2 -2
- package/theme-switcher.vue +7 -4
- package/theme-switcher.vue.js +22 -11
package/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type Session } from '@data-fair/lib-vue/session.js';
|
|
2
2
|
import { VuetifyOptions } from 'vuetify';
|
|
3
3
|
export declare function vuetifySessionOptions(session: Session): VuetifyOptions;
|
|
4
|
-
export declare function vuetifySessionStyle(session: Session): string;
|
|
5
4
|
export declare function defaultOptions(searchParams: Record<string, string>, darkCookie?: boolean, locale?: string): VuetifyOptions;
|
package/index.js
CHANGED
|
@@ -23,9 +23,9 @@ export function vuetifySessionOptions (session) {
|
|
|
23
23
|
messages: { fr, en }
|
|
24
24
|
},
|
|
25
25
|
theme: {
|
|
26
|
-
defaultTheme: '
|
|
26
|
+
defaultTheme: session.theme.value ?? 'default',
|
|
27
27
|
themes: {
|
|
28
|
-
|
|
28
|
+
[session.theme.value ?? 'default']: {
|
|
29
29
|
dark: session.site.value?.dark,
|
|
30
30
|
colors,
|
|
31
31
|
variables: {
|
|
@@ -46,17 +46,6 @@ export function vuetifySessionOptions (session) {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
export function vuetifySessionStyle (session) {
|
|
50
|
-
if (!session.site.value) { throw new Error('vuetifySectionStyle requires fething site info in session util') }
|
|
51
|
-
return `
|
|
52
|
-
.v-application .text-primary!important {
|
|
53
|
-
color: ${session.site.value.colors['text-primary']};
|
|
54
|
-
}
|
|
55
|
-
.v-application .text-secondary!important {
|
|
56
|
-
color: ${session.site.value.colors['text-secondary']};
|
|
57
|
-
}
|
|
58
|
-
`
|
|
59
|
-
}
|
|
60
49
|
// TODO: deprecate this in favor of sessionVuetifyOptions
|
|
61
50
|
export function defaultOptions (searchParams, darkCookie = false, locale = 'fr') {
|
|
62
51
|
// console.warn('vuetify.defaultOptions is deprecated, use vuetifySessionOptions')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@data-fair/lib-vuetify",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Components based on the Vuetify 3 UI lib for the data-fair stack.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"build": "cd .. && npm run build"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@data-fair/lib-vue": "^1.
|
|
19
|
+
"@data-fair/lib-vue": "^1.15.0",
|
|
20
20
|
"ofetch": "1",
|
|
21
21
|
"vue-i18n": "10",
|
|
22
22
|
"vuetify": "3"
|
package/theme-switcher.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<v-toolbar-items class="theme-switcher" v-if="session.fullSite.value?.theme.dark || session.fullSite.value?.theme.hc">
|
|
2
|
+
<v-toolbar-items class="theme-switcher" v-if="session.fullSite.value?.theme.dark || session.fullSite.value?.theme.hc || session.fullSite.value?.theme.hcDark">
|
|
3
3
|
<v-menu
|
|
4
4
|
offset-y
|
|
5
5
|
nudge-left
|
|
@@ -21,11 +21,12 @@
|
|
|
21
21
|
color="primary"
|
|
22
22
|
hide-details
|
|
23
23
|
:label="t('themeSwitch')"
|
|
24
|
-
@update:modelValue="value => session.switchTheme(value as 'default' | 'dark' | 'hc')"
|
|
24
|
+
@update:modelValue="value => session.switchTheme(value as 'default' | 'dark' | 'hc' | 'hc-dark')"
|
|
25
25
|
>
|
|
26
26
|
<v-radio :label="t('theme.default')" value="default"></v-radio>
|
|
27
|
-
<v-radio :label="t('theme.dark')" value="dark"></v-radio>
|
|
28
|
-
<v-radio :label="t('theme.hc')" value="hc"></v-radio>
|
|
27
|
+
<v-radio v-if="session.fullSite.value?.theme.dark" :label="t('theme.dark')" value="dark"></v-radio>
|
|
28
|
+
<v-radio v-if="session.fullSite.value?.theme.hc":label="t('theme.hc')" value="hc"></v-radio>
|
|
29
|
+
<v-radio v-if="session.fullSite.value?.theme.hcDark" :label="t('theme.hcDark')" value="hc-dark"></v-radio>
|
|
29
30
|
</v-radio-group>
|
|
30
31
|
</v-list-item>
|
|
31
32
|
</v-list>
|
|
@@ -40,12 +41,14 @@ fr:
|
|
|
40
41
|
default: par défaut
|
|
41
42
|
dark: sombre
|
|
42
43
|
hc: contraste élevé
|
|
44
|
+
hcDark: sombre et contraste élevé
|
|
43
45
|
en:
|
|
44
46
|
themeSwitch: Change theme
|
|
45
47
|
theme:
|
|
46
48
|
default: default
|
|
47
49
|
dark: dark
|
|
48
50
|
hc: high contrast
|
|
51
|
+
hcDark: dark and high contrast
|
|
49
52
|
</i18n>
|
|
50
53
|
|
|
51
54
|
<script setup lang="ts">
|
package/theme-switcher.vue.js
CHANGED
|
@@ -25,7 +25,7 @@ function __VLS_template() {
|
|
|
25
25
|
// CSS variable injection
|
|
26
26
|
// CSS variable injection end
|
|
27
27
|
let __VLS_resolvedLocalAndGlobalComponents;
|
|
28
|
-
if (__VLS_ctx.session.fullSite.value?.theme.dark || __VLS_ctx.session.fullSite.value?.theme.hc) {
|
|
28
|
+
if (__VLS_ctx.session.fullSite.value?.theme.dark || __VLS_ctx.session.fullSite.value?.theme.hc || __VLS_ctx.session.fullSite.value?.theme.hcDark) {
|
|
29
29
|
const __VLS_0 = __VLS_resolvedLocalAndGlobalComponents.VToolbarItems;
|
|
30
30
|
/** @type { [typeof __VLS_components.VToolbarItems, typeof __VLS_components.vToolbarItems, typeof __VLS_components.VToolbarItems, typeof __VLS_components.vToolbarItems, ] } */
|
|
31
31
|
// @ts-ignore
|
|
@@ -72,16 +72,27 @@ function __VLS_template() {
|
|
|
72
72
|
// @ts-ignore
|
|
73
73
|
const __VLS_39 = __VLS_asFunctionalComponent(__VLS_38, new __VLS_38({ label: ((__VLS_ctx.t('theme.default'))), value: ("default"), }));
|
|
74
74
|
const __VLS_40 = __VLS_39({ label: ((__VLS_ctx.t('theme.default'))), value: ("default"), }, ...__VLS_functionalComponentArgsRest(__VLS_39));
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
75
|
+
if (__VLS_ctx.session.fullSite.value?.theme.dark) {
|
|
76
|
+
const __VLS_44 = __VLS_resolvedLocalAndGlobalComponents.VRadio;
|
|
77
|
+
/** @type { [typeof __VLS_components.VRadio, typeof __VLS_components.vRadio, typeof __VLS_components.VRadio, typeof __VLS_components.vRadio, ] } */
|
|
78
|
+
// @ts-ignore
|
|
79
|
+
const __VLS_45 = __VLS_asFunctionalComponent(__VLS_44, new __VLS_44({ label: ((__VLS_ctx.t('theme.dark'))), value: ("dark"), }));
|
|
80
|
+
const __VLS_46 = __VLS_45({ label: ((__VLS_ctx.t('theme.dark'))), value: ("dark"), }, ...__VLS_functionalComponentArgsRest(__VLS_45));
|
|
81
|
+
}
|
|
82
|
+
if (__VLS_ctx.session.fullSite.value?.theme.hc) {
|
|
83
|
+
const __VLS_50 = __VLS_resolvedLocalAndGlobalComponents.VRadio;
|
|
84
|
+
/** @type { [typeof __VLS_components.VRadio, typeof __VLS_components.vRadio, typeof __VLS_components.VRadio, typeof __VLS_components.vRadio, ] } */
|
|
85
|
+
// @ts-ignore
|
|
86
|
+
const __VLS_51 = __VLS_asFunctionalComponent(__VLS_50, new __VLS_50({ label: ((__VLS_ctx.t('theme.hc'))), value: ("hc"), }));
|
|
87
|
+
const __VLS_52 = __VLS_51({ label: ((__VLS_ctx.t('theme.hc'))), value: ("hc"), }, ...__VLS_functionalComponentArgsRest(__VLS_51));
|
|
88
|
+
}
|
|
89
|
+
if (__VLS_ctx.session.fullSite.value?.theme.hcDark) {
|
|
90
|
+
const __VLS_56 = __VLS_resolvedLocalAndGlobalComponents.VRadio;
|
|
91
|
+
/** @type { [typeof __VLS_components.VRadio, typeof __VLS_components.vRadio, typeof __VLS_components.VRadio, typeof __VLS_components.vRadio, ] } */
|
|
92
|
+
// @ts-ignore
|
|
93
|
+
const __VLS_57 = __VLS_asFunctionalComponent(__VLS_56, new __VLS_56({ label: ((__VLS_ctx.t('theme.hcDark'))), value: ("hc-dark"), }));
|
|
94
|
+
const __VLS_58 = __VLS_57({ label: ((__VLS_ctx.t('theme.hcDark'))), value: ("hc-dark"), }, ...__VLS_functionalComponentArgsRest(__VLS_57));
|
|
95
|
+
}
|
|
85
96
|
__VLS_nonNullable(__VLS_35.slots).default;
|
|
86
97
|
const __VLS_35 = __VLS_pickFunctionalComponentCtx(__VLS_30, __VLS_32);
|
|
87
98
|
__VLS_nonNullable(__VLS_29.slots).default;
|