@data-fair/lib-vuetify 1.6.5 → 1.7.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.js CHANGED
@@ -23,10 +23,10 @@ export function vuetifySessionOptions (session) {
23
23
  messages: { fr, en }
24
24
  },
25
25
  theme: {
26
- defaultTheme: 'light',
26
+ defaultTheme: 'site',
27
27
  themes: {
28
- light: {
29
- dark: false,
28
+ site: {
29
+ dark: session.site.value?.dark,
30
30
  colors,
31
31
  variables: {
32
32
  // deactivate automatic partial transparencies
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/lib-vuetify",
3
- "version": "1.6.5",
3
+ "version": "1.7.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": [
package/personal-menu.vue CHANGED
@@ -31,7 +31,7 @@
31
31
 
32
32
  <v-list
33
33
  outlined
34
- class="py-0"
34
+ class="py-0 border-sm"
35
35
  >
36
36
  <!-- current account, not actionable -->
37
37
  <v-list-item
@@ -128,17 +128,17 @@
128
128
  class="personal-menu-switch-list-item"
129
129
  >
130
130
  <template #prepend>
131
- <v-icon :icon="mdiShieldAlert" />
131
+ <v-icon :icon="mdiShieldAlert" color="admin" />
132
132
  </template>
133
133
  <v-list-item-title>
134
134
  <v-switch
135
- v-model="user.adminMode"
135
+ :model-value="!!user.adminMode"
136
136
  color="admin"
137
137
  hide-details
138
138
  class="mt-0"
139
139
  density="compact"
140
140
  :label="t('adminMode')"
141
- @change="session.setAdminMode"
141
+ @change="session.setAdminMode(!user.adminMode)"
142
142
  />
143
143
  </v-list-item-title>
144
144
  </v-list-item>
@@ -156,28 +156,6 @@
156
156
  <v-list-item-title>{{ t('backToAdmin') }}</v-list-item-title>
157
157
  </v-list-item>
158
158
 
159
- <!-- switch dark mode -->
160
- <v-list-item
161
- v-if="darkModeSwitch"
162
- density="compact"
163
- class="personal-menu-switch-list-item"
164
- >
165
- <template #prepend>
166
- <v-icon :icon="mdiWeatherNight" />
167
- </template>
168
- <v-list-item-title>
169
- <v-switch
170
- :input-value="session.state.dark"
171
- hide-details
172
- class="mt-0"
173
- density="compact"
174
- :label="t('darkMode')"
175
- color="white"
176
- @change="() => session.switchDark(!session.state.dark)"
177
- />
178
- </v-list-item-title>
179
- </v-list-item>
180
-
181
159
  <!-- logout button -->
182
160
  <v-divider />
183
161
  <v-list-item
@@ -219,23 +197,16 @@ en:
219
197
  </i18n>
220
198
 
221
199
  <script setup lang="ts">
222
- import { computed, toRefs } from 'vue'
200
+ import { computed, toRefs, ref } from 'vue'
223
201
  import { useI18n } from 'vue-i18n'
224
202
  import { useSession } from '@data-fair/lib-vue/session.js'
225
203
  import { useTheme } from 'vuetify'
226
204
  import UserAvatar from './user-avatar.vue'
227
- import { mdiAlert, mdiShieldAlert, mdiLogout, mdiAccountSwitchOutline, mdiWeatherNight } from '@mdi/js'
205
+ import { mdiAlert, mdiShieldAlert, mdiLogout, mdiAccountSwitchOutline } from '@mdi/js'
228
206
 
229
207
  const theme = useTheme()
230
208
  const session = useSession()
231
209
 
232
- defineProps({
233
- darkModeSwitch: {
234
- type: Boolean,
235
- default: false
236
- }
237
- })
238
-
239
210
  const { t } = useI18n({ useScope: 'local' })
240
211
  const { user, account } = toRefs(session.state)
241
212
  const switchableOrganizations = computed(() => {
@@ -6,19 +6,7 @@ declare function __VLS_template(): {
6
6
  attrs: Partial<{}>;
7
7
  };
8
8
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
9
- declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
10
- darkModeSwitch: {
11
- type: BooleanConstructor;
12
- default: boolean;
13
- };
14
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
- darkModeSwitch: {
16
- type: BooleanConstructor;
17
- default: boolean;
18
- };
19
- }>> & Readonly<{}>, {
20
- darkModeSwitch: boolean;
21
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
9
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
22
10
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
23
11
  export default _default;
24
12
  type __VLS_WithTemplateSlots<T, S> = T & {
@@ -4,16 +4,10 @@ import { useI18n } from 'vue-i18n';
4
4
  import { useSession } from '@data-fair/lib-vue/session.js';
5
5
  import { useTheme } from 'vuetify';
6
6
  import UserAvatar from './user-avatar.vue';
7
- import { mdiAlert, mdiShieldAlert, mdiLogout, mdiAccountSwitchOutline, mdiWeatherNight } from '@mdi/js';
7
+ import { mdiAlert, mdiShieldAlert, mdiLogout, mdiAccountSwitchOutline } from '@mdi/js';
8
8
  const { defineProps, defineSlots, defineEmits, defineExpose, defineModel, defineOptions, withDefaults, } = await import('vue');
9
9
  const theme = useTheme();
10
10
  const session = useSession();
11
- const __VLS_props = defineProps({
12
- darkModeSwitch: {
13
- type: Boolean,
14
- default: false
15
- }
16
- });
17
11
  const { t } = useI18n({ useScope: 'local' });
18
12
  const { user, account } = toRefs(session.state);
19
13
  const switchableOrganizations = computed(() => {
@@ -22,14 +16,7 @@ const switchableOrganizations = computed(() => {
22
16
  return;
23
17
  return user.organizations.filter(o => account.type === 'user' || account.id !== o.id || (account.department || null) !== (o.department || null));
24
18
  });
25
- const __VLS_fnComponent = (await import('vue')).defineComponent({
26
- props: {
27
- darkModeSwitch: {
28
- type: Boolean,
29
- default: false
30
- }
31
- },
32
- });
19
+ const __VLS_fnComponent = (await import('vue')).defineComponent({});
33
20
  ;
34
21
  let __VLS_functionalComponentProps;
35
22
  function __VLS_template() {
@@ -95,8 +82,8 @@ function __VLS_template() {
95
82
  const __VLS_35 = __VLS_resolvedLocalAndGlobalComponents.VList;
96
83
  /** @type { [typeof __VLS_components.VList, typeof __VLS_components.vList, typeof __VLS_components.VList, typeof __VLS_components.vList, ] } */
97
84
  // @ts-ignore
98
- const __VLS_36 = __VLS_asFunctionalComponent(__VLS_35, new __VLS_35({ outlined: (true), ...{ class: ("py-0") }, }));
99
- const __VLS_37 = __VLS_36({ outlined: (true), ...{ class: ("py-0") }, }, ...__VLS_functionalComponentArgsRest(__VLS_36));
85
+ const __VLS_36 = __VLS_asFunctionalComponent(__VLS_35, new __VLS_35({ outlined: (true), ...{ class: ("py-0 border-sm") }, }));
86
+ const __VLS_37 = __VLS_36({ outlined: (true), ...{ class: ("py-0 border-sm") }, }, ...__VLS_functionalComponentArgsRest(__VLS_36));
100
87
  const __VLS_41 = __VLS_resolvedLocalAndGlobalComponents.VListItem;
101
88
  /** @type { [typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, ] } */
102
89
  // @ts-ignore
@@ -279,8 +266,8 @@ function __VLS_template() {
279
266
  const __VLS_155 = __VLS_resolvedLocalAndGlobalComponents.VIcon;
280
267
  /** @type { [typeof __VLS_components.VIcon, typeof __VLS_components.vIcon, ] } */
281
268
  // @ts-ignore
282
- const __VLS_156 = __VLS_asFunctionalComponent(__VLS_155, new __VLS_155({ icon: ((__VLS_ctx.mdiShieldAlert)), }));
283
- const __VLS_157 = __VLS_156({ icon: ((__VLS_ctx.mdiShieldAlert)), }, ...__VLS_functionalComponentArgsRest(__VLS_156));
269
+ const __VLS_156 = __VLS_asFunctionalComponent(__VLS_155, new __VLS_155({ icon: ((__VLS_ctx.mdiShieldAlert)), color: ("admin"), }));
270
+ const __VLS_157 = __VLS_156({ icon: ((__VLS_ctx.mdiShieldAlert)), color: ("admin"), }, ...__VLS_functionalComponentArgsRest(__VLS_156));
284
271
  }
285
272
  const __VLS_161 = __VLS_resolvedLocalAndGlobalComponents.VListItemTitle;
286
273
  /** @type { [typeof __VLS_components.VListItemTitle, typeof __VLS_components.vListItemTitle, typeof __VLS_components.VListItemTitle, typeof __VLS_components.vListItemTitle, ] } */
@@ -290,11 +277,17 @@ function __VLS_template() {
290
277
  const __VLS_167 = __VLS_resolvedLocalAndGlobalComponents.VSwitch;
291
278
  /** @type { [typeof __VLS_components.VSwitch, typeof __VLS_components.vSwitch, ] } */
292
279
  // @ts-ignore
293
- const __VLS_168 = __VLS_asFunctionalComponent(__VLS_167, new __VLS_167({ ...{ 'onChange': {} }, modelValue: ((__VLS_ctx.user.adminMode)), color: ("admin"), hideDetails: (true), ...{ class: ("mt-0") }, density: ("compact"), label: ((__VLS_ctx.t('adminMode'))), }));
294
- const __VLS_169 = __VLS_168({ ...{ 'onChange': {} }, modelValue: ((__VLS_ctx.user.adminMode)), color: ("admin"), hideDetails: (true), ...{ class: ("mt-0") }, density: ("compact"), label: ((__VLS_ctx.t('adminMode'))), }, ...__VLS_functionalComponentArgsRest(__VLS_168));
280
+ const __VLS_168 = __VLS_asFunctionalComponent(__VLS_167, new __VLS_167({ ...{ 'onChange': {} }, modelValue: ((!!__VLS_ctx.user.adminMode)), color: ("admin"), hideDetails: (true), ...{ class: ("mt-0") }, density: ("compact"), label: ((__VLS_ctx.t('adminMode'))), }));
281
+ const __VLS_169 = __VLS_168({ ...{ 'onChange': {} }, modelValue: ((!!__VLS_ctx.user.adminMode)), color: ("admin"), hideDetails: (true), ...{ class: ("mt-0") }, density: ("compact"), label: ((__VLS_ctx.t('adminMode'))), }, ...__VLS_functionalComponentArgsRest(__VLS_168));
295
282
  let __VLS_173;
296
283
  const __VLS_174 = {
297
- onChange: (__VLS_ctx.session.setAdminMode)
284
+ onChange: (...[$event]) => {
285
+ if (!(!((!__VLS_ctx.user || !__VLS_ctx.account))))
286
+ return;
287
+ if (!((__VLS_ctx.user.isAdmin)))
288
+ return;
289
+ __VLS_ctx.session.setAdminMode(!__VLS_ctx.user.adminMode);
290
+ }
298
291
  };
299
292
  let __VLS_170;
300
293
  let __VLS_171;
@@ -340,74 +333,38 @@ function __VLS_template() {
340
333
  const __VLS_194 = __VLS_pickFunctionalComponentCtx(__VLS_189, __VLS_191);
341
334
  const __VLS_180 = __VLS_pickFunctionalComponentCtx(__VLS_175, __VLS_177);
342
335
  }
343
- if (__VLS_ctx.darkModeSwitch) {
344
- const __VLS_195 = __VLS_resolvedLocalAndGlobalComponents.VListItem;
345
- /** @type { [typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, ] } */
346
- // @ts-ignore
347
- const __VLS_196 = __VLS_asFunctionalComponent(__VLS_195, new __VLS_195({ density: ("compact"), ...{ class: ("personal-menu-switch-list-item") }, }));
348
- const __VLS_197 = __VLS_196({ density: ("compact"), ...{ class: ("personal-menu-switch-list-item") }, }, ...__VLS_functionalComponentArgsRest(__VLS_196));
349
- __VLS_elementAsFunction(__VLS_intrinsicElements.template, __VLS_intrinsicElements.template)({});
350
- {
351
- const { prepend: __VLS_thisSlot } = __VLS_nonNullable(__VLS_200.slots);
352
- const __VLS_201 = __VLS_resolvedLocalAndGlobalComponents.VIcon;
353
- /** @type { [typeof __VLS_components.VIcon, typeof __VLS_components.vIcon, ] } */
354
- // @ts-ignore
355
- const __VLS_202 = __VLS_asFunctionalComponent(__VLS_201, new __VLS_201({ icon: ((__VLS_ctx.mdiWeatherNight)), }));
356
- const __VLS_203 = __VLS_202({ icon: ((__VLS_ctx.mdiWeatherNight)), }, ...__VLS_functionalComponentArgsRest(__VLS_202));
357
- }
358
- const __VLS_207 = __VLS_resolvedLocalAndGlobalComponents.VListItemTitle;
359
- /** @type { [typeof __VLS_components.VListItemTitle, typeof __VLS_components.vListItemTitle, typeof __VLS_components.VListItemTitle, typeof __VLS_components.vListItemTitle, ] } */
360
- // @ts-ignore
361
- const __VLS_208 = __VLS_asFunctionalComponent(__VLS_207, new __VLS_207({}));
362
- const __VLS_209 = __VLS_208({}, ...__VLS_functionalComponentArgsRest(__VLS_208));
363
- const __VLS_213 = __VLS_resolvedLocalAndGlobalComponents.VSwitch;
364
- /** @type { [typeof __VLS_components.VSwitch, typeof __VLS_components.vSwitch, ] } */
365
- // @ts-ignore
366
- const __VLS_214 = __VLS_asFunctionalComponent(__VLS_213, new __VLS_213({ ...{ 'onChange': {} }, inputValue: ((__VLS_ctx.session.state.dark)), hideDetails: (true), ...{ class: ("mt-0") }, density: ("compact"), label: ((__VLS_ctx.t('darkMode'))), color: ("white"), }));
367
- const __VLS_215 = __VLS_214({ ...{ 'onChange': {} }, inputValue: ((__VLS_ctx.session.state.dark)), hideDetails: (true), ...{ class: ("mt-0") }, density: ("compact"), label: ((__VLS_ctx.t('darkMode'))), color: ("white"), }, ...__VLS_functionalComponentArgsRest(__VLS_214));
368
- let __VLS_219;
369
- const __VLS_220 = {
370
- onChange: (() => __VLS_ctx.session.switchDark(!__VLS_ctx.session.state.dark))
371
- };
372
- let __VLS_216;
373
- let __VLS_217;
374
- const __VLS_218 = __VLS_pickFunctionalComponentCtx(__VLS_213, __VLS_215);
375
- __VLS_nonNullable(__VLS_212.slots).default;
376
- const __VLS_212 = __VLS_pickFunctionalComponentCtx(__VLS_207, __VLS_209);
377
- const __VLS_200 = __VLS_pickFunctionalComponentCtx(__VLS_195, __VLS_197);
378
- }
379
- const __VLS_221 = __VLS_resolvedLocalAndGlobalComponents.VDivider;
336
+ const __VLS_195 = __VLS_resolvedLocalAndGlobalComponents.VDivider;
380
337
  /** @type { [typeof __VLS_components.VDivider, typeof __VLS_components.vDivider, ] } */
381
338
  // @ts-ignore
382
- const __VLS_222 = __VLS_asFunctionalComponent(__VLS_221, new __VLS_221({}));
383
- const __VLS_223 = __VLS_222({}, ...__VLS_functionalComponentArgsRest(__VLS_222));
384
- const __VLS_227 = __VLS_resolvedLocalAndGlobalComponents.VListItem;
339
+ const __VLS_196 = __VLS_asFunctionalComponent(__VLS_195, new __VLS_195({}));
340
+ const __VLS_197 = __VLS_196({}, ...__VLS_functionalComponentArgsRest(__VLS_196));
341
+ const __VLS_201 = __VLS_resolvedLocalAndGlobalComponents.VListItem;
385
342
  /** @type { [typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, ] } */
386
343
  // @ts-ignore
387
- const __VLS_228 = __VLS_asFunctionalComponent(__VLS_227, new __VLS_227({ ...{ 'onClick': {} }, }));
388
- const __VLS_229 = __VLS_228({ ...{ 'onClick': {} }, }, ...__VLS_functionalComponentArgsRest(__VLS_228));
389
- let __VLS_233;
390
- const __VLS_234 = {
344
+ const __VLS_202 = __VLS_asFunctionalComponent(__VLS_201, new __VLS_201({ ...{ 'onClick': {} }, }));
345
+ const __VLS_203 = __VLS_202({ ...{ 'onClick': {} }, }, ...__VLS_functionalComponentArgsRest(__VLS_202));
346
+ let __VLS_207;
347
+ const __VLS_208 = {
391
348
  onClick: (() => __VLS_ctx.session.logout())
392
349
  };
393
- let __VLS_230;
394
- let __VLS_231;
350
+ let __VLS_204;
351
+ let __VLS_205;
395
352
  __VLS_elementAsFunction(__VLS_intrinsicElements.template, __VLS_intrinsicElements.template)({});
396
353
  {
397
- const { prepend: __VLS_thisSlot } = __VLS_nonNullable(__VLS_232.slots);
398
- const __VLS_235 = __VLS_resolvedLocalAndGlobalComponents.VIcon;
354
+ const { prepend: __VLS_thisSlot } = __VLS_nonNullable(__VLS_206.slots);
355
+ const __VLS_209 = __VLS_resolvedLocalAndGlobalComponents.VIcon;
399
356
  /** @type { [typeof __VLS_components.VIcon, typeof __VLS_components.vIcon, ] } */
400
357
  // @ts-ignore
401
- const __VLS_236 = __VLS_asFunctionalComponent(__VLS_235, new __VLS_235({ icon: ((__VLS_ctx.mdiLogout)), }));
402
- const __VLS_237 = __VLS_236({ icon: ((__VLS_ctx.mdiLogout)), }, ...__VLS_functionalComponentArgsRest(__VLS_236));
358
+ const __VLS_210 = __VLS_asFunctionalComponent(__VLS_209, new __VLS_209({ icon: ((__VLS_ctx.mdiLogout)), }));
359
+ const __VLS_211 = __VLS_210({ icon: ((__VLS_ctx.mdiLogout)), }, ...__VLS_functionalComponentArgsRest(__VLS_210));
403
360
  }
404
- const __VLS_241 = __VLS_resolvedLocalAndGlobalComponents.VListItemTitle;
361
+ const __VLS_215 = __VLS_resolvedLocalAndGlobalComponents.VListItemTitle;
405
362
  /** @type { [typeof __VLS_components.VListItemTitle, typeof __VLS_components.vListItemTitle, ] } */
406
363
  // @ts-ignore
407
- const __VLS_242 = __VLS_asFunctionalComponent(__VLS_241, new __VLS_241({}));
408
- const __VLS_243 = __VLS_242({}, ...__VLS_functionalComponentArgsRest(__VLS_242));
364
+ const __VLS_216 = __VLS_asFunctionalComponent(__VLS_215, new __VLS_215({}));
365
+ const __VLS_217 = __VLS_216({}, ...__VLS_functionalComponentArgsRest(__VLS_216));
409
366
  __VLS_directiveAsFunction(__VLS_directives.vT)(null, { ...__VLS_directiveBindingRestFields, value: ('logout') }, null, null);
410
- const __VLS_232 = __VLS_pickFunctionalComponentCtx(__VLS_227, __VLS_229);
367
+ const __VLS_206 = __VLS_pickFunctionalComponentCtx(__VLS_201, __VLS_203);
411
368
  __VLS_nonNullable(__VLS_40.slots).default;
412
369
  const __VLS_40 = __VLS_pickFunctionalComponentCtx(__VLS_35, __VLS_37);
413
370
  const __VLS_17 = __VLS_pickFunctionalComponentCtx(__VLS_12, __VLS_14);
@@ -417,14 +374,13 @@ function __VLS_template() {
417
374
  __VLS_styleScopedClasses['personal-menu'];
418
375
  __VLS_styleScopedClasses['px-0'];
419
376
  __VLS_styleScopedClasses['py-0'];
377
+ __VLS_styleScopedClasses['border-sm'];
420
378
  __VLS_styleScopedClasses['text--secondary'];
421
379
  __VLS_styleScopedClasses['justify-center'];
422
380
  __VLS_styleScopedClasses['ma-0'];
423
381
  __VLS_styleScopedClasses['mb-2'];
424
382
  __VLS_styleScopedClasses['personal-menu-switch-list-item'];
425
383
  __VLS_styleScopedClasses['mt-0'];
426
- __VLS_styleScopedClasses['personal-menu-switch-list-item'];
427
- __VLS_styleScopedClasses['mt-0'];
428
384
  var __VLS_slots;
429
385
  var __VLS_inheritedAttrs;
430
386
  const __VLS_refs = {};
@@ -444,7 +400,6 @@ const __VLS_self = (await import('vue')).defineComponent({
444
400
  mdiShieldAlert: mdiShieldAlert,
445
401
  mdiLogout: mdiLogout,
446
402
  mdiAccountSwitchOutline: mdiAccountSwitchOutline,
447
- mdiWeatherNight: mdiWeatherNight,
448
403
  theme: theme,
449
404
  session: session,
450
405
  t: t,
@@ -453,23 +408,11 @@ const __VLS_self = (await import('vue')).defineComponent({
453
408
  switchableOrganizations: switchableOrganizations,
454
409
  };
455
410
  },
456
- props: {
457
- darkModeSwitch: {
458
- type: Boolean,
459
- default: false
460
- }
461
- },
462
411
  });
463
412
  const __VLS_component = (await import('vue')).defineComponent({
464
413
  setup() {
465
414
  return {};
466
415
  },
467
- props: {
468
- darkModeSwitch: {
469
- type: Boolean,
470
- default: false
471
- }
472
- },
473
416
  });
474
417
  export default {};
475
418
  ;
@@ -0,0 +1,64 @@
1
+ <template>
2
+ <v-toolbar-items class="theme-switcher" v-if="session.fullSite.value?.theme.dark || session.fullSite.value?.theme.hc">
3
+ <v-menu
4
+ offset-y
5
+ nudge-left
6
+ >
7
+ <template #activator="{props: activatorProps}">
8
+ <v-btn
9
+ class="px-0"
10
+ :icon="mdiThemeLightDark"
11
+ :title="t('themeSwitch')"
12
+ v-bind="activatorProps"
13
+ />
14
+ </template>
15
+
16
+ <v-list class="border-sm">
17
+ <v-list-item density="compact" class="pl-0">
18
+ <v-radio-group
19
+ :model-value="session.theme.value"
20
+ density="comfortable"
21
+ color="primary"
22
+ hide-details
23
+ :label="t('themeSwitch')"
24
+ @update:modelValue="value => session.switchTheme(value as 'default' | 'dark' | 'hc')"
25
+ >
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>
29
+ </v-radio-group>
30
+ </v-list-item>
31
+ </v-list>
32
+ </v-menu>
33
+ </v-toolbar-items>
34
+ </template>
35
+
36
+ <i18n lang="yaml">
37
+ fr:
38
+ themeSwitch: Changer de thème
39
+ theme:
40
+ default: par défaut
41
+ dark: sombre
42
+ hc: contraste élevé
43
+ en:
44
+ themeSwitch: Change theme
45
+ theme:
46
+ default: default
47
+ dark: dark
48
+ hc: high contrast
49
+ </i18n>
50
+
51
+ <script setup lang="ts">
52
+ import { useSession } from '@data-fair/lib-vue/session.js'
53
+ import { useI18n } from 'vue-i18n'
54
+ import { mdiThemeLightDark } from '@mdi/js'
55
+
56
+
57
+ const session = useSession()
58
+
59
+ const { t } = useI18n({ useScope: 'local' })
60
+ </script>
61
+
62
+ <style>
63
+
64
+ </style>
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,125 @@
1
+ /// <reference types=".vue-global-types/vue_3.5_false.d.ts" />
2
+ import { useSession } from '@data-fair/lib-vue/session.js';
3
+ import { useI18n } from 'vue-i18n';
4
+ import { mdiThemeLightDark } from '@mdi/js';
5
+ const { defineProps, defineSlots, defineEmits, defineExpose, defineModel, defineOptions, withDefaults, } = await import('vue');
6
+ const session = useSession();
7
+ const { t } = useI18n({ useScope: 'local' });
8
+ const __VLS_fnComponent = (await import('vue')).defineComponent({});
9
+ ;
10
+ let __VLS_functionalComponentProps;
11
+ function __VLS_template() {
12
+ const __VLS_ctx = {};
13
+ const __VLS_localComponents = {
14
+ ...{},
15
+ ...{},
16
+ ...__VLS_ctx,
17
+ };
18
+ let __VLS_components;
19
+ const __VLS_localDirectives = {
20
+ ...{},
21
+ ...__VLS_ctx,
22
+ };
23
+ let __VLS_directives;
24
+ let __VLS_styleScopedClasses;
25
+ // CSS variable injection
26
+ // CSS variable injection end
27
+ let __VLS_resolvedLocalAndGlobalComponents;
28
+ if (__VLS_ctx.session.fullSite.value?.theme.dark || __VLS_ctx.session.fullSite.value?.theme.hc) {
29
+ const __VLS_0 = __VLS_resolvedLocalAndGlobalComponents.VToolbarItems;
30
+ /** @type { [typeof __VLS_components.VToolbarItems, typeof __VLS_components.vToolbarItems, typeof __VLS_components.VToolbarItems, typeof __VLS_components.vToolbarItems, ] } */
31
+ // @ts-ignore
32
+ const __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({ ...{ class: ("theme-switcher") }, }));
33
+ const __VLS_2 = __VLS_1({ ...{ class: ("theme-switcher") }, }, ...__VLS_functionalComponentArgsRest(__VLS_1));
34
+ const __VLS_6 = __VLS_resolvedLocalAndGlobalComponents.VMenu;
35
+ /** @type { [typeof __VLS_components.VMenu, typeof __VLS_components.vMenu, typeof __VLS_components.VMenu, typeof __VLS_components.vMenu, ] } */
36
+ // @ts-ignore
37
+ const __VLS_7 = __VLS_asFunctionalComponent(__VLS_6, new __VLS_6({ offsetY: (true), nudgeLeft: (true), }));
38
+ const __VLS_8 = __VLS_7({ offsetY: (true), nudgeLeft: (true), }, ...__VLS_functionalComponentArgsRest(__VLS_7));
39
+ __VLS_elementAsFunction(__VLS_intrinsicElements.template, __VLS_intrinsicElements.template)({});
40
+ {
41
+ const { activator: __VLS_thisSlot } = __VLS_nonNullable(__VLS_11.slots);
42
+ const { props: activatorProps } = __VLS_getSlotParam(__VLS_thisSlot);
43
+ const __VLS_12 = __VLS_resolvedLocalAndGlobalComponents.VBtn;
44
+ /** @type { [typeof __VLS_components.VBtn, typeof __VLS_components.vBtn, ] } */
45
+ // @ts-ignore
46
+ const __VLS_13 = __VLS_asFunctionalComponent(__VLS_12, new __VLS_12({ ...{ class: ("px-0") }, icon: ((__VLS_ctx.mdiThemeLightDark)), title: ((__VLS_ctx.t('themeSwitch'))), ...(activatorProps), }));
47
+ const __VLS_14 = __VLS_13({ ...{ class: ("px-0") }, icon: ((__VLS_ctx.mdiThemeLightDark)), title: ((__VLS_ctx.t('themeSwitch'))), ...(activatorProps), }, ...__VLS_functionalComponentArgsRest(__VLS_13));
48
+ }
49
+ const __VLS_18 = __VLS_resolvedLocalAndGlobalComponents.VList;
50
+ /** @type { [typeof __VLS_components.VList, typeof __VLS_components.vList, typeof __VLS_components.VList, typeof __VLS_components.vList, ] } */
51
+ // @ts-ignore
52
+ const __VLS_19 = __VLS_asFunctionalComponent(__VLS_18, new __VLS_18({ ...{ class: ("border-sm") }, }));
53
+ const __VLS_20 = __VLS_19({ ...{ class: ("border-sm") }, }, ...__VLS_functionalComponentArgsRest(__VLS_19));
54
+ const __VLS_24 = __VLS_resolvedLocalAndGlobalComponents.VListItem;
55
+ /** @type { [typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, ] } */
56
+ // @ts-ignore
57
+ const __VLS_25 = __VLS_asFunctionalComponent(__VLS_24, new __VLS_24({ density: ("compact"), ...{ class: ("pl-0") }, }));
58
+ const __VLS_26 = __VLS_25({ density: ("compact"), ...{ class: ("pl-0") }, }, ...__VLS_functionalComponentArgsRest(__VLS_25));
59
+ const __VLS_30 = __VLS_resolvedLocalAndGlobalComponents.VRadioGroup;
60
+ /** @type { [typeof __VLS_components.VRadioGroup, typeof __VLS_components.vRadioGroup, typeof __VLS_components.VRadioGroup, typeof __VLS_components.vRadioGroup, ] } */
61
+ // @ts-ignore
62
+ const __VLS_31 = __VLS_asFunctionalComponent(__VLS_30, new __VLS_30({ ...{ 'onUpdate:modelValue': {} }, modelValue: ((__VLS_ctx.session.theme.value)), density: ("comfortable"), color: ("primary"), hideDetails: (true), label: ((__VLS_ctx.t('themeSwitch'))), }));
63
+ const __VLS_32 = __VLS_31({ ...{ 'onUpdate:modelValue': {} }, modelValue: ((__VLS_ctx.session.theme.value)), density: ("comfortable"), color: ("primary"), hideDetails: (true), label: ((__VLS_ctx.t('themeSwitch'))), }, ...__VLS_functionalComponentArgsRest(__VLS_31));
64
+ let __VLS_36;
65
+ const __VLS_37 = {
66
+ 'onUpdate:modelValue': (value => __VLS_ctx.session.switchTheme(value))
67
+ };
68
+ let __VLS_33;
69
+ let __VLS_34;
70
+ const __VLS_38 = __VLS_resolvedLocalAndGlobalComponents.VRadio;
71
+ /** @type { [typeof __VLS_components.VRadio, typeof __VLS_components.vRadio, typeof __VLS_components.VRadio, typeof __VLS_components.vRadio, ] } */
72
+ // @ts-ignore
73
+ const __VLS_39 = __VLS_asFunctionalComponent(__VLS_38, new __VLS_38({ label: ((__VLS_ctx.t('theme.default'))), value: ("default"), }));
74
+ const __VLS_40 = __VLS_39({ label: ((__VLS_ctx.t('theme.default'))), value: ("default"), }, ...__VLS_functionalComponentArgsRest(__VLS_39));
75
+ const __VLS_44 = __VLS_resolvedLocalAndGlobalComponents.VRadio;
76
+ /** @type { [typeof __VLS_components.VRadio, typeof __VLS_components.vRadio, typeof __VLS_components.VRadio, typeof __VLS_components.vRadio, ] } */
77
+ // @ts-ignore
78
+ const __VLS_45 = __VLS_asFunctionalComponent(__VLS_44, new __VLS_44({ label: ((__VLS_ctx.t('theme.dark'))), value: ("dark"), }));
79
+ const __VLS_46 = __VLS_45({ label: ((__VLS_ctx.t('theme.dark'))), value: ("dark"), }, ...__VLS_functionalComponentArgsRest(__VLS_45));
80
+ const __VLS_50 = __VLS_resolvedLocalAndGlobalComponents.VRadio;
81
+ /** @type { [typeof __VLS_components.VRadio, typeof __VLS_components.vRadio, typeof __VLS_components.VRadio, typeof __VLS_components.vRadio, ] } */
82
+ // @ts-ignore
83
+ const __VLS_51 = __VLS_asFunctionalComponent(__VLS_50, new __VLS_50({ label: ((__VLS_ctx.t('theme.hc'))), value: ("hc"), }));
84
+ const __VLS_52 = __VLS_51({ label: ((__VLS_ctx.t('theme.hc'))), value: ("hc"), }, ...__VLS_functionalComponentArgsRest(__VLS_51));
85
+ __VLS_nonNullable(__VLS_35.slots).default;
86
+ const __VLS_35 = __VLS_pickFunctionalComponentCtx(__VLS_30, __VLS_32);
87
+ __VLS_nonNullable(__VLS_29.slots).default;
88
+ const __VLS_29 = __VLS_pickFunctionalComponentCtx(__VLS_24, __VLS_26);
89
+ __VLS_nonNullable(__VLS_23.slots).default;
90
+ const __VLS_23 = __VLS_pickFunctionalComponentCtx(__VLS_18, __VLS_20);
91
+ const __VLS_11 = __VLS_pickFunctionalComponentCtx(__VLS_6, __VLS_8);
92
+ __VLS_nonNullable(__VLS_5.slots).default;
93
+ const __VLS_5 = __VLS_pickFunctionalComponentCtx(__VLS_0, __VLS_2);
94
+ }
95
+ __VLS_styleScopedClasses['theme-switcher'];
96
+ __VLS_styleScopedClasses['px-0'];
97
+ __VLS_styleScopedClasses['border-sm'];
98
+ __VLS_styleScopedClasses['pl-0'];
99
+ var __VLS_slots;
100
+ var __VLS_inheritedAttrs;
101
+ const __VLS_refs = {};
102
+ var $refs;
103
+ return {
104
+ slots: __VLS_slots,
105
+ refs: $refs,
106
+ attrs: {},
107
+ };
108
+ }
109
+ ;
110
+ const __VLS_self = (await import('vue')).defineComponent({
111
+ setup() {
112
+ return {
113
+ mdiThemeLightDark: mdiThemeLightDark,
114
+ session: session,
115
+ t: t,
116
+ };
117
+ },
118
+ });
119
+ export default (await import('vue')).defineComponent({
120
+ setup() {
121
+ return {};
122
+ },
123
+ });
124
+ ;
125
+ //# sourceMappingURL=theme-switcher.vue.js.map