@data-fair/lib-vuetify 1.3.0 → 1.4.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.
Files changed (3) hide show
  1. package/index.d.ts +3 -1
  2. package/index.js +29 -0
  3. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
+ import { type Session } from '@data-fair/lib-vue/session.js';
1
2
  import { VuetifyOptions } from 'vuetify';
2
- export declare function defaultOptions(searchParams: Record<string, string>, darkCookie?: boolean, locale?: 'fr' | 'en'): VuetifyOptions;
3
+ export declare function vuetifySessionOptions(session: Session): VuetifyOptions;
4
+ export declare function defaultOptions(searchParams: Record<string, string>, darkCookie?: boolean, locale?: string): VuetifyOptions;
package/index.js CHANGED
@@ -13,7 +13,36 @@ const baseDarkColors = {
13
13
  primary: '#2196F3', // blue.base
14
14
  success: '#00E676' // green.accent3
15
15
  }
16
+ export function vuetifySessionOptions (session) {
17
+ const colors = { ...baseColors, ...session.site.value?.colors }
18
+ return {
19
+ ssr: false,
20
+ locale: {
21
+ locale: session.lang.value,
22
+ messages: { fr, en }
23
+ },
24
+ theme: {
25
+ defaultTheme: 'light',
26
+ themes: {
27
+ light: {
28
+ dark: false,
29
+ colors
30
+ }
31
+ }
32
+ },
33
+ defaults: {
34
+ 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;'
39
+ }
40
+ }
41
+ }
42
+ }
43
+ // TODO: deprecate this in favor of sessionVuetifyOptions
16
44
  export function defaultOptions (searchParams, darkCookie = false, locale = 'fr') {
45
+ console.warn('vuetify.defaultOptions is deprecated, use sessionVuetifyOptions')
17
46
  const dark = searchParams?.dark ? searchParams.dark === 'true' : darkCookie
18
47
  const searchParamsColors = {}
19
48
  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.3.0",
3
+ "version": "1.4.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.2.0",
19
+ "@data-fair/lib-vue": "^1.9.0",
20
20
  "ofetch": "1",
21
21
  "vue-i18n": "10",
22
22
  "vuetify": "3"