@data-fair/lib-vuetify 1.4.1 → 1.5.1

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 CHANGED
@@ -1,4 +1,5 @@
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;
4
5
  export declare function defaultOptions(searchParams: Record<string, string>, darkCookie?: boolean, locale?: string): VuetifyOptions;
package/index.js CHANGED
@@ -14,6 +14,7 @@ const baseDarkColors = {
14
14
  success: '#00E676' // green.accent3
15
15
  }
16
16
  export function vuetifySessionOptions (session) {
17
+ if (!session.site.value) { throw new Error('vuetifySessionOptions requires fething site info in session util') }
17
18
  const colors = { ...baseColors, ...session.site.value?.colors }
18
19
  return {
19
20
  ssr: false,
@@ -26,23 +27,44 @@ export function vuetifySessionOptions (session) {
26
27
  themes: {
27
28
  light: {
28
29
  dark: false,
29
- colors
30
+ colors,
31
+ variables: {
32
+ // deactivate automatic partial transparencies
33
+ // best to control colors precisely and ensure sufficient contrast for readability
34
+ 'high-emphasis-opacity': 1,
35
+ 'medium-emphasis-opacity': 0.87
36
+ }
30
37
  }
31
38
  }
32
39
  },
33
40
  defaults: {
41
+ global: {
42
+ // the default density is way too low
43
+ density: 'comfortable'
44
+ },
34
45
  VCard: {
35
- // grey outlined card by default
36
- variant: 'outlined',
37
- // TODO: replace this with a cleaner border-opacity prop https://vuetifyjs.com/en/styles/borders/#theme-colors ?
38
- style: 'border-color: rgba(var(--v-theme-on-surface), var(--v-focus-opacity)) !important;'
46
+ // white card with light grey border by default
47
+ variant: 'elevated',
48
+ elevation: 0,
49
+ border: 'sm'
39
50
  }
40
51
  }
41
52
  }
42
53
  }
54
+ export function vuetifySessionStyle (session) {
55
+ if (!session.site.value) { throw new Error('vuetifySectionStyle requires fething site info in session util') }
56
+ return `
57
+ .v-application .text-primary!important {
58
+ color: ${session.site.value.colors['text-primary']};
59
+ }
60
+ .v-application .text-secondary!important {
61
+ color: ${session.site.value.colors['text-secondary']};
62
+ }
63
+ `
64
+ }
43
65
  // TODO: deprecate this in favor of sessionVuetifyOptions
44
66
  export function defaultOptions (searchParams, darkCookie = false, locale = 'fr') {
45
- console.warn('vuetify.defaultOptions is deprecated, use sessionVuetifyOptions')
67
+ // console.warn('vuetify.defaultOptions is deprecated, use vuetifySessionOptions')
46
68
  const dark = searchParams?.dark ? searchParams.dark === 'true' : darkCookie
47
69
  const searchParamsColors = {}
48
70
  for (const colorCode of ['primary', 'secondary']) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/lib-vuetify",
3
- "version": "1.4.1",
3
+ "version": "1.5.1",
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.9.0",
19
+ "@data-fair/lib-vue": "^1.9.3",
20
20
  "ofetch": "1",
21
21
  "vue-i18n": "10",
22
22
  "vuetify": "3"
package/user-avatar.vue CHANGED
@@ -8,33 +8,33 @@
8
8
  class="primary-avatar"
9
9
  :size="36"
10
10
  >
11
- <img
11
+ <v-img
12
12
  :src="userAvatarUrl"
13
13
  aria-hidden
14
14
  alt=""
15
- >
15
+ />
16
16
  </v-avatar>
17
17
  <v-avatar
18
18
  v-else
19
19
  class="primary-avatar"
20
20
  :size="36"
21
21
  >
22
- <img
22
+ <v-img
23
23
  :src="accountAvatarUrl"
24
24
  aria-hidden
25
25
  alt=""
26
- >
26
+ />
27
27
  </v-avatar>
28
28
  <v-avatar
29
29
  v-if="showSecondAvatar"
30
30
  class="secondary-avatar"
31
31
  :size="28"
32
32
  >
33
- <img
33
+ <v-img
34
34
  :src="userAvatarUrl"
35
35
  aria-hidden
36
36
  alt=""
37
- >
37
+ />
38
38
  </v-avatar>
39
39
  </div>
40
40
  </template>
@@ -48,29 +48,41 @@ function __VLS_template() {
48
48
  // @ts-ignore
49
49
  const __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({ ...{ class: ("primary-avatar") }, size: ((36)), }));
50
50
  const __VLS_2 = __VLS_1({ ...{ class: ("primary-avatar") }, size: ((36)), }, ...__VLS_functionalComponentArgsRest(__VLS_1));
51
- __VLS_elementAsFunction(__VLS_intrinsicElements.img, __VLS_intrinsicElements.img)({ src: ((__VLS_ctx.userAvatarUrl)), "aria-hidden": (true), alt: (""), });
51
+ const __VLS_6 = __VLS_resolvedLocalAndGlobalComponents.VImg;
52
+ /** @type { [typeof __VLS_components.VImg, typeof __VLS_components.vImg, ] } */
53
+ // @ts-ignore
54
+ const __VLS_7 = __VLS_asFunctionalComponent(__VLS_6, new __VLS_6({ src: ((__VLS_ctx.userAvatarUrl)), "aria-hidden": (true), alt: (""), }));
55
+ const __VLS_8 = __VLS_7({ src: ((__VLS_ctx.userAvatarUrl)), "aria-hidden": (true), alt: (""), }, ...__VLS_functionalComponentArgsRest(__VLS_7));
52
56
  __VLS_nonNullable(__VLS_5.slots).default;
53
57
  const __VLS_5 = __VLS_pickFunctionalComponentCtx(__VLS_0, __VLS_2);
54
58
  }
55
59
  else {
56
- const __VLS_6 = __VLS_resolvedLocalAndGlobalComponents.VAvatar;
60
+ const __VLS_12 = __VLS_resolvedLocalAndGlobalComponents.VAvatar;
57
61
  /** @type { [typeof __VLS_components.VAvatar, typeof __VLS_components.vAvatar, typeof __VLS_components.VAvatar, typeof __VLS_components.vAvatar, ] } */
58
62
  // @ts-ignore
59
- const __VLS_7 = __VLS_asFunctionalComponent(__VLS_6, new __VLS_6({ ...{ class: ("primary-avatar") }, size: ((36)), }));
60
- const __VLS_8 = __VLS_7({ ...{ class: ("primary-avatar") }, size: ((36)), }, ...__VLS_functionalComponentArgsRest(__VLS_7));
61
- __VLS_elementAsFunction(__VLS_intrinsicElements.img, __VLS_intrinsicElements.img)({ src: ((__VLS_ctx.accountAvatarUrl)), "aria-hidden": (true), alt: (""), });
62
- __VLS_nonNullable(__VLS_11.slots).default;
63
- const __VLS_11 = __VLS_pickFunctionalComponentCtx(__VLS_6, __VLS_8);
63
+ const __VLS_13 = __VLS_asFunctionalComponent(__VLS_12, new __VLS_12({ ...{ class: ("primary-avatar") }, size: ((36)), }));
64
+ const __VLS_14 = __VLS_13({ ...{ class: ("primary-avatar") }, size: ((36)), }, ...__VLS_functionalComponentArgsRest(__VLS_13));
65
+ const __VLS_18 = __VLS_resolvedLocalAndGlobalComponents.VImg;
66
+ /** @type { [typeof __VLS_components.VImg, typeof __VLS_components.vImg, ] } */
67
+ // @ts-ignore
68
+ const __VLS_19 = __VLS_asFunctionalComponent(__VLS_18, new __VLS_18({ src: ((__VLS_ctx.accountAvatarUrl)), "aria-hidden": (true), alt: (""), }));
69
+ const __VLS_20 = __VLS_19({ src: ((__VLS_ctx.accountAvatarUrl)), "aria-hidden": (true), alt: (""), }, ...__VLS_functionalComponentArgsRest(__VLS_19));
70
+ __VLS_nonNullable(__VLS_17.slots).default;
71
+ const __VLS_17 = __VLS_pickFunctionalComponentCtx(__VLS_12, __VLS_14);
64
72
  }
65
73
  if (__VLS_ctx.showSecondAvatar) {
66
- const __VLS_12 = __VLS_resolvedLocalAndGlobalComponents.VAvatar;
74
+ const __VLS_24 = __VLS_resolvedLocalAndGlobalComponents.VAvatar;
67
75
  /** @type { [typeof __VLS_components.VAvatar, typeof __VLS_components.vAvatar, typeof __VLS_components.VAvatar, typeof __VLS_components.vAvatar, ] } */
68
76
  // @ts-ignore
69
- const __VLS_13 = __VLS_asFunctionalComponent(__VLS_12, new __VLS_12({ ...{ class: ("secondary-avatar") }, size: ((28)), }));
70
- const __VLS_14 = __VLS_13({ ...{ class: ("secondary-avatar") }, size: ((28)), }, ...__VLS_functionalComponentArgsRest(__VLS_13));
71
- __VLS_elementAsFunction(__VLS_intrinsicElements.img, __VLS_intrinsicElements.img)({ src: ((__VLS_ctx.userAvatarUrl)), "aria-hidden": (true), alt: (""), });
72
- __VLS_nonNullable(__VLS_17.slots).default;
73
- const __VLS_17 = __VLS_pickFunctionalComponentCtx(__VLS_12, __VLS_14);
77
+ const __VLS_25 = __VLS_asFunctionalComponent(__VLS_24, new __VLS_24({ ...{ class: ("secondary-avatar") }, size: ((28)), }));
78
+ const __VLS_26 = __VLS_25({ ...{ class: ("secondary-avatar") }, size: ((28)), }, ...__VLS_functionalComponentArgsRest(__VLS_25));
79
+ const __VLS_30 = __VLS_resolvedLocalAndGlobalComponents.VImg;
80
+ /** @type { [typeof __VLS_components.VImg, typeof __VLS_components.vImg, ] } */
81
+ // @ts-ignore
82
+ const __VLS_31 = __VLS_asFunctionalComponent(__VLS_30, new __VLS_30({ src: ((__VLS_ctx.userAvatarUrl)), "aria-hidden": (true), alt: (""), }));
83
+ const __VLS_32 = __VLS_31({ src: ((__VLS_ctx.userAvatarUrl)), "aria-hidden": (true), alt: (""), }, ...__VLS_functionalComponentArgsRest(__VLS_31));
84
+ __VLS_nonNullable(__VLS_29.slots).default;
85
+ const __VLS_29 = __VLS_pickFunctionalComponentCtx(__VLS_24, __VLS_26);
74
86
  }
75
87
  __VLS_styleScopedClasses['sd-avatar'];
76
88
  __VLS_styleScopedClasses['has-secondary-avatar'];