@data-fair/lib-vuetify 1.4.0 → 1.5.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.
Files changed (3) hide show
  1. package/index.d.ts +2 -238
  2. package/index.js +24 -6
  3. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -1,241 +1,5 @@
1
1
  import { type Session } from '@data-fair/lib-vue/session.js';
2
2
  import { VuetifyOptions } from 'vuetify';
3
- export declare function vuetifySessionOptions(session: Session): {
4
- ssr: boolean;
5
- locale: {
6
- locale: import("vue").ComputedRef<string>;
7
- messages: {
8
- fr: {
9
- badge: string;
10
- open: string;
11
- close: string;
12
- dismiss: string;
13
- confirmEdit: {
14
- ok: string;
15
- cancel: string;
16
- };
17
- dataIterator: {
18
- noResultsText: string;
19
- loadingText: string;
20
- };
21
- dataTable: {
22
- itemsPerPageText: string;
23
- ariaLabel: {
24
- sortDescending: string;
25
- sortAscending: string;
26
- sortNone: string;
27
- activateNone: string;
28
- activateDescending: string;
29
- activateAscending: string;
30
- };
31
- sortBy: string;
32
- };
33
- dataFooter: {
34
- itemsPerPageText: string;
35
- itemsPerPageAll: string;
36
- nextPage: string;
37
- prevPage: string;
38
- firstPage: string;
39
- lastPage: string;
40
- pageText: string;
41
- };
42
- dateRangeInput: {
43
- divider: string;
44
- };
45
- datePicker: {
46
- itemsSelected: string;
47
- range: {
48
- title: string;
49
- header: string;
50
- };
51
- title: string;
52
- header: string;
53
- input: {
54
- placeholder: string;
55
- };
56
- };
57
- noDataText: string;
58
- carousel: {
59
- prev: string;
60
- next: string;
61
- ariaLabel: {
62
- delimiter: string;
63
- };
64
- };
65
- calendar: {
66
- moreEvents: string;
67
- today: string;
68
- };
69
- input: {
70
- clear: string;
71
- prependAction: string;
72
- appendAction: string;
73
- otp: string;
74
- };
75
- fileInput: {
76
- counter: string;
77
- counterSize: string;
78
- };
79
- timePicker: {
80
- am: string;
81
- pm: string;
82
- title: string;
83
- };
84
- pagination: {
85
- ariaLabel: {
86
- root: string;
87
- next: string;
88
- previous: string;
89
- page: string;
90
- currentPage: string;
91
- first: string;
92
- last: string;
93
- };
94
- };
95
- stepper: {
96
- next: string;
97
- prev: string;
98
- };
99
- rating: {
100
- ariaLabel: {
101
- item: string;
102
- };
103
- };
104
- loading: string;
105
- infiniteScroll: {
106
- loadMore: string;
107
- empty: string;
108
- };
109
- };
110
- en: {
111
- badge: string;
112
- open: string;
113
- close: string;
114
- dismiss: string;
115
- confirmEdit: {
116
- ok: string;
117
- cancel: string;
118
- };
119
- dataIterator: {
120
- noResultsText: string;
121
- loadingText: string;
122
- };
123
- dataTable: {
124
- itemsPerPageText: string;
125
- ariaLabel: {
126
- sortDescending: string;
127
- sortAscending: string;
128
- sortNone: string;
129
- activateNone: string;
130
- activateDescending: string;
131
- activateAscending: string;
132
- };
133
- sortBy: string;
134
- };
135
- dataFooter: {
136
- itemsPerPageText: string;
137
- itemsPerPageAll: string;
138
- nextPage: string;
139
- prevPage: string;
140
- firstPage: string;
141
- lastPage: string;
142
- pageText: string;
143
- };
144
- dateRangeInput: {
145
- divider: string;
146
- };
147
- datePicker: {
148
- itemsSelected: string;
149
- range: {
150
- title: string;
151
- header: string;
152
- };
153
- title: string;
154
- header: string;
155
- input: {
156
- placeholder: string;
157
- };
158
- };
159
- noDataText: string;
160
- carousel: {
161
- prev: string;
162
- next: string;
163
- ariaLabel: {
164
- delimiter: string;
165
- };
166
- };
167
- calendar: {
168
- moreEvents: string;
169
- today: string;
170
- };
171
- input: {
172
- clear: string;
173
- prependAction: string;
174
- appendAction: string;
175
- otp: string;
176
- };
177
- fileInput: {
178
- counter: string;
179
- counterSize: string;
180
- };
181
- timePicker: {
182
- am: string;
183
- pm: string;
184
- title: string;
185
- };
186
- pagination: {
187
- ariaLabel: {
188
- root: string;
189
- next: string;
190
- previous: string;
191
- page: string;
192
- currentPage: string;
193
- first: string;
194
- last: string;
195
- };
196
- };
197
- stepper: {
198
- next: string;
199
- prev: string;
200
- };
201
- rating: {
202
- ariaLabel: {
203
- item: string;
204
- };
205
- };
206
- loading: string;
207
- infiniteScroll: {
208
- loadMore: string;
209
- empty: string;
210
- };
211
- };
212
- };
213
- };
214
- theme: {
215
- defaultTheme: string;
216
- themes: {
217
- light: {
218
- dark: boolean;
219
- colors: {
220
- background?: string | undefined;
221
- surface?: string | undefined;
222
- primary: string;
223
- secondary: string;
224
- accent: string;
225
- error: string;
226
- info: string;
227
- success: string;
228
- warning: string;
229
- admin: string;
230
- };
231
- };
232
- };
233
- };
234
- defaults: {
235
- VCard: {
236
- variant: string;
237
- style: string;
238
- };
239
- };
240
- };
3
+ export declare function vuetifySessionOptions(session: Session): VuetifyOptions;
4
+ export declare function vuetifySessionStyle(session: Session): string;
241
5
  export declare function defaultOptions(searchParams: Record<string, string>, darkCookie?: boolean, locale?: string): VuetifyOptions;
package/index.js CHANGED
@@ -14,11 +14,12 @@ 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,
20
21
  locale: {
21
- locale: session.lang,
22
+ locale: session.lang.value,
22
23
  messages: { fr, en }
23
24
  },
24
25
  theme: {
@@ -26,20 +27,37 @@ 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': 1
36
+ }
30
37
  }
31
38
  }
32
39
  },
33
40
  defaults: {
34
41
  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;'
42
+ // white card with light grey border by default
43
+ variant: 'elevated',
44
+ elevation: 0,
45
+ border: 'sm'
39
46
  }
40
47
  }
41
48
  }
42
49
  }
50
+ export function vuetifySessionStyle (session) {
51
+ if (!session.site.value) { throw new Error('vuetifySectionStyle requires fething site info in session util') }
52
+ return `
53
+ .v-application .text-primary!important {
54
+ color: ${session.site.value.colors['text-primary']};
55
+ }
56
+ .v-application .text-secondary!important {
57
+ color: ${session.site.value.colors['text-secondary']};
58
+ }
59
+ `
60
+ }
43
61
  // TODO: deprecate this in favor of sessionVuetifyOptions
44
62
  export function defaultOptions (searchParams, darkCookie = false, locale = 'fr') {
45
63
  console.warn('vuetify.defaultOptions is deprecated, use sessionVuetifyOptions')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/lib-vuetify",
3
- "version": "1.4.0",
3
+ "version": "1.5.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.9.0",
19
+ "@data-fair/lib-vue": "^1.9.3",
20
20
  "ofetch": "1",
21
21
  "vue-i18n": "10",
22
22
  "vuetify": "3"