@dargmuesli/nuxt-vio 3.0.0-beta.5 → 3.0.0-beta.7

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/app.config.ts CHANGED
@@ -34,7 +34,6 @@ export default defineAppConfig({
34
34
  },
35
35
  },
36
36
  },
37
- stagingHost: undefined,
38
37
  themeColor: undefined,
39
38
  },
40
39
  })
@@ -95,7 +94,6 @@ declare module 'nuxt/schema' {
95
94
  }
96
95
  }
97
96
  }
98
- stagingHost?: string
99
97
  themeColor?: string
100
98
  }
101
99
  }
@@ -53,7 +53,7 @@
53
53
  <VioFormInputIconWrapper v-if="validationProperty.$pending">
54
54
  <IconHourglass
55
55
  class="text-blue-600"
56
- :title="t('globalLoading')"
56
+ :title="t('globalStatusLoading')"
57
57
  />
58
58
  </VioFormInputIconWrapper>
59
59
  <VioFormInputIconWrapper
@@ -91,7 +91,7 @@
91
91
  <div class="md:w-2/3">
92
92
  <slot name="stateInfo" />
93
93
  <VioFormInputStateInfo v-if="value?.$pending">
94
- {{ t('globalLoading') }}
94
+ {{ t('globalStatusLoading') }}
95
95
  </VioFormInputStateInfo>
96
96
  </div>
97
97
  <div class="md:w-1/3" />
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div
3
3
  class="flex h-full items-center justify-center"
4
- :title="t('globalLoading')"
4
+ :title="t('globalStatusLoading')"
5
5
  >
6
6
  <div class="flex items-center justify-center w-1/2">
7
7
  <slot />
@@ -2,7 +2,7 @@
2
2
  <VioLoaderIndicator>
3
3
  <div
4
4
  class="w-1/2 aspect-square animate-ping rounded-full bg-gray-500"
5
- :title="t('globalLoading')"
5
+ :title="t('globalStatusLoading')"
6
6
  />
7
7
  </VioLoaderIndicator>
8
8
  </template>
@@ -1,6 +1,6 @@
1
1
  export const useGetServiceHref = () => {
2
2
  const host = useHost()
3
- const appConfig = useAppConfig()
3
+ const runtimeConfig = useRuntimeConfig()
4
4
 
5
5
  return ({
6
6
  isSsr = true,
@@ -16,6 +16,6 @@ export const useGetServiceHref = () => {
16
16
  isSsr,
17
17
  name,
18
18
  port,
19
- stagingHost: appConfig.vio.stagingHost,
19
+ stagingHost: runtimeConfig.public.stagingHost,
20
20
  })
21
21
  }
package/locales/de.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
- "globalLoading": "Lade...",
3
2
  "globalPlaceholderUrl": "https://websei.te",
4
3
  "globalStatusError": "Fehler",
4
+ "globalStatusLoading": "Lade...",
5
5
  "globalValidationFailed": "Bitte überprüfe deine Eingaben 🙈",
6
6
  "globalValidationFormatUrlHttps": "Muss mit \"https://\" beginnen",
7
7
  "globalValidationLength": "Zu lang",
package/locales/en.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
- "globalLoading": "Loading...",
3
2
  "globalPlaceholderUrl": "https://websi.te",
4
3
  "globalStatusError": "Error",
4
+ "globalStatusLoading": "Loading...",
5
5
  "globalValidationFailed": "Please check your input 🙈",
6
6
  "globalValidationFormatUrlHttps": "Must start with \"https://\"",
7
7
  "globalValidationLength": "Too long",
package/nuxt.config.ts CHANGED
@@ -65,6 +65,11 @@ export default defineNuxtConfig({
65
65
  },
66
66
  isInProduction: process.env.NODE_ENV === 'production',
67
67
  isTesting: false,
68
+ stagingHost:
69
+ process.env.NODE_ENV !== 'production' &&
70
+ !process.env.NUXT_PUBLIC_STACK_DOMAIN
71
+ ? 'localhost:3000'
72
+ : undefined,
68
73
  },
69
74
  },
70
75
  typescript: {
@@ -164,7 +169,7 @@ export default defineNuxtConfig({
164
169
  url: BASE_URL,
165
170
  },
166
171
  sitemap: {
167
- exclude: ['/api/**'],
172
+ exclude: ['/api/pages/**'],
168
173
  },
169
174
  tailwindcss: {
170
175
  cssPath: join(currentDir, './assets/css/tailwind.css'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dargmuesli/nuxt-vio",
3
- "version": "3.0.0-beta.5",
3
+ "version": "3.0.0-beta.7",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -29,17 +29,17 @@
29
29
  ],
30
30
  "main": "nuxt.config.ts",
31
31
  "scripts": {
32
- "dev": "nuxi dev .playground",
33
- "build": "nuxi build .playground",
34
- "generate": "nuxi generate .playground",
35
- "preview": "nuxi preview .playground",
36
- "prepare": "nuxi prepare .playground",
37
- "lint": "pnpm lint:js && pnpm lint:ts && pnpm lint:style",
32
+ "build": "nuxt build .playground",
33
+ "dev": "nuxt dev .playground",
34
+ "generate": "nuxt generate .playground",
38
35
  "lint:fix": "pnpm lint:js --fix && pnpm lint:ts --fix && pnpm lint:style --fix",
39
36
  "lint:js": "eslint --cache --ext .js,.ts,.vue --ignore-path .gitignore .",
40
37
  "lint:staged": "lint-staged",
41
38
  "lint:style": "stylelint **/*.{vue,css} --ignore-path .gitignore",
42
- "lint:ts": "nuxi typecheck"
39
+ "lint:ts": "nuxt typecheck",
40
+ "lint": "pnpm lint:js && pnpm lint:ts && pnpm lint:style",
41
+ "prepare": "nuxt prepare .playground",
42
+ "preview": "nuxt preview .playground"
43
43
  },
44
44
  "dependencies": {
45
45
  "@dargmuesli/nuxt-cookie-control": "6.1.5",
@@ -57,8 +57,9 @@
57
57
  "@urql/exchange-graphcache": "6.3.1",
58
58
  "@urql/vue": "1.1.2",
59
59
  "@vuelidate/core": "2.0.3",
60
+ "@vuelidate/validators": "2.0.3",
60
61
  "clipboard": "2.0.11",
61
- "dayjs": "1.11.9",
62
+ "dayjs": "2.0.0-alpha.4",
62
63
  "is-https": "4.0.0",
63
64
  "jose": "4.14.4",
64
65
  "marked": "7.0.1",
@@ -85,7 +86,6 @@
85
86
  "stylelint-config-standard": "34.0.0",
86
87
  "stylelint-no-unsupported-browser-features": "7.0.0",
87
88
  "tailwindcss": "3.3.3",
88
- "typescript": "5.1.6",
89
89
  "vue": "3.3.4",
90
90
  "vue-tsc": "1.8.8"
91
91
  }
package/plugins/dayjs.ts CHANGED
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/no-named-as-default-member */
2
1
  import dayjs from 'dayjs'
3
2
 
4
3
  // workaround for [1]
@@ -6,7 +6,11 @@ import { TIMEZONE_HEADER_KEY } from '../../utils/constants'
6
6
  import { getTimezone } from '../../utils/networking'
7
7
 
8
8
  export default defineEventHandler(async (event) => {
9
- setRequestHeader(event, TIMEZONE_HEADER_KEY, await getTimezone(event))
9
+ setRequestHeader(
10
+ event,
11
+ TIMEZONE_HEADER_KEY,
12
+ (await getTimezone(event)) || 'UTC',
13
+ )
10
14
  // setContentSecurityPolicy(event);
11
15
  setResponseHeaders(event)
12
16
  })
@@ -1,3 +1,3 @@
1
1
  {
2
- "extends": "../.nuxt/tsconfig.server.json"
2
+ "extends": "../.playground/.nuxt/tsconfig.server.json"
3
3
  }
@@ -0,0 +1,2 @@
1
+ export const getCspAsString = (csp = {} as Record<string, Array<string>>) =>
2
+ Object.keys(csp).reduce((p, c) => (p += `${c} ${csp[c].join(' ')};`), '')
@@ -1,8 +1,8 @@
1
- import { Config } from 'tailwindcss'
2
- import colors from 'tailwindcss/colors'
3
- import { PluginAPI } from 'tailwindcss/types/config'
4
1
  import formsPlugin from '@tailwindcss/forms'
5
2
  import typographyPlugin from '@tailwindcss/typography'
3
+ import type { Config } from 'tailwindcss'
4
+ import colors from 'tailwindcss/colors'
5
+ import type { PluginAPI } from 'tailwindcss/types/config'
6
6
 
7
7
  const heading = (theme: PluginAPI['theme']): Record<string, string> => ({
8
8
  fontWeight: theme('fontWeight.bold'),
package/types/api.d.ts CHANGED
@@ -1,7 +1,9 @@
1
- export type BackendError = CombinedError | { errcode: string; message: string }
1
+ import type { CombinedError } from '@urql/core'
2
2
 
3
3
  export type ApiData = ComputedRef<{
4
4
  data?: Object
5
5
  errors: BackendError[]
6
6
  isFetching: boolean
7
7
  }>
8
+
9
+ export type BackendError = CombinedError | { errcode: string; message: string }
@@ -60,9 +60,6 @@ export const getCombinedErrorMessages = (
60
60
  return errorMessages
61
61
  }
62
62
 
63
- export const getCspAsString = (csp = {} as Record<string, Array<string>>) =>
64
- Object.keys(csp).reduce((p, c) => (p += `${c} ${csp[c].join(' ')};`), '')
65
-
66
63
  export const getDomainTldPort = (host: string) => {
67
64
  const hostParts = host.split('.')
68
65
 
@@ -106,10 +103,22 @@ export const getServiceHref = ({
106
103
  }
107
104
  }
108
105
 
109
- export const getTimezone = async (event: H3Event) =>
110
- getCookie(event, TIMEZONE_COOKIE_NAME) ||
111
- (
112
- await ofetch(
106
+ export const getTimezone = async (event: H3Event) => {
107
+ const timezoneCookie = getCookie(event, TIMEZONE_COOKIE_NAME)
108
+
109
+ if (timezoneCookie) {
110
+ return timezoneCookie
111
+ }
112
+
113
+ if (event.node.req.headers['x-real-ip']) {
114
+ const ipApiResult = await ofetch<{ timezone: string }>(
113
115
  `http://ip-api.com/json/${event.node.req.headers['x-real-ip']}`,
114
- )
115
- ).timezone
116
+ ).catch(() => {})
117
+
118
+ if (ipApiResult) {
119
+ return ipApiResult.timezone
120
+ }
121
+ }
122
+
123
+ return undefined
124
+ }