@dargmuesli/nuxt-vio 3.0.0-beta.19 → 3.0.0-beta.20

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.
@@ -1,9 +1,9 @@
1
1
  <template>
2
2
  <a
3
- v-if="to.match(/^((ftp|http(s)?):\/\/|(mailto):)/)"
3
+ v-if="to?.toString().match(/^((ftp|http(s)?):\/\/|(mailto):)/)"
4
4
  :aria-label="ariaLabel"
5
5
  :class="classes"
6
- :href="to"
6
+ :href="to.toString()"
7
7
  :rel="
8
8
  [...(nofollow ? ['nofollow'] : []), 'noopener', 'noreferrer'].join(' ')
9
9
  "
@@ -24,13 +24,15 @@
24
24
  </template>
25
25
 
26
26
  <script setup lang="ts">
27
+ import { NuxtLinkProps } from '#app'
28
+
27
29
  export interface Props {
28
30
  ariaLabel?: string
29
31
  isColored?: boolean
30
32
  isToRelative?: boolean
31
33
  isUnderlined?: boolean
32
34
  nofollow?: boolean
33
- to: string
35
+ to: NuxtLinkProps['to']
34
36
  }
35
37
  const props = withDefaults(defineProps<Props>(), {
36
38
  ariaLabel: undefined,
package/nuxt.config.ts CHANGED
@@ -1,180 +1,172 @@
1
1
  import { dirname, join } from 'node:path'
2
2
  import { fileURLToPath } from 'node:url'
3
3
 
4
+ import { defu } from 'defu'
5
+
4
6
  import {
7
+ BASE_URL,
5
8
  I18N_COOKIE_NAME,
6
- I18N_MODULE_CONFIG,
7
- TIMEZONE_COOKIE_NAME,
8
9
  SITE_NAME,
10
+ TIMEZONE_COOKIE_NAME,
11
+ VIO_NUXT_BASE_CONFIG,
9
12
  } from './utils/constants'
10
13
 
11
14
  const currentDir = dirname(fileURLToPath(import.meta.url))
12
15
 
13
- const BASE_URL =
14
- (process.env.NUXT_PUBLIC_STACK_DOMAIN ? 'https' : 'http') +
15
- '://' +
16
- (process.env.NUXT_PUBLIC_STACK_DOMAIN ||
17
- `${process.env.HOST || 'localhost'}:${
18
- !process.env.NODE_ENV || process.env.NODE_ENV === 'development'
19
- ? '3000'
20
- : '3001'
21
- }`)
22
-
23
16
  // https://v3.nuxtjs.org/api/configuration/nuxt.config
24
- export default defineNuxtConfig({
25
- alias: {
26
- clipboard: 'clipboard',
27
- dayjs: 'dayjs',
28
- sweetalert2: 'sweetalert2',
29
- }, // TODO: remove (https://github.com/nuxt/nuxt/issues/19426)
30
- app: {
31
- head: {
32
- htmlAttrs: {
33
- lang: 'en', // fallback data to prevent invalid html at generation
17
+ export default defineNuxtConfig(
18
+ defu(
19
+ {
20
+ alias: {
21
+ clipboard: 'clipboard',
22
+ dayjs: 'dayjs',
23
+ sweetalert2: 'sweetalert2',
24
+ }, // TODO: remove (https://github.com/nuxt/nuxt/issues/19426)
25
+ app: {
26
+ head: {
27
+ htmlAttrs: {
28
+ lang: 'en', // fallback data to prevent invalid html at generation
29
+ },
30
+ titleTemplate: '%s', // fully set in `composables/useAppLayout.ts`
31
+ },
32
+ pageTransition: {
33
+ name: 'layout',
34
+ },
34
35
  },
35
- title: SITE_NAME, // fallback data to prevent invalid html at generation
36
- titleTemplate: '%s', // fully set in `composables/useAppLayout.ts`
37
- },
38
- pageTransition: {
39
- name: 'layout',
40
- },
41
- },
42
- devtools: {
43
- enabled: process.env.NODE_ENV !== 'production',
44
- timeline: {
45
- enabled: true,
46
- },
47
- },
48
- modules: [
49
- '@dargmuesli/nuxt-cookie-control',
50
- '@nuxt/image',
51
- '@nuxtjs/color-mode',
52
- '@nuxtjs/html-validator',
53
- '@nuxtjs/i18n',
54
- '@nuxtjs/tailwindcss',
55
- '@pinia/nuxt',
56
- 'nuxt-seo-kit-module',
57
- ],
58
- nitro: {
59
- compressPublicAssets: true,
60
- },
61
- runtimeConfig: {
62
- public: {
63
- i18n: {
64
- baseUrl: BASE_URL,
36
+ devtools: {
37
+ enabled: process.env.NODE_ENV !== 'production',
38
+ timeline: {
39
+ enabled: true,
40
+ },
65
41
  },
66
- vio: {
67
- googleAnalyticsId: '', // set via environment variable `NUXT_PUBLIC_GOOGLE_ANALYTICS_ID` only
68
- isInProduction: process.env.NODE_ENV === 'production',
69
- isTesting: false,
70
- stagingHost:
71
- process.env.NODE_ENV !== 'production' &&
72
- !process.env.NUXT_PUBLIC_STACK_DOMAIN
73
- ? 'localhost:3000'
74
- : undefined,
42
+ modules: [
43
+ '@dargmuesli/nuxt-cookie-control',
44
+ '@nuxt/image',
45
+ '@nuxtjs/color-mode',
46
+ '@nuxtjs/html-validator',
47
+ '@nuxtjs/i18n',
48
+ '@nuxtjs/tailwindcss',
49
+ '@pinia/nuxt',
50
+ 'nuxt-seo-kit-module',
51
+ ],
52
+ nitro: {
53
+ compressPublicAssets: true,
75
54
  },
76
- },
77
- },
78
- typescript: {
79
- shim: false,
80
- // tsConfig: {
81
- // compilerOptions: {
82
- // esModuleInterop: true,
83
- // },
84
- // },
85
- },
86
-
87
- // modules
88
- colorMode: {
89
- classSuffix: '',
90
- },
91
- cookieControl: {
92
- cookies: {
93
- necessary: [
94
- {
95
- description: {
96
- de: 'Dieser Cookie von uns speichert die Einstellungen, die in diesem Dialog getroffen werden.',
97
- en: 'This cookie of ours stores the settings made in this dialog.',
55
+ runtimeConfig: {
56
+ public: {
57
+ vio: {
58
+ googleAnalyticsId: '', // set via environment variable `NUXT_PUBLIC_GOOGLE_ANALYTICS_ID` only
59
+ isInProduction: process.env.NODE_ENV === 'production',
60
+ isTesting: false,
98
61
  },
99
- id: 'c',
100
- name: {
101
- de: 'Cookie-Präferenzen',
102
- en: 'Cookie Preferences',
103
- },
104
- targetCookieIds: ['ncc_c', 'ncc_e'],
105
62
  },
106
- {
107
- description: {
108
- de: 'Dieser Cookie von uns speichert die Sprache, in der diese Webseite angezeigt wird.',
109
- en: "This cookie of ours stores the language that's used to display this website.",
110
- },
111
- id: 'l',
112
- name: {
113
- de: 'Sprache',
114
- en: 'Language',
63
+ },
64
+ typescript: {
65
+ shim: false,
66
+ tsConfig: {
67
+ compilerOptions: {
68
+ esModuleInterop: true,
69
+ // moduleResolution: 'bundler',
70
+ // noErrorTruncation: true,
115
71
  },
116
- targetCookieIds: [I18N_COOKIE_NAME],
117
72
  },
118
- {
119
- description: {
120
- de: 'Dieser Cookie von uns speichert die Zeitzone, in der sich das Gerät zu befinden scheint.',
121
- en: 'This cookie of ours saves the timezone in which the device appears to be located.',
122
- },
123
- id: 't',
124
- name: {
125
- de: 'Zeitzone',
126
- en: 'Timezone',
127
- },
128
- targetCookieIds: [TIMEZONE_COOKIE_NAME],
73
+ },
74
+
75
+ // modules
76
+ colorMode: {
77
+ classSuffix: '',
78
+ },
79
+ cookieControl: {
80
+ cookies: {
81
+ necessary: [
82
+ {
83
+ description: {
84
+ de: 'Dieser Cookie von uns speichert die Einstellungen, die in diesem Dialog getroffen werden.',
85
+ en: 'This cookie of ours stores the settings made in this dialog.',
86
+ },
87
+ id: 'c',
88
+ name: {
89
+ de: 'Cookie-Präferenzen',
90
+ en: 'Cookie Preferences',
91
+ },
92
+ targetCookieIds: ['ncc_c', 'ncc_e'],
93
+ },
94
+ {
95
+ description: {
96
+ de: 'Dieser Cookie von uns speichert die Sprache, in der diese Webseite angezeigt wird.',
97
+ en: "This cookie of ours stores the language that's used to display this website.",
98
+ },
99
+ id: 'l',
100
+ name: {
101
+ de: 'Sprache',
102
+ en: 'Language',
103
+ },
104
+ targetCookieIds: [I18N_COOKIE_NAME],
105
+ },
106
+ {
107
+ description: {
108
+ de: 'Dieser Cookie von uns speichert die Zeitzone, in der sich das Gerät zu befinden scheint.',
109
+ en: 'This cookie of ours saves the timezone in which the device appears to be located.',
110
+ },
111
+ id: 't',
112
+ name: {
113
+ de: 'Zeitzone',
114
+ en: 'Timezone',
115
+ },
116
+ targetCookieIds: [TIMEZONE_COOKIE_NAME],
117
+ },
118
+ ],
119
+ optional: [
120
+ {
121
+ description: {
122
+ de: 'Die Cookies vom Drittanbieter Google ermöglichen die Analyse von Nutzerverhalten. Diese Analyse hilft uns unsere Dienste zu verbessern, indem wir verstehen, wie diese Webseite genutzt wird.',
123
+ en: 'The third-party cookies by Google enable the analysis of user behavior. This analysis helps us to improve our services by understanding how this website is used.',
124
+ },
125
+ id: 'ga',
126
+ links: {
127
+ 'https://policies.google.com/privacy': 'Google Privacy Policy',
128
+ 'https://policies.google.com/terms': 'Google Terms of Service',
129
+ },
130
+ name: 'Analytics',
131
+ targetCookieIds: ['_ga', '_ga_K4R41W62BR'],
132
+ },
133
+ ],
129
134
  },
130
- ],
131
- optional: [
132
- {
133
- description: {
134
- de: 'Die Cookies vom Drittanbieter Google ermöglichen die Analyse von Nutzerverhalten. Diese Analyse hilft uns unsere Dienste zu verbessern, indem wir verstehen, wie diese Webseite genutzt wird.',
135
- en: 'The third-party cookies by Google enable the analysis of user behavior. This analysis helps us to improve our services by understanding how this website is used.',
136
- },
137
- id: 'ga',
138
- links: {
139
- 'https://policies.google.com/privacy': 'Google Privacy Policy',
140
- 'https://policies.google.com/terms': 'Google Terms of Service',
141
- },
142
- name: 'Analytics',
143
- targetCookieIds: ['_ga', '_ga_K4R41W62BR'],
135
+ locales: ['en', 'de'],
136
+ },
137
+ htmlValidator: {
138
+ failOnError: false, // TODO: fix invalid html in nuxt html template (https://github.com/nuxt/nuxt/issues/22526)
139
+ logLevel: 'warning',
140
+ },
141
+ i18n: {
142
+ defaultLocale: 'en', // Must be set for the default prefix_except_default prefix strategy.
143
+ detectBrowserLanguage: {
144
+ cookieKey: I18N_COOKIE_NAME,
145
+ cookieSecure: true,
144
146
  },
145
- ],
146
- },
147
- locales: ['en', 'de'],
148
- },
149
- htmlValidator: {
150
- failOnError: false, // TODO: fix invalid html in nuxt html template (https://github.com/nuxt/nuxt/issues/22526)
151
- logLevel: 'warning',
152
- },
153
- i18n: {
154
- ...I18N_MODULE_CONFIG,
155
- defaultLocale: 'en', // Must be set for the default prefix_except_default prefix strategy.
156
- detectBrowserLanguage: {
157
- cookieKey: I18N_COOKIE_NAME,
158
- cookieSecure: true,
147
+ },
148
+ linkChecker: {
149
+ debug: process.env.NODE_ENV === 'development',
150
+ failOnError: true,
151
+ },
152
+ seoKit: {
153
+ splash: false,
154
+ },
155
+ site: {
156
+ debug: process.env.NODE_ENV === 'development',
157
+ titleSeparator: '·',
158
+ },
159
+ sitemap: {
160
+ exclude: ['/api/pages/**'],
161
+ },
162
+ tailwindcss: {
163
+ cssPath: join(currentDir, './assets/css/tailwind.css'),
164
+ },
159
165
  },
160
- },
161
- linkChecker: {
162
- debug: process.env.NODE_ENV === 'development',
163
- failOnError: true,
164
- },
165
- seoKit: {
166
- splash: false,
167
- },
168
- site: {
169
- debug: process.env.NODE_ENV === 'development',
170
- name: SITE_NAME,
171
- titleSeparator: '·',
172
- url: BASE_URL,
173
- },
174
- sitemap: {
175
- exclude: ['/api/pages/**'],
176
- },
177
- tailwindcss: {
178
- cssPath: join(currentDir, './assets/css/tailwind.css'),
179
- },
180
- })
166
+ VIO_NUXT_BASE_CONFIG({
167
+ baseUrl: BASE_URL,
168
+ siteName: SITE_NAME,
169
+ stagingHost: 'localhost:3000',
170
+ }),
171
+ ),
172
+ )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dargmuesli/nuxt-vio",
3
- "version": "3.0.0-beta.19",
3
+ "version": "3.0.0-beta.20",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,5 +1,14 @@
1
1
  export const SITE_NAME = 'Vio'
2
2
 
3
+ export const BASE_URL =
4
+ (process.env.NUXT_PUBLIC_STACK_DOMAIN ? 'https' : 'http') +
5
+ '://' +
6
+ (process.env.NUXT_PUBLIC_STACK_DOMAIN ||
7
+ `${process.env.HOST || 'localhost'}:${
8
+ !process.env.NODE_ENV || process.env.NODE_ENV === 'development'
9
+ ? '3000'
10
+ : '3001'
11
+ }`)
3
12
  export const CACHE_VERSION = 'bOXMwoKlJr'
4
13
  export const COOKIE_PREFIX = SITE_NAME.toLocaleLowerCase()
5
14
  export const COOKIE_SEPARATOR = '_'
@@ -38,44 +47,36 @@ export const VIO_NUXT_BASE_CONFIG = ({
38
47
  baseUrl?: string
39
48
  siteName: string
40
49
  stagingHost?: string
41
- }) => ({
42
- app: {
43
- head: {
44
- title: SITE_NAME, // fallback data to prevent invalid html at generation
45
- },
46
- },
47
- runtimeConfig: {
48
- public: {
49
- i18n: {
50
- ...(baseUrl ? { baseUrl } : {}),
51
- },
52
- vio: {
53
- ...(stagingHost
54
- ? {
55
- stagingHost:
56
- process.env.NODE_ENV !== 'production' &&
57
- !process.env.NUXT_PUBLIC_STACK_DOMAIN
58
- ? stagingHost
59
- : undefined,
60
- }
61
- : {}),
50
+ }) =>
51
+ ({
52
+ app: {
53
+ head: {
54
+ title: SITE_NAME, // fallback data to prevent invalid html at generation
62
55
  },
63
56
  },
64
- },
65
- typescript: {
66
- tsConfig: {
67
- compilerOptions: {
68
- esModuleInterop: true,
69
- // moduleResolution: 'bundler',
70
- // noErrorTruncation: true,
57
+ runtimeConfig: {
58
+ public: {
59
+ i18n: {
60
+ ...(baseUrl ? { baseUrl } : {}),
61
+ },
62
+ vio: {
63
+ ...(stagingHost
64
+ ? {
65
+ stagingHost:
66
+ process.env.NODE_ENV !== 'production' &&
67
+ !process.env.NUXT_PUBLIC_STACK_DOMAIN
68
+ ? stagingHost
69
+ : undefined,
70
+ }
71
+ : {}),
72
+ },
71
73
  },
72
74
  },
73
- },
74
75
 
75
- // modules
76
- i18n: I18N_MODULE_CONFIG, // `langDir`, `lazy` and `locales` must be configured to extend a layer having lazy-loaded translations (https://v8.i18n.nuxtjs.org/guide/layers#locales)
77
- site: {
78
- name: siteName,
79
- ...(baseUrl ? { url: baseUrl } : {}),
80
- },
81
- })
76
+ // modules
77
+ i18n: I18N_MODULE_CONFIG, // `langDir`, `lazy` and `locales` must be configured to extend a layer having lazy-loaded translations (https://v8.i18n.nuxtjs.org/guide/layers#locales)
78
+ site: {
79
+ name: siteName,
80
+ ...(baseUrl ? { url: baseUrl } : {}),
81
+ },
82
+ }) as Parameters<typeof defineNuxtConfig>[0]
package/utils/routing.ts CHANGED
@@ -1,2 +1,4 @@
1
- export const append = (path: string, pathToAppend: string) =>
2
- path + (path.endsWith('/') ? '' : '/') + pathToAppend
1
+ import { RouteLocationRaw } from '#vue-router'
2
+
3
+ export const append = (path: string, pathToAppend?: RouteLocationRaw) =>
4
+ path + (path.endsWith('/') ? '' : '/') + (pathToAppend ?? '')